From 158d1b26b0455c2214741ebc4406130a559b8f8f Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Sun, 26 Jun 2022 08:57:37 -0700 Subject: [PATCH] PlayState rename (#835) * PlayState rename * Make this work with the latest master and run format * Respond to hensldm's review * Respond to Elliptic's review * Add Effect_GetPlayState to namefixer.py * Add missed comma --- CONTRIBUTING.md | 4 +- docs/STYLE.md | 10 +- docs/tutorial/advanced_control_flow.md | 278 +-- docs/tutorial/beginning_decomp.md | 60 +- docs/tutorial/diff_and_permuter.md | 26 +- docs/tutorial/documenting.md | 90 +- docs/tutorial/draw_functions.md | 68 +- docs/tutorial/introduction.md | 8 +- docs/tutorial/object_decomp_example.md | 2 +- docs/tutorial/other_functions.md | 98 +- docs/tutorial/types_structs_padding.md | 2 +- include/functions.h | 1576 ++++++++--------- include/macros.h | 6 +- include/variables.h | 6 +- include/z64.h | 46 +- include/z64actor.h | 10 +- include/z64animation.h | 28 +- include/z64bgcheck.h | 4 +- include/z64curve.h | 14 +- include/z64effect.h | 10 +- include/z64light.h | 2 +- include/z64player.h | 2 +- include/z64save.h | 8 +- include/z64skin.h | 14 +- include/z64subs.h | 58 +- include/z_en_hy_code.h | 24 +- src/code/code_800E8EA0.c | 25 +- src/code/code_8012EC80.c | 22 +- src/code/flg_set.c | 6 +- src/code/z_actor.c | 1067 ++++++----- src/code/z_bg_item.c | 14 +- src/code/z_bgcheck.c | 182 +- src/code/z_cheap_proc.c | 16 +- src/code/z_collision_check.c | 901 +++++----- src/code/z_construct.c | 2 +- src/code/z_debug_display.c | 42 +- src/code/z_demo.c | 562 +++--- src/code/z_eff_footmark.c | 24 +- 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 | 26 +- src/code/z_effect_soft_sprite.c | 36 +- src/code/z_effect_soft_sprite_old_init.c | 344 ++-- src/code/z_elf_message.c | 6 +- src/code/z_en_a_keep.c | 32 +- src/code/z_en_hy_code.c | 68 +- src/code/z_en_item00.c | 306 ++-- src/code/z_env_flags.c | 18 +- src/code/z_face_reaction.c | 6 +- src/code/z_fcurve_data_skelanime.c | 36 +- src/code/z_fireobj.c | 61 +- src/code/z_game_dlftbls.c | 2 +- src/code/z_game_over.c | 24 +- src/code/z_kaleido_manager.c | 4 +- src/code/z_kaleido_scope_call.c | 34 +- src/code/z_kaleido_setup.c | 39 +- src/code/z_kanfont.c | 6 +- src/code/z_lifemeter.c | 40 +- src/code/z_lights.c | 39 +- src/code/z_message.c | 178 +- src/code/z_message_nes.c | 66 +- src/code/z_message_staff.c | 4 +- src/code/z_path.c | 4 +- src/code/z_play.c | 126 +- src/code/z_player_call.c | 32 +- src/code/z_quake.c | 30 +- src/code/z_rcp.c | 4 +- src/code/z_room.c | 68 +- src/code/z_scene.c | 240 +-- src/code/z_scene_proc.c | 237 ++- src/code/z_schedule.c | 50 +- src/code/z_skelanime.c | 379 ++-- src/code/z_skin.c | 24 +- src/code/z_skin_awb.c | 2 +- src/code/z_snap.c | 26 +- src/code/z_sound_source.c | 32 +- src/code/z_sram_NES.c | 35 +- src/code/z_sub_s.c | 151 +- src/code/z_vr_box.c | 10 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 71 +- .../actors/ovl_Arms_Hook/z_arms_hook.h | 2 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 59 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.h | 2 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 44 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.h | 2 +- .../actors/ovl_Arrow_Light/z_arrow_light.c | 44 +- .../actors/ovl_Arrow_Light/z_arrow_light.h | 2 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c | 80 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h | 2 +- .../ovl_Bg_Botihasira/z_bg_botihasira.c | 8 +- .../ovl_Bg_Botihasira/z_bg_botihasira.h | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 162 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.h | 6 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c | 8 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h | 2 +- .../ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c | 62 +- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 58 +- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.h | 2 +- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c | 6 +- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h | 2 +- .../ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c | 113 +- .../ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h | 2 +- .../z_bg_dblue_elevator.c | 8 +- .../z_bg_dblue_elevator.h | 2 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 210 ++- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h | 2 +- .../z_bg_dblue_waterfall.c | 180 +- .../z_bg_dblue_waterfall.h | 2 +- .../ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c | 8 +- .../ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.h | 2 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 26 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 2 +- .../actors/ovl_Bg_F40_Block/z_bg_f40_block.c | 96 +- .../actors/ovl_Bg_F40_Block/z_bg_f40_block.h | 2 +- .../actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c | 8 +- .../actors/ovl_Bg_F40_Flift/z_bg_f40_flift.h | 2 +- .../ovl_Bg_F40_Switch/z_bg_f40_switch.c | 74 +- .../ovl_Bg_F40_Switch/z_bg_f40_switch.h | 2 +- .../ovl_Bg_F40_Swlift/z_bg_f40_swlift.c | 8 +- .../actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c | 14 +- .../actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h | 2 +- .../actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c | 28 +- .../actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c | 8 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c | 86 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h | 2 +- .../ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c | 8 +- .../ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h | 2 +- .../ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c | 54 +- .../ovl_Bg_Haka_Curtain/z_bg_haka_curtain.h | 2 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c | 40 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h | 2 +- .../z_bg_hakugin_bombwall.c | 104 +- .../z_bg_hakugin_bombwall.h | 6 +- .../z_bg_hakugin_elvpole.c | 10 +- .../z_bg_hakugin_elvpole.h | 2 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 178 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h | 2 +- .../z_bg_hakugin_switch.c | 162 +- .../z_bg_hakugin_switch.h | 4 +- .../actors/ovl_Bg_Icefloe/z_bg_icefloe.c | 8 +- .../actors/ovl_Bg_Icefloe/z_bg_icefloe.h | 2 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 88 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.h | 2 +- .../ovl_Bg_Ikana_Block/z_bg_ikana_block.c | 100 +- .../ovl_Bg_Ikana_Block/z_bg_ikana_block.h | 2 +- .../z_bg_ikana_bombwall.c | 78 +- .../z_bg_ikana_bombwall.h | 2 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c | 76 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.h | 2 +- .../ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c | 8 +- .../ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.h | 2 +- .../actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c | 42 +- .../actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h | 2 +- .../z_bg_ikana_rotaryroom.c | 164 +- .../z_bg_ikana_rotaryroom.h | 6 +- .../ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c | 84 +- .../ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.h | 2 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 90 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h | 2 +- .../actors/ovl_Bg_Ikninside/z_bg_ikninside.c | 52 +- .../actors/ovl_Bg_Ikninside/z_bg_ikninside.h | 2 +- .../ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c | 20 +- .../ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h | 2 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c | 82 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.h | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 162 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.h | 2 +- .../ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c | 20 +- .../ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c | 46 +- .../ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h | 2 +- .../ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c | 28 +- .../ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c | 69 +- .../ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h | 2 +- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 62 +- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.h | 2 +- .../ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c | 18 +- .../ovl_Bg_Kin2_Picture/z_bg_kin2_picture.h | 2 +- .../ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c | 67 +- .../ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.h | 2 +- .../actors/ovl_Bg_Ladder/z_bg_ladder.c | 62 +- .../actors/ovl_Bg_Ladder/z_bg_ladder.h | 2 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.c | 8 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.h | 2 +- .../actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c | 18 +- src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c | 48 +- src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h | 2 +- .../ovl_Bg_Market_Step/z_bg_market_step.c | 12 +- .../ovl_Bg_Mbar_Chair/z_bg_mbar_chair.c | 22 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c | 108 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h | 2 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.c | 14 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.h | 2 +- .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.c | 30 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c | 31 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h | 2 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 90 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.h | 2 +- .../ovl_Bg_Spout_Fire/z_bg_spout_fire.c | 12 +- .../ovl_Bg_Spout_Fire/z_bg_spout_fire.h | 2 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 41 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.h | 2 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 6 +- src/overlays/actors/ovl_Boss_01/z_boss_01.c | 50 +- src/overlays/actors/ovl_Boss_01/z_boss_01.h | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 315 ++-- src/overlays/actors/ovl_Boss_02/z_boss_02.h | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 468 +++-- src/overlays/actors/ovl_Boss_03/z_boss_03.h | 2 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 147 +- src/overlays/actors/ovl_Boss_04/z_boss_04.h | 2 +- src/overlays/actors/ovl_Boss_05/z_boss_05.c | 32 +- src/overlays/actors/ovl_Boss_05/z_boss_05.h | 2 +- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 125 +- src/overlays/actors/ovl_Boss_06/z_boss_06.h | 2 +- src/overlays/actors/ovl_Boss_07/z_boss_07.c | 80 +- src/overlays/actors/ovl_Boss_07/z_boss_07.h | 2 +- .../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 38 +- .../actors/ovl_Boss_Hakugin/z_boss_hakugin.h | 2 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 90 +- .../actors/ovl_Demo_Effect/z_demo_effect.h | 2 +- .../actors/ovl_Demo_Getitem/z_demo_getitem.c | 6 +- .../actors/ovl_Demo_Getitem/z_demo_getitem.h | 2 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 132 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.h | 2 +- .../actors/ovl_Demo_Moonend/z_demo_moonend.c | 8 +- .../actors/ovl_Demo_Moonend/z_demo_moonend.h | 2 +- src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c | 16 +- .../actors/ovl_Demo_Syoten/z_demo_syoten.c | 149 +- .../actors/ovl_Demo_Syoten/z_demo_syoten.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_Dm_Ah/z_dm_ah.c | 12 +- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h | 2 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.c | 10 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.h | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 116 +- src/overlays/actors/ovl_Dm_An/z_dm_an.h | 2 +- src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c | 66 +- src/overlays/actors/ovl_Dm_Bal/z_dm_bal.h | 2 +- .../actors/ovl_Dm_Char00/z_dm_char00.c | 228 ++- .../actors/ovl_Dm_Char00/z_dm_char00.h | 2 +- .../actors/ovl_Dm_Char01/z_dm_char01.c | 171 +- .../actors/ovl_Dm_Char01/z_dm_char01.h | 2 +- .../actors/ovl_Dm_Char02/z_dm_char02.c | 10 +- .../actors/ovl_Dm_Char02/z_dm_char02.h | 2 +- .../actors/ovl_Dm_Char03/z_dm_char03.c | 14 +- .../actors/ovl_Dm_Char03/z_dm_char03.h | 2 +- .../actors/ovl_Dm_Char04/z_dm_char04.c | 8 +- .../actors/ovl_Dm_Char04/z_dm_char04.h | 2 +- .../actors/ovl_Dm_Char05/z_dm_char05.c | 405 +++-- .../actors/ovl_Dm_Char05/z_dm_char05.h | 2 +- .../actors/ovl_Dm_Char06/z_dm_char06.c | 10 +- .../actors/ovl_Dm_Char06/z_dm_char06.h | 2 +- .../actors/ovl_Dm_Char07/z_dm_char07.c | 40 +- .../actors/ovl_Dm_Char07/z_dm_char07.h | 2 +- .../actors/ovl_Dm_Char08/z_dm_char08.c | 8 +- .../actors/ovl_Dm_Char08/z_dm_char08.h | 2 +- .../actors/ovl_Dm_Char09/z_dm_char09.c | 14 +- .../actors/ovl_Dm_Char09/z_dm_char09.h | 2 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 116 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h | 2 +- src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c | 16 +- src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h | 2 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c | 41 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h | 2 +- .../actors/ovl_Dm_Opstage/z_dm_opstage.c | 60 +- .../actors/ovl_Dm_Opstage/z_dm_opstage.h | 2 +- .../actors/ovl_Dm_Ravine/z_dm_ravine.c | 36 +- .../actors/ovl_Dm_Ravine/z_dm_ravine.h | 2 +- src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c | 42 +- src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h | 2 +- .../actors/ovl_Dm_Statue/z_dm_statue.c | 20 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 462 +++-- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h | 2 +- src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c | 12 +- src/overlays/actors/ovl_Dm_Tag/z_dm_tag.h | 2 +- src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.c | 8 +- src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c | 54 +- src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 60 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.h | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 219 ++- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- .../actors/ovl_Door_Spiral/z_door_spiral.c | 87 +- .../actors/ovl_Door_Spiral/z_door_spiral.h | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 499 +++--- .../actors/ovl_Door_Warp1/z_door_warp1.h | 2 +- .../actors/ovl_Eff_Change/z_eff_change.c | 6 +- .../actors/ovl_Eff_Change/z_eff_change.h | 2 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 58 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h | 2 +- .../z_eff_kamejima_wave.c | 6 +- .../z_eff_kamejima_wave.h | 2 +- .../actors/ovl_Eff_Lastday/z_eff_lastday.c | 16 +- .../actors/ovl_Eff_Lastday/z_eff_lastday.h | 2 +- src/overlays/actors/ovl_Eff_Stk/z_eff_stk.c | 8 +- src/overlays/actors/ovl_Eff_Stk/z_eff_stk.h | 2 +- .../actors/ovl_Eff_Zoraband/z_eff_zoraband.c | 10 +- .../actors/ovl_Eff_Zoraband/z_eff_zoraband.h | 2 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 6 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h | 2 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 8 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h | 2 +- src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c | 6 +- src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.h | 2 +- src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c | 10 +- src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.h | 2 +- src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.c | 8 +- src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.h | 2 +- src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c | 88 +- src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.h | 2 +- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 133 +- src/overlays/actors/ovl_En_Ah/z_en_ah.h | 4 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 279 ++- .../ovl_En_Akindonuts/z_en_akindonuts.h | 4 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 157 +- src/overlays/actors/ovl_En_Al/z_en_al.h | 6 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 138 +- src/overlays/actors/ovl_En_Am/z_en_am.h | 2 +- src/overlays/actors/ovl_En_An/z_en_an.c | 12 +- src/overlays/actors/ovl_En_An/z_en_an.h | 2 +- src/overlays/actors/ovl_En_And/z_en_and.c | 10 +- src/overlays/actors/ovl_En_And/z_en_and.h | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 96 +- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 2 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 309 ++-- .../actors/ovl_En_Aob_01/z_en_aob_01.h | 2 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 182 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.h | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 79 +- .../ovl_En_Attack_Niw/z_en_attack_niw.h | 2 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 28 +- src/overlays/actors/ovl_En_Az/z_en_az.h | 2 +- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 237 ++- src/overlays/actors/ovl_En_Baba/z_en_baba.h | 2 +- src/overlays/actors/ovl_En_Baguo/z_en_baguo.c | 113 +- src/overlays/actors/ovl_En_Baguo/z_en_baguo.h | 2 +- .../actors/ovl_En_Baisen/z_en_baisen.c | 81 +- .../actors/ovl_En_Baisen/z_en_baisen.h | 2 +- src/overlays/actors/ovl_En_Bal/z_en_bal.c | 8 +- src/overlays/actors/ovl_En_Bal/z_en_bal.h | 2 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 16 +- src/overlays/actors/ovl_En_Bat/z_en_bat.h | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 132 +- src/overlays/actors/ovl_En_Bb/z_en_bb.h | 2 +- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 128 +- .../actors/ovl_En_Bba_01/z_en_bba_01.h | 2 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 145 +- .../actors/ovl_En_Bbfall/z_en_bbfall.h | 2 +- src/overlays/actors/ovl_En_Bee/z_en_bee.c | 12 +- src/overlays/actors/ovl_En_Bee/z_en_bee.h | 2 +- src/overlays/actors/ovl_En_Bh/z_en_bh.c | 8 +- src/overlays/actors/ovl_En_Bh/z_en_bh.h | 2 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 219 ++- .../actors/ovl_En_Bigokuta/z_en_bigokuta.h | 4 +- .../actors/ovl_En_Bigpamet/z_en_bigpamet.c | 36 +- .../actors/ovl_En_Bigpamet/z_en_bigpamet.h | 2 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 352 ++-- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h | 2 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 556 +++--- .../actors/ovl_En_Bigslime/z_en_bigslime.h | 2 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 168 +- .../actors/ovl_En_Bji_01/z_en_bji_01.h | 2 +- src/overlays/actors/ovl_En_Bjt/z_en_bjt.c | 12 +- src/overlays/actors/ovl_En_Bjt/z_en_bjt.h | 2 +- .../actors/ovl_En_Boj_01/z_en_boj_01.c | 16 +- .../actors/ovl_En_Boj_02/z_en_boj_02.c | 16 +- .../actors/ovl_En_Boj_03/z_en_boj_03.c | 16 +- .../actors/ovl_En_Boj_04/z_en_boj_04.c | 16 +- .../actors/ovl_En_Boj_05/z_en_boj_05.c | 16 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 197 +-- src/overlays/actors/ovl_En_Bom/z_en_bom.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 192 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 142 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.h | 2 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 14 +- .../actors/ovl_En_Bombal/z_en_bombal.h | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 103 +- .../actors/ovl_En_Bombers/z_en_bombers.h | 2 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 99 +- .../actors/ovl_En_Bombers2/z_en_bombers2.h | 2 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 159 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.h | 2 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 245 ++- .../actors/ovl_En_Bomjima/z_en_bomjima.h | 2 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 207 ++- .../actors/ovl_En_Bomjimb/z_en_bomjimb.h | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 71 +- src/overlays/actors/ovl_En_Boom/z_en_boom.h | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 207 ++- src/overlays/actors/ovl_En_Box/z_en_box.h | 4 +- src/overlays/actors/ovl_En_Bsb/z_en_bsb.c | 46 +- src/overlays/actors/ovl_En_Bsb/z_en_bsb.h | 2 +- src/overlays/actors/ovl_En_Bu/z_en_bu.c | 28 +- src/overlays/actors/ovl_En_Bu/z_en_bu.h | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 14 +- .../actors/ovl_En_Bubble/z_en_bubble.h | 2 +- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 74 +- src/overlays/actors/ovl_En_Butte/z_en_butte.h | 2 +- src/overlays/actors/ovl_En_Cha/z_en_cha.c | 40 +- src/overlays/actors/ovl_En_Cha/z_en_cha.h | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 92 +- .../actors/ovl_En_Cne_01/z_en_cne_01.c | 129 +- .../actors/ovl_En_Cne_01/z_en_cne_01.h | 2 +- .../actors/ovl_En_Col_Man/z_en_col_man.c | 110 +- .../actors/ovl_En_Col_Man/z_en_col_man.h | 2 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 138 +- src/overlays/actors/ovl_En_Cow/z_en_cow.h | 2 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 104 +- src/overlays/actors/ovl_En_Crow/z_en_crow.h | 2 +- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 158 +- src/overlays/actors/ovl_En_Dai/z_en_dai.h | 2 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 69 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.h | 2 +- .../actors/ovl_En_Daiku2/z_en_daiku2.c | 158 +- .../actors/ovl_En_Daiku2/z_en_daiku2.h | 2 +- src/overlays/actors/ovl_En_Death/z_en_death.c | 48 +- src/overlays/actors/ovl_En_Death/z_en_death.h | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 38 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 2 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 149 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.h | 2 +- .../ovl_En_Demo_heishi/z_en_demo_heishi.c | 56 +- .../ovl_En_Demo_heishi/z_en_demo_heishi.h | 2 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 284 +-- src/overlays/actors/ovl_En_Dg/z_en_dg.h | 2 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 340 ++-- .../actors/ovl_En_Dinofos/z_en_dinofos.h | 2 +- src/overlays/actors/ovl_En_Dnb/z_en_dnb.c | 65 +- src/overlays/actors/ovl_En_Dnh/z_en_dnh.c | 12 +- src/overlays/actors/ovl_En_Dnh/z_en_dnh.h | 2 +- src/overlays/actors/ovl_En_Dnk/z_en_dnk.c | 116 +- src/overlays/actors/ovl_En_Dnk/z_en_dnk.h | 2 +- src/overlays/actors/ovl_En_Dno/z_en_dno.c | 348 ++-- src/overlays/actors/ovl_En_Dno/z_en_dno.h | 2 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 121 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.h | 2 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 109 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.h | 4 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 143 +- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 4 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 211 ++- .../actors/ovl_En_Dodongo/z_en_dodongo.h | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 113 +- src/overlays/actors/ovl_En_Door/z_en_door.h | 2 +- .../actors/ovl_En_Door_Etc/z_en_door_etc.c | 6 +- .../actors/ovl_En_Door_Etc/z_en_door_etc.h | 2 +- .../actors/ovl_En_Dragon/z_en_dragon.c | 123 +- .../actors/ovl_En_Dragon/z_en_dragon.h | 2 +- src/overlays/actors/ovl_En_Drs/z_en_drs.c | 58 +- src/overlays/actors/ovl_En_Drs/z_en_drs.h | 2 +- src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c | 8 +- src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h | 2 +- src/overlays/actors/ovl_En_Dt/z_en_dt.c | 8 +- src/overlays/actors/ovl_En_Dt/z_en_dt.h | 2 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 36 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.h | 2 +- .../actors/ovl_En_Egblock/z_en_egblock.c | 8 +- .../actors/ovl_En_Egblock/z_en_egblock.h | 2 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 8 +- src/overlays/actors/ovl_En_Egol/z_en_egol.h | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 377 ++-- src/overlays/actors/ovl_En_Elf/z_en_elf.h | 4 +- .../actors/ovl_En_Elfbub/z_en_elfbub.c | 58 +- .../actors/ovl_En_Elfbub/z_en_elfbub.h | 2 +- .../actors/ovl_En_Elfgrp/z_en_elfgrp.c | 209 ++- .../actors/ovl_En_Elfgrp/z_en_elfgrp.h | 2 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 168 +- .../actors/ovl_En_Elforg/z_en_elforg.h | 2 +- .../actors/ovl_En_Encount1/z_en_encount1.c | 6 +- .../actors/ovl_En_Encount1/z_en_encount1.h | 2 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 75 +- .../actors/ovl_En_Encount2/z_en_encount2.h | 2 +- .../actors/ovl_En_Encount3/z_en_encount3.c | 14 +- .../actors/ovl_En_Encount3/z_en_encount3.h | 2 +- .../actors/ovl_En_Encount4/z_en_encount4.c | 16 +- .../actors/ovl_En_Encount4/z_en_encount4.h | 2 +- .../ovl_En_Ending_Hero/z_en_ending_hero.c | 38 +- .../ovl_En_Ending_Hero/z_en_ending_hero.h | 2 +- .../ovl_En_Ending_Hero2/z_en_ending_hero2.c | 34 +- .../ovl_En_Ending_Hero2/z_en_ending_hero2.h | 2 +- .../ovl_En_Ending_Hero3/z_en_ending_hero3.c | 36 +- .../ovl_En_Ending_Hero3/z_en_ending_hero3.h | 2 +- .../ovl_En_Ending_Hero4/z_en_ending_hero4.c | 34 +- .../ovl_En_Ending_Hero4/z_en_ending_hero4.h | 2 +- .../ovl_En_Ending_Hero5/z_en_ending_hero5.c | 46 +- .../ovl_En_Ending_Hero5/z_en_ending_hero5.h | 2 +- .../ovl_En_Ending_Hero6/z_en_ending_hero6.c | 46 +- .../ovl_En_Ending_Hero6/z_en_ending_hero6.h | 2 +- .../actors/ovl_En_Estone/z_en_estone.c | 12 +- .../actors/ovl_En_Estone/z_en_estone.h | 2 +- src/overlays/actors/ovl_En_Fall/z_en_fall.c | 305 ++-- src/overlays/actors/ovl_En_Fall/z_en_fall.h | 2 +- src/overlays/actors/ovl_En_Fall2/z_en_fall2.c | 8 +- src/overlays/actors/ovl_En_Fall2/z_en_fall2.h | 2 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 164 +- src/overlays/actors/ovl_En_Famos/z_en_famos.h | 2 +- src/overlays/actors/ovl_En_Fg/z_en_fg.c | 92 +- src/overlays/actors/ovl_En_Fg/z_en_fg.h | 2 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 16 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 133 +- .../actors/ovl_En_Firefly/z_en_firefly.h | 2 +- .../actors/ovl_En_Firefly2/z_en_firefly2.c | 16 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 146 +- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 187 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.h | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 836 +++++---- .../actors/ovl_En_Fishing/z_en_fishing.h | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 241 ++- .../actors/ovl_En_Floormas/z_en_floormas.h | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 16 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 529 +++--- src/overlays/actors/ovl_En_Fsn/z_en_fsn.h | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 513 +++--- src/overlays/actors/ovl_En_Fu/z_en_fu.h | 2 +- .../actors/ovl_En_Fu_Kago/z_en_fu_kago.c | 94 +- .../actors/ovl_En_Fu_Kago/z_en_fu_kago.h | 2 +- .../actors/ovl_En_Fu_Mato/z_en_fu_mato.c | 102 +- .../actors/ovl_En_Fu_Mato/z_en_fu_mato.h | 2 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 187 +- src/overlays/actors/ovl_En_Fz/z_en_fz.h | 2 +- .../actors/ovl_En_Gakufu/z_en_gakufu.c | 70 +- .../actors/ovl_En_Gakufu/z_en_gakufu.h | 2 +- .../actors/ovl_En_Gamelupy/z_en_gamelupy.c | 14 +- .../actors/ovl_En_Gamelupy/z_en_gamelupy.h | 2 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 351 ++-- src/overlays/actors/ovl_En_Gb2/z_en_gb2.h | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 8 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 28 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 8 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 2 +- src/overlays/actors/ovl_En_Geg/z_en_geg.c | 294 +-- src/overlays/actors/ovl_En_Geg/z_en_geg.h | 2 +- src/overlays/actors/ovl_En_Gg/z_en_gg.c | 203 ++- src/overlays/actors/ovl_En_Gg/z_en_gg.h | 4 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 117 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.h | 2 +- src/overlays/actors/ovl_En_Giant/z_en_giant.c | 89 +- src/overlays/actors/ovl_En_Giant/z_en_giant.h | 2 +- .../actors/ovl_En_Ginko_Man/z_en_ginko_man.c | 295 ++- .../actors/ovl_En_Ginko_Man/z_en_ginko_man.h | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 282 +-- src/overlays/actors/ovl_En_GirlA/z_en_girla.h | 8 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 307 ++-- src/overlays/actors/ovl_En_Gk/z_en_gk.h | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 378 ++-- src/overlays/actors/ovl_En_Gm/z_en_gm.h | 6 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 505 +++--- src/overlays/actors/ovl_En_Go/z_en_go.h | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 238 ++- .../actors/ovl_En_Goroiwa/z_en_goroiwa.h | 2 +- .../ovl_En_Grasshopper/z_en_grasshopper.c | 8 +- .../ovl_En_Grasshopper/z_en_grasshopper.h | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 280 ++- src/overlays/actors/ovl_En_Gs/z_en_gs.h | 2 +- .../ovl_En_Guard_Nuts/z_en_guard_nuts.c | 93 +- .../ovl_En_Guard_Nuts/z_en_guard_nuts.h | 2 +- .../actors/ovl_En_Guruguru/z_en_guruguru.c | 107 +- .../actors/ovl_En_Guruguru/z_en_guruguru.h | 2 +- .../actors/ovl_En_Hakurock/z_en_hakurock.c | 84 +- .../actors/ovl_En_Hakurock/z_en_hakurock.h | 2 +- .../actors/ovl_En_Hanabi/z_en_hanabi.c | 73 +- .../actors/ovl_En_Hanabi/z_en_hanabi.h | 2 +- src/overlays/actors/ovl_En_Hata/z_en_hata.c | 39 +- .../actors/ovl_En_Heishi/z_en_heishi.c | 41 +- .../actors/ovl_En_Heishi/z_en_heishi.h | 2 +- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 130 +- src/overlays/actors/ovl_En_Hg/z_en_hg.h | 2 +- src/overlays/actors/ovl_En_Hgo/z_en_hgo.c | 146 +- src/overlays/actors/ovl_En_Hgo/z_en_hgo.h | 2 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 111 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.h | 2 +- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 229 ++- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.h | 2 +- .../actors/ovl_En_Hit_Tag/z_en_hit_tag.c | 28 +- .../actors/ovl_En_Hit_Tag/z_en_hit_tag.h | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 146 +- src/overlays/actors/ovl_En_Holl/z_en_holl.h | 2 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 36 +- .../actors/ovl_En_Honotrap/z_en_honotrap.h | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 814 +++++---- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 6 +- .../z_en_horse_game_check.c | 176 +- .../z_en_horse_game_check.h | 2 +- .../z_en_horse_link_child.c | 99 +- .../z_en_horse_link_child.h | 2 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 142 +- src/overlays/actors/ovl_En_Hs/z_en_hs.h | 2 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.c | 22 +- src/overlays/actors/ovl_En_Hs2/z_en_hs2.h | 2 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 191 +- src/overlays/actors/ovl_En_Ig/z_en_ig.h | 6 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 8 +- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 552 +++--- src/overlays/actors/ovl_En_In/z_en_in.h | 2 +- .../actors/ovl_En_Insect/z_en_insect.c | 84 +- .../actors/ovl_En_Insect/z_en_insect.h | 2 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 1109 ++++++------ .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 6 +- .../z_en_invadepoh_demo.c | 20 +- .../z_en_invadepoh_demo.h | 2 +- .../z_en_invisible_ruppe.c | 48 +- .../z_en_invisible_ruppe.h | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 220 +-- src/overlays/actors/ovl_En_Ishi/z_en_ishi.h | 6 +- src/overlays/actors/ovl_En_Ja/z_en_ja.c | 178 +- src/overlays/actors/ovl_En_Ja/z_en_ja.h | 2 +- .../actors/ovl_En_Jc_Mato/z_en_jc_mato.c | 48 +- .../actors/ovl_En_Jc_Mato/z_en_jc_mato.h | 2 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 213 ++- src/overlays/actors/ovl_En_Jg/z_en_jg.h | 2 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 243 ++- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h | 2 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 8 +- src/overlays/actors/ovl_En_Js/z_en_js.h | 2 +- src/overlays/actors/ovl_En_Jso/z_en_jso.c | 40 +- src/overlays/actors/ovl_En_Jso/z_en_jso.h | 2 +- src/overlays/actors/ovl_En_Jso2/z_en_jso2.c | 44 +- src/overlays/actors/ovl_En_Jso2/z_en_jso2.h | 2 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 6 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 2 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 268 +-- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 4 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 187 +- src/overlays/actors/ovl_En_Kame/z_en_kame.h | 2 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 93 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 178 +- .../actors/ovl_En_Karebaba/z_en_karebaba.h | 2 +- src/overlays/actors/ovl_En_Kbt/z_en_kbt.c | 74 +- src/overlays/actors/ovl_En_Kbt/z_en_kbt.h | 2 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 289 ++- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.h | 2 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 460 ++--- src/overlays/actors/ovl_En_Kgy/z_en_kgy.h | 2 +- src/overlays/actors/ovl_En_Kitan/z_en_kitan.c | 6 +- src/overlays/actors/ovl_En_Kitan/z_en_kitan.h | 2 +- .../actors/ovl_En_Knight/z_en_knight.c | 66 +- .../actors/ovl_En_Knight/z_en_knight.h | 2 +- .../actors/ovl_En_Kujiya/z_en_kujiya.c | 114 +- .../actors/ovl_En_Kujiya/z_en_kujiya.h | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 196 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 235 ++- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h | 2 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c | 8 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h | 2 +- src/overlays/actors/ovl_En_Light/z_en_light.c | 57 +- .../actors/ovl_En_Look_Nuts/z_en_look_nuts.c | 86 +- .../actors/ovl_En_Look_Nuts/z_en_look_nuts.h | 2 +- .../actors/ovl_En_M_Fire1/z_en_m_fire1.c | 20 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 8 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.h | 2 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 406 ++--- src/overlays/actors/ovl_En_Ma4/z_en_ma4.h | 2 +- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 529 +++--- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.h | 2 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 163 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.h | 2 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 58 +- .../actors/ovl_En_Maruta/z_en_maruta.c | 112 +- .../actors/ovl_En_Maruta/z_en_maruta.h | 2 +- .../actors/ovl_En_Minideath/z_en_minideath.c | 32 +- .../actors/ovl_En_Minideath/z_en_minideath.h | 2 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 197 +-- .../actors/ovl_En_Minifrog/z_en_minifrog.h | 2 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 116 +- .../actors/ovl_En_Minislime/z_en_minislime.h | 2 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 179 +- src/overlays/actors/ovl_En_Mk/z_en_mk.h | 2 +- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 22 +- src/overlays/actors/ovl_En_Mkk/z_en_mkk.h | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 62 +- src/overlays/actors/ovl_En_Mm/z_en_mm.h | 2 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 48 +- src/overlays/actors/ovl_En_Mm2/z_en_mm2.h | 2 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 216 +-- src/overlays/actors/ovl_En_Mm3/z_en_mm3.h | 2 +- src/overlays/actors/ovl_En_Mnk/z_en_mnk.c | 8 +- src/overlays/actors/ovl_En_Mnk/z_en_mnk.h | 2 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 90 +- src/overlays/actors/ovl_En_Ms/z_en_ms.h | 2 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 136 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.h | 2 +- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 164 +- .../actors/ovl_En_Mushi2/z_en_mushi2.h | 2 +- src/overlays/actors/ovl_En_Muto/z_en_muto.c | 79 +- src/overlays/actors/ovl_En_Muto/z_en_muto.h | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 12 +- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 2 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c | 164 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h | 2 +- .../actors/ovl_En_Nimotsu/z_en_nimotsu.c | 8 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 178 +- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 2 +- src/overlays/actors/ovl_En_Nnh/z_en_nnh.c | 46 +- src/overlays/actors/ovl_En_Nnh/z_en_nnh.h | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 54 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 118 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.h | 2 +- .../z_en_okarina_effect.c | 48 +- .../z_en_okarina_effect.h | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 10 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.h | 2 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.c | 30 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.h | 2 +- .../actors/ovl_En_Onpuman/z_en_onpuman.c | 6 +- .../actors/ovl_En_Onpuman/z_en_onpuman.h | 2 +- src/overlays/actors/ovl_En_Osk/z_en_osk.c | 106 +- src/overlays/actors/ovl_En_Osk/z_en_osk.h | 2 +- src/overlays/actors/ovl_En_Osn/z_en_osn.c | 162 +- src/overlays/actors/ovl_En_Osn/z_en_osn.h | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 517 +++--- src/overlays/actors/ovl_En_Ossan/z_en_ossan.h | 2 +- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 413 +++-- src/overlays/actors/ovl_En_Ot/z_en_ot.h | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 310 ++-- src/overlays/actors/ovl_En_Owl/z_en_owl.h | 2 +- .../actors/ovl_En_Pamera/z_en_pamera.c | 287 ++- .../actors/ovl_En_Pamera/z_en_pamera.h | 4 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 361 ++-- .../actors/ovl_En_Pametfrog/z_en_pametfrog.h | 2 +- src/overlays/actors/ovl_En_Paper/z_en_paper.c | 12 +- src/overlays/actors/ovl_En_Paper/z_en_paper.h | 2 +- src/overlays/actors/ovl_En_Part/z_en_part.c | 8 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 193 +- .../actors/ovl_En_Peehat/z_en_peehat.h | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 277 ++- src/overlays/actors/ovl_En_Pm/z_en_pm.h | 6 +- .../ovl_En_Po_Composer/z_en_po_composer.c | 30 +- .../ovl_En_Po_Composer/z_en_po_composer.h | 2 +- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.c | 78 +- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 234 ++- .../ovl_En_Po_Sisters/z_en_po_sisters.h | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 218 ++- src/overlays/actors/ovl_En_Poh/z_en_poh.h | 2 +- src/overlays/actors/ovl_En_Pp/z_en_pp.c | 8 +- src/overlays/actors/ovl_En_Pp/z_en_pp.h | 2 +- src/overlays/actors/ovl_En_Pr/z_en_pr.c | 140 +- src/overlays/actors/ovl_En_Pr/z_en_pr.h | 2 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 125 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.h | 2 +- src/overlays/actors/ovl_En_Prz/z_en_prz.c | 114 +- src/overlays/actors/ovl_En_Prz/z_en_prz.h | 2 +- src/overlays/actors/ovl_En_Pst/z_en_pst.c | 12 +- src/overlays/actors/ovl_En_Pst/z_en_pst.h | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 77 +- .../actors/ovl_En_Racedog/z_en_racedog.h | 2 +- src/overlays/actors/ovl_En_Raf/z_en_raf.c | 166 +- src/overlays/actors/ovl_En_Raf/z_en_raf.h | 2 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 264 ++- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.h | 2 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 296 ++-- .../actors/ovl_En_Railgibud/z_en_railgibud.h | 2 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 8 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 282 +-- src/overlays/actors/ovl_En_Rd/z_en_rd.h | 2 +- .../actors/ovl_En_Recepgirl/z_en_recepgirl.c | 61 +- .../actors/ovl_En_Recepgirl/z_en_recepgirl.h | 2 +- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 163 +- src/overlays/actors/ovl_En_Rg/z_en_rg.h | 2 +- .../ovl_En_River_Sound/z_en_river_sound.c | 20 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 174 +- src/overlays/actors/ovl_En_Rr/z_en_rr.h | 2 +- src/overlays/actors/ovl_En_Rsn/z_en_rsn.c | 40 +- src/overlays/actors/ovl_En_Rsn/z_en_rsn.h | 2 +- src/overlays/actors/ovl_En_Ru/z_en_ru.c | 10 +- src/overlays/actors/ovl_En_Ru/z_en_ru.h | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 176 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.h | 2 +- src/overlays/actors/ovl_En_Rz/z_en_rz.c | 34 +- src/overlays/actors/ovl_En_Rz/z_en_rz.h | 2 +- .../actors/ovl_En_S_Goro/z_en_s_goro.c | 8 +- .../actors/ovl_En_S_Goro/z_en_s_goro.h | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 94 +- src/overlays/actors/ovl_En_Sb/z_en_sb.h | 2 +- .../actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c | 50 +- .../actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.h | 2 +- .../actors/ovl_En_Scopecoin/z_en_scopecoin.c | 44 +- .../actors/ovl_En_Scopecoin/z_en_scopecoin.h | 2 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.c | 64 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.h | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 163 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.h | 2 +- src/overlays/actors/ovl_En_Sda/z_en_sda.c | 42 +- .../actors/ovl_En_Sekihi/z_en_sekihi.c | 14 +- .../actors/ovl_En_Sekihi/z_en_sekihi.h | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 247 ++- .../actors/ovl_En_Sellnuts/z_en_sellnuts.h | 2 +- src/overlays/actors/ovl_En_Shn/z_en_shn.c | 98 +- src/overlays/actors/ovl_En_Shn/z_en_shn.h | 2 +- src/overlays/actors/ovl_En_Si/z_en_si.c | 12 +- src/overlays/actors/ovl_En_Si/z_en_si.h | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 281 ++- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 2 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 40 +- src/overlays/actors/ovl_En_Slime/z_en_slime.h | 2 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 253 ++- .../actors/ovl_En_Snowman/z_en_snowman.h | 2 +- .../actors/ovl_En_Snowwd/z_en_snowwd.c | 10 +- .../actors/ovl_En_Snowwd/z_en_snowwd.h | 2 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 561 +++--- src/overlays/actors/ovl_En_Sob1/z_en_sob1.h | 2 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 212 +-- src/overlays/actors/ovl_En_Ssh/z_en_ssh.h | 2 +- src/overlays/actors/ovl_En_St/z_en_st.c | 176 +- src/overlays/actors/ovl_En_St/z_en_st.h | 2 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 256 ++- src/overlays/actors/ovl_En_Sth/z_en_sth.h | 2 +- src/overlays/actors/ovl_En_Sth2/z_en_sth2.c | 6 +- .../ovl_En_Stone_heishi/z_en_stone_heishi.c | 20 +- .../ovl_En_Stone_heishi/z_en_stone_heishi.h | 2 +- .../ovl_En_Stop_heishi/z_en_stop_heishi.c | 12 +- .../ovl_En_Stop_heishi/z_en_stop_heishi.h | 2 +- .../actors/ovl_En_Stream/z_en_stream.c | 40 +- .../actors/ovl_En_Stream/z_en_stream.h | 2 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 397 +++-- .../actors/ovl_En_Suttari/z_en_suttari.h | 2 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 216 ++- src/overlays/actors/ovl_En_Sw/z_en_sw.h | 2 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.c | 68 +- .../ovl_En_Syateki_Crow/z_en_syateki_crow.h | 2 +- .../z_en_syateki_dekunuts.c | 99 +- .../z_en_syateki_dekunuts.h | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 463 +++-- .../ovl_En_Syateki_Man/z_en_syateki_man.h | 2 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 113 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.h | 2 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 105 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.h | 2 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 147 +- src/overlays/actors/ovl_En_Tab/z_en_tab.h | 4 +- .../actors/ovl_En_Tag_Obj/z_en_tag_obj.c | 14 +- .../actors/ovl_En_Takaraya/z_en_takaraya.c | 8 +- .../actors/ovl_En_Takaraya/z_en_takaraya.h | 2 +- src/overlays/actors/ovl_En_Talk/z_en_talk.c | 30 +- src/overlays/actors/ovl_En_Talk/z_en_talk.h | 2 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 294 ++- .../ovl_En_Talk_Gibud/z_en_talk_gibud.h | 2 +- .../actors/ovl_En_Tanron1/z_en_tanron1.c | 58 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 111 +- .../actors/ovl_En_Tanron2/z_en_tanron2.h | 2 +- .../actors/ovl_En_Tanron3/z_en_tanron3.c | 93 +- .../actors/ovl_En_Tanron3/z_en_tanron3.h | 2 +- .../actors/ovl_En_Tanron4/z_en_tanron4.c | 38 +- .../actors/ovl_En_Tanron4/z_en_tanron4.h | 2 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 82 +- .../actors/ovl_En_Tanron6/z_en_tanron6.c | 24 +- .../actors/ovl_En_Tanron6/z_en_tanron6.h | 2 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 53 +- src/overlays/actors/ovl_En_Test2/z_en_test2.c | 4 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 6 +- src/overlays/actors/ovl_En_Test3/z_en_test3.h | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 163 +- src/overlays/actors/ovl_En_Test4/z_en_test4.h | 2 +- src/overlays/actors/ovl_En_Test5/z_en_test5.c | 39 +- src/overlays/actors/ovl_En_Test5/z_en_test5.h | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 472 ++--- src/overlays/actors/ovl_En_Test6/z_en_test6.h | 2 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 271 ++- src/overlays/actors/ovl_En_Test7/z_en_test7.h | 6 +- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 10 +- src/overlays/actors/ovl_En_Tg/z_en_tg.h | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 189 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.h | 2 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.c | 148 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.h | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 259 ++- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 2 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 454 +++-- src/overlays/actors/ovl_En_Tk/z_en_tk.h | 4 +- src/overlays/actors/ovl_En_Torch/z_en_torch.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 50 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 351 ++-- src/overlays/actors/ovl_En_Toto/z_en_toto.h | 4 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 608 ++++--- src/overlays/actors/ovl_En_Trt/z_en_trt.h | 2 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 243 ++- src/overlays/actors/ovl_En_Trt2/z_en_trt2.h | 4 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 198 +-- src/overlays/actors/ovl_En_Tru/z_en_tru.h | 4 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 135 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.h | 2 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 226 +-- src/overlays/actors/ovl_En_Tsn/z_en_tsn.h | 2 +- .../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_Twig/z_en_twig.c | 8 +- src/overlays/actors/ovl_En_Twig/z_en_twig.h | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 14 +- .../actors/ovl_En_Viewer/z_en_viewer.h | 2 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 117 +- src/overlays/actors/ovl_En_Vm/z_en_vm.h | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 211 ++- .../actors/ovl_En_Wallmas/z_en_wallmas.h | 2 +- .../actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c | 58 +- .../actors/ovl_En_Warp_Uzu/z_en_warp_uzu.h | 2 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 104 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.h | 2 +- .../ovl_En_Water_Effect/z_en_water_effect.c | 153 +- .../actors/ovl_En_Wdhand/z_en_wdhand.c | 8 +- .../actors/ovl_En_Wdhand/z_en_wdhand.h | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 262 ++- .../ovl_En_Weather_Tag/z_en_weather_tag.h | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 317 ++-- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 2 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 8 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.h | 2 +- .../actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c | 54 +- .../actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h | 2 +- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c | 261 ++- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h | 2 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 83 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 198 +-- src/overlays/actors/ovl_En_Yb/z_en_yb.h | 2 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 16 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 10 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.h | 2 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 87 +- src/overlays/actors/ovl_En_Zo/z_en_zo.h | 2 +- src/overlays/actors/ovl_En_Zob/z_en_zob.c | 282 +-- src/overlays/actors/ovl_En_Zob/z_en_zob.h | 2 +- src/overlays/actors/ovl_En_Zod/z_en_zod.c | 8 +- src/overlays/actors/ovl_En_Zod/z_en_zod.h | 2 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 280 +-- src/overlays/actors/ovl_En_Zog/z_en_zog.h | 2 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 312 ++-- .../actors/ovl_En_Zoraegg/z_en_zoraegg.h | 2 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 274 +-- src/overlays/actors/ovl_En_Zos/z_en_zos.h | 2 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 462 ++--- src/overlays/actors/ovl_En_Zot/z_en_zot.h | 2 +- src/overlays/actors/ovl_En_Zov/z_en_zov.c | 170 +- src/overlays/actors/ovl_En_Zov/z_en_zov.h | 4 +- src/overlays/actors/ovl_En_Zow/z_en_zow.c | 145 +- src/overlays/actors/ovl_En_Zow/z_en_zow.h | 2 +- .../actors/ovl_Item_B_Heart/z_item_b_heart.c | 44 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 58 +- .../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 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 82 +- src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c | 8 +- src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c | 76 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 91 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h | 2 +- .../actors/ovl_Obj_Armos/z_obj_armos.c | 92 +- .../actors/ovl_Obj_Armos/z_obj_armos.h | 2 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 238 +-- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h | 2 +- src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c | 80 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.c | 86 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.h | 2 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 24 +- .../ovl_Obj_Blockstop/z_obj_blockstop.h | 2 +- src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c | 40 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c | 121 +- .../actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h | 2 +- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c | 40 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 114 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h | 2 +- .../actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c | 8 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 128 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h | 2 +- .../ovl_Obj_Danpeilift/z_obj_danpeilift.c | 8 +- .../ovl_Obj_Danpeilift/z_obj_danpeilift.h | 2 +- src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c | 8 +- src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h | 2 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.c | 104 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.h | 2 +- .../actors/ovl_Obj_Dinner/z_obj_dinner.c | 24 +- src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c | 58 +- src/overlays/actors/ovl_Obj_Dora/z_obj_dora.h | 2 +- .../actors/ovl_Obj_Dowsing/z_obj_dowsing.c | 34 +- .../actors/ovl_Obj_Driftice/z_obj_driftice.c | 46 +- .../actors/ovl_Obj_Driftice/z_obj_driftice.h | 2 +- .../actors/ovl_Obj_Ending/z_obj_ending.c | 18 +- .../actors/ovl_Obj_Entotu/z_obj_entotu.c | 46 +- .../actors/ovl_Obj_Etcetera/z_obj_etcetera.c | 84 +- .../actors/ovl_Obj_Etcetera/z_obj_etcetera.h | 2 +- .../ovl_Obj_Fireshield/z_obj_fireshield.c | 62 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 196 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.h | 2 +- .../actors/ovl_Obj_Funen/z_obj_funen.c | 22 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 92 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.h | 2 +- .../actors/ovl_Obj_Grass/z_obj_grass.c | 104 +- .../ovl_Obj_Grass_Carry/z_obj_grass_carry.c | 94 +- .../ovl_Obj_Grass_Carry/z_obj_grass_carry.h | 2 +- .../ovl_Obj_Grass_Unit/z_obj_grass_unit.c | 2 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c | 160 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h | 2 +- .../actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 76 +- src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c | 18 +- .../actors/ovl_Obj_Hariko/z_obj_hariko.c | 34 +- .../actors/ovl_Obj_Hariko/z_obj_hariko.h | 2 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c | 74 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h | 2 +- .../actors/ovl_Obj_HsStump/z_obj_hsstump.c | 56 +- .../actors/ovl_Obj_HsStump/z_obj_hsstump.h | 2 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 10 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.h | 2 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 137 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h | 2 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 172 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.h | 2 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 90 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h | 2 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 285 ++- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.h | 4 +- .../actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c | 30 +- .../ovl_Obj_Jgame_Light/z_obj_jgame_light.c | 8 +- .../ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c | 97 +- .../ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h | 2 +- .../ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c | 22 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 162 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.h | 2 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 84 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.h | 2 +- .../actors/ovl_Obj_Kinoko/z_obj_kinoko.c | 36 +- .../actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c | 46 +- .../actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 8 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h | 2 +- .../ovl_Obj_Lightblock/z_obj_lightblock.c | 68 +- .../ovl_Obj_Lightblock/z_obj_lightblock.h | 2 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 108 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.h | 2 +- .../ovl_Obj_Lupygamelift/z_obj_lupygamelift.c | 8 +- .../ovl_Obj_Lupygamelift/z_obj_lupygamelift.h | 2 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 6 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 34 +- .../actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c | 28 +- src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c | 8 +- src/overlays/actors/ovl_Obj_Mine/z_obj_mine.h | 2 +- .../ovl_Obj_Moon_Stone/z_obj_moon_stone.c | 74 +- .../ovl_Obj_Moon_Stone/z_obj_moon_stone.h | 2 +- .../actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c | 84 +- .../actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.h | 2 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 88 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h | 2 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.c | 10 +- .../actors/ovl_Obj_Mure2/z_obj_mure2.h | 2 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.c | 12 +- .../actors/ovl_Obj_Mure3/z_obj_mure3.h | 2 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.c | 164 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.h | 2 +- .../ovl_Obj_Ocarinalift/z_obj_ocarinalift.c | 8 +- .../ovl_Obj_Ocarinalift/z_obj_ocarinalift.h | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 181 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h | 2 +- .../actors/ovl_Obj_Purify/z_obj_purify.c | 6 +- .../actors/ovl_Obj_Purify/z_obj_purify.h | 2 +- .../actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c | 80 +- .../actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h | 2 +- .../actors/ovl_Obj_Raillift/z_obj_raillift.c | 87 +- .../actors/ovl_Obj_Raillift/z_obj_raillift.h | 2 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.c | 36 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.h | 2 +- .../actors/ovl_Obj_Rotlift/z_obj_rotlift.c | 28 +- .../actors/ovl_Obj_Shutter/z_obj_shutter.c | 8 +- .../ovl_Obj_Skateblock/z_obj_skateblock.c | 122 +- .../ovl_Obj_Skateblock/z_obj_skateblock.h | 2 +- .../actors/ovl_Obj_Smork/z_obj_smork.c | 32 +- .../actors/ovl_Obj_Snowball/z_obj_snowball.c | 197 +-- .../actors/ovl_Obj_Snowball/z_obj_snowball.h | 2 +- .../ovl_Obj_Snowball2/z_obj_snowball2.c | 168 +- .../ovl_Obj_Snowball2/z_obj_snowball2.h | 2 +- .../actors/ovl_Obj_Sound/z_obj_sound.c | 6 +- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 74 +- .../ovl_Obj_Spidertent/z_obj_spidertent.h | 2 +- .../ovl_Obj_Spinyroll/z_obj_spinyroll.c | 114 +- .../ovl_Obj_Spinyroll/z_obj_spinyroll.h | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 295 ++- .../actors/ovl_Obj_Switch/z_obj_switch.h | 4 +- .../actors/ovl_Obj_Swprize/z_obj_swprize.c | 14 +- .../actors/ovl_Obj_Swprize/z_obj_swprize.h | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 69 +- .../z_obj_takaraya_wall.c | 10 +- .../z_obj_takaraya_wall.h | 2 +- src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c | 8 +- src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h | 2 +- src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c | 79 +- src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h | 2 +- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.c | 80 +- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.h | 2 +- .../ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c | 8 +- .../ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h | 2 +- .../ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c | 32 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 258 ++- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h | 2 +- .../actors/ovl_Obj_Toudai/z_obj_toudai.c | 8 +- src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c | 54 +- src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 237 ++- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 4 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 38 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.h | 2 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.c | 8 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.h | 2 +- .../ovl_Obj_Visiblock/z_obj_visiblock.c | 18 +- .../ovl_Obj_Vspinyroll/z_obj_vspinyroll.c | 98 +- .../ovl_Obj_Vspinyroll/z_obj_vspinyroll.h | 2 +- .../ovl_Obj_Warpstone/z_obj_warpstone.c | 82 +- .../ovl_Obj_Warpstone/z_obj_warpstone.h | 2 +- src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c | 8 +- .../actors/ovl_Obj_Wturn/z_obj_wturn.c | 74 +- .../actors/ovl_Obj_Wturn/z_obj_wturn.h | 2 +- .../actors/ovl_Obj_Y2lift/z_obj_y2lift.c | 22 +- .../ovl_Obj_Y2shutter/z_obj_y2shutter.c | 8 +- src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c | 34 +- src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c | 26 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 281 ++- .../ovl_Object_Kankyo/z_object_kankyo.h | 2 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 12 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.h | 2 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 12 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.h | 2 +- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 8 +- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 8 +- .../actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 8 +- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 8 +- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 8 +- .../actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c | 40 +- .../actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c | 8 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 14 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h | 2 +- src/overlays/actors/ovl_TG_Sw/z_tg_sw.c | 36 +- src/overlays/actors/ovl_TG_Sw/z_tg_sw.h | 2 +- .../actors/ovl_player_actor/z_player.c | 8 +- .../z_eff_en_ice_block.c | 32 +- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.c | 6 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c | 8 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 30 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 6 +- .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c | 6 +- .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c | 6 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 6 +- .../z_eff_ss_dt_bubble.c | 6 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.c | 8 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 6 +- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 8 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 32 +- .../z_eff_ss_fhg_flash.c | 6 +- .../z_eff_ss_fire_tail.c | 6 +- .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c | 6 +- .../z_eff_ss_g_ripple.c | 6 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c | 8 +- .../z_eff_ss_g_splash.c | 6 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c | 6 +- .../ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c | 6 +- .../z_eff_ss_ice_piece.c | 26 +- .../z_eff_ss_ice_smoke.c | 26 +- .../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 +- .../effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c | 24 +- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c | 18 +- .../z_eff_ss_solder_srch_ball.c | 6 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 18 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 16 +- .../gamestates/ovl_daytelop/z_daytelop.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- tools/disasm/functions.txt | 2 +- tools/disasm/variables.txt | 2 +- tools/namefixer.py | 41 +- tools/sizes/code_functions.csv | 2 +- 1175 files changed, 36240 insertions(+), 36688 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0839bb2d6..0cc5b0375c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,11 +74,11 @@ If you make significant progress on decompiling a function, but can't get it to ```c #ifdef NON_MATCHING -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v) { // ... } #else -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v); +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v); #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_SpawnWaterDroplets.s") #endif ``` diff --git a/docs/STYLE.md b/docs/STYLE.md index 6524e05d66..d66c22c81c 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -139,18 +139,18 @@ All compound flag lists (e.g. `ACTOR_FLAG_4 | ACTOR_FLAG_8`) should be listed in - Use `sizeof` or `ARRAY_COUNT`/`ARRAY_COUNTU` where it makes sense, e.g. in loops that are using an array. - clang-format sometimes does weird things to array formatting. Experiment with and without a comma after the last element and see which looks better. -## GlobalCtx2 +## Play2 -In some particular instances, IDO requires the function argument `globalCtx` to be cast to a second variable of the same type to match. In these particular instances, the function argument should be renamed to `globalCtx2` and than this `globalCtx2` just assigned to a stack variable called `globalCtx`. This cast should occur before the actor `THIS` cast is made. For example in `z_en_firefly.c` +In some particular instances, IDO requires the function argument `play` to be cast to a second variable of the same type to match. In these particular instances, the function argument should be renamed to `play2` and than this `play2` just assigned to a stack variable called `play`. This cast should occur before the actor `THIS` cast is made. For example in `z_en_firefly.c` ```c -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFirefly_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFirefly* this = THIS; ``` In other places the cast is actually not explictly needed, but a stack `pad` variable is still needed. For this there should just be a stack variable called `pad` of type `s32` before the actor `THIS` cast. For example in `z_bg_goron_oyu` ```c -void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGoronOyu_Init(Actor* thisx, PlayState* play) { s32 pad; BgGoronOyu* this = THIS; CollisionHeader* colHeader = NULL; diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index 4952f7586c..ee6c13aa77 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -16,15 +16,15 @@ Again our example will be taken from a small NPC: this time, `EnMs` (Bean Seller #define THIS ((EnMs*)thisx) -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 func_80952734(EnMs* this, GlobalContext* globalCtx); -void func_809527F8(EnMs* this, GlobalContext* globalCtx); -void func_809529AC(EnMs* this, GlobalContext* globalCtx); -void func_80952A1C(EnMs *this, GlobalContext *globalCtx); +void func_80952734(EnMs* this, PlayState* play); +void func_809527F8(EnMs* this, PlayState* play); +void func_809529AC(EnMs* this, PlayState* play); +void func_80952A1C(EnMs* this, PlayState* play); const ActorInit En_Ms_InitVars = { ACTOR_EN_MS, @@ -56,13 +56,13 @@ extern InitChainEntry D_80952BCC[]; extern AnimationHeader D_060005EC; extern FlexSkeletonHeader D_06003DC0; -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Init(Actor* thisx, PlayState* play) { EnMs* this = THIS; Actor_ProcessInitChain(thisx, D_80952BCC); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &D_80952BA0); + SkelAnime_InitFlex(play, &this->skelAnime, &D_06003DC0, &D_060005EC, this->jointTable, this->morphTable, 9); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &D_80952BA0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); Actor_SetScale(&this->actor, 0.015f); this->actor.colChkInfo.mass = 0xFF; @@ -72,13 +72,13 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Destroy(Actor* thisx, PlayState* play) { EnMs* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80952734(EnMs* this, GlobalContext* globalCtx) { +void func_80952734(EnMs* this, PlayState* play) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (gSaveContext.save.inventory.items[10] == ITEM_NONE) { @@ -87,40 +87,40 @@ void func_80952734(EnMs* this, GlobalContext* globalCtx) { this->actor.textId = 0x932; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { this->actionFunc = func_809527F8; return; } if (this->actor.xzDistToPlayer < 90.0f) { if (ABS_ALT(temp_v1) < 0x2000) { - func_800B8614(&this->actor, globalCtx, 90.0f); + func_800B8614(&this->actor, play, 90.0f); } } } #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s") -void func_809529AC(EnMs *this, GlobalContext *globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809529AC(EnMs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.textId = 0; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80952A1C; } else { - Actor_PickUp(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } -void func_80952A1C(EnMs *this, GlobalContext *globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80151938(globalCtx, 0x936U); +void func_80952A1C(EnMs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80151938(play, 0x936U); this->actionFunc = func_809527F8; } else { - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); } } -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Update(Actor* thisx, PlayState* play) { s32 pad; EnMs* this = THIS; @@ -128,16 +128,16 @@ 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); 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 = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); } @@ -152,53 +152,53 @@ $ ../mips_to_c/mips_to_c.py asm/non_matchings/overlays/ovl_En_Ms/func_809527F8.s ``` ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { +void func_809527F8(EnMs* this, PlayState* play) { u8 temp_v0; u8 temp_v0_2; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 != 4) { if (temp_v0 != 5) { - if ((temp_v0 == 6) && (Message_ShouldAdvance(globalCtx) != 0)) { + if ((temp_v0 == 6) && (Message_ShouldAdvance(play) != 0)) { this->actionFunc = func_80952734; return; } // Duplicate return node #17. Try simplifying control flow for better match return; } - if (Message_ShouldAdvance(globalCtx) != 0) { - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + if (Message_ShouldAdvance(play) != 0) { + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; } // Duplicate return node #17. Try simplifying control flow for better match return; } - if (Message_ShouldAdvance(globalCtx) != 0) { - temp_v0_2 = globalCtx->msgCtx.choiceIndex; + if (Message_ShouldAdvance(play) != 0) { + temp_v0_2 = play->msgCtx.choiceIndex; if (temp_v0_2 != 0) { if (temp_v0_2 != 1) { } func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); // Duplicate return node #17. Try simplifying control flow for better match return; } - func_801477B4(globalCtx); + func_801477B4(play); if ((s32) gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; } if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; } @@ -208,10 +208,10 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { which is long, messy, and contains some rather nasty-looking control flow, including horrors like ```C - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 != 4) { if (temp_v0 != 5) { - if ((temp_v0 == 6) && (Message_ShouldAdvance(globalCtx) != 0)) { + if ((temp_v0 == 6) && (Message_ShouldAdvance(play) != 0)) { this->actionFunc = func_80952734; return; } @@ -234,11 +234,11 @@ For didactic purposes, we'll use a feature of mips2c called goto-only mode to ex instead will produce ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { +void func_809527F8(EnMs* this, PlayState* play) { u8 temp_v0; u8 temp_v0_2; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { goto block_7; } @@ -248,24 +248,24 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { if (temp_v0 != 6) { goto block_17; } - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } this->actionFunc = func_80952734; return; block_5: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } - temp_v0_2 = globalCtx->msgCtx.choiceIndex; + temp_v0_2 = play->msgCtx.choiceIndex; if (temp_v0_2 == 0) { goto block_11; } @@ -274,29 +274,29 @@ block_7: } goto block_16; block_11: - func_801477B4(globalCtx); + func_801477B4(play); if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; block_13: if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] < 0x14) { goto block_15; } play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); return; block_15: func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); block_17: return; } @@ -316,7 +316,7 @@ The simplest sort of block label to eliminate is one that is only used once, and goto block_13; } play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; block_13: ``` @@ -326,7 +326,7 @@ Currently, this says to jump over the code block `play_sound...` if the conditio ```C if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; } ``` @@ -336,11 +336,11 @@ Likewise, one can do this with `block_15`. If you examine appropriate part of the diff, you will usually find that such eliminations make no, or very little, difference to the compiled code. ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { +void func_809527F8(EnMs* this, PlayState* play) { u8 temp_v0; u8 temp_v0_2; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { goto block_7; } @@ -350,24 +350,24 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { if (temp_v0 != 6) { goto block_17; } - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } this->actionFunc = func_80952734; return; block_5: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { goto block_17; } - temp_v0_2 = globalCtx->msgCtx.choiceIndex; + temp_v0_2 = play->msgCtx.choiceIndex; if (temp_v0_2 == 0) { goto block_11; } @@ -376,27 +376,27 @@ block_7: } goto block_16; block_11: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); block_17: return; } @@ -406,11 +406,11 @@ We can't apply this rule any more, so we need to move on to the next: `block_17` ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { +void func_809527F8(EnMs* this, PlayState* play) { u8 temp_v0; u8 temp_v0_2; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { goto block_7; } @@ -420,24 +420,24 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { if (temp_v0 != 6) { return; } - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } this->actionFunc = func_80952734; return; block_5: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } - temp_v0_2 = globalCtx->msgCtx.choiceIndex; + temp_v0_2 = play->msgCtx.choiceIndex; if (temp_v0_2 == 0) { goto block_11; } @@ -446,27 +446,27 @@ block_7: } goto block_16; block_11: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); } ``` @@ -475,7 +475,7 @@ Our next rule is about non-crossing blocks. If two code blocks do not contain an Now let's start thinking about switches. A good indicator of a switch in goto-only mode is something like ```C - temp_v0_2 = globalCtx->msgCtx.choiceIndex; + temp_v0_2 = play->msgCtx.choiceIndex; if (temp_v0_2 == 0) { goto block_11; } @@ -493,23 +493,23 @@ because So let us rewrite the entire second half as a switch: ```C - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; return; @@ -518,7 +518,7 @@ So let us rewrite the entire second half as a switch: case 1: default: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); break; } ``` @@ -528,19 +528,19 @@ There's a couple of other obvious things here: - a common pattern everywhere, a sequence of ifs with returns as the last thing inside is the same as an if-else chain, so we can rewrite these as ```C - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; } @@ -549,7 +549,7 @@ There's a couple of other obvious things here: case 1: default: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); break; } ``` @@ -557,7 +557,7 @@ There's a couple of other obvious things here: Well, at least the bottom half looks respectable now. Again, there is no code after the switch, so the next thing up, namely ```C - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } ``` @@ -565,10 +565,10 @@ Well, at least the bottom half looks respectable now. Again, there is no code af can be swapped round and made to wrap the switch. This leaves us with ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { +void func_809527F8(EnMs* this, PlayState* play) { u8 temp_v0; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { goto block_7; } @@ -578,34 +578,34 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { if (temp_v0 != 6) { return; } - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } this->actionFunc = func_80952734; return; block_5: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: - if (Message_ShouldAdvance(globalCtx) != 0) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) != 0) { + switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; } @@ -614,7 +614,7 @@ block_7: case 1: default: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); break; } } @@ -623,7 +623,7 @@ block_7: Now, the top of the function also looks like a switch: ```C - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { goto block_7; } @@ -640,36 +640,36 @@ Interestingly, this time the blocks are the other way round. Also, the last stat Putting all this together, we write down a function with no gotos in it: ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_809527F8(EnMs* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 6: this->actionFunc = func_80952734; break; case 5: - if (Message_ShouldAdvance(globalCtx) == 0) { + if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; break; case 4: - if (Message_ShouldAdvance(globalCtx) != 0) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) != 0) { + switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; } @@ -678,7 +678,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { case 1: default: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); break; } } @@ -693,35 +693,35 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { Lastly, we can simplify `case 5` to replace the return in the if by the rest of the code, and we end up with ```C -void func_809527F8(EnMs *this, GlobalContext *globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_809527F8(EnMs* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 6: this->actionFunc = func_80952734; break; case 5: - if (Message_ShouldAdvance(globalCtx) != 0) { - func_801477B4(globalCtx); - Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + if (Message_ShouldAdvance(play) != 0) { + func_801477B4(play); + Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; } break; case 4: - if (Message_ShouldAdvance(globalCtx) != 0) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) != 0) { + switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(globalCtx, 0x935U); + func_80151938(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(globalCtx, 0x937U); + func_80151938(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, globalCtx, 0x35, 90.0f, 10.0f); + Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); func_801159EC(-0xA); this->actionFunc = func_809529AC; } @@ -730,7 +730,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) { case 1: default: func_8019F230(); - func_80151938(globalCtx, 0x934U); + func_80151938(play, 0x934U); break; } } diff --git a/docs/tutorial/beginning_decomp.md b/docs/tutorial/beginning_decomp.md index 13e5941fce..3a4337deb8 100644 --- a/docs/tutorial/beginning_decomp.md +++ b/docs/tutorial/beginning_decomp.md @@ -21,10 +21,10 @@ The actor file starts off looking like: #define THIS ((EnRecepgirl*)thisx) // --------------- 3 --------------- -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Init(Actor* thisx, PlayState* play); +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play); +void EnRecepgirl_Update(Actor* thisx, PlayState* play); +void EnRecepgirl_Draw(Actor* thisx, PlayState* play); // --------------- 4 --------------- #if 0 @@ -115,7 +115,7 @@ The header file looks like this at the moment: struct EnRecepgirl; -typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); +typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, PlayState*); typedef struct EnRecepgirl { /* 0x0000 */ Actor actor; @@ -141,7 +141,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(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80whatever(EnRecepgirl* 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 be thinking about several at once.) @@ -207,14 +207,14 @@ static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60 static s32 D_80C106C8 = 0; InitChainEntry D_80C106C0[2]; // unable to generate initializer -void EnRecepgirl_Init(EnRecepgirl *this, GlobalContext *globalCtx) { +void EnRecepgirl_Init(EnRecepgirl* this, PlayState* play) { EnRecepgirl* this = (EnRecepgirl *) thisx; void **temp_s0; void **phi_s0; Actor_ProcessInitChain((Actor *) this, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + SkelAnime_InitFlex(play, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); phi_s0 = D_80C106B0; if (D_80C106C8 == 0) { do { @@ -225,7 +225,7 @@ void EnRecepgirl_Init(EnRecepgirl *this, GlobalContext *globalCtx) { D_80C106C8 = 1; } this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + if (Flags_GetSwitch(play, (s32) this->actor.params) != 0) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -244,14 +244,14 @@ static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60 static s32 D_80C106C8 = 0; InitChainEntry D_80C106C0[2]; // unable to generate initializer -void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = (EnRecepgirl *) thisx; void **temp_s0; void **phi_s0; Actor_ProcessInitChain((Actor *) this, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + SkelAnime_InitFlex(play, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); phi_s0 = D_80C106B0; if (D_80C106C8 == 0) { do { @@ -262,7 +262,7 @@ void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { D_80C106C8 = 1; } this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + if (Flags_GetSwitch(play, (s32) this->actor.params) != 0) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -300,14 +300,14 @@ static void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60 static s32 D_80C106C8 = 0; InitChainEntry D_80C106C0[2]; // unable to generate initializer -void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; void **temp_s0; void **phi_s0; Actor_ProcessInitChain(&this->actor, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + SkelAnime_InitFlex(play, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); phi_s0 = D_80C106B0; if (D_80C106C8 == 0) { do { @@ -318,7 +318,7 @@ void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { D_80C106C8 = 1; } this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + if (Flags_GetSwitch(play, (s32) this->actor.params) != 0) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -388,7 +388,7 @@ This is the combined system that handles actors' skeletons and their animations. ```C Actor_ProcessInitChain(&this->actor, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); + SkelAnime_InitFlex(play, (SkelAnime *) this->unk_144, &D_06011B60, (AnimationHeader *) &D_06009890, this + 0x188, this + 0x218, 0x18); phi_s0 = D_80C106B0; ``` @@ -396,7 +396,7 @@ An actor with SkelAnime has three structs in the Actor struct that handle it: on There are two different sorts of SkelAnime, although for decompilation purposes there is not much difference between them. Looking at the prototype of `SkelAnime_InitFlex` from `functions.h` (or even the definition in `z_skelanime.c`), ```C -void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +void SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); ``` we can read off the types of the various arguments: @@ -432,7 +432,7 @@ As with the data, these externed symbols should be kept in increasing address or They are both passed to the function as pointers, so need `&` to pass the address instead of the actual data. Hence we end up with ```C - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); ``` note that `this->jointTable` and `this->morphTable` are arrays, so are already effectively pointers and don't need a `&`. @@ -487,14 +487,14 @@ Removing some of the declarations for data that we have accounted for, the funct ```C ? func_80C10148(EnRecepgirl *); // extern -void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; void **temp_s0; void **phi_s0; Actor_ProcessInitChain(&this->actor, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); phi_s0 = D_80C106B0; if (D_80C106C8 == 0) { @@ -507,7 +507,7 @@ void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { } this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + if (Flags_GetSwitch(play, (s32) this->actor.params) != 0) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -520,7 +520,7 @@ We have one significant problem and a few minor ones left. ### Casts and boolean functions -mips2c likes casting a lot: this is useful for getting types, less so when the type is changed automatically, such as in `Flags_GetSwitch(globalCtx, (s32) this->actor.params)`. Also, if we look at this function's definition, we discover it will only return `true` or `false`, so we can remove the `!= 0`. +mips2c likes casting a lot: this is useful for getting types, less so when the type is changed automatically, such as in `Flags_GetSwitch(play, (s32) this->actor.params)`. Also, if we look at this function's definition, we discover it will only return `true` or `false`, so we can remove the `!= 0`. ### Functions called @@ -529,14 +529,14 @@ One minor problem is what `func_80C10148` is: C needs a prototype to compile it 2. It's not used to assign a value To this experience will add a third reason: -3. This is probably a setup function for an actionFunc, which are usually either `void (*)(ActorType*)` or `void (*)(ActorType*, GlobalContext*)`. +3. This is probably a setup function for an actionFunc, which are usually either `void (*)(ActorType*)` or `void (*)(ActorType*, PlayState*)`. The upshot of all this is to remove mips2c's `? func_80C10148(EnRecepgirl *); // extern`, and add a `void func_80C10148(EnRecepgirl* this);` underneath the declarations for the main four functions: ```C -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Init(Actor* thisx, PlayState* play); +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play); +void EnRecepgirl_Update(Actor* thisx, PlayState* play); +void EnRecepgirl_Draw(Actor* thisx, PlayState* play); void func_80C10148(EnRecepgirl* this); ``` @@ -625,12 +625,12 @@ Hence we end up with void func_80C10148(EnRecepgirl* this); [...] -void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; Actor_ProcessInitChain(&this->actor, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &D_06011B60, &D_06009890, this->jointTable, this->morphTable, 24); if (D_80C106C8 == 0) { for (i = 0; i < 4; i++) { @@ -641,7 +641,7 @@ void EnRecepgirl_Init(Actor *thisx, GlobalContext *globalCtx) { this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; diff --git a/docs/tutorial/diff_and_permuter.md b/docs/tutorial/diff_and_permuter.md index aa72999d15..2b5d41e307 100644 --- a/docs/tutorial/diff_and_permuter.md +++ b/docs/tutorial/diff_and_permuter.md @@ -51,7 +51,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; @@ -64,7 +64,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; @@ -78,24 +78,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); @@ -104,7 +104,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); @@ -123,10 +123,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/documenting.md b/docs/tutorial/documenting.md index e31a31969c..ad990af4eb 100644 --- a/docs/tutorial/documenting.md +++ b/docs/tutorial/documenting.md @@ -40,15 +40,15 @@ Large code block, click to show #define THIS ((EnRecepgirl*)thisx) -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Init(Actor* thisx, PlayState* play); +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play); +void EnRecepgirl_Update(Actor* thisx, PlayState* play); +void EnRecepgirl_Draw(Actor* thisx, PlayState* play); void func_80C10148(EnRecepgirl* this); -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C1019C(EnRecepgirl* this, PlayState* play); void func_80C10290(EnRecepgirl* this); -void func_80C102D4(EnRecepgirl * this, GlobalContext * globalCtx); +void func_80C102D4(EnRecepgirl* this, PlayState* play); const ActorInit En_Recepgirl_InitVars = { ACTOR_EN_RECEPGIRL, @@ -73,13 +73,13 @@ static InitChainEntry D_80C106C0[] = { static s32 D_80C106C8 = 0; // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Init.s") -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; s32 i; Actor_ProcessInitChain(&this->actor, D_80C106C0); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bg_Skel_011B60, &object_bg_Anim_009890, this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &object_bg_Skel_011B60, &object_bg_Anim_009890, this->jointTable, this->morphTable, 24); if (D_80C106C8 == 0) { for (i = 0; i < 4; i++) { @@ -90,7 +90,7 @@ void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2AC = 2; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -100,7 +100,7 @@ void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Destroy.s") -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C100DC.s") @@ -127,7 +127,7 @@ void func_80C10148(EnRecepgirl *this) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C1019C.s") -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { +void func_80C1019C(EnRecepgirl* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &object_bg_Anim_00A280) { Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); @@ -136,13 +136,13 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { func_80C10290(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_800B8614(&this->actor, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == 2) { + func_800B8614(&this->actor, play, 60.0f); + if (Player_GetMask(play) == 2) { this->actor.textId = 0x2367; - } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -157,7 +157,7 @@ void func_80C10290(EnRecepgirl *this) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C102D4.s") -void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { +void func_80C102D4(EnRecepgirl* this, PlayState* play) { u8 temp_v0_2; if (SkelAnime_Update(&this->skelAnime) != 0) { @@ -176,16 +176,16 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { } } - temp_v0_2 = Message_GetState(&globalCtx->msgCtx); + temp_v0_2 = Message_GetState(&play->msgCtx); if (temp_v0_2 == 2) { this->actor.textId = 0x2ADC; func_80C10148(this); return; } - if ((temp_v0_2 == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { + if ((temp_v0_2 == 5) && (Message_ShouldAdvance(play) != 0)) { if (this->actor.textId == 0x2AD9) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); if ((gSaveContext.save.weekEventReg[63] & 0x80)) { this->actor.textId = 0x2ADF; @@ -205,23 +205,23 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { this->actor.textId = 0x2AE0; } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Update.s") -void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Update(Actor* thisx, PlayState* play) { s32 pad; EnRecepgirl* this = THIS; Vec3s sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); func_80C100DC(this); } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") -s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { +s32 func_80C10558(PlayState* play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -231,7 +231,7 @@ s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") -void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { +void func_80C10590(PlayState* play, s32 limbIndex, Actor *thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -241,18 +241,18 @@ void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { } // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") -void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Draw(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } ``` @@ -412,7 +412,7 @@ Finally, clearly `4` is linked to the data over which we're iterating: namely it We've got one struct variable left. To find out what it does, we can look at a function that uses it, for example ```C -s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnRecepgirl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRecepgirl* this = THIS; @@ -422,7 +422,7 @@ s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnRecepgirl_UnkLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnRecepgirl_UnkLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -449,7 +449,7 @@ void func_80C10148(EnRecepgirl* this) { this->actionFunc = func_80C1019C; } -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { +void func_80C1019C(EnRecepgirl* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &object_bg_Anim_00A280) { Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); @@ -458,13 +458,13 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { func_80C10290(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_800B8614(&this->actor, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + func_800B8614(&this->actor, play, 60.0f); + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?" - } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; // hear directions again? } else { this->actor.textId = 0x2AD9; // "Welcome..." @@ -477,7 +477,7 @@ void func_80C10290(EnRecepgirl* this) { this->actionFunc = func_80C102D4; } -void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) { +void func_80C102D4(EnRecepgirl* this, PlayState* play) { u8 temp_v0_2; if (SkelAnime_Update(&this->skelAnime)) { @@ -496,13 +496,13 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) { } } - temp_v0_2 = Message_GetState(&globalCtx->msgCtx); + temp_v0_2 = Message_GetState(&play->msgCtx); if (temp_v0_2 == 2) { this->actor.textId = 0x2ADC; // hear directions again? func_80C10148(this); - } else if ((temp_v0_2 == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { + } else if ((temp_v0_2 == 5) && (Message_ShouldAdvance(play) != 0)) { if (this->actor.textId == 0x2AD9) { // "Welcome..." - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) @@ -524,11 +524,11 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) { this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } ``` -All this branching is to make the conversation look more diverse and interesting. Notably, though, `func_80C1019C` is set to start with, and is only changed when `Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0`. This is something to do with talking. The other function handles the rest of the conversation, and hands back to the first if `Message_GetState(&globalCtx->msgCtx) == 2`. This function is *something* to do with the text state, which will require `z_message` to be decomped. However, observation in-game will reveal this is something to do with ending dialogue. So we can conclude that the action functions are `EnRecepgirl_Wait` and `EnRecepgirl_Talk`. The setup functions are thus `EnRecepgirl_SetupWait` and `EnRecepgirl_SetupTalk`. +All this branching is to make the conversation look more diverse and interesting. Notably, though, `func_80C1019C` is set to start with, and is only changed when `Actor_ProcessTalkRequest(&this->actor, &play->state) != 0`. This is something to do with talking. The other function handles the rest of the conversation, and hands back to the first if `Message_GetState(&play->msgCtx) == 2`. This function is *something* to do with the text state, which will require `z_message` to be decomped. However, observation in-game will reveal this is something to do with ending dialogue. So we can conclude that the action functions are `EnRecepgirl_Wait` and `EnRecepgirl_Talk`. The setup functions are thus `EnRecepgirl_SetupWait` and `EnRecepgirl_SetupTalk`. For more complex actors, we have a tool called `graphovl.py` that can produce function flow graphs for actors: running ``` @@ -551,7 +551,7 @@ We like to make macros for reading an actor's `params` (indeed, this is required Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_tree_Colheader_001B2C, &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); } ``` @@ -571,7 +571,7 @@ Notice that we use `thisx`: this makes the form of every one of these macros the Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_tree_Colheader_001B2C, &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); } ``` diff --git a/docs/tutorial/draw_functions.md b/docs/tutorial/draw_functions.md index 4eb22bf4fe..2e8948268e 100644 --- a/docs/tutorial/draw_functions.md +++ b/docs/tutorial/draw_functions.md @@ -12,29 +12,29 @@ This document will be a bit different: we will look at the draw functions in EnR 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 -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Draw(Actor* thisx, PlayState* play); ``` 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 -s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); // extern -void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor); // extern +s32 func_80C10558(PlayState* play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); // extern +void func_80C10590(PlayState* play, s32 limbIndex, Actor *actor); // extern void *D_80C106B0[4] = {(void *)0x600F8F0, (void *)0x600FCF0, (void *)0x60100F0, (void *)0x600FCF0}; -void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Draw(Actor* thisx, PlayState* play) { EnRecepgirl* this = (EnRecepgirl *) thisx; GraphicsContext *sp30; Gfx *temp_v1; GraphicsContext *temp_a0; - temp_a0 = globalCtx->state.gfxCtx; + temp_a0 = play->state.gfxCtx; sp30 = temp_a0; func_8012C28C(temp_a0); temp_v1 = sp30->polyOpa.p; sp30->polyOpa.p = temp_v1 + 8; temp_v1->words.w0 = 0xDB060020; temp_v1->words.w1 = (u32) D_80C106B0[this->unk_2AC]; - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, (Actor *) this); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, (Actor *) this); } ``` @@ -91,25 +91,25 @@ If you have worked on OoT, you will be aware of the functions `Graph_OpenDisps` It's sensible to eliminate all the `gfxCtx` temps and reintroduce as needed. Also remember to change the prototype and function definition back! ```C -s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); +s32 func_80C10558(PlayState* play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s") -void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor); +void func_80C10590(PlayState* play, s32 limbIndex, Actor *actor); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10590.s") // #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_Draw.s") -void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Draw(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } ``` @@ -117,20 +117,20 @@ And this matches. The last two functions in the actor are used as arguments in `SkelAnime_DrawTransformFlexOpa`. This is a `SkelAnime` function, except unlike the OoT ones, it has three function callback arguments instead of two: in `functions.h` or `z_skelanime.c`, we find ```C -void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor) ``` The typedefs of the callbacks it uses are in `z64animation.h`: ```C -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, struct Actor* thisx); -typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, +typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* thisx); [...] -typedef void (*TransformLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* thisx); +typedef void (*TransformLimbDrawOpa)(struct PlayState* play, s32 limbIndex, struct Actor* thisx); ``` which is where mips2c got them from. @@ -140,7 +140,7 @@ In this case, only two of them are used, and it is these that are the last funct Well, we don't have a PostLimbDraw here, but as we see from the prototype, it's much the same as the OverrideLimbDraw but without the `pos` argument and no return value. ```C -s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor) { +s32 func_80C10558(PlayState* play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *actor) { if (limbIndex == 5) { rot->x += actor->unk2B0; } @@ -149,7 +149,7 @@ s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p ``` Only two things to do here: we need to use `EnRecepgirl` to get to `actor + 0x2B0`, and the return value is used as a boolean, so we replace `0` by `false` (`true` means "don't draw the limb", and is hardly ever used). ```C -s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { +s32 func_80C10558(PlayState* play, s32 limbIndex, Gfx **dList, Vec3f *pos, Vec3s *rot, Actor *thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -161,7 +161,7 @@ s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p As for the TransformLimbDraw, it has a much simpler prototype. mips2c gives ```C -void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor) { +void func_80C10590(PlayState* play, s32 limbIndex, Actor *actor) { if (limbIndex == 5) { Matrix_RotateYS((s16) (0x400 - actor->unk2AE), 1); Matrix_MultVecX(500.0f, (Vec3f *) &actor->focus); @@ -173,7 +173,7 @@ There is only minor cleanup needed here: - replacing the last argument of `Matrix_RotateYS` by the enum `MTXMODE_APPLY` (which means "use the current matrix instead of starting from a new identity matrix"), and the first argument by `0x400 - this->unk_2AE.x`. - `(Vec3f *) &actor->focus` to `&actor->focus.pos` (this is the same issue as `(Actor*)this`, where mips2c doesn't climb deep enough into the struct). ```C -void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { +void func_80C10590(PlayState* play, s32 limbIndex, Actor *thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -187,7 +187,7 @@ void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *thisx) { Since EnRecepgirl was a bit light on graphics macros, we will look at an example that has a few more. A nice simple one is `ObjTree_Draw`: the original mips2c output is ```C -void ObjTree_Draw(Actor *thisx, GlobalContext *globalCtx) { +void ObjTree_Draw(Actor* thisx, PlayState* play) { s16 sp36; s16 sp34; Gfx *sp28; @@ -201,14 +201,14 @@ void ObjTree_Draw(Actor *thisx, GlobalContext *globalCtx) { sp36 = (s16) (s32) (f32) thisx->shape.rot.x; sp34 = (s16) (s32) (f32) thisx->shape.rot.z; - temp_a0 = globalCtx->state.gfxCtx; + temp_a0 = play->state.gfxCtx; temp_s0 = temp_a0; func_8012C28C(temp_a0); temp_v0 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0 + 8; temp_v0->words.w0 = 0xDA380003; sp28 = temp_v0; - sp28->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + sp28->words.w1 = Matrix_NewMtx(play->state.gfxCtx); temp_v0_2 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0_2 + 8; temp_v0_2->words.w1 = (u32) &D_06000680; @@ -218,7 +218,7 @@ void ObjTree_Draw(Actor *thisx, GlobalContext *globalCtx) { temp_s0->polyOpa.p = temp_v0_3 + 8; temp_v0_3->words.w0 = 0xDA380003; sp20 = temp_v0_3; - sp20->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + sp20->words.w1 = Matrix_NewMtx(play->state.gfxCtx); temp_v0_4 = temp_s0->polyOpa.p; temp_s0->polyOpa.p = temp_v0_4 + 8; temp_v0_4->words.w1 = (u32) &D_060007C8; @@ -231,7 +231,7 @@ We can see there are four blocks here, although only two different macros: temp_s0->polyOpa.p = temp_v0 + 8; temp_v0->words.w0 = 0xDA380003; sp28 = temp_v0; - sp28->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + sp28->words.w1 = Matrix_NewMtx(play->state.gfxCtx); ``` gfxdis gives ``` @@ -240,7 +240,7 @@ gSPMatrix(POLY_OPA_DISP++, 0x12345678, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVI ``` so it becomes ```C -gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); ``` ```C @@ -263,7 +263,7 @@ gSPDisplayList(POLY_OPA_DISP++, D_06000680); temp_s0->polyOpa.p = temp_v0_3 + 8; temp_v0_3->words.w0 = 0xDA380003; sp20 = temp_v0_3; - sp20->words.w1 = Matrix_NewMtx(globalCtx->state.gfxCtx); + sp20->words.w1 = Matrix_NewMtx(play->state.gfxCtx); ``` This is the same as the first one. Indeed, it's identical. ```C @@ -276,21 +276,21 @@ This is the same as the second one, but with a different second word. Tidying up and inserting `OPEN_DISPS` and `CLOSE_DISPS`, we end up with ```C -void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTree_Draw(Actor* thisx, PlayState* play) { s16 sp36 = (f32) thisx->shape.rot.x; s16 sp34 = (f32) thisx->shape.rot.z; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_06000680); Matrix_RotateZYX(sp36, 0, sp34, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_060007C8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } ``` diff --git a/docs/tutorial/introduction.md b/docs/tutorial/introduction.md index 6178019c8a..99625364d0 100644 --- a/docs/tutorial/introduction.md +++ b/docs/tutorial/introduction.md @@ -40,13 +40,13 @@ glabel func_809529AC and turn it into compilable C code: ```C -void func_809529AC(EnMs *this, GlobalContext *globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809529AC(EnMs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.textId = 0; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80952A1C; } else { - Actor_PickUp(&this->actor, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } ``` diff --git a/docs/tutorial/object_decomp_example.md b/docs/tutorial/object_decomp_example.md index 798167e68a..8de89d0750 100644 --- a/docs/tutorial/object_decomp_example.md +++ b/docs/tutorial/object_decomp_example.md @@ -61,7 +61,7 @@ Now, we can redefine the `jointTable` and `morphTable` in terms of the limb enum We can also use our new skeleton name and limb enum when initialization the skeleton like so: ```c -SkelAnime_Init(globalCtx, &this->skelAnime, &gKingsChamberDekuGuardSkel, NULL, this->jointTable, this->morphTable, KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX); +SkelAnime_Init(play, &this->skelAnime, &gKingsChamberDekuGuardSkel, NULL, this->jointTable, this->morphTable, KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX); ``` Lastly, we can use our limb enum in `EnDns_PostLimbDraw`. Where the code originally had: diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index f9a189d6ba..f85bf7ad89 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -26,7 +26,7 @@ void EnRecepgirl_Destroy(s32 arg0, ? arg1) { ``` so it really does do nothing. It is worth staying on this briefly to understand what is is doing, though. Even with no context, mips2c knows it takes two arguments because it does two saves onto the stack: the calling convention the N64 uses requires the first four arguments be saved from the registers onto the stack, since the registers are expected to be cleared when a function call happens. It's done a bad job of guessing what they are, but that's to be expected: the assembly only tells us they're words. Thankfully we already know in this case, so we can just replace the `GLOBAL_ASM` by ```C -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play) { } ``` @@ -54,11 +54,11 @@ void func_80C10148(EnRecepgirl *this) { This gives us some information immediately: `D_0600AD98` is an `AnimationHeader`, and `func_80C1019C` is set as the action function. This means that we know its type, even though mips2c does not: looking in the header, we see the typedef is ```C -typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); +typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, PlayState*); ``` and so we prototype `func_80C1019C` as ```C -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C1019C(EnRecepgirl* this, PlayState* play); ``` at the top (were it above the function we're currently working on, the prototype could eventually be replaced by the function definition itself, but since it isn't, it goes at the top with the others). @@ -73,7 +73,7 @@ If we tackle these, we end up with ```C void func_80C10148(EnRecepgirl* this); -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C1019C(EnRecepgirl* this, PlayState* play); [...] @@ -103,7 +103,7 @@ Remake the context and run mips2c on this function's assembly file. We get ```C ? func_80C10290(EnRecepgirl *); // extern -void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { +void func_80C1019C(EnRecepgirl* this, PlayState* play) { SkelAnime *sp24; SkelAnime *temp_a0; @@ -116,17 +116,17 @@ void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { Animation_ChangeTransitionRepeat(temp_a0, &D_06009890, -4.0f); } } - if (Actor_ProcessTalkRequest((Actor *) this, globalCtx) != 0) { + if (Actor_ProcessTalkRequest((Actor *) this, play) != 0) { func_80C10290(this); return; } if (Actor_IsFacingPlayer((Actor *) this, 0x2000) != 0) { - func_800B8614((Actor *) this, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == 2) { + func_800B8614((Actor *) this, play, 60.0f); + if (Player_GetMask(play) == 2) { this->actor.textId = 0x2367; return; } - if (Flags_GetSwitch(globalCtx, (s32) this->actor.params) != 0) { + if (Flags_GetSwitch(play, (s32) this->actor.params) != 0) { this->actor.textId = 0x2ADC; return; } @@ -147,7 +147,7 @@ This is a bit juicier! We can do some preliminary cleanup, then worry about the Changing all these, we end up with ```C void func_80C10148(EnRecepgirl* this); -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx); +void func_80C1019C(EnRecepgirl* this, PlayState* play); void func_80C10290(EnRecepgirl* this); [...] @@ -160,7 +160,7 @@ extern FlexSkeletonHeader D_06011B60; [...] -void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { +void func_80C1019C(EnRecepgirl* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (&D_0600A280 == this->skelAnime.animation) { Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); @@ -168,17 +168,17 @@ void func_80C1019C(EnRecepgirl *this, GlobalContext *globalCtx) { Animation_ChangeTransitionRepeat(&this->skelAnime, &D_06009890, -4.0f); } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { func_80C10290(this); return; } if (Actor_IsFacingPlayer(&this->actor, 0x2000) != 0) { - func_800B8614(&this->actor, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == 2) { + func_800B8614(&this->actor, play, 60.0f); + if (Player_GetMask(play) == 2) { this->actor.textId = 0x2367; return; } - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; return; } @@ -194,7 +194,7 @@ If we look with diff.py, we find this matches. But we can replace some of the `r Here, it's debatable whether to keep the first, since `func_80C10290` is likely a setup function. The latter two should be changed to elses, though. For now, let's replace all of them. This leaves us with ```C -void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { +void func_80C1019C(EnRecepgirl* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &D_0600A280) { Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 5.0f); @@ -203,13 +203,13 @@ void func_80C1019C(EnRecepgirl* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { func_80C10290(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_800B8614(&this->actor, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == 2) { + func_800B8614(&this->actor, play, 60.0f); + if (Player_GetMask(play) == 2) { this->actor.textId = 0x2367; - } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; } else { this->actor.textId = 0x2AD9; @@ -227,7 +227,7 @@ typedef enum { /* 0x19 */ PLAYER_MASK_MAX } PlayerMask; ``` -and so we can write the last if as `Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK`. +and so we can write the last if as `Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK`. Again, we have no choice in what to do next. @@ -236,7 +236,7 @@ Again, we have no choice in what to do next. Remaking the context and running mips2c gives ```C -void func_80C102D4(EnRecepgirl *, GlobalContext *); // extern +void func_80C102D4(EnRecepgirl*, PlayState*); // extern void func_80C10290(EnRecepgirl *this) { Animation_MorphToPlayOnce(&this->skelAnime, &D_0600A280, -4.0f); @@ -256,7 +256,7 @@ Large code block, click to show ```C extern AnimationHeader D_06000968; -void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { +void func_80C102D4(EnRecepgirl* this, PlayState* play) { SkelAnime *sp20; AnimationHeader *temp_v0; SkelAnime *temp_a0; @@ -282,16 +282,16 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { Animation_MorphToPlayOnce(sp20, &D_0600A280, -4.0f); } } - temp_v0_2 = Message_GetState(&globalCtx->msgCtx); + temp_v0_2 = Message_GetState(&play->msgCtx); if (temp_v0_2 == 2) { this->actor.textId = 0x2ADC; func_80C10148(this); return; } - if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { + if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(play) != 0)) { temp_v0_3 = this->actor.textId; if (temp_v0_3 == 0x2AD9) { - Flags_SetSwitch(globalCtx, (s32) this->actor.params); + Flags_SetSwitch(play, (s32) this->actor.params); Animation_MorphToPlayOnce(sp20, &D_0600AD98, 10.0f); if ((*(&gSaveContext + 0xF37) & 0x80) != 0) { this->actor.textId = 0x2ADF; @@ -312,7 +312,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { this->actor.textId = 0x2AE0; } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } ``` @@ -321,7 +321,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { Well, this is a big one! We get one more extern, for `D_06000968`. A lot of the temps used in the conditionals look fake, with the exception of `temp_v0_2`: because the function is only called once but the temp is used twice, the temp must be real. Removing the others and switching the `animation` conditionals, ```C -void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { +void func_80C102D4(EnRecepgirl* this, PlayState* play) { u8 temp_v0_2; if (SkelAnime_Update(&this->skelAnime) != 0) { @@ -340,16 +340,16 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { } } - temp_v0_2 = Message_GetState(&globalCtx->msgCtx); + temp_v0_2 = Message_GetState(&play->msgCtx); if (temp_v0_2 == 2) { this->actor.textId = 0x2ADC; func_80C10148(this); return; } - if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { + if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(play) != 0)) { if (this->actor.textId == 0x2AD9) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f); if ((*(&gSaveContext + 0xF37) & 0x80) != 0) { this->actor.textId = 0x2ADF; @@ -369,7 +369,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) { this->actor.textId = 0x2AE0; } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } ``` @@ -390,14 +390,14 @@ The yellow shows registers that don't match, the different colours on the regist ``` somehow we skipped over `t0`. Where is this in the code? The `153` in the middle is the line number in the C file (the `3f0`s are the offsets into the assembly file), we have `--source` if you want to see the code explicitly, or you can do it the old-fashioned way, and work it out from nearby function calls. In this case, `func_80C10148` is run straight after, and the only place that is called is ```C - temp_v0_2 = Message_GetState(&globalCtx->msgCtx); + temp_v0_2 = Message_GetState(&play->msgCtx); if (temp_v0_2 == 2) { this->actor.textId = 0x2ADC; func_80C10148(this); return; } - if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) { + if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(play) != 0)) { ``` If you look at the conditionals and the declaration of `temp_v0_2`, you may notice something odd: `temp_v0_2` is a `u8`. Therefore the `& 0xFF` does nothing! It's surprisingly common for this to happen, be it leaving out a `& 0xFF` or adding an extraneous one. If we remove it, we get a match: @@ -417,12 +417,12 @@ Remake the context and run mips2c: ```C ? func_80C100DC(EnRecepgirl *); // extern -void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Update(Actor* thisx, PlayState* play) { EnRecepgirl* this = (EnRecepgirl *) thisx; ? sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, (Actor *) this, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); + this->actionFunc(this, play); + Actor_TrackPlayer(play, (Actor *) this, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); func_80C100DC(this); } ``` @@ -435,18 +435,18 @@ void func_80C100DC(EnRecepgirl *); [...] -void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Update(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; ? sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, this + 0x2AE, (Vec3s *) &sp30, (bitwise Vec3f) this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z); func_80C100DC(this); } ``` Now, our problem is `Actor_TrackPlayer`. The arguments all look terrible! Indeed, if we look at the actual function in `src/code/code_800E8EA0.c` (found by searching), we find that it should be ```C -s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) +s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) ``` So mips2c has made a bit of a mess here: - the third argument should be a `Vec3s`. Hence `this + 0x2AE` is a `Vec3s*`, and so `this->unk_2AE` is a `Vec3s` @@ -455,12 +455,12 @@ So mips2c has made a bit of a mess here: Fixing all of this, we end up with ```C -void EnRecepgirl_Update(EnRecepgirl *this, GlobalContext *globalCtx) { +void EnRecepgirl_Update(EnRecepgirl* this, PlayState* play) { EnRecepgirl* this = THIS; Vec3s sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); func_80C100DC(this); } ``` @@ -482,21 +482,21 @@ It's entirely possible that `unk_2AD` is not real, and is just padding: see [Typ ![EnRecepgirl_Update's stack difference](images/EnRecepgirl_stack_diff.png) -So `sp30` is in the wrong place: it's `4` too high on the stack in ours. This is because the main four functions do not actually take `GlobalContext`: they really take `Gamestate` and recast it with a temp, just like `EnRecepgirl* this = THIS;`. We haven't implemented this in the repo yet, though, so for now, it suffices to put a pad on the stack where it would go instead: experience has shown when it matters, it goes above the actor recast, so we end up with +So `sp30` is in the wrong place: it's `4` too high on the stack in ours. This is because the main four functions do not actually take `PlayState`: they really take `Gamestate` and recast it with a temp, just like `EnRecepgirl* this = THIS;`. We haven't implemented this in the repo yet, though, so for now, it suffices to put a pad on the stack where it would go instead: experience has shown when it matters, it goes above the actor recast, so we end up with ```C -void EnRecepgirl_Update(Actor *thisx, GlobalContext *globalCtx) { +void EnRecepgirl_Update(Actor* thisx, PlayState* play) { s32 pad; EnRecepgirl* this = THIS; Vec3s sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, &this->unk_2AE, &sp30, this->actor.focus.pos); func_80C100DC(this); } ``` and this now matches. -**N.B.** sometimes using an actual `GlobalContext* globalCtx` temp is required for matching: add it to your bag o' matching memes. +**N.B.** sometimes using an actual `PlayState* play` temp is required for matching: add it to your bag o' matching memes. ### *Some remarks about the function stack diff --git a/docs/tutorial/types_structs_padding.md b/docs/tutorial/types_structs_padding.md index dc72e0100b..2e1d4d8b93 100644 --- a/docs/tutorial/types_structs_padding.md +++ b/docs/tutorial/types_structs_padding.md @@ -33,7 +33,7 @@ Useful data for guessing types: Another useful thing to put here: the typedef 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. `EnRecepgirl`. In MM these typedefs have been automatically generated, so you don't need to constantly copy from here or another actor any more. diff --git a/include/functions.h b/include/functions.h index 84be91ee7e..b16e79798b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -430,27 +430,27 @@ s32 __osStrcmp(const char* str1, const char* str2); char* __osStrcpy(char* dst, const char* src); void* __osMemcpy(void* dst, void* src, size_t size); -// void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale); -// void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx); -// void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx); -// void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx); -// void func_800A640C(EnItem00* this, GlobalContext* globalCtx); -// void func_800A6650(EnItem00* this, GlobalContext* globalCtx); -// void func_800A6780(EnItem00* this, GlobalContext* globalCtx); -// void func_800A6A40(EnItem00* this, GlobalContext* globalCtx); -// void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx); -// void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx); -// void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx); -// void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx); -// void EnItem00_DrawHeartContainer(EnItem00* this, GlobalContext* globalCtx); -// void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx); +// void EnItem00_SetObject(EnItem00* this, PlayState* play, f32* shadowOffset, f32* shadowScale); +// void EnItem00_Init(Actor* thisx, PlayState* play); +// void EnItem00_Destroy(Actor* thisx, PlayState* play); +// void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play); +// void func_800A640C(EnItem00* this, PlayState* play); +// void func_800A6650(EnItem00* this, PlayState* play); +// void func_800A6780(EnItem00* this, PlayState* play); +// void func_800A6A40(EnItem00* this, PlayState* play); +// void EnItem00_Update(Actor* thisx, PlayState* play); +// void EnItem00_Draw(Actor* thisx, PlayState* play); +// void EnItem00_DrawRupee(EnItem00* this, PlayState* play); +// void EnItem00_DrawSprite(EnItem00* this, PlayState* play); +// void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play); +// void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play); // s16 func_800A7650(s16 dropId); -Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params); -Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 params); -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params); +Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params); +Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params); +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params); s32 func_800A8150(s32 index); s32 func_800A817C(s32 index); -s32 Item_CanDropBigFairy(GlobalContext* globalCtx, s32 index, s32 collectibleFlag); +s32 Item_CanDropBigFairy(PlayState* play, s32 index, s32 collectibleFlag); void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); void EffectBlure_AddSpace(EffectBlure* this); void EffectBlure_Init1(void* thisx, void* initParamsx); @@ -466,168 +466,168 @@ 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_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_800AE5A0(GlobalContext* globalCtx); -void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3); -void func_800AE8EC(GlobalContext* globalCtx); +void func_800AE2A0(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE434(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE5A0(PlayState* play); +void func_800AE5E4(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE778(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3); +void func_800AE8EC(PlayState* play); void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f32 arg3, s16 angle, CollisionPoly* colPoly, s32 arg6); void func_800AEF44(EffectTireMark* this); void EffectTireMark_Init(void* thisx, void* initParamsx); void EffectTireMark_Destroy(void* thisx); s32 EffectTireMark_Update(void* thisx); void EffectTireMark_Draw(void* thisx, GraphicsContext* gfxCtx); -GlobalContext* Effect_GetGlobalCtx(void); +PlayState* Effect_GetPlayState(void); void* Effect_GetByIndex(s32 index); -void Effect_Init(GlobalContext* globalCtx); -void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams); +void Effect_Init(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_Destroy(GlobalContext* globalCtx, s32 index); -void Effect_DestroyAll(GlobalContext* globalCtx); -void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries); -void EffectSS_Clear(GlobalContext* globalCtx); +void Effect_UpdateAll(PlayState* play); +void Effect_Destroy(PlayState* play, s32 index); +void Effect_DestroyAll(PlayState* play); +void EffectSS_Init(PlayState* play, s32 numEntries); +void EffectSS_Clear(PlayState* play); EffectSs* EffectSS_GetTable(void); void EffectSS_Delete(EffectSs* param_1); void EffectSS_ResetEntry(EffectSs* particle); s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry); -void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* particle); -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams); -void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index); -void EffectSS_UpdateAllParticles(GlobalContext* globalCtx); -void EffectSS_DrawParticle(GlobalContext* globalCtx, s32 index); -void EffectSS_DrawAllParticles(GlobalContext* globalCtx); +void EffectSS_Copy(PlayState* play, EffectSs* particle); +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams); +void EffectSS_UpdateParticle(PlayState* play, s32 index); +void EffectSS_UpdateAllParticles(PlayState* play); +void EffectSS_DrawParticle(PlayState* play, s32 index); +void EffectSS_DrawAllParticles(PlayState* play); s16 func_800B096C(s16 param_1, s16 param_2, s32 param_3); s16 func_800B09D0(s16 a0, s16 a1, f32 a2); u8 func_800B0A24(u8 a0, u8 a1, f32 a2); -void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* texture); -void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life, u8 updateMode); -void func_800B0DE0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_800B0E48(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_800B0EB0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800B0F18(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800B0F80(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); -void func_800B0FE8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_800B1054(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); -void func_800B10C0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800B1130(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800B11A0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_800B1210(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); -void func_800B1280(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_800B12F0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); -void func_800B1360(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void func_800B139C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); +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_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_800B0E48(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_800B0EB0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_800B0F18(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_800B0F80(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life); +void func_800B0FE8(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_800B1054(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 scaleStep); +void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); +void func_800B11A0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_800B1210(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep); +void func_800B1280(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); +void func_800B12F0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life); +void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); +void func_800B139C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel); -void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos); -void func_800B1598(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, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); -void EffectSsKirakira_SpawnDispersed(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); +void func_800B14D4(PlayState* play, f32 randScale, Vec3f* srcPos); +void func_800B1598(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 EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor); +void EffectSsKirakira_SpawnDispersed(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s32 life); // void EffectSsKirakira_SpawnFocused(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); // void EffectSsBomb2_SpawnFade(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4); -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); // void EffectSsBlast_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, Color_RGBA8* param_5, Color_RGBA8* param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); -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(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7); -void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); +void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); // void EffectSsGSpk_SpawnAccel(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, Vec3f* pzParm4, Vec3f* param_5, Color_RGBA8* param_6, Color_RGBA8* param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9); // void EffectSsGSpk_SpawnNoAccel(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9); -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); // void EffectSsGSpk_SpawnRandColor(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); // void EffectSsGSpk_SpawnSmall(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s16 life, s32 arg9); -void EffectSsBubble_Spawn(GlobalContext* globalCtx, 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, s16 type, s16 scale); +void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s16 life, s32 arg9); +void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale); +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 EffectSsGFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2); // void EffectSsLightning_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Color_RGBA8* pzParm3, Color_RGBA8* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); // void EffectSsDtBubble_SpawnColorProfile(UNK_TYPE4 param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); -void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, 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, s16 objId, s16 life, Gfx* dList); -void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstScale, s16 unused, s16 scale, s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); +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(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16 scale, 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); // void func_800B2364(void); // void EffectSsStick_Spawn(UNK_TYPE4 uParm1, UNK_PTR puParm2, UNK_TYPE2 uParm3); // void EffectSsSibuki_Spawn(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); -void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos); -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 reg0); +void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0); // void EffectSsHitMark_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, UNK_TYPE2 uParm3, Vec3f* pzParm4); -void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* pos); -void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, 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_SpawnShock(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5); // void EffectSsKFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6); -void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected, s16 drawFlag); -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 EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected, s16 drawFlag); +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(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void EffectSsIcePiece_SpawnBurst(void); // void EffectSsEnIce_SpawnFlyingVec3f(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, Color_RGBA8* pzParm4, Color_RGBA8* param_5, UNK_TYPE4 param_6); -void func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3); +void func_800B2B44(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); // void func_800B2B7C(void); -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); // void EffectSsFireTail_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE4 uParm4, Vec3f* param_5, UNK_TYPE2 param_6, Color_RGBA8* param_7, Color_RGBA8* param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE4 param_11); // void EffectSsFireTail_SpawnFlame(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); // void EffectSsFireTail_SpawnFlameOnPlayer(void); -void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); // void EffectSsEnFire_SpawnVec3s(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); -void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); -void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex); -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life); +void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); +void func_800B3030(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex); +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life); // void EffectSsDeadDs_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); -void func_800B31BC(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life); -void EffectSsIceSmoke_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void func_800B31BC(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life); +void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); +void EffectSsIceBlock_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); void FlagSet_Update(GameState* gameState); void FlagSet_Draw(GameState* gameState); void Overlay_LoadGameState(GameStateOverlay* gameState); void Overlay_FreeGameState(GameStateOverlay* gameState); void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); -void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx); -void ActorShadow_DrawSquare(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_DrawCircle(Actor* actor, Lights* lights, PlayState* play); +void ActorShadow_DrawSquare(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* mapper, GlobalContext* globalCtx); +void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play); void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos); -void func_800B4AEC(GlobalContext* globalCtx, Actor* actor, f32 y); -void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx); -void Actor_GetProjectedPos(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3); +void func_800B4AEC(PlayState* play, Actor* actor, f32 y); +void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play); +void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3); -void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx); +void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play); -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag); -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag); -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag); -void Flags_SetAllTreasure(GlobalContext* globalCtx, s32 flag); -s32 Flags_GetAllTreasure(GlobalContext* globalCtx); -s32 Flags_GetClear(GlobalContext* globalCtx, s32 roomNumber); -void Flags_SetClear(GlobalContext* globalCtx, s32 roomNumber); -void Flags_UnsetClear(GlobalContext* globalCtx, s32 roomNumber); -s32 Flags_GetClearTemp(GlobalContext* globalCtx, s32 roomNumber); -void Flags_SetClearTemp(GlobalContext* globalCtx, s32 roomNumber); -void Flags_UnsetClearTemp(GlobalContext* globalCtx, s32 roomNumber); -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag); -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag); +s32 Flags_GetSwitch(PlayState* play, s32 flag); +void Flags_SetSwitch(PlayState* play, s32 flag); +void Flags_UnsetSwitch(PlayState* play, s32 flag); +s32 Flags_GetTreasure(PlayState* play, s32 flag); +void Flags_SetTreasure(PlayState* play, s32 flag); +void Flags_SetAllTreasure(PlayState* play, s32 flag); +s32 Flags_GetAllTreasure(PlayState* play); +s32 Flags_GetClear(PlayState* play, s32 roomNumber); +void Flags_SetClear(PlayState* play, s32 roomNumber); +void Flags_UnsetClear(PlayState* play, s32 roomNumber); +s32 Flags_GetClearTemp(PlayState* play, s32 roomNumber); +void Flags_SetClearTemp(PlayState* play, s32 roomNumber); +void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber); +s32 Flags_GetCollectible(PlayState* play, s32 flag); +void Flags_SetCollectible(PlayState* play, s32 flag); void TitleCard_InitBossName(GameState* gameState, TitleCardContext* titleCtx, TexturePtr texture, s16 x, s16 y, u8 width, u8 height); -s32 func_800B648C(GlobalContext* globalCtx, s32 arg1, s32 arg2, f32 arg3, Vec3f* arg4); -f32 func_800B64FC(GlobalContext* globalCtx, f32 arg1, Vec3f* arg2, u32* arg3); -void* func_800B6584(GlobalContext* globalCtx, s16 id, void* arg2, size_t size); -void* func_800B6608(GlobalContext* globalCtx, s16 id); -void* func_800B6680(GlobalContext* globalCtx, s16 id); +s32 func_800B648C(PlayState* play, s32 arg1, s32 arg2, f32 arg3, Vec3f* arg4); +f32 func_800B64FC(PlayState* play, f32 arg1, Vec3f* arg2, u32* arg3); +void* func_800B6584(PlayState* play, s16 id, void* arg2, size_t size); +void* func_800B6608(PlayState* play, s16 id); +void* func_800B6680(PlayState* play, s16 id); void Actor_MarkForDeath(Actor* actor); void Actor_SetWorldToHome(Actor* actor); void Actor_SetFocus(Actor* actor, f32 height); void Actor_SetWorldRotToShape(Actor* actor); void Actor_SetShapeRotToWorld(Actor* actor); void Actor_SetScale(Actor* actor, f32 scale); -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor); +void Actor_SetObjectDependency(PlayState* play, Actor* actor); void Actor_SetMovementScale(s32 scale); void Actor_UpdatePos(Actor* actor); void Actor_UpdateVelocityWithGravity(Actor* actor); @@ -649,19 +649,19 @@ f32 Actor_XZDistanceBetweenActors(Actor* actor1, Actor* actor2); f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point); void Actor_OffsetOfPointInActorCoords(Actor* actor, Vec3f* offset, Vec3f* point); f32 Actor_HeightDiff(Actor* actor1, Actor* actor2); -void func_800B6F20(GlobalContext* globalCtx, Input* input, f32 arg2, s16 arg3); +void func_800B6F20(PlayState* play, Input* input, f32 arg2, s16 arg3); f32 Player_GetHeight(Player* player); f32 Player_GetRunSpeedLimit(Player* player); s32 func_800B7118(Player* player); s32 func_800B7128(Player* player); -s32 func_800B715C(GlobalContext* globalCtx); -void Actor_SetCameraHorseSetting(GlobalContext* globalCtx, Player* player); -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse); -s32 func_800B724C(GlobalContext* globalCtx, Actor* actor, u8 csMode); -u32 func_800B7298(GlobalContext* globalCtx, Actor* actor, u8 csMode); +s32 func_800B715C(PlayState* play); +void Actor_SetCameraHorseSetting(PlayState* play, Player* player); +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse); +s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode); +u32 func_800B7298(PlayState* play, Actor* actor, u8 csMode); void func_800B72F8(DynaPolyActor* dyna, f32 extraPushForce, s16 yRotation); -s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, GlobalContext* globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, PlayState* play); s32 Actor_ActorBIsFacingActorA(Actor* actorA, Actor* actorB, s16 maxAngleDiff); s32 Actor_IsFacingPlayer(Actor* actor, s16 angle); s32 Actor_ActorAIsFacingActorB(Actor* actorA, Actor* actorB, s16 maxAngleDiff); @@ -669,48 +669,48 @@ s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 maxAngleDiff); s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 maxAngleDiff); void func_800B75A0(CollisionPoly* poly, Vec3f* normal, s16* azimuth); -void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 flags); +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 flags); Hilite* Hilite_DrawOpa(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); -void func_800B8050(Actor* actor, GlobalContext* globalCtx, s32 flag); -void func_800B8118(Actor* actor, GlobalContext* globalCtx, s32 flag); +void func_800B8050(Actor* actor, PlayState* play, s32 flag); +void func_800B8118(Actor* actor, PlayState* play, s32 flag); PosRot* Actor_GetFocus(PosRot* dest, Actor* actor); PosRot* Actor_GetWorld(PosRot* dest, Actor* actor); PosRot* Actor_GetWorldPosShapeRot(PosRot* dest, Actor* actor); s32 func_800B83F8(Actor* actor, Player* player, s32 flag); s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState); -s32 func_800B8500(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId); -s32 func_800B85E0(Actor* actor, GlobalContext* globalCtx, f32 radius, s32 exchangeItemId); -s32 func_800B8614(Actor* actor, GlobalContext* globalCtx, f32 radius); -s32 func_800B863C(Actor* actor, GlobalContext* globalCtx); -s32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx); -s32 Actor_ChangeFocus(Actor* actor1, GlobalContext* globalCtx, Actor* actor2); -s32 Player_GetExchangeItemId(GlobalContext* globalCtx); +s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId); +s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, s32 exchangeItemId); +s32 func_800B8614(Actor* actor, PlayState* play, f32 radius); +s32 func_800B863C(Actor* actor, PlayState* play); +s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play); +s32 Actor_ChangeFocus(Actor* actor1, PlayState* play, Actor* actor2); +s32 Player_GetExchangeItemId(PlayState* play); s32 func_800B8718(Actor* actor, GameState* gameState); -s32 func_800B874C(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange); -s32 func_800B8804(Actor* actor, GlobalContext* globalCtx, f32 xzRange); -s32 func_800B886C(Actor* actor, GlobalContext* globalCtx); -void Actor_GetScreenPos(GlobalContext* globalCtx, Actor* actor, s16* x, s16* y); -s32 func_800B8934(GlobalContext* globalCtx, Actor* actor); -s32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx); -s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange); -s32 Actor_PickUpNearby(Actor* actor, GlobalContext* globalCtx, s32 getItemId); -s32 Actor_LiftActor(Actor* actor, GlobalContext* globalCtx); -s32 Actor_PickUpFar(Actor* actor, GlobalContext* globalCtx, s32 getItemId); -s32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx); -void func_800B8C20(Actor* actorA, Actor* actorB, GlobalContext* globalCtx); -void func_800B8C50(Actor* actor, GlobalContext* globalCtx); -s32 Actor_HasRider(GlobalContext* globalCtx, Actor* horse); -s32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide); -s32 Actor_HasNoRider(GlobalContext* globalCtx, Actor* horse); -void func_800B8D10(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); -void func_800B8D50(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 yaw, f32 arg4, u32 arg5); -void func_800B8D98(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); -void func_800B8DD4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_800B8E1C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange); +s32 func_800B8804(Actor* actor, PlayState* play, f32 xzRange); +s32 func_800B886C(Actor* actor, PlayState* play); +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); +s32 func_800B8934(PlayState* play, Actor* actor); +s32 Actor_HasParent(Actor* actor, PlayState* play); +s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); +s32 Actor_PickUpNearby(Actor* actor, PlayState* play, s32 getItemId); +s32 Actor_LiftActor(Actor* actor, PlayState* play); +s32 Actor_PickUpFar(Actor* actor, PlayState* play, s32 getItemId); +s32 Actor_HasNoParent(Actor* actor, PlayState* play); +void func_800B8C20(Actor* actorA, Actor* actorB, PlayState* play); +void func_800B8C50(Actor* actor, PlayState* play); +s32 Actor_HasRider(PlayState* play, Actor* horse); +s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide); +s32 Actor_HasNoRider(PlayState* play, Actor* horse); +void func_800B8D10(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); +void func_800B8D50(PlayState* play, Actor* actor, f32 arg2, s16 yaw, f32 arg4, u32 arg5); +void func_800B8D98(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +void func_800B8DD4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); +void func_800B8E1C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); void func_800B8E58(Player* player, u16 sfxId); void Actor_PlaySfxAtPos(Actor* actor, u16 sfxId); -void func_800B8EF4(GlobalContext* globalCtx, Actor* actor); +void func_800B8EF4(PlayState* play, Actor* actor); void func_800B8F98(Actor* actor, u16 sfxId); void func_800B8FC0(Actor* actor, u16 sfxId); void func_800B8FE8(Actor* actor, u16 sfxId); @@ -718,54 +718,54 @@ void func_800B9010(Actor* actor, u16 sfxId); void func_800B9038(Actor* actor, s32 timer); void func_800B9084(Actor* actor); void func_800B9098(Actor* actor); -s32 func_800B90AC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4); -void func_800B90F4(GlobalContext* globalCtx); +s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4); +void func_800B90F4(PlayState* play); void func_800B9120(ActorContext* actorCtx); -void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry); -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); -s32 Actor_RecordUndrawnActor(GlobalContext* globalCtx, Actor* actor); -void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_800BA6FC(GlobalContext* globalCtx, ActorContext* actorCtx); -void func_800BA798(GlobalContext* globalCtx, ActorContext* actorCtx); -void Actor_CleanupContext(ActorContext* actorCtx, GlobalContext* globalCtx); -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params); -Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, GlobalContext* globalCtx, s16 index, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s32 params, u32 cutscene, s32 arg11, Actor* parent); -Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params); -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx); -void Enemy_StartFinishingBlow(GlobalContext* globalCtx, Actor* actor); +void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry); +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx); +s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor); +void Actor_DrawAll(PlayState* play, ActorContext* actorCtx); +void func_800BA6FC(PlayState* play, ActorContext* actorCtx); +void func_800BA798(PlayState* play, ActorContext* actorCtx); +void Actor_CleanupContext(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, s32 params); +Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s32 params, u32 cutscene, s32 arg11, Actor* parent); +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params); +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx); +void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); s16 func_800BBAC0(s16 arg0[2], s16 arg1, s16 arg2, s16 arg3); s16 func_800BBB74(s16 arg0[2], s16 arg1, s16 arg2, s16 arg3); -void Actor_SpawnBodyParts(Actor* actor, GlobalContext* globalCtx, s32 arg2, Gfx** dList); -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 countMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting); -void func_800BBFB0(GlobalContext* globalCtx, Vec3f* position, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6); -void func_800BC154(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory); +void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 arg2, Gfx** dList); +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 countMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting); +void func_800BBFB0(PlayState* play, Vec3f* position, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6); +void func_800BC154(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory); s32 func_800BC188(s32 index); -Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, s32 arg3); -Actor* func_800BC444(GlobalContext* globalCtx, Actor* actor, f32 arg2); -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); -void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx); -void func_800BC770(GlobalContext* globalCtx, s16 y, s16 countdown); -void func_800BC7D8(GlobalContext* globalCtx, s16 y, s16 countdown, s16 speed); -void func_800BC848(Actor* actor, GlobalContext* globalCtx, s16 y, s16 countdown); -void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type); +Actor* func_800BC270(PlayState* play, Actor* actor, f32 arg2, s32 arg3); +Actor* func_800BC444(PlayState* play, Actor* actor, f32 arg2); +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); +void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play); +void func_800BC770(PlayState* play, s16 y, s16 countdown); +void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed); +void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown); +void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type); void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration); -Hilite* func_800BCBF4(Vec3f* arg0, GlobalContext* globalCtx); -Hilite* func_800BCC68(Vec3f* arg0, GlobalContext* globalCtx); +Hilite* func_800BCBF4(Vec3f* arg0, PlayState* play); +Hilite* func_800BCC68(Vec3f* arg0, PlayState* play); void Actor_GetClosestPosOnPath(Vec3s* points, s32 numPoints, Vec3f* srcPos, Vec3f* dstPos, s32 isPathLoop); -s32 func_800BD2B4(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 arg3, u16 (*textIdCallback)(GlobalContext*, Actor*), s16 (*arg5)(GlobalContext*, Actor*)); +s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*textIdCallback)(PlayState*, Actor*), s16 (*arg5)(PlayState*, Actor*)); void func_800BD888(Actor* actor, struct_800BD888_arg1* arg1, s16 arg2, s16 arg3); -void func_800BD9E0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -void func_800BDAA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); +void func_800BD9E0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); +void func_800BDAA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animation, s32 index); -void Actor_Noop(Actor* actor, GlobalContext* globalCtx); +void Actor_Noop(Actor* actor, PlayState* play); -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist); -void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist); +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist); +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist); -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* inActor, s16 actorId, u8 actorCategory, f32 distance); -s32 func_800BE184(GlobalContext* globalCtx, Actor* actor, f32 xzDist, s16 arg3, s16 arg4, s16 arg5); +Actor* Actor_FindNearby(PlayState* play, Actor* inActor, s16 actorId, u8 actorCategory, f32 distance); +s32 func_800BE184(PlayState* play, Actor* actor, f32 xzDist, s16 arg3, s16 arg4, s16 arg5); u8 Actor_ApplyDamage(Actor* actor); void Actor_SetDropFlag(Actor* actor, ColliderInfo* colInfo); void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSphere); @@ -775,8 +775,8 @@ void func_800BE504(Actor* actor, ColliderCylinder* collider); void func_800BE568(Actor* actor, ColliderSphere* collider); void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex); s32 Actor_IsSmallChest(struct EnBox* chest); -void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type); -void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, f32 scale, f32 scaleRange); +void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type); +void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, f32 scale, f32 scaleRange); void ActorOverlayTable_FaultPrint(void* arg0, void* arg1); void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1); @@ -787,8 +787,8 @@ void SSNode_SetValue(SSNode* node, s16* polyIndex, u16 next); void SSList_SetNull(SSList* head); void SSNodeList_SetSSListHead(SSNodeList* list, SSList* ssList, s16* polyIndex); void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* polyIndex); -void DynaSSNodeList_Init(GlobalContext* globalCtx, DynaSSNodeList* list); -void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* list, u32 numNodes); +void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list); +void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes); void DynaSSNodeList_ResetCount(DynaSSNodeList* list); u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* list); void BgCheck_Vec3sToVec3f(Vec3s* vertex, Vec3f* vector); @@ -807,24 +807,24 @@ void BgCheck_GetSubdivisionMinBounds(CollisionContext* colCtx, Vec3f* pos, s32* void BgCheck_GetSubdivisionMaxBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz); void BgCheck_GetPolySubdivisionBounds(CollisionContext* colCtx, Vec3s* vtxList, CollisionPoly* polyList, s32* subdivMinX, s32* subdivMinY, s32* subdivMinZ, s32* subdivMaxX, s32* subdivMaxY, s32* subdivMaxZ, s16 polyId); s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* polyList, Vec3s* vtxList, s16 polyId); -u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl); -s32 BgCheck_IsSmallMemScene(GlobalContext* globalCtx); +u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl); +s32 BgCheck_IsSmallMemScene(PlayState* play); s32 BgCheck_TryGetCustomMemsize(s32 sceneId, u32* memSize); void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* subdivLength, f32* subdivLengthInv); -s32 BgCheck_GetSpecialSceneMaxObjects(GlobalContext* globalCtx, s32* maxNodes, s32* maxPolygons, s32* maxVertices); -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader); +s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPolygons, s32* maxVertices); +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader); void BgCheck_SetContextFlags(CollisionContext* colCtx, u32 flags); void BgCheck_UnsetContextFlags(CollisionContext* colCtx, u32 flags); CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId); -f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist, s32 arg9); +f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 chkDist, s32 arg9); f32 BgCheck_CameraRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2_1(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor2_1(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); f32 BgCheck_EntityRaycastFloor5(CollisionContext* colCtx, CollisionPoly** outPoly, s32* outBgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5_2(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5_3(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor5_2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor5_3(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); f32 BgCheck_EntityRaycastFloor7(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); f32 BgCheck_AnyRaycastFloor1(CollisionContext* colCtx, CollisionPoly* outPoly, Vec3f* pos); @@ -853,7 +853,7 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); s32 BgCheck_SphVsFirstWall(CollisionContext* colCtx, Vec3f* center, f32 radius); void SSNodeList_Init(SSNodeList* this); -void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s32 numPolys); +void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys); SSNode* SSNodeList_GetNextNode(SSNodeList* this); u16 SSNodeList_GetNextNodeIdx(SSNodeList* this); void ScaleRotPos_Init(ScaleRotPos* srp); @@ -863,37 +863,37 @@ void DynaLookup_ResetLists(DynaLookup* dynaLookup); void DynaLookup_Reset(DynaLookup* dynaLookup); void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex); void DynaLookup_ResetWaterBoxStartIndex(u16* waterBoxStartIndex); -void BgActor_Init(GlobalContext* globalCtx, BgActor* bgActor); +void BgActor_Init(PlayState* play, BgActor* bgActor); void BgActor_SetActor(BgActor* bgActor, Actor* actor, CollisionHeader* colHeader); s32 BgActor_IsTransformUnchanged(BgActor* bgActor); void DynaPoly_NullPolyList(CollisionPoly** polyList); -void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys); +void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys); void DynaPoly_NullVtxList(Vec3s** vtxList); -void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx); +void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx); void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList); -void DynaPoly_AllocWaterBoxList(GlobalContext* globalCtx, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes); -void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor); +void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes); +void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor); s32 DynaPoly_IsBgIdBgActor(s32 bgId); -void DynaPoly_Init(GlobalContext* globalCtx, DynaCollisionContext* dyna); -void DynaPoly_Alloc(GlobalContext* globalCtx, DynaCollisionContext* dyna); -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); +s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); -void func_800C62BC(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_800C6314(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_800C636C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_800C63C4(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_800C641C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void func_800C6474(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); -void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId); +void func_800C62BC(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C6314(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C636C(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C63C4(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C641C(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C6474(PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId); void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPos, Vec3s* minPosOut, s16* xLength, s16* zLength); -void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); -void BgCheck_ResetFlagsIfLoadedActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor); -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna); +void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); +void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor); +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna); void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertices, s32* numWaterBoxes); -void DynaPoly_UpdateBgActorTransforms(GlobalContext* globalCtx, DynaCollisionContext* dyna); +void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna); void CollisionHeader_SegmentedToVirtual(CollisionHeader* header); void CollisionHeader_GetVirtual(CollisionHeader* meshSegPtr, CollisionHeader** param_2); -void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, GlobalContext* globalCtx); +void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play); u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 dataIdx); u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u16 SurfaceType_GetCameraSType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); @@ -925,23 +925,23 @@ s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); 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_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); -s32 WaterBox_GetSurface1(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface1_2(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox, s32* bgId); +s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); +s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox, s32* bgId); f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId); u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); void func_800CA6B8(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); -s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); -s32 func_800CA9D0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); +s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); s32 func_800CAA14(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 index, Actor* actor); void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 index, Actor* actor); void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 index); u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 index, Actor* actor); void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); -void DynaPolyActor_LoadMesh(GlobalContext* globalCtx, DynaPolyActor* dynaActor, CollisionHeader* meshHeader); +void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader); void DynaPolyActor_ResetState(DynaPolyActor* dynaActor); void DynaPolyActor_SetRidingFallingState(DynaPolyActor* dynaActor); void DynaPolyActor_SetRidingMovingState(DynaPolyActor* dynaActor); @@ -955,7 +955,7 @@ s32 DynaPolyActor_IsInRidingMovingState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInRidingRotatingState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInSwitchPressedState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_ValidateMove(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight); +s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight); f32 Camera_fabsf(f32 f); f32 Camera_LengthVec3f(Vec3f* v); // void func_800CB270(void); @@ -1098,9 +1098,9 @@ s32 Camera_ModeSPEC6(Camera* camera); s32 Camera_ModeSPEC7(Camera* camera); s32 Camera_ModeSPEC8(Camera* camera); s32 Camera_ModeSPEC9(Camera* camera); -Camera* Camera_Alloc(View* view, CollisionContext* bg, GlobalContext* globalCtx); +Camera* Camera_Alloc(View* view, CollisionContext* bg, PlayState* play); void Camera_Free(Camera* camera); -void Camera_Init(Camera* camera, View* view, CollisionContext* bg, GlobalContext* globalCtx); +void Camera_Init(Camera* camera, View* view, CollisionContext* bg, PlayState* play); // void func_800DDFE0(void); void func_800DE0EC(Camera* camera, Actor* actor); // s32 func_800DE308(Camera* camera, UNK_TYPE2 uParm2); @@ -1147,221 +1147,221 @@ void DamageTable_Clear(DamageTable* damageTable); f32 CollisionCheck_GetDamageAndEffectOnBumper(Collider* at, ColliderInfo* atInfo, Collider* ac, ColliderInfo* acInfo, u32* effect); f32 CollisionCheck_ApplyBumperDefense(f32 damage, ColliderInfo* ac); s32 CollisionCheck_GetToucherDamage(Collider* at, ColliderInfo* atInfo, Collider* ac, ColliderInfo* acInfo); -s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider); -s32 Collider_DestroyBase(GlobalContext* globalCtx, Collider* collider); -s32 Collider_SetBaseToActor(GlobalContext* globalCtx, Collider* collider, ColliderInitToActor* src); -s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInitType1* src); -s32 Collider_SetBase(GlobalContext* globalCtx, Collider* collider, Actor* actor, ColliderInit* src); -void Collider_ResetATBase(GlobalContext* globalCtx, Collider* collider); -void Collider_ResetACBase(GlobalContext* globalCtx, Collider* collider); -void Collider_ResetOCBase(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitTouch(GlobalContext* globalCtx, ColliderTouch* touch); -s32 Collider_DestroyTouch(GlobalContext* globalCtx, ColliderTouch* touch); -s32 Collider_SetTouch(GlobalContext* globalCtx, ColliderTouch* touch, ColliderTouchInit* src); -void Collider_ResetATInfoUnk(GlobalContext* globalCtx, ColliderInfo* info); -s32 Collider_InitBump(GlobalContext* globalCtx, ColliderBump* bump); -s32 Collider_DestroyBump(GlobalContext* globalCtx, ColliderBump* bump); -s32 Collider_SetBump(GlobalContext* globalCtx, ColliderBump* bump, ColliderBumpInit* src); -s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info); -s32 Collider_DestroyInfo(GlobalContext* globalCtx, ColliderInfo* info); -s32 Collider_SetInfo(GlobalContext* globalCtx, ColliderInfo* info, ColliderInfoInit* src); -void Collider_ResetATInfo(GlobalContext* globalCtx, ColliderInfo* info); -void Collider_ResetACInfo(GlobalContext* globalCtx, ColliderInfo* info); -void Collider_ResetOCInfo(GlobalContext* globalCtx, ColliderInfo* info); -s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dim); -s32 Collider_DestroyJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dim); -s32 Collider_SetJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dest, ColliderJntSphElementDimInit* src); -s32 Collider_InitJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* element); -s32 Collider_DestroyJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* element); -s32 Collider_SetJntSphElement(GlobalContext* globalCtx, ColliderJntSphElement* dest, ColliderJntSphElementInit* src); -s32 Collider_ResetJntSphElementAT(GlobalContext* globalCtx, ColliderJntSphElement* collider); -s32 Collider_ResetJntSphElementAC(GlobalContext* globalCtx, ColliderJntSphElement* collider); -s32 Collider_ResetJntSphElementOC(GlobalContext* globalCtx, ColliderJntSphElement* collider); -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* collider, ColliderJntSphInitToActor* src); -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInitType1* src); -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements); -s32 Collider_InitAndSetJntSph(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, 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_InitCylinderDim(GlobalContext* globalCtx, Cylinder16* dim); -s32 Collider_DestroyCylinderDim(GlobalContext* globalCtx, Cylinder16* dim); -s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dim, Cylinder16* src); -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, ColliderCylinderInitType1* src); -s32 Collider_SetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); -s32 Collider_InitAndSetCylinder(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_InitTrisElementDim(GlobalContext* globalCtx, TriNorm* dim); -s32 Collider_DestroyTrisElementDim(GlobalContext* globalCtx, TriNorm* dim); -s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dim, ColliderTrisElementDimInit* src); -s32 Collider_InitTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element); -s32 Collider_DestroyTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element); -s32 Collider_SetTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element, ColliderTrisElementInit* src); -s32 Collider_ResetTrisElementAT(GlobalContext* globalCtx, ColliderTrisElement* element); -s32 Collider_ResetTrisElementAC(GlobalContext* globalCtx, ColliderTrisElement* element); -s32 Collider_ResetTrisElementOC(GlobalContext* globalCtx, ColliderTrisElement* element); -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* tris, Actor* actor, ColliderTrisInitType1* src); -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* triGroup, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* tris); -s32 Collider_InitAndSetTris(GlobalContext* globalCtx, ColliderTris* tris, 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_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim); -s32 Collider_DestroyQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim); -s32 Collider_ResetQuadACDist(GlobalContext* globalCtx, ColliderQuadDim* dim); +s32 Collider_InitBase(PlayState* play, Collider* collider); +s32 Collider_DestroyBase(PlayState* play, Collider* collider); +s32 Collider_SetBaseToActor(PlayState* play, Collider* collider, ColliderInitToActor* src); +s32 Collider_SetBaseType1(PlayState* play, Collider* collider, Actor* actor, ColliderInitType1* src); +s32 Collider_SetBase(PlayState* play, Collider* collider, Actor* actor, ColliderInit* src); +void Collider_ResetATBase(PlayState* play, Collider* collider); +void Collider_ResetACBase(PlayState* play, Collider* collider); +void Collider_ResetOCBase(PlayState* play, Collider* collider); +s32 Collider_InitTouch(PlayState* play, ColliderTouch* touch); +s32 Collider_DestroyTouch(PlayState* play, ColliderTouch* touch); +s32 Collider_SetTouch(PlayState* play, ColliderTouch* touch, ColliderTouchInit* src); +void Collider_ResetATInfoUnk(PlayState* play, ColliderInfo* info); +s32 Collider_InitBump(PlayState* play, ColliderBump* bump); +s32 Collider_DestroyBump(PlayState* play, ColliderBump* bump); +s32 Collider_SetBump(PlayState* play, ColliderBump* bump, ColliderBumpInit* src); +s32 Collider_InitInfo(PlayState* play, ColliderInfo* info); +s32 Collider_DestroyInfo(PlayState* play, ColliderInfo* info); +s32 Collider_SetInfo(PlayState* play, ColliderInfo* info, ColliderInfoInit* src); +void Collider_ResetATInfo(PlayState* play, ColliderInfo* info); +void Collider_ResetACInfo(PlayState* play, ColliderInfo* info); +void Collider_ResetOCInfo(PlayState* play, ColliderInfo* info); +s32 Collider_InitJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dim); +s32 Collider_DestroyJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dim); +s32 Collider_SetJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dest, ColliderJntSphElementDimInit* src); +s32 Collider_InitJntSphElement(PlayState* play, ColliderJntSphElement* element); +s32 Collider_DestroyJntSphElement(PlayState* play, ColliderJntSphElement* element); +s32 Collider_SetJntSphElement(PlayState* play, ColliderJntSphElement* dest, ColliderJntSphElementInit* src); +s32 Collider_ResetJntSphElementAT(PlayState* play, ColliderJntSphElement* collider); +s32 Collider_ResetJntSphElementAC(PlayState* play, ColliderJntSphElement* collider); +s32 Collider_ResetJntSphElementOC(PlayState* play, ColliderJntSphElement* collider); +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* collider, ColliderJntSphInitToActor* src); +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInitType1* src); +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements); +s32 Collider_InitAndSetJntSph(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements); +s32 Collider_ResetJntSphAT(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphAC(PlayState* play, Collider* collider); +s32 Collider_ResetJntSphOC(PlayState* play, Collider* collider); +s32 Collider_InitCylinderDim(PlayState* play, Cylinder16* dim); +s32 Collider_DestroyCylinderDim(PlayState* play, Cylinder16* dim); +s32 Collider_SetCylinderDim(PlayState* play, Cylinder16* dim, Cylinder16* src); +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(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src); +s32 Collider_InitAndSetCylinder(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_InitTrisElementDim(PlayState* play, TriNorm* dim); +s32 Collider_DestroyTrisElementDim(PlayState* play, TriNorm* dim); +s32 Collider_SetTrisElementDim(PlayState* play, TriNorm* dim, ColliderTrisElementDimInit* src); +s32 Collider_InitTrisElement(PlayState* play, ColliderTrisElement* element); +s32 Collider_DestroyTrisElement(PlayState* play, ColliderTrisElement* element); +s32 Collider_SetTrisElement(PlayState* play, ColliderTrisElement* element, ColliderTrisElementInit* src); +s32 Collider_ResetTrisElementAT(PlayState* play, ColliderTrisElement* element); +s32 Collider_ResetTrisElementAC(PlayState* play, ColliderTrisElement* element); +s32 Collider_ResetTrisElementOC(PlayState* play, ColliderTrisElement* element); +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* tris, Actor* actor, ColliderTrisInitType1* src); +s32 Collider_SetTris(PlayState* play, ColliderTris* triGroup, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* tris); +s32 Collider_InitAndSetTris(PlayState* play, ColliderTris* tris, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements); +s32 Collider_ResetTrisAT(PlayState* play, Collider* collider); +s32 Collider_ResetTrisAC(PlayState* play, Collider* collider); +s32 Collider_ResetTrisOC(PlayState* play, Collider* collider); +s32 Collider_InitQuadDim(PlayState* play, ColliderQuadDim* dim); +s32 Collider_DestroyQuadDim(PlayState* play, ColliderQuadDim* dim); +s32 Collider_ResetQuadACDist(PlayState* play, ColliderQuadDim* dim); void Collider_SetQuadMidpoints(ColliderQuadDim* dim); -s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim, ColliderQuadDimInit* init); -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_InitAndSetQuad(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_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3f* hitPos); -s32 Collider_InitSphere(GlobalContext* globalCtx, ColliderSphere* collider); -s32 Collider_DestroySphere(GlobalContext* globalCtx, ColliderSphere* collider); -s32 Collider_SetSphere(GlobalContext* globalCtx, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src); -s32 Collider_InitAndSetSphere(GlobalContext* globalCtx, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src); -s32 Collider_ResetSphereAT(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetSphereAC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_ResetSphereOC(GlobalContext* globalCtx, Collider* collider); -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line); -s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* line, Vec3f* a, Vec3f* b); -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* line, OcLine* src); -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line); -void CollisionCheck_InitContext(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index); -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index); -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index); -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, OcLine* line); +s32 Collider_SetQuadDim(PlayState* play, ColliderQuadDim* dim, ColliderQuadDimInit* init); +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_InitAndSetQuad(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_QuadSetNearestAC(PlayState* play, ColliderQuad* quad, Vec3f* hitPos); +s32 Collider_InitSphere(PlayState* play, ColliderSphere* collider); +s32 Collider_DestroySphere(PlayState* play, ColliderSphere* collider); +s32 Collider_SetSphere(PlayState* play, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src); +s32 Collider_InitAndSetSphere(PlayState* play, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src); +s32 Collider_ResetSphereAT(PlayState* play, Collider* collider); +s32 Collider_ResetSphereAC(PlayState* play, Collider* collider); +s32 Collider_ResetSphereOC(PlayState* play, Collider* collider); +s32 Collider_InitLine(PlayState* play, OcLine* line); +s32 Collider_DestroyLine(PlayState* play, OcLine* line); +s32 Collider_SetLinePoints(PlayState* play, OcLine* line, Vec3f* a, Vec3f* b); +s32 Collider_SetLine(PlayState* play, OcLine* line, OcLine* src); +s32 Collider_ResetLineOC(PlayState* play, OcLine* line); +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colCtxt); +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colCtxt); +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colCtxt); +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colCtxt); +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colCtxt); +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index); +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index); +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index); +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colCtxt, OcLine* line); s32 CollisionCheck_SkipTouch(ColliderInfo* info); s32 CollisionCheck_SkipBump(ColliderInfo* info); s32 CollisionCheck_NoSharedFlags(ColliderInfo* toucher, ColliderInfo* bumper); -void CollisionCheck_NoBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_WaterBurst(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_RedBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_RedBloodUnused(GlobalContext* globalCtx, Collider* collider, Vec3f* v); -void CollisionCheck_HitSolid(GlobalContext* globalCtx, ColliderInfo* info, Collider* collider, Vec3f* hitPos); +void CollisionCheck_NoBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_GreenBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_WaterBurst(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_RedBlood(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v); +void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* collider, Vec3f* hitPos); s32 CollisionCheck_SwordHitAudio(Collider* at, ColliderInfo* acInfo); -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); void CollisionCheck_SetBounce(Collider* at, Collider* ac); -s32 CollisionCheck_SetATvsAC(GlobalContext* globalCtx, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, ColliderInfo* acInfo, Vec3f* acPos, Vec3f* hitPos); +s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo, Vec3f* atPos, Collider* ac, ColliderInfo* acInfo, Vec3f* acPos, Vec3f* hitPos); void CollisionCheck_TrisAvgPoint(ColliderTrisElement* tri, Vec3f* avg); void CollisionCheck_QuadAvgPoint(ColliderQuad* quad, Vec3f* avg); -void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_TrisVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_QuadVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_SphereVsCylinder(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_SphereVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_SphereVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_AC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); -void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_SetSphereHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT); -void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); +void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_JntSphVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_JntSphVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_JntSphVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_CylVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_CylVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_CylVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_CylVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_TrisVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_TrisVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_TrisVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_TrisVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_TrisVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_QuadVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_QuadVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_QuadVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_QuadVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_QuadVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_SphereVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_SphereVsCylinder(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_SphereVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_SphereVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_AC_SphereVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC); +void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_SetSphereHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colCtxt); +void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT); +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colCtxt); s32 CollisionCheck_GetMassType(u8 mass); -void CollisionCheck_SetOCvsOC(GlobalContext* globalCtx, Collider* left, ColliderInfo* leftInfo, Vec3f* leftPos, Collider* right, ColliderInfo* rightInfo, Vec3f* rightPos, f32 overlap); -void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_SphereVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); -void CollisionCheck_OC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_SetOCvsOC(PlayState* play, Collider* left, ColliderInfo* leftInfo, Vec3f* leftPos, Collider* right, ColliderInfo* rightInfo, Vec3f* rightPos, f32 overlap); +void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_JntSphVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_CylVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_CylVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_SphereVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_SphereVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); +void CollisionCheck_OC_SphereVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r); s32 CollisionCheck_SkipOC(Collider* collider); s32 CollisionCheck_Incompatible(Collider* left, Collider* right); -void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colCtxt); 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_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, ColliderInfo* info); -void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_ApplyDamageCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_ApplyDamageTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_ApplyDamageQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_ApplyDamageSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider); -void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colCtxt); -s32 CollisionCheck_LineOC_JntSph(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOC_Cyl(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOC_Sphere(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions); -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b); -s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions); +void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, ColliderInfo* info); +void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_ApplyDamageTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_ApplyDamageQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_ApplyDamageSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider); +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colCtxt); +s32 CollisionCheck_LineOC_JntSph(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOC_Cyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOC_Sphere(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOC(PlayState* play, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b, Actor** exclusions, s32 numExclusions); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b); +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colCtxt, 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 Collider_UpdateSpheresElement(ColliderJntSph* collider, s32 index, Actor* actor); void Collider_UpdateSphere(s32 limb, ColliderSphere* 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* pos); -void CollisionCheck_SpawnShieldParticlesMetal2(GlobalContext* globalCtx, Vec3f* v); -void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, Vec3f* pos); +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* pos); +void CollisionCheck_SpawnShieldParticlesMetal2(PlayState* play, Vec3f* v); +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* pos); s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* itemPos, Vec3f* itemProjPos, Vec3f* out1, Vec3f* out2); -void Actor_ContinueText(GlobalContext* globalCtx, Actor* actor, u16 textId); +void Actor_ContinueText(PlayState* play, Actor* actor, u16 textId); s32 Flags_GetEventChkInf(s32 flag); void Flags_SetEventChkInf(s32 flag); s32 Flags_GetInfTable(s32 flag); void Flags_SetInfTable(s32 flag); s32 Actor_TrackNone(Vec3s* headRot, Vec3s* torsoRot); s32 Actor_TrackPoint(Actor* actor, Vec3f* target, Vec3s* headRot, Vec3s* torsoRot); -s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusPosYAdj); -s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos); +s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusPosYAdj); +s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos); void SaveContext_Init(void); void GameInfo_Init(void); // void DebugDisplay_Init(void); @@ -1373,65 +1373,65 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, // void func_800E9E94(void); void func_800E9F78(GraphicsContext* gfxCtx); -void Cutscene_Init(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_Start(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_End(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_Update1(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_Update2(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800EDBE0(GlobalContext* globalCtx); -void func_800EDDB0(GlobalContext* globalCtx); -void Cutscene_LoadCutsceneData(GlobalContext* globalCtx, u8 csIndex); -void Cutscene_ActorTranslate(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex); -void Cutscene_ActorTranslateAndYaw(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex); -void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex); -void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex); -s32 Cutscene_GetSceneSetupIndex(GlobalContext* globalCtx); -s32 Cutscene_GetActorActionIndex(GlobalContext* globalCtx, u16 actorActionCmd); -s32 Cutscene_CheckActorAction(GlobalContext* globalCtx, u16 actorActionCmd); -u8 Cutscene_IsPlaying(GlobalContext* globalCtx); +void Cutscene_Init(PlayState* play, CutsceneContext* csCtx); +void Cutscene_Start(PlayState* play, CutsceneContext* csCtx); +void Cutscene_End(PlayState* play, CutsceneContext* csCtx); +void Cutscene_Update1(PlayState* play, CutsceneContext* csCtx); +void Cutscene_Update2(PlayState* play, CutsceneContext* csCtx); +void func_800EDBE0(PlayState* play); +void func_800EDDB0(PlayState* play); +void Cutscene_LoadCutsceneData(PlayState* play, u8 csIndex); +void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 actorActionIndex); +void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActionIndex); +void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); +void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); +s32 Cutscene_GetSceneSetupIndex(PlayState* play); +s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd); +s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd); +u8 Cutscene_IsPlaying(PlayState* play); -void GetItem_Draw(GlobalContext* globalCtx, s16 index); -void func_800EE364(GlobalContext* globalCtx, s16 index); -void func_800EE400(GlobalContext* globalCtx, s16 index); -void func_800EE5FC(GlobalContext* globalCtx, s16 index); -void func_800EE7D8(GlobalContext* globalCtx, s16 index); -void func_800EE940(GlobalContext* globalCtx, s16 index); -void func_800EEA48(GlobalContext* globalCtx, s16 index); -void func_800EEC18(GlobalContext* globalCtx, s16 index); -void func_800EED20(GlobalContext* globalCtx, s16 index); -void func_800EEE34(GlobalContext* globalCtx, s16 index); -void func_800EEF4C(GlobalContext* globalCtx, s16 index); -void func_800EF054(GlobalContext* globalCtx, s16 index); -void func_800EF0F0(GlobalContext* globalCtx, s16 index); -void func_800EF1F4(GlobalContext* globalCtx, s16 index); -void func_800EF2AC(GlobalContext* globalCtx, s16 index); -void func_800EF364(GlobalContext* globalCtx, s16 index); -void func_800EF4D4(GlobalContext* globalCtx, s16 index); -void func_800EF65C(GlobalContext* globalCtx, s16 index); -void func_800EF780(GlobalContext* globalCtx, s16 index); -void func_800EF89C(GlobalContext* globalCtx, s16 index); -void func_800EF984(GlobalContext* globalCtx, s16 index); -void func_800EFAB8(GlobalContext* globalCtx, s16 index); -void func_800EFBFC(GlobalContext* globalCtx, s16 index); -void func_800EFD44(GlobalContext* globalCtx, s16 index); -void EffFootmark_Init(GlobalContext* globalCtx); -void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); -void EffFootmark_Update(GlobalContext* globalCtx); -void EffFootmark_Draw(GlobalContext* globalCtx); -void SoundSource_InitAll(GlobalContext* globalCtx); -void SoundSource_UpdateAll(GlobalContext* globalCtx); -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId); -void SoundSource_PlaySfxEachFrameAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId); -u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx); +void GetItem_Draw(PlayState* play, s16 index); +void func_800EE364(PlayState* play, s16 index); +void func_800EE400(PlayState* play, s16 index); +void func_800EE5FC(PlayState* play, s16 index); +void func_800EE7D8(PlayState* play, s16 index); +void func_800EE940(PlayState* play, s16 index); +void func_800EEA48(PlayState* play, s16 index); +void func_800EEC18(PlayState* play, s16 index); +void func_800EED20(PlayState* play, s16 index); +void func_800EEE34(PlayState* play, s16 index); +void func_800EEF4C(PlayState* play, s16 index); +void func_800EF054(PlayState* play, s16 index); +void func_800EF0F0(PlayState* play, s16 index); +void func_800EF1F4(PlayState* play, s16 index); +void func_800EF2AC(PlayState* play, s16 index); +void func_800EF364(PlayState* play, s16 index); +void func_800EF4D4(PlayState* play, s16 index); +void func_800EF65C(PlayState* play, s16 index); +void func_800EF780(PlayState* play, s16 index); +void func_800EF89C(PlayState* play, s16 index); +void func_800EF984(PlayState* play, s16 index); +void func_800EFAB8(PlayState* play, s16 index); +void func_800EFBFC(PlayState* play, s16 index); +void func_800EFD44(PlayState* play, s16 index); +void EffFootmark_Init(PlayState* play); +void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); +void EffFootmark_Update(PlayState* play); +void EffFootmark_Draw(PlayState* play); +void SoundSource_InitAll(PlayState* play); +void SoundSource_UpdateAll(PlayState* play); +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId); +void SoundSource_PlaySfxEachFrameAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId); +u16 ElfMessage_GetFirstCycleHint(PlayState* play); -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); -void EnvFlags_UnsetAll(GlobalContext* globalCtx); -void EnvFlags_Set(GlobalContext* globalCtx, s16 flag); -void EnvFlags_Unset(GlobalContext* globalCtx, s16 flag); -s32 EnvFlags_Get(GlobalContext* globalCtx, s16 flag); +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet); +void EnvFlags_UnsetAll(PlayState* play); +void EnvFlags_Set(PlayState* play, s16 flag); +void EnvFlags_Unset(PlayState* play, s16 flag); +s32 EnvFlags_Get(PlayState* play, s16 flag); s16 func_800F1460(s16 param_1); ActorCutscene* ActorCutscene_GetCutsceneImpl(s16 index); -void ActorCutscene_Init(GlobalContext* globalCtx, ActorCutscene* cutscenes, s32 num); +void ActorCutscene_Init(PlayState* play, ActorCutscene* cutscenes, s32 num); void func_800F15D8(Camera* camera); // void ActorCutscene_ClearWaiting(void); // void ActorCutscene_ClearNextCutscenes(void); @@ -1455,87 +1455,87 @@ s16 func_800F21CC(void); s32 func_800F22C4(s16 param_1, Actor* actor); void ActorCutscene_SetReturnCamera(s16 index); void FireObj_SetPosition(FireObj* fire, Vec3f* pos); -void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire); -void FireObj_Init(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init, Actor* actor); -void FireObj_Destroy(GlobalContext* globalCtx, FireObj* fire); +void FireObj_Draw(PlayState* play, FireObj* fire); +void FireObj_Init(PlayState* play, FireObj* fire, FireObjInitParams* init, Actor* actor); +void FireObj_Destroy(PlayState* play, FireObj* fire); void FireObj_SetState2(FireObj* fire, f32 dynamicSizeStep, u8 newState); -void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor); -s32 func_800F3940(GlobalContext* globalCtx); +void FireObj_Update(PlayState* play, FireObj* fire, Actor* actor); +s32 func_800F3940(PlayState* play); // void func_800F39B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_800F3A64(void); -void func_800F3B2C(GlobalContext* globalCtx); +void func_800F3B2C(PlayState* play); // void func_800F3B68(void); // void func_800F3C44(void); // void func_800F3ED4(void); void func_800F40A0(GameState* gameState, Player* player); void func_800F415C(Actor* actor, Vec3f* arg1, s16 arg2); -UNK_TYPE func_800F41E4(GlobalContext* globalCtx, ActorContext* actorCtx); +UNK_TYPE func_800F41E4(PlayState* play, ActorContext* actorCtx); -void func_800F4A10(GlobalContext* globalCtx); -void KaleidoSetup_Update(GlobalContext* globalCtx); -void KaleidoSetup_Init(GlobalContext* globalCtx); -void KaleidoSetup_Destroy(GlobalContext* globalCtx); +void func_800F4A10(PlayState* play); +void KaleidoSetup_Update(PlayState* play); +void KaleidoSetup_Init(PlayState* play); +void KaleidoSetup_Destroy(PlayState* play); -void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset); -void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset); +void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset); +void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset); void Font_LoadMessageBoxEndIcon(Font* font, u16 icon); void Font_LoadOrderedFont(Font* font); // void func_800F5090(void); // void func_800F50D4(void); -void Kankyo_Init(GlobalContext* globalCtx, EnvironmentContext* envCtx); +void Kankyo_Init(PlayState* play, EnvironmentContext* envCtx); u32 func_800F5954(u8* param_1, u32 param_2, u32 param_3, u8 param_4, u8 param_5); f32 Environment_LerpWeight(u16 max, u16 min, u16 val); // void func_800F5B10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // void func_800F5CD0(void); -void func_800F6834(GlobalContext* globalCtx, s32 waterLightsIndex); +void func_800F6834(PlayState* play, s32 waterLightsIndex); // void func_800F694C(void); // void func_800F6A04(void); // void func_800F6A40(void); // void func_800F6AB8(void); -void func_800F6B44(GlobalContext* globalCtx, EnvironmentContext* envCtx, s32 iParm3, s32 iParm4, s16* param_5); +void func_800F6B44(PlayState* play, EnvironmentContext* envCtx, s32 iParm3, s32 iParm4, s16* param_5); // void func_800F6CEC(void); // void func_800F6EA4(void); -// UNK_TYPE4 Kankyo_IsSceneUpsideDown(GlobalContext* globalCtx); -void func_800F6FF8(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx); +// UNK_TYPE4 Kankyo_IsSceneUpsideDown(PlayState* play); +void func_800F6FF8(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx); // void func_800F8554(void); // void func_800F88C4(void); // void func_800F8970(void); // void func_800F8A9C(void); -// void func_800F8CD4(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); +// void func_800F8CD4(PlayState* play, EnvironmentContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800F8D84(void); // void func_800F9728(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -void func_800F9824(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f vec, f32 arg5, f32 arg6, s8 arg7, s8 arg8); +void func_800F9824(PlayState* play, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f vec, f32 arg5, f32 arg6, s8 arg7, s8 arg8); // void func_800FA39C(void); // void func_800FA3C4(void); // void func_800FA9FC(void); -void func_800FAAB4(GlobalContext* globalCtx, u8 arg1); +void func_800FAAB4(PlayState* play, u8 arg1); // void func_800FAC20(void); // void func_800FAF74(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); // void func_800FB010(void); -void Environment_AddLightningBolts(GlobalContext* globalCtx, u8 num); +void Environment_AddLightningBolts(PlayState* play, u8 num); // void func_800FB388(void); -void func_800FB758(GlobalContext* globalCtx); +void func_800FB758(PlayState* play); // void func_800FB9B4(void); // void func_800FBCBC(void); -void Kankyo_InitGameOverLights(GlobalContext* globalCtx); -void Kankyo_FadeInGameOverLights(GlobalContext* globalCtx); -void Kankyo_FadeOutGameOverLights(GlobalContext* globalCtx); +void Kankyo_InitGameOverLights(PlayState* play); +void Kankyo_FadeInGameOverLights(PlayState* play); +void Kankyo_FadeOutGameOverLights(PlayState* play); // void func_800FC3DC(void); void func_800FC444(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4, UNK_TYPE arg5); // void func_800FC64C(void); -s32 func_800FD2B4(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4); +s32 func_800FD2B4(PlayState* play, f32 arg1, f32 arg2, f32 arg3, f32 arg4); void func_800FD538(Color_RGB8* param_1, Color_RGB8* param_2, f32 param_3, Vec3s* param_4); -void func_800FD59C(GlobalContext* globalCtx, Color_RGB8* pzParm2, f32 fParm3); -void func_800FD5E0(GlobalContext* globalCtx, Color_RGB8* pzParm2, f32 fParm3); -void func_800FD654(GlobalContext* globalCtx, Color_RGB8* pzParm2, f32 fParm3); -void func_800FD698(GlobalContext* globalCtx, s16 arg1, s16 arg2, f32 arg3); +void func_800FD59C(PlayState* play, Color_RGB8* pzParm2, f32 fParm3); +void func_800FD5E0(PlayState* play, Color_RGB8* pzParm2, f32 fParm3); +void func_800FD654(PlayState* play, Color_RGB8* pzParm2, f32 fParm3); +void func_800FD698(PlayState* play, s16 arg1, s16 arg2, f32 arg3); // u32 get_days_elapsed(void); // void reset_days_elapsed(void); // u32 get_current_day(void); void func_800FD750(u16 seqId); // void func_800FD768(void); -void func_800FD78C(GlobalContext* globalCtx); -void func_800FD858(GlobalContext* globalCtx); +void func_800FD78C(PlayState* play); +void func_800FD858(PlayState* play); void func_800FD928(s32 param_1); // void func_800FD980(void); // void func_800FDAF8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); @@ -1545,19 +1545,19 @@ void func_800FD928(s32 param_1); void func_800FE484(void); void func_800FE498(void); // void func_800FE4A8(void); -u32 func_800FE4B8(GlobalContext* globalCtx); +u32 func_800FE4B8(PlayState* play); // void func_800FE590(void); // void func_800FE5D0(void); // UNK_TYPE4 func_800FE610(void); -u32 func_800FE620(GlobalContext* globalCtx); +u32 func_800FE620(PlayState* play); void func_800FE658(f32 arg0); // UNK_TYPE4 func_800FE6F8(UNK_TYPE4 param_1, s16 param_2, s16 param_3); // void func_800FE778(void); // void func_800FE788(void); // void func_800FE798(void); void func_800FE7A8(Color_RGBA8* inColor, Color_RGBA8* outColor); -s32 func_800FE9B4(GlobalContext* globalCtx); -void func_800FEA50(GlobalContext* globalCtx); +s32 func_800FE9B4(PlayState* play); +void func_800FEA50(PlayState* play); void func_800FEAB0(void); // void func_800FEAC0(void); void func_800FEAF4(EnvironmentContext* envCtx); @@ -1630,13 +1630,13 @@ void* Lib_SegmentedToVirtual(void* ptr); void* Lib_SegmentedToVirtualNull(void* ptr); void* Lib_PhysicalToVirtual(void* ptr); void* Lib_PhysicalToVirtualNull(void* ptr); -void LifeMeter_Init(GlobalContext* globalCtx); -void LifeMeter_UpdateColors(GlobalContext* globalCtx); -s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx); -s32 LifeMeter_IncreaseInterfaceHealth(GlobalContext* globalCtx); -s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx); -void LifeMeter_Draw(GlobalContext* globalCtx); -void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx); +void LifeMeter_Init(PlayState* play); +void LifeMeter_UpdateColors(PlayState* play); +s32 LifeMeter_SaveInterfaceHealth(PlayState* play); +s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play); +s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play); +void LifeMeter_Draw(PlayState* play); +void LifeMeter_UpdateSizeAndBeep(PlayState* play); bool LifeMeter_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); @@ -1648,23 +1648,23 @@ void Lights_Reset(Lights* lights, u8 r, u8 g, u8 b); void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx); Light* Lights_FindSlot(Lights* lights); void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* pos); -void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* globalCtx); +void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play); void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused); -void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalContext* globalCtx); +void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play); LightNode* Lights_FindBufSlot(); void Lights_FreeNode(LightNode* light); -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 func_80102544(LightContext* lightCtx, u8 a1, u8 a2, u8 a3, s16 numLights, s16 sp16); 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* light); +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* light); 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_Malloc(size_t size); void* ZeldaArena_MallocR(size_t size); void* ZeldaArena_Realloc(void* oldPtr, size_t newSize); @@ -1693,15 +1693,15 @@ void func_80102ED0(u32 param_1); // void func_801045AC(void); // void func_80104AE8(void); // void func_80104C80(void); -void func_80104CF4(GlobalContext* globalCtx); +void func_80104CF4(PlayState* play); // void func_80104F34(void); // void func_80105294(void); // void func_80105318(void); // void func_80105328(void); // void func_8010534C(void); -void func_8010549C(GlobalContext* globalCtx, void* segmentAddress); -void func_8010565C(GlobalContext* globalCtx, u8 num, void* segmentAddress); -void func_80105818(GlobalContext* globalCtx, u32 uParm2, TransitionActorEntry* puParm3); +void func_8010549C(PlayState* play, void* segmentAddress); +void func_8010565C(PlayState* play, u8 num, void* segmentAddress); +void func_80105818(PlayState* play, u32 uParm2, TransitionActorEntry* puParm3); // void func_80105A40(void); // void func_80105B34(void); // void func_80105C40(void); @@ -1768,17 +1768,17 @@ void func_80105818(GlobalContext* globalCtx, u32 uParm2, TransitionActorEntry* p // void func_80109E70(void); // void func_80109EF8(void); // void func_80109F78(void); -s32 func_8010A000(GlobalContext* globalCtx); -s32 func_8010A074(GlobalContext* globalCtx); -s32 func_8010A0A4(GlobalContext* globalCtx); +s32 func_8010A000(PlayState* play); +s32 func_8010A074(PlayState* play); +s32 func_8010A0A4(PlayState* play); // void func_8010A0F0(void); // void func_8010A164(void); // void func_8010A194(void); // void func_8010A208(void); // void func_8010A238(void); // void func_8010A2AC(void); -void func_8010A2DC(GlobalContext* globalCtx); -void func_8010A33C(GlobalContext* globalCtx, s16 param_2); +void func_8010A2DC(PlayState* play); +void func_8010A33C(PlayState* play, s16 param_2); // void func_8010A410(void); // void func_8010A430(void); // void func_8010A54C(void); @@ -1834,7 +1834,7 @@ void func_8010A33C(GlobalContext* globalCtx, s16 param_2); // void func_8010BEBC(void); // void func_8010BEF0(void); // void func_8010BF24(void); -s32 func_8010BF58(Actor* actor, GlobalContext* globalCtx, s32* param_3, UNK_PTR param_4, s32* param_5); +s32 func_8010BF58(Actor* actor, PlayState* play, s32* param_3, UNK_PTR param_4, s32* param_5); void Nmi_Init(void); void Nmi_SetPrenmiStart(void); // s32 Nmi_GetPrenmiHasStarted(void); @@ -1873,7 +1873,7 @@ void func_8010EA9C(s32 arg0, s32 arg1); // void func_8010EB50(void); // void func_8010EBA0(void); // void func_8010EC54(void); -void func_8010EE74(GlobalContext* globalCtx, s32 day); +void func_8010EE74(PlayState* play, s32 day); void Interface_ChangeAlpha(u16 param_1); // void func_8010EF9C(void); // void func_8010F0D4(void); @@ -1881,11 +1881,11 @@ void Interface_ChangeAlpha(u16 param_1); // void func_80110038(void); // void func_80111CB4(void); // void func_801129E4(void); -void func_80112AFC(GlobalContext* globalCtx); -void func_80112B40(GlobalContext* globalCtx, u8 arg1); +void func_80112AFC(PlayState* play); +void func_80112B40(PlayState* play, u8 arg1); // void func_80112BE4(void); // void func_80112C0C(void); -u32 Item_Give(GlobalContext* globalCtx, u8 param_2); +u32 Item_Give(PlayState* play, u8 param_2); // void func_801143CC(void); UNK_TYPE func_80114978(UNK_TYPE arg0); void func_801149A0(s32 itemId, s16 slotId); @@ -1899,15 +1899,15 @@ s32 Interface_HasItemInBottle(u8 itemId); // void func_801152B8(void); // void func_801153C8(void); // void func_80115428(void); -void func_8011552C(GlobalContext* globalCtx, s16 arg1); +void func_8011552C(PlayState* play, s16 arg1); // void func_801155B4(void); // void func_80115764(void); -void func_80115844(GlobalContext* globalCtx, s16 param_2); -s32 func_80115908(GlobalContext* globalCtx, u8 param_2); +void func_80115844(PlayState* play, s16 param_2); +s32 func_80115908(PlayState* play, u8 param_2); void func_801159c0(s16 param_1); void func_801159EC(s16 arg0); void func_80115A14(s16 arg0, s16 arg1); -void Parameter_AddMagic(GlobalContext* globalCtx, s16 arg1); +void Parameter_AddMagic(PlayState* play, s16 arg1); void func_80115D5C(GameState* gamestate); // void func_80115DB4(void); // void func_80116088(void); @@ -1924,12 +1924,12 @@ void func_80115D5C(GameState* gamestate); // void func_80118BA4(void); // void func_80119030(void); // void func_80119610(void); -void func_8011B4E0(GlobalContext* globalCtx, s32 arg1); +void func_8011B4E0(PlayState* play, s32 arg1); // void func_8011B5C0(void); // void func_8011B9E0(void); // void func_8011BF70(void); // void func_8011C4C4(void); -void func_8011C808(GlobalContext* globalCtx); +void func_8011C808(PlayState* play); // void func_8011C898(void); // void func_8011CA64(void); // void func_8011E3B4(void); @@ -1940,17 +1940,17 @@ void func_8011C808(GlobalContext* globalCtx); // void func_80121064(void); // void func_801210E0(void); // void func_80121F94(void); -void func_80121FC4(GlobalContext* globalCtx); -Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); +void func_80121FC4(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 func_801226E0(GlobalContext* globalCtx, s8 arg1); -void func_80122744(GlobalContext* globalCtx, UNK_PTR arg1, u32 arg2, Vec3s* arg3); -s32 func_80122760(GlobalContext* globalCtx, UNK_PTR arg1, f32 arg2); -void func_80122868(GlobalContext* globalCtx, Player* player); -void func_801229A0(GlobalContext* globalCtx, Player* player); +void func_801226E0(PlayState* play, s8 arg1); +void func_80122744(PlayState* play, UNK_PTR arg1, u32 arg2, Vec3s* arg3); +s32 func_80122760(PlayState* play, UNK_PTR arg1, f32 arg2); +void func_80122868(PlayState* play, Player* player); +void func_801229A0(PlayState* play, Player* player); // void func_801229EC(void); // void func_801229FC(void); // void func_80122BA4(void); @@ -1959,38 +1959,38 @@ void func_801229A0(GlobalContext* globalCtx, Player* player); // void func_80122ED8(void); // void func_80122EEC(void); void func_80122F28(Player* player); -s32 func_80122F9C(GlobalContext* globalCtx); -s32 func_80122FCC(GlobalContext* globalCtx); -void func_8012300C(GlobalContext* globalCtx, s32 arg1); -void func_8012301C(s32 iParm1, GlobalContext* globalCtx); -void func_80123140(GlobalContext* globalCtx, Player* player); -u32 func_80123358(GlobalContext* globalCtx, Player* player); +s32 func_80122F9C(PlayState* play); +s32 func_80122FCC(PlayState* play); +void func_8012300C(PlayState* play, s32 arg1); +void func_8012301C(s32 iParm1, PlayState* play); +void func_80123140(PlayState* play, Player* player); +u32 func_80123358(PlayState* play, Player* player); s32 Player_InCsMode(GameState* gameState); // void func_80123420(void); // void func_80123434(void); // void func_80123448(void); // void func_801234B0(void); // void func_801234D4(void); -s32 func_80123590(GlobalContext* globalCtx, Actor* actor); +s32 func_80123590(PlayState* play, Actor* actor); // void func_8012364C(void); -s32 func_80123810(GlobalContext* globalCtx); +s32 func_80123810(PlayState* play); // void func_80123960(void); // void func_801239AC(void); void func_80123AA4(Player* player, s32 arg1); // void func_80123BD4(void); // void func_80123C58(void); -void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this); -void func_80123D50(GlobalContext* globalCtx, Player* player, UNK_TYPE arg2, UNK_TYPE arg3); +void Player_SetEquipmentData(PlayState* play, Player* this); +void func_80123D50(PlayState* play, Player* player, UNK_TYPE arg2, UNK_TYPE arg3); void func_80123DA4(Player* player); // void func_80123DC0(void); -void func_80123E90(GlobalContext* globalCtx, Actor* actor); -void func_80123F2C(GlobalContext* globalCtx, s32 arg1); -s32 func_80123F48(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3); +void func_80123E90(PlayState* play, Actor* actor); +void func_80123F2C(PlayState* play, s32 arg1); +s32 func_80123F48(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3); s32 func_80124020(void); -u8 Player_GetMask(GlobalContext* globalCtx); -void Player_RemoveMask(GlobalContext* globalCtx); -s32 func_8012405C(GlobalContext* globalCtx); -s32 func_80124088(GlobalContext* globalCtx); +u8 Player_GetMask(PlayState* play); +void Player_RemoveMask(PlayState* play); +s32 func_8012405C(PlayState* play); +s32 func_80124088(PlayState* play); s32 func_801240C8(Player* player); // void func_801240DC(void); // void func_80124110(void); @@ -2023,11 +2023,11 @@ s32 func_801242B4(Player* player); // void func_80125D4C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_801262C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_801263FC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -s32 func_80126440(GlobalContext* globalCtx, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* arg3, Vec3f* arg4); +s32 func_80126440(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* arg3, Vec3f* arg4); // void func_801265C8(void); // void func_8012669C(void); // void func_80126808(void); -void func_8012697C(GlobalContext* globalCtx, Player* player); +void func_8012697C(PlayState* play, Player* player); // void func_80126AB4(void); // void func_80126B8C(void); // void func_80126BD0(void); @@ -2074,7 +2074,7 @@ void Quake_Init(void); s16 Quake_Add(Camera* camera, u32 callbackIdx); u32 Quake_RemoveFromIdx(s16 idx); s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData); -void Distortion_Init(GlobalContext* globalCtx); +void Distortion_Init(PlayState* play); void Distortion_SetCountdown(s16 countdown); s16 Distortion_GetCountdown(void); s16 Distortion_GetType(void); @@ -2105,7 +2105,7 @@ void func_8012C1C0(GraphicsContext* gfxCtx); Gfx* func_8012C1EC(Gfx* gfx); void func_8012C214(GraphicsContext* gfxCtx); void func_8012C240(GraphicsContext* gfxCtx); -void func_8012C268(GlobalContext* globalCtx); +void func_8012C268(PlayState* play); void func_8012C28C(GraphicsContext* gfxCtx); Gfx* func_8012C2B4(Gfx* gfx); void func_8012C2DC(GraphicsContext* gfxCtx); @@ -2163,30 +2163,30 @@ Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s3 void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g, u8 b); void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); void func_8012D40C(f32* param_1, f32* param_2, s16* param_3); -void Room_nop8012D510(GlobalContext* globalCtx, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4); -void Room_DrawType3Mesh(GlobalContext* globalCtx, Room* room, u32 flags); -void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags); -void Room_DrawType2Mesh(GlobalContext* globalCtx, Room* room, u32 flags); -void func_8012DEE8(GlobalContext* globalCtx, Room* room, u32 flags); -u32 func_8012E254(s32 param_1, GlobalContext* globalCtx); -void func_8012E32C(GlobalContext* globalCtx, Room* room, u32 flags); -void Room_DrawType1Mesh(GlobalContext* globalCtx, Room* room, u32 flags); -void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx); -u32 Room_AllocateAndLoad(GlobalContext* globalCtx, RoomContext* roomCtx); -s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 index); -s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx); -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags); -void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtx); -s32 Inventory_GetBtnBItem(GlobalContext* globalCtx); +void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4); +void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags); +void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags); +void Room_DrawType2Mesh(PlayState* play, Room* room, u32 flags); +void func_8012DEE8(PlayState* play, Room* room, u32 flags); +u32 func_8012E254(s32 param_1, PlayState* play); +void func_8012E32C(PlayState* play, Room* room, u32 flags); +void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags); +void Room_Init(PlayState* play, RoomContext* roomCtx); +u32 Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx); +s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index); +s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx); +void Room_Draw(PlayState* play, Room* room, u32 flags); +void func_8012EBF8(PlayState* play, RoomContext* roomCtx); +s32 Inventory_GetBtnBItem(PlayState* play); void Inventory_ChangeEquipment(s16 value); -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, u32 value); s32 Inventory_IsMapVisible(s16 sceneNum); void Inventory_SetMapVisibility(s16 tingleIndex); void Inventory_SaveDekuPlaygroundHighScore(s16 timerId); void Inventory_IncrementSkullTokenCount(s16 sceneIndex); s16 Inventory_GetSkullTokenCount(s16 sceneIndex); -void Inventory_SaveLotteryCodeGuess(GlobalContext* globalCtx); +void Inventory_SaveLotteryCodeGuess(PlayState* play); s32 Object_Spawn(ObjectContext* objectCtx, s16 id); void Object_InitBank(GameState* gameState, ObjectContext* objectCtx); void Object_UpdateBank(ObjectContext* objectCtx); @@ -2194,148 +2194,148 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 id); s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index); void Object_LoadAll(ObjectContext* objectCtx); void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id); -void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdRoomList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdMesh(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd); +void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd); void Door_InitContext(GameState* gameState, DoorContext* doorCtx); -void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex); -void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdWindSettings(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdExitList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmd09(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdEchoSetting(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdActorCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdMiniMap(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmd1D(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdMiniMapCompassInfo(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_HeaderCmdAnimatedMaterials(GlobalContext* globalCtx, SceneCmd* cmd); -void Scene_SetExitFade(GlobalContext* globalCtx); -s32 Scene_ProcessHeader(GlobalContext* globalCtx, SceneCmd* header); +void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd); +void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex); +void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd); +void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd); +void Scene_SetExitFade(PlayState* play); +s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); u16 Entrance_CreateIndex(s32 sceneIndex, s32 spawnIndex, s32 sceneSetup); u16 Entrance_CreateIndexFromSpawn(s32 spawnIndex); -void Scene_ExecuteDrawConfig(GlobalContext* globalCtx); -void Scene_DrawConfigDefault(GlobalContext* globalCtx); -Gfx* AnimatedMat_TexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params); -void AnimatedMat_DrawTexScroll(GlobalContext* globalCtx, s32 segment, void* params); -Gfx* AnimatedMat_TwoLayerTexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params); -void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* params); -void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* primColor, F3DEnvColor* envColor); -void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params); +void Scene_ExecuteDrawConfig(PlayState* play); +void Scene_DrawConfigDefault(PlayState* play); +Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params); +void AnimatedMat_DrawTexScroll(PlayState* play, s32 segment, void* params); +Gfx* AnimatedMat_TwoLayerTexScroll(PlayState* play, AnimatedMatTexScrollParams* params); +void AnimatedMat_DrawTwoTexScroll(PlayState* play, s32 segment, void* params); +void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColor, F3DEnvColor* envColor); +void AnimatedMat_DrawColor(PlayState* play, s32 segment, void* params); s32 AnimatedMat_Lerp(s32 min, s32 max, f32 norm); -void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* params); +void AnimatedMat_DrawColorLerp(PlayState* play, s32 segment, void* params); f32 Scene_LagrangeInterp(s32 n, f32 x[], f32 fx[], f32 xp); u8 Scene_LagrangeInterpColor(s32 n, f32 x[], f32 fx[], f32 xp); -void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment, void* params); -void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* params); -void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags); -void AnimatedMat_Draw(GlobalContext* globalCtx, AnimatedMaterial* matAnim); -void AnimatedMat_DrawOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim); -void AnimatedMat_DrawXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim); -void AnimatedMat_DrawAlpha(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio); -void AnimatedMat_DrawAlphaOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio); -void AnimatedMat_DrawAlphaXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio); -void AnimatedMat_DrawStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step); -void AnimatedMat_DrawStepOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step); -void AnimatedMat_DrawStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step); -void AnimatedMat_DrawAlphaStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); -void AnimatedMat_DrawAlphaStepOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); -void AnimatedMat_DrawAlphaStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); -void Scene_DrawConfigMatAnim(GlobalContext* globalCtx); -void Scene_DrawConfig3(GlobalContext* globalCtx); -void Scene_DrawConfig4(GlobalContext* globalCtx); -void Scene_DrawConfigDoNothing(GlobalContext* globalCtx); -void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags); -void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags); -void Scene_DrawConfig5(GlobalContext* globalCtx); -void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx); -void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx); +void AnimatedMat_DrawColorNonLinearInterp(PlayState* play, s32 segment, void* params); +void AnimatedMat_DrawTexCycle(PlayState* play, s32 segment, void* params); +void AnimatedMat_DrawMain(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags); +void AnimatedMat_Draw(PlayState* play, AnimatedMaterial* matAnim); +void AnimatedMat_DrawOpa(PlayState* play, AnimatedMaterial* matAnim); +void AnimatedMat_DrawXlu(PlayState* play, AnimatedMaterial* matAnim); +void AnimatedMat_DrawAlpha(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio); +void AnimatedMat_DrawAlphaOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio); +void AnimatedMat_DrawAlphaXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio); +void AnimatedMat_DrawStep(PlayState* play, AnimatedMaterial* matAnim, u32 step); +void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* matAnim, u32 step); +void AnimatedMat_DrawStepXlu(PlayState* play, AnimatedMaterial* matAnim, u32 step); +void AnimatedMat_DrawAlphaStep(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); +void AnimatedMat_DrawAlphaStepOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); +void AnimatedMat_DrawAlphaStepXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step); +void Scene_DrawConfigMatAnim(PlayState* play); +void Scene_DrawConfig3(PlayState* play); +void Scene_DrawConfig4(PlayState* play); +void Scene_DrawConfigDoNothing(PlayState* play); +void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags); +void Scene_SetCullFlag(PlayState* play, s32 index, u32 flags); +void Scene_DrawConfig5(PlayState* play); +void Scene_DrawConfigMatAnimManualStep(PlayState* play); +void Scene_DrawConfigGreatBayTemple(PlayState* play); EntranceTableEntry* Entrance_GetTableEntry(u16 entrance); s32 Entrance_GetSceneNum(u16 entranceIndex); s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex); s32 Entrance_GetSpawnNum(u16 entranceIndex); s32 Entrance_GetTransitionFlags(u16 entranceIndex); -s32 Schedule_RunScript(GlobalContext* globalCtx, u8* script, ScheduleResult* result); -void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx); -void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, Mtx** limbMatricies); -void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx); -void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor); +s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result); +void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); +void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx); +void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod); +void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); +void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, Mtx** limbMatricies); +void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); +void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx); +void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor); void SkelAnime_GetFrameData(AnimationHeader* animation, s32 currentFrame, s32 limbCount, Vec3s* dst); s16 Animation_GetLength(void* animation); s16 Animation_GetLastFrame(void* animation); -Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); -Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx); -Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); +Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); +Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx); +Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable); s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation); s16 Animation_GetLength2(LegacyAnimationHeader* animation); s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation); void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf); void AnimationContext_Reset(AnimationContext* animationCtx); -void AnimationContext_SetNextQueue(GlobalContext* globalCtx); -void AnimationContext_DisableQueue(GlobalContext* globalCtx); +void AnimationContext_SetNextQueue(PlayState* play); +void AnimationContext_DisableQueue(PlayState* play); AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, AnimationType type); -void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, 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* index); -void AnimationContext_SetCopyFalse(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); -void AnimationContext_SetMoveActor(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3); -void AnimationContext_LoadFrame(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_CopyAll(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_Interp(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_CopyTrue(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_CopyFalse(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_MoveActor(GlobalContext* globalCtx, AnimationEntryData* data); -void AnimationContext_Update(GlobalContext* globalCtx, AnimationContext* animationCtx); -void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* animation, s32 flags, Vec3s* jointTable, Vec3s* morphTable, s32 limbBufCount); +void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); +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* index); +void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); +void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3); +void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data); +void AnimationContext_Interp(PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyTrue(PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyFalse(PlayState* play, AnimationEntryData* data); +void AnimationContext_MoveActor(PlayState* play, AnimationEntryData* data); +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); -s32 LinkAnimation_Morph(GlobalContext* globalCtx, SkelAnime* skelAnime); -void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime); -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime); -s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime); -void Animation_SetMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 morphFrames); -void LinkAnimation_Change(GlobalContext* globalCtx, 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, f32 playSpeed); -void LinkAnimation_PlayLoop(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayLoopSetSpeed(GlobalContext* globalCtx, 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, f32 frame); -void LinkAnimation_LoadToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_InterpJointMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame); -void LinkAnimation_BlendToJoint(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); -void LinkAnimation_BlendToMorph(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, Vec3s* blendTable); +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime); +s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime); +void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime); +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); +s32 LinkAnimation_Once(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(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); +void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); +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(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); +void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 frame); +void LinkAnimation_BlendToJoint(PlayState* play, 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); void LinkAnimation_EndLoop(SkelAnime* skelAnime); s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate); s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); +void SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); +void SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); void SkelAnime_SetUpdate(SkelAnime* skelAnime); s32 SkelAnime_Update(SkelAnime* skelAnime); @@ -2359,7 +2359,7 @@ 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* pos, 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 SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); @@ -2386,12 +2386,12 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -s32 func_8013A240(GlobalContext* globalCtx); +s32 func_8013A240(PlayState* play); void func_8013A41C(s32 flag); void func_8013A46C(s32 flag); u32 func_8013A4C4(s32 flag); s16 func_8013A504(s16 val); -s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError); +s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError); // void func_8013EC10(void); void func_8013EC44(f32 a, u8 b, u8 c, u8 d); @@ -2464,7 +2464,7 @@ void func_80142100(void* arg0, Gfx** gfx, u32 arg2); s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* vtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8); void func_80143148(SkyboxContext* skyboxCtx, s32 arg1); void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType); -void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType); +void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyType); void func_801434E4(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType); Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z); void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB); @@ -2472,14 +2472,14 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb void SkyboxDraw_Noop(SkyboxContext* skyboxCtx); // void func_80147520(void); -void func_80147564(GlobalContext* globalCtx); -s32 Message_ShouldAdvance(GlobalContext* globalCtx); -s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx); -void func_801477B4(GlobalContext* globalCtx); -void func_80147818(GlobalContext* globalCtx, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); -// void func_80147F18(GlobalContext* globalCtx, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); -// void func_80148558(GlobalContext* globalCtx, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); -void func_80148B98(GlobalContext* globalCtx, u8 bParm2); +void func_80147564(PlayState* play); +s32 Message_ShouldAdvance(PlayState* play); +s32 Message_ShouldAdvanceSilent(PlayState* play); +void func_801477B4(PlayState* play); +void func_80147818(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); +// void func_80147F18(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); +// void func_80148558(PlayState* play, UNK_PTR puParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4); +void func_80148B98(PlayState* play, u8 bParm2); // void func_80148CBC(void); // void func_80148D64(void); // void func_80149048(void); @@ -2487,29 +2487,29 @@ void func_80148B98(GlobalContext* globalCtx, u8 bParm2); // void func_80149454(void); // void func_801496C8(void); // void func_8014995C(void); -void func_80149C18(GlobalContext* globalCtx); +void func_80149C18(PlayState* play); // void Message_FindMessage(void); -void func_80149F74(GlobalContext* globalCtx, u32** ppuParm2); +void func_80149F74(PlayState* play, u32** ppuParm2); // void func_8014AAD0(void); -void func_8014ADBC(GlobalContext* globalCtx, UNK_PTR puParm2); +void func_8014ADBC(PlayState* play, UNK_PTR puParm2); // void func_8014C70C(void); -void Message_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32* offset, f32* arg3, s16 arg4); +void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 arg4); // void func_8014CCB4(void); // void func_8014CDF0(void); // void func_8014CFDC(void); void func_8014D304(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_8014D62C(void); // void func_8014D7B4(void); -void func_80150A84(GlobalContext* globalCtx); -void func_80150D08(GlobalContext* globalCtx, u32 uParm2); +void func_80150A84(PlayState* play); +void func_80150D08(PlayState* play, u32 uParm2); // void func_801514B0(void); -void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* Actor); -void func_80151938(GlobalContext* globalCtx, u16 textId); -void func_80151A68(GlobalContext* globalCtx, u16 textId); -void func_80151BB4(GlobalContext* globalCtx, u8 uParm2); +void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor); +void func_80151938(PlayState* play, u16 textId); +void func_80151A68(PlayState* play, u16 textId); +void func_80151BB4(PlayState* play, u8 uParm2); // void func_80151C9C(void); -void func_80151DA4(GlobalContext* globalCtx, u16 arg2); -void func_80152434(GlobalContext* globalCtx, u16 arg2); +void func_80151DA4(PlayState* play, u16 arg2); +void func_80152434(PlayState* play, u16 arg2); // void func_80152464(void); u8 Message_GetState(MessageContext* msgCtx); // void func_8015268C(void); @@ -2520,12 +2520,12 @@ u8 Message_GetState(MessageContext* msgCtx); // void func_80153750(void); // void func_80153E7C(void); // void func_80153EF0(void); -void func_801541D4(GlobalContext* globalCtx, Gfx** gfxp); +void func_801541D4(PlayState* play, Gfx** gfxp); // void func_80156758(void); -void func_8015680C(GlobalContext* globalCtx); -void func_801586A4(GlobalContext* globalCtx); -void Message_Init(GlobalContext* globalCtx); -void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId); +void func_8015680C(PlayState* play); +void func_801586A4(PlayState* play); +void Message_Init(PlayState* play); +void Message_FindMessageNES(PlayState* play, u16 textId); // void Message_LoadCharNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // void Message_LoadPluralRupeesNES(void); // void Message_LoadLocalizedRupeesNES(void); @@ -2533,11 +2533,11 @@ void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId); // void Message_LoadTimeNES(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void Message_LoadAreaTextNES(void); // void func_80159438(void); -void func_8015966C(GlobalContext* globalCtx, UNK_PTR puParm2, UNK_TYPE arg3); +void func_8015966C(PlayState* play, UNK_PTR puParm2, UNK_TYPE arg3); // void func_8015A144(void); -void func_8015B198(GlobalContext* globalCtx); -void Message_FindCreditsMessage(GlobalContext *globalCtx, u16 textId); -void func_8015E7EC(GlobalContext* globalCtx, UNK_PTR puParm2); +void func_8015B198(PlayState* play); +void Message_FindCreditsMessage(PlayState* play, u16 textId); +void func_8015E7EC(PlayState* play, UNK_PTR puParm2); // void func_8015F8A8(UNK_TYPE4 ctxt); void ShrinkWindow_SetLetterboxTarget(s32 target); @@ -2576,14 +2576,14 @@ void func_80161C0C(void); void* KaleidoManager_FaultAddrConvFunc(void* address, void* param); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_Init(GlobalContext* globalCtx); +void KaleidoManager_Init(PlayState* play); void KaleidoManager_Destroy(); 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 KaleidoScopeCall_Init(PlayState* play); +void KaleidoScopeCall_Destroy(PlayState* play); +void KaleidoScopeCall_Update(PlayState* play); +void KaleidoScopeCall_Draw(PlayState* play); // void func_80163C90(void); // void func_80163D80(void); // void func_80163DC0(void); @@ -2631,42 +2631,42 @@ void func_80165690(void); // void func_80165E7C(void); // void func_80165EC0(void); // void func_80166060(void); -Gfx* func_801660B8(GlobalContext* globalCtx, Gfx* gfx); -void Play_Fini(GameState* gameState); +Gfx* func_801660B8(PlayState* play, Gfx* gfx); +void Play_Fini(GameState* thisx); // void func_801663C4(void); // void func_80166644(void); // void func_801668B4(void); -void func_80166968(GlobalContext* globalCtx, Camera* camera); -void func_80166B30(GlobalContext* globalCtx); -void func_80167814(GlobalContext* globalCtx); -void func_80167DE4(GlobalContext* globalCtx); +void func_80166968(PlayState* play, Camera* camera); +void func_80166B30(PlayState* play); +void func_80167814(PlayState* play); +void func_80167DE4(PlayState* play); // void func_80167F0C(void); -void Play_Draw(GlobalContext* globalCtx); -void func_80168DAC(GlobalContext* globalCtx); -void Play_Update(GlobalContext* globalCtx); -s32 Play_InCsMode(GlobalContext* globalCtx); -f32 func_80169100(GlobalContext* globalCtx, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); +void Play_Draw(PlayState* play); +void func_80168DAC(PlayState* play); +void Play_Update(PlayState* play); +s32 Play_InCsMode(PlayState* play); +f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); // void func_801691F0(void); -void* Play_LoadScene(GlobalContext* globalCtx, RomFile* entry); -void func_8016927C(GlobalContext* globalCtx, s16 sParm2); -// void func_801692C4(GlobalContext* globalCtx, UNK_TYPE1 uParm2); -// void Play_SceneInit(GlobalContext* globalCtx, s32 sceneIndex, UNK_TYPE1 param_3); -UNK_RET func_80169474(GlobalContext* globalCtx, Vec3f* v1, Vec3f* v2); -s32 Play_CreateSubCamera(GlobalContext* globalCtx); -s32 Play_GetActiveCamId(GlobalContext* globalCtx); -void Play_CameraChangeStatus(GlobalContext* globalCtx, s16 camId, s16 status); -void Play_ClearCamera(GlobalContext* globalCtx, s16 camId); -Camera* Play_GetCamera(GlobalContext* globalCtx, s16 index); -s32 Play_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye); -void Play_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); -void Play_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov); -void Play_CameraSetRoll(GlobalContext* globalCtx, s16 camId, s16 roll); -void Play_CopyCamera(GlobalContext* globalCtx, s16 dstCamId, s16 srcCamId); +void* Play_LoadScene(PlayState* play, RomFile* entry); +void func_8016927C(PlayState* play, s16 sParm2); +// void func_801692C4(PlayState* play, UNK_TYPE1 uParm2); +// void Play_SceneInit(PlayState* play, s32 sceneIndex, UNK_TYPE1 param_3); +UNK_RET func_80169474(PlayState* play, Vec3f* v1, Vec3f* v2); +s32 Play_CreateSubCamera(PlayState* play); +s32 Play_GetActiveCamId(PlayState* play); +void Play_CameraChangeStatus(PlayState* play, s16 camId, s16 status); +void Play_ClearCamera(PlayState* play, s16 camId); +Camera* Play_GetCamera(PlayState* play, s16 index); +s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); +void Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +void Play_CameraSetFov(PlayState* play, s16 camId, f32 fov); +void Play_CameraSetRoll(PlayState* play, s16 camId, s16 roll); +void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId); // void func_80169A50(void); -void Play_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting); -void func_80169AFC(GlobalContext* globalCtx, s16 camId, s16 arg2); -s16 Play_GetCsCamDataSetting(GlobalContext* globalCtx, s32 camId); -Vec3s* Play_GetCsCamDataVec3s(GlobalContext* globalCtx, s32 camId); +void Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting); +void func_80169AFC(PlayState* play, s16 camId, s16 arg2); +s16 Play_GetCsCamDataSetting(PlayState* play, s32 camId); +Vec3s* Play_GetCsCamDataVec3s(PlayState* play, s32 camId); s16 Play_GetOriginalSceneNumber(s16 sceneNum); void Play_SaveCycleSceneFlags(GameState* gameState); void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); @@ -2677,7 +2677,7 @@ void func_80169FDC(GameState* gameState); s32 func_80169FFC(GameState* gameState); s32 FrameAdvance_IsEnabled(GameState* gameState); s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw); -s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos); +s32 Play_IsUnderwater(PlayState* play, Vec3f* pos); s32 Play_IsDebugCamEnabled(void); void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 cutscene); void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5); @@ -2692,7 +2692,7 @@ void Play_Init(GameState* gameState); // void func_8016EA90(void); // void func_8016F1A8(void); // void func_8016F4EC(void); -void func_8016F5A8(GlobalContext* globalCtx, s8* pcParm2, Input* iParm3); +void func_8016F5A8(PlayState* play, s8* pcParm2, Input* iParm3); // void func_8016FC78(void); // void func_8016FC98(void); void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); @@ -3031,7 +3031,7 @@ void func_801835EC(UNK_PTR arg0, UNK_PTR arg1); // void func_80183B68(void); s32 func_80183DE0(SkeletonInfo* skeletonInfo); // void func_8018410C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -void func_8018450C(GlobalContext* globalCtx, SkeletonInfo* skeleton, Mtx* mtx, +void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, OverrideKeyframeDrawScaled overrideKeyframeDraw, PostKeyframeDrawScaled postKeyframeDraw, Actor* actor); // void func_801845A4(void); @@ -3518,9 +3518,9 @@ void Audio_SetVolumeScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTim // void func_801A99B8(void); // void func_801A9A74(void); -void GameOver_Init(GlobalContext* globalCtx); -void GameOver_FadeLights(GlobalContext* globalCtx); -void GameOver_Update(GlobalContext* globalCtx); -void func_801AAAA0(GlobalContext* globalCtx); +void GameOver_Init(PlayState* play); +void GameOver_FadeLights(PlayState* play); +void GameOver_Update(PlayState* play); +void func_801AAAA0(PlayState* play); #endif diff --git a/include/macros.h b/include/macros.h index ddf3dcc87c..f1837e3d88 100644 --- a/include/macros.h +++ b/include/macros.h @@ -20,7 +20,7 @@ #define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - RDRAM_CACHED) #define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr)) -#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) +#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamera]) #define CAM_ID_MAIN 0 #define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ @@ -38,9 +38,9 @@ } \ (void)0 -#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].first) +#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].first) -#define GET_FIRST_ENEMY(globalCtx) ((Actor*)(globalCtx)->actorCtx.actorLists[ACTORCAT_ENEMY].first) +#define GET_FIRST_ENEMY(play) ((Actor*)(play)->actorCtx.actorLists[ACTORCAT_ENEMY].first) // linkAge still exists in MM, but is always set to 0 (always adult) // There are remnants of these macros from OOT, but they are essentially useless diff --git a/include/variables.h b/include/variables.h index cbe125ad58..ddb9be246d 100644 --- a/include/variables.h +++ b/include/variables.h @@ -882,7 +882,7 @@ extern s16 actorCutsceneEnding; extern s16 actorCutsceneCurrentCamera; extern Actor* actorCutsceneCurrentCutsceneActor; // extern UNK_TYPE4 actorCutsceneStartMethod; -extern GlobalContext* actorCutscenesGlobalCtxt; +extern PlayState* actorCutscenesPlayState; extern s16 actorCutsceneReturnCamera; extern s16 D_801BD8C6; extern GameStateOverlay gGameStateOverlayTable[]; @@ -3243,8 +3243,8 @@ extern ShrinkWindowContext gShrinkWindowContext; extern ShrinkWindowContext* gShrinkWindowContextPtr; // extern UNK_TYPE4 D_801F6B50; // extern UNK_TYPE1 D_801F6B58; -extern void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx); -extern void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx); +extern void (*sKaleidoScopeUpdateFunc)(PlayState* play); +extern void (*sKaleidoScopeDrawFunc)(PlayState* play); extern FaultAddrConvClient sKaleidoAreaFaultClient; // extern UNK_TYPE1 D_801F6C10; extern Input D_801F6C18; diff --git a/include/z64.h b/include/z64.h index a7895b1865..7970c73e7f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -979,17 +979,17 @@ typedef struct { /* 0x10 */ OSTime resetTime; } PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused) -typedef struct GlobalContext GlobalContext; +typedef struct PlayState PlayState; -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 void(*draw_func)(GlobalContext* globalCtx, s16 index); +typedef void(*draw_func)(PlayState* play, s16 index); -typedef void(*room_draw_func)(GlobalContext* globalCtx, Room* room, u32 flags); +typedef void(*room_draw_func)(PlayState* play, Room* room, u32 flags); typedef struct { /* 0x00 */ draw_func unk0; @@ -1010,7 +1010,7 @@ typedef struct Camera { /* 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; @@ -1115,7 +1115,7 @@ typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*); #define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9) typedef struct { - /* 0x0 */ GlobalContext* globalCtx; + /* 0x0 */ PlayState* play; /* 0x4 */ s32 type; // bitfield, highest set bit determines type /* 0x8 */ s16 countdown; /* 0xA */ s16 state; @@ -1256,7 +1256,7 @@ typedef struct { /* 0x00 */ u16 state; } GameOverContext; // size = 0x02 -struct GlobalContext { +struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneNum; /* 0x000A6 */ u8 sceneConfig; @@ -1288,19 +1288,19 @@ struct GlobalContext { /* 0x17D88 */ ObjectContext objectCtx; /* 0x186E0 */ RoomContext roomCtx; /* 0x18760 */ DoorContext doorCtx; - /* 0x18768 */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader); - /* 0x1876C */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input); - /* 0x18770 */ void (*unk_18770)(struct GlobalContext* globalCtx, Player* player); - /* 0x18774 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx); - /* 0x18778 */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player); - /* 0x1877C */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Player* player, s32 mode); - /* 0x18780 */ void (*func_18780)(Player* player, struct GlobalContext* globalCtx); - /* 0x18784 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage); - /* 0x18788 */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor); - /* 0x1878C */ void (*unk_1878C)(struct GlobalContext* globalCtx); - /* 0x18790 */ void (*unk_18790)(struct GlobalContext* globalCtx, s16 arg1, Actor* actor); + /* 0x18768 */ void (*playerInit)(Player* player, struct PlayState* play, FlexSkeletonHeader* skelHeader); + /* 0x1876C */ void (*playerUpdate)(Player* player, struct PlayState* play, Input* input); + /* 0x18770 */ void (*unk_18770)(struct PlayState* play, Player* player); + /* 0x18774 */ s32 (*startPlayerFishing)(struct PlayState* play); + /* 0x18778 */ s32 (*grabPlayer)(struct PlayState* play, Player* player); + /* 0x1877C */ s32 (*startPlayerCutscene)(struct PlayState* play, Player* player, s32 mode); + /* 0x18780 */ void (*func_18780)(Player* player, struct PlayState* play); + /* 0x18784 */ s32 (*damagePlayer)(struct PlayState* play, s32 damage); + /* 0x18788 */ void (*talkWithPlayer)(struct PlayState* play, Actor* actor); + /* 0x1878C */ void (*unk_1878C)(struct PlayState* play); + /* 0x18790 */ void (*unk_18790)(struct PlayState* play, s16 arg1, Actor* actor); /* 0x18794 */ void* unk_18794; //! @TODO: Determine function prototype - /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct GlobalContext* globalCtx, void* talkAnim, s32 arg2); + /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, void* talkAnim, s32 arg2); /* 0x1879C */ s16 playerActorCsIds[10]; /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f unk_187F0; diff --git a/include/z64actor.h b/include/z64actor.h index c7724bcd74..8412e735d4 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -13,13 +13,13 @@ #define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects. struct Actor; -struct GlobalContext; +struct PlayState; struct Lights; struct CollisionPoly; struct EnBox; -typedef void(*ActorFunc)(struct Actor* this, struct GlobalContext* globalCtx); +typedef void(*ActorFunc)(struct Actor* this, struct PlayState* play); typedef struct { /* 0x00 */ Vec3f pos; @@ -110,7 +110,7 @@ typedef struct { /* 0x1E */ s8 numLoaded; // original name: "clients" } ActorOverlay; // size = 0x20 -typedef void(*ActorShadowFunc)(struct Actor* actor, struct Lights* mapper, struct GlobalContext* globalCtx); +typedef void(*ActorShadowFunc)(struct Actor* actor, struct Lights* mapper, struct PlayState* play); typedef struct { /* 0x00 */ Vec3s rot; // Current actor shape rotation @@ -254,7 +254,7 @@ typedef enum { struct EnItem00; -typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct GlobalContext*); +typedef void (*EnItem00ActionFunc)(struct EnItem00*, struct PlayState*); #define ENITEM00_GET_8000(thisx) ((thisx)->params & 0x8000) #define ENITEM00_GET_7F00(thisx) (((thisx)->params & 0x7F00) >> 8) @@ -275,7 +275,7 @@ typedef struct EnItem00 { struct EnAObj; -typedef void (*EnAObjActionFunc)(struct EnAObj*, struct GlobalContext*); +typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); typedef struct EnAObj { /* 0x000 */ Actor actor; diff --git a/include/z64animation.h b/include/z64animation.h index ced59e4576..cceb2547f2 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -6,7 +6,7 @@ #include "z64dma.h" #include "z64math.h" -struct GlobalContext; +struct PlayState; struct Actor; struct SkelAnime; @@ -189,7 +189,7 @@ typedef struct SkelAnime { /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph /* 0x30 */ union { s32 (*normal)(struct SkelAnime*);// Can be Loop, Partial loop, Play once, Morph, or Tapered morph - s32 (*link)(struct GlobalContext*, struct SkelAnime*); // Loop, Play once, and Morph + s32 (*link)(struct PlayState*, struct SkelAnime*); // Loop, Play once, and Morph } update; /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. @@ -198,29 +198,29 @@ typedef struct SkelAnime { /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. } SkelAnime; // size = 0x44 -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, struct Actor* thisx); -typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, +typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* thisx); -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, struct Actor* thisx, Gfx** gfx); -typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, +typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, struct Actor* thisx, Gfx** gfx); -typedef s32 (*OverrideLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +typedef s32 (*OverrideLimbDrawFlex)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, struct Actor* thisx); -typedef void (*PostLimbDrawFlex)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, +typedef void (*PostLimbDrawFlex)(struct PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, struct Actor* thisx); -typedef void (*TransformLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* thisx); +typedef void (*TransformLimbDrawOpa)(struct PlayState* play, s32 limbIndex, struct Actor* thisx); -typedef void (*TransformLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* thisx, Gfx** gfx); +typedef void (*TransformLimbDraw)(struct PlayState* play, s32 limbIndex, struct Actor* thisx, Gfx** gfx); -typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryData*); +typedef void (*AnimationEntryCallback)(struct PlayState*, AnimationEntryData*); extern u32 link_animetion_segment; @@ -251,7 +251,7 @@ typedef struct AnimationSpeedInfo { struct SkeletonInfo; -typedef s32 (*UnkKeyframeCallback)(struct GlobalContext* globalCtx, struct SkeletonInfo* skeletonInfo, s32* arg2, Gfx** dList, +typedef s32 (*UnkKeyframeCallback)(struct PlayState* play, struct SkeletonInfo* skeletonInfo, s32* arg2, Gfx** dList, u8* arg4, void* arg5); // Keyframe limb? @@ -312,10 +312,10 @@ typedef struct SkeletonInfo { /* 0x2C */ s16* unk_2C; } SkeletonInfo; -typedef s32 (*OverrideKeyframeDrawScaled)(struct GlobalContext* globalCtx, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, +typedef s32 (*OverrideKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos); -typedef void (*PostKeyframeDrawScaled)(struct GlobalContext* globalCtx, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList, +typedef void (*PostKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList, u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos); #endif diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 0a5afb3d9a..2849ce490b 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -1,7 +1,7 @@ #ifndef Z64_BGCHECK_H #define Z64_BGCHECK_H -struct GlobalContext; +struct PlayState; struct Actor; struct DynaPolyActor; @@ -223,7 +223,7 @@ typedef struct { } CollisionContext; // size = 0x1470 typedef struct { - /* 0x00 */ struct GlobalContext* globalCtx; + /* 0x00 */ struct PlayState* play; /* 0x04 */ CollisionContext* colCtx; /* 0x08 */ u16 xpFlags; /* 0x0C */ CollisionPoly** resultPoly; diff --git a/include/z64curve.h b/include/z64curve.h index 2e6e539ba8..f4923e3bfd 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -4,7 +4,7 @@ #include "PR/ultratypes.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, struct Actor* actor); -typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, struct Actor* actor); +typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, struct Actor* actor); +typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, struct Actor* actor); f32 Curve_Interpolate(f32 x, CurveInterpKnot* knots, s32 knotCount); void SkelCurve_Clear(SkelCurve* skelCurve); -s32 SkelCurve_Init(struct GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, CurveAnimationHeader* animation); -void SkelCurve_Destroy(struct GlobalContext* globalCtx, SkelCurve* skelCurve); +s32 SkelCurve_Init(struct PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, CurveAnimationHeader* animation); +void SkelCurve_Destroy(struct PlayState* play, SkelCurve* skelCurve); void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f32 arg2, f32 endFrame, f32 curFrame, f32 playSpeed); -s32 SkelCurve_Update(struct GlobalContext* globalCtx, SkelCurve* skelCurve); -void SkelCurve_Draw(Actor* actor, struct GlobalContext* globalCtx, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* 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, Actor* thisx); // ZAPD compatibility typedefs diff --git a/include/z64effect.h b/include/z64effect.h index 0b848a478f..937c55958c 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -8,7 +8,7 @@ #include "unk.h" struct GraphicsContext; -struct GlobalContext; +struct PlayState; #define SPARK_COUNT 3 #define BLURE_COUNT 25 @@ -199,7 +199,7 @@ typedef struct { } EffectTireMark; // size = 0x60C typedef struct { - /* 0x0000 */ struct GlobalContext* globalCtx; + /* 0x0000 */ struct PlayState* play; struct { EffectStatus status; EffectSpark effect; @@ -238,9 +238,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* particle); -typedef void(*EffectSsDrawFunc)(struct GlobalContext* globalCtx, u32 index, struct EffectSs* particle); +typedef u32 (*EffectSsInitFunc)(struct PlayState* play, u32 index, struct EffectSs* effectSs, void* initParams); +typedef void(*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct EffectSs* particle); +typedef void(*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* particle); typedef struct { /* 0x00 */ u32 type; diff --git a/include/z64light.h b/include/z64light.h index 0c90be7134..60736b62e4 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -88,6 +88,6 @@ typedef enum LightType { } LightType; typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec); -typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, struct GlobalContext* globalCtx); +typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, struct PlayState* play); #endif diff --git a/include/z64player.h b/include/z64player.h index 3a3d10dc91..b37a5335fd 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -186,7 +186,7 @@ typedef struct { } WeaponInfo; // size = 0x1C -typedef void (*PlayerFuncD58)(struct GlobalContext*, struct Player*); +typedef void (*PlayerFuncD58)(struct PlayState*, struct Player*); typedef struct Player { /* 0x000 */ Actor actor; diff --git a/include/z64save.h b/include/z64save.h index 260701473f..28c426bdde 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -6,7 +6,7 @@ #include "os.h" struct GameState; -struct GlobalContext; +struct PlayState; struct FileChooseContext; // TODO: properly name DOWN, RETURN and TOP @@ -275,7 +275,7 @@ typedef enum SunsSongState { void Sram_ActivateOwl(u8 owlId); void Sram_ClearFlagsAtDawnOfTheFirstDay(void); -void Sram_SaveEndOfCycle(struct GlobalContext* globalCtx); +void Sram_SaveEndOfCycle(struct PlayState* play); void Sram_IncrementDay(void); u16 Sram_CalcChecksum(void* data, size_t count); void Sram_InitNewSave(void); @@ -290,8 +290,8 @@ void Sram_InitSave(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx void func_80146DF8(SramContext* sramCtx); void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); void Sram_Alloc(struct GameState* gamestate, SramContext* sramCtx); -void Sram_SaveSpecialEnterClockTown(struct GlobalContext* globalCtx); -void Sram_SaveSpecialNewDay(struct GlobalContext* globalCtx); +void Sram_SaveSpecialEnterClockTown(struct PlayState* play); +void Sram_SaveSpecialNewDay(struct PlayState* play); void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages); void func_80147020(SramContext* sramCtx); void func_80147068(SramContext* sramCtx); diff --git a/include/z64skin.h b/include/z64skin.h index 3d0969fb25..fdc61a5ef7 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -5,7 +5,7 @@ struct GraphicsContext; struct GameState; -struct GlobalContext; +struct PlayState; /** * Holds a compact version of a vertex used in the Skin system (doesn't has the x, y, z positions or the flag member) @@ -78,8 +78,8 @@ typedef struct { /* 0x04C */ SkelAnime skelAnime; } Skin; // size = 0x90 -typedef void (*SkinPostDraw)(struct Actor* thisx, struct GlobalContext* globalCtx, Skin* skin); -typedef s32 (*SkinOverrideLimbDraw)(struct Actor* thisx, struct GlobalContext* globalCtx, s32 limbIndex, Skin* skin); +typedef void (*SkinPostDraw)(struct Actor* thisx, struct PlayState* play, Skin* skin); +typedef s32 (*SkinOverrideLimbDraw)(struct Actor* thisx, struct PlayState* play, s32 limbIndex, Skin* skin); #define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0) #define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1) @@ -89,10 +89,10 @@ void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* mod void Skin_ApplyLimbModifications(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3); void Skin_DrawAnimatedLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); void Skin_DrawLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dListOverride, s32 drawFlags); -void func_80138228(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); -void func_80138258(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); -void func_8013828C(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); -void func_801382C4(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); +void func_80138228(Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); +void func_80138258(Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); +void func_8013828C(Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); +void func_801382C4(Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst); void Skin_GetVertexPos(Skin* skin, s32 limbIndex, s32 vtxIndex, Vec3f* dst); diff --git a/include/z64subs.h b/include/z64subs.h index 96e0366bf4..60c3e7151f 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -17,9 +17,9 @@ typedef enum { } SubSCutsceneType; //! @TODO: rename based on func_8013E748 and func_800B8500 -typedef s32 (*func_8013E748_VerifyFunc)(struct GlobalContext*, Actor*, void*); +typedef s32 (*func_8013E748_VerifyFunc)(struct PlayState*, Actor*, void*); -typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*); +typedef s32 (*VerifyActor)(struct PlayState*, Actor*, Actor*, void*); #define SUBS_SHADOW_TEX_WIDTH 64 #define SUBS_SHADOW_TEX_HEIGHT 64 @@ -55,8 +55,8 @@ typedef struct TrackOptionsSet { (ACTOR_PATHING_REACHED_END_PERMANENT | ACTOR_PATHING_REACHED_END_TEMPORARY) struct ActorPathing; -typedef void (*ActorPathingComputeFunc)(struct GlobalContext*, struct ActorPathing*); -typedef s32 (*ActorPathingUpdateFunc)(struct GlobalContext*, struct ActorPathing*); +typedef void (*ActorPathingComputeFunc)(struct PlayState*, struct ActorPathing*); +typedef s32 (*ActorPathingUpdateFunc)(struct PlayState*, struct ActorPathing*); typedef struct ActorPathing { /* 0x00 */ Path* setupPathList; @@ -82,12 +82,12 @@ typedef struct ActorPathing { /* 0x68 */ ActorPathingUpdateFunc setNextPointFunc; // Return true if should compute and update again } ActorPathing; // size = 0x6C -struct EnDoor* SubS_FindDoor(struct GlobalContext* globalCtx, s32 switchFlag); +struct EnDoor* SubS_FindDoor(struct PlayState* play, s32 switchFlag); -Gfx* SubS_DrawTransformFlexLimb(struct GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx); -Gfx* SubS_DrawTransformFlex(struct GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx); +Gfx* SubS_DrawTransformFlexLimb(struct PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx); +Gfx* SubS_DrawTransformFlex(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx); -s32 SubS_InCsMode(struct GlobalContext* globalCtx); +s32 SubS_InCsMode(struct PlayState* play); s32 SubS_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRot, s32 overrideRot); @@ -98,24 +98,24 @@ s32 SubS_TimePathing_ComputeProgress(f32* progress, s32 elapsedTime, s32 waypoin void SubS_TimePathing_ComputeWeights(s32 order, f32 progress, s32 waypoint, f32 knots[], f32 weights[]); void SubS_TimePathing_ComputeTargetPosXZ(f32* x, f32* z, f32 progress, s32 order, s32 waypoint, Vec3s points[], f32 knots[]); s32 SubS_TimePathing_Update(Path* path, f32* progress, s32* elapsedTime, s32 waypointTime, s32 totalTime, s32* waypoint, f32 knots[], Vec3f* targetPos, s32 timeSpeed); -void SubS_TimePathing_ComputeInitialY(struct GlobalContext* globalCtx, Path* path, s32 waypoint, Vec3f* targetPos); +void SubS_TimePathing_ComputeInitialY(struct PlayState* play, Path* path, s32 waypoint, Vec3f* targetPos); -Path* SubS_GetAdditionalPath(struct GlobalContext* globalCtx, u8 pathIndex, s32 max); +Path* SubS_GetAdditionalPath(struct PlayState* play, u8 pathIndex, s32 max); -Actor* SubS_FindNearestActor(Actor* actor, struct GlobalContext* globalCtx, u8 actorCategory, s16 actorId); +Actor* SubS_FindNearestActor(Actor* actor, struct PlayState* play, u8 actorCategory, s16 actorId); s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations, s32 index); s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex); -Path* SubS_GetDayDependentPath(struct GlobalContext* globalCtx, u8 pathIndex, u8 max, s32* startPointIndex); +Path* SubS_GetDayDependentPath(struct PlayState* play, u8 pathIndex, u8 max, s32* startPointIndex); s32 SubS_WeightPathing_ComputePoint(Path* path, s32 waypoint, Vec3f* point, f32 progress, s32 direction); s32 SubS_WeightPathing_Move(Actor* actor, Path* path, s32* waypoint, f32* progress, s32 direction, s32 returnStart); s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst); -s32 func_8013C964(Actor* actor, struct GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 itemId, s32 type); +s32 func_8013C964(Actor* actor, struct PlayState* play, f32 xzRange, f32 yRange, s32 itemId, s32 type); void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size); void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[], s8 parentBodyParts[]); @@ -126,30 +126,30 @@ s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* turnT s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB); -Path* SubS_GetPathByIndex(struct GlobalContext* globalCtx, s16 pathIndex, s16 max); +Path* SubS_GetPathByIndex(struct PlayState* play, s16 pathIndex, s16 max); s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst); s16 SubS_GetDistSqAndOrientPoints(Vec3f* vecA, Vec3f* vecB, f32* distSq); s32 SubS_MoveActorToPoint(Actor* actor, Vec3f* point, s16 rotStep); s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq); -s8 SubS_IsObjectLoaded(s8 index, struct GlobalContext* globalCtx); -s8 SubS_GetObjectIndex(s16 id, struct GlobalContext* globalCtx); +s8 SubS_IsObjectLoaded(s8 index, struct PlayState* play); +s8 SubS_GetObjectIndex(s16 id, struct PlayState* play); -Actor* SubS_FindActor(struct GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId); +Actor* SubS_FindActor(struct PlayState* play, Actor* actorListStart, u8 actorCategory, s16 actorId); -s32 SubS_FillLimbRotTables(struct GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs); +s32 SubS_FillLimbRotTables(struct PlayState* play, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs); -s32 SubS_IsFloorAbove(struct GlobalContext* globalCtx, Vec3f* pos, f32 distAbove); +s32 SubS_IsFloorAbove(struct PlayState* play, Vec3f* pos, f32 distAbove); s32 SubS_CopyPointFromPathList(Path* paths, s32 pathIndex, s32 pointIndex, Vec3f* dst); u8 SubS_GetPathCountFromPathList(Path* paths, s32 pathIndex); -void SubS_ActorPathing_Init(struct GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags); -s32 SubS_ActorPathing_Update(struct GlobalContext* globalCtx, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc); -void SubS_ActorPathing_ComputePointInfo(struct GlobalContext* globalCtx, ActorPathing* actorPath); -s32 SubS_ActorPathing_MoveWithGravity(struct GlobalContext* globalCtx, ActorPathing* actorPath); -s32 SubS_ActorPathing_MoveWithoutGravityReverse(struct GlobalContext* globalCtx, ActorPathing* actorPath); -s32 SubS_ActorPathing_SetNextPoint(struct GlobalContext* globalCtx, ActorPathing* actorPath); +void SubS_ActorPathing_Init(struct PlayState* play, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags); +s32 SubS_ActorPathing_Update(struct PlayState* play, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc); +void SubS_ActorPathing_ComputePointInfo(struct PlayState* play, ActorPathing* actorPath); +s32 SubS_ActorPathing_MoveWithGravity(struct PlayState* play, ActorPathing* actorPath); +s32 SubS_ActorPathing_MoveWithoutGravityReverse(struct PlayState* play, ActorPathing* actorPath); +s32 SubS_ActorPathing_SetNextPoint(struct PlayState* play, ActorPathing* actorPath); void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex, s32* curIndex); @@ -159,11 +159,11 @@ s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes); void SubS_ConstructPlane(Vec3f* point, Vec3f* unitVec, Vec3s* rot, Plane* plane); s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect); -Actor* SubS_FindActorCustom(struct GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, void* verifyData, VerifyActor verifyActor); +Actor* SubS_FindActorCustom(struct PlayState* play, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, void* verifyData, VerifyActor verifyActor); -s32 func_8013E748(Actor* actor, struct GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, func_8013E748_VerifyFunc verifyFunc); -s32 SubS_ActorAndPlayerFaceEachOther(struct GlobalContext* globalCtx, Actor* actor, void* data); -s32 func_8013E8F8(Actor* actor, struct GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, s16 actorYawTol); +s32 func_8013E748(Actor* actor, struct PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, func_8013E748_VerifyFunc verifyFunc); +s32 SubS_ActorAndPlayerFaceEachOther(struct PlayState* play, Actor* actor, void* data); +s32 func_8013E8F8(Actor* actor, struct PlayState* play, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, s16 actorYawTol); s32 SubS_TrackPointStep(Vec3f* worldPos, Vec3f* focusPos, s16 shapeYRot, Vec3f* yawTarget, Vec3f* pitchTarget, s16* headZRotStep, s16* headXRotStep, s16* torsoZRotStep, s16* torsoXRotStep, u16 headZRotStepMax, u16 headXRotStepMax, u16 torsoZRotStepMax, u16 torsoXRotStepMax); diff --git a/include/z_en_hy_code.h b/include/z_en_hy_code.h index 7c67226cf1..b8391a7d98 100644 --- a/include/z_en_hy_code.h +++ b/include/z_en_hy_code.h @@ -34,7 +34,7 @@ typedef enum { /* 21 */ ENHY_ANIMATION_MAX } EnHyAnimation; -typedef void (*EnHyActionFunc)(struct EnHy*, GlobalContext*); +typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); typedef struct EnHy { /* 0x000 */ Actor actor; @@ -76,19 +76,19 @@ extern s8 gEnHyParentBodyParts[]; extern u8 gEnHyShadowSizes[]; s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex); -EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx); -void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex); -s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx); +EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play); +void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex); +s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play); void EnHy_Blink(EnHy* enHy, s32 arg1); -s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex); -void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, s16 arg4); -s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5); -s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3); -s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex); -s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex); +s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex); +void func_800F0BB4(EnHy* enHy, PlayState* play, EnDoor* door, s16 arg3, s16 arg4); +s32 func_800F0CE4(EnHy* enHy, PlayState* play, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5); +s32 func_800F0DD4(EnHy* enHy, PlayState* play, s16 arg2, s16 arg3); +s32 EnHy_SetPointFowards(EnHy* enHy, PlayState* play, f32 gravity, s16 animIndex); +s32 EnHy_SetPointBackwards(EnHy* enHy, PlayState* play, s16 animIndex); s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget); s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget); -void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx); -s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThreshold); +void EnHy_UpdateCollider(EnHy* enHy, PlayState* play); +s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold); #endif // Z_EN_HY_CODE_H diff --git a/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c index 6fb787451b..7485f2d3a7 100644 --- a/src/code/code_800E8EA0.c +++ b/src/code/code_800E8EA0.c @@ -1,7 +1,7 @@ #include "global.h" -void Actor_ContinueText(GlobalContext* globalCtx, Actor* actor, u16 textId) { - func_80151938(globalCtx, textId); +void Actor_ContinueText(PlayState* play, Actor* actor, u16 textId) { + func_80151938(play, textId); actor->textId = textId; } @@ -77,16 +77,15 @@ s32 Actor_TrackPoint(Actor* actor, Vec3f* target, Vec3s* headRot, Vec3s* torsoRo * * @note same note as Actor_TrackPlayer */ -s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, - f32 focusHeight) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, f32 focusHeight) { + Player* player = GET_PLAYER(play); s16 yaw; Vec3f target; actor->focus.pos = actor->world.pos; actor->focus.pos.y += focusHeight; - if (!((globalCtx->csCtx.state != 0) || gDbgCamEnabled)) { + if (!((play->csCtx.state != 0) || gDbgCamEnabled)) { yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); if (yaw >= 0x4300) { Actor_TrackNone(headRot, torsoRot); @@ -94,8 +93,8 @@ s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3 } } - if ((globalCtx->csCtx.state != 0) || gDbgCamEnabled) { - target = globalCtx->view.eye; + if ((play->csCtx.state != 0) || gDbgCamEnabled) { + target = play->view.eye; } else { target = player->actor.focus.pos; } @@ -121,14 +120,14 @@ s32 Actor_TrackPlayerSetFocusHeight(GlobalContext* globalCtx, Actor* actor, Vec3 * @note if in a cutscene or debug camera is enabled, the computed rotation will instead turn towards the view eye no * matter the yaw. */ -s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos) { + Player* player = GET_PLAYER(play); s16 yaw; Vec3f target; actor->focus.pos = focusPos; - if (!((globalCtx->csCtx.state != 0) || gDbgCamEnabled)) { + if (!((play->csCtx.state != 0) || gDbgCamEnabled)) { yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); if (yaw >= 0x4300) { Actor_TrackNone(headRot, torsoRot); @@ -136,8 +135,8 @@ s32 Actor_TrackPlayer(GlobalContext* globalCtx, Actor* actor, Vec3s* headRot, Ve } } - if ((globalCtx->csCtx.state != 0) || gDbgCamEnabled) { - target = globalCtx->view.eye; + if ((play->csCtx.state != 0) || gDbgCamEnabled) { + target = play->view.eye; } else { target = player->actor.focus.pos; } diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 5dee17fb5b..ea3c30aa6f 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -474,15 +474,15 @@ u16 gScenesPerRegion[11][27] = { }, }; -s32 Inventory_GetBtnBItem(GlobalContext* globalCtx) { +s32 Inventory_GetBtnBItem(PlayState* play) { if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { return ITEM_NONE; } else if (gSaveContext.unk_1015 == ITEM_NONE) { return ITEM_NONE; } else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) { - if (globalCtx->interfaceCtx.unk_21C != 0) { - if (globalCtx->interfaceCtx.unk_21E != 0) { - return globalCtx->interfaceCtx.unk_21E; + if (play->interfaceCtx.unk_21C != 0) { + if (play->interfaceCtx.unk_21E != 0) { + return play->interfaceCtx.unk_21E; } } return ITEM_NONE; @@ -501,12 +501,12 @@ void Inventory_ChangeEquipment(s16 value) { /** * Only deletes shield, equipment argument unused and is a remnant of OoT */ -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { - Player* player = GET_PLAYER(globalCtx); +u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { + Player* player = GET_PLAYER(play); if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { SET_EQUIP_VALUE(EQUIP_SHIELD, 0); - Player_SetEquipmentData(globalCtx, player); + Player_SetEquipmentData(play, player); return true; } @@ -719,12 +719,12 @@ s16 Inventory_GetSkullTokenCount(s16 sceneIndex) { } } -void Inventory_SaveLotteryCodeGuess(GlobalContext* globalCtx) { +void Inventory_SaveLotteryCodeGuess(PlayState* play) { u16 lotteryCodeGuess; - lotteryCodeGuess = ((globalCtx->msgCtx.unk12054[0] & 0xF) << 8); // First Digit - lotteryCodeGuess |= ((globalCtx->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit - lotteryCodeGuess |= (globalCtx->msgCtx.unk12054[2] & 0xF); // Third Digit + lotteryCodeGuess = ((play->msgCtx.unk12054[0] & 0xF) << 8); // First Digit + lotteryCodeGuess |= ((play->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit + lotteryCodeGuess |= (play->msgCtx.unk12054[2] & 0xF); // Third Digit gSaveContext.save.lotteryCodeGuess = (gSaveContext.save.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF); } diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 715d3756f4..20818c06e4 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -134,8 +134,8 @@ static u32 sCurrentBit = 0; static s32 sTimer = 0; void FlagSet_Update(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; - Input* input = CONTROLLER1(&globalCtx->state); + PlayState* play = (PlayState*)gameState; + Input* input = CONTROLLER1(&play->state); /* Intra-byte navigation */ @@ -255,7 +255,7 @@ void FlagSet_Update(GameState* gameState) { // Pressing B will exit } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - globalCtx->pauseCtx.debugState = 0; + play->pauseCtx.debugState = 0; } } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ddc22949bc..fe5927c17c 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -30,13 +30,13 @@ extern Mtx D_801ED8E0; // 1 func extern Actor* D_801ED920; // 2 funcs. 1 out of z_actor // Internal forward declarations -void func_800BA8B8(GlobalContext* globalCtx, ActorContext* actorCtx); -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx); -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx); +void func_800BA8B8(PlayState* play, ActorContext* actorCtx); +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play); +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play); void func_800BB8EC(GameState* gameState, ActorContext* actorCtx, Actor** arg2, Actor** arg3, Player* player); -s32 func_800BA2FC(GlobalContext* globalCtx, Actor* actor, Vec3f* projectedPos, f32 projectedW); +s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projectedW); void Actor_AddToCategory(ActorContext* actorCtx, Actor* actor, u8 actorCategory); -Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove); +Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove); void Actor_PrintLists(ActorContext* actorCtx) { ActorListEntry* actorList = &actorCtx->actorLists[0]; @@ -64,7 +64,7 @@ void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadow actorShape->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) { if (actor->floorPoly != NULL) { f32 dy = actor->world.pos.y - actor->floorHeight; @@ -72,7 +72,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf f32 shadowScale; MtxF mtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -102,48 +102,48 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf shadowScale *= actor->shape.shadowScale; Matrix_Scale(actor->scale.x * shadowScale, 1.0f, actor->scale.z * shadowScale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dlist); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void ActorShadow_DrawCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) { if (actor->bgCheckFlags & 0x400) { - func_800B4AEC(globalCtx, actor, 50.0f); + func_800B4AEC(play, actor, 50.0f); } - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, NULL); + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, NULL); } -void ActorShadow_DrawSquare(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawSquare(Actor* actor, Lights* lights, PlayState* play) { if (actor->bgCheckFlags & 0x400) { - func_800B4AEC(globalCtx, actor, 50.0f); + func_800B4AEC(play, actor, 50.0f); } - ActorShadow_Draw(actor, lights, globalCtx, gSquareShadowDL, NULL); + ActorShadow_Draw(actor, lights, play, gSquareShadowDL, NULL); } -void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, GlobalContext* globalCtx) { +void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play) { static Color_RGBA8 color = { 255, 255, 255, 255 }; - ActorShadow_Draw(actor, lights, globalCtx, gCircleShadowDL, &color); + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &color); } -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 lightNum, f32 shadowAlpha, - f32 shadowScaleX, f32 shadowScaleZ) { +void ActorShadow_DrawFoot(PlayState* play, Light* light, MtxF* arg2, s32 lightNum, f32 shadowAlpha, f32 shadowScaleX, + f32 shadowScaleZ) { s32 pad; s16 sp58; f32 dir2; f32 dir0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(CLAMP_MAX(lightNum * 1.3e-05f, 1.0f) * shadowAlpha)); @@ -156,13 +156,13 @@ void ActorShadow_DrawFoot(GlobalContext* globalCtx, Light* light, MtxF* arg2, s3 Matrix_RotateYS(sp58, MTXMODE_APPLY); Matrix_Scale(shadowScaleX, 1.0f, shadowScaleX * shadowScaleZ, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gFootShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { +void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { f32 distToFloor = actor->world.pos.y - actor->floorHeight; if (distToFloor > 0.0f) { @@ -177,13 +177,13 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx actor->shape.shadowScale *= 0.2f; alphaRatio = distToFloor * 0.03f; actor->shape.shadowAlpha = actor->shape.shadowAlpha * CLAMP_MAX(alphaRatio, 1.0f); - ActorShadow_Draw(actor, mapper, globalCtx, gCircleShadowDL, NULL); + ActorShadow_Draw(actor, mapper, play, gCircleShadowDL, NULL); actor->scale.z = tmpScaleZ; } else { actor->shape.shadowScale *= 0.3f; alphaRatio = (distToFloor - 20.0f) * 0.02f; actor->shape.shadowAlpha = actor->shape.shadowAlpha * CLAMP_MAX(alphaRatio, 1.0f); - ActorShadow_DrawCircle(actor, mapper, globalCtx); + ActorShadow_DrawCircle(actor, mapper, play); } actor->shape.shadowScale = shadowScale; @@ -214,7 +214,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx feetPosPtr = actor->shape.feetPos; floorHeightPtr = floorHeight; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); actor->shape.feetFloorFlags = 0; @@ -222,7 +222,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx for (i = 0; i < ARRAY_COUNT(floorHeight); i++, spB8 >>= 1) { feetPosPtr->y += 50.0f; - *floorHeightPtr = func_80169100(globalCtx, &sp13C, &spF8, &bgId, feetPosPtr); + *floorHeightPtr = func_80169100(play, &sp13C, &spF8, &bgId, feetPosPtr); feetPosPtr->y -= 50.0f; distToFloor = feetPosPtr->y - *floorHeightPtr; @@ -233,10 +233,10 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx actor->shape.feetFloorFlags |= spB8; if ((actor->depthInWater < 0.0f) && (bgId == 0x32) && ((actor->shape.unk_17 & spB8) != 0)) { - if (func_800C9C24(&globalCtx->colCtx, spF8, bgId, 1) != 0) { + if (func_800C9C24(&play->colCtx, spF8, bgId, 1) != 0) { SkinMatrix_MtxFCopy(&sp13C, &spFC); SkinMatrix_MulYRotation(&spFC, actor->shape.rot.y); - EffFootmark_Add(globalCtx, &spFC, actor, i, feetPosPtr, (actor->shape.shadowScale * 0.3f), + EffFootmark_Add(play, &spFC, actor, i, feetPosPtr, (actor->shape.shadowScale * 0.3f), IREG(88) + 80, IREG(89) + 60, IREG(90) + 40, 30000, 200, 60); } actor->shape.unk_17 &= ~spB8; @@ -259,7 +259,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx if (lightNum > 0) { lightNumMax += lightNum; - ActorShadow_DrawFoot(globalCtx, lightPtr, &sp13C, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &sp13C, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -272,7 +272,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx ABS_ALT(lightPtr->l.dir[1])) - (lightNumMax * 8); if (lightNum > 0) { - ActorShadow_DrawFoot(globalCtx, lightPtr, &sp13C, lightNum, shadowAlpha, shadowScaleX, + ActorShadow_DrawFoot(play, lightPtr, &sp13C, lightNum, shadowAlpha, shadowScaleX, shadowScaleZ); } } @@ -295,7 +295,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -308,18 +308,18 @@ void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* lef } } -void func_800B4AEC(GlobalContext* globalCtx, Actor* actor, f32 y) { +void func_800B4AEC(PlayState* play, Actor* actor, f32 y) { s32 floorBgId; f32 yPos = actor->world.pos.y; actor->world.pos.y += y; - actor->floorHeight = BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, - actor, &actor->world.pos); + actor->floorHeight = + BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &actor->floorPoly, &floorBgId, actor, &actor->world.pos); actor->floorBgId = floorBgId; actor->world.pos.y = yPos; } -void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { +void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) { f32 spEC; f32 temp_f12; f32 shadowScaleZ; @@ -335,7 +335,7 @@ void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { s32 lightNumMax; if (actor->bgCheckFlags & 0x400) { - func_800B4AEC(globalCtx, actor, 50.0f); + func_800B4AEC(play, actor, 50.0f); } if (actor->floorPoly != NULL) { @@ -349,13 +349,13 @@ void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { actor->shape.shadowScale *= 0.3f; temp_f12 = (spEC - 20.0f) * 0.02f; actor->shape.shadowAlpha = CLAMP_MAX(temp_f12, 1.0f) * actor->shape.shadowAlpha; - ActorShadow_DrawCircle(actor, mapper, globalCtx); + ActorShadow_DrawCircle(actor, mapper, play); actor->shape.shadowScale = temp_f20; actor->shape.shadowAlpha = temp_v0; } else if (spEC >= -1.0f) { numLights = mapper->numLights - 2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); @@ -371,7 +371,7 @@ void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { lightNum = (phi_s0->l.col[0] + phi_s0->l.col[1] + phi_s0->l.col[2]) * ABS_ALT(phi_s0->l.dir[1]); if (lightNum > 0) { lightNumMax += lightNum; - ActorShadow_DrawFoot(globalCtx, phi_s0, &sp94, lightNum, temp_f22, temp_f24, shadowScaleZ); + ActorShadow_DrawFoot(play, phi_s0, &sp94, lightNum, temp_f22, temp_f24, shadowScaleZ); } } } @@ -381,17 +381,17 @@ void func_800B4B50(Actor* actor, Lights* mapper, GlobalContext* globalCtx) { lightNum = ((phi_s0->l.col[0] + phi_s0->l.col[1] + phi_s0->l.col[2]) * ABS_ALT(phi_s0->l.dir[1])) - (8 * lightNumMax); if (lightNum > 0) { - ActorShadow_DrawFoot(globalCtx, phi_s0, &sp94, lightNum, temp_f22, temp_f24, shadowScaleZ); + ActorShadow_DrawFoot(play, phi_s0, &sp94, lightNum, temp_f22, temp_f24, shadowScaleZ); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void Actor_GetProjectedPos(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg1, arg2, arg3); +void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, arg2, arg3); if (*arg3 < 1.0f) { *arg3 = 1.0f; } else { @@ -421,12 +421,12 @@ TatlColor sTatlColorList[] = { { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } } }; -void func_800B4F78(TargetContext* targetCtx, s32 type, GlobalContext* globalCtx) { +void func_800B4F78(TargetContext* targetCtx, s32 type, PlayState* play) { TatlColor* tatlColorEntry; s32 i; TargetContextEntry* targetEntry; - Math_Vec3f_Copy(&targetCtx->targetCenterPos, &globalCtx->view.eye); + Math_Vec3f_Copy(&targetCtx->targetCenterPos, &play->view.eye); targetCtx->unk48 = 0x100; tatlColorEntry = &sTatlColorList[type]; targetCtx->unk44 = 500.0f; @@ -441,7 +441,7 @@ void func_800B4F78(TargetContext* targetCtx, s32 type, GlobalContext* globalCtx) } } -void Target_SetColors(TargetContext* targetCtx, Actor* actor, s32 type, GlobalContext* globalCtx) { +void Target_SetColors(TargetContext* targetCtx, Actor* actor, s32 type, PlayState* play) { targetCtx->unk0.x = actor->focus.pos.x; targetCtx->unk0.y = actor->focus.pos.y + (actor->targetArrowOffset * actor->scale.y); targetCtx->unk0.z = actor->focus.pos.z; @@ -456,7 +456,7 @@ void Target_SetColors(TargetContext* targetCtx, Actor* actor, s32 type, GlobalCo targetCtx->fairyOuter.a = sTatlColorList[type].outer.a; } -void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) { +void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, PlayState* play) { targetCtx->bgmEnemy = NULL; targetCtx->unk8C = NULL; targetCtx->targetedActor = NULL; @@ -464,17 +464,17 @@ void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, GlobalConte targetCtx->unk4B = 0; targetCtx->unk4C = 0; targetCtx->unk40 = 0.0f; - Target_SetColors(targetCtx, actor, actor->category, globalCtx); - func_800B4F78(targetCtx, actor->category, globalCtx); + Target_SetColors(targetCtx, actor, actor->category, play); + func_800B4F78(targetCtx, actor->category, play); } -void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x300006C2)) { Actor* actor = targetCtx->targetedActor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (targetCtx->unk48 != 0) { TargetContextEntry* entry; s16 alpha = 255; @@ -504,7 +504,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx) { alpha = targetCtx->unk48; } - Actor_GetProjectedPos(globalCtx, &targetCtx->targetCenterPos, &spBC, &spB4); + Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &spBC, &spB4); spBC.x = (160 * (spBC.x * spB4)) * var1; spBC.x = CLAMP(spBC.x, -320.0f, 320.0f); @@ -546,8 +546,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_RotateZS(0x4000, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(entry->unkC, entry->unkC, 0.0f, MTXMODE_APPLY); - gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(OVERLAY_DISP++, gZTargetLockOnTriangleDL); Matrix_Pop(); } @@ -570,22 +569,22 @@ void Actor_DrawZTarget(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_RotateYS((globalCtx->gameplayFrames * 3000), MTXMODE_APPLY); + Matrix_RotateYS((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, color->inner.r, color->inner.g, color->inner.b, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gZTargetArrowDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } // OoT: func_8002C7BC void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; + PlayState* play = (PlayState*)gameState; Actor* sp68 = NULL; s32 category; Vec3f sp58; @@ -594,7 +593,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS if ((player->unk_730 != 0) && (player->unk_AE3[player->unk_ADE] == 2)) { targetCtx->unk_94 = NULL; } else { - func_800BB8EC(gameState, &globalCtx->actorCtx, &sp68, &D_801ED920, player); + func_800BB8EC(gameState, &play->actorCtx, &sp68, &D_801ED920, player); targetCtx->unk_94 = sp68; } @@ -637,11 +636,11 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS targetCtx->unk0.y += y * temp_f0; targetCtx->unk0.z += z * temp_f0; } else { - Target_SetColors(targetCtx, sp68, category, globalCtx); + Target_SetColors(targetCtx, sp68, category, play); } if (actor != NULL && targetCtx->unk4B == 0) { - Actor_GetProjectedPos(globalCtx, &actor->focus.pos, &sp58, &sp54); + Actor_GetProjectedPos(play, &actor->focus.pos, &sp58, &sp54); if ((sp58.z <= 0.0f) || (fabsf(sp58.x * sp54) >= 1.0f) || (fabsf(sp58.y * sp54) >= 1.0f)) { actor = NULL; } @@ -651,7 +650,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS if (actor != targetCtx->targetedActor) { s32 sfxId; - func_800B4F78(targetCtx, actor->category, globalCtx); + func_800B4F78(targetCtx, actor->category, play); targetCtx->targetedActor = actor; @@ -693,9 +692,9 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS /** * Tests if current scene switch flag is set. */ -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - return globalCtx->actorCtx.flags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); + return play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); } return 0; } @@ -703,97 +702,97 @@ s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) { /** * Sets current scene switch flag. */ -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_SetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - globalCtx->actorCtx.flags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); + play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); } } /** * Unsets current scene switch flag. */ -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) { +void Flags_UnsetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - globalCtx->actorCtx.flags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F)); + play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F)); } } /** * 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); } /** * Overrides the all the chest flags. */ -void Flags_SetAllTreasure(GlobalContext* globalCtx, s32 flag) { - globalCtx->actorCtx.flags.chest = flag; +void Flags_SetAllTreasure(PlayState* play, s32 flag) { + play->actorCtx.flags.chest = flag; } /** * Returns all the chest flags. */ -s32 Flags_GetAllTreasure(GlobalContext* globalCtx) { - return globalCtx->actorCtx.flags.chest; +s32 Flags_GetAllTreasure(PlayState* play) { + return play->actorCtx.flags.chest; } /** * Tests if current scene clear flag is set. */ -s32 Flags_GetClear(GlobalContext* globalCtx, s32 roomNumber) { - return globalCtx->actorCtx.flags.clearedRoom & (1 << roomNumber); +s32 Flags_GetClear(PlayState* play, s32 roomNumber) { + return play->actorCtx.flags.clearedRoom & (1 << roomNumber); } /** * Sets current scene clear flag. */ -void Flags_SetClear(GlobalContext* globalCtx, s32 roomNumber) { - globalCtx->actorCtx.flags.clearedRoom |= (1 << roomNumber); +void Flags_SetClear(PlayState* play, s32 roomNumber) { + play->actorCtx.flags.clearedRoom |= (1 << roomNumber); } /** * Unsets current scene clear flag. */ -void Flags_UnsetClear(GlobalContext* globalCtx, s32 roomNumber) { - globalCtx->actorCtx.flags.clearedRoom &= ~(1 << roomNumber); +void Flags_UnsetClear(PlayState* play, s32 roomNumber) { + play->actorCtx.flags.clearedRoom &= ~(1 << roomNumber); } /** * Tests if current scene temp clear flag is set. */ -s32 Flags_GetClearTemp(GlobalContext* globalCtx, s32 roomNumber) { - return globalCtx->actorCtx.flags.clearedRoomTemp & (1 << roomNumber); +s32 Flags_GetClearTemp(PlayState* play, s32 roomNumber) { + return play->actorCtx.flags.clearedRoomTemp & (1 << roomNumber); } /** * Sets current scene temp clear flag. */ -void Flags_SetClearTemp(GlobalContext* globalCtx, s32 roomNumber) { - globalCtx->actorCtx.flags.clearedRoomTemp |= (1 << roomNumber); +void Flags_SetClearTemp(PlayState* play, s32 roomNumber) { + play->actorCtx.flags.clearedRoomTemp |= (1 << roomNumber); } /** * Unsets current scene temp clear flag. */ -void Flags_UnsetClearTemp(GlobalContext* globalCtx, s32 roomNumber) { - globalCtx->actorCtx.flags.clearedRoomTemp &= ~(1 << roomNumber); +void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) { + play->actorCtx.flags.clearedRoomTemp &= ~(1 << roomNumber); } /** * Tests if current scene collectible flag is set. */ -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) { +s32 Flags_GetCollectible(PlayState* play, s32 flag) { if (flag > 0 && flag < 0x80) { - return globalCtx->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); + return play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); } return 0; } @@ -801,9 +800,9 @@ s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) { /** * Sets current scene collectible flag. */ -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) { +void Flags_SetCollectible(PlayState* play, s32 flag) { if (flag > 0 && flag < 0x80) { - globalCtx->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); + play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); } } @@ -898,8 +897,8 @@ void TitleCard_Draw(GameState* gameState, TitleCardContext* titleCtx) { /* End of TitleCard section */ // unused -s32 func_800B6434(GlobalContext* globalCtx, TitleCardContext* titleCtx) { - if ((globalCtx->actorCtx.titleCtxt.delayTimer != 0) || (globalCtx->actorCtx.titleCtxt.alpha != 0)) { +s32 func_800B6434(PlayState* play, TitleCardContext* titleCtx) { + if ((play->actorCtx.titleCtxt.delayTimer != 0) || (play->actorCtx.titleCtxt.alpha != 0)) { titleCtx->durationTimer = 0; titleCtx->delayTimer = 0; return false; @@ -907,57 +906,57 @@ s32 func_800B6434(GlobalContext* globalCtx, TitleCardContext* titleCtx) { return true; } -void func_800B6468(GlobalContext* globalCtx) { - globalCtx->actorCtx.unk1F5 = 0; +void func_800B6468(PlayState* play) { + play->actorCtx.unk1F5 = 0; } -void func_800B6474(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.unk1F5 != 0) { - globalCtx->actorCtx.unk1F5--; +void func_800B6474(PlayState* play) { + if (play->actorCtx.unk1F5 != 0) { + play->actorCtx.unk1F5--; } } -s32 func_800B648C(GlobalContext* globalCtx, s32 arg1, s32 arg2, f32 arg3, Vec3f* arg4) { - if ((globalCtx->actorCtx.unk1F5 != 0) && (arg3 < globalCtx->actorCtx.unk1F8)) { +s32 func_800B648C(PlayState* play, s32 arg1, s32 arg2, f32 arg3, Vec3f* arg4) { + if ((play->actorCtx.unk1F5 != 0) && (arg3 < play->actorCtx.unk1F8)) { return false; } - globalCtx->actorCtx.unk1F4 = arg1; - globalCtx->actorCtx.unk1F5 = arg2; - globalCtx->actorCtx.unk1F8 = arg3; - Math_Vec3f_Copy(&globalCtx->actorCtx.unk1FC, arg4); + play->actorCtx.unk1F4 = arg1; + play->actorCtx.unk1F5 = arg2; + play->actorCtx.unk1F8 = arg3; + Math_Vec3f_Copy(&play->actorCtx.unk1FC, arg4); return true; } -f32 func_800B64FC(GlobalContext* globalCtx, f32 arg1, Vec3f* arg2, u32* arg3) { +f32 func_800B64FC(PlayState* play, f32 arg1, Vec3f* arg2, u32* arg3) { f32 temp_f8; - if ((globalCtx->actorCtx.unk1F5 == 0) || (arg1 == 0.0f)) { + if ((play->actorCtx.unk1F5 == 0) || (arg1 == 0.0f)) { return -1.0f; } - temp_f8 = Math_Vec3f_DistXYZ(&globalCtx->actorCtx.unk1FC, arg2) / arg1; - *arg3 = globalCtx->actorCtx.unk1F4; - return globalCtx->actorCtx.unk1F8 - temp_f8; + temp_f8 = Math_Vec3f_DistXYZ(&play->actorCtx.unk1FC, arg2) / arg1; + *arg3 = play->actorCtx.unk1F4; + return play->actorCtx.unk1F8 - temp_f8; } /** - * Initializes an element of the `globalCtx->actorCtx.unk_20C` array to the `arg2` pointer, or allocates one using the + * Initializes an element of the `play->actorCtx.unk_20C` array to the `arg2` pointer, or allocates one using the * `size` argument in case `arg2` is NULL. This element is associated to an `id` * * In success returns the allocated pointer if `arg2` was NULL or the `arg2` pointer otherwise - * In failure (There's no space left in `globalCtx->actorCtx.unk_20C` or an allocation error happened) returns NULL + * In failure (There's no space left in `play->actorCtx.unk_20C` or an allocation error happened) returns NULL * * Note there are no duplicated id checks. * * Used only by EnLiftNuts. */ -void* func_800B6584(GlobalContext* globalCtx, s16 id, void* arg2, size_t size) { - ActorContext_unk_20C* entry = globalCtx->actorCtx.unk_20C; +void* func_800B6584(PlayState* play, s16 id, void* arg2, size_t size) { + ActorContext_unk_20C* entry = play->actorCtx.unk_20C; s32 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->actorCtx.unk_20C); i++) { + for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) { if (entry->id == 0) { if (arg2 == NULL) { arg2 = ZeldaArena_Malloc(size); @@ -979,18 +978,18 @@ void* func_800B6584(GlobalContext* globalCtx, s16 id, void* arg2, size_t size) { } /** - * Frees the first element of `globalCtx->actorCtx.unk_20C` with id `id`. + * Frees the first element of `play->actorCtx.unk_20C` with id `id`. * * If success, the free'd pointer is returned. * If failure, NULL is returned. * * Used only by EnLiftNuts. */ -void* func_800B6608(GlobalContext* globalCtx, s16 id) { - ActorContext_unk_20C* entry = globalCtx->actorCtx.unk_20C; +void* func_800B6608(PlayState* play, s16 id) { + ActorContext_unk_20C* entry = play->actorCtx.unk_20C; s32 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->actorCtx.unk_20C); i++) { + for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) { if (id == entry->id) { entry->id = 0; if (entry->isDynamicallyInitialised) { @@ -1012,11 +1011,11 @@ void* func_800B6608(GlobalContext* globalCtx, s16 id) { * * Used only by EnLiftNuts. */ -void* func_800B6680(GlobalContext* globalCtx, s16 id) { - ActorContext_unk_20C* entry = globalCtx->actorCtx.unk_20C; +void* func_800B6680(PlayState* play, s16 id) { + ActorContext_unk_20C* entry = play->actorCtx.unk_20C; s32 i; - for (i = 0; i < ARRAY_COUNT(globalCtx->actorCtx.unk_20C); i++) { + for (i = 0; i < ARRAY_COUNT(play->actorCtx.unk_20C); i++) { if (id == entry->id) { return entry->ptr; } @@ -1061,11 +1060,11 @@ void Actor_SetScale(Actor* actor, f32 scale) { actor->scale.x = scale; } -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[actor->objBankIndex].segment); +void Actor_SetObjectDependency(PlayState* play, Actor* actor) { + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(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); @@ -1085,17 +1084,17 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { 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) { if (actor->init == NULL) { if (actor->destroy != NULL) { - actor->destroy(actor, globalCtx); + actor->destroy(actor, play); actor->destroy = NULL; } } @@ -1280,8 +1279,8 @@ f32 Actor_HeightDiff(Actor* actor1, Actor* actor2) { /** * Sets the current and new inputs. */ -void func_800B6F20(GlobalContext* globalCtx, Input* input, f32 magnitude, s16 baseYaw) { - s16 relativeYaw = baseYaw - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); +void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw) { + s16 relativeYaw = baseYaw - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); input->cur.stick_x = -Math_SinS(relativeYaw) * magnitude; input->rel.stick_x = input->cur.stick_x; @@ -1332,23 +1331,23 @@ s32 func_800B7128(Player* player) { return func_800B7118(player) && player->unk_ACC; } -s32 func_800B715C(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800B715C(PlayState* play) { + Player* player = GET_PLAYER(play); return player->stateFlags2 & 0x8; } -void Actor_SetCameraHorseSetting(GlobalContext* globalCtx, Player* player) { - if ((globalCtx->roomCtx.currRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { +void Actor_SetCameraHorseSetting(PlayState* play, Player* player) { + if ((play->roomCtx.currRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { - func_800DFAC8(Play_GetCamera(globalCtx, CAM_ID_MAIN), 4); + func_800DFAC8(Play_GetCamera(play, CAM_ID_MAIN), 4); } } } -void Actor_MountHorse(GlobalContext* globalCtx, Player* player, Actor* horse) { +void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { player->rideActor = horse; player->stateFlags1 |= 0x800000; horse->child = &player->actor; @@ -1362,8 +1361,8 @@ void func_800B722C(GameState* gameState, Player* player) { func_800F40A0(gameState, player); } -s32 func_800B724C(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); if ((player->csMode == 5) || ((csMode == 6) && (player->csMode == 0))) { return false; @@ -1375,10 +1374,10 @@ s32 func_800B724C(GlobalContext* globalCtx, Actor* actor, u8 csMode) { return true; } -u32 func_800B7298(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = GET_PLAYER(globalCtx); +u32 func_800B7298(PlayState* play, Actor* actor, u8 csMode) { + Player* player = GET_PLAYER(play); - if (func_800B724C(globalCtx, actor, csMode)) { + if (func_800B724C(play, actor, csMode)) { player->unk_3BA = 1; return true; } @@ -1400,8 +1399,8 @@ void func_800B72F8(DynaPolyActor* dyna, f32 extraPushForce, s16 yRotation) { * Check if the player is facing the specified actor. * The maximum angle difference that qualifies as "facing" is specified by `maxAngleDiff`. */ -s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff = BINANG_ADD(actor->yawTowardsPlayer, 0x8000) - player->actor.shape.rot.y; if (ABS_ALT(yawDiff) < maxAngleDiff) { @@ -1511,14 +1510,13 @@ s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) { return true; } -s32 func_800B7678(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s32 flags) { +s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { f32 distToFloor; s32 bgId; pos->y += (flags & 0x800) ? 10.0f : 50.0f; - actor->floorHeight = - BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &bgId, actor, pos); + actor->floorHeight = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &actor->floorPoly, &bgId, actor, pos); actor->bgCheckFlags &= ~(0x80 | 0x04 | 0x02); if (actor->floorHeight <= BGCHECK_Y_MIN) { return func_800B761C(actor, BGCHECK_Y_MIN, flags); @@ -1553,7 +1551,7 @@ s32 func_800B7678(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s32 flags) } actor->bgCheckFlags |= 1; - BgCheck2_AttachToMesh(&globalCtx->colCtx, actor, (s32)actor->floorBgId); + BgCheck2_AttachToMesh(&play->colCtx, actor, (s32)actor->floorBgId); } } else { return func_800B761C(actor, distToFloor, flags); @@ -1562,14 +1560,14 @@ s32 func_800B7678(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s32 flags) 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, u32 flags) { f32 sp94 = actor->world.pos.y - actor->prevPos.y; s32 pad; Vec3f pos; if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { - BgCheck2_UpdateActorAttachedToMesh(&globalCtx->colCtx, actor->floorBgId, actor); + BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, actor->floorBgId, actor); } if (flags & 1) { @@ -1577,10 +1575,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe actor->bgCheckFlags &= ~0x1000; if ((!(flags & 0x80) && - (BgCheck_EntitySphVsWall3(&globalCtx->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, + (BgCheck_EntitySphVsWall3(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight))) || ((flags & 0x80) && - (BgCheck_EntitySphVsWall4(&globalCtx->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, + (BgCheck_EntitySphVsWall4(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight)))) { CollisionPoly* sp7C = actor->wallPoly; @@ -1605,7 +1603,7 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe f32 y; pos.y = actor->prevPos.y + 4.0f; - if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &y, &pos, (ceilingCheckHeight + sp94) - 4.0f, &D_801ED8B0, + if (BgCheck_EntityCheckCeiling(&play->colCtx, &y, &pos, (ceilingCheckHeight + sp94) - 4.0f, &D_801ED8B0, &D_801ED8B4, actor)) { actor->bgCheckFlags |= 0x10; actor->world.pos.y = (y + sp94) - 4.0f; @@ -1618,11 +1616,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe f32 y; pos.y = actor->prevPos.y; - func_800B7678(globalCtx, actor, &pos, flags); + func_800B7678(play, actor, &pos, flags); y = actor->world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->world.pos.x, actor->world.pos.z, &y, - &waterbox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &y, &waterbox)) { actor->depthInWater = y - actor->world.pos.y; if (actor->depthInWater <= 0.0f) { actor->bgCheckFlags &= ~(0x40 | 0x20); @@ -1635,9 +1632,9 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp64.y = y; sp64.z = actor->world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp64, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &sp64, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &sp64, 100, 500, 8); + EffectSsGRipple_Spawn(play, &sp64, 100, 500, 0); + EffectSsGRipple_Spawn(play, &sp64, 100, 500, 4); + EffectSsGRipple_Spawn(play, &sp64, 100, 500, 8); } } else { actor->bgCheckFlags &= ~0x40; @@ -1652,8 +1649,7 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe WaterBox* waterbox; f32 y = actor->world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, actor->world.pos.x, actor->world.pos.z, &y, - &waterbox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &y, &waterbox)) { actor->depthInWater = y - actor->world.pos.y; if (actor->depthInWater < 0.0f) { @@ -1667,9 +1663,9 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp50.y = y; sp50.z = actor->world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp50, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &sp50, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &sp50, 100, 500, 8); + EffectSsGRipple_Spawn(play, &sp50, 100, 500, 0); + EffectSsGRipple_Spawn(play, &sp50, 100, 500, 4); + EffectSsGRipple_Spawn(play, &sp50, 100, 500, 8); } } else { actor->bgCheckFlags &= ~0x40; @@ -1721,41 +1717,41 @@ Hilite* Hilite_DrawXlu(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsConte return hilite; } -void func_800B8050(Actor* actor, GlobalContext* globalCtx, s32 flag) { - Hilite* hilite = func_800BCBF4(&actor->world.pos, globalCtx); +void func_800B8050(Actor* actor, PlayState* play, s32 flag) { + Hilite* hilite = func_800BCBF4(&actor->world.pos, play); if (flag != 0) { Gfx* displayListHead; - Gfx* displayList = GRAPH_ALLOC(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + Gfx* displayList = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); gSPSegment(POLY_OPA_DISP++, 0x07, displayList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_800B8118(Actor* actor, GlobalContext* globalCtx, s32 flag) { - Hilite* hilite = func_800BCC68(&actor->world.pos, globalCtx); +void func_800B8118(Actor* actor, PlayState* play, s32 flag) { + Hilite* hilite = func_800BCC68(&actor->world.pos, play); if (flag != 0) { Gfx* displayListHead; - Gfx* displayList = GRAPH_ALLOC(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); + Gfx* displayList = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); gSPSegment(POLY_XLU_DISP++, 0x07, displayList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1856,11 +1852,11 @@ s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState) { // Actor_PickUpExchange? Seems to be called with exchangeItemId -1 if the same actor used Actor_PickUp // This function is also used to toggle the "Speak" action on the A button -s32 func_800B8500(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId) { + Player* player = GET_PLAYER(play); if ((player->actor.flags & ACTOR_FLAG_100) || - ((exchangeItemId > EXCH_ITEM_NONE) && Player_InCsMode(&globalCtx->state)) || + ((exchangeItemId > EXCH_ITEM_NONE) && Player_InCsMode(&play->state)) || (!actor->isTargeted && ((fabsf(actor->playerHeightRel) > fabsf(yRange)) || ((actor->xzDistToPlayer > player->targetActorDistance)) || (xzRange < actor->xzDistToPlayer)))) { @@ -1875,22 +1871,22 @@ s32 func_800B8500(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang return true; } -s32 func_800B85E0(Actor* actor, GlobalContext* globalCtx, f32 radius, s32 exchangeItemId) { - return func_800B8500(actor, globalCtx, radius, radius, exchangeItemId); +s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, s32 exchangeItemId) { + return func_800B8500(actor, play, radius, radius, exchangeItemId); } -s32 func_800B8614(Actor* actor, GlobalContext* globalCtx, f32 radius) { - return func_800B85E0(actor, globalCtx, radius, EXCH_ITEM_NONE); +s32 func_800B8614(Actor* actor, PlayState* play, f32 radius) { + return func_800B85E0(actor, play, radius, EXCH_ITEM_NONE); } -s32 func_800B863C(Actor* actor, GlobalContext* globalCtx) { +s32 func_800B863C(Actor* actor, PlayState* play) { f32 cylRadius = actor->colChkInfo.cylRadius + 50.0f; - return func_800B8614(actor, globalCtx, cylRadius); + return func_800B8614(actor, play, cylRadius); } -s32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 2) { +s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 2) { actor->flags &= ~ACTOR_FLAG_100; return true; } @@ -1902,9 +1898,9 @@ s32 Actor_TextboxIsClosing(Actor* actor, GlobalContext* globalCtx) { * Changes the actor the Player is focussing on * Fails if Player is not already focussing on an actor or in a talking state */ -s32 Actor_ChangeFocus(Actor* actor1, GlobalContext* globalCtx, Actor* actor2) { +s32 Actor_ChangeFocus(Actor* actor1, PlayState* play, Actor* actor2) { Actor* targetActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); targetActor = player->targetActor; @@ -1917,8 +1913,8 @@ s32 Actor_ChangeFocus(Actor* actor1, GlobalContext* globalCtx, Actor* actor2) { return false; } -s32 Player_GetExchangeItemId(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 Player_GetExchangeItemId(PlayState* play) { + Player* player = GET_PLAYER(play); return player->exchangeItemId; } @@ -1933,10 +1929,10 @@ s32 func_800B8718(Actor* actor, GameState* gameState) { } // Similar to func_800B8500 -s32 func_800B874C(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange) { + Player* player = GET_PLAYER(play); - if ((player->actor.flags & ACTOR_FLAG_20000000) || Player_InCsMode(&globalCtx->state) || + if ((player->actor.flags & ACTOR_FLAG_20000000) || Player_InCsMode(&play->state) || (yRange < fabsf(actor->playerHeightRel)) || ((player->unk_A94 < actor->xzDistToPlayer)) || (xzRange < actor->xzDistToPlayer)) { return false; @@ -1947,44 +1943,44 @@ s32 func_800B874C(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang return true; } -s32 func_800B8804(Actor* actor, GlobalContext* globalCtx, f32 xzRange) { - return func_800B874C(actor, globalCtx, xzRange, 20.0f); +s32 func_800B8804(Actor* actor, PlayState* play, f32 xzRange) { + return func_800B874C(actor, play, xzRange, 20.0f); } -s32 func_800B882C(Actor* actor, GlobalContext* globalCtx) { +s32 func_800B882C(Actor* actor, PlayState* play) { f32 cylRadius = actor->colChkInfo.cylRadius + 50.0f; - return func_800B8804(actor, globalCtx, cylRadius); + return func_800B8804(actor, play, cylRadius); } -s32 func_800B886C(Actor* actor, GlobalContext* globalCtx) { - if (!(GET_PLAYER(globalCtx)->actor.flags & ACTOR_FLAG_20000000)) { +s32 func_800B886C(Actor* actor, PlayState* play) { + if (!(GET_PLAYER(play)->actor.flags & ACTOR_FLAG_20000000)) { return true; } return false; } -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 w; - Actor_GetProjectedPos(globalCtx, &actor->focus.pos, &projectedPos, &w); + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &w); *x = (projectedPos.x * w * (SCREEN_WIDTH / 2)) + (SCREEN_WIDTH / 2); *y = (projectedPos.y * w * -(SCREEN_HEIGHT / 2)) + (SCREEN_HEIGHT / 2); } -s32 func_800B8934(GlobalContext* globalCtx, Actor* actor) { +s32 func_800B8934(PlayState* play, Actor* actor) { Vec3f sp2C; f32 sp28; s32 pad[2]; - Actor_GetProjectedPos(globalCtx, &actor->focus.pos, &sp2C, &sp28); + Actor_GetProjectedPos(play, &actor->focus.pos, &sp2C, &sp28); return (sp2C.x * sp28 >= -1.0f) && (sp2C.x * sp28 <= 1.0f) && (sp2C.y * sp28 >= -1.0f) && (sp2C.y * sp28 <= 1.0f); } -s32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { +s32 Actor_HasParent(Actor* actor, PlayState* play) { if (actor->parent != NULL) { return true; } else { @@ -1999,8 +1995,8 @@ s32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { * GI_NONE is usually used as a special case to lift an actor * GI_MAX is usually used to catch an actor in a bottle */ -s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) { @@ -2018,7 +2014,7 @@ s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRa player->getItemDirection = absYawDiff; if ((getItemId > GI_NONE) && (getItemId < GI_MAX)) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[1]); + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[1]); } return true; @@ -2030,19 +2026,19 @@ s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRa return false; } -s32 Actor_PickUpNearby(Actor* actor, GlobalContext* globalCtx, s32 getItemId) { - return Actor_PickUp(actor, globalCtx, getItemId, 50.0f, 10.0f); +s32 Actor_PickUpNearby(Actor* actor, PlayState* play, s32 getItemId) { + return Actor_PickUp(actor, play, getItemId, 50.0f, 10.0f); } -s32 Actor_LiftActor(Actor* actor, GlobalContext* globalCtx) { - return Actor_PickUpNearby(actor, globalCtx, GI_NONE); +s32 Actor_LiftActor(Actor* actor, PlayState* play) { + return Actor_PickUpNearby(actor, play, GI_NONE); } -s32 Actor_PickUpFar(Actor* actor, GlobalContext* globalCtx, s32 getItemId) { - return Actor_PickUp(actor, globalCtx, getItemId, 9999.9f, 9999.9f); +s32 Actor_PickUpFar(Actor* actor, PlayState* play, s32 getItemId) { + return Actor_PickUp(actor, play, getItemId, 9999.9f, 9999.9f); } -s32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { +s32 Actor_HasNoParent(Actor* actor, PlayState* play) { if (actor->parent == NULL) { return true; } @@ -2050,7 +2046,7 @@ s32 Actor_HasNoParent(Actor* actor, GlobalContext* globalCtx) { return false; } -void func_800B8C20(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { +void func_800B8C20(Actor* actorA, Actor* actorB, PlayState* play) { Actor* parent = actorA->parent; if (parent->id == ACTOR_PLAYER) { @@ -2065,15 +2061,15 @@ void func_800B8C20(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { actorA->parent = NULL; } -void func_800B8C50(Actor* actor, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_800B8C50(Actor* actor, PlayState* play) { + Player* player = GET_PLAYER(play); if (actor->xyzDistToPlayerSq < player->unk_AA0) { player->unk_AA0 = actor->xyzDistToPlayerSq; } } -s32 Actor_HasRider(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_HasRider(PlayState* play, Actor* horse) { if (horse->child != NULL) { return true; } @@ -2081,8 +2077,8 @@ s32 Actor_HasRider(GlobalContext* globalCtx, Actor* horse) { return false; } -s32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { - Player* player = GET_PLAYER(globalCtx); +s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x003C7880)) { player->rideActor = horse; @@ -2094,7 +2090,7 @@ s32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { return false; } -s32 Actor_HasNoRider(GlobalContext* globalCtx, Actor* horse) { +s32 Actor_HasNoRider(PlayState* play, Actor* horse) { if (horse->child == NULL) { return true; } @@ -2102,8 +2098,8 @@ s32 Actor_HasNoRider(GlobalContext* globalCtx, Actor* horse) { return false; } -void func_800B8D10(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { - Player* player = GET_PLAYER(globalCtx); +void func_800B8D10(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { + Player* player = GET_PLAYER(play); player->unk_B74 = arg6; player->unk_B75 = arg5; @@ -2112,20 +2108,20 @@ void func_800B8D10(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f player->unk_B7C = arg4; } -void func_800B8D50(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 yaw, f32 arg4, u32 arg5) { - func_800B8D10(globalCtx, actor, arg2, yaw, arg4, 3, arg5); +void func_800B8D50(PlayState* play, Actor* actor, f32 arg2, s16 yaw, f32 arg4, u32 arg5) { + func_800B8D10(play, actor, arg2, yaw, arg4, 3, arg5); } -void func_800B8D98(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_800B8D50(globalCtx, actor, arg2, arg3, arg4, 0); +void func_800B8D98(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_800B8D50(play, actor, arg2, arg3, arg4, 0); } -void func_800B8DD4(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_800B8D10(globalCtx, actor, arg2, arg3, arg4, 2, arg5); +void func_800B8DD4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { + func_800B8D10(play, actor, arg2, arg3, arg4, 2, arg5); } -void func_800B8E1C(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_800B8DD4(globalCtx, actor, arg2, arg3, arg4, 0); +void func_800B8E1C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { + func_800B8DD4(play, actor, arg2, arg3, arg4, 0); } void func_800B8E58(Player* player, u16 sfxId) { @@ -2143,7 +2139,7 @@ void Actor_PlaySfxAtPos(Actor* actor, u16 sfxId) { Audio_PlaySfxAtPos(&actor->projectedPos, sfxId); } -void func_800B8EF4(GlobalContext* globalCtx, Actor* actor) { +void func_800B8EF4(PlayState* play, Actor* actor) { u32 sfxId; if (actor->bgCheckFlags & 0x20) { @@ -2153,7 +2149,7 @@ void func_800B8EF4(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); } Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); @@ -2208,18 +2204,18 @@ void func_800B9098(Actor* actor) { actor->audioFlags |= 0x40; } -s32 func_800B90AC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4) { - if (func_800C99D4(&globalCtx->colCtx, polygon, index) == 8) { +s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 index, s32 arg4) { + if (func_800C99D4(&play->colCtx, polygon, index) == 8) { return true; } return false; } -void func_800B90F4(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.unk3 != 0) { - globalCtx->actorCtx.unk3 = 0; - func_80115D5C(&globalCtx->state); +void func_800B90F4(PlayState* play) { + if (play->actorCtx.unk3 != 0) { + play->actorCtx.unk3 = 0; + func_80115D5C(&play->state); } } @@ -2233,18 +2229,18 @@ void func_800B9120(ActorContext* actorCtx) { actorCtx->unkC = 0x200 >> phi_v0; } -void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) { +void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) { ActorOverlay* overlayEntry; CycleSceneFlags* cycleFlags; s32 i; gSaveContext.save.weekEventReg[92] |= 0x80; - cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; + cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)]; bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); - Matrix_MtxFCopy(&globalCtx->billboardMtxF, &gIdentityMtxF); - Matrix_MtxFCopy(&globalCtx->viewProjectionMtxF, &gIdentityMtxF); + Matrix_MtxFCopy(&play->billboardMtxF, &gIdentityMtxF); + Matrix_MtxFCopy(&play->viewProjectionMtxF, &gIdentityMtxF); overlayEntry = gActorOverlayTable; for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { @@ -2256,42 +2252,42 @@ void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEn actorCtx->flags.chest = cycleFlags->chest; actorCtx->flags.switches[0] = cycleFlags->switch0; actorCtx->flags.switches[1] = cycleFlags->switch1; - if (globalCtx->sceneNum == SCENE_INISIE_R) { - cycleFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum]; + if (play->sceneNum == SCENE_INISIE_R) { + cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneNum]; } actorCtx->flags.collectible[0] = cycleFlags->collectible; actorCtx->flags.clearedRoom = cycleFlags->clearedRoom; - TitleCard_ContextInit(&globalCtx->state, &actorCtx->titleCtxt); - func_800B6468(globalCtx); + TitleCard_ContextInit(&play->state, &actorCtx->titleCtxt); + func_800B6468(play); actorCtx->absoluteSpace = NULL; - Actor_SpawnEntry(actorCtx, actorEntry, globalCtx); - Actor_TargetContextInit(&actorCtx->targetContext, actorCtx->actorLists[ACTORCAT_PLAYER].first, globalCtx); + Actor_SpawnEntry(actorCtx, actorEntry, play); + Actor_TargetContextInit(&actorCtx->targetContext, actorCtx->actorLists[ACTORCAT_PLAYER].first, play); func_800B9120(actorCtx); Fault_AddClient(&sActorFaultClient, (void*)Actor_PrintLists, actorCtx, NULL); - func_800B722C(&globalCtx->state, (Player*)actorCtx->actorLists[ACTORCAT_PLAYER].first); + func_800B722C(&play->state, (Player*)actorCtx->actorLists[ACTORCAT_PLAYER].first); } /** * Spawns the actors in the current setup (of the current scene/setup/room triple) * Only spawns actors based on the time flags embedded in their rotation parameters */ -void Actor_SpawnSetupActors(GlobalContext* globalCtx, ActorContext* actorCtx) { - if (globalCtx->numSetupActors > 0) { - ActorEntry* actorEntry = globalCtx->setupActorList; +void Actor_SpawnSetupActors(PlayState* play, ActorContext* actorCtx) { + if (play->numSetupActors > 0) { + ActorEntry* actorEntry = play->setupActorList; s32 temp_fp = actorCtx->unkC; s32 temp_s1; s32 phi_v0; s32 i; func_800B9120(actorCtx); - func_800BA8B8(globalCtx, &globalCtx->actorCtx); + func_800BA8B8(play, &play->actorCtx); temp_s1 = (actorCtx->unkC * 2) & 0x2FF; - for (i = 0; i < globalCtx->numSetupActors; i++) { + for (i = 0; i < play->numSetupActors; i++) { phi_v0 = ((actorEntry->rot.x & 7) << 7) | (actorEntry->rot.z & 0x7F); if (phi_v0 == 0) { phi_v0 = 0x3FF; @@ -2299,18 +2295,18 @@ void Actor_SpawnSetupActors(GlobalContext* globalCtx, ActorContext* actorCtx) { if (!(phi_v0 & temp_fp) && (phi_v0 & actorCtx->unkC) && (!(gSaveContext.eventInf[1] & 0x80) || !(phi_v0 & temp_s1) || !(actorEntry->id & 0x800))) { - Actor_SpawnEntry(&globalCtx->actorCtx, actorEntry, globalCtx); + Actor_SpawnEntry(&play->actorCtx, actorEntry, play); } actorEntry++; } // Prevents re-spawning the setup actors - globalCtx->numSetupActors = -globalCtx->numSetupActors; + play->numSetupActors = -play->numSetupActors; } } typedef struct { - /* 0x00 */ GlobalContext* globalCtx; + /* 0x00 */ PlayState* play; /* 0x04 */ Actor* actor; /* 0x08 */ u32 unk_08; /* 0x0C */ u32 unkC; @@ -2321,7 +2317,7 @@ typedef struct { } UpdateActor_Params; // size = 0x1C Actor* Actor_UpdateActor(UpdateActor_Params* params) { - GlobalContext* globalCtx = params->globalCtx; + PlayState* play = params->play; Actor* actor = params->actor; Actor* nextActor; @@ -2333,21 +2329,21 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { actor->audioFlags &= ~0x7F; 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; } nextActor = actor->next; } else if (actor->update == NULL) { if (!actor->isDrawn) { - nextActor = Actor_Delete(&globalCtx->actorCtx, actor, globalCtx); + nextActor = Actor_Delete(&play->actorCtx, actor, play); } else { - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); nextActor = actor->next; } } else { - if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_MarkForDeath(actor); } else { s32 tmp = (params->unk_08 == 0); @@ -2379,14 +2375,14 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { actor->targetPriority = 0; } - Actor_SetObjectDependency(globalCtx, actor); + Actor_SetObjectDependency(play, actor); if (actor->colorFilterTimer != 0) { actor->colorFilterTimer--; } - actor->update(actor, globalCtx); - BgCheck_ResetFlagsIfLoadedActor(globalCtx, &globalCtx->colCtx.dyna, actor); + actor->update(actor, play); + BgCheck_ResetFlagsIfLoadedActor(play, &play->colCtx.dyna, actor); } CollisionCheck_ResetDamage(&actor->colChkInfo); @@ -2402,10 +2398,10 @@ u32 D_801AED58[] = { 0x10000282, 0x00000002, 0x300002C2, 0x100006C2, 0x00000002, 0x100002C2, }; -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { s32 i; Actor* actor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); u32* tmp; s32 cat; Actor* next; @@ -2413,15 +2409,15 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { UpdateActor_Params params; params.player = player; - params.globalCtx = globalCtx; + params.play = play; - if (globalCtx->unk_18844 != 0) { + if (play->unk_18844 != 0) { params.unk_18 = ACTOR_FLAG_200000; } else { params.unk_18 = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_10; } - Actor_SpawnSetupActors(globalCtx, actorCtx); + Actor_SpawnSetupActors(play, actorCtx); if (actorCtx->unk2 != 0) { actorCtx->unk2--; @@ -2450,7 +2446,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (i == ACTORCAT_BG) { - DynaPoly_Setup(globalCtx, &globalCtx->colCtx.dyna); + DynaPoly_Setup(play, &play->colCtx.dyna); } } @@ -2465,7 +2461,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { next = actor->next; cat = actor->category; actor->category = i; - Actor_RemoveFromCategory(globalCtx, actorCtx, actor); + Actor_RemoveFromCategory(play, actorCtx, actor); Actor_AddToCategory(actorCtx, actor, cat); actor = next; } @@ -2489,43 +2485,43 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (!(player->stateFlags1 & 2)) { - func_800B5814(&actorCtx->targetContext, player, actor, &globalCtx->state); + func_800B5814(&actorCtx->targetContext, player, actor, &play->state); } - TitleCard_Update(&globalCtx->state, &actorCtx->titleCtxt); - func_800B6474(globalCtx); - DynaPoly_UpdateBgActorTransforms(globalCtx, &globalCtx->colCtx.dyna); + TitleCard_Update(&play->state, &actorCtx->titleCtxt); + func_800B6474(play); + DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna); } -void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { +void Actor_Draw(PlayState* play, Actor* actor) { Lights* light; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - light = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - if ((actor->flags & ACTOR_FLAG_10000000) && (globalCtx->roomCtx.currRoom.enablePosLights || (MREG(93) != 0))) { + light = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); + if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.currRoom.enablePosLights || (MREG(93) != 0))) { light->enablePosLights = true; } - Lights_BindAll(light, globalCtx->lightCtx.listHead, - (actor->flags & (ACTOR_FLAG_10000000 | ACTOR_FLAG_400000)) ? NULL : &actor->world.pos, globalCtx); - Lights_Draw(light, globalCtx->state.gfxCtx); + Lights_BindAll(light, play->lightCtx.listHead, + (actor->flags & (ACTOR_FLAG_10000000 | ACTOR_FLAG_400000)) ? NULL : &actor->world.pos, play); + Lights_Draw(light, play->state.gfxCtx); if (actor->flags & ACTOR_FLAG_1000) { - Matrix_SetTranslateRotateYXZ( - actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, - actor->world.pos.y + ((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), - actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); + Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x, + actor->world.pos.y + + ((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) { s32 temp_v0_2 = actor->colorFilterParams & 0xC000; @@ -2543,28 +2539,28 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { } if (actor->colorFilterParams & 0x2000) { - func_800AE778(globalCtx, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_800AE778(play, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } else { - func_800AE434(globalCtx, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_800AE434(play, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); } } - actor->draw(actor, globalCtx); + actor->draw(actor, play); if (actor->colorFilterTimer != 0) { if (actor->colorFilterParams & 0x2000) { - func_800AE8EC(globalCtx); + func_800AE8EC(play); } else { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } } if (actor->shape.shadowDraw != NULL) { - actor->shape.shadowDraw(actor, light, globalCtx); + actor->shape.shadowDraw(actor, light, play); } actor->isDrawn = true; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_800B9D1C(Actor* actor) { @@ -2595,18 +2591,18 @@ void func_800B9D1C(Actor* actor) { } } -void Actor_DrawAllSetup(GlobalContext* globalCtx) { - globalCtx->actorCtx.undrawnActorCount = 0; - globalCtx->actorCtx.unkB = 0; +void Actor_DrawAllSetup(PlayState* play) { + play->actorCtx.undrawnActorCount = 0; + play->actorCtx.unkB = 0; } -s32 Actor_RecordUndrawnActor(GlobalContext* globalCtx, Actor* actor) { - if (globalCtx->actorCtx.undrawnActorCount >= 32) { +s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) { + if (play->actorCtx.undrawnActorCount >= 32) { return false; } - globalCtx->actorCtx.undrawnActors[globalCtx->actorCtx.undrawnActorCount] = actor; - globalCtx->actorCtx.undrawnActorCount++; + play->actorCtx.undrawnActors[play->actorCtx.undrawnActorCount] = actor; + play->actorCtx.undrawnActorCount++; return true; } @@ -2616,7 +2612,7 @@ void func_800B9E84(Gfx** arg0, s32 arg1) { #ifdef NON_EQUIVALENT // Related to draw actors with lens -void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { +void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors) { s32 spB4; Gfx* spAC; void* spA8; // pad @@ -2634,18 +2630,18 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { Gfx* phi_s1_2; // void* phi_s1_4; - OPEN_DISPS(globalCtx->state.gfxCtx); - // temp_s2 = globalCtx->state.gfxCtx; + OPEN_DISPS(play->state.gfxCtx); + // temp_s2 = play->state.gfxCtx; if (numActors > 0) { spAC = POLY_XLU_DISP; - // sp34 = globalCtx + 0x18000; - spA4 = globalCtx->unk_18E68; + // sp34 = play + 0x18000; + spA4 = play->unk_18E68; - PreRender_SetValues(&globalCtx->pauseBgPreRender, D_801FBBCC, D_801FBBCE, __gfxCtx->curFrameBuffer, + PreRender_SetValues(&play->pauseBgPreRender, D_801FBBCC, D_801FBBCE, __gfxCtx->curFrameBuffer, __gfxCtx->zbuffer); - func_80170200(&globalCtx->pauseBgPreRender, &spAC, __gfxCtx->zbuffer, (void*)spA4); + func_80170200(&play->pauseBgPreRender, &spAC, __gfxCtx->zbuffer, (void*)spA4); // spAC->words.w0 = 0xE7000000; // spAC->words.w1 = 0; @@ -2673,7 +2669,7 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { gDPSetPrimColor(spAC++, 0, 0, 0, 0, 0, 255); // temp_s1_5 = spAC; - if (globalCtx->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.currRoom.unk5 == 0) { // temp_s1_5->words.w0 = 0xFC61E6C3; // temp_s1_5->words.w1 = 0x11CF9FCF; // phi_s1 = temp_s1_5 + 8; @@ -2687,14 +2683,14 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { } // spAC = phi_s1; - func_800B9E84(&spAC, globalCtx->actorCtx.unk4); - phi_s1_2 = func_801660B8(globalCtx, spAC); + func_800B9E84(&spAC, play->actorCtx.unk4); + phi_s1_2 = func_801660B8(play, spAC); for (spB4 = 0; spB4 < numActors; spB4++, actors++) { - Actor_Draw(globalCtx, *actors); + Actor_Draw(play, *actors); } - // temp_s0_2 = &globalCtx->pauseBgPreRender; + // temp_s0_2 = &play->pauseBgPreRender; // phi_s1_2->words.w0 = 0xE7000000; // phi_s1_2->words.w1 = 0; @@ -2723,7 +2719,7 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { // temp_a0_2 = &spAC; // if (sp34->unk_6E5 == 0) { - if (globalCtx->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.currRoom.unk5 == 0) { // temp_s1_10->unk_0 = 0xFC119623; // temp_s1_10->unk_4 = 0xFF2FFFFF; // phi_s1_4 = temp_s1_10 + 8; @@ -2741,14 +2737,13 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { // phi_s1_4->unk_0 = (s32) (((sp34->unk_B4C - 1) & 0xFFF) | 0xFF100000); // temp_s1_11 = phi_s1_4 + 8; // phi_s1_4->unk_4 = spA4; - gDPSetColorImage(phi_s1_2++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((globalCtx->pauseBgPreRender.width - 1) & 0xFFF), - spA4); + gDPSetColorImage(phi_s1_2++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((play->pauseBgPreRender.width - 1) & 0xFFF), spA4); // temp_s1_11 = phi_s1_2; spAC = phi_s1_2; // spAC = temp_s1_11; - func_800B9E84(&spAC, (s32)globalCtx->actorCtx.unk4); + func_800B9E84(&spAC, (s32)play->actorCtx.unk4); // temp_s1_11->words.w0 = 0xE7000000; // temp_s1_11->words.w1 = 0; // temp_s1_12 = temp_s1_11 + 8; @@ -2762,13 +2757,13 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { // temp_s1_14 = temp_s1_13 + 8; // temp_s1_13->words.w0 = ((sp34->unk_B4C - 1) & 0xFFF) | 0xFF100000; // temp_s1_13->words.w1 = sp34->unk_B5C; - gDPSetColorImage(spAC++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((globalCtx->pauseBgPreRender.width - 1) & 0xFFF), - globalCtx->pauseBgPreRender.fbuf); + gDPSetColorImage(spAC++, G_IM_FMT_RGBA, G_IM_SIZ_16b, ((play->pauseBgPreRender.width - 1) & 0xFFF), + play->pauseBgPreRender.fbuf); // temp_a1 = &spAC; // spAC = temp_s1_14; - // func_8016FDB8(&globalCtx->pauseBgPreRender, temp_a1, (void* ) spA4, spA8, 1U); - func_8016FDB8(&globalCtx->pauseBgPreRender, &spAC, (void*)spA4, __gfxCtx->zbuffer, 1U); + // func_8016FDB8(&play->pauseBgPreRender, temp_a1, (void* ) spA4, spA8, 1U); + func_8016FDB8(&play->pauseBgPreRender, &spAC, (void*)spA4, __gfxCtx->zbuffer, 1U); // // POLY_OPA_DISP = temp_s1_14; POLY_OPA_DISP = spAC; @@ -2800,22 +2795,22 @@ void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors) { // spAC = temp_s1_18 + 8; gDPSetPrimColor(spAC++, 0, 0, 74, 0, 0, 74); - func_800B9E84(&spAC, (s32)globalCtx->actorCtx.unk4); + func_800B9E84(&spAC, (s32)play->actorCtx.unk4); OVERLAY_DISP = spAC; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #else -void func_800B9EF4(GlobalContext* globalCtx, s32 numActors, Actor** actors); +void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors); #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800B9EF4.s") #endif -s32 func_800BA2D8(GlobalContext* globalCtx, Actor* actor) { - return func_800BA2FC(globalCtx, actor, &actor->projectedPos, actor->projectedW); +s32 func_800BA2D8(PlayState* play, Actor* actor) { + return func_800BA2FC(play, actor, &actor->projectedPos, actor->projectedW); } -s32 func_800BA2FC(GlobalContext* globalCtx, Actor* actor, Vec3f* projectedPos, f32 projectedW) { +s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projectedW) { if ((-actor->uncullZoneScale < projectedPos->z) && (projectedPos->z < (actor->uncullZoneForward + actor->uncullZoneScale))) { f32 phi_f12; @@ -2823,10 +2818,10 @@ s32 func_800BA2FC(GlobalContext* globalCtx, Actor* actor, Vec3f* projectedPos, f f32 phi_f14; f32 phi_f16; - if (globalCtx->view.fovy != 60.0f) { - phi_f12 = actor->uncullZoneScale * globalCtx->unk_187F0.x * 0.76980036f; // sqrt(16/27) + if (play->view.fovy != 60.0f) { + phi_f12 = actor->uncullZoneScale * play->unk_187F0.x * 0.76980036f; // sqrt(16/27) - phi_f14 = globalCtx->unk_187F0.y * 0.57735026f; // 1 / sqrt(3) + phi_f14 = play->unk_187F0.y * 0.57735026f; // 1 / sqrt(3) phi_f16 = actor->uncullZoneScale * phi_f14; phi_f14 *= actor->uncullZoneDownward; } else { @@ -2843,7 +2838,7 @@ s32 func_800BA2FC(GlobalContext* globalCtx, Actor* actor, Vec3f* projectedPos, f return false; } -void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { +void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { s32 pad[2]; Gfx* ref2; Gfx* tmp2; @@ -2854,15 +2849,15 @@ void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { s32 actorFlags; s32 i; - if (globalCtx->unk_18844 != 0) { + if (play->unk_18844 != 0) { actorFlags = ACTOR_FLAG_200000; } else { actorFlags = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_20; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Actor_DrawAllSetup(globalCtx); + Actor_DrawAllSetup(play); sp58 = POLY_XLU_DISP; POLY_XLU_DISP = &sp58[1]; @@ -2871,14 +2866,14 @@ void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actorEntry->first; while (actor != NULL) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); if (actor->audioFlags & 0x7F) { func_800B9D1C(actor); } - if (func_800BA2D8(globalCtx, actor)) { + if (func_800BA2D8(play, actor)) { actor->flags |= ACTOR_FLAG_40; } else { actor->flags &= ~ACTOR_FLAG_40; @@ -2887,11 +2882,11 @@ void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { actor->isDrawn = false; if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & actorFlags)) { if ((actor->flags & ACTOR_FLAG_80) && - ((globalCtx->roomCtx.currRoom.unk5 == 0) || (globalCtx->actorCtx.unk4 == 0x64) || - (actor->room != globalCtx->roomCtx.currRoom.num))) { - if (Actor_RecordUndrawnActor(globalCtx, actor)) {} + ((play->roomCtx.currRoom.unk5 == 0) || (play->actorCtx.unk4 == 0x64) || + (actor->room != play->roomCtx.currRoom.num))) { + if (Actor_RecordUndrawnActor(play, actor)) {} } else { - Actor_Draw(globalCtx, actor); + Actor_Draw(play, actor); } } @@ -2899,25 +2894,25 @@ void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - Effect_DrawAll(globalCtx->state.gfxCtx); - EffectSS_DrawAllParticles(globalCtx); - EffFootmark_Draw(globalCtx); + Effect_DrawAll(play->state.gfxCtx); + EffectSS_DrawAllParticles(play); + EffFootmark_Draw(play); ref2 = POLY_XLU_DISP; gSPDisplayList(sp58, &ref2[1]); POLY_XLU_DISP = &ref2[1]; - if (globalCtx->actorCtx.unk3 != 0) { - Math_StepToC(&globalCtx->actorCtx.unk4, 100, 20); - if (GET_PLAYER(globalCtx)->stateFlags2 & 0x8000000) { - func_800B90F4(globalCtx); + if (play->actorCtx.unk3 != 0) { + Math_StepToC(&play->actorCtx.unk4, 100, 20); + if (GET_PLAYER(play)->stateFlags2 & 0x8000000) { + func_800B90F4(play); } } else { - Math_StepToC(&globalCtx->actorCtx.unk4, 0, 10); + Math_StepToC(&play->actorCtx.unk4, 0, 10); } - if (globalCtx->actorCtx.unk4 != 0) { - globalCtx->actorCtx.unkB = 1; - func_800B9EF4(globalCtx, globalCtx->actorCtx.undrawnActorCount, globalCtx->actorCtx.undrawnActors); + if (play->actorCtx.unk4 != 0) { + play->actorCtx.unkB = 1; + func_800B9EF4(play, play->actorCtx.undrawnActorCount, play->actorCtx.undrawnActors); } tmp2 = POLY_XLU_DISP; @@ -2925,19 +2920,19 @@ void Actor_DrawAll(GlobalContext* globalCtx, ActorContext* actorCtx) { gSPBranchList(ref2, &tmp2[1]); POLY_XLU_DISP = &tmp2[1]; - if (globalCtx->unk_18844 == 0) { - Lights_DrawGlow(globalCtx); + if (play->unk_18844 == 0) { + Lights_DrawGlow(play); } - TitleCard_Draw(&globalCtx->state, &actorCtx->titleCtxt); + TitleCard_Draw(&play->state, &actorCtx->titleCtxt); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Kills every actor which its object is not loaded */ -void func_800BA6FC(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_800BA6FC(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; @@ -2945,7 +2940,7 @@ void func_800BA6FC(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actorCtx->actorLists[i].first; while (actor != NULL) { - if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { + if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_MarkForDeath(actor); } @@ -2957,7 +2952,7 @@ void func_800BA6FC(GlobalContext* globalCtx, ActorContext* actorCtx) { /** * Kill actors on room change and update flags accordingly */ -void func_800BA798(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_800BA798(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; @@ -2965,13 +2960,13 @@ void func_800BA798(GlobalContext* globalCtx, ActorContext* actorCtx) { actor = actorCtx->actorLists[i].first; while (actor != NULL) { - if ((actor->room >= 0) && (actor->room != globalCtx->roomCtx.currRoom.num) && - (actor->room != globalCtx->roomCtx.prevRoom.num)) { + if ((actor->room >= 0) && (actor->room != play->roomCtx.currRoom.num) && + (actor->room != play->roomCtx.prevRoom.num)) { if (!actor->isDrawn) { - actor = Actor_Delete(actorCtx, actor, globalCtx); + actor = Actor_Delete(actorCtx, actor, play); } else { Actor_MarkForDeath(actor); - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -2980,14 +2975,14 @@ void func_800BA798(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx); + CollisionCheck_ClearContext(play, &play->colChkCtx); actorCtx->flags.clearedRoomTemp = 0; actorCtx->flags.switches[3] = 0; actorCtx->flags.collectible[3] = 0; - globalCtx->msgCtx.unk_12030 = 0; + play->msgCtx.unk_12030 = 0; } -void func_800BA8B8(GlobalContext* globalCtx, ActorContext* actorCtx) { +void func_800BA8B8(PlayState* play, ActorContext* actorCtx) { s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { @@ -2995,12 +2990,12 @@ void func_800BA8B8(GlobalContext* globalCtx, ActorContext* actorCtx) { while (actor != NULL) { if (!(actor->unk20 & actorCtx->unkC)) { - func_80123590(globalCtx, actor); + func_80123590(play, actor); if (!actor->isDrawn) { - actor = Actor_Delete(actorCtx, actor, globalCtx); + actor = Actor_Delete(actorCtx, actor, play); } else { Actor_MarkForDeath(actor); - Actor_Destroy(actor, globalCtx); + Actor_Destroy(actor, play); actor = actor->next; } } else { @@ -3009,11 +3004,11 @@ void func_800BA8B8(GlobalContext* globalCtx, ActorContext* actorCtx) { } } - CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx); - globalCtx->msgCtx.unk_12030 = 0; + CollisionCheck_ClearContext(play, &play->colChkCtx); + play->msgCtx.unk_12030 = 0; } -void Actor_CleanupContext(ActorContext* actorCtx, GlobalContext* globalCtx) { +void Actor_CleanupContext(ActorContext* actorCtx, PlayState* play) { s32 i; Fault_RemoveClient(&sActorFaultClient); @@ -3023,14 +3018,14 @@ void Actor_CleanupContext(ActorContext* actorCtx, GlobalContext* globalCtx) { Actor* actor = actorCtx->actorLists[i].first; while (actor != NULL) { - Actor_Delete(actorCtx, actor, globalCtx); + Actor_Delete(actorCtx, actor, play); actor = actorCtx->actorLists[i].first; } } } while (actorCtx->actorLists[ACTORCAT_PLAYER].first != NULL) { - Actor_Delete(actorCtx, actorCtx->actorLists[ACTORCAT_PLAYER].first, globalCtx); + Actor_Delete(actorCtx, actorCtx->actorLists[ACTORCAT_PLAYER].first, play); } if (actorCtx->absoluteSpace != NULL) { @@ -3038,7 +3033,7 @@ void Actor_CleanupContext(ActorContext* actorCtx, GlobalContext* globalCtx) { actorCtx->absoluteSpace = NULL; } - Play_SaveCycleSceneFlags(&globalCtx->state); + Play_SaveCycleSceneFlags(&play->state); ActorOverlayTable_Cleanup(); } @@ -3075,7 +3070,7 @@ void Actor_AddToCategory(ActorContext* actorCtx, Actor* actor, u8 actorCategory) * 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->totalLoadedActors--; @@ -3096,9 +3091,9 @@ Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == globalCtx->roomCtx.currRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + if ((actorToRemove->room == play->roomCtx.currRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { - Flags_SetClearTemp(globalCtx, globalCtx->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.currRoom.num); } return newHead; @@ -3121,10 +3116,10 @@ void Actor_FreeOverlay(ActorOverlay* entry) { } } -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, - s16 rotX, s16 rotY, s16 rotZ, s32 params) { - return Actor_SpawnAsChildAndCutscene(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, - 0x3FF, NULL); +Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, + s16 rotY, s16 rotZ, s32 params) { + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, 0x3FF, + NULL); } ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { @@ -3167,8 +3162,8 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { return actorInit; } -Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, GlobalContext* globalCtx, s16 index, f32 x, f32 y, f32 z, - s16 rotX, s16 rotY, s16 rotZ, s32 params, u32 cutscene, s32 arg11, Actor* parent) { +Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, + s16 rotY, s16 rotZ, s32 params, u32 cutscene, s32 arg11, Actor* parent) { s32 pad; Actor* actor; ActorInit* actorInit; @@ -3184,10 +3179,9 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, GlobalContext* glob return NULL; } - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); - if ((objBankIndex < 0) || - ((actorInit->type == ACTORCAT_ENEMY) && Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num) && - (actorInit->id != ACTOR_BOSS_05))) { + objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); + if ((objBankIndex < 0) || ((actorInit->type == ACTORCAT_ENEMY) && + Flags_GetClear(play, play->roomCtx.currRoom.num) && (actorInit->id != ACTOR_BOSS_05))) { Actor_FreeOverlay(&gActorOverlayTable[index]); return NULL; } @@ -3225,7 +3219,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, GlobalContext* glob actor->parent = parent; parent->child = actor; } else { - actor->room = globalCtx->roomCtx.currRoom.num; + actor->room = play->roomCtx.currRoom.num; } actor->home.pos.x = x; @@ -3252,48 +3246,48 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, GlobalContext* glob { u32 sp20 = gSegments[6]; - Actor_Init(actor, globalCtx); + Actor_Init(actor, play); gSegments[6] = sp20; } 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, s32 params) { - return Actor_SpawnAsChildAndCutscene(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, +Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, + f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) { + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, parent->unk20, parent); } -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) { - TransitionActorEntry* transitionActorList = globalCtx->doorCtx.transitionActorList; +void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { + TransitionActorEntry* transitionActorList = play->doorCtx.transitionActorList; s32 i; - s16 numTransitionActors = globalCtx->doorCtx.numTransitionActors; + s16 numTransitionActors = play->doorCtx.numTransitionActors; for (i = 0; i < numTransitionActors; transitionActorList++, i++) { if (transitionActorList->id >= 0) { if ((transitionActorList->sides[0].room >= 0 && - (globalCtx->roomCtx.currRoom.num == transitionActorList->sides[0].room || - globalCtx->roomCtx.prevRoom.num == transitionActorList->sides[0].room)) || + (play->roomCtx.currRoom.num == transitionActorList->sides[0].room || + play->roomCtx.prevRoom.num == transitionActorList->sides[0].room)) || (transitionActorList->sides[1].room >= 0 && - (globalCtx->roomCtx.currRoom.num == transitionActorList->sides[1].room || - globalCtx->roomCtx.prevRoom.num == transitionActorList->sides[1].room))) { + (play->roomCtx.currRoom.num == transitionActorList->sides[1].room || + play->roomCtx.prevRoom.num == transitionActorList->sides[1].room))) { s16 rotY = ((transitionActorList->rotY >> 7) & 0x1FF) * (0x10000 / 360.0f); - if (Actor_SpawnAsChildAndCutscene(actorCtx, globalCtx, transitionActorList->id & 0x1FFF, + if (Actor_SpawnAsChildAndCutscene(actorCtx, play, transitionActorList->id & 0x1FFF, transitionActorList->pos.x, transitionActorList->pos.y, transitionActorList->pos.z, 0, rotY, 0, (i << 0xA) + (transitionActorList->params & 0x3FF), transitionActorList->rotY & 0x7F, 0x3FF, 0) != NULL) { transitionActorList->id = -transitionActorList->id; } - numTransitionActors = globalCtx->doorCtx.numTransitionActors; + numTransitionActors = play->doorCtx.numTransitionActors; } } } } -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx) { +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play) { s16 rotX = (actorEntry->rot.x >> 7) & 0x1FF; s16 rotY = (actorEntry->rot.y >> 7) & 0x1FF; s16 rotZ = (actorEntry->rot.z >> 7) & 0x1FF; @@ -3316,21 +3310,21 @@ Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalCo rotZ -= 360; } - return Actor_SpawnAsChildAndCutscene(actorCtx, globalCtx, actorEntry->id & 0x1FFF, actorEntry->pos.x, - actorEntry->pos.y, actorEntry->pos.z, rotX, rotY, rotZ, - actorEntry->params & 0xFFFF, actorEntry->rot.y & 0x7F, + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorEntry->id & 0x1FFF, actorEntry->pos.x, actorEntry->pos.y, + actorEntry->pos.z, rotX, rotY, rotZ, actorEntry->params & 0xFFFF, + actorEntry->rot.y & 0x7F, ((actorEntry->rot.x & 7) << 7) | (actorEntry->rot.z & 0x7F), NULL); } -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) { +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* newHead; ActorOverlay* overlayEntry = actor->overlayEntry; if ((player != NULL) && (actor == player->unk_730)) { func_80123DA4(player); - Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCamId(globalCtx)), 0); + Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } if (actor == actorCtx->targetContext.arrowPointedActor) { @@ -3346,9 +3340,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_Free(actor); if (overlayEntry->vramStart != NULL) { @@ -3359,17 +3353,17 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC return newHead; } -s32 func_800BB59C(GlobalContext* globalCtx, Actor* actor) { +s32 func_800BB59C(PlayState* play, Actor* actor) { s16 x; s16 y; - Actor_GetScreenPos(globalCtx, actor, &x, &y); + Actor_GetScreenPos(play, actor, &x, &y); return (x > -20) && (x < gScreenWidth + 20) && (y > -160) && (y < gScreenHeight + 160); } void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player, s32 actorCategory) { - GlobalContext* globalCtx = (GlobalContext*)gameState; + PlayState* play = (PlayState*)gameState; f32 temp_f0_2; Actor* sp8C; Actor* actor; @@ -3404,11 +3398,10 @@ void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player, } if (((phi_s2) || (phi_s2_2)) && (func_800B83BC(actor, temp_f0_2))) { - if (func_800BB59C(globalCtx, actor)) { - if (((!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.focus.pos, - &actor->focus.pos, &sp70, &sp80, true, true, true, true, - &sp7C)) || - (SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp80, sp7C)))) { + if (func_800BB59C(play, actor)) { + if (((!BgCheck_CameraLineTest1(&play->colCtx, &player->actor.focus.pos, &actor->focus.pos, + &sp70, &sp80, true, true, true, true, &sp7C)) || + (SurfaceType_IsIgnoredByProjectiles(&play->colCtx, sp80, sp7C)))) { if (actor->targetPriority != 0) { if ((phi_s2 != 0) && (actor->targetPriority < D_801ED8D4)) { D_801ED8BC = actor; @@ -3486,9 +3479,9 @@ void func_800BB8EC(GameState* gameState, ActorContext* actorCtx, Actor** arg2, A * 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); } // blinking routine @@ -3537,7 +3530,7 @@ s16 func_800BBC20(s16 arg0[2], s16 arg1, s16 arg2, s16 arg3) { return arg0[0]; } -void Actor_SpawnBodyParts(Actor* actor, GlobalContext* globalCtx, s32 arg2, Gfx** dList) { +void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 arg2, Gfx** dList) { EnPart* part; Actor* spawnedPart; MtxF* currentMatrix; @@ -3545,7 +3538,7 @@ void Actor_SpawnBodyParts(Actor* actor, GlobalContext* globalCtx, s32 arg2, Gfx* if (*dList != NULL) { currentMatrix = Matrix_GetCurrent(); spawnedPart = - Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, currentMatrix->mf[3][0], + Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, currentMatrix->mf[3][0], currentMatrix->mf[3][1], currentMatrix->mf[3][2], 0, 0, actor->objBankIndex, arg2); if (spawnedPart != NULL) { part = (EnPart*)spawnedPart; @@ -3557,7 +3550,7 @@ void Actor_SpawnBodyParts(Actor* actor, GlobalContext* globalCtx, s32 arg2, Gfx* } } -void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 countMinusOne, +void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 countMinusOne, f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting) { Vec3f pos; Vec3f accel = { 0.0f, 0.3f, 0.0f }; @@ -3576,17 +3569,17 @@ void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* pos accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight; if (scale == 0) { - func_800B10C0(globalCtx, &pos, &gZeroVec3f, &accel); + func_800B10C0(play, &pos, &gZeroVec3f, &accel); } else if (useLighting) { - func_800B1210(globalCtx, &pos, &gZeroVec3f, &accel, scale, scaleStep); + func_800B1210(play, &pos, &gZeroVec3f, &accel, scale, scaleStep); } else { - func_800B11A0(globalCtx, &pos, &gZeroVec3f, &accel, scale, scaleStep); + func_800B11A0(play, &pos, &gZeroVec3f, &accel, scale, scaleStep); } angle += (2.0f * 3.14f) / (countMinusOne + 1.0f); } } -void func_800BBFB0(GlobalContext* globalCtx, Vec3f* position, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6) { +void func_800BBFB0(PlayState* play, Vec3f* position, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6) { Vec3f pos; Vec3f accel = { 0.0f, 0.3f, 0.0f }; s32 i; @@ -3602,14 +3595,14 @@ void func_800BBFB0(GlobalContext* globalCtx, Vec3f* position, f32 arg2, s32 arg3 scale += arg4; if (arg6) { - func_800B1210(globalCtx, &pos, &gZeroVec3f, &accel, scale, scaleStep); + func_800B1210(play, &pos, &gZeroVec3f, &accel, scale, scaleStep); } else { - func_800B11A0(globalCtx, &pos, &gZeroVec3f, &accel, scale, scaleStep); + func_800B11A0(play, &pos, &gZeroVec3f, &accel, scale, scaleStep); } } } -void func_800BC154(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { +void func_800BC154(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 actorCategory) { actorCtx->actorLists[actor->category].unk_08 = 1; actor->category = actorCategory; } @@ -3639,8 +3632,8 @@ s32 func_800BC1B4(Actor* actor, Actor* arg1, f32 arg2, f32 arg3) { return false; } -Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, s32 arg3) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +Actor* func_800BC270(PlayState* play, Actor* actor, f32 arg2, s32 arg3) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (itemAction != NULL) { if (((itemAction->id == ACTOR_ARMS_HOOK) && (arg3 & 0x80)) || @@ -3648,7 +3641,7 @@ Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, s32 arg3) ((itemAction->id == ACTOR_EN_ARROW) && (func_800BC188(itemAction->params) & arg3))) { f32 speedXZ; - if ((itemAction->speedXZ <= 0.0f) && (GET_PLAYER(globalCtx)->unk_D57 != 0)) { + if ((itemAction->speedXZ <= 0.0f) && (GET_PLAYER(play)->unk_D57 != 0)) { if (itemAction->id == ACTOR_ARMS_HOOK) { speedXZ = 20.0f; } else if (itemAction->id == ACTOR_EN_BOOM) { @@ -3679,8 +3672,8 @@ Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, s32 arg3) return itemAction; } -Actor* func_800BC444(GlobalContext* globalCtx, Actor* actor, f32 arg2) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; +Actor* func_800BC444(PlayState* play, Actor* actor, f32 arg2) { + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { if (((explosive->id == ACTOR_EN_BOM) || (explosive->id == ACTOR_EN_BOM_CHU) || @@ -3701,7 +3694,7 @@ Actor* func_800BC444(GlobalContext* globalCtx, Actor* actor, f32 arg2) { * * 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; u16 bgCheckFlags; f32 dx; @@ -3718,7 +3711,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, 4); + Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, 4); Math_Vec3f_Copy(&actor->world.pos, &actorPos); ret = actor->bgCheckFlags & 1; @@ -3731,8 +3724,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->stateFlags3 & 0x80000000) && actor->isTargeted) { return true; @@ -3744,8 +3737,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->stateFlags3 & 0x80000000) && !actor->isTargeted) { return true; @@ -3754,13 +3747,13 @@ s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) { return false; } -void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) { +void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { MtxF sp58; f32 sp54; Vec3f sp48; CollisionPoly* sp44; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); @@ -3769,7 +3762,7 @@ void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) sp48.y = arg0->y + 1.0f; sp48.z = arg0->z; - sp54 = BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &sp44, &sp48); + sp54 = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp44, &sp48); if (sp44 != NULL) { func_800C0094(sp44, arg0->x, sp54, arg0->z, &sp58); Matrix_Put(&sp58); @@ -3778,35 +3771,35 @@ void func_800BC620(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800BC770(GlobalContext* globalCtx, s16 y, s16 countdown) { - s16 idx = Quake_Add(&globalCtx->mainCamera, 3); +void func_800BC770(PlayState* play, s16 y, s16 countdown) { + s16 idx = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(idx, 20000); Quake_SetQuakeValues(idx, y, 0, 0, 0); Quake_SetCountdown(idx, countdown); } -void func_800BC7D8(GlobalContext* globalCtx, s16 y, s16 countdown, s16 speed) { - s16 idx = Quake_Add(&globalCtx->mainCamera, 3); +void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed) { + s16 idx = Quake_Add(&play->mainCamera, 3); Quake_SetSpeed(idx, speed); Quake_SetQuakeValues(idx, y, 0, 0, 0); Quake_SetCountdown(idx, countdown); } -void func_800BC848(Actor* actor, GlobalContext* globalCtx, s16 y, s16 countdown) { +void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown) { if (y >= 5) { func_8013ECE0(actor->xyzDistToPlayerSq, 255, 20, 150); } else { func_8013ECE0(actor->xyzDistToPlayerSq, 180, 20, 100); } - func_800BC770(globalCtx, y, countdown); + func_800BC770(play, y, countdown); } typedef struct { @@ -3829,7 +3822,7 @@ DoorLockInfo sDoorLocksInfo[DOORLOCK_MAX] = { * 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) { s32 pad[2]; MtxF baseMtxF; s32 i; @@ -3839,7 +3832,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { f32 chainRotZ = entry->chainsRotZInit; f32 rotZStep; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY); Matrix_Get(&baseMtxF); @@ -3855,7 +3848,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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, entry->chainDL); if ((i % 2) != 0) { @@ -3870,14 +3863,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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, entry->lockDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void Actor_SpawnShieldParticlesMetal(GlobalContext* globalCtx, Vec3f* pos) { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, pos); +void Actor_SpawnShieldParticlesMetal(PlayState* play, Vec3f* pos) { + CollisionCheck_SpawnShieldParticlesMetal(play, pos); } void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration) { @@ -3889,24 +3882,24 @@ void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u1 actor->colorFilterTimer = duration; } -Hilite* func_800BCBF4(Vec3f* arg0, GlobalContext* globalCtx) { +Hilite* func_800BCBF4(Vec3f* arg0, 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 Hilite_DrawOpa(arg0, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return Hilite_DrawOpa(arg0, &play->view.eye, &lightDir, play->state.gfxCtx); } -Hilite* func_800BCC68(Vec3f* arg0, GlobalContext* globalCtx) { +Hilite* func_800BCC68(Vec3f* arg0, 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 Hilite_DrawXlu(arg0, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); + return Hilite_DrawXlu(arg0, &play->view.eye, &lightDir, play->state.gfxCtx); } /** @@ -4055,20 +4048,20 @@ void Actor_GetClosestPosOnPath(Vec3s* points, s32 numPoints, Vec3f* srcPos, Vec3 } // unused -s32 func_800BD2B4(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 arg3, - u16 (*textIdCallback)(GlobalContext*, Actor*), s16 (*arg5)(GlobalContext*, Actor*)) { - if (Actor_ProcessTalkRequest(actor, &globalCtx->state)) { +s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*textIdCallback)(PlayState*, Actor*), + s16 (*arg5)(PlayState*, Actor*)) { + if (Actor_ProcessTalkRequest(actor, &play->state)) { *arg2 = true; return true; } else if (*arg2) { - *arg2 = arg5(globalCtx, actor); + *arg2 = arg5(play, actor); return false; - } else if (!func_800B8934(globalCtx, actor)) { + } else if (!func_800B8934(play, actor)) { return false; - } else if (!func_800B8614(actor, globalCtx, arg3)) { + } else if (!func_800B8614(actor, play, arg3)) { return false; } else { - actor->textId = textIdCallback(globalCtx, actor); + actor->textId = textIdCallback(play, actor); return false; } } @@ -4250,39 +4243,39 @@ Gfx* func_800BD9A0(GraphicsContext* gfxCtx) { } // unused -void func_800BD9E0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, - PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void func_800BD9E0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, + Actor* actor, s16 alpha) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, alpha); gSPSegment(POLY_OPA_DISP++, 0x0C, gEmptyDL); - 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); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800BDAA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, - PostLimbDraw postLimbDraw, Actor* actor, s16 alpha) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); +void func_800BDAA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, + Actor* actor, s16 alpha) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha); - gSPSegment(POLY_XLU_DISP++, 0x0C, func_800BD9A0(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x0C, func_800BD9A0(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); + CLOSE_DISPS(play->state.gfxCtx); } // Unused -s16 func_800BDB6C(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { - Player* player = GET_PLAYER(globalCtx); +s16 func_800BDB6C(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { + Player* player = GET_PLAYER(play); f32 phi_f2; - if ((globalCtx->csCtx.state != 0) || gDbgCamEnabled) { - phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &globalCtx->view.eye) * 0.25f; + if ((play->csCtx.state != 0) || gDbgCamEnabled) { + phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); } @@ -4313,8 +4306,8 @@ void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animation, } // Unused -void func_800BDCF4(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 size) { - s32 frames = globalCtx->gameplayFrames; +void func_800BDCF4(PlayState* play, s16* arg1, s16* arg2, s32 size) { + s32 frames = play->gameplayFrames; s32 i; for (i = 0; i < size; i++) { @@ -4323,7 +4316,7 @@ void func_800BDCF4(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 size) { } } -void Actor_Noop(Actor* actor, GlobalContext* globalCtx) { +void Actor_Noop(Actor* actor, PlayState* play) { } #include "z_cheap_proc.c" @@ -4333,8 +4326,8 @@ void Actor_Noop(Actor* actor, 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* inActor, s16 actorId, u8 actorCategory, f32 distance) { - Actor* actor = globalCtx->actorCtx.actorLists[actorCategory].first; +Actor* Actor_FindNearby(PlayState* play, Actor* inActor, s16 actorId, u8 actorCategory, f32 distance) { + Actor* actor = play->actorCtx.actorLists[actorCategory].first; while (actor != NULL) { if (actor == inActor || ((actorId != -1) && (actorId != actor->id))) { @@ -4352,8 +4345,8 @@ Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* inActor, s16 actorId, u return NULL; } -s32 func_800BE184(GlobalContext* globalCtx, Actor* actor, f32 xzDist, s16 arg3, s16 arg4, s16 arg5) { - Player* player = GET_PLAYER(globalCtx); +s32 func_800BE184(PlayState* play, Actor* actor, f32 xzDist, s16 arg3, s16 arg4, s16 arg5) { + Player* player = GET_PLAYER(play); s16 phi_v0 = BINANG_SUB(BINANG_ROT180(actor->yawTowardsPlayer), player->actor.shape.rot.y); s16 temp_t0 = actor->yawTowardsPlayer - arg5; @@ -4502,7 +4495,7 @@ TexturePtr sElectricSparkTextures[] = { /** * Draw common damage effects applied to each limb provided in limbPos */ -void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, +void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 limbPosCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type) { if (effectAlpha > 0.001f) { s32 twoTexScrollParam; @@ -4514,13 +4507,13 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP f32 electricSparksScale; f32 steamScale; Vec3f* limbPosStart = limbPos; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; f32 effectAlphaScaled; currentMatrix = Matrix_GetCurrent(); // Apply sfx along with damage effect - if ((actor != NULL) && (effectAlpha > 0.05f) && (globalCtx->gameOverCtx.state == 0)) { + if ((actor != NULL) && (effectAlpha > 0.05f) && (play->gameOverCtx.state == 0)) { if (type == ACTOR_DRAW_DMGEFF_FIRE) { Actor_PlaySfxAtPos(actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } else if (type == ACTOR_DRAW_DMGEFF_BLUE_FIRE) { @@ -4532,21 +4525,21 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP } } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); switch (type) { case ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX: case ACTOR_DRAW_DMGEFF_FROZEN_SFX: frozenScale = ((KREG(19) * 0.01f) + 2.3f) * effectScale; steamScale = ((KREG(28) * 0.0001f) + 0.035f) * frozenSteamScale; - func_800BCC68(limbPos, globalCtx); + func_800BCC68(limbPos, play); // Setup to draw ice over frozen actor gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0, (gameplayFrames * 2) & 0xFF, 64, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); gSPDisplayList(POLY_XLU_DISP++, gFrozenIceDL); @@ -4577,7 +4570,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP Matrix_RotateZF(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFrozenIceVtxDL); @@ -4602,14 +4595,14 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP for (limbIndex = 0; limbIndex < limbPosCount; limbIndex++, limbPos++) { twoTexScrollParam = ((limbIndex * 3) + gameplayFrames); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, twoTexScrollParam * 3, - twoTexScrollParam * -12, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, twoTexScrollParam * 3, twoTexScrollParam * -12, + 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(limbPos->x, limbPos->y, limbPos->z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(steamScale, steamScale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFrozenSteamVtxDL); @@ -4626,7 +4619,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP type = 255; } - Matrix_Put(&globalCtx->billboardMtxF); + Matrix_Put(&play->billboardMtxF); Matrix_Scale((effectScale * 0.005f) * 1.35f, (effectScale * 0.005f), (effectScale * 0.005f) * 1.35f, MTXMODE_APPLY); @@ -4649,7 +4642,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, type, (u8)alpha); 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, ((limbIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128)); Matrix_RotateYF(M_PI, MTXMODE_APPLY); @@ -4657,7 +4650,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP currentMatrix->mf[3][1] = limbPos->y; currentMatrix->mf[3][2] = limbPos->z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); @@ -4689,7 +4682,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 128); } - Matrix_Put(&globalCtx->billboardMtxF); + Matrix_Put(&play->billboardMtxF); Matrix_Scale(lightOrbsScale, lightOrbsScale, 1.0f, MTXMODE_APPLY); // Apply and draw a light orb over each limb of frozen actor @@ -4699,7 +4692,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP currentMatrix->mf[3][1] = limbPos->y; currentMatrix->mf[3][2] = limbPos->z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL); @@ -4718,7 +4711,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP } gSPSegment(POLY_XLU_DISP++, 0x08, - Lib_SegmentedToVirtual(sElectricSparkTextures[globalCtx->gameplayFrames % 4])); + Lib_SegmentedToVirtual(sElectricSparkTextures[play->gameplayFrames % 4])); gSPDisplayList(POLY_XLU_DISP++, gElectricSparkDL); @@ -4727,7 +4720,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP gDPSetEnvColor(POLY_XLU_DISP++, (u8)(sREG(20) + 255), (u8)(sREG(21) + 255), (u8)sREG(22), (u8)sREG(23)); - Matrix_Put(&globalCtx->billboardMtxF); + Matrix_Put(&play->billboardMtxF); Matrix_Scale(electricSparksScale, electricSparksScale, electricSparksScale, MTXMODE_APPLY); // Every limb draws two electric sparks at random orientations @@ -4739,7 +4732,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y; currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gElectricSparkVtxDL); @@ -4751,7 +4744,7 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP currentMatrix->mf[3][1] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->y; currentMatrix->mf[3][2] = randPlusMinusPoint5Scaled((f32)sREG(24) + 30.0f) + limbPos->z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gElectricSparkVtxDL); @@ -4760,12 +4753,12 @@ void Actor_DrawDamageEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbP break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s32 limbPosCount, - s32 effectsPerLimb, f32 scale, f32 scaleRange) { +void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, + f32 scale, f32 scaleRange) { static Color_RGBA8 primColor = { 170, 255, 255, 255 }; static Color_RGBA8 envColor = { 200, 200, 255, 255 }; static Vec3f accel = { 0.0f, -1.0f, 0.0f }; @@ -4776,7 +4769,7 @@ void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos s16 yaw; s32 j; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < limbPosCount; i++) { yaw = Actor_YawToPoint(actor, limbPos); @@ -4790,7 +4783,7 @@ void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos velocity.y = Rand_ZeroFloat(4.0f) + 8.0f; velocity.z *= Math_CosS(randomYaw); - EffectSsEnIce_Spawn(globalCtx, limbPos, Rand_ZeroFloat(scaleRange) + scale, &velocity, &accel, &primColor, + EffectSsEnIce_Spawn(play, limbPos, Rand_ZeroFloat(scaleRange) + scale, &velocity, &accel, &primColor, &envColor, 30); } diff --git a/src/code/z_bg_item.c b/src/code/z_bg_item.c index 74adbe6952..79bdf2b822 100644 --- a/src/code/z_bg_item.c +++ b/src/code/z_bg_item.c @@ -15,11 +15,11 @@ void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) { dynaActor->stateFlags = DYNAPOLY_STATE_NONE; } -void DynaPolyActor_LoadMesh(GlobalContext* globalCtx, DynaPolyActor* dynaActor, CollisionHeader* meshHeader) { +void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader) { CollisionHeader* header = NULL; CollisionHeader_GetVirtual(meshHeader, &header); - dynaActor->bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &dynaActor->actor, header); + dynaActor->bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &dynaActor->actor, header); } void DynaPolyActor_ResetState(DynaPolyActor* dynaActor) { @@ -102,7 +102,7 @@ s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor) { } } -s32 DynaPolyActor_ValidateMove(GlobalContext* globalCtx, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, +s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight) { Vec3f startPos; Vec3f endPos; @@ -125,16 +125,16 @@ s32 DynaPolyActor_ValidateMove(GlobalContext* globalCtx, DynaPolyActor* dynaActo endPos.y = startPos.y; endPos.z = sign * adjustedEndRadius * cos + startPos.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, - true, &bgId, &dynaActor->actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, true, + &bgId, &dynaActor->actor, 0.0f)) { return false; } startPos.x = (dynaActor->actor.world.pos.x * 2.0f) - startPos.x; startPos.z = (dynaActor->actor.world.pos.z * 2.0f) - startPos.z; endPos.x = sign * adjustedEndRadius * sin + startPos.x; endPos.z = sign * adjustedEndRadius * cos + startPos.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, - true, &bgId, &dynaActor->actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, true, + &bgId, &dynaActor->actor, 0.0f)) { return false; } return true; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 0667bd84b0..7aaae22bc0 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -124,13 +124,13 @@ void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* pol ssList->head = index; } -void DynaSSNodeList_Init(GlobalContext* globalCtx, DynaSSNodeList* list) { +void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) { list->tbl = NULL; list->count = 0; } -void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* list, u32 numNodes) { - list->tbl = (SSNode*)THA_AllocEndAlign(&globalCtx->state.heap, numNodes * sizeof(SSNode), -2); +void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) { + list->tbl = (SSNode*)THA_AllocEndAlign(&play->state.heap, numNodes * sizeof(SSNode), -2); list->maxNodes = numNodes; list->count = 0; } @@ -1376,7 +1376,7 @@ s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* pol * Initialize StaticLookup Table * returns size of table, in bytes */ -u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, StaticLookup* lookupTbl) { +u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl) { Vec3s* vtxList; CollisionPoly* polyList; s32 polyMax; @@ -1460,11 +1460,11 @@ u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, GlobalContext* globalCtx, /** * Returns whether the current scene should reserve less memory for it's collision lookup */ -s32 BgCheck_IsSmallMemScene(GlobalContext* globalCtx) { +s32 BgCheck_IsSmallMemScene(PlayState* play) { s16* i; for (i = sSmallMemScenes; i < sSmallMemScenes + ARRAY_COUNT(sSmallMemScenes); i++) { - if (globalCtx->sceneNum == *i) { + if (play->sceneNum == *i) { return true; } } @@ -1499,11 +1499,11 @@ void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* s *max = *subdivLength * subdivAmount + min; } -s32 BgCheck_GetSpecialSceneMaxObjects(GlobalContext* globalCtx, s32* maxNodes, s32* maxPolygons, s32* maxVertices) { +s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPolygons, s32* maxVertices) { s32 i; for (i = 0; i < ARRAY_COUNT(sCustomDynapolyMem); i++) { - if (globalCtx->sceneNum == sCustomDynapolyMem[i].sceneId) { + if (play->sceneNum == sCustomDynapolyMem[i].sceneId) { *maxNodes = sCustomDynapolyMem[i].maxNodes; *maxPolygons = sCustomDynapolyMem[i].maxPolygons; *maxVertices = sCustomDynapolyMem[i].maxVertices; @@ -1516,7 +1516,7 @@ s32 BgCheck_GetSpecialSceneMaxObjects(GlobalContext* globalCtx, s32* maxNodes, s /** * Allocate CollisionContext */ -void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, CollisionHeader* colHeader) { +void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader) { u32 tblMax; u32 memSize; u32 lookupTblMemSize; @@ -1527,7 +1527,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->colHeader = colHeader; colCtx->flags = 0; - if (BgCheck_IsSmallMemScene(globalCtx)) { + if (BgCheck_IsSmallMemScene(play)) { colCtx->memSize = 0xF000; colCtx->dyna.polyNodesMax = 1000; colCtx->dyna.polyListMax = 512; @@ -1540,7 +1540,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis s32 useCustomSubdivisions; s32 i; - if (BgCheck_TryGetCustomMemsize(globalCtx->sceneNum, &customMemSize)) { + if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) { colCtx->memSize = customMemSize; } else { colCtx->memSize = 0x23000; @@ -1548,12 +1548,12 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis colCtx->dyna.polyNodesMax = 1000; colCtx->dyna.polyListMax = 544; colCtx->dyna.vtxListMax = 512; - BgCheck_GetSpecialSceneMaxObjects(globalCtx, &colCtx->dyna.polyNodesMax, &colCtx->dyna.polyListMax, + BgCheck_GetSpecialSceneMaxObjects(play, &colCtx->dyna.polyNodesMax, &colCtx->dyna.polyListMax, &colCtx->dyna.vtxListMax); useCustomSubdivisions = false; for (i = 0; i < ARRAY_COUNT(sSceneSubdivisionList); i++) { - if (globalCtx->sceneNum == sSceneSubdivisionList[i].sceneId) { + if (play->sceneNum == sSceneSubdivisionList[i].sceneId) { colCtx->subdivAmount.x = sSceneSubdivisionList[i].subdivAmount.x; colCtx->subdivAmount.y = sSceneSubdivisionList[i].subdivAmount.y; colCtx->subdivAmount.z = sSceneSubdivisionList[i].subdivAmount.z; @@ -1568,7 +1568,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } } colCtx->lookupTbl = THA_AllocEndAlign( - &globalCtx->state.heap, + &play->state.heap, colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); if (colCtx->lookupTbl == NULL) { Fault_AddHungupAndCrash("../z_bgcheck.c", 3955); @@ -1601,12 +1601,12 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } SSNodeList_Init(&colCtx->polyNodes); - SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); + SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); - lookupTblMemSize = BgCheck_InitStaticLookup(colCtx, globalCtx, colCtx->lookupTbl); + lookupTblMemSize = BgCheck_InitStaticLookup(colCtx, play, colCtx->lookupTbl); - DynaPoly_Init(globalCtx, &colCtx->dyna); - DynaPoly_Alloc(globalCtx, &colCtx->dyna); + DynaPoly_Init(play, &colCtx->dyna); + DynaPoly_Alloc(play, &colCtx->dyna); } /** @@ -1661,7 +1661,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 checkDist, s32 arg9) { f32 yIntersectDyna; f32 yIntersect; @@ -1693,7 +1693,7 @@ f32 BgCheck_RaycastFloorImpl(GlobalContext* globalCtx, CollisionContext* colCtx, checkPos.y -= colCtx->subdivLength.y; } if (!(arg9 & 1)) { - dynaRaycast.globalCtx = globalCtx; + dynaRaycast.play = play; dynaRaycast.colCtx = colCtx; dynaRaycast.xpFlags = xpFlags; dynaRaycast.resultPoly = outPoly; @@ -1741,22 +1741,20 @@ 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, 0); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 0); } /** * Public raycast toward floor * returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected */ -f32 BgCheck_EntityRaycastFloor2_1(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, - Vec3f* pos) { +f32 BgCheck_EntityRaycastFloor2_1(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, 1); + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, &bgId, pos, NULL, 0x1C, 1.0f, 1); } /** @@ -1780,18 +1778,18 @@ f32 BgCheck_EntityRaycastFloor5(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_2(GlobalContext* globalCtx, 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, 0); +f32 BgCheck_EntityRaycastFloor5_2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, + Actor* actor, Vec3f* pos) { + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x1C, 1.0f, 0); } /** * Public raycast toward floor * returns yIntersect of the poly found, or BGCHECK_Y_MIN if no poly detected */ -f32 BgCheck_EntityRaycastFloor5_3(GlobalContext* globalCtx, CollisionContext* colCtx, CollisionPoly** outPoly, - s32* bgId, Actor* actor, Vec3f* pos) { - return BgCheck_RaycastFloorImpl(globalCtx, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x3C, 1.0f, 0); +f32 BgCheck_EntityRaycastFloor5_3(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, + Actor* actor, Vec3f* pos) { + return BgCheck_RaycastFloorImpl(play, colCtx, COLPOLY_IGNORE_ENTITY, outPoly, bgId, pos, actor, 0x3C, 1.0f, 0); } /** @@ -2453,11 +2451,11 @@ void SSNodeList_Init(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.heap, tblMax * sizeof(SSNode), -2); - this->polyCheckTbl = THA_AllocEndAlign16(&globalCtx->state.heap, numPolys * sizeof(u8)); + this->tbl = THA_AllocEndAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); + this->polyCheckTbl = THA_AllocEndAlign16(&play->state.heap, numPolys * sizeof(u8)); if (this->polyCheckTbl == NULL) { sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n"); @@ -2554,7 +2552,7 @@ void DynaLookup_ResetWaterBoxStartIndex(u16* waterBoxStartIndex) { /** * Initialize BgActor */ -void BgActor_Init(GlobalContext* globalCtx, BgActor* bgActor) { +void BgActor_Init(PlayState* play, BgActor* bgActor) { bgActor->actor = NULL; bgActor->colHeader = NULL; ScaleRotPos_Init(&bgActor->prevTransform); @@ -2598,8 +2596,8 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { /** * Allocate dyna.polyList */ -void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) { - *polyList = THA_AllocEndAlign(&globalCtx->state.heap, numPolys * sizeof(CollisionPoly), -2); +void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { + *polyList = THA_AllocEndAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2); } /** @@ -2612,8 +2610,8 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { /** * Allocate dyna.vtxList */ -void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) { - *vtxList = THA_AllocEndAlign(&globalCtx->state.heap, numVtx * sizeof(Vec3s), -2); +void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { + *vtxList = THA_AllocEndAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2); } /** @@ -2627,14 +2625,14 @@ void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList) { /** * Allocate dyna.waterBoxList */ -void DynaPoly_AllocWaterBoxList(GlobalContext* globalCtx, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) { - waterBoxList->boxes = THA_AllocEndAlign(&globalCtx->state.heap, numWaterBoxes * sizeof(WaterBox), -2); +void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) { + waterBoxList->boxes = THA_AllocEndAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2); } /** * Update BgActor's prevTransform */ -void DynaPoly_SetBgActorPrevTransform(GlobalContext* globalCtx, BgActor* bgActor) { +void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor) { bgActor->prevTransform = bgActor->curTransform; } @@ -2651,43 +2649,42 @@ 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); DynaPoly_InitWaterBoxList(&dyna->waterBoxList); - DynaSSNodeList_Init(globalCtx, &dyna->polyNodes); + DynaSSNodeList_Init(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_Init(globalCtx, &dyna->bgActors[i]); + BgActor_Init(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); DynaPoly_InitWaterBoxList(&dyna->waterBoxList); - DynaPoly_AllocWaterBoxList(globalCtx, &dyna->waterBoxList, DYNA_WATERBOX_MAX); + DynaPoly_AllocWaterBoxList(play, &dyna->waterBoxList, DYNA_WATERBOX_MAX); - DynaSSNodeList_Init(globalCtx, &dyna->polyNodes); - DynaSSNodeList_Alloc(globalCtx, &dyna->polyNodes, dyna->polyNodesMax); + DynaSSNodeList_Init(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; @@ -2721,42 +2718,42 @@ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) { return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor; } -void func_800C62BC(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C62BC(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C6314(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C6314(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~4; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C636C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C636C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C63C4(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C63C4(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~8; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C641C(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C641C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] |= 0x20; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C6474(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId) { +void func_800C6474(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { dyna->bgActorFlags[bgId] &= ~0x20; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; @@ -2766,13 +2763,13 @@ void func_800C6474(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; if (DynaPoly_IsBgIdBgActor(bgId) == false) { return; } - actor = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + actor = DynaPoly_GetActor(&play->colCtx, bgId); if (actor != NULL) { actor->bgId = BGACTOR_NEG_ONE; @@ -2781,7 +2778,7 @@ void DynaPoly_DeleteBgActor(GlobalContext* globalCtx, DynaCollisionContext* dyna } } -void func_800C6554(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void func_800C6554(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } @@ -2839,8 +2836,8 @@ void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPo /** * original name: DynaPolyInfo_expandSRT */ -void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, - s32* polyStartIndex, s32* waterBoxStartIndex) { +void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, + s32* waterBoxStartIndex) { Actor* actor; s32 pad; s32 pad2; @@ -3064,13 +3061,13 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/DynaPoly_ExpandSRT.s") #endif -void BgCheck_ResetFlagsIfLoadedActor(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor* actor) { +void BgCheck_ResetFlagsIfLoadedActor(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) { DynaPolyActor_ResetState((DynaPolyActor*)actor); return; @@ -3082,7 +3079,7 @@ void BgCheck_ResetFlagsIfLoadedActor(GlobalContext* globalCtx, DynaCollisionCont /** * original name: DynaPolyInfo_setup */ -void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { +void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { DynaPolyActor* actor; s32 vtxStartIndex; s32 polyStartIndex; @@ -3099,19 +3096,19 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { if (dyna->bgActorFlags[i] & 2) { // Initialize BgActor dyna->bgActorFlags[i] = 0; - BgActor_Init(globalCtx, &dyna->bgActors[i]); + BgActor_Init(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) { // Delete BgActor - 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_Init(globalCtx, &dyna->bgActors[i]); + BgActor_Init(play, &dyna->bgActors[i]); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } @@ -3120,7 +3117,7 @@ void DynaPoly_Setup(GlobalContext* globalCtx, DynaCollisionContext* dyna) { waterBoxStartIndex = 0; for (i = 0; i < BG_ACTOR_MAX; i++) { if ((dyna->bgActorFlags[i] & 1) && !(dyna->bgActorFlags[i] & 2)) { - DynaPoly_ExpandSRT(globalCtx, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex); + DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex); } } dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP; @@ -3150,12 +3147,12 @@ void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertice /** * 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]); } } } @@ -3295,10 +3292,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) { - 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; @@ -3983,7 +3980,7 @@ void CollisionHeader_GetVirtual(CollisionHeader* colHeader, CollisionHeader** de /** * SEGMENT_TO_VIRTUAL all active BgActor CollisionHeaders */ -void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, GlobalContext* globalCtx) { +void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play) { DynaCollisionContext* dyna = &colCtx->dyna; s32 i; u16 flag; @@ -3991,7 +3988,7 @@ void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, GlobalContext* globa 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); } } @@ -4378,7 +4375,7 @@ u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 * 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, s32* bgId) { CollisionHeader* colHeader; u32 room; @@ -4392,7 +4389,7 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = 0x3F & (curWaterBox->properties >> 13); - if (room == (u32)globalCtx->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { if (curWaterBox->properties & 0x80000) { continue; } @@ -4438,16 +4435,16 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, } // boolean -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) { - return WaterBox_GetSurface1_2(globalCtx, colCtx, x, z, ySurface, outWaterBox); + return WaterBox_GetSurface1_2(play, colCtx, x, z, ySurface, outWaterBox); } // boolean -s32 WaterBox_GetSurface1_2(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, +s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { s32 bgId; - return WaterBox_GetSurfaceImpl(globalCtx, colCtx, x, z, ySurface, outWaterBox, &bgId); + return WaterBox_GetSurfaceImpl(play, colCtx, x, z, ySurface, outWaterBox, &bgId); } #ifdef NON_MATCHING @@ -4457,7 +4454,7 @@ s32 WaterBox_GetSurface1_2(GlobalContext* globalCtx, CollisionContext* colCtx, f * 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 surfaceCheckDist, +s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist, WaterBox** outWaterBox, s32* bgId) { CollisionHeader* colHeader; s32 room; @@ -4477,7 +4474,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == globalCtx->roomCtx.currRoom.num || room == 0x3F)) { + if (!(room == play->roomCtx.currRoom.num || room == 0x3F)) { continue; } if ((waterBox->properties & 0x80000)) { @@ -4596,8 +4593,8 @@ 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_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, - WaterBox** outWaterBox, s32* bgId) { +s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, + s32* bgId) { CollisionHeader* colHeader; u32 room; WaterBox* curWaterBox; @@ -4614,7 +4611,7 @@ s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = WATERBOX_ROOM(curWaterBox->properties); - if (room == (u32)globalCtx->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { if ((curWaterBox->properties & 0x80000) != 0) { if (curWaterBox->minPos.x < x && x < curWaterBox->minPos.x + curWaterBox->xLength) { if (curWaterBox->minPos.z < z && z < curWaterBox->minPos.z + curWaterBox->zLength) { @@ -4656,11 +4653,10 @@ s32 func_800CA6F0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800CA6F0.s") #endif -s32 func_800CA9D0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, - WaterBox** outWaterBox) { +s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { s32 bgId; - return func_800CA6F0(globalCtx, colCtx, x, z, ySurface, outWaterBox, &bgId); + return func_800CA6F0(play, colCtx, x, z, ySurface, outWaterBox, &bgId); } /** diff --git a/src/code/z_cheap_proc.c b/src/code/z_cheap_proc.c index d0709fde96..2b4f67cae2 100644 --- a/src/code/z_cheap_proc.c +++ b/src/code/z_cheap_proc.c @@ -3,37 +3,37 @@ /** * Draws a display list to the opaque display buffer */ -void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) { +void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) { Gfx* dl; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); dl = POLY_OPA_DISP; gSPDisplayList(&dl[0], &sSetupDL[6 * 0x19]); - gSPMatrix(&dl[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&dl[2], dlist); POLY_OPA_DISP = &dl[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Draws a display list to the translucent display buffer */ -void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) { +void Gfx_DrawDListXlu(PlayState* play, Gfx* dlist) { Gfx* dl; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); dl = POLY_XLU_DISP; gSPDisplayList(&dl[0], &sSetupDL[6 * 0x19]); - gSPMatrix(&dl[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&dl[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&dl[2], dlist); POLY_XLU_DISP = &dl[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 7ac956e5da..01234f7fc5 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -90,7 +90,7 @@ s32 CollisionCheck_GetToucherDamage(Collider* at, ColliderInfo* atInfo, Collider return atInfo->toucher.damage; } -s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_InitBase(PlayState* play, Collider* collider) { static Collider defaultCollider = { NULL, NULL, NULL, NULL, AT_NONE, AC_NONE, OC1_NONE, OC2_NONE, COLTYPE_HIT3, COLSHAPE_MAX, }; @@ -99,14 +99,14 @@ s32 Collider_InitBase(GlobalContext* globalCtx, Collider* collider) { return 1; } -s32 Collider_DestroyBase(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_DestroyBase(PlayState* play, Collider* collider) { return 1; } /** * 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; @@ -119,7 +119,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; @@ -130,7 +130,7 @@ s32 Collider_SetBaseType1(GlobalContext* globalCtx, Collider* collider, Actor* a return 1; } -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; @@ -141,62 +141,62 @@ s32 Collider_SetBase(GlobalContext* globalCtx, Collider* collider, Actor* actor, return 1; } -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 defaultColliderTouch = { 0x00000000, 0, 0 }; *touch = defaultColliderTouch; return 1; } -s32 Collider_DestroyTouch(GlobalContext* globalCtx, ColliderTouch* touch) { +s32 Collider_DestroyTouch(PlayState* play, ColliderTouch* touch) { return 1; } -s32 Collider_SetTouch(GlobalContext* globalCtx, ColliderTouch* touch, ColliderTouchInit* src) { +s32 Collider_SetTouch(PlayState* play, ColliderTouch* touch, ColliderTouchInit* src) { touch->dmgFlags = src->dmgFlags; touch->effect = src->effect; touch->damage = src->damage; return 1; } -void Collider_ResetATInfoUnk(GlobalContext* globalCtx, ColliderInfo* info) { +void Collider_ResetATInfoUnk(PlayState* play, ColliderInfo* info) { } -s32 Collider_InitBump(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_InitBump(PlayState* play, ColliderBump* bump) { static ColliderBump defaultColliderBump = { 0xF7CFFFFF, 0, 0, { 0, 0, 0 } }; *bump = defaultColliderBump; return 1; } -s32 Collider_DestroyBump(GlobalContext* globalCtx, ColliderBump* bump) { +s32 Collider_DestroyBump(PlayState* play, ColliderBump* bump) { return 1; } -s32 Collider_SetBump(GlobalContext* globalCtx, ColliderBump* bump, ColliderBumpInit* src) { +s32 Collider_SetBump(PlayState* play, ColliderBump* bump, ColliderBumpInit* src) { bump->dmgFlags = src->dmgFlags; bump->effect = src->effect; bump->defense = src->defense; return 1; } -s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { +s32 Collider_InitInfo(PlayState* play, ColliderInfo* info) { static ColliderInfo defaultColliderInfo = { { 0, 0, 0 }, { 0xF7CFFFFF, 0, 0, { 0, 0, 0 } }, ELEMTYPE_UNK0, TOUCH_NONE, @@ -206,36 +206,36 @@ s32 Collider_InitInfo(GlobalContext* globalCtx, ColliderInfo* info) { }; *info = defaultColliderInfo; - Collider_InitTouch(globalCtx, &info->toucher); - Collider_InitBump(globalCtx, &info->bumper); + Collider_InitTouch(play, &info->toucher); + Collider_InitBump(play, &info->bumper); return 1; } -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 1; } -s32 Collider_SetInfo(GlobalContext* globalCtx, ColliderInfo* info, ColliderInfoInit* src) { +s32 Collider_SetInfo(PlayState* play, ColliderInfo* info, ColliderInfoInit* src) { info->elemType = src->elemType; - Collider_SetTouch(globalCtx, &info->toucher, &src->toucher); - Collider_SetBump(globalCtx, &info->bumper, &src->bumper); + Collider_SetTouch(play, &info->toucher, &src->toucher); + Collider_SetBump(play, &info->bumper, &src->bumper); info->toucherFlags = src->toucherFlags; info->bumperFlags = src->bumperFlags; info->ocElemFlags = src->ocElemFlags; return 1; } -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_ResetATInfoUnk(globalCtx, info); + Collider_ResetATInfoUnk(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; @@ -243,11 +243,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 defaultColliderJntSphElementDim = { { { 0, 0, 0 }, 0 }, { { 0, 0, 0 }, 0 }, @@ -259,56 +259,55 @@ s32 Collider_InitJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElemen return 1; } -s32 Collider_DestroyJntSphElementDim(GlobalContext* globalCtx, ColliderJntSphElementDim* dim) { +s32 Collider_DestroyJntSphElementDim(PlayState* play, ColliderJntSphElementDim* dim) { return 1; } -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 1; } -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 1; } -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 1; } -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 1; } -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 1; } -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 1; } -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 1; } /** * 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 1; @@ -317,12 +316,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; @@ -336,13 +335,13 @@ 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; @@ -353,11 +352,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. */ -s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* collider, ColliderJntSphInitToActor* src) { +s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* collider, ColliderJntSphInitToActor* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseToActor(globalCtx, &collider->base, &src->base); + Collider_SetBaseToActor(play, &collider->base, &src->base); collider->count = src->count; collider->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement)); @@ -368,8 +367,8 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* collider for (destElem = collider->elements, srcElem = src->elements; destElem < &collider->elements[collider->count]; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -378,12 +377,12 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* collider * Sets up the ColliderJntSph using the values in src and dynamically allocates the element array. Uses default * OC2_TYPE_1. */ -s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Actor* actor, +s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInitType1* src) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &sphereGroup->base, actor, &src->base); + Collider_SetBaseType1(play, &sphereGroup->base, actor, &src->base); sphereGroup->count = src->count; sphereGroup->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement)); @@ -394,8 +393,8 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* spher for (destElem = sphereGroup->elements, srcElem = src->elements; destElem < &sphereGroup->elements[sphereGroup->count]; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; } @@ -403,19 +402,19 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* spher /** * Sets up the ColliderJntSph using the values in src, placing the element array in elements. */ -s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, +s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, ColliderJntSphElement* elements) { ColliderJntSphElement* destElem; ColliderJntSphElementInit* srcElem; - Collider_SetBase(globalCtx, &sphereGroup->base, actor, &src->base); + Collider_SetBase(play, &sphereGroup->base, actor, &src->base); sphereGroup->count = src->count; sphereGroup->elements = elements; for (destElem = sphereGroup->elements, srcElem = src->elements; destElem < &sphereGroup->elements[sphereGroup->count]; destElem++, srcElem++) { - Collider_InitJntSphElement(globalCtx, destElem); - Collider_SetJntSphElement(globalCtx, destElem, srcElem); + Collider_InitJntSphElement(play, destElem); + Collider_SetJntSphElement(play, destElem, srcElem); } return 1; @@ -424,24 +423,24 @@ s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Ac /** * Fully initializes a ColliderJntSph using the values in `src`, placing the element array in elements. */ -s32 Collider_InitAndSetJntSph(GlobalContext* globalCtx, ColliderJntSph* sphereGroup, Actor* actor, - ColliderJntSphInit* src, ColliderJntSphElement* elements) { - Collider_InitJntSph(globalCtx, sphereGroup); - Collider_SetJntSph(globalCtx, sphereGroup, actor, src, elements); +s32 Collider_InitAndSetJntSph(PlayState* play, ColliderJntSph* sphereGroup, Actor* actor, ColliderJntSphInit* src, + ColliderJntSphElement* elements) { + Collider_InitJntSph(play, sphereGroup); + Collider_SetJntSph(play, sphereGroup, actor, src, elements); return 0; } /** * 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 1; } @@ -449,14 +448,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 1; } @@ -464,30 +463,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 1; } -s32 Collider_InitCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { +s32 Collider_InitCylinderDim(PlayState* play, Cylinder16* dim) { static Cylinder16 defaultColliderCylinderDim = { 0, 0, 0, { 0, 0, 0 } }; *dim = defaultColliderCylinderDim; return 1; } -s32 Collider_DestroyCylinderDim(GlobalContext* globalCtx, Cylinder16* dim) { +s32 Collider_DestroyCylinderDim(PlayState* play, Cylinder16* dim) { return 1; } -s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dim, Cylinder16* src) { +s32 Collider_SetCylinderDim(PlayState* play, Cylinder16* dim, Cylinder16* src) { *dim = *src; return 1; } @@ -495,20 +494,20 @@ s32 Collider_SetCylinderDim(GlobalContext* globalCtx, Cylinder16* dim, Cylinder1 /** * 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 1; } /** * 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 1; } @@ -516,80 +515,77 @@ 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. */ -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 1; } /** * 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 1; } /** * 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 1; } /** * Fully initializes a ColliderCylinder using the values in src. */ -s32 Collider_InitAndSetCylinder(GlobalContext* globalCtx, ColliderCylinder* collider, Actor* actor, - ColliderCylinderInit* src) { - Collider_InitCylinder(globalCtx, collider); - Collider_SetCylinder(globalCtx, collider, actor, src); +s32 Collider_InitAndSetCylinder(PlayState* play, ColliderCylinder* collider, Actor* actor, ColliderCylinderInit* src) { + Collider_InitCylinder(play, collider); + Collider_SetCylinder(play, collider, actor, src); return 1; } /** * 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 1; } /** * 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 1; } /** * 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 1; } -s32 Collider_InitTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { +s32 Collider_InitTrisElementDim(PlayState* play, TriNorm* dim) { static TriNorm defaultColliderTrisElementDim = { { { 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 }, @@ -599,11 +595,11 @@ s32 Collider_InitTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { return 1; } -s32 Collider_DestroyTrisElementDim(GlobalContext* globalCtx, TriNorm* dim) { +s32 Collider_DestroyTrisElementDim(PlayState* play, TriNorm* dim) { return 1; } -s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dim, ColliderTrisElementDimInit* src) { +s32 Collider_SetTrisElementDim(PlayState* play, TriNorm* dim, ColliderTrisElementDimInit* src) { Vec3f* destVtx; Vec3f* srcVtx; f32 nx; @@ -624,44 +620,44 @@ s32 Collider_SetTrisElementDim(GlobalContext* globalCtx, TriNorm* dim, ColliderT return 1; } -s32 Collider_InitTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element) { - Collider_InitInfo(globalCtx, &element->info); - Collider_InitTrisElementDim(globalCtx, &element->dim); +s32 Collider_InitTrisElement(PlayState* play, ColliderTrisElement* element) { + Collider_InitInfo(play, &element->info); + Collider_InitTrisElementDim(play, &element->dim); return 1; } -s32 Collider_DestroyTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element) { - Collider_DestroyInfo(globalCtx, &element->info); - Collider_DestroyTrisElementDim(globalCtx, &element->dim); +s32 Collider_DestroyTrisElement(PlayState* play, ColliderTrisElement* element) { + Collider_DestroyInfo(play, &element->info); + Collider_DestroyTrisElementDim(play, &element->dim); return 1; } -s32 Collider_SetTrisElement(GlobalContext* globalCtx, ColliderTrisElement* element, ColliderTrisElementInit* src) { - Collider_SetInfo(globalCtx, &element->info, &src->info); - Collider_SetTrisElementDim(globalCtx, &element->dim, &src->dim); +s32 Collider_SetTrisElement(PlayState* play, ColliderTrisElement* element, ColliderTrisElementInit* src) { + Collider_SetInfo(play, &element->info, &src->info); + Collider_SetTrisElementDim(play, &element->dim, &src->dim); return 1; } -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 1; } -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 1; } -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 1; } /** * 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 = NULL; return 1; @@ -670,13 +666,13 @@ s32 Collider_InitTris(GlobalContext* globalCtx, ColliderTris* tris) { /** * Destroys a dynamically allocated ColliderTris */ -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; @@ -691,13 +687,13 @@ 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; tris->elements = NULL; @@ -708,11 +704,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. */ -s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* tris, Actor* actor, ColliderTrisInitType1* src) { +s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* tris, Actor* actor, ColliderTrisInitType1* src) { ColliderTrisElement* element; ColliderTrisElementInit* srcElem; - Collider_SetBaseType1(globalCtx, &tris->base, actor, &src->base); + Collider_SetBaseType1(play, &tris->base, actor, &src->base); tris->count = src->count; tris->elements = ZeldaArena_Malloc(tris->count * sizeof(ColliderTrisElement)); @@ -723,8 +719,8 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* tris, Act for (element = tris->elements, srcElem = src->elements; element < &tris->elements[tris->count]; element++, srcElem++) { - Collider_InitTrisElement(globalCtx, element); - Collider_SetTrisElement(globalCtx, element, srcElem); + Collider_InitTrisElement(play, element); + Collider_SetTrisElement(play, element, srcElem); } return 1; @@ -733,19 +729,19 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* tris, Act /** * Sets up the ColliderTris using the values in src, placing the element array in elements. */ -s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* triGroup, Actor* actor, ColliderTrisInit* src, +s32 Collider_SetTris(PlayState* play, ColliderTris* triGroup, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* tris) { ColliderTrisElement* element; ColliderTrisElementInit* srcElem; - Collider_SetBase(globalCtx, &triGroup->base, actor, &src->base); + Collider_SetBase(play, &triGroup->base, actor, &src->base); triGroup->count = src->count; triGroup->elements = tris; for (element = triGroup->elements, srcElem = src->elements; element < &triGroup->elements[triGroup->count]; element++, srcElem++) { - Collider_InitTrisElement(globalCtx, element); - Collider_SetTrisElement(globalCtx, element, srcElem); + Collider_InitTrisElement(play, element); + Collider_SetTrisElement(play, element, srcElem); } return 1; @@ -754,24 +750,24 @@ s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* triGroup, Actor* ac /** * Fully initializes a ColliderTris using the values in src, placing the element array in elements. */ -s32 Collider_InitAndSetTris(GlobalContext* globalCtx, ColliderTris* tris, Actor* actor, ColliderTrisInit* src, +s32 Collider_InitAndSetTris(PlayState* play, ColliderTris* tris, Actor* actor, ColliderTrisInit* src, ColliderTrisElement* elements) { - Collider_InitTris(globalCtx, tris); - Collider_SetTris(globalCtx, tris, actor, src, elements); + Collider_InitTris(play, tris); + Collider_SetTris(play, tris, actor, src, elements); return 0; } /** * 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 1; } @@ -779,14 +775,14 @@ 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 1; } @@ -794,19 +790,19 @@ 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 1; } -s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_InitQuadDim(PlayState* play, ColliderQuadDim* dim) { static ColliderQuadDim defaultColliderQuadDim = { { { 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 }, @@ -818,11 +814,11 @@ s32 Collider_InitQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { return 1; } -s32 Collider_DestroyQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_DestroyQuadDim(PlayState* play, ColliderQuadDim* dim) { return 1; } -s32 Collider_ResetQuadACDist(GlobalContext* globalCtx, ColliderQuadDim* dim) { +s32 Collider_ResetQuadACDist(PlayState* play, ColliderQuadDim* dim) { dim->acDist = 1.0E38f; return 1; } @@ -836,7 +832,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* dim, ColliderQuadDimInit* init) { +s32 Collider_SetQuadDim(PlayState* play, ColliderQuadDim* dim, ColliderQuadDimInit* init) { dim->quad[0] = init->quad[0]; dim->quad[1] = init->quad[1]; dim->quad[2] = init->quad[2]; @@ -849,83 +845,83 @@ s32 Collider_SetQuadDim(GlobalContext* globalCtx, ColliderQuadDim* dim, Collider /** * 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 1; } /** * 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 1; } /** * 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 1; } /** * 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 1; } /** * Fully initializes a ColliderQuad using the values in src. */ -s32 Collider_InitAndSetQuad(GlobalContext* globalCtx, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src) { - Collider_InitQuad(globalCtx, collider); - Collider_SetQuad(globalCtx, collider, actor, src); +s32 Collider_InitAndSetQuad(PlayState* play, ColliderQuad* collider, Actor* actor, ColliderQuadInit* src) { + Collider_InitQuad(play, collider); + Collider_SetQuad(play, collider, actor, src); return 0; } /** * 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 1; } /** * 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 1; } /** * 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 1; } @@ -933,7 +929,7 @@ s32 Collider_ResetQuadOC(GlobalContext* globalCtx, Collider* collider) { * For quad colliders with TOUCH_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 acDist; Vec3f dcMid; @@ -947,10 +943,10 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 quad->dim.acDist = acDist; 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 1; } else { @@ -961,80 +957,79 @@ s32 Collider_QuadSetNearestAC(GlobalContext* globalCtx, ColliderQuad* quad, Vec3 /** * Initializes a ColliderSphere to default values. */ -s32 Collider_InitSphere(GlobalContext* globalCtx, ColliderSphere* collider) { - Collider_InitBase(globalCtx, &collider->base); - Collider_InitInfo(globalCtx, &collider->info); - Collider_InitJntSphElementDim(globalCtx, &collider->dim); +s32 Collider_InitSphere(PlayState* play, ColliderSphere* collider) { + Collider_InitBase(play, &collider->base); + Collider_InitInfo(play, &collider->info); + Collider_InitJntSphElementDim(play, &collider->dim); return 1; } /** * Destroys a ColliderSphere. */ -s32 Collider_DestroySphere(GlobalContext* globalCtx, ColliderSphere* collider) { - Collider_DestroyBase(globalCtx, &collider->base); - Collider_DestroyInfo(globalCtx, &collider->info); - Collider_DestroyJntSphElementDim(globalCtx, &collider->dim); +s32 Collider_DestroySphere(PlayState* play, ColliderSphere* collider) { + Collider_DestroyBase(play, &collider->base); + Collider_DestroyInfo(play, &collider->info); + Collider_DestroyJntSphElementDim(play, &collider->dim); return 1; } /** * Sets up the ColliderSphere using the values in src. */ -s32 Collider_SetSphere(GlobalContext* globalCtx, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src) { - Collider_SetBase(globalCtx, &collider->base, actor, &src->base); - Collider_SetInfo(globalCtx, &collider->info, &src->info); - Collider_SetJntSphElementDim(globalCtx, &collider->dim, &src->dim); +s32 Collider_SetSphere(PlayState* play, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src) { + Collider_SetBase(play, &collider->base, actor, &src->base); + Collider_SetInfo(play, &collider->info, &src->info); + Collider_SetJntSphElementDim(play, &collider->dim, &src->dim); return 1; } /** * Fully initializes a ColliderSphere using the values in src. */ -s32 Collider_InitAndSetSphere(GlobalContext* globalCtx, ColliderSphere* collider, Actor* actor, - ColliderSphereInit* src) { - Collider_InitSphere(globalCtx, collider); - Collider_SetSphere(globalCtx, collider, actor, src); +s32 Collider_InitAndSetSphere(PlayState* play, ColliderSphere* collider, Actor* actor, ColliderSphereInit* src) { + Collider_InitSphere(play, collider); + Collider_SetSphere(play, collider, actor, src); return 0; } /** * Resets the collider's AT collision flags. */ -s32 Collider_ResetSphereAT(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetSphereAT(PlayState* play, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; - Collider_ResetATBase(globalCtx, &sphere->base); - Collider_ResetATInfo(globalCtx, &sphere->info); + Collider_ResetATBase(play, &sphere->base); + Collider_ResetATInfo(play, &sphere->info); return 1; } /** * Resets the collider's AC collision flags. */ -s32 Collider_ResetSphereAC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetSphereAC(PlayState* play, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; - Collider_ResetACBase(globalCtx, &sphere->base); - Collider_ResetACInfo(globalCtx, &sphere->info); + Collider_ResetACBase(play, &sphere->base); + Collider_ResetACInfo(play, &sphere->info); return 1; } /** * Resets the collider's OC collision flags. */ -s32 Collider_ResetSphereOC(GlobalContext* globalCtx, Collider* collider) { +s32 Collider_ResetSphereOC(PlayState* play, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; - Collider_ResetOCBase(globalCtx, &sphere->base); - Collider_ResetOCInfo(globalCtx, &sphere->info); + Collider_ResetOCBase(play, &sphere->base); + Collider_ResetOCInfo(play, &sphere->info); return 1; } /** * Initializes an OcLine to default values */ -s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_InitLine(PlayState* play, OcLine* line) { static Vec3f defaultLinePoint = { 0.0f, 0.0f, 0.0f }; Math_Vec3f_Copy(&line->line.a, &defaultLinePoint); @@ -1045,14 +1040,14 @@ s32 Collider_InitLine(GlobalContext* globalCtx, OcLine* line) { /** * Destroys an OcLine */ -s32 Collider_DestroyLine(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_DestroyLine(PlayState* play, OcLine* line) { return 1; } /** * Sets up an OcLine with endpoints a and b. */ -s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* line, Vec3f* a, Vec3f* b) { +s32 Collider_SetLinePoints(PlayState* play, OcLine* line, Vec3f* a, Vec3f* b) { Math_Vec3f_Copy(&line->line.a, a); Math_Vec3f_Copy(&line->line.b, b); return 1; @@ -1061,16 +1056,16 @@ s32 Collider_SetLinePoints(GlobalContext* globalCtx, OcLine* line, Vec3f* a, Vec /** * Sets up an OcLine using the values in src. */ -s32 Collider_SetLine(GlobalContext* globalCtx, OcLine* line, OcLine* src) { +s32 Collider_SetLine(PlayState* play, OcLine* line, OcLine* src) { line->ocFlags = src->ocFlags; - Collider_SetLinePoints(globalCtx, line, &src->line.a, &src->line.b); + Collider_SetLinePoints(play, line, &src->line.a, &src->line.b); return 1; } /** * Resets the OcLine's collision flags. */ -s32 Collider_ResetLineOC(GlobalContext* globalCtx, OcLine* line) { +s32 Collider_ResetLineOC(PlayState* play, OcLine* line) { line->ocFlags &= ~OCLINE_HIT; return 1; } @@ -1079,18 +1074,18 @@ 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* colCtxt) { +void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colCtxt) { colCtxt->sacFlags = 0; - CollisionCheck_ClearContext(globalCtx, colCtxt); + CollisionCheck_ClearContext(play, colCtxt); } -void CollisionCheck_DestroyContext(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) { +void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colCtxt) { } /** * Clears all collider lists in CollisionCheckContext when not in SAC mode. */ -void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) { +void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colCtxt) { Collider** col; OcLine** line; @@ -1123,14 +1118,14 @@ void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext /** * Enables SAC, an alternate collision check mode that allows direct management of collider lists. */ -void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) { +void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colCtxt) { colCtxt->sacFlags |= SAC_ON; } /** * Disables SAC, an alternate collision check mode that allows direct management of collider lists. */ -void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) { +void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colCtxt) { colCtxt->sacFlags &= ~SAC_ON; } @@ -1142,13 +1137,13 @@ ColChkResetFunc sATResetFuncs[] = { /** * Sets collider as an AT (attack) for the current frame, which will be checked against ACs (attack colliders) */ -s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(&globalCtx->state)) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1170,11 +1165,11 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colCtx * 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* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(&globalCtx->state)) { +s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sATResetFuncs[collider->shape](globalCtx, collider); + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1202,13 +1197,13 @@ ColChkResetFunc sACResetFuncs[] = { /** * Sets collider as an AC (attack collider) for the current frame, allowing it to detect ATs (attacks) */ -s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(&globalCtx->state)) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1230,11 +1225,11 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colCtx * 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* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(&globalCtx->state)) { +s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sACResetFuncs[collider->shape](globalCtx, collider); + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1262,13 +1257,13 @@ ColChkResetFunc sOCResetFuncs[] = { /** * Sets collider as an OC (object collider) for the current frame, allowing it to detect other OCs. */ -s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(&globalCtx->state)) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1290,11 +1285,11 @@ s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colCtx * 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* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(&globalCtx->state)) { +s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - sOCResetFuncs[collider->shape](globalCtx, collider); + sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1320,14 +1315,14 @@ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* co /** * Sets a line as an OC collider for this frame. */ -s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, OcLine* line) { +s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colCtxt, OcLine* line) { s32 index; - if (FrameAdvance_IsEnabled(&globalCtx->state)) { + if (FrameAdvance_IsEnabled(&play->state)) { return -1; } - Collider_ResetLineOC(globalCtx, line); + Collider_ResetLineOC(play, line); if (colCtxt->colLineCount >= ARRAY_COUNT(colCtxt->colLine)) { return -1; @@ -1372,7 +1367,7 @@ s32 CollisionCheck_NoSharedFlags(ColliderInfo* toucher, ColliderInfo* bumper) { * 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) { } /** @@ -1381,7 +1376,7 @@ void CollisionCheck_NoBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* */ #ifdef NON_MATCHING // needs in-function static bss -void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_BlueBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit D_801EEC00; s32 effectIndex; @@ -1427,7 +1422,7 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 D_801EEC00.speed = 8.0f; D_801EEC00.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EEC00); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EEC00); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_BlueBlood.s") @@ -1439,7 +1434,7 @@ void CollisionCheck_BlueBlood(GlobalContext* globalCtx, Collider* collider, Vec3 */ #ifdef NON_MATCHING // needs in-function static bss -void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { +void CollisionCheck_GreenBlood(PlayState* play, Collider* collider, Vec3f* v) { static EffectSparkInit D_801EF0C8; s32 effectIndex; @@ -1484,7 +1479,7 @@ void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec D_801EF0C8.duration = 16; D_801EF0C8.speed = 8.0f; D_801EF0C8.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EF0C8); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EF0C8); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_GreenBlood.s") @@ -1494,55 +1489,55 @@ void CollisionCheck_GreenBlood(GlobalContext* globalCtx, Collider* collider, Vec * Spawns a burst of water. * Used by collider type HIT4. */ -void CollisionCheck_WaterBurst(GlobalContext* globalCtx, Collider* collider, Vec3f* v) { - EffectSsSibuki_SpawnBurst(globalCtx, v); - CollisionCheck_SpawnWaterDroplets(globalCtx, v); +void CollisionCheck_WaterBurst(PlayState* play, Collider* collider, Vec3f* v) { + EffectSsSibuki_SpawnBurst(play, v); + CollisionCheck_SpawnWaterDroplets(play, v); } /** * Spawns red blood drops. * Used by collider type HIT7. */ -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. */ -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, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(play, 0, hitPos); if (collider->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { Audio_PlaySfxAtPos(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); } } else if (flags == TOUCH_SFX_NORMAL) { - EffectSsHitMark_SpawnFixedScale(globalCtx, 3, hitPos); + EffectSsHitMark_SpawnFixedScale(play, 3, 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, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(play, 0, hitPos); if (collider->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { Audio_PlaySfxAtPos(&collider->actor->projectedPos, NA_SE_IT_SHIELD_BOUND); } } else if (flags == TOUCH_SFX_WOOD) { - EffectSsHitMark_SpawnFixedScale(globalCtx, 1, hitPos); + EffectSsHitMark_SpawnFixedScale(play, 1, hitPos); if (collider->actor == NULL) { play_sound(NA_SE_IT_REFLECTION_WOOD); } else { @@ -1584,8 +1579,8 @@ 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; } @@ -1595,26 +1590,26 @@ void CollisionCheck_HitEffects(GlobalContext* globalCtx, Collider* at, ColliderI } 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); play_sound(NA_SE_IT_REFLECTION_WOOD); } 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, 0, hitPos); + EffectSsHitMark_SpawnFixedScale(play, 0, hitPos); if (ac->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); } else { @@ -1634,7 +1629,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) { f32 damage; u32 effect; @@ -1684,7 +1679,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 1; @@ -1707,7 +1702,7 @@ void CollisionCheck_QuadAvgPoint(ColliderQuad* quad, Vec3f* avg) { /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, +void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atElem; @@ -1748,8 +1743,8 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -1763,8 +1758,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* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atElem; ColliderCylinder* ac = (ColliderCylinder*)colAC; @@ -1803,8 +1797,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } } @@ -1814,8 +1807,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_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_JntSphVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderJntSphElement* atElem; ColliderTris* ac = (ColliderTris*)colAC; @@ -1840,8 +1832,8 @@ void CollisionCheck_AC_JntSphVsTris(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&atPos, &atElem->dim.worldSphere.center); CollisionCheck_TrisAvgPoint(acElem, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); return; } } @@ -1852,8 +1844,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_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_JntSphVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderQuad* ac = (ColliderQuad*)colAC; Vec3f hitPos; @@ -1880,7 +1871,7 @@ void CollisionCheck_AC_JntSphVsQuad(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&atPos, &sphElem->dim.worldSphere.center); CollisionCheck_QuadAvgPoint(ac, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &sphElem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &sphElem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); return; } @@ -1891,7 +1882,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_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, +void CollisionCheck_AC_JntSphVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSph* at = (ColliderJntSph*)colAT; ColliderSphere* ac = (ColliderSphere*)colAC; @@ -1927,7 +1918,7 @@ void CollisionCheck_AC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckCo } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &sphElem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &sphElem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); } } @@ -1937,8 +1928,7 @@ void CollisionCheck_AC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckCo /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderJntSph* ac = (ColliderJntSph*)colAC; f32 overlapSize; @@ -1977,7 +1967,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &sphElem->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &sphElem->info, &acPos, &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { break; @@ -1990,8 +1980,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_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; f32 overlapSize; @@ -2035,7 +2024,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); } } } @@ -2043,8 +2032,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* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; @@ -2069,8 +2057,7 @@ void CollisionCheck_AC_CylVsTris(GlobalContext* globalCtx, CollisionCheckContext Math_Vec3s_ToVec3f(&atPos, &at->dim.pos); CollisionCheck_TrisAvgPoint(acElem, &acPos); - 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; } } @@ -2080,8 +2067,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_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderQuad* ac = (ColliderQuad*)colAC; @@ -2104,16 +2090,14 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext Math_Vec3s_ToVec3f(&atPos, &at->dim.pos); CollisionCheck_QuadAvgPoint(ac, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &D_801EDE00); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDE00); } else if (Math3D_ColCylinderTri(&at->dim, &D_801EF638, &D_801EDE00) != 0) { Vec3f atPos; Vec3f acPos; Math_Vec3s_ToVec3f(&atPos, &at->dim.pos); CollisionCheck_QuadAvgPoint(ac, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &D_801EDE00); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDE00); } } } @@ -2121,8 +2105,7 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_CylVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderSphere* ac = (ColliderSphere*)colAC; f32 overlapSize; @@ -2160,7 +2143,7 @@ void CollisionCheck_AC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckConte } else { Math_Vec3f_Copy(&hitPos, &atPos); } - 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); } } } @@ -2168,8 +2151,7 @@ void CollisionCheck_AC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckConte /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderJntSphElement* acElem; ColliderJntSph* ac = (ColliderJntSph*)colAC; @@ -2194,8 +2176,8 @@ void CollisionCheck_AC_TrisVsJntSph(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&acPos, &acElem->dim.worldSphere.center); CollisionCheck_TrisAvgPoint(atElem, &atPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, - &acPos, &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, &acPos, + &hitPos); if (!(ac->base.ocFlags2 & OC2_FIRST_ONLY)) { return; @@ -2209,8 +2191,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_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; ColliderTrisElement* atElem; @@ -2232,7 +2213,7 @@ void CollisionCheck_AC_TrisVsCyl(GlobalContext* globalCtx, CollisionCheckContext CollisionCheck_TrisAvgPoint(atElem, &atPos); Math_Vec3s_ToVec3f(&acPos, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDE10); return; } @@ -2243,8 +2224,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_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atElem; ColliderTris* ac = (ColliderTris*)colAC; @@ -2268,8 +2248,8 @@ void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContex CollisionCheck_TrisAvgPoint(atElem, &atPos); CollisionCheck_TrisAvgPoint(acElem, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, - &acPos, &D_801EDE20); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &acElem->info, &acPos, + &D_801EDE20); return; } } @@ -2280,8 +2260,7 @@ void CollisionCheck_AC_TrisVsTris(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderQuad* ac = (ColliderQuad*)colAC; ColliderTrisElement* atElem; @@ -2308,7 +2287,7 @@ void CollisionCheck_AC_TrisVsQuad(GlobalContext* globalCtx, CollisionCheckContex CollisionCheck_TrisAvgPoint(atElem, &atPos); CollisionCheck_QuadAvgPoint(ac, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDE30); return; } @@ -2319,8 +2298,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_TrisVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_TrisVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderTris* at = (ColliderTris*)colAT; ColliderTrisElement* atElem; ColliderSphere* ac = (ColliderSphere*)colAC; @@ -2343,8 +2321,7 @@ void CollisionCheck_AC_TrisVsSphere(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&acPos, &ac->dim.worldSphere.center); CollisionCheck_TrisAvgPoint(atElem, &atPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, - &hitPos); + CollisionCheck_SetATvsAC(play, &at->base, &atElem->info, &atPos, &ac->base, &ac->info, &acPos, &hitPos); } } } @@ -2353,8 +2330,7 @@ void CollisionCheck_AC_TrisVsSphere(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* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderJntSphElement* acElem; Vec3f hitPos; ColliderQuad* at = (ColliderQuad*)colAT; @@ -2379,13 +2355,12 @@ void CollisionCheck_AC_QuadVsJntSph(GlobalContext* globalCtx, CollisionCheckCont Vec3f atPos; Vec3f acPos; - if (!Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (!Collider_QuadSetNearestAC(play, at, &hitPos)) { continue; } Math_Vec3s_ToVec3f(&acPos, &acElem->dim.worldSphere.center); CollisionCheck_QuadAvgPoint(at, &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; @@ -2398,8 +2373,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_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderQuad* at = (ColliderQuad*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; @@ -2418,26 +2392,24 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext Math3D_TriSetCoords(&D_801EDF90, &at->dim.quad[2], &at->dim.quad[1], &at->dim.quad[0]); if (Math3D_ColCylinderTri(&ac->dim, &D_801EDF58, &D_801EDFE0) != 0) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_801EDFE0)) { + if (Collider_QuadSetNearestAC(play, at, &D_801EDFE0)) { Vec3f atPos; Vec3f acPos; CollisionCheck_QuadAvgPoint(at, &atPos); Math_Vec3s_ToVec3f(&acPos, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &D_801EDFE0); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDFE0); return; } } if (Math3D_ColCylinderTri(&ac->dim, &D_801EDF90, &D_801EDFE0) != 0) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_801EDFE0)) { + if (Collider_QuadSetNearestAC(play, at, &D_801EDFE0)) { Vec3f atPos; Vec3f acPos; CollisionCheck_QuadAvgPoint(at, &atPos); Math_Vec3s_ToVec3f(&acPos, &ac->dim.pos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &D_801EDFE0); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EDFE0); } } } @@ -2446,8 +2418,7 @@ void CollisionCheck_AC_QuadVsCyl(GlobalContext* globalCtx, CollisionCheckContext /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderQuad* at = (ColliderQuad*)colAT; ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; @@ -2470,13 +2441,13 @@ void CollisionCheck_AC_QuadVsTris(GlobalContext* globalCtx, CollisionCheckContex if ((Math3d_ColTriTri(&D_801EE000, &acElem->dim, &D_801EDFF0) != 0) || (Math3d_ColTriTri(&D_801EE038, &acElem->dim, &D_801EDFF0) != 0)) { - if (Collider_QuadSetNearestAC(globalCtx, at, &D_801EDFF0)) { + if (Collider_QuadSetNearestAC(play, at, &D_801EDFF0)) { Vec3f atPos; Vec3f acPos; CollisionCheck_TrisAvgPoint(acElem, &acPos); CollisionCheck_QuadAvgPoint(at, &atPos); - 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, &D_801EDFF0); return; } @@ -2488,8 +2459,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* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderQuad* at = (ColliderQuad*)colAT; ColliderQuad* ac = (ColliderQuad*)colAC; s32 i; @@ -2513,14 +2483,13 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if (Math3d_ColTriTri(&D_801EE0E8[j], &D_801EE070[i], &D_801EE0D8) != 0 && - Collider_QuadSetNearestAC(globalCtx, at, &D_801EE0D8) != 0) { + Collider_QuadSetNearestAC(play, at, &D_801EE0D8) != 0) { Vec3f atPos; Vec3f acPos; CollisionCheck_QuadAvgPoint(at, &atPos); CollisionCheck_QuadAvgPoint(ac, &acPos); - CollisionCheck_SetATvsAC(globalCtx, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, - &D_801EE0D8); + CollisionCheck_SetATvsAC(play, &at->base, &at->info, &atPos, &ac->base, &ac->info, &acPos, &D_801EE0D8); return; } } @@ -2530,8 +2499,7 @@ void CollisionCheck_AC_QuadVsQuad(GlobalContext* globalCtx, CollisionCheckContex /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_QuadVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_QuadVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderQuad* at = (ColliderQuad*)colAT; Vec3f hitPos; ColliderSphere* ac = (ColliderSphere*)colAC; @@ -2548,13 +2516,13 @@ void CollisionCheck_AC_QuadVsSphere(GlobalContext* globalCtx, CollisionCheckCont if ((Math3D_ColSphereTri(&ac->dim.worldSphere, &D_801EE150, &hitPos) != 0) || (Math3D_ColSphereTri(&ac->dim.worldSphere, &D_801EE188, &hitPos) != 0)) { - if (Collider_QuadSetNearestAC(globalCtx, at, &hitPos)) { + if (Collider_QuadSetNearestAC(play, at, &hitPos)) { Vec3f atPos; Vec3f acPos; Math_Vec3s_ToVec3f(&acPos, &ac->dim.worldSphere.center); CollisionCheck_QuadAvgPoint(at, &atPos); - 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); } } } @@ -2562,7 +2530,7 @@ void CollisionCheck_AC_QuadVsSphere(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, +void CollisionCheck_AC_SphereVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderSphere* at = (ColliderSphere*)colAT; ColliderJntSph* ac = (ColliderJntSph*)colAC; @@ -2600,8 +2568,7 @@ void CollisionCheck_AC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckCo } 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); } } } @@ -2610,7 +2577,7 @@ void CollisionCheck_AC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_SphereVsCylinder(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, +void CollisionCheck_AC_SphereVsCylinder(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderCylinder* ac = (ColliderCylinder*)colAC; ColliderSphere* at = (ColliderSphere*)colAT; @@ -2648,7 +2615,7 @@ void CollisionCheck_AC_SphereVsCylinder(GlobalContext* globalCtx, CollisionCheck } else { Math_Vec3f_Copy(&hitPos, &atPos); } - 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); } if (at) {} @@ -2657,8 +2624,7 @@ void CollisionCheck_AC_SphereVsCylinder(GlobalContext* globalCtx, CollisionCheck /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_SphereVsTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_SphereVsTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderSphere* at = (ColliderSphere*)colAT; ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; @@ -2681,8 +2647,7 @@ void CollisionCheck_AC_SphereVsTris(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&atPos, &at->dim.worldSphere.center); CollisionCheck_TrisAvgPoint(acElem, &acPos); - 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; } } @@ -2691,8 +2656,7 @@ void CollisionCheck_AC_SphereVsTris(GlobalContext* globalCtx, CollisionCheckCont /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_SphereVsQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, - Collider* colAC) { +void CollisionCheck_AC_SphereVsQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderSphere* at = (ColliderSphere*)colAT; Vec3f hitPos; ColliderQuad* ac = (ColliderQuad*)colAC; @@ -2714,14 +2678,14 @@ void CollisionCheck_AC_SphereVsQuad(GlobalContext* globalCtx, CollisionCheckCont Math_Vec3s_ToVec3f(&atPos, &at->dim.worldSphere.center); CollisionCheck_QuadAvgPoint(ac, &acPos); - 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); } } /** * AC overlap check. Calculates the center of each collider element and the point of contact. */ -void CollisionCheck_AC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT, +void CollisionCheck_AC_SphereVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT, Collider* colAC) { ColliderSphere* at = (ColliderSphere*)colAT; ColliderSphere* ac = (ColliderSphere*)colAC; @@ -2755,14 +2719,14 @@ void CollisionCheck_AC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckCo } else { Math_Vec3f_Copy(&hitPos, &atPos); } - 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); } } /** * Sets a ColliderJntSph's hit effects */ -void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; ColliderJntSphElement* element; @@ -2772,8 +2736,8 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte Vec3f hitPos; 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; } @@ -2783,7 +2747,7 @@ void CollisionCheck_SetJntSphHitFX(GlobalContext* globalCtx, CollisionCheckConte /** * Sets a ColliderCylinder's hit effects */ -void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; if ((cylinder->info.bumperFlags & BUMP_DRAW_HITMARK) && cylinder->info.acHitInfo != NULL && @@ -2791,7 +2755,7 @@ void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* Vec3f hitPos; 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; } @@ -2800,7 +2764,7 @@ void CollisionCheck_SetCylHitFX(GlobalContext* globalCtx, CollisionCheckContext* /** * Sets a ColliderTris's hit effects */ -void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; ColliderTrisElement* element; @@ -2810,8 +2774,8 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext Vec3f hitPos; 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; } @@ -2821,7 +2785,7 @@ void CollisionCheck_SetTrisHitFX(GlobalContext* globalCtx, CollisionCheckContext /** * Sets a ColliderQuad's hit effects */ -void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; if ((quad->info.bumperFlags & BUMP_DRAW_HITMARK) && quad->info.acHitInfo != NULL && @@ -2829,7 +2793,7 @@ void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext Vec3f hitPos; 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; } } @@ -2837,7 +2801,7 @@ void CollisionCheck_SetQuadHitFX(GlobalContext* globalCtx, CollisionCheckContext /** * Sets a ColliderSphere's hit effects */ -void CollisionCheck_SetSphereHitFX(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_SetSphereHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; if ((sphere->info.bumperFlags & BUMP_DRAW_HITMARK) && sphere->info.acHitInfo != NULL && @@ -2845,7 +2809,7 @@ void CollisionCheck_SetSphereHitFX(GlobalContext* globalCtx, CollisionCheckConte Vec3f hitPos; Math_Vec3s_ToVec3f(&hitPos, &sphere->info.bumper.hitPos); - CollisionCheck_HitEffects(globalCtx, sphere->info.acHit, sphere->info.acHitInfo, &sphere->base, &sphere->info, + CollisionCheck_HitEffects(play, sphere->info.acHit, sphere->info.acHitInfo, &sphere->base, &sphere->info, &hitPos); sphere->info.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK; } @@ -2859,7 +2823,7 @@ 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* colCtxt) { +void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colCtxt) { Collider** col; for (col = &colCtxt->colAC[0]; col < &colCtxt->colAC[colCtxt->colACCount]; col++) { @@ -2869,7 +2833,7 @@ void CollisionCheck_SetHitEffects(GlobalContext* globalCtx, CollisionCheckContex if (colAC->actor != NULL && colAC->actor->update == NULL) { continue; } - sColChkApplyFuncs[colAC->shape](globalCtx, colCtxt, colAC); + sColChkApplyFuncs[colAC->shape](play, colCtxt, colAC); } } } @@ -2890,7 +2854,7 @@ ColChkVsFunc sACVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX] = { /** * Iterates through all AC colliders, performing AC collisions with the AT collider. */ -void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* colAT) { +void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colCtxt, Collider* colAT) { Collider** col; for (col = &colCtxt->colAC[0]; col < &colCtxt->colAC[colCtxt->colACCount]; col++) { @@ -2904,7 +2868,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, if (!(colAT->atFlags & AT_SELF) && colAT->actor != NULL && colAC->actor == colAT->actor) { continue; } - sACVsFuncs[colAT->shape][colAC->shape](globalCtx, colCtxt, colAT, colAC); + sACVsFuncs[colAT->shape][colAC->shape](play, colCtxt, colAT, colAC); } } } @@ -2916,7 +2880,7 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, * 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* colCtxt) { +void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colCtxt) { Collider** col; if (colCtxt->colATCount == 0 || colCtxt->colACCount == 0) { @@ -2930,11 +2894,11 @@ void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) if (colAC->actor != NULL && colAC->actor->update == NULL) { continue; } - CollisionCheck_AC(globalCtx, colCtxt, colAC); + CollisionCheck_AC(play, colCtxt, colAC); } } - CollisionCheck_SetHitEffects(globalCtx, colCtxt); + CollisionCheck_SetHitEffects(play, colCtxt); } /** @@ -2955,8 +2919,8 @@ s32 CollisionCheck_GetMassType(u8 mass) { * Sets OC collision flags for OC collider overlaps. If both colliders are attached to actors and can push, * also performs an elastic collision where both colliders are moved apart in proportion to their masses. */ -void CollisionCheck_SetOCvsOC(GlobalContext* globalCtx, Collider* left, ColliderInfo* leftInfo, Vec3f* leftPos, - Collider* right, ColliderInfo* rightInfo, Vec3f* rightPos, f32 overlap) { +void CollisionCheck_SetOCvsOC(PlayState* play, Collider* left, ColliderInfo* leftInfo, Vec3f* leftPos, Collider* right, + ColliderInfo* rightInfo, Vec3f* rightPos, f32 overlap) { f32 pad; f32 leftDispRatio; f32 rightDispRatio; @@ -3053,8 +3017,7 @@ void CollisionCheck_SetOCvsOC(GlobalContext* globalCtx, Collider* left, Collider /** * OC overlap check for two JntSphs */ -void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, - Collider* r) { +void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderJntSph* right = (ColliderJntSph*)r; ColliderJntSphElement* leftElem; @@ -3079,7 +3042,7 @@ void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo Math_Vec3s_ToVec3f(&leftPos, &leftElem->dim.worldSphere.center); Math_Vec3s_ToVec3f(&rightPos, &rightElem->dim.worldSphere.center); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &leftElem->info, &leftPos, &right->base, + CollisionCheck_SetOCvsOC(play, &left->base, &leftElem->info, &leftPos, &right->base, &rightElem->info, &rightPos, overlap); } } @@ -3090,7 +3053,7 @@ void CollisionCheck_OC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * OC overlap check for a JntSph and Cylinder */ -void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { +void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderCylinder* right = (ColliderCylinder*)r; ColliderJntSphElement* leftElem; @@ -3109,7 +3072,7 @@ void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte Math_Vec3s_ToVec3f(&leftPos, &leftElem->dim.worldSphere.center); Math_Vec3s_ToVec3f(&rightPos, &right->dim.pos); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &leftElem->info, &leftPos, &right->base, &right->info, + CollisionCheck_SetOCvsOC(play, &left->base, &leftElem->info, &leftPos, &right->base, &right->info, &rightPos, overlap); } } @@ -3119,8 +3082,7 @@ void CollisionCheck_OC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte /** * OC overlap check for a JntSph and Sphere */ -void CollisionCheck_OC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, - Collider* r) { +void CollisionCheck_OC_JntSphVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderJntSph* left = (ColliderJntSph*)l; ColliderSphere* right = (ColliderSphere*)r; ColliderJntSphElement* leftElem; @@ -3139,7 +3101,7 @@ void CollisionCheck_OC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckCo Math_Vec3s_ToVec3f(&leftPos, &leftElem->dim.worldSphere.center); Math_Vec3s_ToVec3f(&rightPos, &right->dim.worldSphere.center); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &leftElem->info, &leftPos, &right->base, &right->info, + CollisionCheck_SetOCvsOC(play, &left->base, &leftElem->info, &leftPos, &right->base, &right->info, &rightPos, overlap); } } @@ -3149,14 +3111,14 @@ void CollisionCheck_OC_JntSphVsSphere(GlobalContext* globalCtx, CollisionCheckCo /** * OC overlap check for a Cylinder and JntSph */ -void CollisionCheck_OC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { - CollisionCheck_OC_JntSphVsCyl(globalCtx, colCtxt, r, l); +void CollisionCheck_OC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { + CollisionCheck_OC_JntSphVsCyl(play, colCtxt, r, l); } /** * OC overlap check for two Cylinders */ -void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { +void CollisionCheck_OC_CylVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderCylinder* left = (ColliderCylinder*)l; ColliderCylinder* right = (ColliderCylinder*)r; f32 overlap; @@ -3169,8 +3131,8 @@ void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* Math_Vec3s_ToVec3f(&leftPos, &left->dim.pos); Math_Vec3s_ToVec3f(&rightPos, &right->dim.pos); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &left->info, &leftPos, &right->base, &right->info, - &rightPos, overlap); + CollisionCheck_SetOCvsOC(play, &left->base, &left->info, &leftPos, &right->base, &right->info, &rightPos, + overlap); } } } @@ -3178,7 +3140,7 @@ void CollisionCheck_OC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext* /** * OC overlap check for a Cylinder and Sphere */ -void CollisionCheck_OC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { +void CollisionCheck_OC_CylVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderCylinder* left = (ColliderCylinder*)l; ColliderSphere* right = (ColliderSphere*)r; f32 overlap; @@ -3191,8 +3153,8 @@ void CollisionCheck_OC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckConte Math_Vec3s_ToVec3f(&leftPos, &left->dim.pos); Math_Vec3s_ToVec3f(&rightPos, &right->dim.worldSphere.center); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &left->info, &leftPos, &right->base, &right->info, - &rightPos, overlap); + CollisionCheck_SetOCvsOC(play, &left->base, &left->info, &leftPos, &right->base, &right->info, &rightPos, + overlap); } } } @@ -3200,23 +3162,21 @@ void CollisionCheck_OC_CylVsSphere(GlobalContext* globalCtx, CollisionCheckConte /** * OC overlap check for a Sphere and JntSph */ -void CollisionCheck_OC_SphereVsJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, - Collider* r) { - CollisionCheck_OC_JntSphVsSphere(globalCtx, colCtxt, r, l); +void CollisionCheck_OC_SphereVsJntSph(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { + CollisionCheck_OC_JntSphVsSphere(play, colCtxt, r, l); } /** * OC overlap check for a Sphere and Cylinder */ -void CollisionCheck_OC_SphereVsCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { - CollisionCheck_OC_CylVsSphere(globalCtx, colCtxt, r, l); +void CollisionCheck_OC_SphereVsCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { + CollisionCheck_OC_CylVsSphere(play, colCtxt, r, l); } /** * OC overlap check for two Spheres */ -void CollisionCheck_OC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* l, - Collider* r) { +void CollisionCheck_OC_SphereVsSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* l, Collider* r) { ColliderSphere* left = (ColliderSphere*)l; ColliderSphere* right = (ColliderSphere*)r; f32 overlap; @@ -3229,8 +3189,8 @@ void CollisionCheck_OC_SphereVsSphere(GlobalContext* globalCtx, CollisionCheckCo Math_Vec3s_ToVec3f(&leftPos, &left->dim.worldSphere.center); Math_Vec3s_ToVec3f(&rightPos, &right->dim.worldSphere.center); - CollisionCheck_SetOCvsOC(globalCtx, &left->base, &left->info, &leftPos, &right->base, &right->info, - &rightPos, overlap); + CollisionCheck_SetOCvsOC(play, &left->base, &left->info, &leftPos, &right->base, &right->info, &rightPos, + overlap); } } } @@ -3278,7 +3238,7 @@ ColChkVsFunc sOCVsFuncs[COLSHAPE_MAX][COLSHAPE_MAX] = { * colliders 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* colCtxt) { +void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colCtxt) { Collider** left; Collider** right; ColChkVsFunc vsFunc; @@ -3295,7 +3255,7 @@ void CollisionCheck_OC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) if (vsFunc == NULL) { continue; } - vsFunc(globalCtx, colCtxt, *left, *right); + vsFunc(play, colCtxt, *left, *right); } } } @@ -3365,7 +3325,7 @@ void CollisionCheck_SetInfoGetDamageTable(CollisionCheckInfo* info, s32 index, C /** * Apply AC damage effect */ -void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, +void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider, ColliderInfo* info) { f32 damage; f32 finalDamage = 0.0f; @@ -3416,13 +3376,13 @@ void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* /** * Apply ColliderJntSph AC damage effect */ -void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* colCtxt, 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, colCtxt, &jntSph->base, &jntSph->elements[i].info); + CollisionCheck_ApplyDamage(play, colCtxt, &jntSph->base, &jntSph->elements[i].info); } } } @@ -3430,42 +3390,42 @@ void CollisionCheck_ApplyDamageJntSph(GlobalContext* globalCtx, CollisionCheckCo /** * Apply ColliderCylinder AC damage effect */ -void CollisionCheck_ApplyDamageCyl(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - CollisionCheck_ApplyDamage(globalCtx, colCtxt, &cylinder->base, &cylinder->info); + CollisionCheck_ApplyDamage(play, colCtxt, &cylinder->base, &cylinder->info); } /** * Apply ColliderTris AC damage effect */ -void CollisionCheck_ApplyDamageTris(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_ApplyDamageTris(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderTris* tris = (ColliderTris*)collider; s32 i; // unlike sphere groups above, tri groups are not guarded against // tris->elements being NULL for (i = 0; i < tris->count; i++) { - CollisionCheck_ApplyDamage(globalCtx, colCtxt, &tris->base, &tris->elements[i].info); + CollisionCheck_ApplyDamage(play, colCtxt, &tris->base, &tris->elements[i].info); } } /** * Apply ColliderQuad AC damage effect */ -void CollisionCheck_ApplyDamageQuad(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_ApplyDamageQuad(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - CollisionCheck_ApplyDamage(globalCtx, colCtxt, &quad->base, &quad->info); + CollisionCheck_ApplyDamage(play, colCtxt, &quad->base, &quad->info); } /** * Apply ColliderSphere AC damage effect */ -void CollisionCheck_ApplyDamageSphere(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { +void CollisionCheck_ApplyDamageSphere(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; - CollisionCheck_ApplyDamage(globalCtx, colCtxt, &sphere->base, &sphere->info); + CollisionCheck_ApplyDamage(play, colCtxt, &sphere->base, &sphere->info); } ColChkApplyFunc sApplyDamageFuncs[] = { @@ -3477,7 +3437,7 @@ ColChkApplyFunc sApplyDamageFuncs[] = { * 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* colCtxt) { +void CollisionCheck_Damage(PlayState* play, CollisionCheckContext* colCtxt) { s32 i; for (i = 0; i < colCtxt->colACCount; i++) { @@ -3489,15 +3449,15 @@ void CollisionCheck_Damage(GlobalContext* globalCtx, CollisionCheckContext* colC if (col->acFlags & AC_NO_DAMAGE) { continue; } - sApplyDamageFuncs[col->shape](globalCtx, colCtxt, col); + sApplyDamageFuncs[col->shape](play, colCtxt, col); } } /** * Checks if the line segment 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) { ColliderJntSph* jntSph = (ColliderJntSph*)collider; s32 i; @@ -3520,7 +3480,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) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; @@ -3538,8 +3498,8 @@ s32 CollisionCheck_LineOC_Cyl(GlobalContext* globalCtx, CollisionCheckContext* c /** * Checks if the line segment ab intersects the ColliderSphere */ -s32 CollisionCheck_LineOC_Sphere(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, - Vec3f* a, Vec3f* b) { +s32 CollisionCheck_LineOC_Sphere(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, Vec3f* a, + Vec3f* b) { ColliderSphere* sphere = (ColliderSphere*)collider; if (!(sphere->info.ocElemFlags & OCELEM_ON)) { @@ -3563,8 +3523,8 @@ ColChkLineFunc sOCLineCheckFuncs[] = { * 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; @@ -3592,7 +3552,7 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh continue; } - result = lineCheck(globalCtx, colChkCtx, (*col), a, b); + result = lineCheck(play, colChkCtx, (*col), a, b); if (result) { break; } @@ -3604,17 +3564,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. */ -s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b) { - return CollisionCheck_LineOC(globalCtx, colCtxt, a, b, NULL, 0); +s32 CollisionCheck_LineOCCheckAll(PlayState* play, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b) { + return CollisionCheck_LineOC(play, colCtxt, 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* colCtxt, Vec3f* a, Vec3f* b, - Actor** exclusions, s32 numExclusions) { - return CollisionCheck_LineOC(globalCtx, colCtxt, a, b, exclusions, numExclusions); +s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colCtxt, Vec3f* a, Vec3f* b, Actor** exclusions, + s32 numExclusions) { + return CollisionCheck_LineOC(play, colCtxt, a, b, exclusions, numExclusions); } /** @@ -3669,11 +3629,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* init) { +void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, ColliderTrisElementDimInit* init) { ColliderTrisElement* element = &collider->elements[index]; - Collider_SetTrisElementDim(globalCtx, &element->dim, init); + Collider_SetTrisElementDim(play, &element->dim, init); } /** @@ -3750,7 +3709,7 @@ void Collider_UpdateSphere(s32 limb, ColliderSphere* collider) { */ #ifdef NON_MATCHING // needs in-function static bss -void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnRedBlood(PlayState* play, Vec3f* v) { static EffectSparkInit D_801EE200; s32 effectIndex; @@ -3796,7 +3755,7 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { D_801EE200.speed = 8.0f; D_801EE200.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE200); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE200); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_SpawnRedBlood.s") @@ -3808,7 +3767,7 @@ void CollisionCheck_SpawnRedBlood(GlobalContext* globalCtx, Vec3f* v) { */ #ifdef NON_MATCHING // needs in-function static bss -void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { +void CollisionCheck_SpawnWaterDroplets(PlayState* play, Vec3f* v) { static EffectSparkInit D_801EE738; s32 effectIndex; @@ -3854,7 +3813,7 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { D_801EE738.speed = 8.0f; D_801EE738.gravity = -1.0f; - Effect_Add(globalCtx, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE738); + Effect_Add(play, &effectIndex, EFFECT_SPARK, 0, 1, &D_801EE738); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/CollisionCheck_SpawnWaterDroplets.s") @@ -3863,7 +3822,7 @@ void CollisionCheck_SpawnWaterDroplets(GlobalContext* globalCtx, Vec3f* v) { /** * 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 shieldParticleInitMetal = { 16, { 0, 0, 0 }, @@ -3889,36 +3848,36 @@ void CollisionCheck_SpawnShieldParticles(GlobalContext* globalCtx, Vec3f* v) { shieldParticleInitMetal.lightPoint.y = shieldParticleInitMetal.position.y; shieldParticleInitMetal.lightPoint.z = shieldParticleInitMetal.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitMetal); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitMetal); } /** * 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); play_sound(NA_SE_IT_SHIELD_REFLECT_SW); } /** * 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_PlaySfxAtPos(pos, NA_SE_IT_SHIELD_REFLECT_SW); } /** * 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* pos) { +void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* pos) { static EffectShieldParticleInit shieldParticleInitWood = { 16, { 0, 0, 0 }, @@ -3944,7 +3903,7 @@ void CollisionCheck_SpawnShieldParticlesWood(GlobalContext* globalCtx, Vec3f* v, shieldParticleInitWood.lightPoint.y = shieldParticleInitWood.position.y; shieldParticleInitWood.lightPoint.z = shieldParticleInitWood.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitWood); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &shieldParticleInitWood); Audio_PlaySfxAtPos(pos, NA_SE_IT_REFLECTION_WOOD); } diff --git a/src/code/z_construct.c b/src/code/z_construct.c index a2e295da26..5e92d49587 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,4 +1,4 @@ #include "global.h" -void func_801AAAA0(GlobalContext* globalCtx) { +void func_801AAAA0(PlayState* play) { } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index fb7378751f..a8b851ed7f 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -7,10 +7,10 @@ typedef struct { /* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw funciton when called } DebugDispObjectInfo; // size = 0x8 -typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, GlobalContext*); +typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*); -void DebugDisplay_DrawSpriteI8(DebugDispObject*, void*, GlobalContext*); -void DebugDisplay_DrawPolygon(DebugDispObject*, void*, GlobalContext*); +void DebugDisplay_DrawSpriteI8(DebugDispObject*, void*, PlayState*); +void DebugDisplay_DrawPolygon(DebugDispObject*, void*, PlayState*); DebugDispObject* DebugDisplay_Init(void) { sDebugObjectListHead = NULL; @@ -51,44 +51,44 @@ DebugDispObjectInfo sDebugObjectInfoTable[] = { { 1, &sDebugDisplay2DL }, }; -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); +void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C6FC(globalCtx->state.gfxCtx); + func_8012C6FC(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sDebugDisplaySpriteDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Lights1 sDebugDisplayLight1 = gdSPDefLights1(128, 128, 128, 255, 255, 255, 73, 73, 73); -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C588(globalCtx->state.gfxCtx); + func_8012C588(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); @@ -96,10 +96,10 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, GlobalContex 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, arg1); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 D_801BB068[] = { @@ -110,16 +110,16 @@ s32 D_801BB08C = 0; Gfx* func_800E99B0(GraphicsContext* gfxCtx, s32 arg1); -void func_800E992C(GlobalContext* globalCtx, s32 arg1) { +void func_800E992C(PlayState* play, s32 arg1) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C560(globalCtx->state.gfxCtx); + func_8012C560(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, func_800E99B0(globalCtx->state.gfxCtx, arg1)); + gSPDisplayList(POLY_XLU_DISP++, func_800E99B0(play->state.gfxCtx, arg1)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_display/func_800E99B0.s") diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 67a4d56082..8356f21e3e 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,13 +1,13 @@ #include "global.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" -void Cutscene_DoNothing(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800EA258(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800ED9C4(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800EA2B8(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800ED980(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800EDA04(GlobalContext* globalCtx, CutsceneContext* csCtx); -void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx); +void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx); +void func_800EA258(PlayState* play, CutsceneContext* csCtx); +void func_800ED9C4(PlayState* play, CutsceneContext* csCtx); +void func_800EA2B8(PlayState* play, CutsceneContext* csCtx); +void func_800ED980(PlayState* play, CutsceneContext* csCtx); +void func_800EDA04(PlayState* play, CutsceneContext* csCtx); +void func_800EDA84(PlayState* play, CutsceneContext* csCtx); // Unused UNK_TYPE4 D_801BB120 = 0; @@ -27,14 +27,14 @@ UNK_TYPE D_801F4DDC; u8 D_801F4DE0; s16 D_801F4DE2; -void Cutscene_Init(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void Cutscene_Init(PlayState* play, CutsceneContext* csCtx) { s32 i; csCtx->state = CS_STATE_0; csCtx->frames = 0; csCtx->unk_0C = 0.0f; - globalCtx->csCtx.sceneCsCount = 0; - globalCtx->csCtx.currentCsIndex = 0; + play->csCtx.sceneCsCount = 0; + play->csCtx.currentCsIndex = 0; for (i = 0; i < ARRAY_COUNT(D_801F4DC8); i++) { D_801F4DC8[i] = 0; @@ -45,18 +45,18 @@ void Cutscene_Init(GlobalContext* globalCtx, CutsceneContext* csCtx) { Audio_SetCutsceneFlag(false); } -void Cutscene_Start(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void Cutscene_Start(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_1; csCtx->playerAction = NULL; } -void Cutscene_End(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void Cutscene_End(PlayState* play, CutsceneContext* csCtx) { if (csCtx->state != CS_STATE_4) { csCtx->state = CS_STATE_3; } } -typedef void (*CutsceneStateHandler)(GlobalContext* globalCtx, CutsceneContext* csCtx); +typedef void (*CutsceneStateHandler)(PlayState* play, CutsceneContext* csCtx); CutsceneStateHandler sCsStateHandlers1[] = { Cutscene_DoNothing, // CS_STATE_0 @@ -66,9 +66,9 @@ CutsceneStateHandler sCsStateHandlers1[] = { Cutscene_DoNothing, // CS_STATE_4 }; -void Cutscene_Update1(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void Cutscene_Update1(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.save.cutscene < 0xFFF0) { - sCsStateHandlers1[csCtx->state](globalCtx, csCtx); + sCsStateHandlers1[csCtx->state](play, csCtx); } } @@ -80,8 +80,8 @@ CutsceneStateHandler sCsStateHandlers2[] = { func_800ED980, // CS_STATE_4 }; -void Cutscene_Update2(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if ((gSaveContext.cutsceneTrigger != 0) && (globalCtx->sceneLoadFlag == 0x14)) { +void Cutscene_Update2(PlayState* play, CutsceneContext* csCtx) { + if ((gSaveContext.cutsceneTrigger != 0) && (play->sceneLoadFlag == 0x14)) { gSaveContext.cutsceneTrigger = 0; } @@ -91,32 +91,32 @@ void Cutscene_Update2(GlobalContext* globalCtx, CutsceneContext* csCtx) { } if (gSaveContext.save.cutscene >= 0xFFF0) { - func_800EDA84(globalCtx, csCtx); - sCsStateHandlers2[csCtx->state](globalCtx, csCtx); + func_800EDA84(play, csCtx); + sCsStateHandlers2[csCtx->state](play, csCtx); } } -void Cutscene_DoNothing(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx) { } -s32 func_800EA220(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) { +s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) { return Math_StepToF(&csCtx->unk_0C, target, 0.1f); } -void func_800EA258(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_800EA258(PlayState* play, CutsceneContext* csCtx) { Interface_ChangeAlpha(1); ShrinkWindow_SetLetterboxTarget(32); - if (func_800EA220(globalCtx, csCtx, 1.0f)) { + if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); csCtx->state++; } } -void func_800EA2B8(GlobalContext* globalCtx, CutsceneContext* csCtx) { - func_800ED980(globalCtx, csCtx); +void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) { + func_800ED980(play, csCtx); Interface_ChangeAlpha(1); ShrinkWindow_SetLetterboxTarget(32); - if (func_800EA220(globalCtx, csCtx, 1.0f)) { + if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); csCtx->state++; } @@ -125,10 +125,10 @@ void func_800EA2B8(GlobalContext* globalCtx, CutsceneContext* csCtx) { /* Start of command handling section */ // Command 0x96: Miscellaneous commands. -void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* cmd) { static u16 D_801BB15C = 0xFFFF; - Player* player = GET_PLAYER(globalCtx2); - GlobalContext* globalCtx = globalCtx2; + Player* player = GET_PLAYER(play2); + PlayState* play = play2; u8 isStartFrame = false; f32 progress; SceneTableEntry* loadedScene; @@ -146,33 +146,33 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs switch (cmd->base) { case 0x1: if (isStartFrame) { - func_800FD78C(globalCtx); - globalCtx->envCtx.unk_F2[0] = 0x3C; + func_800FD78C(play); + play->envCtx.unk_F2[0] = 0x3C; } break; case 0x2: if (isStartFrame) { func_801A47DC(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); - Environment_AddLightningBolts(globalCtx, 3); + Environment_AddLightningBolts(play, 3); D_801F4E68 = 1; } break; case 0x3: - if (globalCtx->envCtx.lightSettings.fogFar < 12800) { - globalCtx->envCtx.lightSettings.fogFar += 35; + if (play->envCtx.lightSettings.fogFar < 12800) { + play->envCtx.lightSettings.fogFar += 35; } break; case 0x4: if (isStartFrame) { - globalCtx->envCtx.unk_19 = 1; - globalCtx->envCtx.unk_17 = 1; - globalCtx->envCtx.unk_18 = 0; - globalCtx->envCtx.unk_1A = 0x3C; - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_1F = 0; - globalCtx->envCtx.unk_20 = 1; - globalCtx->envCtx.unk_24 = 0x3C; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + play->envCtx.unk_19 = 1; + play->envCtx.unk_17 = 1; + play->envCtx.unk_18 = 0; + play->envCtx.unk_1A = 0x3C; + play->envCtx.unk_21 = 1; + play->envCtx.unk_1F = 0; + play->envCtx.unk_20 = 1; + play->envCtx.unk_24 = 0x3C; + play->envCtx.unk_22 = play->envCtx.unk_24; } break; case 0x5: @@ -182,16 +182,16 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs break; case 0x7: if (isStartFrame) { - loadedScene = globalCtx->loadedScene; + loadedScene = play->loadedScene; if (loadedScene->titleTextId != 0) { - func_80151A68(globalCtx, loadedScene->titleTextId); + func_80151A68(play, loadedScene->titleTextId); } } break; case 0x8: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -215,32 +215,32 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs D_801F6D30.a = 255 * progress; break; case 0xC: - globalCtx->roomCtx.currRoom.segment = NULL; + play->roomCtx.currRoom.segment = NULL; break; case 0xD: - if (globalCtx->state.frames & 8) { - if (globalCtx->envCtx.lightSettings.ambientColor[0] < 40) { - globalCtx->envCtx.lightSettings.ambientColor[0] += 2; - globalCtx->envCtx.lightSettings.diffuseColor1[1] -= 3; - globalCtx->envCtx.lightSettings.diffuseColor1[2] -= 3; + if (play->state.frames & 8) { + if (play->envCtx.lightSettings.ambientColor[0] < 40) { + play->envCtx.lightSettings.ambientColor[0] += 2; + play->envCtx.lightSettings.diffuseColor1[1] -= 3; + play->envCtx.lightSettings.diffuseColor1[2] -= 3; } } else { - if (globalCtx->envCtx.lightSettings.ambientColor[0] > 2) { - globalCtx->envCtx.lightSettings.ambientColor[0] -= 2; - globalCtx->envCtx.lightSettings.diffuseColor1[1] += 3; - globalCtx->envCtx.lightSettings.diffuseColor1[2] += 3; + if (play->envCtx.lightSettings.ambientColor[0] > 2) { + play->envCtx.lightSettings.ambientColor[0] -= 2; + play->envCtx.lightSettings.diffuseColor1[1] += 3; + play->envCtx.lightSettings.diffuseColor1[2] += 3; } } break; case 0xE: - globalCtx->unk_18845 = 1; + play->unk_18845 = 1; break; case 0xF: - globalCtx->unk_18845 = 0; + play->unk_18845 = 0; break; case 0x10: if (isStartFrame) { - globalCtx->envCtx.sandstormState = 1; + play->envCtx.sandstormState = 1; } func_8019F128(NA_SE_EV_SAND_STORM - SFX_FLAG); break; @@ -260,10 +260,10 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs csCtx->frames = cmd->startFrame - 1; break; case 0x14: - EnvFlags_Set(globalCtx, 3); + EnvFlags_Set(play, 3); break; case 0x15: - EnvFlags_Set(globalCtx, 4); + EnvFlags_Set(play, 4); break; case 0x16: gSaveContext.save.playerForm = PLAYER_FORM_DEKU; @@ -282,7 +282,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs case 0x1A: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(sCutsceneQuakeIndex, 30000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -290,15 +290,15 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs break; case 0x1B: if (isStartFrame) { - globalCtx->nextEntranceIndex = 0x1C00; + play->nextEntranceIndex = 0x1C00; gSaveContext.nextCutsceneIndex = 0xFFF8; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; } break; case 0x1C: if (isStartFrame) { - globalCtx->envCtx.unk_17 = 0xD; + play->envCtx.unk_17 = 0xD; } break; case 0x1D: @@ -312,12 +312,12 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs break; case 0x21: if (isStartFrame) { - Sram_SaveSpecialEnterClockTown(globalCtx); + Sram_SaveSpecialEnterClockTown(play); } break; case 0x22: if (isStartFrame) { - func_80144A94(&globalCtx->sramCtx); + func_80144A94(&play->sramCtx); } break; case 0x23: @@ -334,7 +334,7 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs case 0x24: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -347,12 +347,12 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs gSaveContext.save.day = 9; { - GameState* gameState = &globalCtx->state; + GameState* gameState = &play->state; gameState->running = false; } - SET_NEXT_GAMESTATE(&globalCtx->state, Daytelop_Init, DaytelopContext); + SET_NEXT_GAMESTATE(&play->state, Daytelop_Init, DaytelopContext); - Sram_SaveSpecialNewDay(globalCtx); + Sram_SaveSpecialNewDay(play); break; case 0x27: @@ -366,33 +366,33 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs } // Command 0x97: 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) { if (cmd->setting != 0x20) { - globalCtx->envCtx.lightSettingOverride = cmd->setting - 1; - globalCtx->envCtx.lightBlend = 1.0f; + play->envCtx.lightSettingOverride = cmd->setting - 1; + play->envCtx.lightBlend = 1.0f; } else { - globalCtx->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = 0xFF; } } } // Command 0x12C: Plays a sequence (Background music or Fanfare) -void Cutscene_Command_PlaySequence(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { +void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if (csCtx->frames == cmd->startFrame) { func_801A2C88(cmd->sequence - 1); } } // Command 0x12D: Stops a sequence (Background music or Fanfare) -void Cutscene_Command_StopSequence(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { +void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { func_801A2D54(cmd->sequence - 1); } } // Command 0x9C: Fade a sequence (Background music or Fanfare) over duration -void Cutscene_Command_FadeSequence(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdSequenceFade* cmd) { +void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceFade* cmd) { if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { u8 fadeTimer = cmd->endFrame - cmd->startFrame; @@ -405,16 +405,16 @@ void Cutscene_Command_FadeSequence(GlobalContext* globalCtx, CutsceneContext* cs } // Command 0x12E: Play Ambience sequence -void Cutscene_Command_PlayAmbienceSequence(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame) { // Audio_PlayNatureAmbienceSequence // nightSeqIndex is natureAmbienceId - func_801A4A28(globalCtx->soundCtx.nightSeqIndex); + func_801A4A28(play->soundCtx.nightSeqIndex); } } // Command 0x130: -void func_800EAD48(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void func_800EAD48(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame) { // Audio_SetSfxReverbIndexExceptOcarinaBank func_801A4428(2); @@ -422,7 +422,7 @@ void func_800EAD48(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } // Command 0x131: -void func_800EAD7C(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void func_800EAD7C(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame) { // Audio_SetSfxReverbIndexExceptOcarinaBank func_801A4428(1); @@ -432,7 +432,7 @@ void func_800EAD7C(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* #ifdef NON_MATCHING // needs in-function static bss // audio related -void func_800EADB0(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { static u16 seqId; u8 dayMinusOne; @@ -492,7 +492,7 @@ void func_800EADB0(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* #endif // Command 0x12F: Fade Ambience sequence -void Cutscene_Command_FadeAmbienceSequence(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_FadeAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame && csCtx->frames < cmd->endFrame) { u8 fadeTimer = cmd->endFrame - cmd->startFrame; @@ -501,7 +501,7 @@ void Cutscene_Command_FadeAmbienceSequence(GlobalContext* globalCtx, CutsceneCon } // Command 0x190: Rumble -void Cutscene_Command_Rumble(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdRumble* cmd) { +void Cutscene_Command_Rumble(PlayState* play, CutsceneContext* csCtx, CsCmdRumble* cmd) { switch (cmd->type) { case 1: if (csCtx->frames == cmd->startFrame) { @@ -511,7 +511,7 @@ void Cutscene_Command_Rumble(GlobalContext* globalCtx, CutsceneContext* csCtx, C case 2: if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - if ((csCtx->frames == cmd->startFrame) || (globalCtx->state.frames % 64 == 0)) { + if ((csCtx->frames == cmd->startFrame) || (play->state.frames % 64 == 0)) { func_8013ECE0(0.0f, cmd->unk6, cmd->unk7, cmd->unk8); } } @@ -520,29 +520,29 @@ void Cutscene_Command_Rumble(GlobalContext* globalCtx, CutsceneContext* csCtx, C } // Command 0x9B: -void Cutscene_Command_FadeColorScreen(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdFadeScreen* cmd) { +void Cutscene_Command_FadeColorScreen(PlayState* play, CutsceneContext* csCtx, CsCmdFadeScreen* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { f32 alpha; - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; alpha = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); if (((cmd->unk0 == 1)) || (cmd->unk0 == 2)) { - globalCtx->envCtx.screenFillColor[0] = cmd->color.r; - globalCtx->envCtx.screenFillColor[1] = cmd->color.g; - globalCtx->envCtx.screenFillColor[2] = cmd->color.b; + play->envCtx.screenFillColor[0] = cmd->color.r; + play->envCtx.screenFillColor[1] = cmd->color.g; + play->envCtx.screenFillColor[2] = cmd->color.b; if (cmd->unk0 == 2) { - globalCtx->envCtx.screenFillColor[3] = (1.0f - alpha) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - alpha) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * alpha; + play->envCtx.screenFillColor[3] = 255.0f * alpha; } } } } // Command 0x9D: Set Time of Day & Environment Time -void Cutscene_Command_SetTime(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTime* cmd) { +void Cutscene_Command_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdDayTime* cmd) { u16 nextTime; u16 hourAsMinutes; u16 minutes; @@ -557,7 +557,7 @@ void Cutscene_Command_SetTime(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void Cutscene_TerminatorImpl(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { csCtx->state = CS_STATE_4; func_80165690(); Audio_SetCutsceneFlag(false); @@ -569,32 +569,32 @@ void Cutscene_TerminatorImpl(GlobalContext* globalCtx, CutsceneContext* csCtx, C gSaveContext.save.cutscene = 0; if (cmd->base == 1) { - globalCtx->nextEntranceIndex = globalCtx->csCtx.sceneCsList[globalCtx->csCtx.currentCsIndex].nextEntranceIndex; + play->nextEntranceIndex = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntranceIndex; gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; if (gSaveContext.gameMode != 1) { - Scene_SetExitFade(globalCtx); + Scene_SetExitFade(play); } else { D_801BB12C++; if (D_801BB12C >= 2) { D_801BB12C = 0; } - globalCtx->unk_1887F = 4; + play->unk_1887F = 4; } - if ((globalCtx->nextEntranceIndex & 0xF) > 0) { - gSaveContext.nextCutsceneIndex = (globalCtx->nextEntranceIndex & 0xF) + 0xFFEF; + if ((play->nextEntranceIndex & 0xF) > 0) { + gSaveContext.nextCutsceneIndex = (play->nextEntranceIndex & 0xF) + 0xFFEF; } - globalCtx->nextEntranceIndex &= ~0xF; + play->nextEntranceIndex &= ~0xF; } } // Command 0x15E -void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (cmd->base == 1) { if (csCtx->frames == cmd->startFrame) { - Cutscene_TerminatorImpl(globalCtx, csCtx, cmd); + Cutscene_TerminatorImpl(play, csCtx, cmd); } } else if (cmd->base == 2) { if (csCtx->frames == cmd->startFrame) { @@ -603,44 +603,44 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt switch (D_801F4DE2) { case 0x1F: if (gSaveContext.save.weekEventReg[20] & 2) { - globalCtx->nextEntranceIndex = 0x3010; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->nextEntranceIndex = 0x3010; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; } else { - globalCtx->nextEntranceIndex = 0x8600; + play->nextEntranceIndex = 0x8600; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; } break; case 0x44: if (gSaveContext.save.weekEventReg[33] & 0x80) { - globalCtx->nextEntranceIndex = 0xAE70; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->nextEntranceIndex = 0xAE70; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; } else { - globalCtx->nextEntranceIndex = 0xAE00; + play->nextEntranceIndex = 0xAE00; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; } break; case 0x5F: gSaveContext.save.weekEventReg[55] |= 0x80; - globalCtx->nextEntranceIndex = 0x6A80; + play->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; break; case 0x36: gSaveContext.save.weekEventReg[52] |= 0x20; - globalCtx->nextEntranceIndex = 0x2000; + play->nextEntranceIndex = 0x2000; gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; break; } } @@ -649,142 +649,142 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt // Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding // mask -void Cutscene_Command_ChooseCreditsScenes(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(0, true) != 0xFF)) { switch (cmd->base) { case 1: - Cutscene_TerminatorImpl(globalCtx, csCtx, cmd); + Cutscene_TerminatorImpl(play, csCtx, cmd); break; case 2: if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { // Milk bar - globalCtx->nextEntranceIndex = 0x2400; + play->nextEntranceIndex = 0x2400; gSaveContext.nextCutsceneIndex = 0xFFF0; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C00; + play->nextEntranceIndex = 0x1C00; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 3: if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { // Fairy's fountain - globalCtx->nextEntranceIndex = 0x4600; + play->nextEntranceIndex = 0x4600; gSaveContext.nextCutsceneIndex = 0xFFF0; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C10; + play->nextEntranceIndex = 0x1C10; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 4: if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) { // Romani ranch - globalCtx->nextEntranceIndex = 0x6400; + play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF1; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C20; + play->nextEntranceIndex = 0x1C20; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 5: if (INV_CONTENT(ITEM_MASK_BLAST) == ITEM_MASK_BLAST) { // West clock town - globalCtx->nextEntranceIndex = 0xD400; + play->nextEntranceIndex = 0xD400; gSaveContext.nextCutsceneIndex = 0xFFF0; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C30; + play->nextEntranceIndex = 0x1C30; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 6: if (INV_CONTENT(ITEM_MASK_CIRCUS_LEADER) == ITEM_MASK_CIRCUS_LEADER) { // Milk bar - globalCtx->nextEntranceIndex = 0x2400; + play->nextEntranceIndex = 0x2400; gSaveContext.nextCutsceneIndex = 0xFFF1; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C50; + play->nextEntranceIndex = 0x1C50; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 7: if (INV_CONTENT(ITEM_MASK_BREMEN) == ITEM_MASK_BREMEN) { // Milk bar - globalCtx->nextEntranceIndex = 0x2400; + play->nextEntranceIndex = 0x2400; gSaveContext.nextCutsceneIndex = 0xFFF3; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C60; + play->nextEntranceIndex = 0x1C60; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 8: // Ikana canyon - globalCtx->nextEntranceIndex = 0x2000; + play->nextEntranceIndex = 0x2000; gSaveContext.nextCutsceneIndex = 0xFFF3; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 9: if (INV_CONTENT(ITEM_MASK_COUPLE) == ITEM_MASK_COUPLE) { // Termina field - globalCtx->nextEntranceIndex = 0x5400; + play->nextEntranceIndex = 0x5400; gSaveContext.nextCutsceneIndex = 0xFFF8; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C70; + play->nextEntranceIndex = 0x1C70; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 10: if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { // Cucco shack - globalCtx->nextEntranceIndex = 0x7E00; + play->nextEntranceIndex = 0x7E00; gSaveContext.nextCutsceneIndex = 0xFFF0; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C40; + play->nextEntranceIndex = 0x1C40; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; case 11: if (INV_CONTENT(ITEM_MASK_POSTMAN) == ITEM_MASK_POSTMAN) { // Termina field - globalCtx->nextEntranceIndex = 0x5410; + play->nextEntranceIndex = 0x5410; gSaveContext.nextCutsceneIndex = 0xFFF8; } else { // SPOT00 - globalCtx->nextEntranceIndex = 0x1C80; + play->nextEntranceIndex = 0x1C80; gSaveContext.nextCutsceneIndex = 0xFFF9; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; break; } } } // Command 0x99: Motion blur -void Cutscene_Command_MotionBlur(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_MotionBlur(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { if ((csCtx->frames == cmd->startFrame) && (cmd->base == 1)) { func_8016566C(180); @@ -803,8 +803,8 @@ void Cutscene_Command_MotionBlur(GlobalContext* globalCtx, CutsceneContext* csCt } // Command 0x9A: Gives Tatl to the player -void Cutscene_Command_GiveTatlToPlayer(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = GET_PLAYER(globalCtx); +void Cutscene_Command_GiveTatlToPlayer(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { + Player* player = GET_PLAYER(play); if (csCtx->frames == cmd->startFrame) { if (cmd->base == 1) { @@ -812,69 +812,69 @@ void Cutscene_Command_GiveTatlToPlayer(GlobalContext* globalCtx, CutsceneContext if (player->tatlActor != NULL) { return; } - player->tatlActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, player->actor.world.pos.x, + player->tatlActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 0); } } } // Command 0x98 -void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { +void Cutscene_Command_TransitionFX(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { f32 temp_f0; - globalCtx->envCtx.fillScreen = true; + play->envCtx.fillScreen = true; temp_f0 = 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_f0; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; if (temp_f0 == 0.0f) { func_8019F128(NA_SE_EV_S_STONE_FLASH); } } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 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_f0; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; } else { - globalCtx->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 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_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; } 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_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; } break; @@ -884,35 +884,35 @@ 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_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; } else { - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; } break; case 12: - globalCtx->envCtx.screenFillColor[0] = (160.0f * (1.0f - temp_f0)); - globalCtx->envCtx.screenFillColor[1] = globalCtx->envCtx.screenFillColor[0]; - globalCtx->envCtx.screenFillColor[2] = globalCtx->envCtx.screenFillColor[0]; - globalCtx->envCtx.screenFillColor[3] = 255; + play->envCtx.screenFillColor[0] = (160.0f * (1.0f - temp_f0)); + play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[0]; + play->envCtx.screenFillColor[2] = play->envCtx.screenFillColor[0]; + play->envCtx.screenFillColor[3] = 255; break; case 13: - globalCtx->envCtx.screenFillColor[0] = (160.0f * temp_f0); - globalCtx->envCtx.screenFillColor[1] = globalCtx->envCtx.screenFillColor[0]; - globalCtx->envCtx.screenFillColor[2] = globalCtx->envCtx.screenFillColor[0]; - globalCtx->envCtx.screenFillColor[3] = 255; + play->envCtx.screenFillColor[0] = (160.0f * temp_f0); + play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[0]; + play->envCtx.screenFillColor[2] = play->envCtx.screenFillColor[0]; + play->envCtx.screenFillColor[3] = 255; break; } } } // Command 0x5A: Camera -s32 Cutscene_Command_Camera(GlobalContext* globalCtx, u8* cmd) { +s32 Cutscene_Command_Camera(PlayState* play, u8* cmd) { s32 sp1C = 0; bcopy(cmd, &sp1C, sizeof(s32)); @@ -995,7 +995,7 @@ s32 Cutscene_CountNormalMasks(void) { } // Command 0xA: Textbox -void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdTextbox* cmd) { +void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdTextbox* cmd) { static s32 D_801BB160 = CS_TEXTBOX_TYPE_DEFAULT; u8 dialogState; s32 pad; @@ -1017,21 +1017,21 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { if (cmd->textId1 != 0xFFFF) { - 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); } } else if (cmd->type == CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS) { if (Cutscene_CountNormalMasks() == 20) { if (cmd->textId1 != 0xFFFF) { - 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); } } else { - Message_StartTextbox(globalCtx, cmd->base, NULL); + Message_StartTextbox(play, cmd->base, NULL); } } else { goto else_label; @@ -1039,7 +1039,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } else if (D_801BB128 != cmd->base) { D_801BB160 = CS_TEXTBOX_TYPE_LEARN_SONG; D_801BB128 = cmd->base; - func_80152434(globalCtx, cmd->base); + func_80152434(play, cmd->base); } else { else_label: if (csCtx->frames >= cmd->endFrame) { @@ -1047,17 +1047,17 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, // a textbox that is expected to be closed by the user is still open. originalCsFrames = csCtx->frames; - dialogState = Message_GetState(&globalCtx->msgCtx); + dialogState = Message_GetState(&play->msgCtx); if ((dialogState != 2) && (dialogState != 0) && (dialogState != 7) && (dialogState != 8)) { csCtx->frames--; - if ((dialogState == 4) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((dialogState == 4) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (cmd->base == 0x33BD) { func_8019F230(); } if (cmd->textId1 != 0xFFFF) { - func_80151938(globalCtx, cmd->textId1); + func_80151938(play, cmd->textId1); if (cmd->type == CS_TEXTBOX_TYPE_3) { D_801BB160 = CS_TEXTBOX_TYPE_3; if (cmd->textId2 != 0xFFFF) { @@ -1065,7 +1065,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } } else { - func_801477B4(globalCtx); + func_801477B4(play); csCtx->frames++; } } else { @@ -1074,7 +1074,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } if (cmd->textId2 != 0xFFFF) { - func_80151938(globalCtx, cmd->textId2); + func_80151938(play, cmd->textId2); if (cmd->type == CS_TEXTBOX_TYPE_3) { D_801BB160 = CS_TEXTBOX_TYPE_3; if (cmd->textId1 != 0xFFFF) { @@ -1082,14 +1082,14 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } } else { - func_801477B4(globalCtx); + func_801477B4(play); csCtx->frames++; } } } - if (dialogState == 5 && Message_ShouldAdvance(globalCtx)) { - func_80152434(globalCtx, cmd->base); + if (dialogState == 5 && Message_ShouldAdvance(play)) { + func_80152434(play, cmd->base); } } @@ -1157,7 +1157,7 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { * * TODO: consider changing the type of `cutscenePtr` to `uintptr_t` when this function matches. */ -void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr) { +void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { s32 i; s16 phi_s0; s32 totalEntries; @@ -1175,7 +1175,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cutsceneEndFrame, sizeof(s32)); cutscenePtr += sizeof(s32); - if (((u16)cutsceneEndFrame < csCtx->frames) && (globalCtx->sceneLoadFlag != 0x14) && (csCtx->state != CS_STATE_4)) { + if (((u16)cutsceneEndFrame < csCtx->frames) && (play->sceneLoadFlag != 0x14) && (csCtx->state != CS_STATE_4)) { csCtx->state = CS_STATE_3; return; } @@ -1213,7 +1213,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Misc(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_Misc(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1222,7 +1222,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetLighting(globalCtx, csCtx, (CsCmdEnvLighting*)cutscenePtr); + Cutscene_Command_SetLighting(play, csCtx, (CsCmdEnvLighting*)cutscenePtr); cutscenePtr += sizeof(CsCmdEnvLighting); } break; @@ -1231,7 +1231,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlaySequence(globalCtx, csCtx, (CsCmdSequenceChange*)cutscenePtr); + Cutscene_Command_PlaySequence(play, csCtx, (CsCmdSequenceChange*)cutscenePtr); cutscenePtr += sizeof(CsCmdSequenceChange); } break; @@ -1240,7 +1240,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_StopSequence(globalCtx, csCtx, (CsCmdSequenceChange*)cutscenePtr); + Cutscene_Command_StopSequence(play, csCtx, (CsCmdSequenceChange*)cutscenePtr); cutscenePtr += sizeof(CsCmdSequenceChange); } break; @@ -1249,7 +1249,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeSequence(globalCtx, csCtx, (CsCmdSequenceFade*)cutscenePtr); + Cutscene_Command_FadeSequence(play, csCtx, (CsCmdSequenceFade*)cutscenePtr); cutscenePtr += sizeof(CsCmdSequenceFade); } break; @@ -1258,7 +1258,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlayAmbienceSequence(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_PlayAmbienceSequence(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1267,7 +1267,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeAmbienceSequence(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_FadeAmbienceSequence(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1276,7 +1276,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - func_800EAD48(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + func_800EAD48(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1285,7 +1285,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - func_800EAD7C(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + func_800EAD7C(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1294,7 +1294,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - func_800EADB0(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + func_800EADB0(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1303,7 +1303,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Rumble(globalCtx, csCtx, (CsCmdRumble*)cutscenePtr); + Cutscene_Command_Rumble(play, csCtx, (CsCmdRumble*)cutscenePtr); cutscenePtr += sizeof(CsCmdRumble); } break; @@ -1312,7 +1312,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeColorScreen(globalCtx, csCtx, (CsCmdFadeScreen*)cutscenePtr); + Cutscene_Command_FadeColorScreen(play, csCtx, (CsCmdFadeScreen*)cutscenePtr); cutscenePtr += sizeof(CsCmdFadeScreen); } break; @@ -1321,7 +1321,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetTime(globalCtx, csCtx, (CsCmdDayTime*)cutscenePtr); + Cutscene_Command_SetTime(play, csCtx, (CsCmdDayTime*)cutscenePtr); cutscenePtr += sizeof(CsCmdDayTime); } break; @@ -1339,14 +1339,14 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, break; case CS_CMD_CAMERA: - cutscenePtr = &cutscenePtr[Cutscene_Command_Camera(globalCtx, cutscenePtr)]; + cutscenePtr = &cutscenePtr[Cutscene_Command_Camera(play, cutscenePtr)]; break; case CS_CMD_TERMINATOR: bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Terminator(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_Terminator(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1355,7 +1355,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_ChooseCreditsScenes(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_ChooseCreditsScenes(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1366,7 +1366,7 @@ 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, (CsCmdTextbox*)cutscenePtr); + Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cutscenePtr); } cutscenePtr += sizeof(CsCmdTextbox); } @@ -1376,7 +1376,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_TransitionFX(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_TransitionFX(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1385,7 +1385,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_MotionBlur(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_MotionBlur(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1394,7 +1394,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_GiveTatlToPlayer(globalCtx, csCtx, (CsCmdBase*)cutscenePtr); + Cutscene_Command_GiveTatlToPlayer(play, csCtx, (CsCmdBase*)cutscenePtr); cutscenePtr += sizeof(CsCmdBase); } break; @@ -1413,29 +1413,29 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } } #else -void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr); +void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr); #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/Cutscene_ProcessCommands.s") #endif /* End of command handling section */ -void func_800ED980(GlobalContext* globalCtx, CutsceneContext* csCtx) { +void func_800ED980(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.save.cutscene >= 0xFFF0) { csCtx->frames++; - Cutscene_ProcessCommands(globalCtx, csCtx, (u8*)globalCtx->csCtx.csData); + Cutscene_ProcessCommands(play, csCtx, (u8*)play->csCtx.csData); } } -void func_800ED9C4(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (func_800EA220(globalCtx, csCtx, 0.0f)) { +void func_800ED9C4(PlayState* play, CutsceneContext* csCtx) { + if (func_800EA220(play, csCtx, 0.0f)) { Audio_SetCutsceneFlag(false); csCtx->state = CS_STATE_0; } } // unused -void func_800EDA04(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if (func_800EA220(globalCtx, csCtx, 0.0f)) { +void func_800EDA04(PlayState* play, CutsceneContext* csCtx) { + if (func_800EA220(play, csCtx, 0.0f)) { s16 i; csCtx->playerAction = NULL; @@ -1452,8 +1452,8 @@ void func_800EDA04(GlobalContext* globalCtx, CutsceneContext* csCtx) { } } -void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx) { - if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(&globalCtx->state)) { +void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { + if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(&play->state)) { gSaveContext.save.cutscene = 0xFFFD; } @@ -1474,7 +1474,7 @@ void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->frames = 0xFFFF; csCtx->csCamId = ActorCutscene_GetCurrentCamera(0x7F); - func_8016119C(Play_GetCamera(globalCtx, csCtx->csCamId), &sCutsceneCameraInfo); + func_8016119C(Play_GetCamera(play, csCtx->csCamId), &sCutsceneCameraInfo); csCtx->unk_18 = 0xFFFF; if (gSaveContext.cutsceneTrigger == 0) { @@ -1484,7 +1484,7 @@ void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->state++; } - func_800ED980(globalCtx, csCtx); + func_800ED980(play, csCtx); } gSaveContext.cutsceneTrigger = 0; @@ -1494,7 +1494,7 @@ void func_800EDA84(GlobalContext* globalCtx, CutsceneContext* csCtx) { #ifdef NON_MATCHING // HandleFlags? // regalloc -void func_800EDBE0(GlobalContext* globalCtx) { +void func_800EDBE0(PlayState* play) { CutsceneEntry* temp_a3; s16 sp2A; SceneTableEntry* sp24; @@ -1505,7 +1505,7 @@ void func_800EDBE0(GlobalContext* globalCtx) { if (sp2A != -1) { temp_v0_3 = func_800F2138(sp2A); if (temp_v0_3 != -1) { - temp_a3 = ((void)0, globalCtx->csCtx.sceneCsList); + temp_a3 = ((void)0, play->csCtx.sceneCsList); if ((temp_a3[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { if (temp_a3[temp_v0_3].unk7 == 0xFE) { ActorCutscene_Start(sp2A, NULL); @@ -1525,11 +1525,11 @@ void func_800EDBE0(GlobalContext* globalCtx) { } if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { - sp24 = globalCtx->loadedScene; + sp24 = play->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { if ((Entrance_GetTransitionFlags(gSaveContext.sceneSetupIndex + gSaveContext.save.entranceIndex) & 0x4000) != 0) { - func_80151A68(globalCtx, sp24->titleTextId); + func_80151A68(play, sp24->titleTextId); } } @@ -1540,16 +1540,16 @@ void func_800EDBE0(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EDBE0.s") #endif -void func_800EDDB0(GlobalContext* globalCtx) { +void func_800EDDB0(PlayState* play) { } void func_800EDDBC(UNK_TYPE arg0, UNK_TYPE arg1) { } -void Cutscene_LoadCutsceneData(GlobalContext* globalCtx, u8 csIndex) { +void Cutscene_LoadCutsceneData(PlayState* play, u8 csIndex) { if (dREG(95) == 0) { - globalCtx->csCtx.currentCsIndex = csIndex; - globalCtx->csCtx.csData = Lib_SegmentedToVirtual(globalCtx->csCtx.sceneCsList[csIndex].segmentedData); + play->csCtx.currentCsIndex = csIndex; + play->csCtx.csData = Lib_SegmentedToVirtual(play->csCtx.sceneCsList[csIndex].segmentedData); } gSaveContext.cutsceneTrigger = 1; @@ -1561,10 +1561,10 @@ void Cutscene_LoadCutsceneData(GlobalContext* globalCtx, u8 csIndex) { * Interpolates the actor's position based on the corresponding actor action's position * and the current cutscene frame */ -void Cutscene_ActorTranslate(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex) { +void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 actorActionIndex) { Vec3f start; Vec3f end; - CsCmdActorAction* entry = globalCtx->csCtx.actorActions[actorActionIndex]; + CsCmdActorAction* entry = play->csCtx.actorActions[actorActionIndex]; f32 progress; start.x = entry->startPos.x; @@ -1574,7 +1574,7 @@ void Cutscene_ActorTranslate(Actor* actor, GlobalContext* globalCtx, s32 actorAc end.y = entry->endPos.y; end.z = entry->endPos.z; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, globalCtx->csCtx.frames); + progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); VEC3F_LERPIMPDST(&actor->world.pos, &start, &end, progress); } @@ -1583,10 +1583,10 @@ void Cutscene_ActorTranslate(Actor* actor, GlobalContext* globalCtx, s32 actorAc * Interpolates the actor's position based on the corresponding actor action's position * and the current cutscene frame, and sets the actor's yaw using the actor action yaw */ -void Cutscene_ActorTranslateAndYaw(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex) { - Cutscene_ActorTranslate(actor, globalCtx, actorActionIndex); +void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActionIndex) { + Cutscene_ActorTranslate(actor, play, actorActionIndex); - actor->world.rot.y = globalCtx->csCtx.actorActions[actorActionIndex]->urot.y; + actor->world.rot.y = play->csCtx.actorActions[actorActionIndex]->urot.y; actor->shape.rot.y = actor->world.rot.y; } @@ -1594,21 +1594,21 @@ void Cutscene_ActorTranslateAndYaw(Actor* actor, GlobalContext* globalCtx, s32 a * Interpolates the actor's position and yaw based on the corresponding actor action's * position and the current cutscene frame */ -void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex) { +void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex) { Vec3f start; Vec3f end; CsCmdActorAction* entry; f32 progress; - start.x = globalCtx->csCtx.actorActions[actorActionIndex]->startPos.x; - start.y = globalCtx->csCtx.actorActions[actorActionIndex]->startPos.y; - start.z = globalCtx->csCtx.actorActions[actorActionIndex]->startPos.z; - end.x = globalCtx->csCtx.actorActions[actorActionIndex]->endPos.x; - end.y = globalCtx->csCtx.actorActions[actorActionIndex]->endPos.y; - end.z = globalCtx->csCtx.actorActions[actorActionIndex]->endPos.z; + start.x = play->csCtx.actorActions[actorActionIndex]->startPos.x; + start.y = play->csCtx.actorActions[actorActionIndex]->startPos.y; + start.z = play->csCtx.actorActions[actorActionIndex]->startPos.z; + end.x = play->csCtx.actorActions[actorActionIndex]->endPos.x; + end.y = play->csCtx.actorActions[actorActionIndex]->endPos.y; + end.z = play->csCtx.actorActions[actorActionIndex]->endPos.z; - entry = globalCtx->csCtx.actorActions[actorActionIndex]; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, globalCtx->csCtx.frames); + entry = play->csCtx.actorActions[actorActionIndex]; + progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); VEC3F_LERPIMPDST(&actor->world.pos, &start, &end, progress); @@ -1620,19 +1620,19 @@ void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, GlobalContext* globalCtx, * Interpolates the actor's XZ position and yaw based on the corresponding actor action's * position and the current cutscene frame */ -void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, GlobalContext* globalCtx, s32 actorActionIndex) { +void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex) { Vec3f start; Vec3f end; CsCmdActorAction* entry; f32 progress; - start.x = globalCtx->csCtx.actorActions[actorActionIndex]->startPos.x; - start.z = globalCtx->csCtx.actorActions[actorActionIndex]->startPos.z; - end.x = globalCtx->csCtx.actorActions[actorActionIndex]->endPos.x; - end.z = globalCtx->csCtx.actorActions[actorActionIndex]->endPos.z; + start.x = play->csCtx.actorActions[actorActionIndex]->startPos.x; + start.z = play->csCtx.actorActions[actorActionIndex]->startPos.z; + end.x = play->csCtx.actorActions[actorActionIndex]->endPos.x; + end.z = play->csCtx.actorActions[actorActionIndex]->endPos.z; - entry = globalCtx->csCtx.actorActions[actorActionIndex]; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, globalCtx->csCtx.frames); + entry = play->csCtx.actorActions[actorActionIndex]; + progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); actor->world.pos.x = start.x + (end.x - start.x) * progress; actor->world.pos.z = start.z + (end.z - start.z) * progress; @@ -1641,7 +1641,7 @@ void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, GlobalContext* globalCt actor->shape.rot.y = actor->world.rot.y; } -s32 Cutscene_GetSceneSetupIndex(GlobalContext* globalCtx) { +s32 Cutscene_GetSceneSetupIndex(PlayState* play) { s32 sceneSetupIndex = 0; if (gSaveContext.sceneSetupIndex > 0) { @@ -1650,7 +1650,7 @@ s32 Cutscene_GetSceneSetupIndex(GlobalContext* globalCtx) { return sceneSetupIndex; } -s32 Cutscene_GetActorActionIndex(GlobalContext* globalCtx, u16 actorActionCmd) { +s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd) { s32 i; s32 index = -1; @@ -1663,20 +1663,20 @@ s32 Cutscene_GetActorActionIndex(GlobalContext* globalCtx, u16 actorActionCmd) { return index; } -s32 Cutscene_CheckActorAction(GlobalContext* globalCtx, u16 actorActionCmd) { - if (globalCtx->csCtx.state != CS_STATE_0) { - s32 index = Cutscene_GetActorActionIndex(globalCtx, actorActionCmd); +s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd) { + if (play->csCtx.state != CS_STATE_0) { + s32 index = Cutscene_GetActorActionIndex(play, actorActionCmd); if (index != -1) { - return globalCtx->csCtx.actorActions[index] != NULL; + return play->csCtx.actorActions[index] != NULL; } } return false; } -u8 Cutscene_IsPlaying(GlobalContext* globalCtx) { - return (gSaveContext.cutsceneTrigger != 0) || (globalCtx->csCtx.state != CS_STATE_0); +u8 Cutscene_IsPlaying(PlayState* play) { + return (gSaveContext.cutsceneTrigger != 0) || (play->csCtx.state != CS_STATE_0); } /* End of actor utilities section */ diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c index f959867fe1..2205d2d955 100644 --- a/src/code/z_eff_footmark.c +++ b/src/code/z_eff_footmark.c @@ -1,10 +1,10 @@ #include "global.h" -void EffFootmark_Init(GlobalContext* globalCtx) { +void EffFootmark_Init(PlayState* play) { EffFootmark* footmark; s32 i; - for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { footmark->actor = NULL; footmark->location.x = 0; footmark->location.y = 0; @@ -16,15 +16,15 @@ void EffFootmark_Init(GlobalContext* globalCtx) { } } -void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, - u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) { +void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, + u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) { s32 i; EffFootmark* footmark; EffFootmark* destination = NULL; EffFootmark* oldest = NULL; s32 isNew = 1; - for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) { if (fabsf((footmark->location).x - location->x) <= 1) { if (fabsf((footmark->location).z - location->z) <= 1) { @@ -70,11 +70,11 @@ void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor } } -void EffFootmark_Update(GlobalContext* globalCtx) { +void EffFootmark_Update(PlayState* play) { EffFootmark* footmark; s32 i; - for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { if ((footmark->flags & 1) == 1) { if (footmark->age < 0xFFFFu) { // TODO replace with MAX_U16 or something @@ -95,21 +95,21 @@ void EffFootmark_Update(GlobalContext* globalCtx) { } } -void EffFootmark_Draw(GlobalContext* globalCtx) { +void EffFootmark_Draw(PlayState* play) { EffFootmark* footmark; s32 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240); - for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { Matrix_Put(&footmark->displayMatrix); Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8); diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index e3a051fb4e..90833947b1 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -43,7 +43,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; } @@ -54,10 +54,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 697c553987..fd92516dfc 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -122,7 +122,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; @@ -199,7 +199,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 bd93f5eeda..b7c6af97e3 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_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_800AE2A0(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_OPA_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -23,14 +23,14 @@ void func_800AE2A0(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a POLY_OPA_DISP = displayListHead; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_800AE434(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { Gfx* displayListHead; f32 cos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); cos = Math_CosS((0x4000 / arg3) * arg2); displayListHead = POLY_OPA_DISP; @@ -41,26 +41,26 @@ void func_800AE434(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a POLY_OPA_DISP = displayListHead; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800AE5A0(GlobalContext* globalCtx) { +void func_800AE5A0(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_800AE5E4(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x8000 / arg3) * arg2); @@ -78,14 +78,14 @@ void func_800AE5E4(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a POLY_XLU_DISP = displayListHead; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { +void func_800AE778(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); displayListHead = POLY_XLU_DISP; cos = Math_CosS((0x4000 / arg3) * arg2); @@ -96,16 +96,16 @@ void func_800AE778(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a POLY_XLU_DISP = displayListHead; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_800AE8EC(GlobalContext* globalCtx) { +void func_800AE8EC(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - POLY_XLU_DISP = func_801660B8(globalCtx, POLY_XLU_DISP); + POLY_XLU_DISP = func_801660B8(play, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/code/z_effect.c b/src/code/z_effect.c index 4c446b6501..b4a76380ea 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -40,8 +40,8 @@ EffectInfo sEffectInfoTable[] = { }, }; -GlobalContext* Effect_GetGlobalCtx(void) { - return sEffectContext.globalCtx; +PlayState* Effect_GetPlayState(void) { + return sEffectContext.play; } void* Effect_GetByIndex(s32 index) { @@ -93,7 +93,7 @@ void Effect_InitStatus(EffectStatus* status) { status->unk2 = 0; } -void Effect_Init(GlobalContext* globalCtx) { +void Effect_Init(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { @@ -113,10 +113,10 @@ void Effect_Init(GlobalContext* globalCtx) { Effect_InitStatus(&sEffectContext.tireMarks[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) { u32 slotFound; s32 i; void* effect = NULL; @@ -124,7 +124,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg *pIndex = TOTAL_EFFECT_COUNT; - if (FrameAdvance_IsEnabled(&globalCtx->state) != true) { + if (FrameAdvance_IsEnabled(&play->state) != true) { slotFound = false; switch (type) { case EFFECT_SPARK: @@ -217,14 +217,14 @@ 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 (1) {} // necessary to match if (sEffectContext.sparks[i].status.active) { if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) { - Effect_Destroy(globalCtx, i); + Effect_Destroy(play, i); } } } @@ -233,7 +233,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { if (1) {} // necessary to match if (sEffectContext.blures[i].status.active) { if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) { - Effect_Destroy(globalCtx, i + SPARK_COUNT); + Effect_Destroy(play, i + SPARK_COUNT); } } } @@ -242,7 +242,7 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { if (1) {} // necessary to match if (sEffectContext.shieldParticles[i].status.active) { if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) { - Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT); + Effect_Destroy(play, i + SPARK_COUNT + BLURE_COUNT); } } } @@ -251,13 +251,13 @@ void Effect_UpdateAll(GlobalContext* globalCtx) { if (1) {} // necessary to match if (sEffectContext.tireMarks[i].status.active) { if (sEffectInfoTable[EFFECT_TIRE_MARK].update(&sEffectContext.tireMarks[i].effect) == 1) { - Effect_Destroy(globalCtx, i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT); + Effect_Destroy(play, i + SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT); } } } } -void Effect_Destroy(GlobalContext* globalCtx, s32 index) { +void Effect_Destroy(PlayState* play, s32 index) { if (index == TOTAL_EFFECT_COUNT) { return; } @@ -290,7 +290,7 @@ void Effect_Destroy(GlobalContext* globalCtx, s32 index) { } } -void Effect_DestroyAll(GlobalContext* globalCtx) { +void Effect_DestroyAll(PlayState* play) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 56eab9e8a4..422bb401e5 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -3,12 +3,12 @@ EffectSsInfo sEffectSsInfo = { NULL, 0, 0 }; -void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) { +void EffectSS_Init(PlayState* play, s32 numEntries) { u32 i; EffectSs* effectsSs; EffectSsOverlay* overlay; - sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&globalCtx->state.heap, numEntries * sizeof(EffectSs)); + sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&play->state.heap, numEntries * sizeof(EffectSs)); sEffectSsInfo.searchIndex = 0; sEffectSsInfo.size = numEntries; @@ -24,7 +24,7 @@ void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) { } } -void EffectSS_Clear(GlobalContext* globalCtx) { +void EffectSS_Clear(PlayState* play) { u32 i; EffectSs* effectsSs; EffectSsOverlay* overlay; @@ -150,10 +150,10 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { return false; } -void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) { +void EffectSS_Copy(PlayState* play, EffectSs* effectsSs) { s32 index; - if (FrameAdvance_IsEnabled(&globalCtx->state) != true) { + if (FrameAdvance_IsEnabled(&play->state) != true) { if (EffectSS_FindFreeSpace(effectsSs->priority, &index) == 0) { sEffectSsInfo.searchIndex = index + 1; sEffectSsInfo.data_table[index] = *effectsSs; @@ -161,7 +161,7 @@ void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) { } } -void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initData) { +void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) { s32 index; u32 overlaySize; EffectSsOverlay* entry = &gParticleOverlayTable[type]; @@ -199,13 +199,13 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init sEffectSsInfo.data_table[index].type = type; sEffectSsInfo.data_table[index].priority = priority; - if (initInfo->init(globalCtx, index, &sEffectSsInfo.data_table[index], initData) == 0) { + if (initInfo->init(play, index, &sEffectSsInfo.data_table[index], initData) == 0) { EffectSS_ResetEntry(&sEffectSsInfo.data_table[index]); } } } -void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) { +void EffectSS_UpdateParticle(PlayState* play, s32 index) { EffectSs* particle = &sEffectSsInfo.data_table[index]; if (particle->update != NULL) { @@ -217,11 +217,11 @@ void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) { particle->pos.y += particle->velocity.y; particle->pos.z += particle->velocity.z; - particle->update(globalCtx, index, particle); + particle->update(play, index, particle); } } -void EffectSS_UpdateAllParticles(GlobalContext* globalCtx) { +void EffectSS_UpdateAllParticles(PlayState* play) { s32 i; for (i = 0; i < sEffectSsInfo.size; i++) { @@ -234,25 +234,25 @@ void EffectSS_UpdateAllParticles(GlobalContext* globalCtx) { } if (sEffectSsInfo.data_table[i].life > -1) { - EffectSS_UpdateParticle(globalCtx, i); + EffectSS_UpdateParticle(play, i); } } } -void EffectSS_DrawParticle(GlobalContext* globalCtx, s32 index) { +void EffectSS_DrawParticle(PlayState* play, s32 index) { EffectSs* entry = &sEffectSsInfo.data_table[index]; if (entry->draw != NULL) { - entry->draw(globalCtx, index, entry); + entry->draw(play, index, entry); } } -void EffectSS_DrawAllParticles(GlobalContext* globalCtx) { - Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); +void EffectSS_DrawAllParticles(PlayState* play) { + Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); s32 i; - Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL, globalCtx); - Lights_Draw(lights, globalCtx->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, NULL, play); + Lights_Draw(lights, play->state.gfxCtx); for (i = 0; i < sEffectSsInfo.size; i++) { if (sEffectSsInfo.data_table[i].life > -1) { @@ -264,7 +264,7 @@ void EffectSS_DrawAllParticles(GlobalContext* globalCtx) { (sEffectSsInfo.data_table[i].pos.z < BGCHECK_Y_MIN)) { EffectSS_Delete(&sEffectSsInfo.data_table[i]); } else { - EffectSS_DrawParticle(globalCtx, i); + EffectSS_DrawParticle(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 1e9b255736..c7b073540f 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -32,8 +32,8 @@ #include "overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h" #include "overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h" -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; @@ -41,14 +41,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); 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[0x06] = PHYSICAL_TO_VIRTUAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); @@ -70,7 +70,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; @@ -86,80 +86,78 @@ 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_800B0DE0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0DE0(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_800B0E48(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0E48(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_800B0EB0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0EB0(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_800B0F18(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0F18(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_800B0F80(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0F80(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); } -void func_800B0FE8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B0FE8(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); } -void func_800B1054(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B1054(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_800B10C0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } -void func_800B1130(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); +void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { + EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } -void func_800B11A0(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_800B11A0(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_800B1210(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_800B1210(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_800B1280(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_800B1280(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_800B12F0(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_800B12F0(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); } -void func_800B1360(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_800B0DE0(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_800B0DE0(play, pos, velocity, accel, primColor, envColor, 100, 5); } -void func_800B139C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, +void func_800B139C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor) { - func_800B0E48(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5); + func_800B0E48(play, pos, velocity, accel, primColor, envColor, 100, 5); } void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) { @@ -182,7 +180,7 @@ void func_800B13D8(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, accel->z = 0.0f; } -void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_800B14D4(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -190,11 +188,11 @@ void func_800B14D4(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_800B13D8(srcPos, randScale, &pos, &velocity, &accel); - func_800B1280(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_800B1280(play, &pos, &velocity, &accel, 100, 30, 7); } } -void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { +void func_800B1598(PlayState* play, f32 randScale, Vec3f* srcPos) { s32 i; Vec3f pos; Vec3f velocity; @@ -202,24 +200,24 @@ void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { for (i = 0; i < 20; i++) { func_800B13D8(srcPos, randScale, &pos, &velocity, &accel); - func_800B12F0(globalCtx, &pos, &velocity, &accel, 100, 30, 7); + func_800B12F0(play, &pos, &velocity, &accel, 100, 30, 7); } } -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); @@ -236,11 +234,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); @@ -255,10 +253,10 @@ 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); } -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); @@ -268,11 +266,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); @@ -282,12 +279,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) { EffectSsBlastInitParams initParams; @@ -301,32 +298,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; @@ -340,11 +337,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; @@ -358,19 +355,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; @@ -384,16 +381,16 @@ 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, s16 arg8, s32 life) { EffectSsDFireInitParams initParams; @@ -407,12 +404,12 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.unk_2C = arg8; initParams.life = life; - EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams); } // 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; @@ -422,12 +419,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); @@ -435,13 +432,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); @@ -456,23 +453,23 @@ void EffectSsGSplash_Spawn(GlobalContext* globalCtx, Vec3f* pos, Color_RGBA8* pr initParams.customColor = 0; } - EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPLASH, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_G_SPLASH, 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); @@ -483,13 +480,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); @@ -501,10 +498,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; @@ -518,7 +515,7 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec initParams.randXZ = randXZ; initParams.customColor = 1; - EffectSs_Spawn(globalCtx, EFFECT_SS_DT_BUBBLE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams); } // EffectSsHahen Spawn Functions @@ -532,8 +529,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); @@ -545,7 +542,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); } /** @@ -557,8 +554,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; @@ -571,15 +568,15 @@ 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); } } -void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) { +void func_800B2364(PlayState* play, Vec3f* pos, Gfx* dList) { Vec3f accel = { 0.0f, -2.0f, 0.0f }; - EffectSsHahen_Spawn(globalCtx, pos, &gZeroVec3f, &accel, 1, 5, 1, 10, dList); + EffectSsHahen_Spawn(play, pos, &gZeroVec3f, &accel, 1, 5, 1, 10, dList); } // EffectSsStick Spawn Functions @@ -588,19 +585,19 @@ void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) { * 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); @@ -610,48 +607,48 @@ 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 zeroVec = { 0.0f, 0.0f, 0.0f }; 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); } } // EffectSsStone1 Spawn Functions -void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 reg0) { +void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0) { EffectSsStone1InitParams initParams; initParams.pos = *pos; initParams.reg0 = reg0; - 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 @@ -664,7 +661,7 @@ void EffectSsHitMark_SpawnCustomScale(GlobalContext* globalCtx, s32 type, s16 sc * 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; @@ -673,12 +670,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); @@ -687,12 +684,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, s16 drawFlag) { EffectSsSolderSrchBallInitParams initParams; @@ -703,14 +700,14 @@ void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v initParams.linkDetected = linkDetected; initParams.drawFlag = drawFlag; - 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); @@ -729,12 +726,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); @@ -742,10 +739,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 }, @@ -776,15 +773,15 @@ 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, Color_RGBA8* prim, - Color_RGBA8* env, f32 scale) { +void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, + f32 scale) { EffectSsEnIceInitParams initParams; initParams.actor = actor; @@ -798,25 +795,25 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3 Actor_PlaySfxAtPos(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 func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale) { +void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) { static Color_RGBA8 primColor = { 150, 150, 150, 250 }; static Color_RGBA8 envColor = { 235, 245, 255, 255 }; - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, actor, pos, &primColor, &envColor, scale); + EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale); } -void func_800B2B7C(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, f32 scale) { +void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) { Vec3f dest; Math_Vec3s_ToVec3f(&dest, arg2); - func_800B2B44(globalCtx, actor, &dest, scale); + func_800B2B44(play, actor, &dest, scale); } -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); @@ -828,12 +825,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; @@ -848,10 +845,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 }; @@ -863,20 +860,19 @@ 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 -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; @@ -891,10 +887,10 @@ void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* po Actor_PlaySfxAtPos(actor, NA_SE_EV_FLAME_IGNITION); } - EffectSs_Spawn(globalCtx, EFFECT_SS_EN_FIRE, 128, &initParams); + EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } -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; @@ -911,12 +907,12 @@ void EffectSsEnFire_SpawnVec3s(GlobalContext* globalCtx, Actor* actor, Vec3s* po Actor_PlaySfxAtPos(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); @@ -925,12 +921,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); } // EffectSsDeadDb Spawn Functions -void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, +void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) { EffectSsDeadDbInitParams initParams; @@ -948,10 +944,10 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.envColor.b = env->b; initParams.unk_30 = unk; - EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams); + EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams); } -void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, +void func_800B3030(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex) { static Color_RGBA8 primColor = { 255, 255, 255, 255 }; static Color_RGBA8 envColors[] = { @@ -961,12 +957,12 @@ void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* { 150, 150, 150, 255 }, }; - EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColors[colorIndex], scale, scaleStep, 9); + EffectSsDeadDb_Spawn(play, pos, velocity, accel, &primColor, &envColors[colorIndex], scale, scaleStep, 9); } // EffectSsDeadDd Spawn Functions -void EffectSsDeadDd_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, +void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s16 alphaStep, s32 life) { EffectSsDeadDdInitParams initParams; @@ -986,12 +982,12 @@ 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); } // 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; @@ -1002,16 +998,16 @@ 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 func_800B31BC(GlobalContext* globalCtx, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) { - EffectSsDeadDs_Spawn(globalCtx, pos, &gZeroVec3f, &gZeroVec3f, scale, scaleStep, alpha, life); +void func_800B31BC(PlayState* play, Vec3f* pos, s16 scale, s16 scaleStep, s16 alpha, s32 life) { + EffectSsDeadDs_Spawn(play, pos, &gZeroVec3f, &gZeroVec3f, scale, scaleStep, alpha, life); } // EffectSsIceSmoke Spawn Functions -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); @@ -1019,12 +1015,12 @@ 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); } // EffectSsIceBlock Spawn Functions -void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { +void EffectSsIceBlock_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale) { EffectEnIceBlockInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -1032,5 +1028,5 @@ void EffectSsIceBlock_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocit Math_Vec3f_Copy(&initParams.accel, accel); initParams.scale = scale; - EffectSs_Spawn(globalCtx, EFFECT_EN_ICE_BLOCK, 128, &initParams); + EffectSs_Spawn(play, EFFECT_EN_ICE_BLOCK, 128, &initParams); } diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index cd2fa96b6e..57e84e86bf 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -1,6 +1,6 @@ #include "global.h" -u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { +u16 ElfMessage_GetFirstCycleHint(PlayState* play) { if (INV_CONTENT(ITEM_OCARINA) == ITEM_OCARINA) { return 0; } @@ -20,7 +20,7 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { if (gSaveContext.save.weekEventReg[9] & 1) { return 0x21E; } - if (globalCtx->sceneNum == SCENE_YOUSEI_IZUMI) { + if (play->sceneNum == SCENE_YOUSEI_IZUMI) { return 0; } return 0x21D; @@ -29,7 +29,7 @@ u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx) { return 0x21F; } if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) { - if (globalCtx->sceneNum != SCENE_OKUJOU) { + if (play->sceneNum != SCENE_OKUJOU) { return 0x244; } return 0; diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 1d083b2c7a..267da4e40f 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -2,56 +2,56 @@ #define THIS ((EnAObj*)thisx) -void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx); -void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx); +void EnAObj_Update1(EnAObj* this, PlayState* play); +void EnAObj_Update2(EnAObj* this, PlayState* play); -void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Init(Actor* thisx, PlayState* play) { EnAObj* this = THIS; this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300; this->actor.params = (this->actor.params & 0xFF) - 9; Actor_ProcessInitChain(&this->actor, &enAObjInitVar); ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 12); - Collider_InitAndSetCylinder(globalCtx, &this->collision, &this->actor, &enAObjCylinderInit); + Collider_InitAndSetCylinder(play, &this->collision, &this->actor, &enAObjCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collision); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = EnAObj_Update1; } -void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Destroy(Actor* thisx, PlayState* play) { EnAObj* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collision); + Collider_DestroyCylinder(play, &this->collision); } -void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx) { +void EnAObj_Update1(EnAObj* this, PlayState* play) { s32 yawDiff; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnAObj_Update2; } else { yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } } -void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnAObj_Update2(EnAObj* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnAObj_Update1; } } -void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAObj_Update(Actor* thisx, PlayState* play) { EnAObj* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 45.0f); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collision.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collision.base); } -void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, enAObjDisplayLists[thisx->params]); +void EnAObj_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, enAObjDisplayLists[thisx->params]); } diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 28c1770680..6549ed9e19 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -58,7 +58,7 @@ s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { return isChanged; } -EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) { +EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { EnDoor* nearestDoor = NULL; Actor* doorIter = NULL; f32 dist; @@ -67,7 +67,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) { f32 minDist = 0.0f; do { - doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); + doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); door = (EnDoor*)doorIter; dist = Actor_DistanceBetweenActors(actor, &door->dyna.actor); if (!isSetup || (dist < minDist)) { @@ -83,16 +83,16 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) { return nearestDoor; } -void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment); +void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment); EnHy_ChangeAnim(&enHy->skelAnime, animIndex); } -s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx) { +s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play) { s32 isUpdated = false; if (enHy->actor.draw != NULL) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment); SkelAnime_Update(&enHy->skelAnime); isUpdated = true; } @@ -109,26 +109,26 @@ void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) { } } -s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) { +s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) { s32 isInitialized = false; - if ((SubS_IsObjectLoaded(enHy->animObjIndex, globalCtx) == true) && - (SubS_IsObjectLoaded(enHy->headObjIndex, globalCtx) == true) && - (SubS_IsObjectLoaded(enHy->skelUpperObjIndex, globalCtx) == true) && - (SubS_IsObjectLoaded(enHy->skelLowerObjIndex, globalCtx) == true)) { + if ((SubS_IsObjectLoaded(enHy->animObjIndex, play) == true) && + (SubS_IsObjectLoaded(enHy->headObjIndex, play) == true) && + (SubS_IsObjectLoaded(enHy->skelUpperObjIndex, play) == true) && + (SubS_IsObjectLoaded(enHy->skelLowerObjIndex, play) == true)) { enHy->actor.objBankIndex = enHy->skelLowerObjIndex; isInitialized = true; ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->actor.objBankIndex].segment); - SkelAnime_InitFlex(globalCtx, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable, + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->actor.objBankIndex].segment); + SkelAnime_InitFlex(play, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable, ENHY_LIMB_MAX); - EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); + EnHy_ChangeObjectAndAnim(enHy, play, animIndex); } return isInitialized; } -void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, s16 arg4) { +void func_800F0BB4(EnHy* enHy, PlayState* play, EnDoor* door, s16 arg3, s16 arg4) { s32 pad; s8 animIndex; Vec3f offset; @@ -137,26 +137,26 @@ void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, Actor_OffsetOfPointInActorCoords(&door->dyna.actor, &offset, &enHy->actor.world.pos); phi_f0 = (offset.z >= 0.0f) ? 1.0f : -1.0f; animIndex = ((s8)phi_f0 < 0) ? 0 : 2; - EnHy_ChangeObjectAndAnim(enHy, globalCtx, (animIndex == 0) ? arg3 : arg4); + EnHy_ChangeObjectAndAnim(enHy, play, (animIndex == 0) ? arg3 : arg4); enHy->skelAnime.baseTransl = *enHy->skelAnime.jointTable; enHy->skelAnime.prevTransl = *enHy->skelAnime.jointTable; enHy->skelAnime.moveFlags |= 3; - AnimationContext_SetMoveActor(globalCtx, &enHy->actor, &enHy->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &enHy->actor, &enHy->skelAnime, 1.0f); door->unk_1A1 = 1; door->animIndex = animIndex; } -s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) { +s32 func_800F0CE4(EnHy* enHy, PlayState* play, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) { s32 ret = false; s16 yaw; EnDoor* door; s32 pad; if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) { - door = EnHy_FindNearestDoor(&enHy->actor, globalCtx); + door = EnHy_FindNearestDoor(&enHy->actor, play); if (door != NULL) { ret = true; - func_800F0BB4(enHy, globalCtx, door, arg3, arg4); + func_800F0BB4(enHy, play, door, arg3, arg4); yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos); enHy->actor.world.pos.x += arg5 * Math_SinS(yaw); enHy->actor.world.pos.z += arg5 * Math_CosS(yaw); @@ -168,17 +168,17 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3 return ret; } -s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) { +s32 func_800F0DD4(EnHy* enHy, PlayState* play, s16 arg2, s16 arg3) { s32 ret = false; s32 pad; EnDoor* door; enHy->curPoint = 0; if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) { - door = EnHy_FindNearestDoor(&enHy->actor, globalCtx); + door = EnHy_FindNearestDoor(&enHy->actor, play); if (door != NULL) { ret = true; - func_800F0BB4(enHy, globalCtx, door, arg2, arg3); + func_800F0BB4(enHy, play, door, arg2, arg3); enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos); enHy->actor.world.rot.y = enHy->actor.shape.rot.y; enHy->actor.gravity = 0.0f; @@ -188,16 +188,16 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) { return ret; } -s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex) { +s32 EnHy_SetPointFowards(EnHy* enHy, PlayState* play, f32 gravity, s16 animIndex) { enHy->actor.gravity = gravity; enHy->actor.flags |= ACTOR_FLAG_1; - EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); + EnHy_ChangeObjectAndAnim(enHy, play, animIndex); enHy->curPoint++; return false; } -s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) { - EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex); +s32 EnHy_SetPointBackwards(EnHy* enHy, PlayState* play, s16 animIndex) { + EnHy_ChangeObjectAndAnim(enHy, play, animIndex); enHy->curPoint--; return false; } @@ -238,16 +238,16 @@ s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) { return reachedEnd; } -void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx) { +void EnHy_UpdateCollider(EnHy* enHy, PlayState* play) { enHy->collider.dim.pos.x = enHy->actor.world.pos.x; enHy->collider.dim.pos.y = enHy->actor.world.pos.y; enHy->collider.dim.pos.z = enHy->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &enHy->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &enHy->collider.base); } -s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThreshold) { +s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) { u8 wasLeftFootOnGround = enHy->isLeftFootOnGround; u8 wasRightFootOnGround = enHy->isRightFootOnGround; s32 waterSfxId; @@ -262,15 +262,15 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThr } sfxId = waterSfxId + SFX_FLAG; } else { - sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG; + sfxId = SurfaceType_GetSfx(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG; } - enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->leftFootPos, distAboveThreshold); + enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->leftFootPos, distAboveThreshold); if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) { Actor_PlaySfxAtPos(&enHy->actor, sfxId); } - enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->rightFootPos, distAboveThreshold); + enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->rightFootPos, distAboveThreshold); if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) { Actor_PlaySfxAtPos(&enHy->actor, sfxId); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 7ba6134fbe..0e783e76c9 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -6,16 +6,16 @@ #define THIS ((EnItem00*)thisx) -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 EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx); -void func_800A640C(EnItem00* this, GlobalContext* globalCtx); -void func_800A6650(EnItem00* this, GlobalContext* globalCtx); -void func_800A6780(EnItem00* this, GlobalContext* globalCtx); -void func_800A6A40(EnItem00* this, GlobalContext* globalCtx); +void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play); +void func_800A640C(EnItem00* this, PlayState* play); +void func_800A6650(EnItem00* this, PlayState* play); +void func_800A6780(EnItem00* this, PlayState* play); +void func_800A6A40(EnItem00* this, PlayState* play); const ActorInit En_Item00_InitVars = { ACTOR_EN_ITEM00, @@ -53,8 +53,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOffset, f32* shadowScale) { - Actor_SetObjectDependency(globalCtx, &this->actor); +void EnItem00_SetObject(EnItem00* this, PlayState* play, f32* shadowOffset, f32* shadowScale) { + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.5f); this->unk154 = 0.5f; *shadowOffset = 0.0f; @@ -62,7 +62,7 @@ void EnItem00_SetObject(EnItem00* this, GlobalContext* globalCtx, f32* shadowOff this->actor.world.rot.x = 0x4000; } -void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Init(Actor* thisx, PlayState* play) { EnItem00* this = THIS; s32 pad; f32 shadowOffset = 980.0f; @@ -74,7 +74,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 0xFF; // Has to be thisx to match - if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) { + if (Flags_GetCollectible(play, this->collectibleFlag)) { if (this->actor.params == ITEM00_HEART_PIECE) { sp30 = 0; this->collectibleFlag = 0; @@ -89,7 +89,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk150 = 1; @@ -164,16 +164,16 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk154 = 0.01f; break; case ITEM00_SHIELD_HERO: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_SHIELD_2); - EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2); + EnItem00_SetObject(this, play, &shadowOffset, &shadowScale); break; case ITEM00_MAP: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MAP); - EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_MAP); + EnItem00_SetObject(this, play, &shadowOffset, &shadowScale); break; case ITEM00_COMPASS: - this->actor.objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_COMPASS); - EnItem00_SetObject(this, globalCtx, &shadowOffset, &shadowScale); + this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_COMPASS); + EnItem00_SetObject(this, play, &shadowOffset, &shadowScale); break; default: break; @@ -205,51 +205,51 @@ 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_HUGE: - Item_Give(globalCtx, ITEM_RUPEE_HUGE); + Item_Give(play, ITEM_RUPEE_HUGE); break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: - func_80115908(globalCtx, 0x70); + func_80115908(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_10: - Item_Give(globalCtx, ITEM_ARROWS_10); + Item_Give(play, ITEM_ARROWS_10); break; case ITEM00_ARROWS_30: - Item_Give(globalCtx, ITEM_ARROWS_30); + Item_Give(play, ITEM_ARROWS_30); break; case ITEM00_ARROWS_40: - Item_Give(globalCtx, ITEM_ARROWS_40); + Item_Give(play, ITEM_ARROWS_40); break; case ITEM00_ARROWS_50: - Item_Give(globalCtx, ITEM_ARROWS_50); + Item_Give(play, ITEM_ARROWS_50); break; case ITEM00_MAGIC_LARGE: - Item_Give(globalCtx, ITEM_MAGIC_LARGE); + Item_Give(play, ITEM_MAGIC_LARGE); break; case ITEM00_MAGIC_SMALL: - Item_Give(globalCtx, ITEM_MAGIC_SMALL); + Item_Give(play, ITEM_MAGIC_SMALL); break; case ITEM00_SMALL_KEY: - Item_Give(globalCtx, ITEM_KEY_SMALL); + Item_Give(play, ITEM_KEY_SMALL); break; case ITEM00_NUTS_1: getItemId = GI_NUTS_1; @@ -261,31 +261,31 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { break; } - if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, globalCtx) == 0)) { - Actor_PickUp(&this->actor, globalCtx, getItemId, 50.0f, 20.0f); + if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, play) == 0)) { + Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f); } this->actionFunc = func_800A6A40; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Destroy(Actor* thisx, PlayState* play) { EnItem00* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnItem00_WaitForHeartObject(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play) { s32 sp1C; - sp1C = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEARTS); - if (Object_IsLoaded(&globalCtx->objectCtx, sp1C)) { + sp1C = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS); + if (Object_IsLoaded(&play->objectCtx, sp1C)) { this->actor.objBankIndex = sp1C; this->actionFunc = func_800A640C; } } -void func_800A640C(EnItem00* this, GlobalContext* globalCtx) { +void func_800A640C(EnItem00* this, PlayState* play) { if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk152 < 0)) || (this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) { this->actor.shape.rot.y = this->actor.shape.rot.y + 960; @@ -335,18 +335,18 @@ static Color_RGBA8 D_801ADF14 = { 255, 255, 255, 0 }; static Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f }; static Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f }; -void func_800A6650(EnItem00* this, GlobalContext* globalCtx) { +void func_800A6650(EnItem00* this, PlayState* play) { u32 pad; Vec3f pos; if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y = this->actor.shape.rot.y + 960; } - if ((globalCtx->gameplayFrames & 1) != 0) { + if ((play->gameplayFrames & 1) != 0) { pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f); pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f); pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f); - EffectSsKirakira_SpawnSmall(globalCtx, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); + EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); } if ((this->actor.bgCheckFlags & 3) != 0) { if (this->actor.velocity.y > -2.0f) { @@ -359,7 +359,7 @@ void func_800A6650(EnItem00* this, GlobalContext* globalCtx) { } } -void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { +void func_800A6780(EnItem00* this, PlayState* play) { s32 pad; Vec3f pos; s32 var1; @@ -399,11 +399,11 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 1) == 0) { + if ((play->gameplayFrames & 1) == 0) { 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, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); + EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14); } if (this->actor.bgCheckFlags & 0x0003) { @@ -413,12 +413,12 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { } } -void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_800A6A40(EnItem00* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk14A != GI_NONE) { - if (Actor_HasParent(&this->actor, globalCtx) == 0) { - Actor_PickUp(&this->actor, globalCtx, this->unk14A, 50.0f, 80.0f); + if (Actor_HasParent(&this->actor, play) == 0) { + Actor_PickUp(&this->actor, play, this->unk14A, 50.0f, 80.0f); this->unk152++; } else { this->unk14A = GI_NONE; @@ -445,10 +445,10 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { } } -void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Update(Actor* thisx, PlayState* play) { EnItem00* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp38 = player->stateFlags3 & 0x1000; s32 getItemId = GI_NONE; s32 params; @@ -461,7 +461,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk14E = this->unk152; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Math_SmoothStepToF(&this->actor.scale.x, this->unk154, 0.1f, this->unk154 * 0.1f, 0.0f); this->actor.scale.z = this->actor.scale.x; @@ -469,7 +469,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.gravity != 0.0f) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D); if (this->actor.floorHeight <= BGCHECK_Y_MIN) { Actor_MarkForDeath(&this->actor); @@ -478,7 +478,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); params = this->actor.params; if ((params == ITEM00_SHIELD_HERO) || (params == ITEM00_MAP) || (params == ITEM00_COMPASS)) { @@ -493,35 +493,35 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { (this->actor.playerHeightRel <= 100.0f)) && !((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.playerHeightRel >= -50.0f) && (this->actor.playerHeightRel <= 50.0f))) { - if (!Actor_HasParent(&this->actor, globalCtx)) { + if (!Actor_HasParent(&this->actor, play)) { return; } } - if (globalCtx->gameOverCtx.state != 0) { + if (play->gameOverCtx.state != 0) { return; } switch (this->actor.params) { case ITEM00_RUPEE_GREEN: this->unk1A4 = 1; - Item_Give(globalCtx, ITEM_RUPEE_GREEN); + Item_Give(play, ITEM_RUPEE_GREEN); break; case ITEM00_RUPEE_BLUE: this->unk1A4 = 1; - Item_Give(globalCtx, ITEM_RUPEE_BLUE); + Item_Give(play, ITEM_RUPEE_BLUE); break; case ITEM00_RUPEE_RED: this->unk1A4 = 1; - Item_Give(globalCtx, ITEM_RUPEE_RED); + Item_Give(play, ITEM_RUPEE_RED); break; case ITEM00_RUPEE_PURPLE: this->unk1A4 = 1; - Item_Give(globalCtx, ITEM_RUPEE_PURPLE); + Item_Give(play, ITEM_RUPEE_PURPLE); break; case ITEM00_RUPEE_HUGE: this->unk1A4 = 1; - Item_Give(globalCtx, ITEM_RUPEE_HUGE); + Item_Give(play, ITEM_RUPEE_HUGE); break; case ITEM00_STICK: getItemId = GI_STICKS_1; @@ -533,27 +533,27 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_NUTS_10; break; case ITEM00_HEART: - Item_Give(globalCtx, ITEM_HEART); + Item_Give(play, ITEM_HEART); break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: - func_80115908(globalCtx, 0x70); + func_80115908(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_10: - Item_Give(globalCtx, ITEM_ARROWS_10); + Item_Give(play, ITEM_ARROWS_10); break; case ITEM00_ARROWS_30: - Item_Give(globalCtx, ITEM_ARROWS_30); + Item_Give(play, ITEM_ARROWS_30); break; case ITEM00_ARROWS_40: - Item_Give(globalCtx, ITEM_ARROWS_40); + Item_Give(play, ITEM_ARROWS_40); break; case ITEM00_ARROWS_50: - Item_Give(globalCtx, ITEM_ARROWS_50); + Item_Give(play, ITEM_ARROWS_50); break; case ITEM00_SMALL_KEY: getItemId = GI_KEY_SMALL; @@ -565,10 +565,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { getItemId = GI_HEART_CONTAINER; break; case ITEM00_MAGIC_LARGE: - Item_Give(globalCtx, ITEM_MAGIC_LARGE); + Item_Give(play, ITEM_MAGIC_LARGE); break; case ITEM00_MAGIC_SMALL: - Item_Give(globalCtx, ITEM_MAGIC_SMALL); + Item_Give(play, ITEM_MAGIC_SMALL); break; case ITEM00_SHIELD_HERO: getItemId = GI_SHIELD_HERO; @@ -584,8 +584,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } if (getItemId != GI_NONE) { - if (!Actor_HasParent(&this->actor, globalCtx)) { - Actor_PickUp(&this->actor, globalCtx, getItemId, 50.0f, 20.0f); + if (!Actor_HasParent(&this->actor, play)) { + Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f); } } @@ -596,8 +596,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_SHIELD_HERO: case ITEM00_MAP: case ITEM00_COMPASS: - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, this->collectibleFlag); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, this->collectibleFlag); Actor_MarkForDeath(&this->actor); } return; @@ -608,8 +608,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params <= ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_RUPEE_HUGE)) { play_sound(NA_SE_SY_GET_RUPY); } 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_MarkForDeath(&this->actor); } return; @@ -617,7 +617,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { play_sound(NA_SE_SY_GET_ITEM); } - Flags_SetCollectible(globalCtx, this->collectibleFlag); + Flags_SetCollectible(play, this->collectibleFlag); this->unk152 = 15; this->unk14C = 35; @@ -632,12 +632,12 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_800A6A40; } -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx); -void EnItem00_DrawSprite(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_DrawSprite(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play); +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play); -void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnItem00_Draw(Actor* thisx, PlayState* play) { s32 pad; EnItem00* this = THIS; @@ -648,26 +648,26 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_RUPEE_RED: case ITEM00_RUPEE_HUGE: 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->unk152 < 0) { if (this->unk152 == -1) { - s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); - if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { + s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART); + if (Object_IsLoaded(&play->objectCtx, bankIndex)) { this->actor.objBankIndex = bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->unk152 = -2; } } else { Matrix_Scale(16.0f, 16.0f, 16.0f, MTXMODE_APPLY); - GetItem_Draw(globalCtx, 8); + GetItem_Draw(play, 8); } break; } @@ -684,16 +684,16 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_SMALL_KEY: case ITEM00_NUTS_10: case ITEM00_BOMBS_0: - EnItem00_DrawSprite(this, globalCtx); + EnItem00_DrawSprite(this, play); break; case ITEM00_SHIELD_HERO: - GetItem_Draw(globalCtx, GID_SHIELD_HERO); + GetItem_Draw(play, GID_SHIELD_HERO); break; case ITEM00_MAP: - GetItem_Draw(globalCtx, GID_DUNGEON_MAP); + GetItem_Draw(play, GID_DUNGEON_MAP); break; case ITEM00_COMPASS: - GetItem_Draw(globalCtx, GID_COMPASS); + GetItem_Draw(play, GID_COMPASS); case ITEM00_MASK: case ITEM00_FLEXIBLE: case ITEM00_3_HEARTS: @@ -712,14 +712,14 @@ TexturePtr D_801ADF30[] = { gameplay_keep_Tex_062020 // Purple rupee }; -void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawRupee(EnItem00* this, PlayState* play) { s32 pad; s32 iconNb; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, 0); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); if (this->actor.params <= ITEM00_RUPEE_RED) { iconNb = this->actor.params; @@ -727,13 +727,13 @@ void EnItem00_DrawRupee(EnItem00* this, GlobalContext* globalCtx) { iconNb = this->actor.params - 0x10; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF30[iconNb])); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); // TODO symbol - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } TexturePtr D_801ADF44[12] = { @@ -751,12 +751,12 @@ TexturePtr D_801ADF44[12] = { gameplay_keep_Tex_05F7C0 // Small Key }; -void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawSprite(EnItem00* this, PlayState* play) { s32 iconNb = this->actor.params - 3; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); if (this->actor.params == ITEM00_NUTS_10) { iconNb = 6; @@ -773,45 +773,45 @@ void EnItem00_DrawSprite(EnItem00* this, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF44[iconNb])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnItem00_DrawHeartContainer(EnItem00* actor, GlobalContext* globalCtx) { +void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) { s32 pad; s32 pad2; - if (Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Scale(20.0f, 20.0f, 20.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001290); gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001470); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { +void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&this->actor, globalCtx, 0); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s16 func_800A7650(s16 dropId) { @@ -834,7 +834,7 @@ s16 func_800A7650(s16 dropId) { return dropId; } -Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params) { +Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { s32 pad; Actor* spawnedActor = NULL; s32 newParamFF; @@ -850,29 +850,28 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param if (paramFF == ITEM00_3_HEARTS) { for (i = 0; i < 3; i++) { - spawnedActor = Item_DropCollectible(globalCtx, spawnPos, param7F00 | ITEM00_HEART | param8000); + spawnedActor = Item_DropCollectible(play, spawnPos, param7F00 | ITEM00_HEART | param8000); } } else if (paramFF == ITEM00_MUSHROOM_CLOUD) { param7F00 >>= 8; - if (!Flags_GetCollectible(globalCtx, param7F00)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, - 0, param7F00); + if (!Flags_GetCollectible(play, param7F00)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_KINOKO, spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, + param7F00); } } else if (((paramFF == ITEM00_FLEXIBLE) || (newParamFF == ITEM00_BIG_FAIRY)) && (param10000 == 0)) { newParamFF = params & 0xFF; if (newParamFF == ITEM00_FLEXIBLE) { - spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); - if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) { + SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } else { - spawnedActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, + spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); if (param20000 == 0) { - if (!Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) { + SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } } @@ -881,8 +880,8 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param params = func_800A7650(newParamFF); } if ((s32)params != ITEM00_NO_DROP) { - spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, - spawnPos->z, 0, 0, 0, (s32)params | param8000 | param7F00); + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, + 0, 0, (s32)params | param8000 | param7F00); if ((spawnedActor != NULL) && (param8000 == 0)) { if (param10000 == 0) { spawnedActor->velocity.y = 8.0f; @@ -907,7 +906,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, u32 param return spawnedActor; } -Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 params) { +Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { Actor* spawnedActor = NULL; s32 pad; s32 param10000 = params & 0x10000; @@ -922,21 +921,20 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s32 para if ((((params & 0xFF) == ITEM00_FLEXIBLE) || ((params & 0xFF) == ITEM00_BIG_FAIRY)) && (param10000 == 0)) { if ((params & 0xFF) == ITEM00_FLEXIBLE) { - spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); } else { - spawnedActor = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, + spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); } - if (Flags_GetCollectible(globalCtx, (param7F00 >> 8) & 0x7F) == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + if (Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F) == 0) { + SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } else { params = func_800A7650(params & 0xFF); if (params != ITEM00_NO_DROP) { - spawnedActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, - spawnPos->z, 0, 0, 0, (s32)params | param8000 | param7F00); + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, spawnPos->z, 0, + 0, 0, (s32)params | param8000 | param7F00); if (spawnedActor != NULL) { if (param8000 == 0) { spawnedActor->velocity.y = 0.0f; @@ -1032,7 +1030,7 @@ u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, }; -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) { +void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params) { EnItem00* spawnedActor; u8 dropId; s32 dropQuantity; @@ -1084,9 +1082,9 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (dropId == ITEM00_FLEXIBLE) { if (gSaveContext.save.playerData.health <= 0x10) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, 2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, + 2); + SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); return; } @@ -1129,8 +1127,8 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 if (param8000 == 0) { dropId = func_800A7650(dropId); if (dropId != (u8)ITEM00_NO_DROP) { - spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId); + spawnedActor = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, spawnPos->x, + spawnPos->y, spawnPos->z, 0, 0, 0, dropId); if ((spawnedActor != 0) && (dropId != (u8)ITEM00_NO_DROP)) { spawnedActor->actor.velocity.y = 8.0f; spawnedActor->actor.speedXZ = 2.0f; @@ -1148,7 +1146,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 } } } else { - Item_DropCollectible(globalCtx, spawnPos, params | 0x8000); + Item_DropCollectible(play, spawnPos, params | 0x8000); } dropQuantity--; @@ -1185,6 +1183,6 @@ s32 func_800A817C(s32 index) { return D_801AE214[index]; } -s32 Item_CanDropBigFairy(GlobalContext* globalCtx, s32 index, s32 collectibleFlag) { - return (func_800A8150(index) == ITEM00_BIG_FAIRY) && (!Flags_GetCollectible(globalCtx, collectibleFlag)); +s32 Item_CanDropBigFairy(PlayState* play, s32 index, s32 collectibleFlag) { + return (func_800A8150(index) == ITEM00_BIG_FAIRY) && (!Flags_GetCollectible(play, collectibleFlag)); } diff --git a/src/code/z_env_flags.c b/src/code/z_env_flags.c index d766815124..06e216cd35 100644 --- a/src/code/z_env_flags.c +++ b/src/code/z_env_flags.c @@ -1,33 +1,33 @@ #include "global.h" -void EnvFlags_UnsetAll(GlobalContext* globalCtx) { +void EnvFlags_UnsetAll(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 EnvFlags_Set(GlobalContext* globalCtx, s16 flag) { +void EnvFlags_Set(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 EnvFlags_Unset(GlobalContext* globalCtx, s16 flag) { +void EnvFlags_Unset(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 EnvFlags_Get(GlobalContext* globalCtx, s16 flag) { +s32 EnvFlags_Get(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/z_face_reaction.c b/src/code/z_face_reaction.c index d54561fdd5..e6d985d65e 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -178,9 +178,9 @@ static u16 sReactionTextIds[][PLAYER_MASK_GIANT - 1] = { }; // clang-format on -u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) { - if ((Player_GetMask(globalCtx) > PLAYER_MASK_NONE) && (Player_GetMask(globalCtx) < PLAYER_MASK_GIANT)) { - return sReactionTextIds[reactionSet][Player_GetMask(globalCtx) - 1]; +u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) { + if ((Player_GetMask(play) > PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) { + return sReactionTextIds[reactionSet][Player_GetMask(play) - 1]; } return 0; } diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index b40a1c351c..669e013480 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 = Lib_SegmentedToVirtual(skeletonHeaderSeg); @@ -61,7 +61,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_Free(skelCurve->jointTable); } @@ -91,7 +91,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; @@ -108,7 +108,7 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelCurve* skelCurve) { constantData = Lib_SegmentedToVirtual(animation->constantData); jointData = *skelCurve->jointTable; - skelCurve->curFrame += skelCurve->playSpeed * ((s32)globalCtx->state.framerateDivisor * 0.5f); + skelCurve->curFrame += skelCurve->playSpeed * ((s32)play->state.framerateDivisor * 0.5f); if (((skelCurve->playSpeed >= 0.0f) && (skelCurve->curFrame > skelCurve->endFrame)) || ((skelCurve->playSpeed < 0.0f) && (skelCurve->curFrame < skelCurve->endFrame))) { @@ -155,16 +155,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, Actor* thisx) { +void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, + PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) { SkelCurveLimb* limb = Lib_SegmentedToVirtual(skelCurve->skeleton[limbIndex]); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); if ((overrideLimbDraw == NULL) || - ((overrideLimbDraw != NULL) && overrideLimbDraw(globalCtx, skelCurve, limbIndex, thisx))) { + ((overrideLimbDraw != NULL) && overrideLimbDraw(play, skelCurve, limbIndex, thisx))) { Vec3f scale; Vec3s rot; Vec3f pos; @@ -191,7 +191,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), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, dList); } @@ -200,13 +200,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), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), 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), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dList); } @@ -214,25 +214,25 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelCurve* skel } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, skelCurve, limbIndex, thisx); + postLimbDraw(play, skelCurve, limbIndex, thisx); } if (limb->child != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); + SkelCurve_DrawLimb(play, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelCurve_DrawLimb(globalCtx, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); + SkelCurve_DrawLimb(play, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelCurve* skelCurve, - OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) { +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, + PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) { if (skelCurve->jointTable != NULL) { - SkelCurve_DrawLimb(globalCtx, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); + SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, thisx); } } diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index f627c63948..97d5d8373b 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -37,7 +37,7 @@ FireObjLightParams sFireObjLightParams[] = { { 200, { 128, 128, 0 }, { 127, 127, 0 } }, }; -void FireObj_InitWithParams(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init) { +void FireObj_InitWithParams(PlayState* play, FireObj* fire, FireObjInitParams* init) { fire->size = init->size; fire->sizeInv = 1.0f / init->size; fire->dynamicSizeStep = init->dynamicSizeStep; @@ -92,8 +92,8 @@ void FireObj_StepSize(FireObj* fire) { fire->xScale = fire->dynamicSize * fire->size; } -void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) { - Player* player = GET_PLAYER(globalCtx); +void FireObj_UpdateStateTransitions(PlayState* play, FireObj* fire) { + Player* player = GET_PLAYER(play); WaterBox* waterBox; f32 waterY; s32 sp40 = false; @@ -114,7 +114,7 @@ void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) { FireObj_SetState(fire, fire->dynamicSizeStep, nextState); } if ((fire->flags & 1) && (fire->state != FIRE_STATE_3) && - WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) && + WaterBox_GetSurface1_2(play, &play->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) && (waterY - fire->position.y > 6500.0f * fire->yScale)) { FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_3); } @@ -131,25 +131,24 @@ void FireObj_UpdateStateTransitions(GlobalContext* globalCtx, FireObj* fire) { } } else if (player->unk_B28 == 0) { player->unk_B28 = 0xD2; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &fire->position, 20, NA_SE_EV_FLAME_IGNITION); + SoundSource_PlaySfxAtFixedWorldPos(play, &fire->position, 20, NA_SE_EV_FLAME_IGNITION); } else if (player->unk_B28 < 0xC8) { player->unk_B28 = 0xC8; } } } -void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) { +void FireObj_Draw(PlayState* play, FireObj* fire) { s32 pad; FireObjColors* fireColors = &sFireObjColors[fire->colorsIndex]; if (fire->state != FIRE_STATE_3) { Vec3s vec; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->unk26 * -20) & 511, 32, 128)); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->unk26 * -20) & 511, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0, fireColors->lod, fireColors->primColor.r, fireColors->primColor.g, fireColors->primColor.b, fireColors->primColor.a); @@ -157,31 +156,31 @@ void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) { gDPSetEnvColor(POLY_XLU_DISP++, fireColors->envColor.r, fireColors->envColor.g, fireColors->envColor.b, 0); vec.x = 0; - vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; vec.z = 0; Matrix_SetTranslateRotateYXZ(fire->position.x, fire->position.y, fire->position.z, &vec); Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void FireObj_InitLight(GlobalContext* globalCtx, FireObjLight* light, u8* paramsIndex, Vec3f* pos) { +void FireObj_InitLight(PlayState* play, FireObjLight* light, u8* paramsIndex, Vec3f* pos) { FireObjLightParams* objectParams = &sFireObjLightParams[*paramsIndex]; Lights_PointGlowSetInfo(&light->lightInfo, pos->x, pos->y, pos->z, objectParams->color.r, objectParams->color.g, objectParams->color.b, objectParams->radius); - light->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &light->lightInfo); + light->light = LightContext_InsertLight(play, &play->lightCtx, &light->lightInfo); light->lightParamsIndex = *paramsIndex; } -void FireObj_DestroyLight(GlobalContext* globalCtx, FireObjLight* light) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, light->light); +void FireObj_DestroyLight(PlayState* play, FireObjLight* light) { + LightContext_RemoveLight(play, &play->lightCtx, light->light); } -void FireObj_UpdateLight(GlobalContext* globalCtx, FireObjLight* light, FireObj* fire) { +void FireObj_UpdateLight(PlayState* play, FireObjLight* light, FireObj* fire) { FireObjLightParams* lightParams = &sFireObjLightParams[light->lightParamsIndex]; s16 radius; @@ -198,33 +197,33 @@ void FireObj_UpdateLight(GlobalContext* globalCtx, FireObjLight* light, FireObj* } } -void FireObj_Init(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init, Actor* actor) { +void FireObj_Init(PlayState* play, FireObj* fire, FireObjInitParams* init, Actor* actor) { FireObj* fire2 = fire; - FireObj_InitWithParams(globalCtx, fire, init); - Collider_InitCylinder(globalCtx, &fire->collision); - Collider_SetCylinder(globalCtx, &fire->collision, actor, &sFireObjCollisionInit); + FireObj_InitWithParams(play, fire, init); + Collider_InitCylinder(play, &fire->collision); + Collider_SetCylinder(play, &fire->collision, actor, &sFireObjCollisionInit); fire2->collision.dim.radius = (fire->size * 4000.0f) + 2.5f; fire2->collision.dim.height = fire->size * 16000.0f; fire->collision.dim.yShift = fire->size * -1728.0f; - FireObj_InitLight(globalCtx, &fire->light, &init->lightParamsIndex, &fire->position); + FireObj_InitLight(play, &fire->light, &init->lightParamsIndex, &fire->position); } -void FireObj_Destroy(GlobalContext* globalCtx, FireObj* fire) { - Collider_DestroyCylinder(globalCtx, &fire->collision); - FireObj_DestroyLight(globalCtx, &fire->light); +void FireObj_Destroy(PlayState* play, FireObj* fire) { + Collider_DestroyCylinder(play, &fire->collision); + FireObj_DestroyLight(play, &fire->light); } void FireObj_SetState2(FireObj* fire, f32 dynamicSizeStep, u8 newState) { FireObj_SetState(fire, dynamicSizeStep, newState); } -void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor) { +void FireObj_Update(PlayState* play, FireObj* fire, Actor* actor) { s32 pad; // Gamestate cast? EnArrow* arrow = (EnArrow*)fire->collision.base.ac; - FireObj_UpdateStateTransitions(globalCtx, fire); + FireObj_UpdateStateTransitions(play, fire); if (fire->state == FIRE_STATE_3) { if ((fire->collision.base.acFlags & AC_HIT) && (fire->collision.info.acHitInfo->toucher.dmgFlags & 0x800)) { FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_0); @@ -237,6 +236,6 @@ void FireObj_Update(GlobalContext* globalCtx, FireObj* fire, Actor* actor) { fire->collision.dim.pos.x = fire->position.x; fire->collision.dim.pos.y = fire->position.y; fire->collision.dim.pos.z = fire->position.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &fire->collision.base); - FireObj_UpdateLight(globalCtx, &fire->light, fire); + CollisionCheck_SetAC(play, &play->colChkCtx, &fire->collision.base); + FireObj_UpdateLight(play, &fire->light, fire); } diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 4e2590a6ae..26a17a84a0 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -17,7 +17,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_Fini, sizeof(GlobalContext)), + GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)), GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)), diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 62d55bc00a..b7f6dfa5ef 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,27 +1,27 @@ #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_FadeLights(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_FadeLights(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)) { - Kankyo_FadeInGameOverLights(globalCtx); + Kankyo_FadeInGameOverLights(play); } } static s16 sGameOverTimer = 0; -void GameOver_Update(GlobalContext* globalCtx) { - GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; +void GameOver_Update(PlayState* play) { + GameOverContext* gameOverCtx = &play->gameOverCtx; s16 i; switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: - func_801477B4(globalCtx); + func_801477B4(play); for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { gSaveContext.unk_3DD0[i] = 0; @@ -60,14 +60,14 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.unk_3F20 = 0; gSaveContext.unk_3F22 = 0; gSaveContext.unk_3F24 = 0; - Kankyo_InitGameOverLights(globalCtx); + Kankyo_InitGameOverLights(play); sGameOverTimer = 20; func_8013ECE0(0.0f, 126, 124, 63); gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; case GAMEOVER_DEATH_FADE_OUT: if (func_801A8A50(1) != NA_BGM_GAME_OVER) { - func_80169F78(&globalCtx->state); + func_80169F78(&play->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; } @@ -84,7 +84,7 @@ void GameOver_Update(GlobalContext* globalCtx) { case GAMEOVER_REVIVE_START: gameOverCtx->state++; sGameOverTimer = 0; - Kankyo_InitGameOverLights(globalCtx); + Kankyo_InitGameOverLights(play); ShrinkWindow_SetLetterboxTarget(32); break; case GAMEOVER_REVIVE_RUMBLE: @@ -107,7 +107,7 @@ void GameOver_Update(GlobalContext* globalCtx) { } break; case GAMEOVER_REVIVE_FADE_OUT: - Kankyo_FadeOutGameOverLights(globalCtx); + Kankyo_FadeOutGameOverLights(play); sGameOverTimer--; if (sGameOverTimer == 0) { gameOverCtx->state = GAMEOVER_INACTIVE; diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 73656d65d4..48e8e2ad64 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -54,7 +54,7 @@ void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl) { } } -void KaleidoManager_Init(GlobalContext* globalCtx) { +void KaleidoManager_Init(PlayState* play) { s32 largestSize = 0; s32 size; u32 i; @@ -66,7 +66,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) { } } - sKaleidoAreaPtr = THA_AllocEndAlign16(&globalCtx->state.heap, largestSize); + sKaleidoAreaPtr = THA_AllocEndAlign16(&play->state.heap, largestSize); gKaleidoMgrCurOvl = NULL; Fault_AddAddrConvClient(&sKaleidoAreaFaultClient, KaleidoManager_FaultAddrConvFunc, NULL); } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index c3c616669e..c40154bc7d 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,11 +1,11 @@ #include "prevent_bss_reordering.h" #include "global.h" -void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx); -void (*sKaleidoScopeDrawFunc)(GlobalContext* globalCtx); +void (*sKaleidoScopeUpdateFunc)(PlayState* play); +void (*sKaleidoScopeDrawFunc)(PlayState* play); -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() { KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]; @@ -19,21 +19,21 @@ void KaleidoScopeCall_LoadPlayer() { } } -void KaleidoScopeCall_Init(GlobalContext* globalCtx) { +void KaleidoScopeCall_Init(PlayState* play) { sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(KaleidoScope_Update); sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(KaleidoScope_Draw); - KaleidoSetup_Init(globalCtx); + KaleidoSetup_Init(play); } -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) { - KaleidoSetup_Destroy(globalCtx); +void KaleidoScopeCall_Destroy(PlayState* play) { + KaleidoSetup_Destroy(play); } -void KaleidoScopeCall_Update(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoScopeCall_Update(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { if (pauseCtx->state == 1 || pauseCtx->state == 19) { if (ShrinkWindow_GetLetterboxMagnitude() == 0) { R_PAUSE_MENU_MODE = 1; @@ -60,9 +60,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)) { KaleidoManager_ClearOvl(kaleidoScopeOvl); KaleidoScopeCall_LoadPlayer(); } @@ -71,14 +71,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 <= 26))) { + if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || + ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 26))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeDrawFunc(globalCtx); + sKaleidoScopeDrawFunc(play); } } } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 5ed36d5518..fe985d7c32 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -5,8 +5,8 @@ s16 D_801BDB00[] = { PAUSE_1, PAUSE_2, PAUSE_3, PAUSE_0 }; f32 sKaleidoSetupEyeX[] = { -64.0f, 0.0f, 64.0f, 0.0f }; f32 sKaleidoSetupEyeZ[] = { 0.0f, -64.0f, 0.0f, 64.0f }; -void func_800F4A10(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void func_800F4A10(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s16 i; func_8013EE24(); @@ -59,35 +59,34 @@ void func_800F4A10(GlobalContext* globalCtx) { YREG(26) = -0x3840; } -void KaleidoSetup_Update(GlobalContext* globalCtx) { - Input* input = CONTROLLER1(&globalCtx->state); - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoSetup_Update(PlayState* play) { + Input* input = CONTROLLER1(&play->state); + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); + PauseContext* pauseCtx = &play->pauseCtx; if (CHECK_BTN_ALL(input->cur.button, BTN_R)) { if (msgCtx && msgCtx) {} } - if ((pauseCtx->state == 0) && (pauseCtx->debugState == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE)) { - if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0)) { + if ((pauseCtx->state == 0) && (pauseCtx->debugState == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { + if ((play->sceneLoadFlag == 0) && (play->unk_18B4A == 0)) { if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { - if (!Play_InCsMode(globalCtx) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) { - if ((globalCtx->unk_1887C < 2) && (gSaveContext.unk_3F28 != 8) && (gSaveContext.unk_3F28 != 9)) { + if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) { + if ((play->unk_1887C < 2) && (gSaveContext.unk_3F28 != 8) && (gSaveContext.unk_3F28 != 9)) { if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) { - if (!(globalCtx->actorCtx.unk5 & 2) && !(globalCtx->actorCtx.unk5 & 4)) { - if ((globalCtx->actorCtx.unk268 == 0) && - CHECK_BTN_ALL(input->press.button, BTN_START)) { + if (!(play->actorCtx.unk5 & 2) && !(play->actorCtx.unk5 & 4)) { + if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) { gSaveContext.unk_3F26 = gSaveContext.unk_3F22; pauseCtx->unk_2B9 = 0; pauseCtx->state = 1; - func_800F4A10(globalCtx); + func_800F4A10(play); pauseCtx->mode = pauseCtx->pageIndex * 2 + 1; func_801A3A7C(1); } if (pauseCtx->state == 1) { - Game_SetFramerateDivisor(&globalCtx->state, 2); + Game_SetFramerateDivisor(&play->state, 2); if (ShrinkWindow_GetLetterboxTarget() != 0) { ShrinkWindow_SetLetterboxTarget(0); } @@ -102,8 +101,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) { } } -void KaleidoSetup_Init(GlobalContext* globalCtx) { - PauseContext* pauseCtx = &globalCtx->pauseCtx; +void KaleidoSetup_Init(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; s32 pad[2]; bzero(pauseCtx, sizeof(PauseContext)); @@ -138,8 +137,8 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) { pauseCtx->unk_2BC = 40; pauseCtx->unk_29E = 100; - 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_kanfont.c b/src/code/z_kanfont.c index 2a4849ccb0..68c0fdd016 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,11 +1,11 @@ #include "global.h" // stubbed in NTSC-U -void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset) { +void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset) { } -void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset) { + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset], diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 73ba326b56..651afe6c04 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -33,8 +33,8 @@ TexturePtr HeartDDTextures[] = { gDefenseHeartThreeQuarterTex, }; -void LifeMeter_Init(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void LifeMeter_Init(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; interfaceCtx->unkTimer = 320; @@ -71,8 +71,8 @@ void LifeMeter_Init(GlobalContext* globalCtx) { sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = 0; } -void LifeMeter_UpdateColors(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void LifeMeter_UpdateColors(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; f32 factorBeating = interfaceCtx->lifeColorChange * 0.1f; f32 ddFactor; s32 type = 0; @@ -167,26 +167,26 @@ void LifeMeter_UpdateColors(GlobalContext* globalCtx) { sBeatingHeartsDDEnv[2] = (u8)(bFactor + 0) & 0xFF; } -s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx) { - gSaveContext.save.playerData.health = globalCtx->interfaceCtx.health; +s32 LifeMeter_SaveInterfaceHealth(PlayState* play) { + gSaveContext.save.playerData.health = play->interfaceCtx.health; return 1; } -s32 LifeMeter_IncreaseInterfaceHealth(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; interfaceCtx->unkTimer = 320; interfaceCtx->health += 0x10; - if (globalCtx->interfaceCtx.health >= gSaveContext.save.playerData.health) { - globalCtx->interfaceCtx.health = gSaveContext.save.playerData.health; + if (play->interfaceCtx.health >= gSaveContext.save.playerData.health) { + play->interfaceCtx.health = gSaveContext.save.playerData.health; return 1; } return 0; } -s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->unkTimer != 0) { interfaceCtx->unkTimer--; @@ -195,14 +195,14 @@ s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) { interfaceCtx->health -= 0x10; if (interfaceCtx->health <= 0) { interfaceCtx->health = 0; - globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.save.playerData.health) + 1)); + play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 1)); return 1; } } return 0; } -void LifeMeter_Draw(GlobalContext* globalCtx) { +void LifeMeter_Draw(PlayState* play) { s32 pad[5]; TexturePtr heartTex; s32 curColorSet; @@ -213,8 +213,8 @@ void LifeMeter_Draw(GlobalContext* globalCtx) { f32 posX; f32 halfTexSize; f32 temp_f4; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx; s32 fractionHeartCount = gSaveContext.save.playerData.health % 0x10; s16 healthCapacity = gSaveContext.save.playerData.healthCapacity / 0x10; @@ -391,16 +391,16 @@ void LifeMeter_Draw(GlobalContext* globalCtx) { CLOSE_DISPS(gfxCtx); } -void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx) { - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void LifeMeter_UpdateSizeAndBeep(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; if (interfaceCtx->lifeSizeChangeDirection != 0) { interfaceCtx->lifeSizeChange--; if (interfaceCtx->lifeSizeChange <= 0) { interfaceCtx->lifeSizeChange = 0; interfaceCtx->lifeSizeChangeDirection = 0; - if (!Player_InCsMode(&globalCtx->state) && (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.debugState == 0) && LifeMeter_IsCritical() && !Play_InCsMode(globalCtx)) { + if (!Player_InCsMode(&play->state) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + LifeMeter_IsCritical() && !Play_InCsMode(play)) { play_sound(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index e9fae530ab..b602c66b14 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -124,7 +124,7 @@ void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* p } } -void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* globalCtx) { +void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play) { Light* light; f32 radiusF = params->point.radius; Vec3f posF; @@ -135,7 +135,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global posF.x = params->point.x; posF.y = params->point.y; posF.z = params->point.z; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &posF, &adjustedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &posF, &adjustedPos); if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) && (400 > fabsf(adjustedPos.y) - radiusF)) { light = Lights_FindSlot(lights); @@ -189,7 +189,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) { * Note: Lights in a given list can only be binded to however many free slots are * available in the Lights group. This is at most 7 slots for a new group, but could be less. */ -void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalContext* globalCtx) { +void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play) { static LightsPosBindFunc posBindFuncs[] = { Lights_BindPoint, (LightsPosBindFunc)Lights_BindDirectional, @@ -204,7 +204,7 @@ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalCo if (listHead != NULL) { if ((refPos == NULL) && (lights->enablePosLights == 1)) { do { - posBindFuncs[listHead->info->type](lights, &listHead->info->params, globalCtx); + posBindFuncs[listHead->info->type](lights, &listHead->info->params, play); listHead = listHead->next; } while (listHead != NULL); } else { @@ -248,8 +248,8 @@ void 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); func_80102544(lightCtx, 0, 0, 0, 0x3E4, 0x3200); bzero(&sLightsBuffer, sizeof(LightsBuffer)); @@ -276,13 +276,13 @@ Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) return Lights_New(gfxCtx, lightCtx->ambient.r, lightCtx->ambient.g, lightCtx->ambient.b); } -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; } } @@ -293,7 +293,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* light; light = Lights_FindBufSlot(); @@ -312,7 +312,7 @@ LightNode* LightContext_InsertLight(GlobalContext* globalCtx, LightContext* ligh return light; } -void LightContext_RemoveLight(GlobalContext* globalCtx, LightContext* lightCtx, LightNode* light) { +void LightContext_RemoveLight(PlayState* play, LightContext* lightCtx, LightNode* light) { if (light != NULL) { if (light->prev != NULL) { light->prev->next = light->next; @@ -372,8 +372,8 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient return lights; } -void Lights_GlowCheck(GlobalContext* globalCtx) { - LightNode* light = globalCtx->lightCtx.listHead; +void Lights_GlowCheck(PlayState* play) { + LightNode* light = play->lightCtx.listHead; while (light != NULL) { LightPoint* params = &light->info->params.point; @@ -386,7 +386,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { pos.x = params->x; pos.y = params->y; pos.z = params->z; - Actor_GetProjectedPos(globalCtx, &pos, &multDest, &wDest); + Actor_GetProjectedPos(play, &pos, &multDest, &wDest); params->drawGlow = 0; @@ -406,13 +406,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx) { } } -void Lights_DrawGlow(GlobalContext* globalCtx) { +void Lights_DrawGlow(PlayState* play) { Gfx* dl; LightPoint* params; - LightNode* light = globalCtx->lightCtx.listHead; + LightNode* light = play->lightCtx.listHead; if (light != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); dl = func_8012C7FC(POLY_XLU_DISP); @@ -434,8 +434,7 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dl++, gameplay_keep_DL_029CF0); } @@ -446,6 +445,6 @@ void Lights_DrawGlow(GlobalContext* globalCtx) { POLY_XLU_DISP = dl; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/code/z_message.c b/src/code/z_message.c index d8e2d5c8a7..8081f9c87d 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -42,8 +42,8 @@ void func_80147520(void) { D_801CFCA4[7] = D_801CFCA4[8] = 0; } -void func_80147564(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_80147564(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; msgCtx->unk1204A[0] = 0xBD; msgCtx->unk1204A[1] = 0xB8; @@ -65,9 +65,9 @@ void func_80147564(GlobalContext* globalCtx) { D_801F6B20 = 0xA; } -s32 Message_ShouldAdvance(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; - Input* controller = CONTROLLER1(&globalCtx->state); +s32 Message_ShouldAdvance(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + Input* controller = CONTROLLER1(&play->state); if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { if (CHECK_BTN_ALL(controller->press.button, BTN_A)) { @@ -84,9 +84,9 @@ s32 Message_ShouldAdvance(GlobalContext* globalCtx) { } } -s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; - Input* controller = CONTROLLER1(&globalCtx->state); +s32 Message_ShouldAdvanceSilent(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + Input* controller = CONTROLLER1(&play->state); if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { return CHECK_BTN_ALL(controller->press.button, BTN_A); @@ -96,10 +96,10 @@ s32 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { } } -void func_801477B4(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_801477B4(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; - if (globalCtx->msgCtx.unk11F10 != 0) { + if (play->msgCtx.unk11F10 != 0) { msgCtx->unk12023 = 2; msgCtx->msgMode = 0x43; msgCtx->unk12020 = 0; @@ -114,10 +114,10 @@ void func_801477B4(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148558.s") #ifdef NON_MATCHING -void func_80148B98(GlobalContext* globalCtx, u8 arg1) { +void func_80148B98(PlayState* play, u8 arg1) { static s16 held = 0; - MessageContext* msgCtx = &globalCtx->msgCtx; - Input* curInput = CONTROLLER1(&globalCtx->state); + MessageContext* msgCtx = &play->msgCtx; + Input* curInput = CONTROLLER1(&play->state); if ((curInput->rel.stick_y > 29) && held == 0) { held = 1; @@ -147,8 +147,8 @@ void func_80148B98(GlobalContext* globalCtx, u8 arg1) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148B98.s") #endif -void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_80148CBC(PlayState* play, UNK_PTR puParm2, u8 arg2) { + MessageContext* msgCtx = &play->msgCtx; msgCtx->unk11FF4 = 0x30; if (arg2 == 1) { @@ -156,7 +156,7 @@ void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) { } else { msgCtx->unk11FF6 = msgCtx->unk11FFE[msgCtx->choiceIndex]; } - func_80147818(globalCtx, puParm2, msgCtx->unk11FF4, msgCtx->unk11FF6); + func_80147818(play, puParm2, msgCtx->unk11FF4, msgCtx->unk11FF6); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80148D64.s") @@ -173,8 +173,8 @@ void func_80148CBC(GlobalContext* globalCtx, UNK_PTR puParm2, u8 arg2) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80149C18.s") -void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_FindMessage(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; MessageTableEntry* msgEntry = msgCtx->messageEntryTable; const char* segment = msgEntry->segment; @@ -209,12 +209,12 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014C70C.s") -void Message_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) { + MessageContext* msgCtx = &play->msgCtx; s32 temp1 = *offset; f32 temp2 = *arg3; - Font_LoadChar(globalCtx, codePointIndex, temp1); + Font_LoadChar(play, codePointIndex, temp1); msgCtx->decodedBuffer.wchar[decodedBufPos] = codePointIndex; temp1 += FONT_CHAR_TEX_SIZE; temp2 += (16.0f * msgCtx->unk12098); @@ -223,21 +223,21 @@ void Message_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32* offset, } // Message_LoadRupees JPN ? -void func_8014CCB4(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) { + MessageContext* msgCtx = &play->msgCtx; s16 t = *decodedBufPos; s32 k = *offset; f32 f = *arg3; - Font_LoadChar(globalCtx, 0x838B, k); // 0x838b = ル in JISX0213 + Font_LoadChar(play, 0x838B, k); // 0x838b = ル in JISX0213 k += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.wchar[t] = 0x838B; t += 1; - Font_LoadChar(globalCtx, 0x8373, k); // 0x8373 = ピ in JISX0213 + Font_LoadChar(play, 0x8373, k); // 0x8373 = ピ in JISX0213 k += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.wchar[t] = 0x8373; t += 1; - Font_LoadChar(globalCtx, 0x815C, k); // Ox815C = ― in JISX0213 + Font_LoadChar(play, 0x815C, k); // Ox815C = ― in JISX0213 k += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.wchar[t] = 0x815C; @@ -257,7 +257,7 @@ void func_8014CCB4(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f3 extern u16* D_801D0188; extern s16* D_801D0250; -void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) { +void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { f32 sp3C; s16 temp_s0; s16 temp_s1; @@ -276,10 +276,10 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) { temp_s1 = *arg3; temp_s2 = *arg1; sp3C = *arg2; - if ((func_8010A0A4(arg0) != 0) || (arg0->sceneNum == 0x4F)) { + if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { phi_v0 = 0xA; } else { - phi_v0 = arg0->pauseCtx.unk_238[4]; + phi_v0 = play->pauseCtx.unk_238[4]; } temp_s6 = *(&D_801D0250 + (phi_v0 * 2)); phi_s0 = 0; @@ -290,8 +290,8 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) { phi_s2 = temp_s2; do { temp_v0 = (phi_v0 * 0x12) + &D_801D0188 + (phi_s0 * 2); - (arg0 + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0; - Font_LoadChar(arg0, *temp_v0, phi_s2); + (play + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0; + Font_LoadChar(play, *temp_v0, phi_s2); temp_s0 = phi_s0 + 1; temp_s1_2 = phi_s1 + 1; temp_s2_2 = phi_s2 + 0x80; @@ -304,7 +304,7 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) { } *arg3 = phi_s1_2 - 1; *arg1 = phi_s2_2; - *arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * arg0->msgCtx.unk12098)); + *arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * play->msgCtx.unk12098)); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D62C.s") @@ -318,53 +318,53 @@ void func_8014D62C(GlobalContext* arg0, s32* arg1, f32* arg2, s16* arg3) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_801514B0.s") -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; msgCtx->ocarinaAction = 0xFFFF; - func_80150D08(globalCtx, textId); + func_80150D08(play, textId); msgCtx->unkActor = Actor; msgCtx->msgMode = 1; msgCtx->unk12023 = 0; msgCtx->unk12024 = 0; - globalCtx->msgCtx.ocarinaMode = 0; + play->msgCtx.ocarinaMode = 0; } -void func_80151938(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; - InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; +void func_80151938(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; msgCtx->unk11F10 = 0; - func_80150D08(globalCtx, textId); - func_80150A84(globalCtx); + func_80150D08(play, textId); + func_80150A84(play); msgCtx->msgMode = 5; msgCtx->unk12023 = 8; msgCtx->unk12024 = 0; if (interfaceCtx->unk_222 == 0) { if (textId != 0x1B93) { - func_8011552C(globalCtx, 0x10); + func_8011552C(play, 0x10); } else if (textId != 0xF8) { - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); } } msgCtx->unk1203C = msgCtx->unk1203A; - if (globalCtx->pauseCtx.unk_1F0 != 0) { + if (play->pauseCtx.unk_1F0 != 0) { msgCtx->unk12004 = 0x22; msgCtx->unk12006 = 0x15E; - func_80149C18(globalCtx); + func_80149C18(play); msgCtx->unk12023 = 1; } } -void func_80151A68(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_80151A68(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; msgCtx->unk11F10 = 0; - func_80150D08(globalCtx, textId); - func_80150A84(globalCtx); - func_8015B198(globalCtx); + func_80150D08(play, textId); + func_80150A84(play); + func_8015B198(play); msgCtx->msgMode = 0x45; msgCtx->unk12024 = 0; msgCtx->unk1203C = msgCtx->unk1203A = msgCtx->unk1201E = 0; @@ -386,8 +386,8 @@ void func_80151A68(GlobalContext* globalCtx, u16 textId) { } } -void func_80151BB4(GlobalContext* globalCtx, u8 arg1) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void func_80151BB4(PlayState* play, u8 arg1) { + MessageContext* msgCtx = &play->msgCtx; u8 temp = arg1; if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { @@ -403,8 +403,8 @@ void func_80151BB4(GlobalContext* globalCtx, u8 arg1) { } } -u32 func_80151C9C(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +u32 func_80151C9C(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; while (true) { if (msgCtx->unk120B1 == 0) { @@ -419,7 +419,7 @@ u32 func_80151C9C(GlobalContext* globalCtx) { (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]; if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - func_80151938(globalCtx, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); + func_80151938(play, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); play_sound(NA_SE_SY_SCHEDULE_WRITE); return true; } @@ -429,14 +429,14 @@ u32 func_80151C9C(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80151DA4.s") -void func_80152434(GlobalContext* globalCtx, u16 arg2) { - globalCtx->msgCtx.unk12046 = 0; - func_80151DA4(globalCtx, arg2); +void func_80152434(PlayState* play, u16 arg2) { + play->msgCtx.unk12046 = 0; + func_80151DA4(play, arg2); } -void func_80152464(GlobalContext* globalCtx, u16 arg1) { - globalCtx->msgCtx.unk12046 = 1; - func_80151DA4(globalCtx, arg1); +void func_80152464(PlayState* play, u16 arg1) { + play->msgCtx.unk12046 = 1; + func_80151DA4(play, arg1); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_GetState.s") @@ -451,21 +451,21 @@ void func_80152C64(View* view) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80152CAC.s") // Spawn song effect? -void func_80152EC0(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = GET_PLAYER(globalCtx); +void func_80152EC0(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); if (1) {} if ((msgCtx->songPlayed < 0x17) && (msgCtx->songPlayed != 0xE) && ((msgCtx->ocarinaAction < 0x43) || (msgCtx->ocarinaAction >= 0x47))) { msgCtx->unk120B0 = 1; if (msgCtx->songPlayed != 0x16) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, D_801D02D8[msgCtx->songPlayed], player->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, D_801D02D8[msgCtx->songPlayed], player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, D_801D02F8[msgCtx->songPlayed]); return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OCEFF_WIPE4, player->actor.world.pos.x, - player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_OCEFF_WIPE4, player->actor.world.pos.x, player->actor.world.pos.y, + player->actor.world.pos.z, 0, 0, 0, 0); } } @@ -473,34 +473,34 @@ void func_80152EC0(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80153750.s") -void func_80153E7C(GlobalContext* globalCtx, void* arg1) { - if ((gSaveContext.options.language == 0) && (globalCtx->msgCtx.unk12090 == 0)) { - func_8014ADBC(globalCtx, arg1); +void func_80153E7C(PlayState* play, void* arg1) { + if ((gSaveContext.options.language == 0) && (play->msgCtx.unk12090 == 0)) { + func_8014ADBC(play, arg1); return; } - if (globalCtx->msgCtx.unk12090 != 0) { - func_8015E7EC(globalCtx, arg1); + if (play->msgCtx.unk12090 != 0) { + func_8015E7EC(play, arg1); return; } - func_8015966C(globalCtx, arg1, 0); + func_8015966C(play, arg1, 0); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80153EF0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_801541D4.s") -void func_80156758(GlobalContext* globalCtx) { +void func_80156758(PlayState* play) { Gfx* nextDisplayList; Gfx* polyOpa; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); polyOpa = POLY_OPA_DISP; nextDisplayList = Graph_GfxPlusOne(polyOpa); gSPDisplayList(OVERLAY_DISP++, nextDisplayList); - if ((globalCtx->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(globalCtx)) { - func_801541D4(globalCtx, &nextDisplayList); + if ((play->msgCtx.currentTextId != 0x5E6) || !Play_InCsMode(play)) { + func_801541D4(play, &nextDisplayList); } gSPEndDisplayList(nextDisplayList++); @@ -511,17 +511,17 @@ void func_80156758(GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8015680C.s") -void func_801586A4(GlobalContext* globalCtx) { - globalCtx->msgCtx.messageEntryTableNes = D_801C6B98; - globalCtx->msgCtx.messageTableStaff = D_801CFB08; +void func_801586A4(PlayState* play) { + play->msgCtx.messageEntryTableNes = D_801C6B98; + play->msgCtx.messageTableStaff = D_801CFB08; } -void Message_Init(GlobalContext* globalCtx) { +void Message_Init(PlayState* play) { Font* font; - MessageContext* messageCtx = &globalCtx->msgCtx; + MessageContext* messageCtx = &play->msgCtx; - func_801586A4(globalCtx); - globalCtx->msgCtx.ocarinaMode = 0; + func_801586A4(play); + play->msgCtx.ocarinaMode = 0; messageCtx->msgMode = 0; messageCtx->unk11F10 = 0; messageCtx->currentTextId = 0; @@ -529,10 +529,10 @@ void Message_Init(GlobalContext* globalCtx) { messageCtx->choiceIndex = 0; messageCtx->ocarinaAction = messageCtx->unk11FF2 = 0; messageCtx->unk1201E = 0xFF; - View_Init(&messageCtx->view, globalCtx->state.gfxCtx); - messageCtx->unk11EF8 = THA_AllocEndAlign16(&globalCtx->state.heap, 0x13C00); - font = &globalCtx->msgCtx.font; - Font_LoadOrderedFont(&globalCtx->msgCtx.font); + View_Init(&messageCtx->view, play->state.gfxCtx); + messageCtx->unk11EF8 = THA_AllocEndAlign16(&play->state.heap, 0x13C00); + font = &play->msgCtx.font; + Font_LoadOrderedFont(&play->msgCtx.font); font->unk_11D88 = 0; messageCtx->unk12090 = messageCtx->unk12092 = 0; messageCtx->unk12094 = 0; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 485f016ff9..491427ceff 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -42,8 +42,8 @@ extern u8 D_801D0710[4]; extern u8 D_801D0714[11][16]; extern s16 D_801D07C4[11]; -void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_FindMessageNES(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; MessageTableEntry* msgEntry = msgCtx->messageEntryTableNes; const char* segment = msgEntry->segment; @@ -70,12 +70,12 @@ void Message_FindMessageNES(GlobalContext* globalCtx, u16 textId) { font->messageEnd = nextSegment - foundSegment; } -void Message_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadCharNES(PlayState* play, u8 codePointIndex, s32* offset, f32* arg3, s16 decodedBufPos) { + MessageContext* msgCtx = &play->msgCtx; s32 temp1 = *offset; f32 temp2 = *arg3; - Font_LoadCharNES(globalCtx, codePointIndex, temp1); + Font_LoadCharNES(play, codePointIndex, temp1); msgCtx->decodedBuffer.schar[decodedBufPos] = codePointIndex; temp1 += FONT_CHAR_TEX_SIZE; temp2 += (16.0f * msgCtx->unk12098); @@ -83,35 +83,35 @@ void Message_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32* offse *arg3 = temp2; } -void Message_LoadPluralRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadPluralRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) { + MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg3; msgCtx->decodedBuffer.schar[p] = 0x20; p++; - Font_LoadCharNES(globalCtx, 'R', o); + Font_LoadCharNES(play, 'R', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'R'; p++; - Font_LoadCharNES(globalCtx, 'u', o); + Font_LoadCharNES(play, 'u', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'u'; p++; - Font_LoadCharNES(globalCtx, 'p', o); + Font_LoadCharNES(play, 'p', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'p'; p++; - Font_LoadCharNES(globalCtx, 'e', o); + Font_LoadCharNES(play, 'e', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'e'; p++; - Font_LoadCharNES(globalCtx, 'e', o); + Font_LoadCharNES(play, 'e', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'e'; p++; - Font_LoadCharNES(globalCtx, 's', o); + Font_LoadCharNES(play, 's', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 's'; @@ -121,8 +121,8 @@ void Message_LoadPluralRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s *arg3 = f; } -void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadLocalizedRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) { + MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg3; @@ -132,7 +132,7 @@ void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos p++; for (j = 0; j < D_801D0710[gSaveContext.options.language - 1]; j++) { - Font_LoadCharNES(globalCtx, D_801D06F0[gSaveContext.options.language - 1][j], o); + Font_LoadCharNES(play, D_801D06F0[gSaveContext.options.language - 1][j], o); msgCtx->decodedBuffer.schar[p] = D_801D06F0[gSaveContext.options.language - 1][j]; o += FONT_CHAR_TEX_SIZE; p++; @@ -145,37 +145,37 @@ void Message_LoadLocalizedRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos *arg3 = f; } -void Message_LoadRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* offset, f32* arg3, s16 singular) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadRupeesNES(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3, s16 singular) { + MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg3; msgCtx->decodedBuffer.schar[p] = ' '; p++; - Font_LoadCharNES(globalCtx, 'R', o); + Font_LoadCharNES(play, 'R', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'R'; p++; - Font_LoadCharNES(globalCtx, 'u', o); + Font_LoadCharNES(play, 'u', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'u'; p++; - Font_LoadCharNES(globalCtx, 'p', o); + Font_LoadCharNES(play, 'p', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'p'; p++; - Font_LoadCharNES(globalCtx, 'e', o); + Font_LoadCharNES(play, 'e', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'e'; p++; - Font_LoadCharNES(globalCtx, 'e', o); + Font_LoadCharNES(play, 'e', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 'e'; if (singular != 1) { p++; - Font_LoadCharNES(globalCtx, 's', o); + Font_LoadCharNES(play, 's', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = 's'; f += 16.0f * msgCtx->unk12098 * 6.0f; @@ -188,8 +188,8 @@ void Message_LoadRupeesNES(GlobalContext* globalCtx, s16* decodedBufPos, s32* of *arg3 = f; } -void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* arg3, s16* decodedBufPos) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadTimeNES(PlayState* play, u8 arg1, s32* offset, f32* arg3, s16* decodedBufPos) { + MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg3; @@ -225,12 +225,12 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar } for (i = 0; i < 4; i++) { - Font_LoadCharNES(globalCtx, digits[i] + '0', o); + Font_LoadCharNES(play, digits[i] + '0', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = digits[i] + '0'; p++; if (i == 1) { - Font_LoadCharNES(globalCtx, ':', o); + Font_LoadCharNES(play, ':', o); o += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.schar[p] = ':'; p++; @@ -243,8 +243,8 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar *arg3 = f; } -void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s16* decodedBufPos) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decodedBufPos) { + MessageContext* msgCtx = &play->msgCtx; s16 p = *decodedBufPos; s32 o = *offset; f32 f = *arg2; @@ -253,10 +253,10 @@ void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s s16 currentArea; s16 stringLimit; - if ((func_8010A0A4(globalCtx) != 0) || (globalCtx->sceneNum == SCENE_SECOM)) { + if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) { currentArea = 10; } else { - currentArea = globalCtx->pauseCtx.unk_238[4]; + currentArea = play->pauseCtx.unk_238[4]; } stringLimit = D_801D07C4[currentArea]; @@ -264,7 +264,7 @@ void Message_LoadAreaTextNES(GlobalContext* globalCtx, s32* offset, f32* arg2, s msgCtx->decodedBuffer.schar[p] = D_801D0714[currentArea][i]; currentChar = msgCtx->decodedBuffer.schar[p]; if (currentChar != ' ') { - Font_LoadCharNES(globalCtx, D_801D0714[currentArea][i], o); + Font_LoadCharNES(play, D_801D0714[currentArea][i], o); o += FONT_CHAR_TEX_SIZE; } currentChar = msgCtx->decodedBuffer.schar[p]; diff --git a/src/code/z_message_staff.c b/src/code/z_message_staff.c index 6620f88d59..ab30a3d9c6 100644 --- a/src/code/z_message_staff.c +++ b/src/code/z_message_staff.c @@ -1,8 +1,8 @@ #include "global.h" #include "message_data_static.h" -void Message_FindCreditsMessage(GlobalContext* globalCtx, u16 textId) { - MessageContext* msgCtx = &globalCtx->msgCtx; +void Message_FindCreditsMessage(PlayState* play, u16 textId) { + MessageContext* msgCtx = &play->msgCtx; Font* font = &msgCtx->font; MessageTableEntry* msgEntry = msgCtx->messageTableStaff; const char* segment = msgEntry->segment; diff --git a/src/code/z_path.c b/src/code/z_path.c index 0462a40cd9..3c446d49aa 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 7d13ee8eef..e9f5803d21 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -58,8 +58,8 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s") -s32 Play_InCsMode(GlobalContext* globalCtx) { - return (globalCtx->csCtx.state != 0) || Player_InCsMode(&globalCtx->state); +s32 Play_InCsMode(PlayState* this) { + return (this->csCtx.state != 0) || Player_InCsMode(&this->state); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169100.s") @@ -154,113 +154,113 @@ s16 Play_GetOriginalSceneNumber(s16 sceneNum) { * Copies the flags set in ActorContext over to the current scene's CycleSceneFlags, usually using the original scene * number. Exception for Inverted Stone Tower Temple, which uses its own. */ -void Play_SaveCycleSceneFlags(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +void Play_SaveCycleSceneFlags(GameState* thisx) { + PlayState* this = (PlayState*)thisx; CycleSceneFlags* cycleSceneFlags; - cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; - cycleSceneFlags->chest = globalCtx->actorCtx.flags.chest; - cycleSceneFlags->switch0 = globalCtx->actorCtx.flags.switches[0]; - cycleSceneFlags->switch1 = globalCtx->actorCtx.flags.switches[1]; + cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)]; + cycleSceneFlags->chest = this->actorCtx.flags.chest; + cycleSceneFlags->switch0 = this->actorCtx.flags.switches[0]; + cycleSceneFlags->switch1 = this->actorCtx.flags.switches[1]; - if (globalCtx->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple - cycleSceneFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum]; + if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple + cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum]; } - cycleSceneFlags->collectible = globalCtx->actorCtx.flags.collectible[0]; - cycleSceneFlags->clearedRoom = globalCtx->actorCtx.flags.clearedRoom; + cycleSceneFlags->collectible = this->actorCtx.flags.collectible[0]; + cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom; } -void Play_SetRespawnData(GameState* gameState, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams, +void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw) { - GlobalContext* globalCtx = (GlobalContext*)gameState; + PlayState* this = (PlayState*)thisx; gSaveContext.respawn[respawnMode].entranceIndex = Entrance_CreateIndex(entranceIndex >> 9, 0, entranceIndex & 0xF); gSaveContext.respawn[respawnMode].roomIndex = roomIndex; gSaveContext.respawn[respawnMode].pos = *pos; gSaveContext.respawn[respawnMode].yaw = yaw; gSaveContext.respawn[respawnMode].playerParams = playerParams; - gSaveContext.respawn[respawnMode].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2]; - gSaveContext.respawn[respawnMode].unk_18 = globalCtx->actorCtx.flags.collectible[1]; - gSaveContext.respawn[respawnMode].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; + gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.flags.switches[2]; + gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.flags.collectible[1]; + gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.flags.collectible[2]; } -void Play_SetupRespawnPoint(GameState* gameState, s32 respawnMode, s32 playerParams) { - GlobalContext* globalCtx = (GlobalContext*)gameState; - Player* player = GET_PLAYER(globalCtx); +void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) { + PlayState* this = (PlayState*)thisx; + Player* player = GET_PLAYER(this); - if (globalCtx->sceneNum != SCENE_KAKUSIANA) { // Grottos - Play_SetRespawnData(&globalCtx->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex), - globalCtx->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, + if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos + Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex), + this->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } } // Override respawn data in Sakon's Hideout -void func_80169ECC(GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SECOM) { - globalCtx->nextEntranceIndex = 0x2060; +void func_80169ECC(PlayState* this) { + if (this->sceneNum == SCENE_SECOM) { + this->nextEntranceIndex = 0x2060; gSaveContext.respawnFlag = -7; } } // Gameplay_TriggerVoidOut ? // Used by Player, Ikana_Rotaryroom, Bji01, Kakasi, LiftNuts, Test4, Warptag, WarpUzu, Roomtimer -void func_80169EFC(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +void func_80169EFC(GameState* thisx) { + PlayState* this = (PlayState*)thisx; - gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = globalCtx->actorCtx.flags.switches[2]; - gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = globalCtx->actorCtx.flags.collectible[1]; - gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex; + gSaveContext.respawn[RESTART_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2]; + gSaveContext.respawn[RESTART_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1]; + gSaveContext.respawn[RESTART_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2]; + this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex; gSaveContext.respawnFlag = 1; - func_80169ECC(globalCtx); - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + func_80169ECC(this); + this->sceneLoadFlag = 0x14; + this->unk_1887F = 2; } // Gameplay_LoadToLastEntrance ? // Used by game_over and Test7 -void func_80169F78(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +void func_80169F78(GameState* thisx) { + PlayState* this = (PlayState*)thisx; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex; + this->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_TOP].entranceIndex; gSaveContext.respawnFlag = -1; - func_80169ECC(globalCtx); - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + func_80169ECC(this); + this->sceneLoadFlag = 0x14; + this->unk_1887F = 2; } // Gameplay_TriggerRespawn ? // Used for void by Wallmaster, Deku Shrine doors. Also used by Player, Kaleido, DoorWarp1 -void func_80169FDC(GameState* gameState) { - func_80169F78(gameState); +void func_80169FDC(GameState* thisx) { + func_80169F78(thisx); } // Used by Kankyo to determine how to change the lighting, e.g. for game over. -s32 func_80169FFC(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +s32 func_80169FFC(GameState* thisx) { + PlayState* this = (PlayState*)thisx; - return globalCtx->roomCtx.currRoom.mesh->type0.type != 1; + return this->roomCtx.currRoom.mesh->type0.type != 1; } -s32 FrameAdvance_IsEnabled(GameState* gameState) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +s32 FrameAdvance_IsEnabled(GameState* thisx) { + PlayState* this = (PlayState*)thisx; - return globalCtx->frameAdvCtx.enabled != 0; + return this->frameAdvCtx.enabled != 0; } // Unused, unchanged from OoT, which uses it only in one Camera function. /** * @brief Tests if \p actor is a door and the sides are different rooms. * - * @param[in] gameState GameState, promoted to globalCtx inside. + * @param[in] thisx GameState, promoted to play inside. * @param[in] actor Actor to test. * @param[out] yaw Facing angle of the actor, or reverse if in the back room. * @return true if \p actor is a door and the sides are in different rooms, false otherwise */ -s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw) { + PlayState* this = (PlayState*)thisx; TransitionActorEntry* transitionActor; s8 frontRoom; @@ -268,7 +268,7 @@ s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) { return false; } - transitionActor = &globalCtx->doorCtx.transitionActorList[(u16)actor->params >> 10]; + transitionActor = &this->doorCtx.transitionActorList[(u16)actor->params >> 10]; frontRoom = transitionActor->sides[0].room; if (frontRoom == transitionActor->sides[1].room) { return false; @@ -287,11 +287,11 @@ s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) { /** * @brief Tests if \p pos is underwater. * - * @param[in] globalCtx GlobalContext + * @param[in] play PlayState * @param[in] pos position to test * @return true if inside a waterbox and not above a void. */ -s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos) { +s32 Play_IsUnderwater(PlayState* this, Vec3f* pos) { WaterBox* waterBox; CollisionPoly* poly; Vec3f waterSurfacePos; @@ -299,10 +299,10 @@ s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos) { waterSurfacePos = *pos; - if ((WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y, + if ((WaterBox_GetSurface1(this, &this->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y, &waterBox) == true) && (pos->y < waterSurfacePos.y) && - (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN)) { + (BgCheck_EntityRaycastFloor3(&this->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN)) { return true; } else { return false; @@ -320,17 +320,17 @@ extern s16 D_801D0D64[]; // Used by Player /** * Extract the common actor cutscene ids used by Player from the scene and set the actor cutscene ids in - * globalCtx->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set + * this->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set * to -1. Otherwise, if there is an ActorCutscene where csCamSceneDataId matches the appropriate element of D_801D0D64, * set the corresponding playerActorCsId (and possibly change its priority for the zeroth one) */ -void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 startActorCsId) { - GlobalContext* globalCtx = (GlobalContext*)gameState; +void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId) { + PlayState* this = (PlayState*)thisx; s32 i; - s16* curPlayerActorCsId = globalCtx->playerActorCsIds; + s16* curPlayerActorCsId = this->playerActorCsIds; s16* phi_s1 = D_801D0D64; - for (i = 0; i < ARRAY_COUNT(globalCtx->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) { + for (i = 0; i < ARRAY_COUNT(this->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) { ActorCutscene* actorCutscene; s32 curActorCsId; @@ -352,7 +352,7 @@ void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 startActorCs } // These regs are used by Gameplay_Draw, and several actors, purpose as yet unclear. -void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5) { +void func_8016A268(GameState* thisx, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5) { MREG(64) = arg1; MREG(65) = arg2; MREG(66) = arg3; diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 7ed1ce5ce6..8cd8207b70 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -9,10 +9,10 @@ ActorFunc sPlayerCallDestroyFunc; ActorFunc sPlayerCallUpdateFunc; ActorFunc sPlayerCallDrawFunc; -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); const ActorInit Player_InitVars = { ACTOR_PLAYER, @@ -26,10 +26,10 @@ const ActorInit Player_InitVars = { (ActorFunc)PlayerCall_Draw, }; -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); void PlayerCall_InitFuncPtrs(void) { sPlayerCallInitFunc = KaleidoManager_GetRamAddr(Player_Init); @@ -38,23 +38,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_quake.c b/src/code/z_quake.c index d57dc8e54b..2ada2ba789 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -303,7 +303,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { s32 ret; u32 eq; Vec3f originVec; - GlobalContext* globalCtx = camera->globalCtx; + PlayState* play = camera->play; originVec.x = 0.0f; originVec.y = 0.0f; @@ -326,7 +326,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->camId] == NULL) { + if (play->cameraPtrs[req->camId] == NULL) { Quake_Remove(req); } else { eq = (camera->camId != req->camera->camId); @@ -382,9 +382,9 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { return ret; } -void Distortion_Init(GlobalContext* globalCtx) { - sDistortionContext.globalCtx = globalCtx; - View_ClearDistortion(&globalCtx->view); +void Distortion_Init(PlayState* play) { + sDistortionContext.play = play; + View_ClearDistortion(&play->view); sDistortionContext.type = 0; sDistortionContext.countdown = 0; sDistortionContext.state = DISTORTION_INACTIVE; @@ -419,9 +419,9 @@ void Distortion_ClearType(s32 type) { * Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed */ s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) { - if (SurfaceType_GetConveyorType(&sDistortionContext.globalCtx->colCtx, player->actor.floorPoly, + if (SurfaceType_GetConveyorType(&sDistortionContext.play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == CONVEYOR_WATER) { - return SurfaceType_GetConveyorSpeed(&sDistortionContext.globalCtx->colCtx, player->actor.floorPoly, + return SurfaceType_GetConveyorSpeed(&sDistortionContext.play->colCtx, player->actor.floorPoly, player->actor.floorBgId); } return 0; @@ -446,9 +446,9 @@ void Distortion_Update(void) { f32 zScale; f32 speed; Player* player; - GlobalContext* globalCtx = sDistortionContext.globalCtx; + PlayState* play = sDistortionContext.play; PosRot playerPosRot; - Camera* camera = GET_ACTIVE_CAM(globalCtx); + Camera* camera = GET_ACTIVE_CAM(play); f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f); if (sDistortionContext.type != 0) { @@ -636,7 +636,7 @@ void Distortion_Update(void) { screenPlanePhase = 0x156; sDistortionContext.countdown = 2; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player != NULL) { Actor_GetWorldPosShapeRot(&playerPosRot, &player->actor); @@ -688,7 +688,7 @@ void Distortion_Update(void) { screenPlanePhase = 0x156; sDistortionContext.countdown = 2; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); depthPhaseStep = 359.2f; screenPlanePhaseStep = -18.5f; @@ -759,20 +759,20 @@ void Distortion_Update(void) { depthPhase += DEGF_TO_BINANG(depthPhaseStep); screenPlanePhase += DEGF_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionDirRot(&sDistortionContext.globalCtx->view, + View_SetDistortionDirRot(&sDistortionContext.play->view, Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor), Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor), Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor)); - View_SetDistortionScale(&sDistortionContext.globalCtx->view, + View_SetDistortionScale(&sDistortionContext.play->view, (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, (Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f); - View_SetDistortionSpeed(&sDistortionContext.globalCtx->view, speed * speedScaleFactor); + View_SetDistortionSpeed(&sDistortionContext.play->view, speed * speedScaleFactor); sDistortionContext.state = DISTORTION_ACTIVE; } else if (sDistortionContext.state != DISTORTION_INACTIVE) { - View_ClearDistortion(&globalCtx->view); + View_ClearDistortion(&play->view); sDistortionContext.state = DISTORTION_INACTIVE; sDistortionContext.countdown = 0; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 1d13be316d..ace1cc4cd3 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -896,8 +896,8 @@ void func_8012C240(GraphicsContext* gfxCtx) { gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); } -void func_8012C268(GlobalContext* globalCtx) { - func_8012C28C(globalCtx->state.gfxCtx); +void func_8012C268(PlayState* play) { + func_8012C28C(play->state.gfxCtx); } void func_8012C28C(GraphicsContext* gfxCtx) { diff --git a/src/code/z_room.c b/src/code/z_room.c index 7579c62008..d3b88bd5de 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,30 +1,30 @@ #include "global.h" -void Room_nop8012D510(GlobalContext* globalCtx, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) { +void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) { } -void Room_DrawType3Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { +void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags) { } -void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { +void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags) { RoomMeshType0* mesh; s32 i; RoomMeshType0Params* meshParams; GraphicsContext* gfxCtx; UNK_TYPE4 pad; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; if (flags & 1) { - func_800BCBF4(&D_801C1D10, globalCtx); + func_800BCBF4(&D_801C1D10, play); gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); - func_8012C268(globalCtx); + func_8012C268(play); gSPMatrix(gfxCtx->polyOpa.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { - func_800BCC68(&D_801C1D10, globalCtx); + func_800BCC68(&D_801C1D10, play); gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPMatrix(gfxCtx->polyXlu.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } @@ -51,18 +51,18 @@ void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E32C.s") -void Room_DrawType1Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { +void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { RoomMeshType1* mesh = &room->mesh->type1; if (mesh->format == 1) { - func_8012DEE8(globalCtx, room, flags); + func_8012DEE8(play, room, flags); } else if (mesh->format == 2) { - func_8012E32C(globalCtx, room, flags); + func_8012E32C(play, room, flags); } else { __assert("../z_room.c", 0x3c5); } } -void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) { +void Room_Init(PlayState* play, RoomContext* roomCtx) { s32 i; roomCtx->currRoom.num = -1; roomCtx->currRoom.segment = NULL; @@ -75,7 +75,7 @@ void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_AllocateAndLoad.s") -s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 index) { +s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { if (roomCtx->unk31 == 0) { s32 size; @@ -84,14 +84,14 @@ s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomCtx->currRoom.segment = NULL; roomCtx->unk31 = 1; - size = globalCtx->roomList[index].vromEnd - globalCtx->roomList[index].vromStart; + size = play->roomList[index].vromEnd - play->roomList[index].vromStart; roomCtx->activeRoomVram = (void*)(((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) & 0xfffffff0); osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1); - DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, globalCtx->roomList[index].vromStart, - size, 0, &roomCtx->loadQueue, NULL); + DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0, + &roomCtx->loadQueue, NULL); roomCtx->activeMemPage ^= 1; return 1; @@ -100,7 +100,7 @@ s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 return 0; } -s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) { +s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { if (roomCtx->unk31 == 1) { if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { roomCtx->unk31 = 0; @@ -108,18 +108,18 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) { // TODO: Segment number enum gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment); - func_80123140(globalCtx, GET_PLAYER(globalCtx)); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); + Scene_ProcessHeader(play, (SceneCmd*)roomCtx->currRoom.segment); + func_80123140(play, GET_PLAYER(play)); + Actor_SpawnTransitionActors(play, &play->actorCtx); - if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && - (globalCtx->sceneNum != SCENE_IKNINSIDE)) { - globalCtx->envCtx.lightSettingOverride = 0xff; - globalCtx->envCtx.unk_E0 = 0; + if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && + (play->sceneNum != SCENE_IKNINSIDE)) { + play->envCtx.lightSettingOverride = 0xff; + play->envCtx.unk_E0 = 0; } func_800FEAB0(); - if (!func_800FE4B8(globalCtx)) { - func_800FD858(globalCtx); + if (!func_800FE4B8(play)) { + func_800FD858(play); } } else { return 0; @@ -129,23 +129,23 @@ s32 Room_HandleLoadCallbacks(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) { // TODO: Segment number enum gSegments[0x03] = PHYSICAL_TO_VIRTUAL(room->segment); - roomDrawFuncs[room->mesh->type0.type](globalCtx, room, flags); + roomDrawFuncs[room->mesh->type0.type](play, room, flags); } return; } -void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtx) { +void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.num = -1; roomCtx->prevRoom.segment = NULL; - func_800BA798(globalCtx, &globalCtx->actorCtx); - Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); + func_800BA798(play, &play->actorCtx); + Actor_SpawnTransitionActors(play, &play->actorCtx); if (-1 < roomCtx->currRoom.num) { - func_8010A33C(globalCtx, roomCtx->currRoom.num); - func_8010A2DC(globalCtx); + func_8010A33C(play, roomCtx->currRoom.num); + func_8010A2DC(play); } - func_801A3CD8(globalCtx->roomCtx.currRoom.echo); + func_801A3CD8(play->roomCtx.currRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index b9dbb35dd5..7d2c4301bb 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -23,17 +23,17 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) { } void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { - GlobalContext* globalCtx = (GlobalContext*)gameState; + PlayState* play = (PlayState*)gameState; s32 pad; u32 spaceSize; s32 i; - if (globalCtx->sceneNum == SCENE_CLOCKTOWER || globalCtx->sceneNum == SCENE_TOWN || - globalCtx->sceneNum == SCENE_BACKTOWN || globalCtx->sceneNum == SCENE_ICHIBA) { + if (play->sceneNum == SCENE_CLOCKTOWER || play->sceneNum == SCENE_TOWN || play->sceneNum == SCENE_BACKTOWN || + play->sceneNum == SCENE_ICHIBA) { spaceSize = OBJECT_SPACE_SIZE_CLOCK_TOWN; - } else if (globalCtx->sceneNum == SCENE_MILK_BAR) { + } else if (play->sceneNum == SCENE_MILK_BAR) { spaceSize = OBJECT_SPACE_SIZE_MILK_BAR; - } else if (globalCtx->sceneNum == SCENE_00KEIKOKU) { + } else if (play->sceneNum == SCENE_00KEIKOKU) { spaceSize = OBJECT_SPACE_SIZE_TERMINA_FIELD; } else { spaceSize = OBJECT_SPACE_SIZE_DEFAULT; @@ -141,45 +141,45 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) { } // SceneTableEntry Header Command 0x00: Spawn List -void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) { s32 loadedCount; s16 playerObjectId; void* nextObject; - globalCtx->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + - globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; - if ((globalCtx->linkActorEntry->params & 0x0F00) >> 8 == 0x0C || + play->linkActorEntry = + (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn; + if ((play->linkActorEntry->params & 0x0F00) >> 8 == 0x0C || (gSaveContext.respawnFlag == 0x02 && gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0x0CFF)) { // Skull Kid Object - Object_Spawn(&globalCtx->objectCtx, OBJECT_STK); + Object_Spawn(&play->objectCtx, OBJECT_STK); return; } - loadedCount = Object_Spawn(&globalCtx->objectCtx, OBJECT_LINK_CHILD); - nextObject = globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment; - globalCtx->objectCtx.num = loadedCount; - globalCtx->objectCtx.spawnedObjectCount = loadedCount; + loadedCount = Object_Spawn(&play->objectCtx, OBJECT_LINK_CHILD); + nextObject = play->objectCtx.status[play->objectCtx.num].segment; + play->objectCtx.num = loadedCount; + play->objectCtx.spawnedObjectCount = loadedCount; playerObjectId = gLinkFormObjectIndexes[(void)0, gSaveContext.save.playerForm]; gActorOverlayTable[0].initInfo->objectId = playerObjectId; - Object_Spawn(&globalCtx->objectCtx, playerObjectId); + Object_Spawn(&play->objectCtx, playerObjectId); - globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment = nextObject; + play->objectCtx.status[play->objectCtx.num].segment = nextObject; } // SceneTableEntry Header Command 0x01: Actor List -void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numSetupActors = cmd->actorList.num; - globalCtx->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment); - globalCtx->actorCtx.unkC = 0; +void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) { + play->numSetupActors = cmd->actorList.num; + play->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment); + play->actorCtx.unkC = 0; } // SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes -void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment); +void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { + play->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment); } // SceneTableEntry Header Command 0x03: Collision Header -void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { CollisionHeader* colHeaderTemp; CollisionHeader* colHeader; @@ -200,55 +200,55 @@ void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { colHeader->waterBoxes = Lib_SegmentedToVirtual(colHeader->waterBoxes); } - BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); + BgCheck_Allocate(&play->colCtx, play, colHeader); } // SceneTableEntry Header Command 0x04: Room List -void Scene_HeaderCmdRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numRooms = cmd->roomList.num; - globalCtx->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment); +void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd) { + play->numRooms = cmd->roomList.num; + play->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment); } // SceneTableEntry Header Command 0x06: Entrance List -void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment); +void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd) { + play->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment); } // SceneTableEntry Header Command 0x07: Special Files -void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { static RomFile tatlMessageFiles[2] = { { SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) }, { SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) }, }; if (cmd->specialFiles.subKeepIndex != 0) { - globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.subKeepIndex); + play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.subKeepIndex); // TODO: Segment number enum? - gSegments[0x05] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + gSegments[0x05] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment); } if (cmd->specialFiles.cUpElfMsgNum != 0) { - globalCtx->unk_18868 = Play_LoadScene(globalCtx, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]); + play->unk_18868 = Play_LoadScene(play, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]); } } // SceneTableEntry Header Command 0x08: Room Behavior -void Scene_HeaderCmdRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; - globalCtx->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; - globalCtx->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; - globalCtx->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1; - globalCtx->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1; - globalCtx->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1; +void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { + play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; + play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1; + play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1; + play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1; } // SceneTableEntry Header Command 0x0A: Mesh Header -void Scene_HeaderCmdMesh(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); +void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) { + play->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List -void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -260,21 +260,21 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { objectEntry = Lib_SegmentedToVirtual(cmd->objectList.segment); k = 0; - i = globalCtx->objectCtx.spawnedObjectCount; - status = &globalCtx->objectCtx.status[i]; - firstObject = globalCtx->objectCtx.status; + i = play->objectCtx.spawnedObjectCount; + status = &play->objectCtx.status[i]; + firstObject = play->objectCtx.status; - while (i < globalCtx->objectCtx.num) { + while (i < play->objectCtx.num) { if (status->id != *objectEntry) { - status2 = &globalCtx->objectCtx.status[i]; + status2 = &play->objectCtx.status[i]; - for (j = i; j < globalCtx->objectCtx.num; j++) { + for (j = i; j < play->objectCtx.num; j++) { status2->id = 0; status2++; } - globalCtx->objectCtx.num = i; - func_800BA6FC(globalCtx, &globalCtx->actorCtx); + play->objectCtx.num = i; + func_800BA6FC(play, &play->actorCtx); continue; } @@ -286,7 +286,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { } while (k < cmd->objectList.num) { - nextPtr = func_8012F73C(&globalCtx->objectCtx, i, *objectEntry); + nextPtr = func_8012F73C(&play->objectCtx, i, *objectEntry); if (i < OBJECT_EXCHANGE_BANK_MAX - 1) { firstObject[i + 1].segment = nextPtr; @@ -297,30 +297,30 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { objectEntry++; } - globalCtx->objectCtx.num = i; + play->objectCtx.num = i; } // SceneTableEntry Header Command 0x0C: Light List -void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = Lib_SegmentedToVirtual(cmd->lightList.segment); for (i = 0; i < cmd->lightList.num; i++) { - LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo); + LightContext_InsertLight(play, &play->lightCtx, lightInfo); lightInfo++; } } // SceneTableEntry Header Command 0x0D: Path List -void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment); +void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd) { + play->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment); } // SceneTableEntry Header Command 0x0E: Transition Actor List -void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->doorCtx.numTransitionActors = cmd->transiActorList.num; - globalCtx->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); - func_80105818(globalCtx, globalCtx->doorCtx.numTransitionActors, globalCtx->doorCtx.transitionActorList); +void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd) { + play->doorCtx.numTransitionActors = cmd->transiActorList.num; + play->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); + func_80105818(play, play->doorCtx.numTransitionActors, play->doorCtx.transitionActorList); } // Init function for the transition system. @@ -329,16 +329,16 @@ void Door_InitContext(GameState* state, DoorContext* doorCtx) { } // SceneTableEntry Header Command 0x0F: Environment Light Settings List -void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; - globalCtx->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment); +void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd) { + play->envCtx.numLightSettings = cmd->lightSettingList.num; + play->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment); } /** * Loads different texture files for each region of the world. * These later are stored in segment 0x06, and used in maps. */ -void Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) { +void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) { static RomFile sceneTextureFiles[9] = { { 0, 0 }, // Default { SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) }, @@ -354,51 +354,51 @@ void Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) { size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart; if (size != 0) { - globalCtx->roomCtx.unk74 = THA_AllocEndAlign16(&globalCtx->state.heap, size); - DmaMgr_SendRequest0(globalCtx->roomCtx.unk74, vromStart, size); + play->roomCtx.unk74 = THA_AllocEndAlign16(&play->state.heap, size); + DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size); } } // SceneTableEntry Header Command 0x11: Skybox Settings -void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->skyboxId = cmd->skyboxSettings.skyboxId & 3; - globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk5; - globalCtx->envCtx.unk_1E = cmd->skyboxSettings.unk6; - Scene_LoadAreaTextures(globalCtx, cmd->skyboxSettings.data1); +void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) { + play->skyboxId = cmd->skyboxSettings.skyboxId & 3; + play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk5; + play->envCtx.unk_1E = cmd->skyboxSettings.unk6; + Scene_LoadAreaTextures(play, cmd->skyboxSettings.data1); } // SceneTableEntry Header Command 0x12: Skybox Disables -void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4; - globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5; +void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd) { + play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4; + play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5; } // SceneTableEntry Header Command 0x10: Time Settings -void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { if (cmd->timeSettings.hour != 0xFF && cmd->timeSettings.min != 0xFF) { gSaveContext.environmentTime = gSaveContext.save.time = (u16)(((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f); } if (cmd->timeSettings.unk6 != 0xFF) { - globalCtx->envCtx.timeIncrement = cmd->timeSettings.unk6; + play->envCtx.timeIncrement = cmd->timeSettings.unk6; } else { - globalCtx->envCtx.timeIncrement = 0; + play->envCtx.timeIncrement = 0; } - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (globalCtx->envCtx.timeIncrement != 0)) { - globalCtx->envCtx.timeIncrement = 5; + if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (play->envCtx.timeIncrement != 0)) { + play->envCtx.timeIncrement = 5; } if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) { - REG(15) = globalCtx->envCtx.timeIncrement; + REG(15) = play->envCtx.timeIncrement; } - globalCtx->envCtx.unk_4 = -(Math_SinS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f; - globalCtx->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f; + play->envCtx.unk_4 = -(Math_SinS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f; + play->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f; - if (globalCtx->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) { + if (play->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) { gSaveContext.environmentTime = gSaveContext.save.time; if (gSaveContext.environmentTime >= CLOCK_TIME(4, 0) && gSaveContext.environmentTime < CLOCK_TIME(6, 30)) { @@ -417,30 +417,30 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x05: Wind Settings -void Scene_HeaderCmdWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) { s8 temp1 = cmd->windSettings.west; s8 temp2 = cmd->windSettings.vertical; s8 temp3 = cmd->windSettings.south; - globalCtx->envCtx.windDir.x = temp1; - globalCtx->envCtx.windDir.y = temp2; - globalCtx->envCtx.windDir.z = temp3; - globalCtx->envCtx.windSpeed = cmd->windSettings.clothIntensity; + play->envCtx.windDir.x = temp1; + play->envCtx.windDir.y = temp2; + play->envCtx.windDir.z = temp3; + play->envCtx.windSpeed = cmd->windSettings.clothIntensity; } // SceneTableEntry Header Command 0x13: Exit List -void Scene_HeaderCmdExitList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment); +void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd) { + play->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment); } // SceneTableEntry Header Command 0x09: Undefined -void Scene_HeaderCmd09(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x15: Sound Settings= -void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq; - globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; +void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { + play->soundCtx.seqIndex = cmd->soundSettings.musicSeq; + play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { audio_setBGM(cmd->soundSettings.bgmId); @@ -448,12 +448,12 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x16: Echo Setting -void Scene_HeaderCmdEchoSetting(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.currRoom.echo = cmd->echoSettings.echo; +void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) { + play->roomCtx.currRoom.echo = cmd->echoSettings.echo; } // SceneTableEntry Header Command 0x18: Alternate Header List= -void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; @@ -462,40 +462,40 @@ void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1]; if (altHeader != NULL) { - Scene_ProcessHeader(globalCtx, Lib_SegmentedToVirtual(altHeader)); + Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader)); (cmd + 1)->base.code = 0x14; } } } // SceneTableEntry Header Command 0x17: Cutscene List -void Scene_HeaderCmdCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->csCtx.sceneCsCount = cmd->base.data1; - globalCtx->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2); +void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) { + play->csCtx.sceneCsCount = cmd->base.data1; + play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List -void Scene_HeaderCmdActorCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { - ActorCutscene_Init(globalCtx, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); +void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd) { + ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); } // SceneTableEntry Header Command 0x1C: Mini Maps -void Scene_HeaderCmdMiniMap(GlobalContext* globalCtx, SceneCmd* cmd) { - func_80104CF4(globalCtx); - func_8010549C(globalCtx, cmd->minimapSettings.segment); +void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd) { + func_80104CF4(play); + func_8010549C(play, cmd->minimapSettings.segment); } // SceneTableEntry Header Command 0x1D: Undefined -void Scene_HeaderCmd1D(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info -void Scene_HeaderCmdMiniMapCompassInfo(GlobalContext* globalCtx, SceneCmd* cmd) { - func_8010565C(globalCtx, cmd->minimapChests.num, cmd->minimapChests.segment); +void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { + func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); } // SceneTableEntry Header Command 0x1A: Sets Area Visited Flag -void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) { +void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -509,7 +509,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) } } - if (globalCtx->sceneNum == gScenesPerRegion[i][j]) { + if (play->sceneNum == gScenesPerRegion[i][j]) { break; } @@ -522,22 +522,22 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) } // SceneTableEntry Header Command 0x1A: Material Animations -void Scene_HeaderCmdAnimatedMaterials(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment); +void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd) { + play->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment); } /** * Sets the exit fade from the next entrance index. */ -void Scene_SetExitFade(GlobalContext* globalCtx) { - globalCtx->unk_1887F = Entrance_GetTransitionFlags(globalCtx->nextEntranceIndex) & 0x7F; +void Scene_SetExitFade(PlayState* play) { + play->unk_1887F = Entrance_GetTransitionFlags(play->nextEntranceIndex) & 0x7F; } /** * Executes all of the commands in a scene or room header. */ -s32 Scene_ProcessHeader(GlobalContext* globalCtx, SceneCmd* header) { - static void (*sceneCmdHandlers[])(GlobalContext*, SceneCmd*) = { +s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { + static void (*sceneCmdHandlers[])(PlayState*, SceneCmd*) = { Scene_HeaderCmdSpawnList, Scene_HeaderCmdActorList, Scene_HeaderCmdActorCutsceneCamList, @@ -580,7 +580,7 @@ s32 Scene_ProcessHeader(GlobalContext* globalCtx, SceneCmd* header) { } if (cmdId < SCENE_CMD_MAX) { - sceneCmdHandlers[cmdId](globalCtx, header); + sceneCmdHandlers[cmdId](play, header); } header++; diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index 8f369008f7..8bb8fa4731 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -22,8 +22,8 @@ static Gfx sSceneDrawDefaultDL[] = { /** * Executes the current scene draw config handler. */ -void Scene_ExecuteDrawConfig(GlobalContext* globalCtx) { - static void (*sceneDrawConfigHandlers[])(GlobalContext*) = { +void Scene_ExecuteDrawConfig(PlayState* play) { + static void (*sceneDrawConfigHandlers[])(PlayState*) = { Scene_DrawConfigDefault, Scene_DrawConfigMatAnim, Scene_DrawConfigDoNothing, @@ -34,27 +34,27 @@ void Scene_ExecuteDrawConfig(GlobalContext* globalCtx) { Scene_DrawConfigMatAnimManualStep, }; - sceneDrawConfigHandlers[globalCtx->sceneConfig](globalCtx); + sceneDrawConfigHandlers[play->sceneConfig](play); } /** * SceneTableEntry Draw Config 0: * Default scene draw config function. This just executes `sSceneDrawDefaultDL`. */ -void Scene_DrawConfigDefault(GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void Scene_DrawConfigDefault(PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, sSceneDrawDefaultDL); gSPDisplayList(POLY_XLU_DISP++, sSceneDrawDefaultDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Returns a pointer to a single layer texture scroll displaylist. */ -Gfx* AnimatedMat_TexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params) { - return Gfx_TexScroll(globalCtx->state.gfxCtx, params->xStep * sMatAnimStep, -(params->yStep * sMatAnimStep), +Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params) { + return Gfx_TexScroll(play->state.gfxCtx, params->xStep * sMatAnimStep, -(params->yStep * sMatAnimStep), params->width, params->height); } @@ -62,11 +62,11 @@ Gfx* AnimatedMat_TexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* * Animated Material Type 0: * Scrolls a single layer texture using the provided `AnimatedMatTexScrollParams`. */ -void AnimatedMat_DrawTexScroll(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawTexScroll(PlayState* play, s32 segment, void* params) { AnimatedMatTexScrollParams* texScrollParams = (AnimatedMatTexScrollParams*)params; - Gfx* texScrollDList = AnimatedMat_TexScroll(globalCtx, texScrollParams); + Gfx* texScrollDList = AnimatedMat_TexScroll(play, texScrollParams); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, texScrollDList); @@ -76,28 +76,27 @@ void AnimatedMat_DrawTexScroll(GlobalContext* globalCtx, s32 segment, void* para gSPSegment(POLY_XLU_DISP++, segment, texScrollDList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Returns a pointer to a two layer texture scroll displaylist. */ -Gfx* AnimatedMat_TwoLayerTexScroll(GlobalContext* globalCtx, AnimatedMatTexScrollParams* params) { - return Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, params[0].xStep * sMatAnimStep, - -(params[0].yStep * sMatAnimStep), params[0].width, params[0].height, 1, - params[1].xStep * sMatAnimStep, -(params[1].yStep * sMatAnimStep), params[1].width, - params[1].height); +Gfx* AnimatedMat_TwoLayerTexScroll(PlayState* play, AnimatedMatTexScrollParams* params) { + return Gfx_TwoTexScroll(play->state.gfxCtx, 0, params[0].xStep * sMatAnimStep, -(params[0].yStep * sMatAnimStep), + params[0].width, params[0].height, 1, params[1].xStep * sMatAnimStep, + -(params[1].yStep * sMatAnimStep), params[1].width, params[1].height); } /** * Animated Material Type 1: * Scrolls a two layer texture using the provided `AnimatedMatTexScrollParams`. */ -void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawTwoTexScroll(PlayState* play, s32 segment, void* params) { AnimatedMatTexScrollParams* texScrollParams = (AnimatedMatTexScrollParams*)params; - Gfx* texScrollDList = AnimatedMat_TwoLayerTexScroll(globalCtx, texScrollParams); + Gfx* texScrollDList = AnimatedMat_TwoLayerTexScroll(play, texScrollParams); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, texScrollDList); @@ -107,16 +106,16 @@ void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* p gSPSegment(POLY_XLU_DISP++, segment, texScrollDList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Generates a displaylist that sets the prim and env color, and stores it in the provided segment ID. */ -void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) { - Gfx* colorDList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); +void AnimatedMat_SetColor(PlayState* play, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) { + Gfx* colorDList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // clang-format off if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, colorDList); } @@ -132,14 +131,14 @@ void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* p gSPEndDisplayList(colorDList++); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Animated Material Type 2: * Color key frame animation without linear interpolation. */ -void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawColor(PlayState* play, s32 segment, void* params) { AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params; F3DPrimColor* primColor = Lib_SegmentedToVirtual(colorAnimParams->primColors); F3DEnvColor* envColor; @@ -150,7 +149,7 @@ void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params) ? (F3DEnvColor*)Lib_SegmentedToVirtual(colorAnimParams->envColors) + curFrame : NULL; - AnimatedMat_SetColor(globalCtx, segment, primColor, envColor); + AnimatedMat_SetColor(play, segment, primColor, envColor); } /** @@ -164,7 +163,7 @@ s32 AnimatedMat_Lerp(s32 min, s32 max, f32 norm) { * Animated Material Type 3: * Color key frame animation with linear interpolation. */ -void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawColorLerp(PlayState* play, s32 segment, void* params) { AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params; F3DPrimColor* primColorMax = Lib_SegmentedToVirtual(colorAnimParams->primColors); F3DEnvColor* envColorMax; @@ -216,7 +215,7 @@ void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* para envColorMax = NULL; } - AnimatedMat_SetColor(globalCtx, segment, &primColorResult, (envColorMax != NULL) ? &envColorResult : NULL); + AnimatedMat_SetColor(play, segment, &primColorResult, (envColorMax != NULL) ? &envColorResult : NULL); } /** @@ -277,7 +276,7 @@ u8 Scene_LagrangeInterpColor(s32 n, f32 x[], f32 fx[], f32 xp) { * Animated Material Type 4: * Color key frame animation with non-linear interpolation. */ -void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawColorNonLinearInterp(PlayState* play, s32 segment, void* params) { AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params; F3DPrimColor* primColorCur = Lib_SegmentedToVirtual(colorAnimParams->primColors); F3DEnvColor* envColorCur = Lib_SegmentedToVirtual(colorAnimParams->envColors); @@ -355,21 +354,21 @@ void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment, envColorCur = NULL; } - AnimatedMat_SetColor(globalCtx, segment, &primColorResult, (envColorCur != NULL) ? &envColorResult : NULL); + AnimatedMat_SetColor(play, segment, &primColorResult, (envColorCur != NULL) ? &envColorResult : NULL); } /** * Animated Material Type 5: * Cycles between a list of textures (imagine like a GIF) */ -void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* params) { +void AnimatedMat_DrawTexCycle(PlayState* play, s32 segment, void* params) { AnimatedMatTexCycleParams* texAnimParams = params; void** texList = Lib_SegmentedToVirtual(texAnimParams->textureList); u8* texId = Lib_SegmentedToVirtual(texAnimParams->textureIndexList); s32 curFrame = sMatAnimStep % texAnimParams->keyFrameLength; void* tex = Lib_SegmentedToVirtual(texList[texId[curFrame]]); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (sMatAnimFlags & 1) { gSPSegment(POLY_OPA_DISP++, segment, tex); @@ -379,15 +378,15 @@ void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* param gSPSegment(POLY_XLU_DISP++, segment, tex); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * This is the main function that handles the animated material system. * There are six different animated material types, which should be set in the provided `AnimatedMaterial`. */ -void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags) { - static void (*matAnimDrawHandlers[])(GlobalContext*, s32 segment, void* params) = { +void AnimatedMat_DrawMain(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step, u32 flags) { + static void (*matAnimDrawHandlers[])(PlayState*, s32 segment, void* params) = { AnimatedMat_DrawTexScroll, AnimatedMat_DrawTwoTexScroll, AnimatedMat_DrawColor, AnimatedMat_DrawColorLerp, AnimatedMat_DrawColorNonLinearInterp, AnimatedMat_DrawTexCycle, }; @@ -402,7 +401,7 @@ void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f do { segment = matAnim->segment; segmentAbs = ((segment < 0) ? -segment : segment) + 7; - matAnimDrawHandlers[matAnim->type](globalCtx, segmentAbs, Lib_SegmentedToVirtual(matAnim->params)); + matAnimDrawHandlers[matAnim->type](play, segmentAbs, Lib_SegmentedToVirtual(matAnim->params)); matAnim++; } while (segment >= 0); } @@ -411,123 +410,123 @@ void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f /** * Draws an animated material to both OPA and XLU buffers. */ -void AnimatedMat_Draw(GlobalContext* globalCtx, AnimatedMaterial* matAnim) { - AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 3); +void AnimatedMat_Draw(PlayState* play, AnimatedMaterial* matAnim) { + AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 3); } /** * Draws an animated material to only the OPA buffer. */ -void AnimatedMat_DrawOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim) { - AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 1); +void AnimatedMat_DrawOpa(PlayState* play, AnimatedMaterial* matAnim) { + AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 1); } /** * Draws an animated material to only the XLU buffer. */ -void AnimatedMat_DrawXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim) { - AnimatedMat_DrawMain(globalCtx, matAnim, 1, globalCtx->gameplayFrames, 2); +void AnimatedMat_DrawXlu(PlayState* play, AnimatedMaterial* matAnim) { + AnimatedMat_DrawMain(play, matAnim, 1, play->gameplayFrames, 2); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) both OPA and XLU buffers. */ -void AnimatedMat_DrawAlpha(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 3); +void AnimatedMat_DrawAlpha(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 3); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) to only the OPA buffer. */ -void AnimatedMat_DrawAlphaOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 1); +void AnimatedMat_DrawAlphaOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 1); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) to only the XLU buffer. */ -void AnimatedMat_DrawAlphaXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, globalCtx->gameplayFrames, 2); +void AnimatedMat_DrawAlphaXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, play->gameplayFrames, 2); } /** * Draws an animated material with a step to both the OPA and XLU buffers. */ -void AnimatedMat_DrawStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step) { - AnimatedMat_DrawMain(globalCtx, matAnim, 1, step, 3); +void AnimatedMat_DrawStep(PlayState* play, AnimatedMaterial* matAnim, u32 step) { + AnimatedMat_DrawMain(play, matAnim, 1, step, 3); } /** * Draws an animated material with a step to only the OPA buffer. */ -void AnimatedMat_DrawStepOpa(GlobalContext* globalCtx, AnimatedMaterial* textures, u32 step) { - AnimatedMat_DrawMain(globalCtx, textures, 1, step, 1); +void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* textures, u32 step) { + AnimatedMat_DrawMain(play, textures, 1, step, 1); } /** * Draws an animated material with a step to only the XLU buffer. */ -void AnimatedMat_DrawStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, u32 step) { - AnimatedMat_DrawMain(globalCtx, matAnim, 1, step, 2); +void AnimatedMat_DrawStepXlu(PlayState* play, AnimatedMaterial* matAnim, u32 step) { + AnimatedMat_DrawMain(play, matAnim, 1, step, 2); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to both the OPA and XLU buffers. */ -void AnimatedMat_DrawAlphaStep(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 3); +void AnimatedMat_DrawAlphaStep(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 3); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to only the OPA buffer. */ -void AnimatedMat_DrawAlphaStepOpa(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 1); +void AnimatedMat_DrawAlphaStepOpa(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 1); } /** * Draws an animated material with an alpha ratio (0.0 - 1.0) and a step to only the XLU buffer. */ -void AnimatedMat_DrawAlphaStepXlu(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { - AnimatedMat_DrawMain(globalCtx, matAnim, alphaRatio, step, 2); +void AnimatedMat_DrawAlphaStepXlu(PlayState* play, AnimatedMaterial* matAnim, f32 alphaRatio, u32 step) { + AnimatedMat_DrawMain(play, matAnim, alphaRatio, step, 2); } /** * SceneTableEntry Draw Config 1: * Allows the usage of the animated material system in scenes. */ -void Scene_DrawConfigMatAnim(GlobalContext* globalCtx) { - AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims); +void Scene_DrawConfigMatAnim(PlayState* play) { + AnimatedMat_Draw(play, play->sceneMaterialAnims); } /** * SceneTableEntry Draw Config 3: * This config is unused, although it is identical to the grotto scene config from Ocarina of Time. */ -void Scene_DrawConfig3(GlobalContext* globalCtx) { +void Scene_DrawConfig3(PlayState* play) { u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - frames = globalCtx->gameplayFrames; + frames = play->gameplayFrames; - gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (frames * 1) % 64, 256, 16)); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, (frames * 1) % 64, 256, 16)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (frames % 128), (frames * 1) % 128, 32, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - (frames % 128), (frames * 1) % 128, 32, 32, 1, frames % 128, (frames * 1) % 128, 32, 32)); gSPSegment(POLY_OPA_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (frames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (frames * 1) % 128, 32, 32)); - gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (frames * 1) % 128, 32, 32)); + gSPSegment(POLY_OPA_DISP++, 0x0B, Gfx_TexScroll(play->state.gfxCtx, 0, (frames * 1) % 128, 32, 32)); - gSPSegment(POLY_XLU_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (frames * 50) % 2048, 8, 512, 1, 0, (frames * 60) % 2048, - 8, 512)); + gSPSegment( + POLY_XLU_DISP++, 0x0C, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (frames * 50) % 2048, 8, 512, 1, 0, (frames * 60) % 2048, 8, 512)); gSPSegment(POLY_OPA_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (frames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (frames * 1) % 128, 32, 32)); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); @@ -535,7 +534,7 @@ void Scene_DrawConfig3(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -543,16 +542,16 @@ void Scene_DrawConfig3(GlobalContext* globalCtx) { * This config is unused and just has a single TwoTexScroll intended for two 32x32 textures (likely two water textures). * It is identical to the Castle Courtyard and Sacred Forest Meadow scene config from Ocarina of Time. */ -void Scene_DrawConfig4(GlobalContext* globalCtx) { +void Scene_DrawConfig4(PlayState* play) { u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - frames = globalCtx->gameplayFrames; + frames = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, (frames * 1) % 128, 32, 32, 1, - frames % 128, (frames * 1) % 128, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 127 - frames % 128, (frames * 1) % 128, 32, 32, 1, frames % 128, + (frames * 1) % 128, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -560,20 +559,20 @@ void Scene_DrawConfig4(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * SceneTableEntry Draw Config 2: * Has no effect, and is only used in SPOT00 (cutscene scene). */ -void Scene_DrawConfigDoNothing(GlobalContext* globalCtx) { +void Scene_DrawConfigDoNothing(PlayState* play) { } /** * Stores a displaylist in the provided segment ID that sets a render mode from the index provided. */ -void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) { +void Scene_SetRenderModeXlu(PlayState* play, s32 index, u32 flags) { static Gfx renderModeSetNoneDL[] = { gsSPEndDisplayList(), // These instructions will never get executed @@ -612,7 +611,7 @@ void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) { }; Gfx* dList = dLists[index]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (flags & 1) { gSPSegment(POLY_OPA_DISP++, 0x0C, dList); @@ -622,14 +621,14 @@ void Scene_SetRenderModeXlu(GlobalContext* globalCtx, s32 index, u32 flags) { gSPSegment(POLY_XLU_DISP++, 0x0C, dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * Although this function is unused, it will store a displaylist in the provided segment ID that sets the culling mode * from the index provided. */ -void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) { +void Scene_SetCullFlag(PlayState* play, s32 index, u32 flags) { static Gfx setBackCullDL[] = { gsSPSetGeometryMode(G_CULL_BACK), gsSPEndDisplayList(), @@ -644,7 +643,7 @@ void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) { }; Gfx* dList = dLists[index]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (flags & 1) { gSPSegment(POLY_OPA_DISP++, 0x0C, dList); @@ -654,37 +653,37 @@ void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) { gSPSegment(POLY_XLU_DISP++, 0x0C, dList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * SceneTableEntry Draw Config 5: * This config is unused, and its purpose is unknown. */ -void Scene_DrawConfig5(GlobalContext* globalCtx) { +void Scene_DrawConfig5(PlayState* play) { u32 dListIndex; u32 alpha; - if (globalCtx->roomCtx.unk7A[0] != 0) { + if (play->roomCtx.unk7A[0] != 0) { dListIndex = 1; - alpha = globalCtx->roomCtx.unk7A[1]; + alpha = play->roomCtx.unk7A[1]; } else { dListIndex = 0; alpha = 255; } if (alpha == 0) { - globalCtx->roomCtx.unk78 = 0; + play->roomCtx.unk78 = 0; } else { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - globalCtx->roomCtx.unk78 = 1; - AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims); - Scene_SetRenderModeXlu(globalCtx, dListIndex, 3); + play->roomCtx.unk78 = 1; + AnimatedMat_Draw(play, play->sceneMaterialAnims); + Scene_SetRenderModeXlu(play, dListIndex, 3); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, alpha); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -693,8 +692,8 @@ void Scene_DrawConfig5(GlobalContext* globalCtx) { * This is a special draw config for Sakon's Hideout, as well as the Music Box House. Its step value is set manually * rather than always animating like `Scene_DrawConfigMatAnim`. */ -void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx) { - AnimatedMat_DrawStep(globalCtx, globalCtx->sceneMaterialAnims, globalCtx->roomCtx.unk7A[0]); +void Scene_DrawConfigMatAnimManualStep(PlayState* play) { + AnimatedMat_DrawStep(play, play->sceneMaterialAnims, play->roomCtx.unk7A[0]); } /** @@ -703,7 +702,7 @@ void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx) { * fraction to a certain value when certain flags are set, which are likely used for the pipes whenever they are * activated. */ -void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) { +void Scene_DrawConfigGreatBayTemple(PlayState* play) { static Gfx greatBayTempleColorSetDL[] = { gsDPSetPrimColor(0, 255, 255, 255, 255, 255), gsSPEndDisplayList(), @@ -713,18 +712,18 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) { Gfx* dListHead; Gfx* dList; - if (Flags_GetSwitch(globalCtx, 0x33) && Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35) && - Flags_GetSwitch(globalCtx, 0x36)) { - BgCheck_SetContextFlags(&globalCtx->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW); + if (Flags_GetSwitch(play, 0x33) && Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) && + Flags_GetSwitch(play, 0x36)) { + BgCheck_SetContextFlags(&play->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW); } else { - BgCheck_UnsetContextFlags(&globalCtx->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW); + BgCheck_UnsetContextFlags(&play->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW); } - dList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 18); + dList = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 18); - AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims); + AnimatedMat_Draw(play, play->sceneMaterialAnims); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (dListHead = dList, i = 0; i < 9; i++, dListHead += 2) { lodFrac = 0; @@ -733,50 +732,48 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) { switch (i) { case 0: - if (Flags_GetSwitch(globalCtx, 0x33) && Flags_GetSwitch(globalCtx, 0x34) && - Flags_GetSwitch(globalCtx, 0x35) && Flags_GetSwitch(globalCtx, 0x36)) { + if (Flags_GetSwitch(play, 0x33) && Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) && + Flags_GetSwitch(play, 0x36)) { lodFrac = 255; } break; case 1: - if (Flags_GetSwitch(globalCtx, 0x37)) { + if (Flags_GetSwitch(play, 0x37)) { lodFrac = 68; } break; case 2: - if (Flags_GetSwitch(globalCtx, 0x37) && Flags_GetSwitch(globalCtx, 0x38)) { + if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38)) { lodFrac = 68; } break; case 3: - if (Flags_GetSwitch(globalCtx, 0x37) && Flags_GetSwitch(globalCtx, 0x38) && - Flags_GetSwitch(globalCtx, 0x39)) { + if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38) && Flags_GetSwitch(play, 0x39)) { lodFrac = 68; } break; case 4: - if (!(Flags_GetSwitch(globalCtx, 0x33))) { + if (!(Flags_GetSwitch(play, 0x33))) { lodFrac = 68; } break; case 5: - if (Flags_GetSwitch(globalCtx, 0x34)) { + if (Flags_GetSwitch(play, 0x34)) { lodFrac = 68; } break; case 6: - if (Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35)) { + if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35)) { lodFrac = 68; } break; case 7: - if (Flags_GetSwitch(globalCtx, 0x34) && Flags_GetSwitch(globalCtx, 0x35) && - Flags_GetSwitch(globalCtx, 0x36)) { + if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) && Flags_GetSwitch(play, 0x36)) { lodFrac = 68; } break; case 8: - if (Flags_GetSwitch(globalCtx, 0x3A)) { + if (Flags_GetSwitch(play, 0x3A)) { lodFrac = 68; } break; @@ -788,5 +785,5 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x06, dList); gSPSegment(POLY_XLU_DISP++, 0x06, dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c index 4c57a57d4f..2380cef137 100644 --- a/src/code/z_schedule.c +++ b/src/code/z_schedule.c @@ -6,7 +6,7 @@ (dest) = (temp) * (0x10000 / 60 / 24.0f); \ (dest) = SCHEDULE_CONVERT_TIME(dest); -s32 Schedule_CheckFlagS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckFlagS* cmd = (ScheduleCmdCheckFlagS*)*script; u16 flag = (cmd->flagByte << 8) | cmd->flagMask; @@ -17,7 +17,7 @@ s32 Schedule_CheckFlagS(GlobalContext* globalCtx, u8** script, ScheduleResult* r return false; } -s32 Schedule_CheckFlagL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckFlagL* cmd = (ScheduleCmdCheckFlagL*)*script; u16 flag = (cmd->flagByte << 8) | cmd->flagMask; @@ -28,7 +28,7 @@ s32 Schedule_CheckFlagL(GlobalContext* globalCtx, u8** script, ScheduleResult* r return false; } -s32 Schedule_CheckTimeRangeS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* result) { s32 inRange = false; ScheduleCmdCheckTimeRangeS* cmd = (ScheduleCmdCheckTimeRangeS*)*script; f32 f; @@ -54,7 +54,7 @@ s32 Schedule_CheckTimeRangeS(GlobalContext* globalCtx, u8** script, ScheduleResu return false; } -s32 Schedule_CheckTimeRangeL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* result) { s32 inRange = false; ScheduleCmdCheckTimeRangeL* cmd = (ScheduleCmdCheckTimeRangeL*)*script; f32 f; @@ -80,7 +80,7 @@ s32 Schedule_CheckTimeRangeL(GlobalContext* globalCtx, u8** script, ScheduleResu return false; } -s32 Schedule_ReturnValueL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdReturnValueL* cmd = (ScheduleCmdReturnValueL*)*script; //! @bug result is a u8, value is truncated @@ -90,36 +90,36 @@ s32 Schedule_ReturnValueL(GlobalContext* globalCtx, u8** script, ScheduleResult* return true; } -s32 Schedule_ReturnNone(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleResult* result) { result->hasResult = false; return true; } -s32 Schedule_ReturnEmpty(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleResult* result) { result->hasResult = true; return true; } -s32 Schedule_Nop(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_Nop(PlayState* play, u8** script, ScheduleResult* result) { return false; } -s32 Schedule_CheckMiscS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckMiscS* cmd = (ScheduleCmdCheckMiscS*)*script; if (((cmd->which == SCHEDULE_CHECK_MISC_ROOM_KEY) && (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_ROOM_KEY)) || ((cmd->which == SCHEDULE_CHECK_MISC_LETTER_TO_KAFEI) && (INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_LETTER_TO_KAFEI)) || - ((cmd->which == SCHEDULE_CHECK_MISC_MASK_ROMANI) && (Player_GetMask(globalCtx) == PLAYER_MASK_ROMANI))) { + ((cmd->which == SCHEDULE_CHECK_MISC_MASK_ROMANI) && (Player_GetMask(play) == PLAYER_MASK_ROMANI))) { *script += cmd->offset; } return false; } -s32 Schedule_ReturnValueS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdReturnValueS* cmd = (ScheduleCmdReturnValueS*)*script; result->result = cmd->result; @@ -128,29 +128,29 @@ s32 Schedule_ReturnValueS(GlobalContext* globalCtx, u8** script, ScheduleResult* return true; } -s32 Schedule_CheckNotInSceneS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script; s16 scene = (cmd->sceneH << 8) | cmd->sceneL; - if (scene != globalCtx->sceneNum) { + if (scene != play->sceneNum) { *script += cmd->offset; } return false; } -s32 Schedule_CheckNotInSceneL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script; s16 scene = (cmd->sceneH << 8) | cmd->sceneL; - if (scene != globalCtx->sceneNum) { + if (scene != play->sceneNum) { *script = *script + (s16)((cmd->offsetH << 8) | cmd->offsetL); } return false; } -s32 Schedule_CheckNotInDayS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckNotInDayS* cmd = (ScheduleCmdCheckNotInDayS*)*script; s16 day = (cmd->dayH << 8) | cmd->dayL; @@ -161,7 +161,7 @@ s32 Schedule_CheckNotInDayS(GlobalContext* globalCtx, u8** script, ScheduleResul return false; } -s32 Schedule_CheckNotInDayL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckNotInDayL* cmd = (ScheduleCmdCheckNotInDayL*)*script; s16 day = (cmd->dayH << 8) | cmd->dayL; @@ -172,7 +172,7 @@ s32 Schedule_CheckNotInDayL(GlobalContext* globalCtx, u8** script, ScheduleResul return false; } -s32 Schedule_ReturnTime(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdReturnTime* cmd = (ScheduleCmdReturnTime*)*script; f32 f; u16 time0; @@ -191,7 +191,7 @@ s32 Schedule_ReturnTime(GlobalContext* globalCtx, u8** script, ScheduleResult* r return true; } -s32 Schedule_CheckBeforeTimeS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckBeforeTimeS* cmd = (ScheduleCmdCheckBeforeTimeS*)*script; f32 f; u16 testTime; @@ -208,7 +208,7 @@ s32 Schedule_CheckBeforeTimeS(GlobalContext* globalCtx, u8** script, ScheduleRes return false; } -s32 Schedule_CheckBeforeTimeL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdCheckBeforeTimeL* cmd = (ScheduleCmdCheckBeforeTimeL*)*script; f32 f; u16 testTime; @@ -225,21 +225,21 @@ s32 Schedule_CheckBeforeTimeL(GlobalContext* globalCtx, u8** script, ScheduleRes return false; } -s32 Schedule_BranchS(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdBranchS* cmd = (ScheduleCmdBranchS*)*script; *script += cmd->offset; return false; } -s32 Schedule_BranchL(GlobalContext* globalCtx, u8** script, ScheduleResult* result) { +s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleResult* result) { ScheduleCmdBranchL* cmd = (ScheduleCmdBranchL*)*script; *script += (s16)((cmd->offsetH << 8) | cmd->offsetL); return false; } -static s32 (*sScheduleCmdFuncs[])(GlobalContext*, u8**, ScheduleResult*) = { +static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleResult*) = { Schedule_CheckFlagS, Schedule_CheckFlagL, Schedule_CheckTimeRangeS, Schedule_CheckTimeRangeL, Schedule_ReturnValueL, Schedule_ReturnNone, Schedule_ReturnEmpty, Schedule_Nop, Schedule_CheckMiscS, Schedule_ReturnValueS, Schedule_CheckNotInSceneS, Schedule_CheckNotInSceneL, @@ -269,13 +269,13 @@ static u8 sScheduleCmdSizes[] = { sizeof(ScheduleCmdBranchL), }; -s32 Schedule_RunScript(GlobalContext* globalCtx, u8* script, ScheduleResult* result) { +s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result) { u8 size; s32 stop; do { size = sScheduleCmdSizes[*script]; - stop = (*sScheduleCmdFuncs[*script])(globalCtx, &script, result); + stop = (*sScheduleCmdFuncs[*script])(play, &script, result); script += size; } while (!stop); diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 4c77b36691..a223576245 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -2,14 +2,14 @@ #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_LoopPartial(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation); void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle); -void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, +void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, f32 frame, f32 frameCount, u8 animationMode, f32 morphFrames); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); @@ -24,14 +24,14 @@ s32 sDisableAnimQueueFlags; /* * Draws the limb at `limbIndex` with a level of detail display lists index by `dListIndex` */ -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, Actor* actor, s32 lod) { LodLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); limb = Lib_SegmentedToVirtual(skeleton[limbIndex]); @@ -43,12 +43,12 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele pos.z = limb->jointPos.z; dList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) { + if ((overrideLimbDraw == NULL) || (overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor) == 0)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; - gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&polyTemp[1], dList); POLY_OPA_DISP = &polyTemp[2]; @@ -56,29 +56,28 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor); + postLimbDraw(play, limbIndex, &dList, &rot, actor); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod); + SkelAnime_DrawLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - lod); + SkelAnime_DrawLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * 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, Actor* actor, s32 lod) { +void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, + PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod) { LodLimb* rootLimb; s32 pad; Gfx* dList; @@ -89,7 +88,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -101,12 +100,12 @@ 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, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; - gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&polyTemp[1], dList); @@ -115,24 +114,23 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, actor); + postLimbDraw(play, 1, &dList, &rot, actor); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - lod); + SkelAnime_DrawLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * 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, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx) { LodLimb* limb; @@ -141,7 +139,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -156,7 +154,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*mtx); @@ -170,22 +168,22 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &newDList, &limbDList, &rot, actor); + postLimbDraw(play, limbIndex, &newDList, &limbDList, &rot, actor); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - lod, mtx); + SkelAnime_DrawFlexLimbLod(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod, + mtx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - lod, mtx); + SkelAnime_DrawFlexLimbLod(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, lod, + mtx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -193,7 +191,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, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod) { LodLimb* rootLimb; @@ -202,13 +200,13 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); if (skeleton == NULL) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); Matrix_Push(); @@ -222,7 +220,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dLists[lod]; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; @@ -238,30 +236,30 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &newDList, &limbDList, &rot, actor); + postLimbDraw(play, 1, &newDList, &limbDList, &rot, actor); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbLod(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, lod, &mtx); + SkelAnime_DrawFlexLimbLod(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + lod, &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /* * Draws the limb of the Skeleton `skeleton` at `limbIndex` */ -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, Actor* actor) { StandardLimb* limb; Gfx* dList; Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -273,39 +271,39 @@ 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, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; - gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&polyTemp[1], dList); POLY_OPA_DISP = &polyTemp[2]; } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor); + postLimbDraw(play, limbIndex, &dList, &rot, actor); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); + SkelAnime_DrawLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); + SkelAnime_DrawLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** * 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, Actor* actor) { +void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, + PostLimbDrawOpa postLimbDraw, Actor* actor) { StandardLimb* rootLimb; s32 pad; Gfx* dList; @@ -316,7 +314,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); rootLimb = Lib_SegmentedToVirtual(skeleton[0]); @@ -328,31 +326,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, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; - gSPMatrix(&polyTemp[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&polyTemp[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&polyTemp[1], dList); POLY_OPA_DISP = &polyTemp[2]; } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, actor); + postLimbDraw(play, 1, &dList, &rot, actor); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); + SkelAnime_DrawLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -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, Actor* actor, Mtx** limbMatricies) { StandardLimb* limb; @@ -361,7 +359,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -375,7 +373,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*limbMatricies); @@ -389,22 +387,22 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor); + postLimbDraw(play, limbIndex, &limbDList, &rot, actor); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + SkelAnime_DrawFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, limbMatricies); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + SkelAnime_DrawFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, limbMatricies); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -412,7 +410,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, Actor* actor) { StandardLimb* rootLimb; s32 pad; @@ -420,13 +418,13 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); if (skeleton == NULL) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); @@ -441,7 +439,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; @@ -459,20 +457,20 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, actor); + postLimbDraw(play, 1, &limbDList, &rot, actor); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, &mtx); + SkelAnime_DrawFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx) { StandardLimb* limb; @@ -481,7 +479,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, Vec3f pos; Vec3s rot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -495,11 +493,11 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Push(); - transformLimbDraw(globalCtx, limbIndex, actor); + transformLimbDraw(play, limbIndex, actor); if (newDList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; @@ -518,22 +516,22 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor); + postLimbDraw(play, limbIndex, &limbDList, &rot, actor); } if (limb->child != LIMB_DONE) { - SkelAnime_DrawTransformFlexLimbOpa(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + SkelAnime_DrawTransformFlexLimbOpa(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, mtx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - SkelAnime_DrawTransformFlexLimbOpa(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, - postLimbDraw, transformLimbDraw, actor, mtx); + SkelAnime_DrawTransformFlexLimbOpa(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + transformLimbDraw, actor, mtx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -545,7 +543,7 @@ void SkelAnime_DrawTransformFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, * coordinates. * Note that the `TransformLimbDraw` does not have a NULL check, so must be provided even if empty. */ -void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor) { StandardLimb* rootLimb; @@ -560,9 +558,9 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); + mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); @@ -577,11 +575,11 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Push(); - transformLimbDraw(globalCtx, 1, actor); + transformLimbDraw(play, 1, actor); if (newDList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; @@ -599,17 +597,17 @@ void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, V } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, actor); + postLimbDraw(play, 1, &limbDList, &rot, actor); } if (rootLimb->child != LIMB_DONE) { - SkelAnime_DrawTransformFlexLimbOpa(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, - postLimbDraw, transformLimbDraw, actor, &mtx); + SkelAnime_DrawTransformFlexLimbOpa(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + transformLimbDraw, actor, &mtx); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -651,7 +649,7 @@ s16 Animation_GetLastFrame(void* animation) { * Draws the Skeleton `skeleton`'s limb at index `limbIndex`. Appends all generated graphics commands to * `gfx`. Returns a pointer to the next gfx to be appended to. */ -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, Actor* actor, Gfx* gfx) { StandardLimb* limb; Gfx* dList; @@ -670,29 +668,27 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton dList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&gfx[1], dList); gfx = &gfx[2]; } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor, &gfx); + postLimbDraw(play, limbIndex, &dList, &rot, actor, &gfx); } if (limb->child != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - gfx); + gfx = SkelAnime_DrawLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, - gfx); + gfx = SkelAnime_DrawLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, gfx); } return gfx; @@ -702,7 +698,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton * Draws the Skeleton `skeleton` Appends all generated graphics to `gfx`, and returns a pointer to the * next gfx to be appended to. */ -Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, +Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -726,22 +722,22 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable dList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &dList, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&gfx[1], dList); gfx = &gfx[2]; } } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &dList, &rot, actor, &gfx); + postLimbDraw(play, 1, &dList, &rot, actor, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, gfx); + gfx = + SkelAnime_DrawLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, gfx); } Matrix_Pop(); @@ -752,7 +748,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, Actor* actor, Mtx** mtx, Gfx* gfx) { StandardLimb* limb; @@ -773,7 +769,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { gSPMatrix(&gfx[0], Matrix_ToMtx(*mtx), G_MTX_LOAD); @@ -789,19 +785,19 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx); + postLimbDraw(play, limbIndex, &limbDList, &rot, actor, &gfx); } if (limb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + mtx, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + mtx, gfx); } return gfx; @@ -812,7 +808,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, Actor* actor, Gfx* gfx) { StandardLimb* rootLimb; s32 pad; @@ -826,7 +822,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT return NULL; } - mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); + mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * dListCount)); gSPSegment(gfx++, 0x0D, mtx); @@ -842,7 +838,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT newDList = limbDList = rootLimb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDList, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { gSPMatrix(&gfx[0], Matrix_ToMtx(mtx), G_MTX_LOAD); @@ -858,12 +854,12 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, actor, &gfx); + postLimbDraw(play, 1, &limbDList, &rot, actor, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SkelAnime_DrawFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, - actor, &mtx, gfx); + gfx = SkelAnime_DrawFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, actor, + &mtx, gfx); } Matrix_Pop(); @@ -966,14 +962,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; } @@ -994,9 +990,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, ANIMATION_LINKANIMETION); + AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMATION_LINKANIMETION); if (entry != NULL) { LinkAnimationHeader* linkAnimHeader = Lib_SegmentedToVirtual(animation); @@ -1012,8 +1008,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; @@ -1026,8 +1022,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; @@ -1041,8 +1037,8 @@ void AnimationContext_SetInterp(GlobalContext* globalCtx, s32 vecCount, Vec3s* b /** * Requests copying vectors from src frame table to dst frame table whose load 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; @@ -1056,8 +1052,8 @@ void AnimationContext_SetCopyTrue(GlobalContext* globalCtx, s32 vecCount, Vec3s* /** * Requests copying vectors from src frame table to dst frame table whose load 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; @@ -1071,8 +1067,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; @@ -1084,7 +1080,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); @@ -1093,7 +1089,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)) { @@ -1110,7 +1106,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)) { @@ -1121,7 +1117,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)) { @@ -1141,7 +1137,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)) { @@ -1161,7 +1157,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; @@ -1175,11 +1171,11 @@ 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) { AnimationEntry* entry = animationCtx->entries; for (; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { - sAnimationLoadDone[entry->type](globalCtx, &entry->data); + sAnimationLoadDone[entry->type](play, &entry->data); } sAnimQueueFlags = 1; @@ -1190,7 +1186,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; @@ -1228,7 +1224,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel skelAnime->morphTable = (Vec3s*)ALIGN16((u32)morphTable); } - 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); } /** @@ -1247,24 +1243,24 @@ 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.link(globalCtx, skelAnime); +s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { + return skelAnime->update.link(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 = (s32)globalCtx->state.framerateDivisor * 0.5f; + f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; skelAnime->morphWeight -= skelAnime->morphRate * updateRate; if (skelAnime->morphWeight <= 0.0f) { 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; } @@ -1273,16 +1269,16 @@ 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 = (s32)globalCtx->state.framerateDivisor * 0.5f; + f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; skelAnime->morphWeight -= skelAnime->morphRate * updateRate; 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); } } @@ -1291,8 +1287,8 @@ void LinkAnimation_AnimateFrame(GlobalContext* globalCtx, SkelAnime* skelAnime) /** * Advances a Link animation that loops over its full length */ -s32 LinkAnimation_Loop(GlobalContext* globalCtx, SkelAnime* skelAnime) { - f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f; +s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { + f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; skelAnime->curFrame += skelAnime->playSpeed * updateRate; if (skelAnime->curFrame < 0.0f) { @@ -1300,18 +1296,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) { - f32 updateRate = (s32)globalCtx->state.framerateDivisor * 0.5f; +s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) { + f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; if (skelAnime->curFrame == skelAnime->endFrame) { - LinkAnimation_AnimateFrame(globalCtx, skelAnime); + LinkAnimation_AnimateFrame(play, skelAnime); return 1; } @@ -1326,14 +1322,14 @@ s32 LinkAnimation_Once(GlobalContext* globalCtx, SkelAnime* skelAnime) { 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; } @@ -1344,7 +1340,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))) { @@ -1354,15 +1350,14 @@ void LinkAnimation_Change(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAn morphFrames = -morphFrames; } else { skelAnime->update.link = 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; } @@ -1378,104 +1373,100 @@ 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->common), +void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), 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->common), + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), 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->common), +void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { + LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), 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->common), + LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), 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 */ -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); } /** @@ -1525,7 +1516,7 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) { /** * Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided. */ -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +void SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { SkeletonHeader* skeletonHeader; @@ -1548,7 +1539,7 @@ void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHead /** * Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given. */ -void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, +void SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) { FlexSkeletonHeader* skeletonHeader; @@ -1963,7 +1954,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_Free(skelAnime->jointTable); } diff --git a/src/code/z_skin.c b/src/code/z_skin.c index de449c02d0..0d3e0bf85d 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -182,11 +182,11 @@ void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dLis CLOSE_DISPS(gfxCtx); } -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; SkinLimb** skeleton; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -212,7 +212,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD s32 segmentType; if (overrideLimbDraw != NULL) { - shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin); + shouldDraw = overrideLimbDraw(actor, play, i, skin); } segmentType = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segmentType; @@ -225,7 +225,7 @@ void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostD } if (postDraw != NULL) { - postDraw(actor, globalCtx, skin); + postDraw(actor, play, skin); } close_disps:; @@ -233,26 +233,26 @@ close_disps:; } // allows specifying postDraw and setTranslation -void func_80138228(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { - Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0); +void func_80138228(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { + Skin_DrawImpl(actor, play, skin, postDraw, NULL, setTranslation, false, 0); } // allows specifying OverrideLimbDraw, postDraw and setTranslation -void func_80138258(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_80138258(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, postDraw, setTranslation, and arg6 -void func_8013828C(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_8013828C(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_801382C4(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, +void func_801382C4(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 d45b9bc250..edbcef05f0 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -105,7 +105,7 @@ void Skin_Free(GameState* gameState, Skin* skin) { ZeldaArena_Free(skin->vtxTable); } - SkelAnime_Free(&skin->skelAnime, (GlobalContext*)gameState); + SkelAnime_Free(&skin->skelAnime, (PlayState*)gameState); } } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index f85f33f0a7..2156950f1f 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -2,10 +2,10 @@ typedef struct { Actor actor; - s32 (*pictoFunc)(GlobalContext* globalCtx, Actor* actor); + s32 (*pictoFunc)(PlayState* play, Actor* actor); } PictoActor; -s32 func_8013A240(GlobalContext* globalCtx) { +s32 func_8013A240(PlayState* play) { PictoActor* pictoActor; Actor* actor; s32 type = 0; @@ -15,15 +15,15 @@ s32 func_8013A240(GlobalContext* globalCtx) { gSaveContext.save.pictoFlags0 = 0; gSaveContext.save.pictoFlags1 = 0; - if (globalCtx->sceneNum == SCENE_20SICHITAI) { + if (play->sceneNum == SCENE_20SICHITAI) { func_8013A41C(1); } for (; type < 12; type++) { - for (actor = globalCtx->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) { + for (actor = play->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) { seen = 0; - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_20SICHITAI: if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) { seen = 1; @@ -63,7 +63,7 @@ s32 func_8013A240(GlobalContext* globalCtx) { if (seen != 0) { pictoActor = (PictoActor*)actor; if (pictoActor->pictoFunc != NULL) { - if ((pictoActor->pictoFunc)(globalCtx, actor) == 0) { + if ((pictoActor->pictoFunc)(play, actor) == 0) { count++; } } @@ -107,14 +107,14 @@ s16 func_8013A504(s16 val) { return (val >= 0) ? val : -val; } -s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, - f32 distanceMax, s16 angleError) { +s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, + s16 angleError) { Vec3f screenSpace; s16 x; s16 y; f32 distance; CollisionPoly* poly; - Camera* camera = GET_ACTIVE_CAM(globalCtx); + Camera* camera = GET_ACTIVE_CAM(play); Actor* actors[2]; s32 ret = 0; s32 bgId; @@ -132,7 +132,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, ret |= 0x3E; } - Actor_GetProjectedPos(globalCtx, pos, &screenSpace, &distance); + Actor_GetProjectedPos(play, pos, &screenSpace, &distance); x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85; y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67; if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) { @@ -140,15 +140,15 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, ret |= 0x3D; } - if (BgCheck_ProjectileLineTest(&globalCtx->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true, + if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true, &bgId)) { func_8013A41C(0x3C); ret |= 0x3C; } actors[0] = actor; - actors[1] = &GET_PLAYER(globalCtx)->actor; - if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2)) { + actors[1] = &GET_PLAYER(play)->actor; + if (CollisionCheck_LineOCCheck(play, &play->colChkCtx, pos, &camera->eye, actors, 2)) { func_8013A41C(0x3B); ret |= 0x3B; } diff --git a/src/code/z_sound_source.c b/src/code/z_sound_source.c index ba7036a4ce..2cdc3ab3aa 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); if (source->playSfxEachFrame) { Audio_PlaySfxAtPos(&source->projectedPos, source->sfxId); } @@ -29,15 +29,15 @@ void SoundSource_UpdateAll(GlobalContext* globalCtx) { } } -void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId, u32 playSfxEachFrame) { +void SoundSource_Add(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId, u32 playSfxEachFrame) { s32 countdown; SoundSource* source; s32 smallestCountdown = 0xFFFF; SoundSource* backupSource = NULL; 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; } @@ -52,7 +52,7 @@ void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u1 } // 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); } @@ -62,14 +62,14 @@ void SoundSource_Add(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u1 source->playSfxEachFrame = playSfxEachFrame; source->sfxId = sfxId; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &source->worldPos, &source->projectedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); Audio_PlaySfxAtPos(&source->projectedPos, sfxId); } -void SoundSource_PlaySfxAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) { - SoundSource_Add(globalCtx, worldPos, duration, sfxId, false); +void SoundSource_PlaySfxAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId) { + SoundSource_Add(play, worldPos, duration, sfxId, false); } -void SoundSource_PlaySfxEachFrameAtFixedWorldPos(GlobalContext* globalCtx, Vec3f* worldPos, u32 duration, u16 sfxId) { - SoundSource_Add(globalCtx, worldPos, duration, sfxId, true); +void SoundSource_PlaySfxEachFrameAtFixedWorldPos(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId) { + SoundSource_Add(play, worldPos, duration, sfxId, true); } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 90b60809ef..5129212c2c 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -226,7 +226,7 @@ void Sram_ClearFlagsAtDawnOfTheFirstDay(void) { /** * Used by Song of Time (when clicking "Yes") and (indirectly) by the "Dawn of the New Day" cutscene */ -void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { +void Sram_SaveEndOfCycle(PlayState* play) { s16 sceneNum; s32 j; s32 i; @@ -243,14 +243,14 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { gSaveContext.save.playerData.deaths = 999; } - sceneNum = Play_GetOriginalSceneNumber(globalCtx->sceneNum); - Play_SaveCycleSceneFlags(&globalCtx->state); + sceneNum = Play_GetOriginalSceneNumber(play->sceneNum); + Play_SaveCycleSceneFlags(&play->state); - globalCtx->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2]; - globalCtx->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0]; - globalCtx->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1]; - globalCtx->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3]; - globalCtx->actorCtx.flags.clearedRoom = 0; + play->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2]; + play->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0]; + play->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1]; + play->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3]; + play->actorCtx.flags.clearedRoom = 0; for (i = 0; i < SCENE_MAX; i++) { gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0]; @@ -346,7 +346,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { for (j = 1; j < 4; j++) { if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) { SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE); - func_80112B40(globalCtx, j); + func_80112B40(play, j); } } gSaveContext.save.inventory.items[i] = ITEM_BOTTLE; @@ -415,7 +415,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { for (j = 1; j < 4; j++) { if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) { SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE); - func_80112B40(globalCtx, j); + func_80112B40(play, j); } } @@ -446,7 +446,7 @@ void Sram_SaveEndOfCycle(GlobalContext* globalCtx) { gSaveContext.jinxTimer = 0; gSaveContext.rupeeAccumulator = 0; - func_800F3B2C(globalCtx); + func_800F3B2C(play); } void Sram_IncrementDay(void) { @@ -1519,9 +1519,9 @@ void func_80146EBC(SramContext* sramCtx, s32 curPage, s32 numPages) { /** * Saves the game on the very first time Player enters South Clock Town from the Clock Tower */ -void Sram_SaveSpecialEnterClockTown(GlobalContext* globalCtx) { +void Sram_SaveSpecialEnterClockTown(PlayState* play) { s32 pad[2]; - SramContext* sramCtx = &globalCtx->sramCtx; + SramContext* sramCtx = &play->sramCtx; gSaveContext.save.isFirstCycle = true; gSaveContext.save.isOwlSave = false; @@ -1532,7 +1532,7 @@ void Sram_SaveSpecialEnterClockTown(GlobalContext* globalCtx) { /** * Saves when beating the game, after showing the "Dawn of the New Day" message */ -void Sram_SaveSpecialNewDay(GlobalContext* globalCtx) { +void Sram_SaveSpecialNewDay(PlayState* play) { s32 cutscene = gSaveContext.save.cutscene; s32 day; u16 time = gSaveContext.save.time; @@ -1542,14 +1542,13 @@ void Sram_SaveSpecialNewDay(GlobalContext* globalCtx) { // Unconfirmed: "Obtained Fierce Deity Mask?" gSaveContext.save.weekEventReg[84] &= (u8)~0x20; - Sram_SaveEndOfCycle(globalCtx); - func_8014546C(&globalCtx->sramCtx); + Sram_SaveEndOfCycle(play); + func_8014546C(&play->sramCtx); gSaveContext.save.day = day; gSaveContext.save.time = time; gSaveContext.save.cutscene = cutscene; - func_80185F64(globalCtx->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], - D_801C67F0[gSaveContext.fileNum * 2]); + func_80185F64(play->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C67F0[gSaveContext.fileNum * 2]); } void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages) { diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 4968185d0b..f8c6b1a212 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -17,12 +17,12 @@ s32 D_801C5DBC[] = { 0, 1 }; // Unused /** * Finds the first EnDoor instance with unk_1A4 == 5 and the specified switchFlag. */ -EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag) { +EnDoor* SubS_FindDoor(PlayState* play, s32 switchFlag) { Actor* actor = NULL; EnDoor* door; while (true) { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR); + actor = SubS_FindActor(play, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR); door = (EnDoor*)actor; if (actor == NULL) { @@ -44,7 +44,7 @@ EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag) { return door; } -Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, +Gfx* SubS_DrawTransformFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx) { StandardLimb* limb; @@ -62,11 +62,11 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** pos.z = limb->jointPos.z; newDList = limbDList = limb->dList; - if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &newDList, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Push(); - transformLimbDraw(globalCtx, limbIndex, actor, &gfx); + transformLimbDraw(play, limbIndex, actor, &gfx); if (newDList != NULL) { Matrix_ToMtx(*mtx); @@ -80,15 +80,15 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** Matrix_Pop(); } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx); + postLimbDraw(play, limbIndex, &limbDList, &rot, actor, &gfx); } if (limb->child != LIMB_DONE) { - gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + gfx = SubS_DrawTransformFlexLimb(play, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, mtx, gfx); } Matrix_Pop(); if (limb->sibling != LIMB_DONE) { - gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + gfx = SubS_DrawTransformFlexLimb(play, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, mtx, gfx); } return gfx; @@ -103,7 +103,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** * coordinates. * Note that the `TransformLimbDraw` does not have a NULL check, so must be provided even if empty. */ -Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, +Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx) { StandardLimb* rootLimb; @@ -112,7 +112,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo Gfx* limbDList; Vec3f pos; Vec3s rot; - Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(dListCount * sizeof(Mtx))); + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(dListCount * sizeof(Mtx))); if (skeleton == NULL) { return NULL; @@ -128,11 +128,11 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo newDlist = rootLimb->dList; limbDList = rootLimb->dList; - if (overrideLimbDraw == NULL || !overrideLimbDraw(globalCtx, 1, &newDlist, &pos, &rot, actor, &gfx)) { + if (overrideLimbDraw == NULL || !overrideLimbDraw(play, 1, &newDlist, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Push(); - transformLimbDraw(globalCtx, 1, actor, &gfx); + transformLimbDraw(play, 1, actor, &gfx); if (newDlist != NULL) { Matrix_ToMtx(mtx); @@ -147,21 +147,21 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo } if (postLimbDraw != NULL) { - postLimbDraw(globalCtx, 1, &limbDList, &rot, actor, &gfx); + postLimbDraw(play, 1, &limbDList, &rot, actor, &gfx); } if (rootLimb->child != LIMB_DONE) { - gfx = SubS_DrawTransformFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, - postLimbDraw, transformLimbDraw, actor, &mtx, gfx); + gfx = SubS_DrawTransformFlexLimb(play, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, + transformLimbDraw, actor, &mtx, gfx); } Matrix_Pop(); return gfx; } -s32 SubS_InCsMode(GlobalContext* globalCtx) { +s32 SubS_InCsMode(PlayState* play) { s32 inCsMode = false; - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { inCsMode = true; } @@ -434,14 +434,14 @@ s32 SubS_TimePathing_Update(Path* path, f32* progress, s32* elapsedTime, s32 way /** * Computes the initial Y component of a time based path * - * @param[in] globalCtx + * @param[in] play * @param[in] path * @param[in] waypoint the current waypoint, this and the previous two points will be used to compute the target pos * @param[out] targetPos the computed position to move to, only the Y component has meaning * * @note Same note as SubS_TimePathing_Update() */ -void SubS_TimePathing_ComputeInitialY(GlobalContext* globalCtx, Path* path, s32 waypoint, Vec3f* targetPos) { +void SubS_TimePathing_ComputeInitialY(PlayState* play, Path* path, s32 waypoint, Vec3f* targetPos) { Vec3s* points = Lib_SegmentedToVirtual(path->points); Vec3f posA; Vec3f posB; @@ -475,18 +475,17 @@ void SubS_TimePathing_ComputeInitialY(GlobalContext* globalCtx, Path* path, s32 posB = *targetPos; posA.y = max; posB.y = min; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, true, true, true, true, - &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, true, true, true, true, &bgId)) { targetPos->y = posResult.y; } } -Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max) { +Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 max) { Path* path; s32 i = 0; do { - path = &globalCtx->setupPathList[pathIndex]; + path = &play->setupPathList[pathIndex]; if (i >= max) { break; } @@ -500,7 +499,7 @@ Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max) { /** * Finds the nearest actor instance of a specified Id and category to an actor. */ -Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId) { +Actor* SubS_FindNearestActor(Actor* actor, PlayState* play, u8 actorCategory, s16 actorId) { Actor* actorIter = NULL; Actor* actorTmp; f32 dist; @@ -509,7 +508,7 @@ Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCat s32 isSetup = false; do { - actorIter = SubS_FindActor(globalCtx, actorIter, actorCategory, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); actorTmp = actorIter; if (actorTmp == NULL) { @@ -586,7 +585,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { return reached; } -Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s32* startPointIndex) { +Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 max, s32* startPointIndex) { Path* path = NULL; s32 found = false; s32 time = (((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60) + @@ -599,7 +598,7 @@ Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s } while (pathIndex != 0xFF) { - path = &globalCtx->setupPathList[pathIndex]; + path = &play->setupPathList[pathIndex]; if (sPathDayFlags[day] & path->unk2) { found = true; break; @@ -817,29 +816,29 @@ s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst) { } //! TODO: Needs docs with func_800B8500 -s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 itemId, s32 type) { +s32 func_8013C964(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemId, s32 type) { s32 ret = false; s16 x; s16 y; f32 xzDistToPlayerTemp; - Actor_GetScreenPos(globalCtx, actor, &x, &y); + Actor_GetScreenPos(play, actor, &x, &y); switch (type) { case 1: yRange = fabsf(actor->playerHeightRel) + 1.0f; xzRange = actor->xzDistToPlayer + 1.0f; - ret = Actor_PickUp(actor, globalCtx, itemId, xzRange, yRange); + ret = Actor_PickUp(actor, play, itemId, xzRange, yRange); break; case 2: if ((fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { - ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId); + ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; case 3: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { - ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId); + ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; case 4: @@ -848,7 +847,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang xzDistToPlayerTemp = actor->xzDistToPlayer; actor->xzDistToPlayer = 0.0f; actor->flags |= 0x10000; - ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId); + ret = func_800B8500(actor, play, xzRange, yRange, itemId); actor->xzDistToPlayer = xzDistToPlayerTemp; break; case 5: @@ -856,7 +855,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isTargeted) { actor->flags |= 0x10000; - ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId); + ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; case 6: @@ -864,7 +863,7 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { actor->flags |= 0x10000; - ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId); + ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; } @@ -1090,8 +1089,8 @@ s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) { return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false; } -Path* SubS_GetPathByIndex(GlobalContext* globalCtx, s16 pathIndex, s16 max) { - return (pathIndex != max) ? &globalCtx->setupPathList[pathIndex] : NULL; +Path* SubS_GetPathByIndex(PlayState* play, s16 pathIndex, s16 max) { + return (pathIndex != max) ? &play->setupPathList[pathIndex] : NULL; } s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst) { @@ -1153,22 +1152,22 @@ s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIndex, Vec3f* pos, f32* dis return Math_Atan2S(diffX, diffZ); } -s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx) { - return !Object_IsLoaded(&globalCtx->objectCtx, index) ? false : true; +s8 SubS_IsObjectLoaded(s8 index, PlayState* play) { + return !Object_IsLoaded(&play->objectCtx, index) ? false : true; } -s8 SubS_GetObjectIndex(s16 id, GlobalContext* globalCtx) { - return Object_GetIndex(&globalCtx->objectCtx, id); +s8 SubS_GetObjectIndex(s16 id, PlayState* play) { + return Object_GetIndex(&play->objectCtx, id); } /** * Finds the first actor instance of a specified Id and category. */ -Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId) { +Actor* SubS_FindActor(PlayState* play, Actor* actorListStart, u8 actorCategory, s16 actorId) { Actor* actor = actorListStart; if (actor == NULL) { - actor = globalCtx->actorCtx.actorLists[actorCategory].first; + actor = play->actorCtx.actorLists[actorCategory].first; } while (actor != NULL && actorId != actor->id) { @@ -1178,9 +1177,9 @@ Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorC return actor; } -s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) { +s32 SubS_FillLimbRotTables(PlayState* play, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) { s32 i; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; for (i = 0; i < numLimbs; i++) { limbRotTableY[i] = (i * 50 + 0x814) * frames; @@ -1190,7 +1189,7 @@ s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* li return true; } -s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove) { +s32 SubS_IsFloorAbove(PlayState* play, Vec3f* pos, f32 distAbove) { CollisionPoly* outPoly; Vec3f posA; Vec3f posB; @@ -1199,8 +1198,7 @@ s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove) { posA = posB = *pos; posB.y += distAbove; - return BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, false, true, false, true, - &bgId); + return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, false, true, false, true, &bgId); } s32 SubS_CopyPointFromPathList(Path* paths, s32 pathIndex, s32 pointIndex, Vec3f* dst) { @@ -1220,12 +1218,11 @@ u8 SubS_GetPathCountFromPathList(Path* paths, s32 pathIndex) { return path->count; } -void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, - Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, - u8 flags) { +void SubS_ActorPathing_Init(PlayState* play, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths, + s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags) { Path* path; - actorPath->setupPathList = globalCtx->setupPathList; + actorPath->setupPathList = play->setupPathList; actorPath->pathIndex = pathIndex; path = &paths[pathIndex]; actorPath->points = Lib_SegmentedToVirtual(path->points); @@ -1250,9 +1247,9 @@ void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* ac actorPath->prevFlags = flags; } -s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath, - ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc, - ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc) { +s32 SubS_ActorPathing_Update(PlayState* play, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc, + ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc, + ActorPathingUpdateFunc setNextPointFunc) { s32 shouldSetNextPoint; s32 reupdate; @@ -1272,24 +1269,24 @@ s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath, do { shouldSetNextPoint = false; if (actorPath->computePointInfoFunc != NULL) { - actorPath->computePointInfoFunc(globalCtx, actorPath); + actorPath->computePointInfoFunc(play, actorPath); } if (actorPath->updateActorInfoFunc != NULL) { - shouldSetNextPoint = actorPath->updateActorInfoFunc(globalCtx, actorPath); + shouldSetNextPoint = actorPath->updateActorInfoFunc(play, actorPath); } if (shouldSetNextPoint) { if (actorPath->setNextPointFunc != NULL) { - reupdate = actorPath->setNextPointFunc(globalCtx, actorPath); + reupdate = actorPath->setNextPointFunc(play, actorPath); } } else if (actorPath->moveFunc != NULL) { - reupdate = actorPath->moveFunc(globalCtx, actorPath); + reupdate = actorPath->moveFunc(play, actorPath); } } while (reupdate); actorPath->prevFlags = actorPath->flags; return false; } -void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath) { +void SubS_ActorPathing_ComputePointInfo(PlayState* play, ActorPathing* actorPath) { Vec3f diff; actorPath->curPoint.x = actorPath->points[actorPath->curPointIndex].x + actorPath->pointOffset.x; @@ -1305,17 +1302,17 @@ void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath->rotToCurPoint.z = 0; } -s32 SubS_ActorPathing_MoveWithGravity(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 SubS_ActorPathing_MoveWithGravity(PlayState* play, ActorPathing* actorPath) { Actor_MoveWithGravity(actorPath->actor); return false; } -s32 SubS_ActorPathing_MoveWithoutGravityReverse(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 SubS_ActorPathing_MoveWithoutGravityReverse(PlayState* play, ActorPathing* actorPath) { Actor_MoveWithoutGravityReverse(actorPath->actor); return false; } -s32 SubS_ActorPathing_SetNextPoint(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 SubS_ActorPathing_SetNextPoint(PlayState* play, ActorPathing* actorPath) { s32 reupdate = true; Math_Vec3f_Copy(&actorPath->prevPoint, &actorPath->curPoint); @@ -1484,18 +1481,18 @@ s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePoi * Finds the first actor instance of a specified Id and category verified with a custom callback. * The callback should return `true` when the actor is succesfully verified. */ -Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory, - s16 actorId, void* verifyData, VerifyActor verifyActor) { +Actor* SubS_FindActorCustom(PlayState* play, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, + void* verifyData, VerifyActor verifyActor) { Actor* actorIter = actorListStart; if (actorListStart == NULL) { - actorIter = globalCtx->actorCtx.actorLists[actorCategory].first; + actorIter = play->actorCtx.actorLists[actorCategory].first; } - while (actorIter != NULL && (actorId != actorIter->id || - (actorId == actorIter->id && - (verifyActor == NULL || - (verifyActor != NULL && !verifyActor(globalCtx, actor, actorIter, verifyData)))))) { + while (actorIter != NULL && + (actorId != actorIter->id || + (actorId == actorIter->id && + (verifyActor == NULL || (verifyActor != NULL && !verifyActor(play, actor, actorIter, verifyData)))))) { actorIter = actorIter->next; } @@ -1503,18 +1500,18 @@ Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actor } //! TODO: Needs docs with func_800B8500 -s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, +s32 func_8013E748(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, func_8013E748_VerifyFunc verifyFunc) { s32 ret = false; - if ((verifyFunc == NULL) || ((verifyFunc != NULL) && verifyFunc(globalCtx, actor, data))) { - ret = func_800B8500(actor, globalCtx, xzRange, yRange, exchangeItemId); + if ((verifyFunc == NULL) || ((verifyFunc != NULL) && verifyFunc(play, actor, data))) { + ret = func_800B8500(actor, play, xzRange, yRange, exchangeItemId); } return ret; } -s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, void* data) { - Player* player = GET_PLAYER(globalCtx); +s32 SubS_ActorAndPlayerFaceEachOther(PlayState* play, Actor* actor, void* data) { + Player* player = GET_PLAYER(play); Vec3s* yawTols = (Vec3s*)data; s16 playerYaw = ABS(BINANG_SUB(Actor_YawBetweenActors(&player->actor, actor), player->actor.shape.rot.y)); s16 actorYaw = ABS(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); @@ -1533,13 +1530,13 @@ s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, voi } //! TODO: Needs docs with func_800B8500 -s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, +s32 func_8013E8F8(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, s16 actorYawTol) { Vec3s yawTols; yawTols.x = playerYawTol; yawTols.y = actorYawTol; - return func_8013E748(actor, globalCtx, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther); + return func_8013E748(actor, play, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther); } /** diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 29d1a1acad..7975b1c857 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -36,7 +36,7 @@ void func_80143148(SkyboxContext* skyboxCtx, s32 arg1) { } void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) { - GlobalContext* globalCtx = (GlobalContext*)gameState; + PlayState* play = (PlayState*)gameState; size_t size; void* offset; s32 pad; @@ -75,13 +75,13 @@ void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) skyboxCtx->envB = 40; // Inverted Stone Tower Temple and Inverted Stone Tower - if ((globalCtx->sceneNum == SCENE_F41) || (globalCtx->sceneNum == SCENE_INISIE_R)) { + if ((play->sceneNum == SCENE_F41) || (play->sceneNum == SCENE_INISIE_R)) { skyboxCtx->rotZ = 3.15000009537f; } } } -void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyType) { +void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyType) { size_t size; if (1) {} @@ -89,7 +89,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy if (skyType == 1) { osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); - if (globalCtx->envCtx.unk_10 == 0) { + if (play->envCtx.unk_10 == 0) { // Send a DMA request for the clear sky texture size = SEGMENT_ROM_SIZE(d2_fine_static); @@ -106,7 +106,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); - if (globalCtx->envCtx.unk_11 == 0) { + if (play->envCtx.unk_11 == 0) { // Send a DMA request for the clear sky texture size = SEGMENT_ROM_SIZE(d2_fine_static); 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 18d5792d6c..45d4ff68a3 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -12,13 +12,13 @@ #define THIS ((ArmsHook*)thisx) -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, @@ -56,29 +56,29 @@ 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 = THIS; - Collider_InitQuad(globalCtx, &this->collider); - Collider_SetQuad(globalCtx, &this->collider, &this->actor, &D_808C1BC0); + Collider_InitQuad(play, &this->collider); + Collider_SetQuad(play, &this->collider, &this->actor, &D_808C1BC0); ArmsHook_SetupAction(this, ArmsHook_Wait); this->unk1E0 = this->actor.world.pos; } -void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Destroy(Actor* thisx, PlayState* play) { ArmsHook* this = THIS; if (this->grabbed != NULL) { this->grabbed->flags &= ~0x2000; } - 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) { ArmsHook_SetupAction(this, ArmsHook_Shoot); Actor_SetSpeeds(&this->actor, 20.0f); - this->actor.parent = &GET_PLAYER(globalCtx)->actor; + this->actor.parent = &GET_PLAYER(play)->actor; this->timer = 26; } } @@ -125,8 +125,8 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->unk1FC); } -void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.parent == NULL) || (!func_801240C8(player))) { ArmsHook_DetachHookFromActor(this); @@ -244,11 +244,11 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x); sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y); sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, true, &bgId) && - (func_800B90AC(globalCtx, &this->actor, poly, bgId, &posResult) == 0 || - BgCheck_ProjectileLineTest(&globalCtx->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, - true, &bgId))) { + (func_800B90AC(play, &this->actor, poly, bgId, &posResult) == 0 || + BgCheck_ProjectileLineTest(&play->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, true, + &bgId))) { f32 nx = COLPOLY_GET_NORMAL(poly->normal.x); f32 nz = COLPOLY_GET_NORMAL(poly->normal.z); @@ -256,22 +256,21 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { this->actor.world.pos.x += 10.0f * nx; this->actor.world.pos.z += 10.0f * nz; this->timer = 1; - if (SurfaceType_IsHookshotSurface(&globalCtx->colCtx, poly, bgId)) { + if (SurfaceType_IsHookshotSurface(&play->colCtx, poly, bgId)) { { DynaPolyActor* dynaPolyActor; - if (bgId != BGCHECK_SCENE && - (dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, bgId)) != NULL) { + if (bgId != BGCHECK_SCENE && (dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId)) != NULL) { ArmsHook_AttachHookToActor(this, &dynaPolyActor->actor); } } func_808C1154(this); Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_STICK_OBJ); } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &this->actor.world.pos); + CollisionCheck_SpawnShieldParticlesMetal(play, &this->actor.world.pos); Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_IT_HOOKSHOT_REFLECT); } } else { - if (CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, + if (CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { s32 pad; this->timer = 1; @@ -280,10 +279,10 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } } -void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Update(Actor* thisx, PlayState* play) { ArmsHook* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk1EC = this->unk1E0; } @@ -294,10 +293,10 @@ static Vec3f D_808C1C34 = { 0.0f, -500.0f, -3000.0f }; static Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f }; static Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f }; -void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArmsHook_Draw(Actor* thisx, PlayState* play) { ArmsHook* this = THIS; f32 f0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->actor.draw != NULL && player->rightHandType == 0xB) { Vec3f sp68; @@ -306,7 +305,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 sp4C; f32 sp48; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_808C1C10, &this->unk1E0); @@ -318,11 +317,11 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_808C1C40, &sp5C); Matrix_MultVec3f(&D_808C1C4C, &sp50); } - func_80126440(globalCtx, &this->collider, &this->unk1C4, &sp5C, &sp50); - func_8012C28C(globalCtx->state.gfxCtx); - func_80122868(globalCtx, player); + func_80126440(play, &this->collider, &this->unk1C4, &sp5C, &sp50); + func_8012C28C(play->state.gfxCtx); + func_80122868(play, player); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_link_child_DL_01D960); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Math_Vec3f_Diff(&player->rightHandWorld.pos, &this->actor.world.pos, &sp68); @@ -332,10 +331,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateXS(Math_Atan2S(-sp68.y, sp4C), MTXMODE_APPLY); f0 = sqrtf(SQ(sp68.y) + sp48); Matrix_Scale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0008D0); - func_801229A0(globalCtx, player); + func_801229A0(play, player); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 527d37b61e..5a79392ff7 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -5,7 +5,7 @@ struct ArmsHook; -typedef void (*ArmsHookActionFunc)(struct ArmsHook*, GlobalContext*); +typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*); typedef struct ArmsHook { /* 0x000 */ 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 6a25902590..16e4832a8f 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -11,13 +11,13 @@ #define THIS ((ArrowFire*)thisx) -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 FireArrow_ChargeAndWait(ArrowFire* this, GlobalContext* globalCtx); -void FireArrow_Fly(ArrowFire* this, GlobalContext* globalCtx); +void FireArrow_ChargeAndWait(ArrowFire* this, PlayState* play); +void FireArrow_Fly(ArrowFire* this, PlayState* play); #include "overlays/ovl_Arrow_fire/ovl_Arrow_Fire.c" @@ -63,7 +63,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 = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -74,19 +74,19 @@ void ArrowFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->alpha = 160; this->timer = 0; this->screenFillIntensity = 0.0f; - Collider_InitAndSetQuad(globalCtx, &this->collider1, &this->actor, &sQuadInit); - Collider_InitAndSetQuad(globalCtx, &this->collider2, &this->actor, &sQuadInit); + Collider_InitAndSetQuad(play, &this->collider1, &this->actor, &sQuadInit); + Collider_InitAndSetQuad(play, &this->collider2, &this->actor, &sQuadInit); } -void ArrowFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Destroy(Actor* thisx, PlayState* play) { ArrowFire* this = THIS; - func_80115D5C(&globalCtx->state); - Collider_DestroyQuad(globalCtx, &this->collider1); - Collider_DestroyQuad(globalCtx, &this->collider2); + func_80115D5C(&play->state); + Collider_DestroyQuad(play, &this->collider1); + Collider_DestroyQuad(play, &this->collider2); } -void FireArrow_ChargeAndWait(ArrowFire* this, GlobalContext* globalCtx) { +void FireArrow_ChargeAndWait(ArrowFire* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; if ((arrow == NULL) || (arrow->actor.update == NULL)) { @@ -115,7 +115,7 @@ void FireArrow_Lerp(Vec3f* firedPos, Vec3f* pos, f32 scale) { VEC3F_LERPIMPDST(firedPos, firedPos, pos, scale); } -void FireArrow_Hit(ArrowFire* this, GlobalContext* globalCtx) { +void FireArrow_Hit(ArrowFire* this, PlayState* play) { f32 offset; f32 scale; u16 timer; @@ -160,12 +160,12 @@ void FireArrow_Hit(ArrowFire* this, GlobalContext* globalCtx) { return; } if (this->timer >= 13) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } } -void FireArrow_Fly(ArrowFire* this, GlobalContext* globalCtx) { +void FireArrow_Fly(ArrowFire* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; s32 pad; s32 pad2; @@ -201,14 +201,14 @@ void FireArrow_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 == 0xE) || (globalCtx->msgCtx.msgMode == 0x12)) { + if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) { Actor_MarkForDeath(&this->actor); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } void FireArrow_SetQuadVerticies(ArrowFire* this) { @@ -237,10 +237,10 @@ void FireArrow_SetQuadVerticies(ArrowFire* this) { Collider_SetQuadVertices(&this->collider2, &sp44, &sp38, &sp2C, &sp20); } -void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowFire_Draw(Actor* thisx, PlayState* play) { EnArrow* arrow; ArrowFire* this = THIS; - u32 frames = globalCtx->state.frames; + u32 frames = play->state.frames; s32 pad; arrow = (EnArrow*)this->actor.parent; @@ -248,7 +248,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { Actor* transform = (arrow->unk_261 & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateYS(transform->shape.rot.y, MTXMODE_APPLY); Matrix_RotateXS(transform->shape.rot.x, MTXMODE_APPLY); @@ -266,7 +266,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, D_0E000000.fillRect); } - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); @@ -282,15 +282,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(this->radius * 0.2f, this->height * 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); FireArrow_SetQuadVerticies(this); gSPDisplayList(POLY_XLU_DISP++, gFireArrowMaterialDL); - gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - ((frames * 2) % 256), 0, 64, 32, 1, - 255 - (frames % 256), 511 - ((frames * 10) % 512), 64, 64)); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 255 - ((frames * 2) % 256), 0, 64, 32, + 1, 255 - (frames % 256), 511 - ((frames * 10) % 512), 64, 64)); gSPDisplayList(POLY_XLU_DISP++, gFireArrowModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 5f9617c65f..ce43cc5ed9 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.h @@ -5,7 +5,7 @@ struct ArrowFire; -typedef void (*ArrowFireActionFunc)(struct ArrowFire*, GlobalContext*); +typedef void (*ArrowFireActionFunc)(struct ArrowFire*, PlayState*); typedef struct ArrowFire { /* 0x000 */ 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 6ae5391785..7c4f1f9691 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -11,13 +11,13 @@ #define THIS ((ArrowIce*)thisx) -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_Charge(ArrowIce* this, PlayState* play); +void ArrowIce_Fly(ArrowIce* this, PlayState* play); #include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c" @@ -43,7 +43,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 = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -56,12 +56,12 @@ void ArrowIce_Init(Actor* thisx, GlobalContext* globalCtx) { this->blueingEffectMagnitude = 0.0f; } -void ArrowIce_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_80115D5C(&globalCtx->state); +void ArrowIce_Destroy(Actor* thisx, PlayState* play) { + func_80115D5C(&play->state); (void)"消滅"; // Unreferenced in retail, means "Disappearance" } -void ArrowIce_Charge(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Charge(ArrowIce* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; if ((arrow == NULL) || (arrow->actor.update == NULL)) { @@ -91,7 +91,7 @@ void ArrowIce_LerpFiredPosition(Vec3f* firedPos, Vec3f* icePos, f32 scale) { VEC3F_LERPIMPDST(firedPos, firedPos, icePos, scale); } -void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Hit(ArrowIce* this, PlayState* play) { f32 scale; u16 timer; @@ -140,7 +140,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { +void ArrowIce_Fly(ArrowIce* this, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; f32 distanceScaled; s32 pad; @@ -173,28 +173,28 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { } } -void ArrowIce_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Update(Actor* thisx, PlayState* play) { ArrowIce* this = THIS; - if ((globalCtx->msgCtx.msgMode == 0xE) || (globalCtx->msgCtx.msgMode == 0x12)) { + if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) { Actor_MarkForDeath(&this->actor); return; } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowIce_Draw(Actor* thisx, PlayState* play) { s32 pad; ArrowIce* this = THIS; Actor* transform; - u32 stateFrames = globalCtx->state.frames; + u32 stateFrames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { transform = (arrow->unk_261 & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateYS(transform->shape.rot.y, MTXMODE_APPLY); @@ -214,7 +214,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } // Draw ice on the arrow - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, (s32)(this->alpha * 0.5f) & 0xFF); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); Matrix_RotateZYX(0x4000, 0, 0, MTXMODE_APPLY); @@ -225,13 +225,13 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->height * 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gIceArrowMaterialDL); 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++, gIceArrowModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 a731d9d447..338d65a03a 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.h @@ -5,7 +5,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 1b25b8fbb2..1a7503e54c 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -11,13 +11,13 @@ #define THIS ((ArrowLight*)thisx) -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_Charge(ArrowLight* this, PlayState* play); +void ArrowLight_Fly(ArrowLight* this, PlayState* play); #include "overlays/ovl_Arrow_Light/ovl_Arrow_Light.c" @@ -43,7 +43,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); this->radius = 0; @@ -55,12 +55,12 @@ void ArrowLight_Init(Actor* thisx, GlobalContext* globalCtx) { this->screenFillIntensity = 0.0f; } -void ArrowLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_80115D5C(&globalCtx->state); +void ArrowLight_Destroy(Actor* thisx, PlayState* play) { + func_80115D5C(&play->state); (void)"消滅"; // Unreferenced in retail, means "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)) { @@ -88,7 +88,7 @@ void ArrowLight_Lerp(Vec3f* firedPos, Vec3f* pos, f32 scale) { VEC3F_LERPIMPDST(firedPos, firedPos, pos, scale); } -void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { +void ArrowLight_Hit(ArrowLight* this, PlayState* play) { f32 scale; u16 timer; @@ -134,7 +134,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; s32 pad[2]; @@ -169,26 +169,26 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { } } -void ArrowLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Update(Actor* thisx, PlayState* play) { ArrowLight* this = THIS; - if ((globalCtx->msgCtx.msgMode == 0xE) || (globalCtx->msgCtx.msgMode == 0x12)) { + if ((play->msgCtx.msgMode == 0xE) || (play->msgCtx.msgMode == 0x12)) { Actor_MarkForDeath(&this->actor); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ArrowLight_Draw(Actor* thisx, PlayState* play) { s32 pad; ArrowLight* this = (ArrowLight*)thisx; - u32 frames = globalCtx->state.frames; + u32 frames = play->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { Actor* transform = (arrow->unk_261 & 2) ? &this->actor : &arrow->actor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateYS(transform->shape.rot.y, MTXMODE_APPLY); @@ -205,7 +205,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, D_0E000000.fillRect); } - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); @@ -219,12 +219,12 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(this->radius * 0.2f, this->height * 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLightArrowMaterialDL); gSPDisplayList(POLY_XLU_DISP++, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - ((frames * 5) % 512), 0, 4, 32, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 511 - ((frames * 5) % 512), 0, 4, 32, 1, 511 - ((frames * 10) % 512), 511 - ((frames * 30) % 512), 8, 16)); gSPDisplayList(POLY_XLU_DISP++, gLightArrowModelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 7b3f3088f9..bf58b1e402 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.h @@ -5,7 +5,7 @@ struct ArrowLight; -typedef void (*ArrowLightActionFunc)(struct ArrowLight*, GlobalContext*); +typedef void (*ArrowLightActionFunc)(struct ArrowLight*, PlayState*); typedef struct ArrowLight { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index 1e4a9b3d03..6965ad4c1a 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -11,17 +11,17 @@ #define THIS ((BgAstrBombwall*)thisx) -void BgAstrBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgAstrBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgAstrBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgAstrBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgAstrBombwall_Init(Actor* thisx, PlayState* play); +void BgAstrBombwall_Destroy(Actor* thisx, PlayState* play); +void BgAstrBombwall_Update(Actor* thisx, PlayState* play); +void BgAstrBombwall_Draw(Actor* thisx, PlayState* play); void func_80C0A378(BgAstrBombwall* this); -void func_80C0A38C(BgAstrBombwall* this, GlobalContext* globalCtx); -void func_80C0A400(BgAstrBombwall* this, GlobalContext* globalCtx); -void func_80C0A418(BgAstrBombwall* this, GlobalContext* globalCtx); -void func_80C0A458(BgAstrBombwall* this, GlobalContext* globalCtx); -void func_80C0A4BC(BgAstrBombwall* this, GlobalContext* globalCtx); +void func_80C0A38C(BgAstrBombwall* this, PlayState* play); +void func_80C0A400(BgAstrBombwall* this, PlayState* play); +void func_80C0A418(BgAstrBombwall* this, PlayState* play); +void func_80C0A458(BgAstrBombwall* this, PlayState* play); +void func_80C0A4BC(BgAstrBombwall* this, PlayState* play); const ActorInit Bg_Astr_Bombwall_InitVars = { ACTOR_BG_ASTR_BOMBWALL, @@ -95,20 +95,20 @@ void BgAstrBombwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, } } -void BgAstrBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgAstrBombwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgAstrBombwall* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_astr_obj_Colheader_002498); - Collider_InitTris(globalCtx, &this->collider); - if (Flags_GetSwitch(globalCtx, BGASTRBOMBWALL_GET_SWITCHFLAG(thisx))) { + DynaPolyActor_LoadMesh(play, &this->dyna, &object_astr_obj_Colheader_002498); + Collider_InitTris(play, &this->collider); + if (Flags_GetSwitch(play, BGASTRBOMBWALL_GET_SWITCHFLAG(thisx))) { Actor_MarkForDeath(&this->dyna.actor); return; } this->dyna.actor.flags |= ACTOR_FLAG_10000000; - if (!Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements)) { + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements)) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -117,13 +117,13 @@ void BgAstrBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { func_80C0A378(this); } -void BgAstrBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgAstrBombwall_Destroy(Actor* thisx, PlayState* play) { BgAstrBombwall* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80C0A120(BgAstrBombwall* this, GlobalContext* globalCtx) { +void func_80C0A120(BgAstrBombwall* this, PlayState* play) { s32 i; Vec3f vec; Vec3f pos; @@ -138,7 +138,7 @@ void func_80C0A120(BgAstrBombwall* this, GlobalContext* globalCtx) { vec.z = 0.0f; Matrix_MultVec3f(&vec, &pos); Math_Vec3f_Sum(&this->dyna.actor.world.pos, &pos, &pos); - func_800BBFB0(globalCtx, &pos, 50.0f, 2, Rand_ZeroOne() * 120.0f + 20.0f, Rand_ZeroOne() * 240.0f + 20.0f, 0); + func_800BBFB0(play, &pos, 50.0f, 2, Rand_ZeroOne() * 120.0f + 20.0f, Rand_ZeroOne() * 240.0f + 20.0f, 0); velocity.x = Rand_ZeroOne() * 2.5f; velocity.y = (Rand_ZeroOne() * 2.5f) + 1.0f; velocity.z = Rand_ZeroOne() * 2.5f; @@ -151,8 +151,8 @@ void func_80C0A120(BgAstrBombwall* this, GlobalContext* globalCtx) { } else { var_v0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -260, var_v0, 20, 0, 0, 10, 0, 0, 50, -1, - OBJECT_ASTR_OBJ, object_astr_obj_DL_002178); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -260, var_v0, 20, 0, 0, 10, 0, 0, 50, -1, OBJECT_ASTR_OBJ, + object_astr_obj_DL_002178); } } @@ -160,66 +160,66 @@ void func_80C0A378(BgAstrBombwall* this) { this->actionFunc = func_80C0A38C; } -void func_80C0A38C(BgAstrBombwall* this, GlobalContext* globalCtx) { +void func_80C0A38C(BgAstrBombwall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Flags_SetSwitch(globalCtx, BGASTRBOMBWALL_GET_SWITCHFLAG(&this->dyna.actor)); - func_80C0A400(this, globalCtx); + Flags_SetSwitch(play, BGASTRBOMBWALL_GET_SWITCHFLAG(&this->dyna.actor)); + func_80C0A400(this, play); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80C0A400(BgAstrBombwall* this, GlobalContext* globalCtx) { +void func_80C0A400(BgAstrBombwall* this, PlayState* play) { this->actionFunc = func_80C0A418; } -void func_80C0A418(BgAstrBombwall* this, GlobalContext* globalCtx) { +void func_80C0A418(BgAstrBombwall* this, PlayState* play) { if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - func_80C0A458(this, globalCtx); + func_80C0A458(this, play); } } -void func_80C0A458(BgAstrBombwall* this, GlobalContext* globalCtx) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_80C0A458(BgAstrBombwall* this, PlayState* play) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; - func_80C0A120(this, globalCtx); + func_80C0A120(this, play); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80C0A4BC; } -void func_80C0A4BC(BgAstrBombwall* this, GlobalContext* globalCtx) { +void func_80C0A4BC(BgAstrBombwall* this, PlayState* play) { } -void BgAstrBombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgAstrBombwall_Update(Actor* thisx, PlayState* play) { BgAstrBombwall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgAstrBombwall_Draw(Actor* thixs, GlobalContext* globalCtx) { +void BgAstrBombwall_Draw(Actor* thixs, PlayState* play) { { Gfx* opa; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); opa = POLY_OPA_DISP; gSPDisplayList(&opa[0], &sSetupDL[25 * 6]); - gSPMatrix(&opa[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&opa[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSetGeometryMode(&opa[2], G_LIGHTING_POSITIONAL); gSPDisplayList(&opa[3], object_astr_obj_DL_002380); POLY_OPA_DISP = &opa[4]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } { Gfx* xlu; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); xlu = POLY_XLU_DISP; gSPDisplayList(&xlu[0], &sSetupDL[25 * 6]); - gSPMatrix(&xlu[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&xlu[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSetGeometryMode(&xlu[2], G_LIGHTING_POSITIONAL); gSPDisplayList(&xlu[3], object_astr_obj_DL_0022E0); POLY_XLU_DISP = &xlu[4]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h index 413f14cdd1..58b60b9445 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h @@ -7,7 +7,7 @@ struct BgAstrBombwall; #define BGASTRBOMBWALL_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) -typedef void (*BgAstrBombwallActionFunc)(struct BgAstrBombwall*, GlobalContext*); +typedef void (*BgAstrBombwallActionFunc)(struct BgAstrBombwall*, PlayState*); typedef struct BgAstrBombwall { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgAstrBombwallActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.c b/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.c index 7ca6678ff6..65080bd3d4 100644 --- a/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.c +++ b/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.c @@ -10,10 +10,10 @@ #define THIS ((BgBotihasira*)thisx) -void BgBotihasira_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBotihasira_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgBotihasira_Update(Actor* thisx, GlobalContext* globalCtx); -void BgBotihasira_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgBotihasira_Init(Actor* thisx, PlayState* play); +void BgBotihasira_Destroy(Actor* thisx, PlayState* play); +void BgBotihasira_Update(Actor* thisx, PlayState* play); +void BgBotihasira_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Botihasira_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.h b/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.h index beed2391f4..c66b00b0a9 100644 --- a/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.h +++ b/src/overlays/actors/ovl_Bg_Botihasira/z_bg_botihasira.h @@ -5,7 +5,7 @@ struct BgBotihasira; -typedef void (*BgBotihasiraActionFunc)(struct BgBotihasira*, GlobalContext*); +typedef void (*BgBotihasiraActionFunc)(struct BgBotihasira*, PlayState*); typedef struct BgBotihasira { /* 0x0000 */ Actor actor; 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 b2fe546cfa..9a272e6aae 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -19,31 +19,31 @@ #define THIS ((BgBreakwall*)thisx) -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx); +void BgBreakwall_Init(Actor* thisx, PlayState* play); +void BgBreakwall_Update(Actor* thisx, PlayState* play); void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc); -s32 func_808B736C(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B7380(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B73C4(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B73FC(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B7410(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B7460(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B74A8(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B74D8(BgBreakwall* this, GlobalContext* globalCtx); -s32 func_808B751C(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B76CC(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B77D0(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B77E0(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B782C(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B78A4(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B78DC(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B7914(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B7A10(BgBreakwall* this, GlobalContext* globalCtx); -void func_808B7A90(Actor* thisx, GlobalContext* globalCtx); -void func_808B7B54(Actor* thisx, GlobalContext* globalCtx); -void func_808B7D34(Actor* thisx, GlobalContext* globalCtx); -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx); +s32 func_808B736C(BgBreakwall* this, PlayState* play); +s32 func_808B7380(BgBreakwall* this, PlayState* play); +s32 func_808B73C4(BgBreakwall* this, PlayState* play); +s32 func_808B73FC(BgBreakwall* this, PlayState* play); +s32 func_808B7410(BgBreakwall* this, PlayState* play); +s32 func_808B7460(BgBreakwall* this, PlayState* play); +s32 func_808B74A8(BgBreakwall* this, PlayState* play); +s32 func_808B74D8(BgBreakwall* this, PlayState* play); +s32 func_808B751C(BgBreakwall* this, PlayState* play); +void func_808B76CC(BgBreakwall* this, PlayState* play); +void func_808B77D0(BgBreakwall* this, PlayState* play); +void func_808B77E0(BgBreakwall* this, PlayState* play); +void func_808B782C(BgBreakwall* this, PlayState* play); +void func_808B78A4(BgBreakwall* this, PlayState* play); +void func_808B78DC(BgBreakwall* this, PlayState* play); +void func_808B7914(BgBreakwall* this, PlayState* play); +void func_808B7A10(BgBreakwall* this, PlayState* play); +void func_808B7A90(Actor* thisx, PlayState* play); +void func_808B7B54(Actor* thisx, PlayState* play); +void func_808B7D34(Actor* thisx, PlayState* play); +void BgBreakwall_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Breakwall_InitVars = { ACTOR_BG_BREAKWALL, ACTORCAT_ITEMACTION, FLAGS, @@ -141,63 +141,63 @@ void BgBreakwall_SetupAction(BgBreakwall* this, BgBreakwallActionFunc actionFunc this->actionFunc = actionFunc; } -s32 func_808B736C(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B736C(BgBreakwall* this, PlayState* play) { return true; } -s32 func_808B7380(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B7380(BgBreakwall* this, PlayState* play) { if ((gSaveContext.save.day >= 2) && !(gSaveContext.save.weekEventReg[22] & 1)) { return false; } return true; } -s32 func_808B73C4(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B73C4(BgBreakwall* this, PlayState* play) { return (gSaveContext.save.weekEventReg[33] & 0x80) || (gSaveContext.save.weekEventReg[21] & 1); } -s32 func_808B73FC(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B73FC(BgBreakwall* this, PlayState* play) { return true; } -s32 func_808B7410(BgBreakwall* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +s32 func_808B7410(BgBreakwall* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->dyna.actor.draw = NULL; } Actor_SetScale(&this->dyna.actor, 0.1f); return true; } -s32 func_808B7460(BgBreakwall* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, this->switchFlag)) { +s32 func_808B7460(BgBreakwall* this, PlayState* play) { + if (!Flags_GetSwitch(play, this->switchFlag)) { this->dyna.actor.scale.x = 0.1f; } return true; } -s32 func_808B74A8(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B74A8(BgBreakwall* this, PlayState* play) { if (gSaveContext.save.weekEventReg[55] & 0x80) { return false; } return true; } -s32 func_808B74D8(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B74D8(BgBreakwall* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[9] & 0x80) || (gSaveContext.save.weekEventReg[23] & 0x20)) { return false; } return true; } -s32 func_808B751C(BgBreakwall* this, GlobalContext* globalCtx) { +s32 func_808B751C(BgBreakwall* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, 0.1f); if ((BGBREAKWALL_SWITCHFLAG(&this->dyna.actor) != 0x7F) && - !Flags_GetSwitch(globalCtx, BGBREAKWALL_SWITCHFLAG(&this->dyna.actor))) { + !Flags_GetSwitch(play, BGBREAKWALL_SWITCHFLAG(&this->dyna.actor))) { return false; } - func_800FEA50(globalCtx); + func_800FEA50(play); if (gSaveContext.save.isNight) { this->unk_15E = 0; @@ -207,15 +207,15 @@ s32 func_808B751C(BgBreakwall* this, GlobalContext* globalCtx) { return true; } -void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgBreakwall* this = THIS; BgBreakwallStruct* sp24 = &D_808B8140[BGBREAKWALL_GET_F(&this->dyna.actor)]; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->unk_15C = Object_GetIndex(&globalCtx->objectCtx, sp24->unk_00); + this->unk_15C = Object_GetIndex(&play->objectCtx, sp24->unk_00); - if ((this->unk_15C < 0) || !sp24->unk_14(this, globalCtx)) { + if ((this->unk_15C < 0) || !sp24->unk_14(this, play)) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -224,17 +224,17 @@ void BgBreakwall_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = BGBREAKWALL_SWITCHFLAG(&this->dyna.actor); } -void BgBreakwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Destroy(Actor* thisx, PlayState* play) { BgBreakwall* this = THIS; BgBreakwallStruct* temp_s1 = &D_808B8140[BGBREAKWALL_GET_F(&this->dyna.actor)]; if (temp_s1->unk_10 != NULL) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_808B76CC(BgBreakwall* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_15C)) { +void func_808B76CC(BgBreakwall* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->unk_15C)) { BgBreakwallStruct* temp_s1 = &D_808B8140[BGBREAKWALL_GET_F(&this->dyna.actor)]; this->dyna.actor.objBankIndex = this->unk_15C; @@ -246,7 +246,7 @@ void func_808B76CC(BgBreakwall* this, GlobalContext* globalCtx) { this->dyna.actor.flags &= ~ACTOR_FLAG_10; } - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); if (temp_s1->unk_0C != NULL) { temp_s1->unk_0C = Lib_SegmentedToVirtual(temp_s1->unk_0C); @@ -254,7 +254,7 @@ void func_808B76CC(BgBreakwall* this, GlobalContext* globalCtx) { if (temp_s1->unk_10 != NULL) { DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, temp_s1->unk_10); + DynaPolyActor_LoadMesh(play, &this->dyna, temp_s1->unk_10); } BgBreakwall_SetupAction(this, temp_s1->unk_18); @@ -262,21 +262,21 @@ void func_808B76CC(BgBreakwall* this, GlobalContext* globalCtx) { } } -void func_808B77D0(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B77D0(BgBreakwall* this, PlayState* play) { } -void func_808B77E0(BgBreakwall* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_808B77E0(BgBreakwall* this, PlayState* play) { + if (!Flags_GetSwitch(play, this->switchFlag)) { this->dyna.actor.draw = BgBreakwall_Draw; } else { this->dyna.actor.draw = NULL; } } -void func_808B782C(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B782C(BgBreakwall* this, PlayState* play) { f32 phi_f0; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { phi_f0 = 1.0f; } else { phi_f0 = 0.1f; @@ -284,23 +284,23 @@ void func_808B782C(BgBreakwall* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dyna.actor.scale.x, phi_f0, 0.2f, 0.3f, 0.06f); } -void func_808B78A4(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B78A4(BgBreakwall* this, PlayState* play) { if (gSaveContext.save.weekEventReg[55] & 0x80) { Actor_MarkForDeath(&this->dyna.actor); } } -void func_808B78DC(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B78DC(BgBreakwall* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, 3.5f); func_800B9010(&this->dyna.actor, NA_SE_EV_TORNADE - SFX_FLAG); } -void func_808B7914(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B7914(BgBreakwall* this, PlayState* play) { s32 pad; Vec3f sp30; Vec3f sp24; - if ((globalCtx->gameplayFrames % 8) == 0) { + if ((play->gameplayFrames % 8) == 0) { sp30.x = Rand_ZeroFloat(80.0f) + (this->dyna.actor.world.pos.x - 55.0f); sp30.y = this->dyna.actor.world.pos.y + 70.0f; sp30.z = Rand_ZeroFloat(80.0f) + (this->dyna.actor.world.pos.z - 130.0f); @@ -309,11 +309,11 @@ void func_808B7914(BgBreakwall* this, GlobalContext* globalCtx) { sp24.y = 0.5f; sp24.z = 0.0f; - EffectSsIceSmoke_Spawn(globalCtx, &sp30, &sp24, &gZeroVec3f, -200 - (s32)(Rand_ZeroOne() * 50.0f)); + EffectSsIceSmoke_Spawn(play, &sp30, &sp24, &gZeroVec3f, -200 - (s32)(Rand_ZeroOne() * 50.0f)); } } -void func_808B7A10(BgBreakwall* this, GlobalContext* globalCtx) { +void func_808B7A10(BgBreakwall* this, PlayState* play) { if (gSaveContext.save.isNight) { if (this->unk_15E < 245) { this->unk_15E += 10; @@ -327,17 +327,17 @@ void func_808B7A10(BgBreakwall* this, GlobalContext* globalCtx) { } } -void BgBreakwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Update(Actor* thisx, PlayState* play) { BgBreakwall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_808B7A90(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7A90(Actor* thisx, PlayState* play) { Color_RGBA8 sp2C; Color_RGBA8 sp28; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_800FE7A8(D_808B82F0, &sp2C); func_800FE7A8(D_808B8300, &sp28); @@ -345,19 +345,19 @@ void func_808B7A90(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sp2C.r, sp2C.g, sp2C.b, 255); gDPSetEnvColor(POLY_XLU_DISP++, sp28.r, sp28.g, sp28.b, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808B7B54(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7B54(Actor* thisx, PlayState* play) { s32 pad; Color_RGBA8 sp50; Color_RGBA8 sp4C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_800FE7A8(D_808B8310, &sp50); func_800FE7A8(D_808B8330, &sp4C); @@ -373,17 +373,17 @@ void func_808B7B54(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, sp4C.r, sp4C.g, sp4C.b, 255); gSPDisplayList(POLY_XLU_DISP++, object_kumo30_DL_000C98); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808B7D34(Actor* thisx, GlobalContext* globalCtx) { +void func_808B7D34(Actor* thisx, PlayState* play) { BgBreakwall* this = THIS; s32 sp48; s32 tempA; s32 tempB; s32 tempC; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); sp48 = 255 - this->unk_15E; @@ -391,50 +391,50 @@ void func_808B7D34(Actor* thisx, GlobalContext* globalCtx) { tempB = (((sp48 * 145) + (this->unk_15E * 85)) & 0xFF00) >> 8; tempC = (((sp48 * 135) + (this->unk_15E * 55)) & 0xFF00) >> 8; - gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(globalCtx->state.gfxCtx, 255, 255, tempA, tempB, tempC)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(play->state.gfxCtx, 255, 255, tempA, tempB, tempC)); tempA = (((sp48 * 255) + (this->unk_15E * 150)) & 0xFF00) >> 8; tempB = (((sp48 * 255) + (this->unk_15E * 100)) & 0xFF00) >> 8; tempC = (((sp48 * 255) + (this->unk_15E * 75)) & 0xFF00) >> 8; - gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_PrimColor(globalCtx->state.gfxCtx, 255, tempA, tempA, tempB, tempC)); + gSPSegment(POLY_XLU_DISP++, 0x0A, Gfx_PrimColor(play->state.gfxCtx, 255, tempA, tempA, tempB, tempC)); tempA = (((sp48 * 185) + (this->unk_15E * 140)) & 0xFF00) >> 8; tempB = (((sp48 * 235) + (this->unk_15E * 45)) & 0xFF00) >> 8; - gSPSegment(POLY_XLU_DISP++, 0x0B, Gfx_PrimColor(globalCtx->state.gfxCtx, 255, 255, 255, tempA, tempB)); + gSPSegment(POLY_XLU_DISP++, 0x0B, Gfx_PrimColor(play->state.gfxCtx, 255, 255, 255, tempA, tempB)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgBreakwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgBreakwall_Draw(Actor* thisx, PlayState* play) { s32 pad; BgBreakwall* this = THIS; BgBreakwallStruct* temp_s2 = &D_808B8140[BGBREAKWALL_GET_F(&this->dyna.actor)]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (temp_s2->unk_0C != NULL) { - AnimatedMat_Draw(globalCtx, temp_s2->unk_0C); + AnimatedMat_Draw(play, temp_s2->unk_0C); } if (temp_s2->unk_1C != NULL) { - temp_s2->unk_1C(&this->dyna.actor, globalCtx); + temp_s2->unk_1C(&this->dyna.actor, play); } if (temp_s2->unk_04 != NULL) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, temp_s2->unk_04); } if (temp_s2->unk_08 != NULL) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, temp_s2->unk_08); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 322929344c..a30f63f1a5 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.h @@ -5,9 +5,9 @@ struct BgBreakwall; -typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, GlobalContext*); -typedef s32 (*BgBreakwallUnkFunc)(struct BgBreakwall*, GlobalContext*); -typedef void (*BgBreakwallUnkFunc2)(struct BgBreakwall*, GlobalContext*); +typedef void (*BgBreakwallActionFunc)(struct BgBreakwall*, PlayState*); +typedef s32 (*BgBreakwallUnkFunc)(struct BgBreakwall*, PlayState*); +typedef void (*BgBreakwallUnkFunc2)(struct BgBreakwall*, PlayState*); #define BGBREAKWALL_GET_F(thisx) ((thisx)-> params & 0xF) #define BGBREAKWALL_SWITCHFLAG(thisx) (((thisx)-> params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index c5613248a7..7880410a6b 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -10,10 +10,10 @@ #define THIS ((BgCraceMovebg*)thisx) -void BgCraceMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgCraceMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgCraceMovebg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgCraceMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgCraceMovebg_Init(Actor* thisx, PlayState* play); +void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play); +void BgCraceMovebg_Update(Actor* thisx, PlayState* play); +void BgCraceMovebg_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Crace_Movebg_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h index 7208706d12..8e44e7597e 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h @@ -5,7 +5,7 @@ struct BgCraceMovebg; -typedef void (*BgCraceMovebgActionFunc)(struct BgCraceMovebg*, GlobalContext*); +typedef void (*BgCraceMovebgActionFunc)(struct BgCraceMovebg*, PlayState*); typedef struct BgCraceMovebg { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 2bcc31b5bf..0830d0d81b 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -11,13 +11,13 @@ #define THIS ((BgCtowerGear*)thisx) -void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerGear_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgCtowerGear_Init(Actor* thisx, PlayState* play); +void BgCtowerGear_Destroy(Actor* thisx, PlayState* play); +void BgCtowerGear_Update(Actor* thisx, PlayState* play); +void BgCtowerGear_Draw(Actor* thisx, PlayState* play); -void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerGear_DrawOrgan(Actor* thisx, GlobalContext* globalCtx); +void BgCtowerGear_UpdateOrgan(Actor* thisx, PlayState* play); +void BgCtowerGear_DrawOrgan(Actor* thisx, PlayState* play); const ActorInit Bg_Ctower_Gear_InitVars = { ACTOR_BG_CTOWER_GEAR, @@ -64,7 +64,7 @@ static InitChainEntry sInitChainOrgan[] = { static Gfx* sDLists[] = { gClockTowerCeilingCogDL, gClockTowerCenterCogDL, gClockTowerWaterWheelDL }; -void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { +void BgCtowerGear_Splash(BgCtowerGear* this, PlayState* play) { s32 i; s32 flag40 = this->dyna.actor.flags & 0x40; Vec3f splashSpawnPos; @@ -86,7 +86,7 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f); splashSpawnPos.y += this->dyna.actor.world.pos.y; splashSpawnPos.z += this->dyna.actor.world.pos.z + ((Rand_ZeroOne() * 20.0f) - 10.0f); - EffectSsGSplash_Spawn(globalCtx, &splashSpawnPos, NULL, NULL, 0, (Rand_Next() >> 25) + 340); + EffectSsGSplash_Spawn(play, &splashSpawnPos, NULL, NULL, 0, (Rand_Next() >> 25) + 340); } } } @@ -104,7 +104,7 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { splashSpawnPos.x += this->dyna.actor.world.pos.x + ((Rand_ZeroOne() * 20.0f) - 10.0f); splashSpawnPos.y += this->dyna.actor.world.pos.y; splashSpawnPos.z += this->dyna.actor.world.pos.z + ((Rand_ZeroOne() * 20.0f) - 10.0f); - EffectSsGSplash_Spawn(globalCtx, &splashSpawnPos, NULL, NULL, 0, (Rand_Next() >> 25) + 280); + EffectSsGSplash_Spawn(play, &splashSpawnPos, NULL, NULL, 0, (Rand_Next() >> 25) + 280); } } } @@ -112,7 +112,7 @@ void BgCtowerGear_Splash(BgCtowerGear* this, GlobalContext* globalCtx) { } } -void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerGear_Init(Actor* thisx, PlayState* play) { BgCtowerGear* this = THIS; s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor); @@ -128,24 +128,24 @@ void BgCtowerGear_Init(Actor* thisx, GlobalContext* globalCtx) { } if (type == BGCTOWERGEAR_WATER_WHEEL) { DynaPolyActor_Init(&this->dyna, 3); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerWaterWheelCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerWaterWheelCol); } else if (type == BGCTOWERGEAR_ORGAN) { DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerOrganCol); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerOrganCol); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgCtowerGear_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerGear_Destroy(Actor* thisx, PlayState* play) { BgCtowerGear* this = THIS; s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor); if ((type == BGCTOWERGEAR_WATER_WHEEL) || (type == BGCTOWERGEAR_ORGAN)) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerGear_Update(Actor* thisx, PlayState* play) { BgCtowerGear* this = THIS; s32 type = BGCTOWERGEAR_GET_TYPE(&this->dyna.actor); @@ -156,22 +156,22 @@ void BgCtowerGear_Update(Actor* thisx, GlobalContext* globalCtx) { func_800B9010(&this->dyna.actor, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG); } else if (type == BGCTOWERGEAR_WATER_WHEEL) { this->dyna.actor.shape.rot.z -= 0x1F4; - BgCtowerGear_Splash(this, globalCtx); + BgCtowerGear_Splash(this, play); } } -void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerGear_UpdateOrgan(Actor* thisx, PlayState* play) { BgCtowerGear* this = THIS; - if (Cutscene_CheckActorAction(globalCtx, 104)) { - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 104)]->action) { + if (Cutscene_CheckActorAction(play, 104)) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 104)]->action) { case 1: this->dyna.actor.draw = NULL; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); break; case 2: this->dyna.actor.draw = BgCtowerGear_DrawOrgan; - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); break; case 3: Actor_MarkForDeath(&this->dyna.actor); @@ -180,17 +180,17 @@ void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx) { } } -void BgCtowerGear_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDLists[BGCTOWERGEAR_GET_TYPE(thisx)]); +void BgCtowerGear_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDLists[BGCTOWERGEAR_GET_TYPE(thisx)]); } -void BgCtowerGear_DrawOrgan(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +void BgCtowerGear_DrawOrgan(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gClockTowerOrganDL); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClockTowerOrganPipesDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index d562d1a7ed..a064823f4a 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -11,15 +11,15 @@ #define THIS ((BgCtowerRot*)thisx) -void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerRot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerRot_Update(Actor* thisx, GlobalContext* globalCtx); -void BgCtowerRot_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgCtowerRot_Init(Actor* thisx, PlayState* play); +void BgCtowerRot_Destroy(Actor* thisx, PlayState* play); +void BgCtowerRot_Update(Actor* thisx, PlayState* play); +void BgCtowerRot_Draw(Actor* thisx, PlayState* play); -void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx); -void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, GlobalContext* globalCtx); -void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx); -void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, GlobalContext* globalCtx); +void BgCtowerRot_CorridorRotate(BgCtowerRot* this, PlayState* play); +void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, PlayState* play); +void BgCtowerRot_DoorIdle(BgCtowerRot* this, PlayState* play); +void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, PlayState* play); const ActorInit Bg_Ctower_Rot_InitVars = { ACTOR_BG_CTOWER_ROT, @@ -39,7 +39,7 @@ static InitChainEntry sInitChain[] = { static Gfx* sDLists[] = { gClockTowerCorridorDL, gClockTowerStoneDoorMainDL, gClockTowerStoneDoorDL }; -void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerRot_Init(Actor* thisx, PlayState* play) { s32 pad; BgCtowerRot* this = THIS; Player* player; @@ -48,17 +48,17 @@ void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); if (this->dyna.actor.params == BGCTOWERROT_CORRIDOR) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerCorridorCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerCorridorCol); this->actionFunc = BgCtowerRot_CorridorRotate; return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerStoneDoorMainCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerStoneDoorMainCol); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y + 0x4000; } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTowerStoneDoorCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerStoneDoorCol); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y - 0x4000; } Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); @@ -72,31 +72,31 @@ void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgCtowerRot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerRot_Destroy(Actor* thisx, PlayState* play) { BgCtowerRot* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgCtowerRot_CorridorRotate(BgCtowerRot* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f offset; f32 rotZ; Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); rotZ = CLAMP(1100.0f - offset.z, 0.0f, 1000.0f); - func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 17); + func_800DFAC8(play->cameraPtrs[CAM_ID_MAIN], 17); this->dyna.actor.shape.rot.z = rotZ * 16.384f; - if (globalCtx->csCtx.frames == 132) { + if (play->csCtx.frames == 132) { play_sound(NA_SE_SY_SPIRAL_DASH); } } -void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, GlobalContext* globalCtx) { +void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, PlayState* play) { } -void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { +void BgCtowerRot_DoorClose(BgCtowerRot* this, PlayState* play) { if (!Math_SmoothStepToF(&this->timer, 0.0f, 0.1f, 15.0f, 0.1f)) { if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); @@ -112,8 +112,8 @@ void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { this->dyna.actor.home.pos.z + (Math_CosS(this->dyna.actor.world.rot.y) * this->timer); } -void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgCtowerRot_DoorIdle(BgCtowerRot* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f offset; Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); @@ -124,7 +124,7 @@ void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) { } } -void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { +void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -135,17 +135,17 @@ void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { } } -void BgCtowerRot_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerRot_Update(Actor* thisx, PlayState* play) { BgCtowerRot* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgCtowerRot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgCtowerRot_Draw(Actor* thisx, PlayState* play) { BgCtowerRot* this = THIS; - Gfx_DrawDListOpa(globalCtx, sDLists[this->dyna.actor.params]); + Gfx_DrawDListOpa(play, sDLists[this->dyna.actor.params]); if (this->dyna.actor.params == BGCTOWERROT_CORRIDOR) { - Gfx_DrawDListXlu(globalCtx, gClockTowerCorridorFoliageDL); + Gfx_DrawDListXlu(play, gClockTowerCorridorFoliageDL); } } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.h b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.h index b8b0dbfb0b..e8b83fa226 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.h +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.h @@ -5,7 +5,7 @@ struct BgCtowerRot; -typedef void (*BgCtowerRotActionFunc)(struct BgCtowerRot*, GlobalContext*); +typedef void (*BgCtowerRotActionFunc)(struct BgCtowerRot*, PlayState*); typedef enum { /* 0 */ BGCTOWERROT_CORRIDOR, diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c index 1aada92723..a998936ec5 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c @@ -10,9 +10,9 @@ #define THIS ((BgDanpeiMovebg*)thisx) -void BgDanpeiMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDanpeiMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDanpeiMovebg_Update(Actor* thisx, GlobalContext* globalCtx); +void BgDanpeiMovebg_Init(Actor* thisx, PlayState* play); +void BgDanpeiMovebg_Destroy(Actor* thisx, PlayState* play); +void BgDanpeiMovebg_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Danpei_Movebg_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h index 28dafc099d..8d8f3d2983 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h @@ -5,7 +5,7 @@ struct BgDanpeiMovebg; -typedef void (*BgDanpeiMovebgActionFunc)(struct BgDanpeiMovebg*, GlobalContext*); +typedef void (*BgDanpeiMovebgActionFunc)(struct BgDanpeiMovebg*, PlayState*); typedef struct BgDanpeiMovebg { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index da39431410..99d5c5a85e 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -11,20 +11,20 @@ #define THIS ((BgDblueBalance*)thisx) -void BgDblueBalance_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDblueBalance_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDblueBalance_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDblueBalance_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDblueBalance_Init(Actor* thisx, PlayState* play); +void BgDblueBalance_Destroy(Actor* thisx, PlayState* play); +void BgDblueBalance_Update(Actor* thisx, PlayState* play); +void BgDblueBalance_Draw(Actor* thisx, PlayState* play); void func_80B82DC4(BgDblueBalance* this); -void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx); -void func_80B8330C(Actor* thisx, GlobalContext* globalCtx); +void func_80B82DE0(BgDblueBalance* this, PlayState* play); +void func_80B8330C(Actor* thisx, PlayState* play); void func_80B83344(BgDblueBalance* this); -void func_80B8335C(BgDblueBalance* this, GlobalContext* globalCtx); +void func_80B8335C(BgDblueBalance* this, PlayState* play); void func_80B833A8(BgDblueBalance* this); -void func_80B833C4(BgDblueBalance* this, GlobalContext* globalCtx); -void func_80B83518(Actor* thisx, GlobalContext* globalCtx); -void func_80B83758(Actor* thisx, GlobalContext* globalCtx); +void func_80B833C4(BgDblueBalance* this, PlayState* play); +void func_80B83518(Actor* thisx, PlayState* play); +void func_80B83758(Actor* thisx, PlayState* play); AnimatedMaterial* D_80B83C70; AnimatedMaterial* D_80B83C74; @@ -129,7 +129,7 @@ void func_80B823B0(BgDblueBalance* this) { } } -s32 func_80B82454(BgDblueBalance* this, GlobalContext* globalCtx) { +s32 func_80B82454(BgDblueBalance* this, PlayState* play) { s32 pad; s32 sp58 = true; BgDblueBalance* balance; @@ -147,8 +147,8 @@ s32 func_80B82454(BgDblueBalance* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&sp48, &sp3C); - this->unk_15C = (BgDblueBalance*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_DBLUE_BALANCE, sp3C.x, - sp3C.y, sp3C.z, 0, this->dyna.actor.shape.rot.y, 0, 0x100); + this->unk_15C = (BgDblueBalance*)Actor_Spawn(&play->actorCtx, play, ACTOR_BG_DBLUE_BALANCE, sp3C.x, sp3C.y, sp3C.z, + 0, this->dyna.actor.shape.rot.y, 0, 0x100); if (this->unk_15C == NULL) { sp58 = false; } else { @@ -159,8 +159,8 @@ s32 func_80B82454(BgDblueBalance* this, GlobalContext* globalCtx) { sp48.x = 138.28f; Matrix_MultVec3f(&sp48, &sp3C); - this->unk_160 = (BgDblueBalance*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_DBLUE_BALANCE, sp3C.x, - sp3C.y, sp3C.z, 0, this->dyna.actor.shape.rot.y, 0, 0x200); + this->unk_160 = (BgDblueBalance*)Actor_Spawn(&play->actorCtx, play, ACTOR_BG_DBLUE_BALANCE, sp3C.x, sp3C.y, sp3C.z, + 0, this->dyna.actor.shape.rot.y, 0, 0x200); if (this->unk_160 == NULL) { sp58 = false; } else { @@ -171,13 +171,13 @@ s32 func_80B82454(BgDblueBalance* this, GlobalContext* globalCtx) { return sp58; } -void func_80B8259C(BgDblueBalance* this, GlobalContext* globalCtx) { +void func_80B8259C(BgDblueBalance* this, PlayState* play) { s32 pad; WaterBox* sp30; f32 sp2C; - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.z, &sp2C, &sp30)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &sp2C, + &sp30)) { this->dyna.actor.depthInWater = sp2C - this->dyna.actor.world.pos.y; this->unk_228 = sp2C; if ((this->dyna.actor.depthInWater < 150.0f) && (this->dyna.actor.depthInWater > -150.0f)) { @@ -246,8 +246,8 @@ void func_80B8264C(BgDblueBalance* this) { } } -void func_80B828E4(BgDblueBalance* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)) && (this->unk_17D <= 0)) { +void func_80B828E4(BgDblueBalance* this, PlayState* play) { + if (Flags_GetSwitch(play, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)) && (this->unk_17D <= 0)) { if (this->unk_183 >= 252) { this->unk_183 = 255; } else { @@ -260,7 +260,7 @@ void func_80B828E4(BgDblueBalance* this, GlobalContext* globalCtx) { } } -void func_80B8296C(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { +void func_80B8296C(PlayState* play, Vec3f* arg1, f32 arg2) { s32 i; Vec3f sp60; f32 temp_f0; @@ -270,7 +270,7 @@ void func_80B8296C(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { sp60.x = ((Rand_ZeroOne() - 0.5f) * temp_f20) + arg1->x; sp60.y = arg1->y; sp60.z = ((Rand_ZeroOne() - 0.5f) * temp_f20) + arg1->z; - EffectSsGRipple_Spawn(globalCtx, &sp60, 500, 2000, D_80B83A90[i]); + EffectSsGRipple_Spawn(play, &sp60, 500, 2000, D_80B83A90[i]); } for (i = 0; i < ARRAY_COUNT(D_80B83A94); i++) { @@ -290,7 +290,7 @@ void func_80B8296C(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { } sp60.z = (temp_f20 * arg2) + arg1->z; - EffectSsGRipple_Spawn(globalCtx, &sp60, 400, 800, D_80B83A94[i]); + EffectSsGRipple_Spawn(play, &sp60, 400, 800, D_80B83A94[i]); } } @@ -301,12 +301,12 @@ s32 func_80B82B00(s16 arg0, s16 arg1, s16 arg2) { return (arg0 < arg2 || arg1 >= arg2); } -void BgDblueBalance_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueBalance_Init(Actor* thisx, PlayState* play) { s32 pad; BgDblueBalance* this = THIS; s32 sp2C = BGDBLUEBALANCE_GET_300(&this->dyna.actor); s32 pad2; - s32 sp24 = Flags_GetSwitch(globalCtx, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)); + s32 sp24 = Flags_GetSwitch(play, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -317,7 +317,7 @@ void BgDblueBalance_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.draw = D_80B83A20[sp2C].unk_18; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, D_80B83A20[sp2C].unk_04); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80B83A20[sp2C].unk_04); if (sp2C == 3) { D_80B83C70 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00CE00); @@ -333,8 +333,8 @@ void BgDblueBalance_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0x1C72; this->unk_174 = 0x1C72; } - func_80B82454(this, globalCtx); - func_80B8259C(this, globalCtx); + func_80B82454(this, play); + func_80B8259C(this, play); func_80B82DC4(this); } else if (sp2C == 3) { this->unk_16C = sp24; @@ -348,12 +348,12 @@ void BgDblueBalance_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgDblueBalance_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueBalance_Destroy(Actor* thisx, PlayState* play) { s32 pad; BgDblueBalance* this = THIS; s32 sp1C = BGDBLUEBALANCE_GET_300(&this->dyna.actor); - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (sp1C == 0) { if (this->unk_15C != NULL) { @@ -378,7 +378,7 @@ void func_80B82DC4(BgDblueBalance* this) { this->actionFunc = func_80B82DE0; } -void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx) { +void func_80B82DE0(BgDblueBalance* this, PlayState* play) { s32 pad; f32 sp88 = Math_CosS(this->dyna.actor.shape.rot.z * 2.2499313f); Actor* actor = &this->dyna.actor; @@ -396,7 +396,7 @@ void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx) { BgDblueBalance* sp3C; Vec3f sp30; - if (Flags_GetSwitch(globalCtx, BGDBLUEBALANCE_GET_7F(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGDBLUEBALANCE_GET_7F(&this->dyna.actor))) { if (this->unk_17D > 0) { this->unk_17D--; } else { @@ -495,7 +495,7 @@ void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx) { sp50.y = this->unk_228; sp50.z = sp5C->dyna.actor.world.pos.z + sp60.z; - func_80B8296C(globalCtx, &sp50, 70.0f); + func_80B8296C(play, &sp50, 70.0f); } else { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); } @@ -520,7 +520,7 @@ void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx) { sp30.y = this->unk_228; sp30.z = sp3C->dyna.actor.world.pos.z + sp40.z; - func_80B8296C(globalCtx, &sp30, 47.0f); + func_80B8296C(play, &sp30, 47.0f); } else { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); } @@ -532,17 +532,17 @@ void func_80B82DE0(BgDblueBalance* this, GlobalContext* globalCtx) { func_80B823B0(this); } -void BgDblueBalance_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueBalance_Update(Actor* thisx, PlayState* play) { BgDblueBalance* this = THIS; this->unk_17A = this->unk_178; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80B828E4(this, globalCtx); + func_80B828E4(this, play); } -void func_80B8330C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B8330C(Actor* thisx, PlayState* play) { BgDblueBalance* this = THIS; this->unk_180 = DynaPolyActor_IsInSwitchPressedState(&this->dyna); @@ -554,8 +554,8 @@ void func_80B83344(BgDblueBalance* this) { this->actionFunc = func_80B8335C; } -void func_80B8335C(BgDblueBalance* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, BGDBLUEBALANCE_GET_7F(&this->dyna.actor))) { +void func_80B8335C(BgDblueBalance* this, PlayState* play) { + if (!Flags_GetSwitch(play, BGDBLUEBALANCE_GET_7F(&this->dyna.actor))) { this->unk_178 = -0x14; func_80B833A8(this); } @@ -567,7 +567,7 @@ void func_80B833A8(BgDblueBalance* this) { this->actionFunc = func_80B833C4; } -void func_80B833C4(BgDblueBalance* this, GlobalContext* globalCtx) { +void func_80B833C4(BgDblueBalance* this, PlayState* play) { s32 pad; s32 sp28 = false; s16 sp26; @@ -616,12 +616,12 @@ void func_80B833C4(BgDblueBalance* this, GlobalContext* globalCtx) { } } -void func_80B83518(Actor* thisx, GlobalContext* globalCtx) { +void func_80B83518(Actor* thisx, PlayState* play) { BgDblueBalance* this = THIS; - this->unk_170 = Flags_GetSwitch(globalCtx, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)); + this->unk_170 = Flags_GetSwitch(play, BGDBLUEBALANCE_GET_7F(&this->dyna.actor)); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_17F == 2) { this->unk_17E--; @@ -641,39 +641,39 @@ void func_80B83518(Actor* thisx, GlobalContext* globalCtx) { this->unk_16C = this->unk_170; } -void BgDblueBalance_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueBalance_Draw(Actor* thisx, PlayState* play) { s32 pad; BgDblueBalance* this = THIS; BgDblueBalanceStruct2* ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)]; BgDblueBalance* sp38; Gfx* gfx; - Gfx_DrawDListOpa(globalCtx, ptr2->unk_00); + Gfx_DrawDListOpa(play, ptr2->unk_00); if (!(BGDBLUEBALANCE_GET_300(&this->dyna.actor)) && (this->unk_160 != NULL)) { - AnimatedMat_Draw(globalCtx, D_80B83C74); + AnimatedMat_Draw(play, D_80B83C74); sp38 = this->unk_160; Matrix_SetTranslateRotateYXZ(sp38->dyna.actor.world.pos.x, sp38->dyna.actor.world.pos.y, sp38->dyna.actor.world.pos.z, &sp38->dyna.actor.shape.rot); Matrix_Translate(30.0f, 15.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(sp38->dyna.actor.scale.x, sp38->dyna.actor.scale.y, sp38->dyna.actor.scale.z, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_XLU_DISP; gSPDisplayList(gfx++, &sSetupDL[6 * 25]); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(gfx++, 0, 0, 0, this->unk_183); gSPDisplayList(gfx++, object_dblue_object_DL_00D110); POLY_XLU_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80B83758(Actor* thisx, GlobalContext* globalCtx) { +void func_80B83758(Actor* thisx, PlayState* play) { s32 pad; BgDblueBalance* this = THIS; f32 temp_f0; @@ -695,12 +695,12 @@ void func_80B83758(Actor* thisx, GlobalContext* globalCtx) { if (this->dyna.actor.flags & ACTOR_FLAG_40) { ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)]; - Gfx_DrawDListOpa(globalCtx, ptr2->unk_00); + Gfx_DrawDListOpa(play, ptr2->unk_00); if (this->unk_183 != 0) { - AnimatedMat_Draw(globalCtx, D_80B83C70); + AnimatedMat_Draw(play, D_80B83C70); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_XLU_DISP; @@ -715,15 +715,14 @@ void func_80B83758(Actor* thisx, GlobalContext* globalCtx) { temp = ptr->unk_0E * (f32)this->unk_183 * 0.003921569f; gDPSetEnvColor(gfx++, 0, 0, 0, temp); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, object_dblue_object_DL_00CD10); } } POLY_XLU_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h index 16eed26e32..adef3420eb 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h @@ -5,7 +5,7 @@ struct BgDblueBalance; -typedef void (*BgDblueBalanceActionFunc)(struct BgDblueBalance*, GlobalContext*); +typedef void (*BgDblueBalanceActionFunc)(struct BgDblueBalance*, PlayState*); #define BGDBLUEBALANCE_GET_7F(thisx) ((thisx)->params & 0x7F) #define BGDBLUEBALANCE_GET_300(thisx) (((thisx)->params >> 8) & 3) diff --git a/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.c b/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.c index af6ed5fa2e..a945160f0a 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.c @@ -10,10 +10,10 @@ #define THIS ((BgDblueElevator*)thisx) -void BgDblueElevator_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDblueElevator_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDblueElevator_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDblueElevator_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDblueElevator_Init(Actor* thisx, PlayState* play); +void BgDblueElevator_Destroy(Actor* thisx, PlayState* play); +void BgDblueElevator_Update(Actor* thisx, PlayState* play); +void BgDblueElevator_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Dblue_Elevator_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.h b/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.h index 41015bdfb1..4e16a28c73 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Elevator/z_bg_dblue_elevator.h @@ -5,7 +5,7 @@ struct BgDblueElevator; -typedef void (*BgDblueElevatorActionFunc)(struct BgDblueElevator*, GlobalContext*); +typedef void (*BgDblueElevatorActionFunc)(struct BgDblueElevator*, PlayState*); typedef struct BgDblueElevator { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 857eb43cfb..89c1be29c9 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -12,23 +12,23 @@ #define THIS ((BgDblueMovebg*)thisx) -void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDblueMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDblueMovebg_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDblueMovebg_Init(Actor* thisx, PlayState* play); +void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play); +void BgDblueMovebg_Update(Actor* thisx, PlayState* play); +void BgDblueMovebg_Draw(Actor* thisx, PlayState* play); -void func_80A2A1E0(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A32C(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A444(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A670(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A688(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A714(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2A7F8(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2AAB8(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2AED0(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2B1A0(BgDblueMovebg* this, GlobalContext* globalCtx); -void func_80A2B274(Actor* thisx, GlobalContext* globalCtx); -void func_80A2B308(Actor* thisx, GlobalContext* globalCtx); +void func_80A2A1E0(BgDblueMovebg* this, PlayState* play); +void func_80A2A32C(BgDblueMovebg* this, PlayState* play); +void func_80A2A444(BgDblueMovebg* this, PlayState* play); +void func_80A2A670(BgDblueMovebg* this, PlayState* play); +void func_80A2A688(BgDblueMovebg* this, PlayState* play); +void func_80A2A714(BgDblueMovebg* this, PlayState* play); +void func_80A2A7F8(BgDblueMovebg* this, PlayState* play); +void func_80A2AAB8(BgDblueMovebg* this, PlayState* play); +void func_80A2AED0(BgDblueMovebg* this, PlayState* play); +void func_80A2B1A0(BgDblueMovebg* this, PlayState* play); +void func_80A2B274(Actor* thisx, PlayState* play); +void func_80A2B308(Actor* thisx, PlayState* play); BgDblueMovebg* D_80A2BBF0; @@ -107,7 +107,7 @@ static InitChainEntry sInitChain[] = { Vec3f D_80A2B988 = { 1785.0f, 0.0f, 220.0f }; -s32 func_80A29A80(GlobalContext* globalCtx, s32 arg1, s32 arg2) { +s32 func_80A29A80(PlayState* play, s32 arg1, s32 arg2) { s32 sp2C = 1; s32 val; s32 val2; @@ -118,11 +118,11 @@ s32 func_80A29A80(GlobalContext* globalCtx, s32 arg1, s32 arg2) { while (val--) { if ((1 << val) & val2) { - if (!Flags_GetSwitch(globalCtx, arg1 + val)) { + if (!Flags_GetSwitch(play, arg1 + val)) { sp2C = 0; break; } - } else if (Flags_GetSwitch(globalCtx, arg1 + val)) { + } else if (Flags_GetSwitch(play, arg1 + val)) { sp2C = 0; break; } @@ -131,20 +131,20 @@ s32 func_80A29A80(GlobalContext* globalCtx, s32 arg1, s32 arg2) { sp2C = 0; switch (arg2) { case 14: - if (!Flags_GetSwitch(globalCtx, arg1)) { + if (!Flags_GetSwitch(play, arg1)) { sp2C = 1; } - if (Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) && - Flags_GetSwitch(globalCtx, arg1 + 3)) { + if (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && + Flags_GetSwitch(play, arg1 + 3)) { sp2C += 2; } break; case 15: - if (!Flags_GetSwitch(globalCtx, arg1) || - (Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) && - Flags_GetSwitch(globalCtx, arg1 + 3))) { + if (!Flags_GetSwitch(play, arg1) || + (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && + Flags_GetSwitch(play, arg1 + 3))) { sp2C = 1; } break; @@ -153,7 +153,7 @@ s32 func_80A29A80(GlobalContext* globalCtx, s32 arg1, s32 arg2) { return sp2C; } -void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { s32 pad; BgDblueMovebg* this = THIS; s32 i; @@ -189,7 +189,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { } if (D_80A2B90C[this->unk_160] != NULL) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, D_80A2B90C[this->unk_160]); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80A2B90C[this->unk_160]); } this->unk_164 = D_80A2B8AC[this->unk_160]; @@ -206,14 +206,14 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x = 0; this->dyna.actor.world.rot.z = 0; this->dyna.actor.shape.rot.z = 0; - if (func_80A29A80(globalCtx, this->unk_1C8, this->unk_1C4)) { + if (func_80A29A80(play, this->unk_1C8, this->unk_1C4)) { this->unk_172 |= 1; } else { this->unk_172 &= ~1; } this->unk_17E = 0; this->unk_184 = 0.0f; - if (Flags_GetSwitch(globalCtx, this->unk_1C0)) { + if (Flags_GetSwitch(play, this->unk_1C0)) { this->unk_18C = 0x384; } else { this->unk_18C = 0; @@ -223,7 +223,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 6: - this->unk_178 = func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC); + this->unk_178 = func_80A29A80(play, this->unk_1C0, this->unk_1BC); this->unk_1CC = D_80A2B96C[this->unk_178]; this->unk_1CE = this->unk_1CC; this->actionFunc = func_80A2A1E0; @@ -236,7 +236,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x = 0; this->dyna.actor.world.rot.z = 0; this->dyna.actor.shape.rot.z = 0; - if (Flags_GetSwitch(globalCtx, this->unk_1C0)) { + if (Flags_GetSwitch(play, this->unk_1C0)) { Actor_MarkForDeath(&this->dyna.actor); break; } @@ -256,7 +256,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(D_80A2B974); i++) { D_80A2B974[i] = this->unk_1B6[i]; } - this->unk_178 = func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC); + this->unk_178 = func_80A29A80(play, this->unk_1C0, this->unk_1BC); this->unk_1CC = D_80A2B96C[this->unk_178]; this->unk_1CE = this->unk_1CC; Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW); @@ -274,7 +274,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 11: - this->unk_1CC = D_80A2B96C[func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC)]; + this->unk_1CC = D_80A2B96C[func_80A29A80(play, this->unk_1C0, this->unk_1BC)]; D_80A2BBF0 = this; this->dyna.actor.flags |= ACTOR_FLAG_20; this->dyna.actor.update = Actor_Noop; @@ -283,20 +283,20 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgDblueMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play) { BgDblueMovebg* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->unk_160 == 9) || (this->unk_160 == 8)) { Audio_StopSfxByPos(&this->unk_1A8); } } -void func_80A2A128(BgDblueMovebg* this, GlobalContext* globalCtx) { +void func_80A2A128(BgDblueMovebg* this, PlayState* play) { Actor* phi_s0 = NULL; while (true) { - phi_s0 = SubS_FindActor(globalCtx, phi_s0, ACTORCAT_BG, ACTOR_OBJ_HUNSUI); + phi_s0 = SubS_FindActor(play, phi_s0, ACTORCAT_BG, ACTOR_OBJ_HUNSUI); if (phi_s0 != NULL) { if ((OBJHUNSUI_GET_F000(phi_s0) == 5) && (phi_s0->update != NULL)) { this->unk_2F8[1] = phi_s0; @@ -312,8 +312,8 @@ void func_80A2A128(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2A1E0(BgDblueMovebg* this, GlobalContext* globalCtx) { - s32 temp_v0 = func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC); +void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) { + s32 temp_v0 = func_80A29A80(play, this->unk_1C0, this->unk_1BC); if (temp_v0 != this->unk_178) { switch (temp_v0) { @@ -339,16 +339,15 @@ void func_80A2A1E0(BgDblueMovebg* this, GlobalContext* globalCtx) { Math_StepToS(&this->unk_1CC, this->unk_1CE, 12); this->dyna.actor.shape.rot.y += this->unk_1CC; - if (globalCtx->roomCtx.currRoom.num == 0) { + if (play->roomCtx.currRoom.num == 0) { this->unk_164 = object_dblue_object_DL_004848; - } else if (globalCtx->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.currRoom.num == 8) { this->unk_164 = NULL; } - if (globalCtx->roomCtx.currRoom.num != this->unk_170) { - if (globalCtx->roomCtx.currRoom.num != this->unk_171) { - if ((globalCtx->roomCtx.prevRoom.num != this->unk_170) && - (globalCtx->roomCtx.prevRoom.num != this->unk_171)) { + if (play->roomCtx.currRoom.num != this->unk_170) { + if (play->roomCtx.currRoom.num != this->unk_171) { + if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_01 = 0; Actor_MarkForDeath(&this->dyna.actor); } @@ -356,8 +355,8 @@ void func_80A2A1E0(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2A32C(BgDblueMovebg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2A32C(BgDblueMovebg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_v0; f32 phi_f0; s32 phi_v1; @@ -396,8 +395,8 @@ void func_80A2A32C(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2A444(BgDblueMovebg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2A444(BgDblueMovebg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp20; Player* temp_a3; s16 temp_v0; @@ -422,10 +421,10 @@ void func_80A2A444(BgDblueMovebg* this, GlobalContext* globalCtx) { if (sp20) { player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; - Flags_SetSwitch(globalCtx, this->unk_1C0); + Flags_SetSwitch(play, this->unk_1C0); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); - if (func_80A29A80(globalCtx, this->unk_1C8, this->unk_1C4)) { + if (func_80A29A80(play, this->unk_1C8, this->unk_1C4)) { this->unk_172 |= 1; } else { this->unk_172 &= ~1; @@ -434,17 +433,17 @@ void func_80A2A444(BgDblueMovebg* this, GlobalContext* globalCtx) { if (!(this->unk_174 & 1) && (this->unk_172 & 1)) { func_801000CC(NA_SE_EV_PIPE_STREAM_START); } - func_80A2A670(this, globalCtx); + func_80A2A670(this, play); } else { func_800B9010(&this->dyna.actor, NA_SE_EV_COCK_SWITCH_ROLL - SFX_FLAG); } } -void func_80A2A670(BgDblueMovebg* this, GlobalContext* globalCtx) { +void func_80A2A670(BgDblueMovebg* this, PlayState* play) { this->actionFunc = func_80A2A688; } -void func_80A2A688(BgDblueMovebg* this, GlobalContext* globalCtx) { +void func_80A2A688(BgDblueMovebg* this, PlayState* play) { this->unk_180--; if (this->unk_180 <= 0) { ActorCutscene_Stop(this->unk_1B6[0]); @@ -456,8 +455,8 @@ void func_80A2A688(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2A714(BgDblueMovebg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2A714(BgDblueMovebg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_v0; f32 phi_f0; @@ -484,8 +483,8 @@ void func_80A2A714(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2A7F8(BgDblueMovebg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2A7F8(BgDblueMovebg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp28; s16 sp26; s32 temp; @@ -511,9 +510,9 @@ void func_80A2A7F8(BgDblueMovebg* this, GlobalContext* globalCtx) { temp = (this->unk_18C + sp26 + 3600) % 3600; if ((temp == 900) || (temp == 2700)) { - Flags_SetSwitch(globalCtx, this->unk_1C0); + Flags_SetSwitch(play, this->unk_1C0); } else { - Flags_UnsetSwitch(globalCtx, this->unk_1C0); + Flags_UnsetSwitch(play, this->unk_1C0); } player->stateFlags1 |= 0x20; @@ -527,7 +526,7 @@ void func_80A2A7F8(BgDblueMovebg* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); - if (func_80A29A80(globalCtx, this->unk_1C8, this->unk_1C4)) { + if (func_80A29A80(play, this->unk_1C8, this->unk_1C4)) { this->unk_172 |= 1; } else { this->unk_172 &= ~1; @@ -545,8 +544,8 @@ void func_80A2A7F8(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2AAB8(BgDblueMovebg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2AAB8(BgDblueMovebg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp18; if (this->unk_180-- <= 0) { @@ -576,7 +575,7 @@ void func_80A2AAB8(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2ABD0(BgDblueMovebg* this, GlobalContext* globalCtx) { +void func_80A2ABD0(BgDblueMovebg* this, PlayState* play) { Vec3f spAC; f32 temp_f0; f32 temp_f20; @@ -586,7 +585,7 @@ void func_80A2ABD0(BgDblueMovebg* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->unk_2F8); i++) { if (this->unk_2F8[i] == NULL) { - func_80A2A128(this, globalCtx); + func_80A2A128(this, play); continue; } @@ -624,14 +623,13 @@ void func_80A2ABD0(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void func_80A2AED0(BgDblueMovebg* this, GlobalContext* globalCtx) { +void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { s32 pad; s32 temp_v0_3; - if (globalCtx->roomCtx.currRoom.num != this->unk_170) { - if (globalCtx->roomCtx.currRoom.num != this->unk_171) { - if ((globalCtx->roomCtx.prevRoom.num != this->unk_170) && - (globalCtx->roomCtx.prevRoom.num != this->unk_171)) { + if (play->roomCtx.currRoom.num != this->unk_170) { + if (play->roomCtx.currRoom.num != this->unk_171) { + if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_00 = 0; Actor_MarkForDeath(&this->dyna.actor); return; @@ -639,7 +637,7 @@ void func_80A2AED0(BgDblueMovebg* this, GlobalContext* globalCtx) { } } - temp_v0_3 = func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC); + temp_v0_3 = func_80A29A80(play, this->unk_1C0, this->unk_1BC); if (temp_v0_3 != this->unk_178) { switch (temp_v0_3) { case 1: @@ -670,17 +668,17 @@ void func_80A2AED0(BgDblueMovebg* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x += this->unk_1CC; if (this->unk_160 == 8) { - if (globalCtx->roomCtx.currRoom.num == 8) { - func_80A2ABD0(this, globalCtx); + if (play->roomCtx.currRoom.num == 8) { + func_80A2ABD0(this, play); this->unk_172 |= 0x20; } else { this->unk_172 &= ~0x20; } } - if (globalCtx->roomCtx.currRoom.num == 0) { + if (play->roomCtx.currRoom.num == 0) { this->unk_164 = object_dblue_object_DL_008778; - } else if (globalCtx->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.currRoom.num == 8) { this->unk_164 = object_dblue_object_DL_00A528; } @@ -688,25 +686,25 @@ void func_80A2AED0(BgDblueMovebg* this, GlobalContext* globalCtx) { Vec3f sp54; f32 sp50; - if (Math3D_PointDistToLine2D(globalCtx->view.eye.x, globalCtx->view.eye.z, this->unk_190.x, this->unk_190.z, + if (Math3D_PointDistToLine2D(play->view.eye.x, play->view.eye.z, this->unk_190.x, this->unk_190.z, this->unk_19C.x, this->unk_19C.z, &sp54.x, &sp54.z, &sp50)) { sp54.y = this->dyna.actor.world.pos.y; } else { - if (Math_Vec3f_DistXYZ(&globalCtx->view.eye, &this->unk_190) <= - Math_Vec3f_DistXYZ(&globalCtx->view.eye, &this->unk_19C)) { + if (Math_Vec3f_DistXYZ(&play->view.eye, &this->unk_190) <= + Math_Vec3f_DistXYZ(&play->view.eye, &this->unk_19C)) { Math_Vec3f_Copy(&sp54, &this->unk_190); } else { Math_Vec3f_Copy(&sp54, &this->unk_19C); } } - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &sp54, &this->unk_1A8); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sp54, &this->unk_1A8); this->unk_1D4 = ABS(this->unk_1CC) / 364.0f; } } -void func_80A2B1A0(BgDblueMovebg* this, GlobalContext* globalCtx) { - switch (func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC)) { +void func_80A2B1A0(BgDblueMovebg* this, PlayState* play) { + switch (func_80A29A80(play, this->unk_1C0, this->unk_1BC)) { case 1: this->dyna.actor.shape.rot.z = this->dyna.actor.home.rot.z; break; @@ -717,10 +715,10 @@ void func_80A2B1A0(BgDblueMovebg* this, GlobalContext* globalCtx) { } } -void BgDblueMovebg_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueMovebg_Update(Actor* thisx, PlayState* play) { BgDblueMovebg* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_172 & 8) { if (SubS_StartActorCutscene(&this->dyna.actor, this->unk_1D2, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { @@ -729,7 +727,7 @@ void BgDblueMovebg_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80A2B274(Actor* thisx, GlobalContext* globalCtx) { +void func_80A2B274(Actor* thisx, PlayState* play) { BgDblueMovebg* this = THIS; s16 temp_v1; @@ -738,7 +736,7 @@ void func_80A2B274(Actor* thisx, GlobalContext* globalCtx) { return; } - temp_v1 = D_80A2B96C[func_80A29A80(globalCtx, this->unk_1C0, this->unk_1BC)]; + temp_v1 = D_80A2B96C[func_80A29A80(play, this->unk_1C0, this->unk_1BC)]; if (temp_v1 != 0) { if (temp_v1 > 0) { func_8019FC20(&this->dyna.actor.projectedPos, NA_SE_EV_DUMMY_WATER_WHEEL_RR - SFX_FLAG); @@ -748,22 +746,22 @@ void func_80A2B274(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80A2B308(Actor* thisx, GlobalContext* globalCtx) { +void func_80A2B308(Actor* thisx, PlayState* play) { s32 pad; BgDblueMovebg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_164); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgDblueMovebg* this = THIS; s32 i; s32 j; @@ -772,17 +770,17 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Push(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->unk_160 == 9) || (this->unk_160 == 8) || (this->dyna.actor.flags & ACTOR_FLAG_40)) { if (this->unk_16C != NULL) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(this->unk_16C)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_16C)); } if ((this->unk_164 != 0) || (this->unk_160 == 6)) { gfx2 = Gfx_CallSetupDL(POLY_OPA_DISP, 0x19); - gSPMatrix(&gfx2[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx2[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_160 == 6) { gSPDisplayList(&gfx2[1], object_dblue_object_DL_0052B8); @@ -801,7 +799,7 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_168 != NULL) { gfx = func_8012C2B4(POLY_XLU_DISP); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], this->unk_168); POLY_XLU_DISP = &gfx[2]; @@ -810,12 +808,12 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if ((this->unk_160 == 8) && (this->unk_172 & 0x20)) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_dblue_object_Matanimheader_00CE00)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_dblue_object_Matanimheader_00CE00)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); @@ -828,11 +826,10 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { for (j = 0; j < ARRAY_COUNT(this->unk_1D8); j++) { if (this->unk_1D8[j][i] > 0) { if (this->unk_1F8[j][i] > 0.1f) { - gSPSegment( - gfx++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, - (s32)(((globalCtx->gameplayFrames % 128) * -9.0f) / this->unk_1F8[j][i]), - 0x20, 0x20, 1, 0, 0, 0x20, 0x20)); + gSPSegment(gfx++, 0x09, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, + (s32)(((play->gameplayFrames % 128) * -9.0f) / this->unk_1F8[j][i]), + 0x20, 0x20, 1, 0, 0, 0x20, 0x20)); } Matrix_Push(); Matrix_RotateXS(i * 0x2000, MTXMODE_APPLY); @@ -844,8 +841,7 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1F8[j][i] * this->dyna.actor.scale.y, this->unk_1F8[j][i] * this->dyna.actor.scale.z, MTXMODE_APPLY); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetEnvColor(gfx++, 255, 255, 255, this->unk_1D8[j][i]); gSPDisplayList(gfx++, object_dblue_object_DL_00CD10); @@ -855,7 +851,7 @@ void BgDblueMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { } POLY_XLU_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if ((this->unk_160 == 9) || (this->unk_160 == 8)) { diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h index b487762387..83fb1df621 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h @@ -5,7 +5,7 @@ struct BgDblueMovebg; -typedef void (*BgDblueMovebgActionFunc)(struct BgDblueMovebg*, GlobalContext*); +typedef void (*BgDblueMovebgActionFunc)(struct BgDblueMovebg*, PlayState*); #define BGDBLUEMOVEBG_GET_F(thisx) ((thisx)->params & 0xF) #define BGDBLUEMOVEBG_GET_FF0(thisx) (((thisx)->params >> 4) & 0xFF) diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c index a9777972d5..6f914a4752 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c @@ -11,19 +11,19 @@ #define THIS ((BgDblueWaterfall*)thisx) -void BgDblueWaterfall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDblueWaterfall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDblueWaterfall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDblueWaterfall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDblueWaterfall_Init(Actor* thisx, PlayState* play); +void BgDblueWaterfall_Destroy(Actor* thisx, PlayState* play); +void BgDblueWaterfall_Update(Actor* thisx, PlayState* play); +void BgDblueWaterfall_Draw(Actor* thisx, PlayState* play); -void func_80B8484C(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84928(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84AD4(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84AEC(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84B9C(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84BCC(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84EF0(BgDblueWaterfall* this, GlobalContext* globalCtx); -void func_80B84F20(BgDblueWaterfall* this, GlobalContext* globalCtx); +void func_80B8484C(BgDblueWaterfall* this, PlayState* play); +void func_80B84928(BgDblueWaterfall* this, PlayState* play); +void func_80B84AD4(BgDblueWaterfall* this, PlayState* play); +void func_80B84AEC(BgDblueWaterfall* this, PlayState* play); +void func_80B84B9C(BgDblueWaterfall* this, PlayState* play); +void func_80B84BCC(BgDblueWaterfall* this, PlayState* play); +void func_80B84EF0(BgDblueWaterfall* this, PlayState* play); +void func_80B84F20(BgDblueWaterfall* this, PlayState* play); const ActorInit Bg_Dblue_Waterfall_InitVars = { ACTOR_BG_DBLUE_WATERFALL, @@ -76,11 +76,11 @@ s32 func_80B83C80(Vec3f* arg0, Vec3f* arg1) { return true; } -s32 func_80B83D04(BgDblueWaterfall* this, GlobalContext* globalCtx) { +s32 func_80B83D04(BgDblueWaterfall* this, PlayState* play) { s32 phi_v1; s32 sp18 = BGDBLUEWATERFALL_GET_100(&this->actor); - if (Flags_GetSwitch(globalCtx, BGDBLUEWATERFALL_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, BGDBLUEWATERFALL_GET_7F(&this->actor))) { phi_v1 = true; } else { phi_v1 = false; @@ -88,22 +88,22 @@ s32 func_80B83D04(BgDblueWaterfall* this, GlobalContext* globalCtx) { return phi_v1 ^ sp18; } -s32 func_80B83D58(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80B83D58(Actor* thisx, PlayState* play) { BgDblueWaterfall* this = THIS; - if (Flags_GetSwitch(globalCtx, BGDBLUEWATERFALL_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, BGDBLUEWATERFALL_GET_7F(&this->actor))) { return false; } return true; } -void func_80B83D94(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B83D94(BgDblueWaterfall* this, PlayState* play) { s32 pad; s32 sp20 = BGDBLUEWATERFALL_GET_7F(&this->actor); s32 sp1C = BGDBLUEWATERFALL_GET_100(&this->actor); s32 phi_v0; - if (Flags_GetSwitch(globalCtx, sp20)) { + if (Flags_GetSwitch(play, sp20)) { phi_v0 = true; } else { phi_v0 = false; @@ -111,20 +111,20 @@ void func_80B83D94(BgDblueWaterfall* this, GlobalContext* globalCtx) { if (phi_v0 != sp1C) { if (phi_v0) { - Flags_UnsetSwitch(globalCtx, sp20); + Flags_UnsetSwitch(play, sp20); } else { - Flags_SetSwitch(globalCtx, sp20); + Flags_SetSwitch(play, sp20); } } } -void func_80B83E1C(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B83E1C(BgDblueWaterfall* this, PlayState* play) { s32 pad; s32 sp20 = BGDBLUEWATERFALL_GET_7F(&this->actor); s32 sp1C = BGDBLUEWATERFALL_GET_100(&this->actor); s32 phi_v0; - if (Flags_GetSwitch(globalCtx, sp20)) { + if (Flags_GetSwitch(play, sp20)) { phi_v0 = true; } else { phi_v0 = false; @@ -132,14 +132,14 @@ void func_80B83E1C(BgDblueWaterfall* this, GlobalContext* globalCtx) { if (phi_v0 == sp1C) { if (phi_v0) { - Flags_UnsetSwitch(globalCtx, sp20); + Flags_UnsetSwitch(play, sp20); } else { - Flags_SetSwitch(globalCtx, sp20); + Flags_SetSwitch(play, sp20); } } } -void func_80B83EA4(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B83EA4(BgDblueWaterfall* this, PlayState* play) { s32 i; s32 temp_s1; Vec3f spD4; @@ -189,13 +189,13 @@ void func_80B83EA4(BgDblueWaterfall* this, GlobalContext* globalCtx) { spBC.x = spC8.x * -0.02f; spBC.z = spC8.z * -0.02f; - EffectSsEnIce_Spawn(globalCtx, &spD4, (Rand_ZeroOne() * 0.3f) + 0.1f, &spC8, &spBC, &D_80B8539C, - &D_80B853A0, 30); + EffectSsEnIce_Spawn(play, &spD4, (Rand_ZeroOne() * 0.3f) + 0.1f, &spC8, &spBC, &D_80B8539C, &D_80B853A0, + 30); } } } -void func_80B841A0(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B841A0(BgDblueWaterfall* this, PlayState* play) { Vec3f sp94; s32 i; f32 temp_f0; @@ -220,15 +220,15 @@ void func_80B841A0(BgDblueWaterfall* this, GlobalContext* globalCtx) { sp94.y = ((Rand_ZeroOne() * 20.0f) - 10.0f) + temp_f24; sp94.z = (Math_CosS(temp_s3) * temp_f20) + temp_f26; - EffectSsGSplash_Spawn(globalCtx, &sp94, NULL, NULL, 0, 250); + EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 0, 250); } Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_REFLECTION_WATER); } } -void func_80B84348(BgDblueWaterfall* this, GlobalContext* globalCtx, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, - f32 arg7, s32 arg8) { +void func_80B84348(BgDblueWaterfall* this, PlayState* play, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7, + s32 arg8) { static s16 D_80B853A4 = 0; s32 pad; f32 spB8 = 1.0f / arg8; @@ -263,20 +263,19 @@ void func_80B84348(BgDblueWaterfall* this, GlobalContext* globalCtx, f32 arg2, f sp98.y = temp_f24 + spB0; sp98.z = (temp_f22 * 50.0f) + this->actor.world.pos.z; - EffectSsIceSmoke_Spawn(globalCtx, &sp98, &sp8C, &sp80, (Rand_ZeroOne() * arg7) + arg6); + EffectSsIceSmoke_Spawn(play, &sp98, &sp8C, &sp80, (Rand_ZeroOne() * arg7) + arg6); } } -void func_80B84568(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84568(BgDblueWaterfall* this, PlayState* play) { s32 pad; CollisionPoly* sp40; WaterBox* sp3C; s32 sp38; - f32 sp34 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp40, &sp38, &this->actor, &this->actor.world.pos); + f32 sp34 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp40, &sp38, &this->actor, &this->actor.world.pos); f32 sp30; - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, - &sp3C)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp3C)) { if (sp30 < sp34) { this->unk_198 = sp34; } else { @@ -287,10 +286,10 @@ void func_80B84568(BgDblueWaterfall* this, GlobalContext* globalCtx) { } } -void func_80B84610(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84610(BgDblueWaterfall* this, PlayState* play) { s32 pad[2]; Vec3f sp34; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_1A7 <= 0) { this->unk_1A7 = 16; @@ -333,7 +332,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgDblueWaterfall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueWaterfall_Init(Actor* thisx, PlayState* play) { s32 pad; BgDblueWaterfall* this = THIS; @@ -341,26 +340,26 @@ void BgDblueWaterfall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = 0; this->actor.world.rot.z = 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->unk_190 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00B448); Actor_SetFocus(&this->actor, -100.0f); - func_80B84568(this, globalCtx); - func_80B8484C(this, globalCtx); + func_80B84568(this, play); + func_80B8484C(this, play); } -void BgDblueWaterfall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueWaterfall_Destroy(Actor* thisx, PlayState* play) { BgDblueWaterfall* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B8484C(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B8484C(BgDblueWaterfall* this, PlayState* play) { s32 pad; - s32 temp = func_80B83D04(this, globalCtx); + s32 temp = func_80B83D04(this, play); s32 sp1C = this->actor.home.rot.z * 10; if (temp) { @@ -381,7 +380,7 @@ void func_80B8484C(BgDblueWaterfall* this, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } - if ((sp1C != 0) && !func_80B83D58(&this->actor, globalCtx)) { + if ((sp1C != 0) && !func_80B83D58(&this->actor, play)) { this->unk_19C = sp1C; } else { this->unk_19C = 0; @@ -391,9 +390,9 @@ void func_80B8484C(BgDblueWaterfall* this, GlobalContext* globalCtx) { this->actionFunc = func_80B84928; } -void func_80B84928(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84928(BgDblueWaterfall* this, PlayState* play) { s32 pad; - s32 sp30 = func_80B83D04(this, globalCtx); + s32 sp30 = func_80B83D04(this, play); s32 sp2C = (this->collider.base.acFlags & AC_HIT) != 0; s32 sp28 = false; @@ -402,18 +401,18 @@ void func_80B84928(BgDblueWaterfall* this, GlobalContext* globalCtx) { } if ((sp30 == 0) && (this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { - func_80B84610(this, globalCtx); + func_80B84610(this, play); } if (this->unk_19C > 0) { this->unk_19C--; if (this->unk_19C == 0) { if (sp30 != 0) { - func_80B83D94(this, globalCtx); - func_80B84EF0(this, globalCtx); + func_80B83D94(this, play); + func_80B84EF0(this, play); } else { - func_80B83E1C(this, globalCtx); - func_80B84B9C(this, globalCtx); + func_80B83E1C(this, play); + func_80B84B9C(this, play); } sp28 = true; } @@ -422,50 +421,50 @@ void func_80B84928(BgDblueWaterfall* this, GlobalContext* globalCtx) { if (!sp28) { if (sp2C) { if (sp30 != 0) { - func_80B83EA4(this, globalCtx); + func_80B83EA4(this, play); if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x800) { this->unk_1A4 = this->actor.cutscene; - func_80B84AD4(this, globalCtx); + func_80B84AD4(this, play); } } else { - func_80B841A0(this, globalCtx); + func_80B841A0(this, play); if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000) { this->unk_1A4 = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - func_80B84AD4(this, globalCtx); + func_80B84AD4(this, play); } } } 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 func_80B84AD4(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84AD4(BgDblueWaterfall* this, PlayState* play) { this->actionFunc = func_80B84AEC; } -void func_80B84AEC(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84AEC(BgDblueWaterfall* this, PlayState* play) { s32 pad; s32 sp20; if (ActorCutscene_GetCanPlayNext(this->unk_1A4)) { - sp20 = func_80B83D04(this, globalCtx); + sp20 = func_80B83D04(this, play); ActorCutscene_StartAndSetUnkLinkFields(this->unk_1A4, &this->actor); this->unk_1A3 = true; if (sp20) { - func_80B83D94(this, globalCtx); - func_80B84EF0(this, globalCtx); + func_80B83D94(this, play); + func_80B84EF0(this, play); } else { - func_80B83E1C(this, globalCtx); - func_80B84B9C(this, globalCtx); + func_80B83E1C(this, play); + func_80B84B9C(this, play); } } else { ActorCutscene_SetIntentToPlay(this->unk_1A4); } } -void func_80B84B9C(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84B9C(BgDblueWaterfall* this, PlayState* play) { this->unk_19C = 60; this->unk_19E = 255; this->unk_19F = 0; @@ -473,7 +472,7 @@ void func_80B84B9C(BgDblueWaterfall* this, GlobalContext* globalCtx) { this->actionFunc = func_80B84BCC; } -void func_80B84BCC(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84BCC(BgDblueWaterfall* this, PlayState* play) { s32 pad; this->unk_19C--; @@ -481,23 +480,23 @@ void func_80B84BCC(BgDblueWaterfall* this, GlobalContext* globalCtx) { s32 sp38 = this->unk_19C & 1; if (this->unk_19C > 56) { - func_80B84348(this, globalCtx, 0.0f, -5500.0f, 0.4f, -15.0f, 370.0f, 100.0f, 6); + func_80B84348(this, play, 0.0f, -5500.0f, 0.4f, -15.0f, 370.0f, 100.0f, 6); } if (!sp38) { if ((this->unk_19C < 24) && (this->unk_19C > 10)) { if (this->unk_198 > -32000.0f) { - func_80B84348(this, globalCtx, (this->unk_198 - this->actor.world.pos.y) + 50.0f, + func_80B84348(this, play, (this->unk_198 - this->actor.world.pos.y) + 50.0f, (this->unk_198 - this->actor.world.pos.y), 7.0f, -1.0f, 280.0f, 100.0f, 3); } } if (this->unk_19C > 50) { - func_80B84348(this, globalCtx, 0.0f, -400.0f, 0.6f, -12.0f, 370.0f, 100.0f, 2); + func_80B84348(this, play, 0.0f, -400.0f, 0.6f, -12.0f, 370.0f, 100.0f, 2); } else if (this->unk_19C > 40) { - func_80B84348(this, globalCtx, 0.0f, -400.0f, 1.0f, -12.0f, 370.0f, 100.0f, 2); + func_80B84348(this, play, 0.0f, -400.0f, 1.0f, -12.0f, 370.0f, 100.0f, 2); } else if (this->unk_19C > 20) { - func_80B84348(this, globalCtx, 0.0f, -400.0f, 1.8f, -12.0f, 370.0f, 100.0f, 2); + func_80B84348(this, play, 0.0f, -400.0f, 1.8f, -12.0f, 370.0f, 100.0f, 2); } } @@ -536,11 +535,11 @@ void func_80B84BCC(BgDblueWaterfall* this, GlobalContext* globalCtx) { if (this->unk_1A3) { ActorCutscene_Stop(this->unk_1A4); } - func_80B8484C(this, globalCtx); + func_80B8484C(this, play); } } -void func_80B84EF0(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84EF0(BgDblueWaterfall* this, PlayState* play) { this->unk_19C = 60; this->unk_19E = 0; this->unk_19F = 255; @@ -548,12 +547,12 @@ void func_80B84EF0(BgDblueWaterfall* this, GlobalContext* globalCtx) { this->actionFunc = func_80B84F20; } -void func_80B84F20(BgDblueWaterfall* this, GlobalContext* globalCtx) { +void func_80B84F20(BgDblueWaterfall* this, PlayState* play) { this->unk_19C--; if (this->unk_19C > 0) { if (this->unk_19C >= 58) { - func_80B84348(this, globalCtx, 100.0f, -100.0f, 4.0f, -6.0f, 370.0f, 100.0f, 0xC); + func_80B84348(this, play, 100.0f, -100.0f, 4.0f, -6.0f, 370.0f, 100.0f, 0xC); } if (this->unk_19C < 50) { @@ -575,30 +574,30 @@ void func_80B84F20(BgDblueWaterfall* this, GlobalContext* globalCtx) { if (this->unk_1A3) { ActorCutscene_Stop(this->unk_1A4); } - func_80B8484C(this, globalCtx); + func_80B8484C(this, play); } } -void BgDblueWaterfall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueWaterfall_Update(Actor* thisx, PlayState* play) { BgDblueWaterfall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgDblueWaterfall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgDblueWaterfall_Draw(Actor* thisx, PlayState* play) { s32 pad; BgDblueWaterfall* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_19E > 0) { s32 sp38 = this->unk_19E * 0.49803922f; - AnimatedMat_Draw(globalCtx, this->unk_190); + AnimatedMat_Draw(play, this->unk_190); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x8A, 255, 255, 255, sp38); gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_00B280); @@ -610,12 +609,11 @@ void BgDblueWaterfall_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x9B, 255, 255, 255, this->unk_19F); gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003358); } else { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x9B, 255, 255, 255, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dblue_object_DL_003358); } @@ -628,5 +626,5 @@ void BgDblueWaterfall_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003770); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h index 0fa908629a..24bd8e91ad 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h @@ -5,7 +5,7 @@ struct BgDblueWaterfall; -typedef void (*BgDblueWaterfallActionFunc)(struct BgDblueWaterfall*, GlobalContext*); +typedef void (*BgDblueWaterfallActionFunc)(struct BgDblueWaterfall*, PlayState*); #define BGDBLUEWATERFALL_GET_7F(thisx) ((thisx)->params & 0x7F) #define BGDBLUEWATERFALL_GET_100(thisx) (((thisx)->params >> 8) & 1) diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c index c5757ad0dd..adeba93c8b 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c @@ -10,10 +10,10 @@ #define THIS ((BgDkjailIvy*)thisx) -void BgDkjailIvy_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDkjailIvy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDkjailIvy_Update(Actor* thisx, GlobalContext* globalCtx); -void BgDkjailIvy_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgDkjailIvy_Init(Actor* thisx, PlayState* play); +void BgDkjailIvy_Destroy(Actor* thisx, PlayState* play); +void BgDkjailIvy_Update(Actor* thisx, PlayState* play); +void BgDkjailIvy_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Dkjail_Ivy_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.h b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.h index 0c4d95bb60..e1bf883475 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.h +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.h @@ -5,7 +5,7 @@ struct BgDkjailIvy; -typedef void (*BgDkjailIvyActionFunc)(struct BgDkjailIvy*, GlobalContext*); +typedef void (*BgDkjailIvyActionFunc)(struct BgDkjailIvy*, PlayState*); typedef struct BgDkjailIvy { /* 0x0000 */ Actor actor; 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 4e9bf5c633..b1bdc822c8 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 @@ -10,20 +10,20 @@ #define THIS ((BgDyYoseizo*)thisx) -void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgDyYoseizo_Update(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 func_80A0AE1C(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B078(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B184(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B290(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B35C(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B500(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B5F0(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B75C(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0B8CC(BgDyYoseizo* this, GlobalContext* globalCtx); -void func_80A0BB08(BgDyYoseizo* this, GlobalContext* globalCtx); +void func_80A0AE1C(BgDyYoseizo* this, PlayState* play); +void func_80A0B078(BgDyYoseizo* this, PlayState* play); +void func_80A0B184(BgDyYoseizo* this, PlayState* play); +void func_80A0B290(BgDyYoseizo* this, PlayState* play); +void func_80A0B35C(BgDyYoseizo* this, PlayState* play); +void func_80A0B500(BgDyYoseizo* this, PlayState* play); +void func_80A0B5F0(BgDyYoseizo* this, PlayState* play); +void func_80A0B75C(BgDyYoseizo* this, PlayState* play); +void func_80A0B8CC(BgDyYoseizo* this, PlayState* play); +void func_80A0BB08(BgDyYoseizo* this, PlayState* play); #if 0 const ActorInit Bg_Dy_Yoseizo_InitVars = { 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 4a0e14d2fd..5d9d847490 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 @@ -5,7 +5,7 @@ struct BgDyYoseizo; -typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, GlobalContext*); +typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, PlayState*); typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index 1e8c369fbd..4d2a8632ec 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -11,20 +11,20 @@ #define THIS ((BgF40Block*)thisx) -void BgF40Block_Init(Actor* thisx, GlobalContext* globalCtx); -void BgF40Block_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgF40Block_Update(Actor* thisx, GlobalContext* globalCtx); -void BgF40Block_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgF40Block_Init(Actor* thisx, PlayState* play); +void BgF40Block_Destroy(Actor* thisx, PlayState* play); +void BgF40Block_Update(Actor* thisx, PlayState* play); +void BgF40Block_Draw(Actor* thisx, PlayState* play); -void func_80BC41AC(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC4228(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC4344(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC4380(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC43CC(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC4448(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC44F4(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC4530(BgF40Block* this, GlobalContext* globalCtx); -void func_80BC457C(BgF40Block* this, GlobalContext* globalCtx); +void func_80BC41AC(BgF40Block* this, PlayState* play); +void func_80BC4228(BgF40Block* this, PlayState* play); +void func_80BC4344(BgF40Block* this, PlayState* play); +void func_80BC4380(BgF40Block* this, PlayState* play); +void func_80BC43CC(BgF40Block* this, PlayState* play); +void func_80BC4448(BgF40Block* this, PlayState* play); +void func_80BC44F4(BgF40Block* this, PlayState* play); +void func_80BC4530(BgF40Block* this, PlayState* play); +void func_80BC457C(BgF40Block* this, PlayState* play); const ActorInit Bg_F40_Block_InitVars = { ACTOR_BG_F40_BLOCK, @@ -50,14 +50,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -s32 func_80BC3980(BgF40Block* this, GlobalContext* globalCtx) { +s32 func_80BC3980(BgF40Block* this, PlayState* play) { Vec3s* points; this->unk_160 = 0; this->unk_164 = 0; if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &globalCtx->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; if (this->path != NULL) { points = Lib_SegmentedToVirtual(this->path->points); @@ -72,14 +72,14 @@ s32 func_80BC3980(BgF40Block* this, GlobalContext* globalCtx) { return false; } -s32 func_80BC3A2C(BgF40Block* this, GlobalContext* globalCtx) { +s32 func_80BC3A2C(BgF40Block* this, PlayState* play) { Vec3s* points; this->unk_160 = this->path->count - 1; this->unk_164 = this->path->count - 1; if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &globalCtx->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; if (this->path != NULL) { points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_164; @@ -170,7 +170,7 @@ s32 func_80BC3CA4(BgF40Block* this) { return false; } -s32 func_80BC3D08(BgF40Block* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80BC3D08(BgF40Block* this, PlayState* play, s32 arg2) { CollisionPoly* sp54; Vec3f sp48; Vec3f sp3C; @@ -204,7 +204,7 @@ s32 func_80BC3D08(BgF40Block* this, GlobalContext* globalCtx, s32 arg2) { sp48.z = sp3C.z - (D_80BC4620[this->unk_168].z * this->dyna.actor.speedXZ * 1.5f); } - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, &sp48, &sp3C, &sp30, &sp54, true)) { + if (BgCheck_AnyLineTest1(&play->colCtx, &sp48, &sp3C, &sp30, &sp54, true)) { if (arg2 == 0) { this->dyna.actor.world.pos.x -= sp3C.x - sp30.x; this->dyna.actor.world.pos.y -= sp3C.y - sp30.y; @@ -224,28 +224,28 @@ void func_80BC4038(BgF40Block* this) { this->unk_168 = 6; } -void BgF40Block_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Block_Init(Actor* thisx, PlayState* play) { BgF40Block* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_f40_obj_Colheader_004640); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004640); if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &globalCtx->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; } else { this->path = NULL; } if (this->path != NULL) { - if (Flags_GetSwitch(globalCtx, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { this->actionFunc = func_80BC4530; this->dyna.actor.speedXZ = 40.0f; - func_80BC3A2C(this, globalCtx); + func_80BC3A2C(this, play); } else { this->actionFunc = func_80BC4380; this->dyna.actor.speedXZ = 20.0f; - func_80BC3980(this, globalCtx); + func_80BC3980(this, play); } } else { this->actionFunc = func_80BC457C; @@ -253,15 +253,15 @@ void BgF40Block_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_168 = 6; } -void BgF40Block_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Block_Destroy(Actor* thisx, PlayState* play) { BgF40Block* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80BC41AC(BgF40Block* this, GlobalContext* globalCtx) { - if (func_80BC3D08(this, globalCtx, 1)) { - if (!Flags_GetSwitch(globalCtx, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { +void func_80BC41AC(BgF40Block* this, PlayState* play) { + if (func_80BC3D08(this, play, 1)) { + if (!Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { func_80BC4038(this); this->actionFunc = func_80BC44F4; } @@ -270,7 +270,7 @@ void func_80BC41AC(BgF40Block* this, GlobalContext* globalCtx) { } } -void func_80BC4228(BgF40Block* this, GlobalContext* globalCtx) { +void func_80BC4228(BgF40Block* this, PlayState* play) { if (func_80BC3B00(this)) { this->dyna.actor.speedXZ = 20.0f; if (this->unk_160 < (this->path->count - 1)) { @@ -282,7 +282,7 @@ void func_80BC4228(BgF40Block* this, GlobalContext* globalCtx) { } } - if (func_80BC3D08(this, globalCtx, 0)) { + if (func_80BC3D08(this, play, 0)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->actionFunc = func_80BC41AC; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); @@ -307,21 +307,21 @@ void func_80BC4228(BgF40Block* this, GlobalContext* globalCtx) { } } -void func_80BC4344(BgF40Block* this, GlobalContext* globalCtx) { +void func_80BC4344(BgF40Block* this, PlayState* play) { if (func_80BC3CA4(this)) { this->actionFunc = func_80BC4228; } } -void func_80BC4380(BgF40Block* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { +void func_80BC4380(BgF40Block* this, PlayState* play) { + if (Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { this->actionFunc = func_80BC4344; } } -void func_80BC43CC(BgF40Block* this, GlobalContext* globalCtx) { - if (func_80BC3D08(this, globalCtx, 1)) { - if (Flags_GetSwitch(globalCtx, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { +void func_80BC43CC(BgF40Block* this, PlayState* play) { + if (func_80BC3D08(this, play, 1)) { + if (Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { func_80BC4038(this); this->actionFunc = func_80BC4344; } @@ -330,7 +330,7 @@ void func_80BC43CC(BgF40Block* this, GlobalContext* globalCtx) { } } -void func_80BC4448(BgF40Block* this, GlobalContext* globalCtx) { +void func_80BC4448(BgF40Block* this, PlayState* play) { if (func_80BC3B00(this)) { this->dyna.actor.speedXZ = 40.0f; if (this->unk_160 > 0) { @@ -342,36 +342,36 @@ void func_80BC4448(BgF40Block* this, GlobalContext* globalCtx) { } } - if (func_80BC3D08(this, globalCtx, 0)) { + if (func_80BC3D08(this, play, 0)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->actionFunc = func_80BC43CC; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); } } -void func_80BC44F4(BgF40Block* this, GlobalContext* globalCtx) { +void func_80BC44F4(BgF40Block* this, PlayState* play) { if (func_80BC3CA4(this)) { this->actionFunc = func_80BC4448; } } -void func_80BC4530(BgF40Block* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { +void func_80BC4530(BgF40Block* this, PlayState* play) { + if (!Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { this->actionFunc = func_80BC44F4; } } -void func_80BC457C(BgF40Block* this, GlobalContext* globalCtx) { +void func_80BC457C(BgF40Block* this, PlayState* play) { } -void BgF40Block_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Block_Update(Actor* thisx, PlayState* play) { BgF40Block* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Math_Vec3f_Copy(&this->dyna.actor.focus.pos, &this->dyna.actor.world.pos); } -void BgF40Block_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_f40_obj_DL_0043D0); +void BgF40Block_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_f40_obj_DL_0043D0); } diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h index cf9dfb03b6..66c6e00c09 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h @@ -5,7 +5,7 @@ struct BgF40Block; -typedef void (*BgF40BlockActionFunc)(struct BgF40Block*, GlobalContext*); +typedef void (*BgF40BlockActionFunc)(struct BgF40Block*, PlayState*); #define BGF40BLOCK_GET_PATH(thisx) (((thisx)->params & 0x1FC) >> 2) #define BGF40BLOCK_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c index 7805a6e546..4e323cbf92 100644 --- a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c +++ b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c @@ -10,10 +10,10 @@ #define THIS ((BgF40Flift*)thisx) -void BgF40Flift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgF40Flift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgF40Flift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgF40Flift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgF40Flift_Init(Actor* thisx, PlayState* play); +void BgF40Flift_Destroy(Actor* thisx, PlayState* play); +void BgF40Flift_Update(Actor* thisx, PlayState* play); +void BgF40Flift_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_F40_Flift_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.h b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.h index ca0a56d910..5aa6b46602 100644 --- a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.h +++ b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.h @@ -5,7 +5,7 @@ struct BgF40Flift; -typedef void (*BgF40FliftActionFunc)(struct BgF40Flift*, GlobalContext*); +typedef void (*BgF40FliftActionFunc)(struct BgF40Flift*, PlayState*); typedef struct BgF40Flift { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c index 5278a4b738..d615bd36dd 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c @@ -11,17 +11,17 @@ #define THIS ((BgF40Switch*)thisx) -void BgF40Switch_Init(Actor* thisx, GlobalContext* globalCtx); -void BgF40Switch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgF40Switch_Update(Actor* thisx, GlobalContext* globalCtx); -void BgF40Switch_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgF40Switch_Init(Actor* thisx, PlayState* play); +void BgF40Switch_Destroy(Actor* thisx, PlayState* play); +void BgF40Switch_Update(Actor* thisx, PlayState* play); +void BgF40Switch_Draw(Actor* thisx, PlayState* play); -void BgF40Switch_CheckAll(BgF40Switch* this, GlobalContext* globalCtx); -void BgF40Switch_Unpress(BgF40Switch* this, GlobalContext* globalCtx); -void BgF40Switch_IdlePressed(BgF40Switch* this, GlobalContext* globalCtx); -void BgF40Switch_Press(BgF40Switch* this, GlobalContext* globalCtx); -void BgF40Switch_WaitToPress(BgF40Switch* this, GlobalContext* globalCtx); -void BgF40Switch_IdleUnpressed(BgF40Switch* this, GlobalContext* globalCtx); +void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play); +void BgF40Switch_Unpress(BgF40Switch* this, PlayState* play); +void BgF40Switch_IdlePressed(BgF40Switch* this, PlayState* play); +void BgF40Switch_Press(BgF40Switch* this, PlayState* play); +void BgF40Switch_WaitToPress(BgF40Switch* this, PlayState* play); +void BgF40Switch_IdleUnpressed(BgF40Switch* this, PlayState* play); const ActorInit Bg_F40_Switch_InitVars = { ACTOR_BG_F40_SWITCH, @@ -41,17 +41,17 @@ u32 sBgF40SwitchLastUpdateFrame; /* * Updates all instances of this actor in the current room, unless it's already been called this frame. */ -void BgF40Switch_CheckAll(BgF40Switch* this, GlobalContext* globalCtx) { - if (globalCtx->gameplayFrames != sBgF40SwitchLastUpdateFrame) { +void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play) { + if (play->gameplayFrames != sBgF40SwitchLastUpdateFrame) { u32 pressedSwitchFlags[4] = { 0 }; u32 pad; s32 switchFlag; s32 isPressed; Actor* actor; BgF40Switch* actorAsSwitch; - u32 inCsMode = Player_InCsMode(&globalCtx->state); + u32 inCsMode = Player_InCsMode(&play->state); - for (actor = globalCtx->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { + for (actor = play->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { if (actor->id == ACTOR_BG_F40_SWITCH && actor->room == this->dyna.actor.room && actor->update != NULL) { actorAsSwitch = (BgF40Switch*)actor; actorAsSwitch->wasPressed = actorAsSwitch->isPressed; @@ -77,23 +77,23 @@ void BgF40Switch_CheckAll(BgF40Switch* this, GlobalContext* globalCtx) { if (switchFlag >= 0 && switchFlag < 0x80) { pressedSwitchFlags[(switchFlag & ~0x1F) >> 5] |= 1 << (switchFlag & 0x1F); if (!actorAsSwitch->wasPressed && actorAsSwitch->actionFunc == BgF40Switch_IdleUnpressed && - !Flags_GetSwitch(globalCtx, switchFlag)) { + !Flags_GetSwitch(play, switchFlag)) { actorAsSwitch->isInitiator = true; } } } } } - for (actor = globalCtx->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { + for (actor = play->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { if (actor->id == ACTOR_BG_F40_SWITCH && actor->room == this->dyna.actor.room && actor->update != 0) { switchFlag = BGF40SWITCH_GET_SWITCHFLAG(actor); - if (switchFlag >= 0 && switchFlag < 0x80 && Flags_GetSwitch(globalCtx, switchFlag) && + if (switchFlag >= 0 && switchFlag < 0x80 && Flags_GetSwitch(play, switchFlag) && !(pressedSwitchFlags[(switchFlag & ~0x1F) >> 5] & (1 << (switchFlag & 0x1F)))) { - Flags_UnsetSwitch(globalCtx, switchFlag); + Flags_UnsetSwitch(play, switchFlag); } } } - sBgF40SwitchLastUpdateFrame = globalCtx->gameplayFrames; + sBgF40SwitchLastUpdateFrame = play->gameplayFrames; } } @@ -104,7 +104,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 123, ICHAIN_STOP), }; -void BgF40Switch_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Switch_Init(Actor* thisx, PlayState* play) { BgF40Switch* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -112,20 +112,20 @@ void BgF40Switch_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgF40Switch_IdleUnpressed; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 1.0f; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_f40_switch_Colheader_000118); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_switch_Colheader_000118); if (!sBgF40SwitchGlobalsInitialized) { - sBgF40SwitchLastUpdateFrame = globalCtx->gameplayFrames; + sBgF40SwitchLastUpdateFrame = play->gameplayFrames; sBgF40SwitchGlobalsInitialized = true; } } -void BgF40Switch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Switch_Destroy(Actor* thisx, PlayState* play) { BgF40Switch* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgF40Switch_Unpress(BgF40Switch* this, GlobalContext* globalCtx) { +void BgF40Switch_Unpress(BgF40Switch* this, PlayState* play) { this->dyna.actor.scale.y += 0.0495f; if (this->dyna.actor.scale.y >= 0.165f) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); @@ -134,13 +134,13 @@ void BgF40Switch_Unpress(BgF40Switch* this, GlobalContext* globalCtx) { } } -void BgF40Switch_IdlePressed(BgF40Switch* this, GlobalContext* globalCtx) { +void BgF40Switch_IdlePressed(BgF40Switch* this, PlayState* play) { if (!this->isPressed) { this->actionFunc = BgF40Switch_Unpress; } } -void BgF40Switch_Press(BgF40Switch* this, GlobalContext* globalCtx) { +void BgF40Switch_Press(BgF40Switch* this, PlayState* play) { this->dyna.actor.scale.y -= 0.0495f; if (this->dyna.actor.scale.y <= 0.0165f) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); @@ -155,39 +155,39 @@ void BgF40Switch_Press(BgF40Switch* this, GlobalContext* globalCtx) { } } -void BgF40Switch_WaitToPress(BgF40Switch* this, GlobalContext* globalCtx) { +void BgF40Switch_WaitToPress(BgF40Switch* this, PlayState* play) { if (!this->isInitiator || this->dyna.actor.cutscene == -1) { this->actionFunc = BgF40Switch_Press; if (this->isInitiator) { - Flags_SetSwitch(globalCtx, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); this->actionFunc = BgF40Switch_Press; if (this->isInitiator) { - Flags_SetSwitch(globalCtx, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); } } -void BgF40Switch_IdleUnpressed(BgF40Switch* this, GlobalContext* globalCtx) { +void BgF40Switch_IdleUnpressed(BgF40Switch* this, PlayState* play) { if (this->isPressed) { this->actionFunc = BgF40Switch_WaitToPress; } } -void BgF40Switch_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Switch_Update(Actor* thisx, PlayState* play) { BgF40Switch* this = THIS; - BgF40Switch_CheckAll(this, globalCtx); - this->actionFunc(this, globalCtx); + BgF40Switch_CheckAll(this, play); + this->actionFunc(this, play); } -void BgF40Switch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgF40Switch_Draw(Actor* thisx, PlayState* play) { BgF40Switch* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_f40_switch_DL_000438); - Gfx_DrawDListOpa(globalCtx, object_f40_switch_DL_000390); + Gfx_DrawDListOpa(play, object_f40_switch_DL_000438); + Gfx_DrawDListOpa(play, object_f40_switch_DL_000390); } diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.h b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.h index 8d4e64603f..672a3132ed 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.h +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.h @@ -7,7 +7,7 @@ struct BgF40Switch; #define BGF40SWITCH_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFE00) >> 9) -typedef void (*BgF40SwitchActionFunc)(struct BgF40Switch*, GlobalContext*); +typedef void (*BgF40SwitchActionFunc)(struct BgF40Switch*, PlayState*); typedef struct BgF40Switch { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c index 9d84f191c4..16b39cdd3c 100644 --- a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c +++ b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c @@ -10,10 +10,10 @@ #define THIS ((BgF40Swlift*)thisx) -void BgF40Swlift_Init(Actor* thisx, GlobalContext* globalCtx); -void BgF40Swlift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgF40Swlift_Update(Actor* thisx, GlobalContext* globalCtx); -void BgF40Swlift_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgF40Swlift_Init(Actor* thisx, PlayState* play); +void BgF40Swlift_Destroy(Actor* thisx, PlayState* play); +void BgF40Swlift_Update(Actor* thisx, PlayState* play); +void BgF40Swlift_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_F40_Swlift_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c index 1f959e8271..9e87d66bb4 100644 --- a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c +++ b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c @@ -10,14 +10,14 @@ #define THIS ((BgFireWall*)thisx) -void BgFireWall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgFireWall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgFireWall_Update(Actor* thisx, GlobalContext* globalCtx); +void BgFireWall_Init(Actor* thisx, PlayState* play); +void BgFireWall_Destroy(Actor* thisx, PlayState* play); +void BgFireWall_Update(Actor* thisx, PlayState* play); -void func_809AC638(BgFireWall* this, GlobalContext* globalCtx); -void func_809AC68C(BgFireWall* this, GlobalContext* globalCtx); -void func_809AC6C0(BgFireWall* this, GlobalContext* globalCtx); -void func_809AC970(BgFireWall* this, GlobalContext* globalCtx); +void func_809AC638(BgFireWall* this, PlayState* play); +void func_809AC68C(BgFireWall* this, PlayState* play); +void func_809AC6C0(BgFireWall* this, PlayState* play); +void func_809AC970(BgFireWall* this, PlayState* play); #if 0 const ActorInit Bg_Fire_Wall_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h index b4d176d9e9..d1d21f303d 100644 --- a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h +++ b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h @@ -5,7 +5,7 @@ struct BgFireWall; -typedef void (*BgFireWallActionFunc)(struct BgFireWall*, GlobalContext*); +typedef void (*BgFireWallActionFunc)(struct BgFireWall*, PlayState*); typedef struct BgFireWall { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c index 307d0fd0a3..a98025524c 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c @@ -11,10 +11,10 @@ #define THIS ((BgFuKaiten*)thisx) -void BgFuKaiten_Init(Actor* thisx, GlobalContext* globalCtx); -void BgFuKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgFuKaiten_Update(Actor* thisx, GlobalContext* globalCtx); -void BgFuKaiten_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgFuKaiten_Init(Actor* thisx, PlayState* play); +void BgFuKaiten_Destroy(Actor* thisx, PlayState* play); +void BgFuKaiten_Update(Actor* thisx, PlayState* play); +void BgFuKaiten_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Fu_Kaiten_InitVars = { ACTOR_BG_FU_KAITEN, @@ -28,7 +28,7 @@ const ActorInit Bg_Fu_Kaiten_InitVars = { (ActorFunc)BgFuKaiten_Draw, }; -void BgFuKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgFuKaiten_Init(Actor* thisx, PlayState* play) { s32 pad; BgFuKaiten* this = THIS; CollisionHeader* header = NULL; @@ -36,7 +36,7 @@ void BgFuKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(thisx, 1.0); DynaPolyActor_Init(&this->dyna, 3); CollisionHeader_GetVirtual(&object_fu_kaiten_Colheader_002D30, &header); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, header); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, header); this->bounceHeight = 0.0; this->rotationSpeed = 0; @@ -44,10 +44,10 @@ void BgFuKaiten_Init(Actor* thisx, GlobalContext* globalCtx) { this->bounce = 0; } -void BgFuKaiten_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgFuKaiten_Destroy(Actor* thisx, PlayState* play) { BgFuKaiten* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgFuKaiten_UpdateRotation(BgFuKaiten* this) { @@ -67,19 +67,19 @@ void BgFuKaiten_UpdateHeight(BgFuKaiten* this) { this->dyna.actor.world.pos.y -= this->bounceHeight * Math_CosS(this->bounce); } -void BgFuKaiten_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgFuKaiten_Update(Actor* thisx, PlayState* play) { BgFuKaiten* this = THIS; BgFuKaiten_UpdateRotation(this); BgFuKaiten_UpdateHeight(this); } -void BgFuKaiten_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgFuKaiten_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_fu_kaiten_DL_0005D0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c index a8d54222d8..2681d9292f 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c +++ b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c @@ -10,10 +10,10 @@ #define THIS ((BgFuMizu*)thisx) -void BgFuMizu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgFuMizu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgFuMizu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgFuMizu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgFuMizu_Init(Actor* thisx, PlayState* play); +void BgFuMizu_Destroy(Actor* thisx, PlayState* play); +void BgFuMizu_Update(Actor* thisx, PlayState* play); +void BgFuMizu_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Fu_Mizu_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index aae5930ed6..fbae48df28 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -11,17 +11,17 @@ #define THIS ((BgGoronOyu*)thisx) -void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgGoronOyu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgGoronOyu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgGoronOyu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgGoronOyu_Init(Actor* thisx, PlayState* play); +void BgGoronOyu_Destroy(Actor* thisx, PlayState* play); +void BgGoronOyu_Update(Actor* thisx, PlayState* play); +void BgGoronOyu_Draw(Actor* thisx, PlayState* play); -void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx); -void func_80B400C8(BgGoronOyu* this, GlobalContext* globalCtx); -void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx); -void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx); -void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx); -void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx); +void func_80B40100(BgGoronOyu* this, PlayState* play); +void func_80B400C8(BgGoronOyu* this, PlayState* play); +void func_80B401F8(BgGoronOyu* this, PlayState* play); +void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, PlayState* play); +void BgGoronOyu_SpawnEffects(BgGoronOyu* this, PlayState* play); +void func_80B40160(BgGoronOyu* this, PlayState* play); const ActorInit Bg_Goron_Oyu_InitVars = { ACTOR_BG_GORON_OYU, @@ -47,12 +47,12 @@ void func_80B4009C(BgGoronOyu* this) { this->unk_164 = 20.0f; } -void func_80B400C8(BgGoronOyu* this, GlobalContext* globalCtx) { - BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); - func_80B401F8(this, globalCtx); +void func_80B400C8(BgGoronOyu* this, PlayState* play) { + BgGoronOyu_UpdateWaterBoxInfo(this, play); + func_80B401F8(this, play); } -void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx) { +void func_80B40100(BgGoronOyu* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->initialActorCutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->initialActorCutscene, &this->dyna.actor); this->actionFunc = func_80B40160; @@ -61,12 +61,12 @@ void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx) { } } -void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx) { +void func_80B40160(BgGoronOyu* this, PlayState* play) { static Vec3f D_80B40780 = { 0, 0, 0 }; Math_StepToF(&this->unk_164, 0.0f, 0.2f); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - this->unk_164; - BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); + BgGoronOyu_UpdateWaterBoxInfo(this, play); if (this->unk_164 <= 0.0f) { ActorCutscene_Stop(this->initialActorCutscene); @@ -77,45 +77,45 @@ void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx) { Audio_PlaySfxAtPos(&D_80B40780, NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG); } -void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx) { +void func_80B401F8(BgGoronOyu* this, PlayState* play) { Player* player; Vec3f dist; - if (Actor_HasParent(&this->dyna.actor, globalCtx)) { + if (Actor_HasParent(&this->dyna.actor, play)) { this->dyna.actor.parent = NULL; return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_Vec3f_DistXYZAndStoreDiff(&this->waterBoxPos, &player->actor.world.pos, &dist); if (dist.x >= 0.0f && dist.x <= this->waterBoxXLength && dist.z >= 0.0f && dist.z <= this->waterBoxZLength && fabsf(dist.y) < 100.0f && player->actor.depthInWater > 12.0f) { - Actor_PickUp(&this->dyna.actor, globalCtx, GI_MAX, this->dyna.actor.xzDistToPlayer, + Actor_PickUp(&this->dyna.actor, play, GI_MAX, this->dyna.actor.xzDistToPlayer, fabsf(this->dyna.actor.playerHeightRel)); } } -void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx) { +void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, PlayState* play) { WaterBox* waterBox; f32 ySurface; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, - &ySurface, &waterBox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &ySurface, + &waterBox)) { Math_Vec3s_ToVec3f(&this->waterBoxPos, &waterBox->minPos); this->waterBoxXLength = waterBox->xLength; this->waterBoxZLength = waterBox->zLength; } } -void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx) { +void BgGoronOyu_SpawnEffects(BgGoronOyu* this, PlayState* play) { s16 scale; Vec3f pos1; Vec3f pos2; CollisionPoly* poly; s32 pad; - if ((globalCtx->state.frames % 4) == 0) { + if ((play->state.frames % 4) == 0) { Vec3f vel1; Vec3f vel2; @@ -127,9 +127,9 @@ void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx) { vel1.z = 0.0f; scale = -200 - (s32)(Rand_ZeroOne() * 50.0f); - if (BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos1) < this->waterBoxPos.y) { + if (BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos1) < this->waterBoxPos.y) { pos1.y = this->waterBoxPos.y + 10.0f; - EffectSsIceSmoke_Spawn(globalCtx, &pos1, &vel1, &gZeroVec3f, scale); + EffectSsIceSmoke_Spawn(play, &pos1, &vel1, &gZeroVec3f, scale); } pos2.x = (Rand_ZeroOne() * this->waterBoxXLength) + this->waterBoxPos.x; pos2.y = this->waterBoxPos.y + 100.0f; @@ -139,14 +139,14 @@ void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx) { vel2.z = 0.0f; scale = -200 - (s32)(Rand_ZeroOne() * 50.0f); - if (BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos2) < this->waterBoxPos.y) { + if (BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos2) < this->waterBoxPos.y) { pos2.y = this->waterBoxPos.y + 10.0f; - EffectSsIceSmoke_Spawn(globalCtx, &pos2, &vel2, &gZeroVec3f, scale); + EffectSsIceSmoke_Spawn(play, &pos2, &vel2, &gZeroVec3f, scale); } } } -void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgGoronOyu_Init(Actor* thisx, PlayState* play) { s32 pad; BgGoronOyu* this = THIS; CollisionHeader* colHeader = NULL; @@ -155,9 +155,9 @@ void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_oyu_Colheader_000988, &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); - BgGoronOyu_UpdateWaterBoxInfo(this, globalCtx); + BgGoronOyu_UpdateWaterBoxInfo(this, play); if (thisx->params != 0) { thisx->world.pos.y = thisx->home.pos.y; @@ -168,25 +168,25 @@ void BgGoronOyu_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgGoronOyu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgGoronOyu_Destroy(Actor* thisx, PlayState* play) { BgGoronOyu* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgGoronOyu_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgGoronOyu_Update(Actor* thisx, PlayState* play) { BgGoronOyu* this = THIS; - this->actionFunc(this, globalCtx); - BgGoronOyu_SpawnEffects(this, globalCtx); + this->actionFunc(this, play); + BgGoronOyu_SpawnEffects(this, play); } -void BgGoronOyu_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_oyu_Matanimheader_000968)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +void BgGoronOyu_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_oyu_Matanimheader_000968)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &object_oyu_DL_000158); gSPDisplayList(POLY_XLU_DISP++, &object_oyu_DL_000080); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h index dba8bb044a..d17ff87b3d 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h @@ -5,7 +5,7 @@ struct BgGoronOyu; -typedef void (*BgGoronOyuActionFunc)(struct BgGoronOyu*, GlobalContext*); +typedef void (*BgGoronOyuActionFunc)(struct BgGoronOyu*, PlayState*); typedef struct BgGoronOyu { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c index 3c535326e3..af246eafe4 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c @@ -10,10 +10,10 @@ #define THIS ((BgHakaBombwall*)thisx) -void BgHakaBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaBombwall_Init(Actor* thisx, PlayState* play); +void BgHakaBombwall_Destroy(Actor* thisx, PlayState* play); +void BgHakaBombwall_Update(Actor* thisx, PlayState* play); +void BgHakaBombwall_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Haka_Bombwall_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h index 10ec6e0574..aef2e5aafc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h @@ -5,7 +5,7 @@ struct BgHakaBombwall; -typedef void (*BgHakaBombwallActionFunc)(struct BgHakaBombwall*, GlobalContext*); +typedef void (*BgHakaBombwallActionFunc)(struct BgHakaBombwall*, PlayState*); typedef struct BgHakaBombwall { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c index 576388d5c8..cc90ccd947 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c +++ b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c @@ -11,19 +11,19 @@ #define THIS ((BgHakaCurtain*)thisx) -void BgHakaCurtain_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaCurtain_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaCurtain_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaCurtain_Init(Actor* thisx, PlayState* play); +void BgHakaCurtain_Destroy(Actor* thisx, PlayState* play); +void BgHakaCurtain_Update(Actor* thisx, PlayState* play); +void BgHakaCurtain_Draw(Actor* thisx, PlayState* play); void func_80B6DC98(BgHakaCurtain* this); -void func_80B6DCAC(BgHakaCurtain* this, GlobalContext* globalCtx); +void func_80B6DCAC(BgHakaCurtain* this, PlayState* play); void func_80B6DCEC(BgHakaCurtain* this); -void func_80B6DD00(BgHakaCurtain* this, GlobalContext* globalCtx); +void func_80B6DD00(BgHakaCurtain* this, PlayState* play); void func_80B6DD5C(BgHakaCurtain* this); -void func_80B6DD70(BgHakaCurtain* this, GlobalContext* globalCtx); -void func_80B6DD9C(BgHakaCurtain* this, GlobalContext* globalCtx); -void func_80B6DEA8(BgHakaCurtain* this, GlobalContext* globalCtx); +void func_80B6DD70(BgHakaCurtain* this, PlayState* play); +void func_80B6DD9C(BgHakaCurtain* this, PlayState* play); +void func_80B6DEA8(BgHakaCurtain* this, PlayState* play); void func_80B6DE80(BgHakaCurtain* this); const ActorInit Bg_Haka_Curtain_InitVars = { @@ -45,31 +45,31 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgHakaCurtain_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaCurtain_Init(Actor* thisx, PlayState* play) { BgHakaCurtain* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_haka_obj_Colheader_001588); - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_001588); + if (Flags_GetClear(play, this->dyna.actor.room)) { func_80B6DE80(this); return; } func_80B6DC98(this); } -void BgHakaCurtain_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaCurtain_Destroy(Actor* thisx, PlayState* play) { BgHakaCurtain* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B6DC98(BgHakaCurtain* this) { this->actionFunc = func_80B6DCAC; } -void func_80B6DCAC(BgHakaCurtain* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { +void func_80B6DCAC(BgHakaCurtain* this, PlayState* play) { + if (Flags_GetClear(play, this->dyna.actor.room)) { func_80B6DCEC(this); } } @@ -78,7 +78,7 @@ void func_80B6DCEC(BgHakaCurtain* this) { this->actionFunc = func_80B6DD00; } -void func_80B6DD00(BgHakaCurtain* this, GlobalContext* globalCtx) { +void func_80B6DD00(BgHakaCurtain* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); func_80B6DD5C(this); @@ -91,7 +91,7 @@ void func_80B6DD5C(BgHakaCurtain* this) { this->actionFunc = func_80B6DD70; } -void func_80B6DD70(BgHakaCurtain* this, GlobalContext* globalCtx) { +void func_80B6DD70(BgHakaCurtain* this, PlayState* play) { } void func_80B6DD80(BgHakaCurtain* this) { @@ -99,7 +99,7 @@ void func_80B6DD80(BgHakaCurtain* this) { this->dyna.actor.velocity.y = 0.0f; } -void func_80B6DD9C(BgHakaCurtain* this, GlobalContext* globalCtx) { +void func_80B6DD9C(BgHakaCurtain* this, PlayState* play) { if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y + 150.0f - 30.0f) { Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.12f); } else { @@ -118,22 +118,22 @@ void func_80B6DE80(BgHakaCurtain* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 150.0f; } -void func_80B6DEA8(BgHakaCurtain* this, GlobalContext* globalCtx) { +void func_80B6DEA8(BgHakaCurtain* this, PlayState* play) { } -void BgHakaCurtain_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaCurtain_Update(Actor* thisx, PlayState* play) { BgHakaCurtain* this = THIS; CsCmdActorAction* actorAction; - if (Cutscene_CheckActorAction(globalCtx, 469)) { - actorAction = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 469)]; - if (actorAction->startFrame == globalCtx->csCtx.frames && actorAction->action == 2) { + if (Cutscene_CheckActorAction(play, 469)) { + actorAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 469)]; + if (actorAction->startFrame == play->csCtx.frames && actorAction->action == 2) { func_80B6DD80(this); } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakaCurtain_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_haka_obj_DL_001410); +void BgHakaCurtain_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_haka_obj_DL_001410); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.h b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.h index f227e5c984..4b5e564b28 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.h +++ b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.h @@ -5,7 +5,7 @@ struct BgHakaCurtain; -typedef void (*BgHakaCurtainActionFunc)(struct BgHakaCurtain*, GlobalContext*); +typedef void (*BgHakaCurtainActionFunc)(struct BgHakaCurtain*, PlayState*); typedef struct BgHakaCurtain { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c index 6985878fe9..8d48168a6a 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c @@ -11,17 +11,17 @@ #define THIS ((BgHakaTomb*)thisx) -void BgHakaTomb_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTomb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTomb_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakaTomb_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakaTomb_Init(Actor* thisx, PlayState* play); +void BgHakaTomb_Destroy(Actor* thisx, PlayState* play); +void BgHakaTomb_Update(Actor* thisx, PlayState* play); +void BgHakaTomb_Draw(Actor* thisx, PlayState* play); void func_80BD6624(BgHakaTomb* this); -void func_80BD66AC(BgHakaTomb* this, GlobalContext* globalCtx); +void func_80BD66AC(BgHakaTomb* this, PlayState* play); void func_80BD6754(BgHakaTomb* this); -void func_80BD6768(BgHakaTomb* this, GlobalContext* globalCtx); +void func_80BD6768(BgHakaTomb* this, PlayState* play); void BgHakaTomb_SetupDoNothing(BgHakaTomb* this); -void BgHakaTomb_DoNothing(BgHakaTomb* this, GlobalContext* globalCtx); +void BgHakaTomb_DoNothing(BgHakaTomb* this, PlayState* play); const ActorInit Bg_Haka_Tomb_InitVars = { ACTOR_BG_HAKA_TOMB, @@ -41,20 +41,20 @@ static InitChainEntry sInitChain[] = { static Vec3f D_80BD68A4 = { 30.0f, 90.0f, 0.0f }; -void BgHakaTomb_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTomb_Init(Actor* thisx, PlayState* play) { BgHakaTomb* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_haka_obj_Colheader_000EE8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000EE8); SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); func_80BD6624(this); } -void BgHakaTomb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTomb_Destroy(Actor* thisx, PlayState* play) { BgHakaTomb* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80BD6624(BgHakaTomb* this) { @@ -79,13 +79,13 @@ s32 func_80BD6638(s16* arg0, s16* arg1, s32 arg2) { return retVal; } -void func_80BD66AC(BgHakaTomb* this, GlobalContext* globalCtx) { +void func_80BD66AC(BgHakaTomb* this, PlayState* play) { s16 temp; - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - if (!func_80BD6638(&temp, this->cutscenes, 1) && (temp < 0) && Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (!func_80BD6638(&temp, this->cutscenes, 1) && (temp < 0) && Flags_GetClear(play, this->dyna.actor.room)) { this->dyna.actor.flags |= ACTOR_FLAG_1; if (this->dyna.actor.isTargeted) { func_80BD6754(this); @@ -99,7 +99,7 @@ void func_80BD6754(BgHakaTomb* this) { this->actionFunc = func_80BD6768; } -void func_80BD6768(BgHakaTomb* this, GlobalContext* globalCtx) { +void func_80BD6768(BgHakaTomb* this, PlayState* play) { if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { BgHakaTomb_SetupDoNothing(this); } @@ -109,15 +109,15 @@ void BgHakaTomb_SetupDoNothing(BgHakaTomb* this) { this->actionFunc = BgHakaTomb_DoNothing; } -void BgHakaTomb_DoNothing(BgHakaTomb* this, GlobalContext* globalCtx) { +void BgHakaTomb_DoNothing(BgHakaTomb* this, PlayState* play) { } -void BgHakaTomb_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakaTomb_Update(Actor* thisx, PlayState* play) { BgHakaTomb* this = THIS; s32 pad; Vec3f vec; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_NEW); Matrix_RotateXS(this->dyna.actor.world.rot.x, MTXMODE_APPLY); Matrix_RotateZS(this->dyna.actor.world.rot.z, MTXMODE_APPLY); @@ -125,6 +125,6 @@ void BgHakaTomb_Update(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->dyna.actor.world.pos, &vec, &this->dyna.actor.focus.pos); } -void BgHakaTomb_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_haka_obj_DL_0007B0); +void BgHakaTomb_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_haka_obj_DL_0007B0); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h index 51a024077e..c1cefddc8b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h @@ -5,7 +5,7 @@ struct BgHakaTomb; -typedef void (*BgHakaTombActionFunc)(struct BgHakaTomb*, GlobalContext*); +typedef void (*BgHakaTombActionFunc)(struct BgHakaTomb*, PlayState*); typedef struct BgHakaTomb { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c index 1103c6d815..c856edb3af 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c @@ -11,20 +11,20 @@ #define THIS ((BgHakuginBombwall*)thisx) -void BgHakuginBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakuginBombwall_Init(Actor* thisx, PlayState* play); +void BgHakuginBombwall_Destroy(Actor* thisx, PlayState* play); +void BgHakuginBombwall_Update(Actor* thisx, PlayState* play); +void BgHakuginBombwall_Draw(Actor* thisx, PlayState* play); -void func_80ABBFC0(BgHakuginBombwall* this, GlobalContext* globalCtx); -void func_80ABC2E0(BgHakuginBombwall* this, GlobalContext* globalCtx); -void func_80ABC58C(BgHakuginBombwall* this, GlobalContext* globalCtx); -void func_80ABC7FC(BgHakuginBombwall* this, GlobalContext* globalCtx); -s32 func_80ABCB5C(Actor* thisx, GlobalContext* globalCtx); -s32 func_80ABCC00(Actor* thisx, GlobalContext* globalCtx); -void func_80ABCCE4(BgHakuginBombwall* this, GlobalContext* globalCtx); -void func_80ABCD98(BgHakuginBombwall* this, GlobalContext* globalCtx); -void func_80ABCE60(BgHakuginBombwall* this, GlobalContext* globalCtx); +void func_80ABBFC0(BgHakuginBombwall* this, PlayState* play); +void func_80ABC2E0(BgHakuginBombwall* this, PlayState* play); +void func_80ABC58C(BgHakuginBombwall* this, PlayState* play); +void func_80ABC7FC(BgHakuginBombwall* this, PlayState* play); +s32 func_80ABCB5C(Actor* thisx, PlayState* play); +s32 func_80ABCC00(Actor* thisx, PlayState* play); +void func_80ABCCE4(BgHakuginBombwall* this, PlayState* play); +void func_80ABCD98(BgHakuginBombwall* this, PlayState* play); +void func_80ABCE60(BgHakuginBombwall* this, PlayState* play); const ActorInit Bg_Hakugin_Bombwall_InitVars = { ACTOR_BG_HAKUGIN_BOMBWALL, @@ -121,7 +121,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void func_80ABBFC0(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABBFC0(BgHakuginBombwall* this, PlayState* play) { f32 temp; Vec3f spF0; Vec3f spE4; @@ -162,20 +162,19 @@ void func_80ABBFC0(BgHakuginBombwall* this, GlobalContext* globalCtx) { if ((s32)Rand_Next() > 0) { phi_s0 |= 1; phi_s1 = 1; - func_800B0E48(globalCtx, &spF0, &gZeroVec3f, &D_80ABCFB4, &D_80ABCFAC, &D_80ABCFB0, + func_800B0E48(play, &spF0, &gZeroVec3f, &D_80ABCFB4, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1B) + 70, (Rand_Next() >> 0x1A) + 60); } else { phi_s1 = 0; } - EffectSsKakera_Spawn(globalCtx, &spF0, &spE4, &spF0, -550, phi_s0, 30, 0, 0, - (s32)(Rand_ZeroOne() * 22.0f) + 5, phi_s1, 0, 50, -1, OBJECT_HAKUGIN_OBJ, - object_hakugin_obj_DL_009830); + EffectSsKakera_Spawn(play, &spF0, &spE4, &spF0, -550, phi_s0, 30, 0, 0, (s32)(Rand_ZeroOne() * 22.0f) + 5, + phi_s1, 0, 50, -1, OBJECT_HAKUGIN_OBJ, object_hakugin_obj_DL_009830); } } } -void func_80ABC2E0(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABC2E0(BgHakuginBombwall* this, PlayState* play) { s32 pad; s32 i; s16 phi_s2; @@ -219,17 +218,17 @@ void func_80ABC2E0(BgHakuginBombwall* this, GlobalContext* globalCtx) { phi_t0 = -400; } - EffectSsKakera_Spawn(globalCtx, &spC8, &spBC, &spC8, phi_t0, phi_v0, 30, 0, 0, temp_s1, phi_v1, 0, 50, -1, + EffectSsKakera_Spawn(play, &spC8, &spBC, &spC8, phi_t0, phi_v0, 30, 0, 0, temp_s1, phi_v1, 0, 50, -1, OBJECT_HAKUGIN_OBJ, object_hakugin_obj_DL_009830); if ((i & 1) == 0) { - func_800B0E48(globalCtx, &spC8, &D_80ABD034, &D_80ABCFB4, &D_80ABCFAC, &D_80ABCFB0, - (Rand_Next() >> 0x1B) + 60, (Rand_Next() >> 0x1A) + 50); + func_800B0E48(play, &spC8, &D_80ABD034, &D_80ABCFB4, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1B) + 60, + (Rand_Next() >> 0x1A) + 50); } } } -void func_80ABC58C(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABC58C(BgHakuginBombwall* this, PlayState* play) { s32 pad; Vec3f spD8; Vec3f spCC; @@ -269,12 +268,12 @@ void func_80ABC58C(BgHakuginBombwall* this, GlobalContext* globalCtx) { spC0.y += this->dyna.actor.world.pos.y; spC0.z += this->dyna.actor.world.pos.z; - func_800B0E48(globalCtx, &spC0, &spCC, &spD8, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1A) + 60, + func_800B0E48(play, &spC0, &spCC, &spD8, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1A) + 60, (Rand_Next() >> 0x1B) + 60); } } -void func_80ABC7FC(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABC7FC(BgHakuginBombwall* this, PlayState* play) { s32 pad; Vec3f spB8; Vec3f spAC; @@ -303,28 +302,28 @@ void func_80ABC7FC(BgHakuginBombwall* this, GlobalContext* globalCtx) { spB8.x = spAC.x * -0.095f; spB8.z = spAC.z * -0.095f; - func_800B0E48(globalCtx, &spA0, &spAC, &spB8, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1A) + 60, + func_800B0E48(play, &spA0, &spAC, &spB8, &D_80ABCFAC, &D_80ABCFB0, (Rand_Next() >> 0x1A) + 60, (Rand_Next() >> 0x1B) + 60); } } -void BgHakuginBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginBombwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakuginBombwall* this = THIS; BgHakuginBombwallStruct* ptr = &D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)]; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(globalCtx, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor))) { Actor_MarkForDeath(&this->dyna.actor); return; } - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, ptr->unk_00); + DynaPolyActor_LoadMesh(play, &this->dyna, ptr->unk_00); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->collider.dim.radius = ptr->unk_14; this->collider.dim.height = ptr->unk_16; this->collider.info.bumper.dmgFlags = ptr->unk_18; @@ -336,14 +335,14 @@ void BgHakuginBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80ABCCE4; } -void BgHakuginBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginBombwall_Destroy(Actor* thisx, PlayState* play) { BgHakuginBombwall* this = THIS; - 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); } -s32 func_80ABCB5C(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80ABCB5C(Actor* thisx, PlayState* play) { BgHakuginBombwall* this = THIS; s32 pad; @@ -351,7 +350,7 @@ s32 func_80ABCB5C(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.ac != NULL) { if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->collider.base.ac->world.pos) < D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)].unk_1C) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); return true; } } @@ -359,7 +358,7 @@ s32 func_80ABCB5C(Actor* thisx, GlobalContext* globalCtx) { return false; } -s32 func_80ABCC00(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80ABCC00(Actor* thisx, PlayState* play) { BgHakuginBombwall* this = THIS; s32 pad; @@ -368,52 +367,51 @@ s32 func_80ABCC00(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.ac != NULL) { if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->collider.base.ac->world.pos) < D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)].unk_1C) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, - NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_WALL_BROKEN); return true; } } } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { label:; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 50, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_WALL_BROKEN); return true; } } return false; } -void func_80ABCCE4(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABCCE4(BgHakuginBombwall* this, PlayState* play) { BgHakuginBombwallStruct* ptr = &D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)]; - if (ptr->unk_20(&this->dyna.actor, globalCtx)) { + if (ptr->unk_20(&this->dyna.actor, play)) { this->dyna.actor.flags |= ACTOR_FLAG_10; ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); this->actionFunc = func_80ABCD98; } else { this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80ABCD98(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABCD98(BgHakuginBombwall* this, PlayState* play) { s32 pad; if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { BgHakuginBombwallStruct* ptr = &D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)]; ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - ptr->unk_24(this, globalCtx); + ptr->unk_24(this, play); this->dyna.actor.draw = NULL; this->unk_1AC = 20; - Flags_SetSwitch(globalCtx, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor)); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Flags_SetSwitch(play, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor)); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80ABCE60; } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); } } -void func_80ABCE60(BgHakuginBombwall* this, GlobalContext* globalCtx) { +void func_80ABCE60(BgHakuginBombwall* this, PlayState* play) { BgHakuginBombwallStruct* ptr = &D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)]; this->unk_1AC--; @@ -421,16 +419,16 @@ void func_80ABCE60(BgHakuginBombwall* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->dyna.actor.cutscene); Actor_MarkForDeath(&this->dyna.actor); } else if (this->unk_1AC == ptr->unk_2C) { - ptr->unk_28(this, globalCtx); + ptr->unk_28(this, play); } } -void BgHakuginBombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginBombwall_Update(Actor* thisx, PlayState* play) { BgHakuginBombwall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgHakuginBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(thisx)].unk_04); +void BgHakuginBombwall_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(thisx)].unk_04); } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.h b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.h index 869741214f..9c1da4a06e 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.h @@ -5,9 +5,9 @@ struct BgHakuginBombwall; -typedef void (*BgHakuginBombwallActionFunc)(struct BgHakuginBombwall*, GlobalContext*); -typedef s32 (*BgHakuginBombwallUnkFunc)(Actor*, GlobalContext*); -typedef void (*BgHakuginBombwallUnkFunc2)(struct BgHakuginBombwall*, GlobalContext*); +typedef void (*BgHakuginBombwallActionFunc)(struct BgHakuginBombwall*, PlayState*); +typedef s32 (*BgHakuginBombwallUnkFunc)(Actor*, PlayState*); +typedef void (*BgHakuginBombwallUnkFunc2)(struct BgHakuginBombwall*, PlayState*); #define BGHAKUGIN_BOMBWALL_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) #define BGHAKUGIN_BOMBWALL_100(thisx) (((thisx)->params >> 8) & 1) diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c index b61f66bb62..b119c46af8 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c @@ -10,12 +10,12 @@ #define THIS ((BgHakuginElvpole*)thisx) -void BgHakuginElvpole_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginElvpole_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginElvpole_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginElvpole_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakuginElvpole_Init(Actor* thisx, PlayState* play); +void BgHakuginElvpole_Destroy(Actor* thisx, PlayState* play); +void BgHakuginElvpole_Update(Actor* thisx, PlayState* play); +void BgHakuginElvpole_Draw(Actor* thisx, PlayState* play); -void func_80ABD92C(BgHakuginElvpole* this, GlobalContext* globalCtx); +void func_80ABD92C(BgHakuginElvpole* this, PlayState* play); #if 0 const ActorInit Bg_Hakugin_Elvpole_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h index 1695faedc9..7662ab6383 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h @@ -5,7 +5,7 @@ struct BgHakuginElvpole; -typedef void (*BgHakuginElvpoleActionFunc)(struct BgHakuginElvpole*, GlobalContext*); +typedef void (*BgHakuginElvpoleActionFunc)(struct BgHakuginElvpole*, PlayState*); typedef struct BgHakuginElvpole { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index f0831055f8..81e24f55f9 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -13,27 +13,27 @@ #define THIS ((BgHakuginPost*)thisx) -void BgHakuginPost_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginPost_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginPost_Update(Actor* thisx, GlobalContext* globalCtx); +void BgHakuginPost_Init(Actor* thisx, PlayState* play); +void BgHakuginPost_Destroy(Actor* thisx, PlayState* play); +void BgHakuginPost_Update(Actor* thisx, PlayState* play); void func_80A9CA94(BgHakuginPost* this); -void func_80A9CAA8(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9CAA8(BgHakuginPost* this, PlayState* play); void func_80A9CC84(BgHakuginPost* this); -void func_80A9CCA0(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9CCA0(BgHakuginPost* this, PlayState* play); void func_80A9CD00(BgHakuginPost* this); -void func_80A9CD14(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9CD14(BgHakuginPost* this, PlayState* play); void func_80A9CE00(BgHakuginPost* this); -void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9CE1C(BgHakuginPost* this, PlayState* play); void func_80A9D0A0(BgHakuginPost* this); -void func_80A9D0B4(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9D0B4(BgHakuginPost* this, PlayState* play); void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4); -void func_80A9D260(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9D260(BgHakuginPost* this, PlayState* play); void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4); -void func_80A9D360(BgHakuginPost* this, GlobalContext* globalCtx); +void func_80A9D360(BgHakuginPost* this, PlayState* play); void func_80A9D3E4(BgHakuginPost* this); -void func_80A9D434(BgHakuginPost* this, GlobalContext* globalCtx); -void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx); +void func_80A9D434(BgHakuginPost* this, PlayState* play); +void func_80A9D61C(Actor* thisx, PlayState* play); BgHakuginPostColliders D_80A9DDC0; BgHakuginPostUnkStruct D_80A9E028; @@ -96,7 +96,7 @@ void func_80A9ACF0(void) { bzero(&D_80A9DDC0, sizeof(BgHakuginPostColliders)); } -void func_80A9AD18(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9AD18(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 i; for (i = 0; i < unkStruct->count; i++) { @@ -105,8 +105,8 @@ void func_80A9AD18(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU if ((unkStruct3->unk_04) && (D_80A9DDC0.count < 8)) { ColliderCylinder* collider = &D_80A9DDC0.colliders[D_80A9DDC0.count]; - Collider_InitCylinder(globalCtx, collider); - Collider_SetCylinder(globalCtx, collider, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, collider); + Collider_SetCylinder(play, collider, &this->dyna.actor, &sCylinderInit); collider->dim.height = (s32)unkStruct3->unk_00 - 40; unkStruct->unk_0000[i].collider = collider; D_80A9DDC0.count++; @@ -114,14 +114,14 @@ void func_80A9AD18(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU } } -void func_80A9AE3C(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9AE3C(BgHakuginPost* this, PlayState* play) { while (D_80A9DDC0.count != 0) { D_80A9DDC0.count--; - Collider_DestroyCylinder(globalCtx, &D_80A9DDC0.colliders[D_80A9DDC0.count]); + Collider_DestroyCylinder(play, &D_80A9DDC0.colliders[D_80A9DDC0.count]); } } -void func_80A9AEB8(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9AEB8(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 i; for (i = 0; i < unkStruct->count; i++) { @@ -131,12 +131,12 @@ void func_80A9AEB8(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU collider->dim.pos.x = unkStruct->unk_0000[i].unk_14.x + this->dyna.actor.home.pos.x; collider->dim.pos.y = unkStruct->unk_0000[i].unk_14.y + this->unk_16C; collider->dim.pos.z = unkStruct->unk_0000[i].unk_14.z + this->dyna.actor.home.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); } } } -void func_80A9AFB4(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9AFB4(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 i; s32 j; @@ -156,7 +156,7 @@ void func_80A9AFB4(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU Math_Vec3f_Copy(&unkStruct->unk_0000[i].unk_14, &this->dyna.actor.world.pos); unkStruct->unk_0000[i].unk_2E = BGHAKUGINPOST_GET_7F00(&this->dyna.actor); if (D_80A9D880[unkStruct->unk_0000[i].unk_00].unk_04) { - if (Flags_GetSwitch(globalCtx, unkStruct->unk_0000[i].unk_2E)) { + if (Flags_GetSwitch(play, unkStruct->unk_0000[i].unk_2E)) { unkStruct->unk_0000[i].unk_34 = 5; } else { unkStruct->unk_0000[i].unk_34 = 1; @@ -174,7 +174,7 @@ void func_80A9AFB4(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU } } -void func_80A9B160(BgHakuginPostUnkStruct* unkStruct, GlobalContext* globalCtx) { +void func_80A9B160(BgHakuginPostUnkStruct* unkStruct, PlayState* play) { s32 i; for (i = 0; i < unkStruct->count; i++) { @@ -183,7 +183,7 @@ void func_80A9B160(BgHakuginPostUnkStruct* unkStruct, GlobalContext* globalCtx) unkStruct->unk_0000[i].unk_24 = 0.0f; unkStruct->unk_0000[i].unk_34 = 1; if (D_80A9D880[unkStruct->unk_0000[i].unk_00].unk_04 != 0) { - Flags_UnsetSwitch(globalCtx, unkStruct->unk_0000[i].unk_2E); + Flags_UnsetSwitch(play, unkStruct->unk_0000[i].unk_2E); } } } @@ -237,27 +237,27 @@ void func_80A9B384(Vec3f* arg0) { matrix->mf[3][2] = arg0->z; } -void func_80A9B3BC(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9B3BC(BgHakuginPost* this, PlayState* play) { s32 pad; s32 sp28 = BGHAKUGINPOST_GET_7F00(&this->dyna.actor); s32 sp24 = BGHAKUGINPOST_GET_7F00(&this->dyna.actor) + 1; s32 sp20; s32 sp1C; - if (Flags_GetSwitch(globalCtx, sp28)) { + if (Flags_GetSwitch(play, sp28)) { sp20 = true; } else { sp20 = false; } - if (Flags_GetSwitch(globalCtx, sp24)) { + if (Flags_GetSwitch(play, sp24)) { sp1C = true; } else { sp1C = false; } if (!(sp20 | sp1C)) { - Flags_SetSwitch(globalCtx, sp28); + Flags_SetSwitch(play, sp28); this->unk_170 = true; } else { this->unk_170 = sp20; @@ -266,36 +266,36 @@ void func_80A9B3BC(BgHakuginPost* this, GlobalContext* globalCtx) { this->unk_174 = sp1C; } -void func_80A9B46C(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9B46C(BgHakuginPost* this, PlayState* play) { s32 pad; s32 sp30 = BGHAKUGINPOST_GET_7F00(&this->dyna.actor); s32 sp2C = BGHAKUGINPOST_GET_7F00(&this->dyna.actor) + 1; s32 sp28; s32 sp24; - if (Flags_GetSwitch(globalCtx, sp30)) { + if (Flags_GetSwitch(play, sp30)) { sp28 = true; } else { sp28 = false; } - if (Flags_GetSwitch(globalCtx, sp2C)) { + if (Flags_GetSwitch(play, sp2C)) { sp24 = true; } else { sp24 = false; } if (!this->unk_170 && (sp28 == 1)) { - Flags_UnsetSwitch(globalCtx, sp2C); + Flags_UnsetSwitch(play, sp2C); } else if (!this->unk_174 && (sp24 == 1)) { - Flags_UnsetSwitch(globalCtx, sp30); + Flags_UnsetSwitch(play, sp30); } this->unk_170 = sp28; this->unk_174 = sp24; } -void func_80A9B554(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct, +void func_80A9B554(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct, BgHakuginPostUnkStruct1* unkStruct1) { f32 spE4 = D_80A9D880[unkStruct1->unk_00].unk_00; s32 i; @@ -358,7 +358,7 @@ void func_80A9B554(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU spA0.x = Math_SinS(val) * temp_f20 + spB8.x; spA0.y = (Rand_ZeroOne() * 1.2f - 0.1f) * spE4 + spB8.y; spA0.z = Math_CosS(val) * temp_f20 + spB8.z; - func_800B0E48(globalCtx, &spA0, &gZeroVec3f, &D_80A9D8EC, &D_80A9D8E4, &D_80A9D8E8, + func_800B0E48(play, &spA0, &gZeroVec3f, &D_80A9D8EC, &D_80A9D8E4, &D_80A9D8E8, ((s32)Rand_Next() >> 0x1A) + 0x82, ((s32)Rand_Next() >> 0x1A) + 0x6E); } @@ -424,7 +424,7 @@ void func_80A9BC0C(BgHakuginPostUnkStruct* unkStruct) { } } -void func_80A9BD24(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9BD24(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 i; s32 j; @@ -490,7 +490,7 @@ void func_80A9BD24(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU } } else if (unkStruct->unk_0000[i].unk_34 == 3) { if (Math3D_XZLengthSquared(unkStruct->unk_0000[i].unk_14.x, unkStruct->unk_0000[i].unk_14.z) > 278784.03f) { - func_80A9B554(this, globalCtx, unkStruct, &unkStruct->unk_0000[i]); + func_80A9B554(this, play, unkStruct, &unkStruct->unk_0000[i]); func_8019F128(NA_SE_EV_GLASSBROKEN_IMPACT); unkStruct->unk_0000[i].unk_34 = 4; unkStruct->unk_0000[i].unk_30 = 30; @@ -504,7 +504,7 @@ void func_80A9BD24(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU } } -void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 i; s32 pad; Vec3f sp44; @@ -519,8 +519,8 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU sp44.x = this->dyna.actor.home.pos.x + unkStruct1->unk_14.x; sp44.y = this->unk_16C + unkStruct1->unk_14.y; sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z; - func_8013ECE0(Math3D_Vec3fDistSq(&sp44, &GET_PLAYER(globalCtx)->actor.world.pos), 255, 20, 150); - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + func_8013ECE0(Math3D_Vec3fDistSq(&sp44, &GET_PLAYER(play)->actor.world.pos), 255, 20, 150); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 20000); Quake_SetQuakeValues(quake, 7, 0, 0, 0); Quake_SetCountdown(quake, 12); @@ -534,10 +534,10 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU } } -void func_80A9C18C(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9C18C(BgHakuginPost* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); + Player* player = GET_PLAYER(play); + Camera* activeCam = GET_ACTIVE_CAM(play); s16 quake; func_8013ECE0(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, @@ -549,7 +549,7 @@ void func_80A9C18C(BgHakuginPost* this, GlobalContext* globalCtx) { Quake_SetCountdown(quake, 20); } -void func_80A9C228(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostUnkStruct* unkStruct) { +void func_80A9C228(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { s32 val; BgHakuginPostUnkStruct1* spC8 = NULL; BgHakuginPostUnkStruct1* spC4; @@ -585,7 +585,7 @@ void func_80A9C228(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU spA0.y = 0.2f; spA0.z = spAC.z * -0.08f; - func_800B0E48(globalCtx, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, 0x50, + func_800B0E48(play, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, 0x50, (s32)(Rand_ZeroOne() * 60.0f) + 110); } } @@ -610,14 +610,14 @@ void func_80A9C228(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU spA0.y = 0.2f; spA0.z = spAC.z * -0.08f; - func_800B0E48(globalCtx, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, 0xC8, + func_800B0E48(play, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, 0xC8, (s32)(Rand_ZeroOne() * 70.0f) + 100); } } } } -void func_80A9C634(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9C634(BgHakuginPost* this, PlayState* play) { s32 i; Vec3f spB8; Vec3f spAC; @@ -645,12 +645,11 @@ void func_80A9C634(BgHakuginPost* this, GlobalContext* globalCtx) { spA0.x = spAC.x * -0.08f; spA0.y = 0.8f; spA0.z = spAC.z * -0.08f; - func_800B0DE0(globalCtx, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, (s32)(Rand_ZeroOne() * 400.0f) + 2500, - -250); + func_800B0DE0(play, &spB8, &spAC, &spA0, &D_80A9D8E4, &D_80A9D8E8, (s32)(Rand_ZeroOne() * 400.0f) + 2500, -250); } } -void func_80A9C854(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9C854(BgHakuginPost* this, PlayState* play) { s32 pad; s32 sp38 = false; s32 pad2; @@ -659,13 +658,13 @@ void func_80A9C854(BgHakuginPost* this, GlobalContext* globalCtx) { s32 sp28; if (this->unk_174 != 0) { - if (Flags_GetSwitch(globalCtx, this->dyna.actor.home.rot.z & 0x7F)) { + if (Flags_GetSwitch(play, this->dyna.actor.home.rot.z & 0x7F)) { sp28 = true; for (i = 0; i < D_80A9E028.count; i++) { ColliderCylinder* collider = D_80A9E028.unk_0000[i].collider; - if ((collider != NULL) && Flags_GetSwitch(globalCtx, D_80A9E028.unk_0000[i].unk_2E)) { + if ((collider != NULL) && Flags_GetSwitch(play, D_80A9E028.unk_0000[i].unk_2E)) { sp28 = false; break; } @@ -678,13 +677,13 @@ void func_80A9C854(BgHakuginPost* this, GlobalContext* globalCtx) { } if (sp38) { - Flags_SetSwitch(globalCtx, this->dyna.actor.home.rot.x & 0x7F); + Flags_SetSwitch(play, this->dyna.actor.home.rot.x & 0x7F); } else { - Flags_UnsetSwitch(globalCtx, this->dyna.actor.home.rot.x & 0x7F); + Flags_UnsetSwitch(play, this->dyna.actor.home.rot.x & 0x7F); } } -void BgHakuginPost_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginPost_Init(Actor* thisx, PlayState* play) { static s32 D_80A9D8FC = 1; BgHakuginPost* this = THIS; @@ -701,21 +700,21 @@ void BgHakuginPost_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x = 0; this->dyna.actor.shape.rot.z = 0; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hakugin_obj_Colheader_00D3B0); - func_80A9B3BC(this, globalCtx); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_hakugin_obj_Colheader_00D3B0); + func_80A9B3BC(this, play); func_80A9CA94(this); } else { - func_80A9AFB4(this, globalCtx, &D_80A9E028); + func_80A9AFB4(this, play, &D_80A9E028); Actor_MarkForDeath(&this->dyna.actor); } } -void BgHakuginPost_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginPost_Destroy(Actor* thisx, PlayState* play) { BgHakuginPost* this = THIS; if (BGHAKUGINPOST_GET_7(&this->dyna.actor) == 7) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - func_80A9AE3C(this, globalCtx); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + func_80A9AE3C(this, play); } } @@ -723,7 +722,7 @@ void func_80A9CA94(BgHakuginPost* this) { this->actionFunc = func_80A9CAA8; } -void func_80A9CAA8(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9CAA8(BgHakuginPost* this, PlayState* play) { s32 pad[2]; s32 i; @@ -763,7 +762,7 @@ void func_80A9CAA8(BgHakuginPost* this, GlobalContext* globalCtx) { } } - func_80A9AD18(this, globalCtx, &D_80A9E028); + func_80A9AD18(this, play, &D_80A9E028); this->dyna.actor.draw = func_80A9D61C; if (this->unk_170 != 0) { func_80A9CC84(this); @@ -777,7 +776,7 @@ void func_80A9CC84(BgHakuginPost* this) { this->unk_16C = this->unk_164; } -void func_80A9CCA0(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9CCA0(BgHakuginPost* this, PlayState* play) { if (this->unk_174 != 0) { func_80A9D1E0(this, func_80A9CD00, (this->unk_164 - this->dyna.actor.home.pos.y) + 100.0f, 60, this->dyna.actor.cutscene); @@ -788,14 +787,14 @@ void func_80A9CD00(BgHakuginPost* this) { this->actionFunc = func_80A9CD14; } -void func_80A9CD14(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9CD14(BgHakuginPost* this, PlayState* play) { f32 temp_f12 = Math_SinS((this->unk_16C - this->unk_164) * 0x8000 / (this->unk_168 - this->unk_164)) * 140.0f + 4.0f; temp_f12 = CLAMP_MAX(temp_f12, 40.0f); this->unk_16C += temp_f12; if (this->unk_168 <= this->unk_16C) { - func_80A9C18C(this, globalCtx); + func_80A9C18C(this, play); func_8019F128(NA_SE_EV_STONEDOOR_STOP); func_80A9CE00(this); } else { @@ -808,9 +807,9 @@ void func_80A9CE00(BgHakuginPost* this) { this->unk_16C = this->unk_168; } -void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9CE1C(BgHakuginPost* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); ColliderCylinder* collider; s32 yDiff; s32 i; @@ -838,7 +837,7 @@ void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx) { D_80A9E028.unk_0000[i].unk_34 = 2; func_800B8E58(player, NA_SE_IT_HAMMER_HIT); func_8019F128(NA_SE_EV_SLIDE_DOOR_OPEN); - Flags_SetSwitch(globalCtx, D_80A9E028.unk_0000[i].unk_2E); + Flags_SetSwitch(play, D_80A9E028.unk_0000[i].unk_2E); this->unk_178 = 20; func_80A9D2C4(this, func_80A9CE00, D_80A9E028.unk_0000[i].unk_14.y + 50.0f, D_80A9E028.unk_0000[i].unk_2A, D_80A9E028.unk_0000[i].unk_2C); @@ -855,7 +854,7 @@ void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx) { } if (this->unk_178 <= 0) { - func_80A9AEB8(this, globalCtx, &D_80A9E028); + func_80A9AEB8(this, play, &D_80A9E028); } } @@ -863,17 +862,17 @@ void func_80A9D0A0(BgHakuginPost* this) { this->actionFunc = func_80A9D0B4; } -void func_80A9D0B4(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9D0B4(BgHakuginPost* this, PlayState* play) { f32 sp24 = (this->unk_164 + this->unk_160) - func_80A9B2B8(&D_80A9E028); f32 temp_f14 = Math_SinS((this->unk_16C - sp24) * 0x8000 / (this->unk_168 - sp24)) * 140.0f + 4.0f; temp_f14 = CLAMP_MAX(temp_f14, 40.0f); this->unk_16C -= temp_f14; if (this->unk_16C <= sp24) { - func_80A9C634(this, globalCtx); - func_80A9B160(&D_80A9E028, globalCtx); + func_80A9C634(this, play); + func_80A9B160(&D_80A9E028, play); this->unk_16C = this->unk_164; - func_80A9C18C(this, globalCtx); + func_80A9C18C(this, play); func_8019F128(NA_SE_EV_STONEDOOR_STOP); func_80A9CC84(this); } else { @@ -894,7 +893,7 @@ void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 this->actionFunc = func_80A9D260; } -void func_80A9D260(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9D260(BgHakuginPost* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_184)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_184, &this->dyna.actor); this->unkFunc(this); @@ -918,7 +917,7 @@ void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 this->actionFunc = func_80A9D360; } -void func_80A9D360(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9D360(BgHakuginPost* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_184)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_184, &this->dyna.actor); if (this->unk_186 >= 0) { @@ -939,7 +938,7 @@ void func_80A9D3E4(BgHakuginPost* this) { this->actionFunc = func_80A9D434; } -void func_80A9D434(BgHakuginPost* this, GlobalContext* globalCtx) { +void func_80A9D434(BgHakuginPost* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_186) != 0) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_186, &this->dyna.actor); this->unkFunc(this); @@ -948,11 +947,11 @@ void func_80A9D434(BgHakuginPost* this, GlobalContext* globalCtx) { } } -void BgHakuginPost_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginPost_Update(Actor* thisx, PlayState* play) { BgHakuginPost* this = THIS; f32 temp; - func_80A9B46C(this, globalCtx); + func_80A9B46C(this, play); if ((this->unk_180 >= 0) && ((this->actionFunc != func_80A9D260) || (this->actionFunc != func_80A9D360))) { this->unk_180--; if (this->unk_180 < 0) { @@ -976,10 +975,10 @@ void BgHakuginPost_Update(Actor* thisx, GlobalContext* globalCtx) { } func_80A9BC0C(&D_80A9E028); - this->actionFunc(this, globalCtx); - func_80A9BD24(this, globalCtx, &D_80A9E028); - func_80A9C058(this, globalCtx, &D_80A9E028); - func_80A9C228(this, globalCtx, &D_80A9E028); + this->actionFunc(this, play); + func_80A9BD24(this, play, &D_80A9E028); + func_80A9C058(this, play, &D_80A9E028); + func_80A9C228(this, play, &D_80A9E028); temp = func_80A9B2B8(&D_80A9E028); this->dyna.actor.scale.y = temp + this->unk_16C - this->dyna.actor.home.pos.y; this->dyna.actor.scale.y *= 0.0025f; @@ -987,10 +986,10 @@ void BgHakuginPost_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->scale.y = 0.0001f; } - func_80A9C854(this, globalCtx); + func_80A9C854(this, play); } -void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) { +void func_80A9D61C(Actor* thisx, PlayState* play) { static Gfx* D_80A9D900[] = { object_hakugin_obj_DL_00C1A8, object_hakugin_obj_DL_00C568, NULL, NULL, object_hakugin_obj_DL_00CA38, object_hakugin_obj_DL_00CEC8, NULL, @@ -1007,9 +1006,9 @@ void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp68; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); @@ -1022,8 +1021,7 @@ void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) { sp68.z = unkStruct1->unk_14.z + this->dyna.actor.home.pos.z; func_80A9B384(&sp68); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80A9D900[unkStruct1->unk_00]); } } @@ -1036,12 +1034,12 @@ void func_80A9D61C(Actor* thisx, GlobalContext* globalCtx) { &unkStruct2->unk_20); Matrix_Scale(unkStruct2->unk_00, unkStruct2->unk_00, unkStruct2->unk_00, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80A9D91C[unkStruct2->unk_2D]); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h index 4a574bc24f..7ecae1ea8e 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h @@ -5,7 +5,7 @@ struct BgHakuginPost; -typedef void (*BgHakuginPostActionFunc)(struct BgHakuginPost*, GlobalContext*); +typedef void (*BgHakuginPostActionFunc)(struct BgHakuginPost*, PlayState*); typedef void (*BgHakuginPostFunc)(struct BgHakuginPost*); #define BGHAKUGINPOST_GET_7(thisx) ((thisx)->params & 7) diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c index f5e035be73..da31bef3de 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c @@ -11,29 +11,29 @@ #define THIS ((BgHakuginSwitch*)thisx) -void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx); -void BgHakuginSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgHakuginSwitch_Init(Actor* thisx, PlayState* play); +void BgHakuginSwitch_Destroy(Actor* thisx, PlayState* play); +void BgHakuginSwitch_Update(Actor* thisx, PlayState* play); +void BgHakuginSwitch_Draw(Actor* thisx, PlayState* play); -void func_80B15A68(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15B1C(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15E0C(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15E78(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15F3C(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B15F88(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B1606C(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B160DC(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B161A0(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B16244(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B163C4(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B16400(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B16494(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B16520(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B165A0(BgHakuginSwitch* this, GlobalContext* globalCtx); -void func_80B165E0(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15A68(BgHakuginSwitch* this, PlayState* play); +void func_80B15B1C(BgHakuginSwitch* this, PlayState* play); +void func_80B15B74(BgHakuginSwitch* this, PlayState* play); +void func_80B15E0C(BgHakuginSwitch* this, PlayState* play); +void func_80B15E78(BgHakuginSwitch* this, PlayState* play); +void func_80B15F3C(BgHakuginSwitch* this, PlayState* play); +void func_80B15F88(BgHakuginSwitch* this, PlayState* play); +void func_80B1606C(BgHakuginSwitch* this, PlayState* play); +void func_80B160DC(BgHakuginSwitch* this, PlayState* play); +void func_80B161A0(BgHakuginSwitch* this, PlayState* play); +void func_80B16244(BgHakuginSwitch* this, PlayState* play); +void func_80B162AC(BgHakuginSwitch* this, PlayState* play); +void func_80B163C4(BgHakuginSwitch* this, PlayState* play); +void func_80B16400(BgHakuginSwitch* this, PlayState* play); +void func_80B16494(BgHakuginSwitch* this, PlayState* play); +void func_80B16520(BgHakuginSwitch* this, PlayState* play); +void func_80B165A0(BgHakuginSwitch* this, PlayState* play); +void func_80B165E0(BgHakuginSwitch* this, PlayState* play); u32 D_80B16AF0; @@ -111,7 +111,7 @@ void func_80B157C4(BgHakuginSwitch* this, u16 arg1) { } } -void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginSwitch_Init(Actor* thisx, PlayState* play) { s32 pad; BgHakuginSwitch* this = THIS; s32 sp34 = BGHAKUGINSWITCH_GET_7(&this->dyna.actor); @@ -119,17 +119,17 @@ void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad2; s32 sp28; - if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { sp30 = true; } else { sp30 = false; } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_goronswitch_Colheader_0005C8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_goronswitch_Colheader_0005C8); - 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->unk_1B2 = 15; if (!BGHAKUGINSWITCH_GET_10(&this->dyna.actor)) { @@ -151,9 +151,9 @@ void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } if (sp30) { - func_80B16494(this, globalCtx); + func_80B16494(this, play); } else { - func_80B16244(this, globalCtx); + func_80B16244(this, play); } } else { if (D_80B1688C[sp34].unk_14 & 4) { @@ -169,20 +169,20 @@ void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1BA = ActorCutscene_GetAdditionalCutscene(this->unk_1B8); if (sp30 == sp28) { - func_80B15F3C(this, globalCtx); + func_80B15F3C(this, play); } else { - func_80B15B1C(this, globalCtx); + func_80B15B1C(this, play); } } this->unk_1C8 = 1.0f / this->dyna.actor.scale.y; } -void BgHakuginSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginSwitch_Destroy(Actor* thisx, PlayState* play) { BgHakuginSwitch* this = THIS; - 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_80B15A4C(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2) { @@ -191,7 +191,7 @@ void func_80B15A4C(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2) this->actionFunc = func_80B15A68; } -void func_80B15A68(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15A68(BgHakuginSwitch* this, PlayState* play) { s32 pad; BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; s32 sp18 = !(s->unk_14 & 0x40); @@ -201,13 +201,13 @@ void func_80B15A68(BgHakuginSwitch* this, GlobalContext* globalCtx) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); this->unk_1BF = 40; } - this->unk_1B4(this, globalCtx); + this->unk_1B4(this, play); } else if (sp18) { ActorCutscene_SetIntentToPlay(this->unk_1BC); } } -void func_80B15B1C(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15B1C(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; this->dyna.actor.world.pos.y = s->unk_0 + this->dyna.actor.home.pos.y; @@ -216,7 +216,7 @@ void func_80B15B1C(BgHakuginSwitch* this, GlobalContext* globalCtx) { this->actionFunc = func_80B15B74; } -void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15B74(BgHakuginSwitch* this, PlayState* play) { s32 pad; BgHakuginSwitchStruct* sp38 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; s32 sp34 = (this->collider.base.acFlags & AC_HIT) != 0; @@ -226,7 +226,7 @@ void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx) { s32 sp24; s32 sp20; - if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { sp2C = 1; } else { sp2C = 0; @@ -262,7 +262,7 @@ void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx) { if (sp2C == sp28) { if ((sp38->unk_14 & 0xFF) & 0x10) { - if (D_80B16AF0 < globalCtx->gameplayFrames) { + if (D_80B16AF0 < play->gameplayFrames) { sp24 = true; } } else { @@ -272,25 +272,25 @@ void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx) { if (sp24) { if (sp20 == 1) { - Flags_SetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } else if (sp20 == 0) { - Flags_UnsetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_UnsetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } - D_80B16AF0 = globalCtx->gameplayFrames; + D_80B16AF0 = play->gameplayFrames; if (sp38->unk_14 & 0x10) { func_80B15A4C(this, func_80B15E0C, this->unk_1B8); } else { - func_80B15E0C(this, globalCtx); + func_80B15E0C(this, play); } } else if (!(sp38->unk_14 & 1)) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80B15E0C(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15E0C(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; if ((s->unk_14 & 0x80)) { @@ -300,7 +300,7 @@ void func_80B15E0C(BgHakuginSwitch* this, GlobalContext* globalCtx) { this->actionFunc = func_80B15E78; } -void func_80B15E78(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15E78(BgHakuginSwitch* this, PlayState* play) { s32 pad; BgHakuginSwitchStruct* sp20 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; @@ -308,13 +308,13 @@ void func_80B15E78(BgHakuginSwitch* this, GlobalContext* globalCtx) { if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { func_8013ECE0(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } - func_80B15F3C(this, globalCtx); + func_80B15F3C(this, play); } else if (!(sp20->unk_14 & 0x80)) { func_80B157C4(this, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); } } -void func_80B15F3C(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15F3C(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; this->dyna.actor.world.pos.y = s->unk_4 + this->dyna.actor.home.pos.y; @@ -322,12 +322,12 @@ void func_80B15F3C(BgHakuginSwitch* this, GlobalContext* globalCtx) { this->actionFunc = func_80B15F88; } -void func_80B15F88(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B15F88(BgHakuginSwitch* this, PlayState* play) { s32 phi_a0; BgHakuginSwitchStruct* sp18 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; s32 phi_v1; - if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { phi_a0 = true; } else { phi_a0 = false; @@ -341,16 +341,16 @@ void func_80B15F88(BgHakuginSwitch* this, GlobalContext* globalCtx) { if (phi_a0 != phi_v1) { if ((sp18->unk_14 & 0xFF) & 0x20) { - if (D_80B16AF0 < globalCtx->gameplayFrames) { + if (D_80B16AF0 < play->gameplayFrames) { func_80B15A4C(this, func_80B1606C, this->unk_1BA); } } else { - func_80B1606C(this, globalCtx); + func_80B1606C(this, play); } } } -void func_80B1606C(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B1606C(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; if (s->unk_14 & 0x80) { @@ -360,12 +360,12 @@ void func_80B1606C(BgHakuginSwitch* this, GlobalContext* globalCtx) { this->actionFunc = func_80B160DC; } -void func_80B160DC(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B160DC(BgHakuginSwitch* this, PlayState* play) { s32 pad; BgHakuginSwitchStruct* sp18 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; if (Math_StepToF(&this->dyna.actor.world.pos.y, sp18->unk_0 + this->dyna.actor.home.pos.y, sp18->unk_8)) { - func_80B15B1C(this, globalCtx); + func_80B15B1C(this, play); } else if (!(sp18->unk_14 & 0x80)) { func_80B157C4(this, NA_SE_EV_PILLAR_UP_FAST - SFX_FLAG); } @@ -378,32 +378,32 @@ void func_80B16180(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2, this->actionFunc = func_80B161A0; } -void func_80B161A0(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B161A0(BgHakuginSwitch* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_1BC)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); if (this->unk_1BE != 0) { - Flags_SetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } else { - Flags_UnsetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_UnsetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } this->unk_1BF = 50; - this->unk_1B4(this, globalCtx); + this->unk_1B4(this, play); } else { ActorCutscene_SetIntentToPlay(this->unk_1BC); } } -void func_80B16244(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B16244(BgHakuginSwitch* this, PlayState* play) { this->unk_1C0 = 1; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; if ((BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) && (this->dyna.actor.category != ACTORCAT_SWITCH)) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, 0); + func_800BC154(play, &play->actorCtx, &this->dyna.actor, 0); } this->actionFunc = func_80B162AC; } -void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B162AC(BgHakuginSwitch* this, PlayState* play) { s32 sp34 = (this->collider.base.acFlags & AC_HIT) != 0; s32 sp30 = BGHAKUGINSWITCH_GET_7(&this->dyna.actor); s32 pad; @@ -419,7 +419,7 @@ void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx) { } if (sp30 == 1) { - if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { sp24 = true; } } @@ -428,63 +428,63 @@ void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx) { if (sp28) { func_80B16180(this, func_80B163C4, 1, this->unk_1B8); } else { - func_80B163C4(this, globalCtx); + func_80B163C4(this, play); } } else { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void func_80B163C4(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B163C4(BgHakuginSwitch* this, PlayState* play) { func_80B15790(this, NA_SE_EV_STONE_SWITCH_ON); this->unk_1C0 = 0; this->actionFunc = func_80B16400; } -void func_80B16400(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B16400(BgHakuginSwitch* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, (this->dyna.actor.home.pos.y + 2.0f) - (1800.0f * this->dyna.actor.scale.y), 10.0f)) { if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { func_8013ECE0(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } - func_80B16494(this, globalCtx); + func_80B16494(this, play); } } -void func_80B16494(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B16494(BgHakuginSwitch* this, PlayState* play) { this->unk_1C0 = 0; this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y - (1800.0f * this->dyna.actor.scale.y)) + 2.0f; if ((BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) && (this->dyna.actor.category != ACTORCAT_PROP)) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORCAT_PROP); + func_800BC154(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_PROP); } this->actionFunc = func_80B16520; } -void func_80B16520(BgHakuginSwitch* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { +void func_80B16520(BgHakuginSwitch* this, PlayState* play) { + if (!Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { if (BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) { func_80B16180(this, func_80B165A0, 0, this->unk_1BA); } else { - func_80B165A0(this, globalCtx); + func_80B165A0(this, play); } } } -void func_80B165A0(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B165A0(BgHakuginSwitch* this, PlayState* play) { func_80B15790(this, NA_SE_EV_STONE_SWITCH_OFF); this->unk_1C0 = 1; this->actionFunc = func_80B165E0; } -void func_80B165E0(BgHakuginSwitch* this, GlobalContext* globalCtx) { +void func_80B165E0(BgHakuginSwitch* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 6.0f)) { - func_80B16244(this, globalCtx); + func_80B16244(this, play); } } -void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginSwitch_Update(Actor* thisx, PlayState* play) { s32 pad; BgHakuginSwitch* this = THIS; f32 sp24; @@ -502,7 +502,7 @@ void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); sp24 = this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y; @@ -530,8 +530,8 @@ void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgHakuginSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgHakuginSwitch_Draw(Actor* thisx, PlayState* play) { BgHakuginSwitch* this = THIS; - Gfx_DrawDListOpa(globalCtx, this->unk_1A8); + Gfx_DrawDListOpa(play, this->unk_1A8); } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h index cc13639650..e4a5928f6d 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h @@ -5,8 +5,8 @@ struct BgHakuginSwitch; -typedef void (*BgHakuginSwitchActionFunc)(struct BgHakuginSwitch*, GlobalContext*); -typedef void (*BgHakuginSwitchUnkFunc)(struct BgHakuginSwitch*, GlobalContext*); +typedef void (*BgHakuginSwitchActionFunc)(struct BgHakuginSwitch*, PlayState*); +typedef void (*BgHakuginSwitchUnkFunc)(struct BgHakuginSwitch*, PlayState*); #define BGHAKUGINSWITCH_GET_7(thisx) ((thisx)->params & 7) #define BGHAKUGINSWITCH_GET_10(thisx) (((thisx)->params >> 4) & 1) diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index e3270fb6e2..68e824f4ac 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -10,10 +10,10 @@ #define THIS ((BgIcefloe*)thisx) -void BgIcefloe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIcefloe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIcefloe_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIcefloe_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIcefloe_Init(Actor* thisx, PlayState* play); +void BgIcefloe_Destroy(Actor* thisx, PlayState* play); +void BgIcefloe_Update(Actor* thisx, PlayState* play); +void BgIcefloe_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Icefloe_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.h b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.h index e35f93daf7..64f61ea2f6 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.h +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.h @@ -5,7 +5,7 @@ struct BgIcefloe; -typedef void (*BgIcefloeActionFunc)(struct BgIcefloe*, GlobalContext*); +typedef void (*BgIcefloeActionFunc)(struct BgIcefloe*, PlayState*); typedef struct BgIcefloe { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index bf0851a5b7..aec62ce15e 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -11,16 +11,16 @@ #define THIS ((BgIcicle*)thisx) -void BgIcicle_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIcicle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIcicle_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIcicle_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIcicle_Init(Actor* thisx, PlayState* play); +void BgIcicle_Destroy(Actor* thisx, PlayState* play); +void BgIcicle_Update(Actor* thisx, PlayState* play); +void BgIcicle_Draw(Actor* thisx, PlayState* play); -void BgIcicle_DoNothing(BgIcicle* this, GlobalContext* globalCtx); -void BgIcicle_Wait(BgIcicle* this, GlobalContext* globalCtx); -void BgIcicle_Shiver(BgIcicle* this, GlobalContext* globalCtx); -void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx); -void BgIcicle_Regrow(BgIcicle* this, GlobalContext* globalCtx); +void BgIcicle_DoNothing(BgIcicle* this, PlayState* play); +void BgIcicle_Wait(BgIcicle* this, PlayState* play); +void BgIcicle_Shiver(BgIcicle* this, PlayState* play); +void BgIcicle_Fall(BgIcicle* this, PlayState* play); +void BgIcicle_Regrow(BgIcicle* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -61,7 +61,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIcicle_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIcicle_Init(Actor* thisx, PlayState* play) { s32 pad; BgIcicle* this = THIS; s32 paramsHigh; @@ -69,9 +69,9 @@ void BgIcicle_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_icicle_Colheader_000294); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_icicle_Colheader_000294); - Collider_InitAndSetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider); paramsHigh = (thisx->params >> 8) & 0xFF; @@ -89,14 +89,14 @@ void BgIcicle_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIcicle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIcicle_Destroy(Actor* thisx, PlayState* play) { BgIcicle* this = THIS; - 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 BgIcicle_Break(BgIcicle* this, GlobalContext* globalCtx, f32 arg2) { +void BgIcicle_Break(BgIcicle* 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 }; @@ -105,7 +105,7 @@ void BgIcicle_Break(BgIcicle* 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++) { @@ -117,23 +117,23 @@ void BgIcicle_Break(BgIcicle* this, GlobalContext* globalCtx, f32 arg2) { velocity.z = randPlusMinusPoint5Scaled(7.0f); velocity.y = (Rand_ZeroOne() * 4.0f) + 8.0f; - EffectSsEnIce_Spawn(globalCtx, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &velocity, &accel, &primColor, - &envColor, 30); + EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &velocity, &accel, &primColor, &envColor, + 30); } } } -void BgIcicle_DoNothing(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_DoNothing(BgIcicle* this, PlayState* play) { } -void BgIcicle_Wait(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_Wait(BgIcicle* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 60.0f) { this->shiverTimer = 10; this->actionFunc = BgIcicle_Shiver; } } -void BgIcicle_Shiver(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_Shiver(BgIcicle* this, PlayState* play) { s32 randSign; f32 rand; @@ -149,8 +149,8 @@ void BgIcicle_Shiver(BgIcicle* 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; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Fall; } else { rand = Rand_ZeroOne(); @@ -162,7 +162,7 @@ void BgIcicle_Shiver(BgIcicle* this, GlobalContext* globalCtx) { } } -void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_Fall(BgIcicle* this, PlayState* play) { if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & 1)) { this->collider.base.atFlags &= ~AT_HIT; this->dyna.actor.bgCheckFlags &= ~1; @@ -171,11 +171,11 @@ void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } - BgIcicle_Break(this, globalCtx, 40.0f); + BgIcicle_Break(this, play, 40.0f); if (this->dyna.actor.params == ICICLE_STALACTITE_REGROW) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Regrow; } else { Actor_MarkForDeath(&this->dyna.actor); @@ -184,64 +184,64 @@ void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx) { } else { Actor_MoveWithGravity(&this->dyna.actor); this->dyna.actor.world.pos.y += 40.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); this->dyna.actor.world.pos.y -= 40.0f; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void BgIcicle_Regrow(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_Regrow(BgIcicle* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { this->actionFunc = BgIcicle_Wait; this->dyna.actor.velocity.y = 0.0f; } } -void BgIcicle_UpdateAttacked(BgIcicle* this, GlobalContext* globalCtx) { +void BgIcicle_UpdateAttacked(BgIcicle* this, PlayState* play) { s32 dropItem00Id; if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if (this->dyna.actor.params == ICICLE_STALAGMITE_RANDOM_DROP) { - BgIcicle_Break(this, globalCtx, 50.0f); + BgIcicle_Break(this, play, 50.0f); if (this->unk_160 != 0xFF) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->dyna.actor.world.pos, this->unk_160 << 4); + Item_DropCollectibleRandom(play, NULL, &this->dyna.actor.world.pos, this->unk_160 << 4); } } else if (this->dyna.actor.params == ICICLE_STALAGMITE_FIXED_DROP) { dropItem00Id = func_800A8150(this->unk_160); - BgIcicle_Break(this, globalCtx, 50.0f); - Item_DropCollectible(globalCtx, &this->dyna.actor.world.pos, (this->unk_161 << 8) | dropItem00Id); + BgIcicle_Break(this, play, 50.0f); + Item_DropCollectible(play, &this->dyna.actor.world.pos, (this->unk_161 << 8) | dropItem00Id); } else { if (this->dyna.actor.params == ICICLE_STALACTITE_REGROW) { - BgIcicle_Break(this, globalCtx, 40.0f); + BgIcicle_Break(this, play, 40.0f); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Regrow; return; } - BgIcicle_Break(this, globalCtx, 40.0f); + BgIcicle_Break(this, play, 40.0f); } Actor_MarkForDeath(&this->dyna.actor); } } -void BgIcicle_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIcicle_Update(Actor* thisx, PlayState* play) { s32 pad; BgIcicle* this = THIS; - BgIcicle_UpdateAttacked(this, globalCtx); - this->actionFunc(this, globalCtx); + BgIcicle_UpdateAttacked(this, play); + this->actionFunc(this, play); if (this->actionFunc != BgIcicle_Regrow) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void BgIcicle_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_icicle_DL_0000D0); +void BgIcicle_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_icicle_DL_0000D0); } diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.h b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.h index 510332da02..20450f9299 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.h +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.h @@ -5,7 +5,7 @@ struct BgIcicle; -typedef void (*BgIcicleActionFunc)(struct BgIcicle*, GlobalContext*); +typedef void (*BgIcicleActionFunc)(struct BgIcicle*, PlayState*); typedef enum { /* 0 */ ICICLE_STALAGMITE_RANDOM_DROP, diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c index b7ebb4f408..0a4c31d126 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c @@ -11,19 +11,19 @@ #define THIS ((BgIkanaBlock*)thisx) -void BgIkanaBlock_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaBlock_Update(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaBlock_Init(Actor* thisx, PlayState* play); +void BgIkanaBlock_Destroy(Actor* thisx, PlayState* play); +void BgIkanaBlock_Update(Actor* thisx, PlayState* play); void func_80B7F00C(BgIkanaBlock* this); -void func_80B7F034(BgIkanaBlock* this, GlobalContext* globalCtx); +void func_80B7F034(BgIkanaBlock* this, PlayState* play); void func_80B7F0A4(BgIkanaBlock* this); -void func_80B7F0D0(BgIkanaBlock* this, GlobalContext* globalCtx); +void func_80B7F0D0(BgIkanaBlock* this, PlayState* play); void func_80B7F1A8(BgIkanaBlock* this); -void func_80B7F290(BgIkanaBlock* this, GlobalContext* globalCtx); +void func_80B7F290(BgIkanaBlock* this, PlayState* play); void func_80B7F360(BgIkanaBlock* this); -void func_80B7F398(BgIkanaBlock* this, GlobalContext* globalCtx); -void func_80B7F564(Actor* thisx, GlobalContext* globalCtx); +void func_80B7F398(BgIkanaBlock* this, PlayState* play); +void func_80B7F564(Actor* thisx, PlayState* play); const ActorInit Bg_Ikana_Block_InitVars = { ACTOR_BG_IKANA_BLOCK, @@ -78,15 +78,15 @@ void func_80B7EB30(BgIkanaBlock* this) { } } -s32 func_80B7EB64(BgIkanaBlock* this, GlobalContext* globalCtx) { +s32 func_80B7EB64(BgIkanaBlock* this, PlayState* play) { return !(this->unk_17C & 8); } -s32 func_80B7EB7C(BgIkanaBlock* this, GlobalContext* globalCtx) { +s32 func_80B7EB7C(BgIkanaBlock* this, PlayState* play) { return this->unk_17B > 10; } -s32 func_80B7EB94(BgIkanaBlock* this, GlobalContext* globalCtx) { +s32 func_80B7EB94(BgIkanaBlock* this, PlayState* play) { s32 pad; Vec3f sp70; Vec3f sp64; @@ -125,12 +125,12 @@ s32 func_80B7EB94(BgIkanaBlock* this, GlobalContext* globalCtx) { sp64.y += this->dyna.actor.world.pos.y + this->unk_170 + 2.0f; sp64.z += this->dyna.actor.world.pos.z; - return !BgCheck_EntityLineTest3(&globalCtx->colCtx, &sp70, &sp64, &sp58, &sp54, true, false, false, true, &sp50, + return !BgCheck_EntityLineTest3(&play->colCtx, &sp70, &sp64, &sp58, &sp54, true, false, false, true, &sp50, &this->dyna.actor, 0.0f); } -s32 func_80B7ECFC(BgIkanaBlock* this, GlobalContext* globalCtx) { - return func_80B7EB64(this, globalCtx) && func_80B7EB7C(this, globalCtx) && func_80B7EB94(this, globalCtx); +s32 func_80B7ECFC(BgIkanaBlock* this, PlayState* play) { + return func_80B7EB64(this, play) && func_80B7EB7C(this, play) && func_80B7EB94(this, play); } void func_80B7ED54(BgIkanaBlock* this) { @@ -144,7 +144,7 @@ void func_80B7ED54(BgIkanaBlock* this) { this->unk_170 = sp18.y - 30.0f; } -s32 func_80B7EDC4(BgIkanaBlock* this, GlobalContext* globalCtx) { +s32 func_80B7EDC4(BgIkanaBlock* this, PlayState* play) { s32 pad; Vec3f sp30; s32 sp2C; @@ -153,26 +153,26 @@ s32 func_80B7EDC4(BgIkanaBlock* this, GlobalContext* globalCtx) { sp30.y = this->dyna.actor.world.pos.y + this->unk_170 + 40.0f; sp30.z = this->dyna.actor.world.pos.z; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5_2( - globalCtx, &globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp2C, &this->dyna.actor, &sp30); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &this->dyna.actor.floorPoly, + &sp2C, &this->dyna.actor, &sp30); this->dyna.actor.floorBgId = sp2C; return ((this->dyna.actor.world.pos.y + this->unk_170) - this->dyna.actor.floorHeight) < 2.0f; } -s32 func_80B7EE70(BgIkanaBlock* this, GlobalContext* globalCtx) { - if (func_80B7EDC4(this, globalCtx)) { +s32 func_80B7EE70(BgIkanaBlock* this, PlayState* play) { + if (func_80B7EDC4(this, play)) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight - this->unk_170; return true; } return false; } -s32 func_80B7EEB4(BgIkanaBlock* this, GlobalContext* globalCtx) { - func_80B7EDC4(this, globalCtx); +s32 func_80B7EEB4(BgIkanaBlock* this, PlayState* play) { + func_80B7EDC4(this, play); if (this->dyna.actor.floorHeight > (BGCHECK_Y_MIN + 1.0f)) { - if (DynaPoly_GetActor(&globalCtx->colCtx, this->dyna.actor.floorBgId)) { + if (DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId)) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight - this->unk_170; return true; } @@ -180,23 +180,23 @@ s32 func_80B7EEB4(BgIkanaBlock* this, GlobalContext* globalCtx) { return false; } -void BgIkanaBlock_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBlock_Init(Actor* thisx, PlayState* play) { BgIkanaBlock* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPolyActor_LoadMesh(play, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_15C = Lib_SegmentedToVirtual(gameplay_dangeon_keep_Matanimheader_01B370); this->unk_174 = this->dyna.actor.shape.rot; func_80B7ED54(this); func_80B7F00C(this); } -void BgIkanaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBlock_Destroy(Actor* thisx, PlayState* play) { BgIkanaBlock* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B7F00C(BgIkanaBlock* this) { @@ -205,13 +205,13 @@ void func_80B7F00C(BgIkanaBlock* this) { this->actionFunc = func_80B7F034; } -void func_80B7F034(BgIkanaBlock* this, GlobalContext* globalCtx) { +void func_80B7F034(BgIkanaBlock* this, PlayState* play) { if (this->unk_17D > 0) { this->unk_17D--; } - if (func_80B7EEB4(this, globalCtx)) { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (func_80B7EEB4(this, play)) { + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = func_80B7F564; func_80B7F0A4(this); } @@ -224,7 +224,7 @@ void func_80B7F0A4(BgIkanaBlock* this) { this->actionFunc = func_80B7F0D0; } -void func_80B7F0D0(BgIkanaBlock* this, GlobalContext* globalCtx) { +void func_80B7F0D0(BgIkanaBlock* this, PlayState* play) { s32 sp24 = 0; s32 phi_v1; @@ -233,12 +233,12 @@ void func_80B7F0D0(BgIkanaBlock* this, GlobalContext* globalCtx) { if (this->unk_17C & 4) { sp24 = 1; - } else if (func_80B7ECFC(this, globalCtx)) { + } else if (func_80B7ECFC(this, play)) { sp24 = 2; } if ((sp24 != 2) && (this->unk_17A & (0x8 | 0x4 | 0x2 | 0x1))) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; @@ -285,22 +285,22 @@ void func_80B7F1A8(BgIkanaBlock* this) { this->actionFunc = func_80B7F290; } -void func_80B7F290(BgIkanaBlock* this, GlobalContext* globalCtx) { +void func_80B7F290(BgIkanaBlock* this, PlayState* play) { s32 pad; Math_StepToF(&this->unk_16C, 2.0f, 0.4f); if (Math_StepToF(this->unk_164, this->unk_168, this->unk_16C)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!func_80B7EB94(this, globalCtx)) { + if (!func_80B7EB94(this, play)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; - if (func_80B7EDC4(this, globalCtx)) { + if (func_80B7EDC4(this, play)) { func_80B7F0A4(this); } else { func_80B7F360(this); @@ -318,7 +318,7 @@ void func_80B7F360(BgIkanaBlock* this) { this->actionFunc = func_80B7F398; } -void func_80B7F398(BgIkanaBlock* this, GlobalContext* globalCtx) { +void func_80B7F398(BgIkanaBlock* this, PlayState* play) { if (this->unk_17D > 0) { this->unk_17D--; return; @@ -333,16 +333,16 @@ void func_80B7F398(BgIkanaBlock* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; - if (func_80B7EE70(this, globalCtx)) { + if (func_80B7EE70(this, play)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Actor_PlaySfxAtPos( - &this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + SFX_FLAG); + Actor_PlaySfxAtPos(&this->dyna.actor, + SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + + SFX_FLAG); func_80B7F0A4(this); } } -void BgIkanaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBlock_Update(Actor* thisx, PlayState* play) { BgIkanaBlock* this = THIS; if ((this->dyna.actor.shape.rot.x != this->unk_174.x) || (this->dyna.actor.shape.rot.y != this->unk_174.y) || @@ -351,7 +351,7 @@ void BgIkanaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B7ED54(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->dyna.actor, 30.0f); @@ -369,18 +369,18 @@ void BgIkanaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B7F564(Actor* thisx, GlobalContext* globalCtx) { +void func_80B7F564(Actor* thisx, PlayState* play) { s32 pad; BgIkanaBlock* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - AnimatedMat_DrawStep(globalCtx, this->unk_15C, 0); + func_8012C28C(play->state.gfxCtx); + AnimatedMat_DrawStep(play, this->unk_15C, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0xFF, 0xFF, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_dangeon_keep_DL_0182A8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h index 3ad797cbab..1eba0e6b67 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h @@ -5,7 +5,7 @@ struct BgIkanaBlock; -typedef void (*BgIkanaBlockActionFunc)(struct BgIkanaBlock*, GlobalContext*); +typedef void (*BgIkanaBlockActionFunc)(struct BgIkanaBlock*, PlayState*); typedef struct BgIkanaBlock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c index bc08c94516..43627317e1 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c @@ -11,19 +11,19 @@ #define THIS ((BgIkanaBombwall*)thisx) -void BgIkanaBombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaBombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaBombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaBombwall_Init(Actor* thisx, PlayState* play); +void BgIkanaBombwall_Destroy(Actor* thisx, PlayState* play); +void BgIkanaBombwall_Update(Actor* thisx, PlayState* play); +void BgIkanaBombwall_Draw(Actor* thisx, PlayState* play); void func_80BD4F18(BgIkanaBombwall* this); -void func_80BD4F2C(BgIkanaBombwall* this, GlobalContext* globalCtx); +void func_80BD4F2C(BgIkanaBombwall* this, PlayState* play); void func_80BD4F88(BgIkanaBombwall* this); -void func_80BD4F9C(BgIkanaBombwall* this, GlobalContext* globalCtx); +void func_80BD4F9C(BgIkanaBombwall* this, PlayState* play); void func_80BD4FF8(BgIkanaBombwall* this); -void func_80BD503C(BgIkanaBombwall* this, GlobalContext* globalCtx); +void func_80BD503C(BgIkanaBombwall* this, PlayState* play); void func_80BD5118(BgIkanaBombwall* this); -void func_80BD5134(BgIkanaBombwall* this, GlobalContext* globalCtx); +void func_80BD5134(BgIkanaBombwall* this, PlayState* play); const ActorInit Bg_Ikana_Bombwall_InitVars = { ACTOR_BG_IKANA_BOMBWALL, @@ -97,7 +97,7 @@ Gfx* D_80BD52E0[] = { }; #ifdef NON_MATCHING -void func_80BD4720(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD4720(BgIkanaBombwall* this, PlayState* play) { s32 i; Vec3f spE0; Vec3f spD4; @@ -139,7 +139,7 @@ void func_80BD4720(BgIkanaBombwall* this, GlobalContext* globalCtx) { if ((i & 3) == 0) { phi_s0 = 32; - func_800BBFB0(globalCtx, &spE0, 50.0f, 2, 100, 120, 1); + func_800BBFB0(play, &spE0, 50.0f, 2, 100, 120, 1); } else { phi_s0 = 64; } @@ -157,18 +157,18 @@ void func_80BD4720(BgIkanaBombwall* this, GlobalContext* globalCtx) { temp = -450; } - EffectSsKakera_Spawn(globalCtx, &spE0, &spD4, &spE0, temp, phi_s0, 30, 0, 0, D_80BD52C8[i & 3], phi_t0, 0, 50, - -1, OBJECT_IKANA_OBJ, object_ikana_obj_DL_000288); + EffectSsKakera_Spawn(play, &spE0, &spD4, &spE0, temp, phi_s0, 30, 0, 0, D_80BD52C8[i & 3], phi_t0, 0, 50, -1, + OBJECT_IKANA_OBJ, object_ikana_obj_DL_000288); } Matrix_Pop(); } #else -void func_80BD4720(BgIkanaBombwall* this, GlobalContext* globalCtx); +void func_80BD4720(BgIkanaBombwall* this, PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikana_Bombwall/func_80BD4720.s") #endif -void func_80BD4A14(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD4A14(BgIkanaBombwall* this, PlayState* play) { s32 i; Vec3f spD8; Vec3f spCC; @@ -217,17 +217,17 @@ void func_80BD4A14(BgIkanaBombwall* this, GlobalContext* globalCtx) { phi_t0 = -400; } - EffectSsKakera_Spawn(globalCtx, &spD8, &spCC, &spD8, phi_t0, phi_v0, 30, 0, 0, temp_v1, phi_v1, 0, 50, -1, + EffectSsKakera_Spawn(play, &spD8, &spCC, &spD8, phi_t0, phi_v0, 30, 0, 0, temp_v1, phi_v1, 0, 50, -1, OBJECT_IKANA_OBJ, object_ikana_obj_DL_000288); if ((i & 3) == 0) { spD8.y += 30.0f; - func_800BBFB0(globalCtx, &spD8, 50.0f, 2, 70, 110, 1); + func_800BBFB0(play, &spD8, 50.0f, 2, 70, 110, 1); } } } -void BgIkanaBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBombwall_Init(Actor* thisx, PlayState* play) { s32 pad; BgIkanaBombwall* this = THIS; s32 sp2C = BGIKANABOMBWALL_GET_100(&this->dyna.actor); @@ -236,9 +236,9 @@ void BgIkanaBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(globalCtx, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor))) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -251,8 +251,8 @@ void BgIkanaBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { sp24 = &sCylinderInit2; } - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, sp28); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, sp24); + DynaPolyActor_LoadMesh(play, &this->dyna, sp28); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, sp24); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); if (sp2C == 0) { @@ -262,11 +262,11 @@ void BgIkanaBombwall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIkanaBombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBombwall_Destroy(Actor* thisx, PlayState* play) { BgIkanaBombwall* this = THIS; - 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); } s32 func_80BD4E44(BgIkanaBombwall* this) { @@ -293,11 +293,11 @@ void func_80BD4F18(BgIkanaBombwall* this) { this->actionFunc = func_80BD4F2C; } -void func_80BD4F2C(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD4F2C(BgIkanaBombwall* this, PlayState* play) { if (func_80BD4E44(this)) { func_80BD4FF8(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -305,11 +305,11 @@ void func_80BD4F88(BgIkanaBombwall* this) { this->actionFunc = func_80BD4F9C; } -void func_80BD4F9C(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD4F9C(BgIkanaBombwall* this, PlayState* play) { if (func_80BD4EAC(this)) { func_80BD4FF8(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -319,19 +319,19 @@ void func_80BD4FF8(BgIkanaBombwall* this) { this->actionFunc = func_80BD503C; } -void func_80BD503C(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD503C(BgIkanaBombwall* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { - func_80BD4720(this, globalCtx); + func_80BD4720(this, play); } else { - func_80BD4A14(this, globalCtx); + func_80BD4A14(this, play); } this->dyna.actor.draw = NULL; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(globalCtx, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); + Flags_SetSwitch(play, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor)); if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } func_80BD5118(this); } else { @@ -344,7 +344,7 @@ void func_80BD5118(BgIkanaBombwall* this) { this->actionFunc = func_80BD5134; } -void func_80BD5134(BgIkanaBombwall* this, GlobalContext* globalCtx) { +void func_80BD5134(BgIkanaBombwall* this, PlayState* play) { if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { this->unk_1AC--; if (this->unk_1AC <= 0) { @@ -360,12 +360,12 @@ void func_80BD5134(BgIkanaBombwall* this, GlobalContext* globalCtx) { } } -void BgIkanaBombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaBombwall_Update(Actor* thisx, PlayState* play) { BgIkanaBombwall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIkanaBombwall_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80BD52E0[BGIKANABOMBWALL_GET_100(thisx)]); +void BgIkanaBombwall_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80BD52E0[BGIKANABOMBWALL_GET_100(thisx)]); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.h b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.h index 37921ba537..1a5850232b 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.h @@ -5,7 +5,7 @@ struct BgIkanaBombwall; -typedef void (*BgIkanaBombwallActionFunc)(struct BgIkanaBombwall*, GlobalContext*); +typedef void (*BgIkanaBombwallActionFunc)(struct BgIkanaBombwall*, PlayState*); #define BGIKANABOMBWALL_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) #define BGIKANABOMBWALL_GET_100(thisx) (((thisx)->params >> 8) & 1) diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index 6048a8c9cf..24cb903963 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -11,17 +11,17 @@ #define THIS ((BgIkanaDharma*)thisx) -void BgIkanaDharma_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaDharma_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaDharma_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaDharma_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaDharma_Init(Actor* thisx, PlayState* play); +void BgIkanaDharma_Destroy(Actor* thisx, PlayState* play); +void BgIkanaDharma_Update(Actor* thisx, PlayState* play); +void BgIkanaDharma_Draw(Actor* thisx, PlayState* play); void BgIkanaDharma_SetupWaitForHit(BgIkanaDharma* this); -void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, GlobalContext* globalCtx); +void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play); void BgIkanaDharma_SetupStartCutscene(BgIkanaDharma* this); -void BgIkanaDharma_StartCutscene(BgIkanaDharma* this, GlobalContext* globalCtx); +void BgIkanaDharma_StartCutscene(BgIkanaDharma* this, PlayState* play); void BgIkanaDharma_SetupWaitForCutsceneToEnd(BgIkanaDharma* this); -void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, GlobalContext* globalCtx); +void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, PlayState* play); const ActorInit Bg_Ikana_Dharma_InitVars = { ACTOR_BG_IKANA_DHARMA, @@ -64,7 +64,7 @@ static InitChainEntry sInitChain[] = { static BgIkanaDharma* sFirstHitBgIkanaDharma; -void BgIkanaDharma_SpawnEffects(BgIkanaDharma* this, GlobalContext* globalCtx) { +void BgIkanaDharma_SpawnEffects(BgIkanaDharma* this, PlayState* play) { s32 pad; Vec3f pos; Vec3f velocity; @@ -88,12 +88,12 @@ void BgIkanaDharma_SpawnEffects(BgIkanaDharma* this, GlobalContext* globalCtx) { accel.x = velocity.x * -0.05f; accel.y = -0.15f; accel.z = velocity.z * -0.05f; - EffectSsKirakira_SpawnSmallYellow(globalCtx, &pos, &velocity, &accel); + EffectSsKirakira_SpawnSmallYellow(play, &pos, &velocity, &accel); } } -void BgIkanaDharma_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgIkanaDharma_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgIkanaDharma* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -101,9 +101,9 @@ void BgIkanaDharma_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.scale.y = 0.1f; this->dyna.actor.scale.z = 0.3f; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gStoneTowerTemplePunchablePillarCol); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &gStoneTowerTemplePunchablePillarCol); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); if (!BGIKANADHARMA_IS_CHILD(&this->dyna.actor)) { f32 segmentY = this->dyna.actor.world.pos.y; s32 numSegments = BGIKANADHARMA_NUM_SEGMENTS(&this->dyna.actor); @@ -111,11 +111,11 @@ void BgIkanaDharma_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < numSegments; i++) { segmentY += 60.0f; - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_IKANA_DHARMA, - this->dyna.actor.world.pos.x, segmentY, this->dyna.actor.world.pos.z, - this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, - this->dyna.actor.shape.rot.z, BGIKANADHARMA_PARAMS(0, true, 0), - this->dyna.actor.cutscene, this->dyna.actor.unk20, NULL); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_IKANA_DHARMA, this->dyna.actor.world.pos.x, + segmentY, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, + this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, + BGIKANADHARMA_PARAMS(0, true, 0), this->dyna.actor.cutscene, + this->dyna.actor.unk20, NULL); } this->dyna.actor.bgCheckFlags |= 1; @@ -124,11 +124,11 @@ void BgIkanaDharma_Init(Actor* thisx, GlobalContext* globalCtx2) { BgIkanaDharma_SetupWaitForHit(this); } -void BgIkanaDharma_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaDharma_Destroy(Actor* thisx, PlayState* play) { BgIkanaDharma* this = THIS; - 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); if (sFirstHitBgIkanaDharma == this) { sFirstHitBgIkanaDharma = NULL; } @@ -139,9 +139,9 @@ void BgIkanaDharma_SetupWaitForHit(BgIkanaDharma* this) { this->dyna.actor.speedXZ = 0.0f; } -void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, GlobalContext* globalCtx) { +void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { s32 wasHit = (this->collider.base.acFlags & AC_HIT) != 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BgIkanaDharma* this2 = this; s32 tempAngle1; s32 tempAngle2; @@ -152,7 +152,7 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, GlobalContext* globalCtx) { if (wasHit && sFirstHitBgIkanaDharma == NULL) { sFirstHitBgIkanaDharma = this2; - Flags_SetSwitch(globalCtx, BGIKANADHARMA_GET_SWITCHFLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BGIKANADHARMA_GET_SWITCHFLAG(&this->dyna.actor)); tempAngle1 = BINANG_ADD(this->dyna.actor.yawTowardsPlayer, 0x8000); tempAngle2 = (BINANG_SUB(player->actor.shape.rot.y, tempAngle1) >> 1); this->dyna.actor.world.rot.y = tempAngle1 + tempAngle2 + 0xF000; @@ -166,7 +166,7 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, GlobalContext* globalCtx) { if (tempAngle1 > 0x4000) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -176,7 +176,7 @@ void BgIkanaDharma_SetupStartCutscene(BgIkanaDharma* this) { this->actionFunc = BgIkanaDharma_StartCutscene; } -void BgIkanaDharma_StartCutscene(BgIkanaDharma* this, GlobalContext* globalCtx) { +void BgIkanaDharma_StartCutscene(BgIkanaDharma* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); BgIkanaDharma_SetupWaitForCutsceneToEnd(this); @@ -190,7 +190,7 @@ void BgIkanaDharma_SetupWaitForCutsceneToEnd(BgIkanaDharma* this) { this->actionFunc = BgIkanaDharma_WaitForCutsceneToEnd; } -void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, GlobalContext* globalCtx) { +void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, PlayState* play) { if (this->cutsceneFramesRemaining > 0) { this->cutsceneFramesRemaining--; @@ -208,25 +208,25 @@ void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, GlobalContext* glob } else { this->dyna.actor.scale.x = this->dyna.actor.scale.y * 3.0f; this->dyna.actor.scale.z = this->dyna.actor.scale.y * 3.0f; - BgIkanaDharma_SpawnEffects(this, globalCtx); + BgIkanaDharma_SpawnEffects(this, play); } } -void BgIkanaDharma_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { BgIkanaDharma* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc == BgIkanaDharma_WaitForHit) { DynaPolyActor* actorBelow; s32 pad[2]; - func_800B4AEC(globalCtx, &this->dyna.actor, 30.0f); - actorBelow = DynaPoly_GetActor(&globalCtx->colCtx, this->dyna.actor.floorBgId); + func_800B4AEC(play, &this->dyna.actor, 30.0f); + actorBelow = DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId); if (actorBelow == NULL) { Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); if (this->dyna.actor.bgCheckFlags & 2) { - s16 quake = Quake_Add(globalCtx->cameraPtrs[globalCtx->activeCamera], 3); + s16 quake = Quake_Add(play->cameraPtrs[play->activeCamera], 3); Quake_SetSpeed(quake, 21536); Quake_SetQuakeValues(quake, 4, 0, 0, 0); @@ -247,14 +247,14 @@ void BgIkanaDharma_Update(Actor* thisx, GlobalContext* globalCtx) { wallCheckRadius = CLAMP_MIN(wallCheckRadius, 2.0f); Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, wallCheckRadius, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, wallCheckRadius, 0.0f, 5); } Actor_SetFocus(&this->dyna.actor, 40.0f); } -void BgIkanaDharma_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaDharma_Draw(Actor* thisx, PlayState* play) { BgIkanaDharma* this = THIS; - Gfx_DrawDListOpa(globalCtx, gStoneTowerTemplePunchablePillarDL); + Gfx_DrawDListOpa(play, gStoneTowerTemplePunchablePillarDL); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.h b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.h index bf769a1a15..11a962b4ec 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.h @@ -10,7 +10,7 @@ struct BgIkanaDharma; -typedef void (*BgIkanaDharmaActionFunc)(struct BgIkanaDharma*, GlobalContext*); +typedef void (*BgIkanaDharmaActionFunc)(struct BgIkanaDharma*, PlayState*); typedef struct BgIkanaDharma { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c index de45de35bc..0a3b7b4456 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.c @@ -10,10 +10,10 @@ #define THIS ((BgIkanaMirror*)thisx) -void BgIkanaMirror_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaMirror_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaMirror_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaMirror_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaMirror_Init(Actor* thisx, PlayState* play); +void BgIkanaMirror_Destroy(Actor* thisx, PlayState* play); +void BgIkanaMirror_Update(Actor* thisx, PlayState* play); +void BgIkanaMirror_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Ikana_Mirror_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.h b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.h index fc50c760da..c9f8812084 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Mirror/z_bg_ikana_mirror.h @@ -5,7 +5,7 @@ struct BgIkanaMirror; -typedef void (*BgIkanaMirrorActionFunc)(struct BgIkanaMirror*, GlobalContext*); +typedef void (*BgIkanaMirrorActionFunc)(struct BgIkanaMirror*, PlayState*); typedef struct BgIkanaMirror { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c index d0ec425224..f4d9648172 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c @@ -11,15 +11,15 @@ #define THIS ((BgIkanaRay*)thisx) -void BgIkanaRay_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRay_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRay_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRay_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaRay_Init(Actor* thisx, PlayState* play); +void BgIkanaRay_Destroy(Actor* thisx, PlayState* play); +void BgIkanaRay_Update(Actor* thisx, PlayState* play); +void BgIkanaRay_Draw(Actor* thisx, PlayState* play); void BgIkanaRay_SetDeactivated(BgIkanaRay* this); -void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, GlobalContext* globalCtx); +void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, PlayState* play); void BgIkanaRay_SetActivated(BgIkanaRay* this); -void BgIkanaRay_UpdateActivated(BgIkanaRay* this, GlobalContext* globalCtx); +void BgIkanaRay_UpdateActivated(BgIkanaRay* this, PlayState* play); const ActorInit Bg_Ikana_Ray_InitVars = { ACTOR_BG_IKANA_RAY, @@ -60,29 +60,29 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgIkanaRay_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRay_Init(Actor* thisx, PlayState* play) { BgIkanaRay* this = THIS; ColliderCylinder* collision = &this->collision; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, collision); - Collider_SetCylinder(globalCtx, collision, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, collision); + Collider_SetCylinder(play, collision, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collision); this->animatedTextures = Lib_SegmentedToVirtual(object_ikana_obj_Matanimheader_001228); - if (Flags_GetSwitch(globalCtx, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { + if (Flags_GetSwitch(play, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { BgIkanaRay_SetActivated(this); } else { BgIkanaRay_SetDeactivated(this); } } -void BgIkanaRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRay_Destroy(Actor* thisx, PlayState* play) { BgIkanaRay* this = THIS; ColliderCylinder* collision = &this->collision; - Collider_DestroyCylinder(globalCtx, collision); + Collider_DestroyCylinder(play, collision); } void BgIkanaRay_SetDeactivated(BgIkanaRay* this) { @@ -91,8 +91,8 @@ void BgIkanaRay_SetDeactivated(BgIkanaRay* this) { this->actionFunc = BgIkanaRay_UpdateCheckForActivation; } -void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { +void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, PlayState* play) { + if (Flags_GetSwitch(play, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { BgIkanaRay_SetActivated(this); } } @@ -103,19 +103,19 @@ void BgIkanaRay_SetActivated(BgIkanaRay* this) { this->actionFunc = BgIkanaRay_UpdateActivated; } -void BgIkanaRay_UpdateActivated(BgIkanaRay* this, GlobalContext* globalCtx) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collision.base); +void BgIkanaRay_UpdateActivated(BgIkanaRay* this, PlayState* play) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collision.base); } -void BgIkanaRay_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRay_Update(Actor* thisx, PlayState* play) { BgIkanaRay* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIkanaRay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRay_Draw(Actor* thisx, PlayState* play) { BgIkanaRay* this = THIS; - AnimatedMat_Draw(globalCtx, this->animatedTextures); - Gfx_DrawDListXlu(globalCtx, object_ikana_obj_DL_001100); + AnimatedMat_Draw(play, this->animatedTextures); + Gfx_DrawDListXlu(play, object_ikana_obj_DL_001100); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h index 7c8d8c3693..9aa4f89d4a 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h @@ -5,7 +5,7 @@ struct BgIkanaRay; -typedef void (*BgIkanaRayActionFunc)(struct BgIkanaRay*, GlobalContext*); +typedef void (*BgIkanaRayActionFunc)(struct BgIkanaRay*, PlayState*); #define BGIKANARAY_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index d395fd6ee0..90de39bf4d 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -13,24 +13,24 @@ #define THIS ((BgIkanaRotaryroom*)thisx) -void BgIkanaRotaryroom_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRotaryroom_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRotaryroom_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaRotaryroom_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaRotaryroom_Init(Actor* thisx, PlayState* play); +void BgIkanaRotaryroom_Destroy(Actor* thisx, PlayState* play); +void BgIkanaRotaryroom_Update(Actor* thisx, PlayState* play); +void BgIkanaRotaryroom_Draw(Actor* thisx, PlayState* play); -void func_80B814B8(BgIkanaRotaryroom* this, GlobalContext* globalCtx); +void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play); void func_80B818B4(BgIkanaRotaryroom* this); -void func_80B818C8(Actor* thisx, GlobalContext* globalCtx); +void func_80B818C8(Actor* thisx, PlayState* play); void func_80B81978(BgIkanaRotaryroom* this); -void func_80B8198C(Actor* thisx, GlobalContext* globalCtx); +void func_80B8198C(Actor* thisx, PlayState* play); void func_80B819DC(BgIkanaRotaryroom* this); -void func_80B819F0(Actor* thisx, GlobalContext* globalCtx); +void func_80B819F0(Actor* thisx, PlayState* play); void func_80B81A64(BgIkanaRotaryroom* this); -void func_80B81A80(Actor* thisx, GlobalContext* globalCtx); +void func_80B81A80(Actor* thisx, PlayState* play); void func_80B81B84(BgIkanaRotaryroom* this); -void func_80B81BA0(Actor* thisx, GlobalContext* globalCtx); +void func_80B81BA0(Actor* thisx, PlayState* play); void func_80B81DAC(BgIkanaRotaryroom* this); -void func_80B81DC8(Actor* thisx, GlobalContext* globalCtx); +void func_80B81DC8(Actor* thisx, PlayState* play); const ActorInit Bg_Ikana_Rotaryroom_InitVars = { ACTOR_BG_IKANA_ROTARYROOM, @@ -160,14 +160,14 @@ void func_80B80358(Vec3f* arg0) { arg0->z = (s32)arg0->z; } -void func_80B80440(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B80440(BgIkanaRotaryroom* this, PlayState* play) { s32 pad; Vec3f sp50; Matrix_Push(); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); - if (Flags_GetSwitch(globalCtx, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor))) { Matrix_Translate(D_80B82178.x, D_80B82178.y, D_80B82178.z, MTXMODE_APPLY); } else { Matrix_Translate(D_80B8216C.x, D_80B8216C.y, D_80B8216C.z, MTXMODE_APPLY); @@ -175,13 +175,13 @@ void func_80B80440(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_MultZero(&sp50); func_80B80358(&sp50); this->unk_204.unk_00 = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_BG_IKANA_BLOCK, sp50.x, sp50.y, sp50.z, this->dyna.actor.shape.rot.x, + &play->actorCtx, play, ACTOR_BG_IKANA_BLOCK, sp50.x, sp50.y, sp50.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, -1, ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene), this->dyna.actor.unk20, NULL); Matrix_Pop(); } -void func_80B80550(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B80550(BgIkanaRotaryroom* this, PlayState* play) { s32 pad; s32 spC8 = BGIKANAROTARYROOM_GET_1(&this->dyna.actor); s32 spC4; @@ -193,13 +193,13 @@ void func_80B80550(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { MtxF sp68; Vec3s sp60; - if (Flags_GetSwitch(globalCtx, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { spC4 = 1; } else { spC4 = 0; } - actor = globalCtx->actorCtx.actorLists[ACTORCAT_DOOR].first; + actor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; Matrix_Push(); sp60.x = BINANG_ROT180(this->dyna.actor.home.rot.x); sp60.y = this->dyna.actor.home.rot.y; @@ -235,7 +235,7 @@ void func_80B80550(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_Pop(); } -BgIkanaRotaryroomStruct4* func_80B80778(BgIkanaRotaryroom* this, GlobalContext* globalCtx, Actor* arg2) { +BgIkanaRotaryroomStruct4* func_80B80778(BgIkanaRotaryroom* this, PlayState* play, Actor* arg2) { s32 i; Vec3f sp68; s32 pad[2]; @@ -264,7 +264,7 @@ BgIkanaRotaryroomStruct4* func_80B80778(BgIkanaRotaryroom* this, GlobalContext* return sp58; } -void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B80894(BgIkanaRotaryroom* this, PlayState* play) { s32 pad[7]; Actor* actor = this->unk_204.unk_00; s32 i; @@ -293,10 +293,10 @@ void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { this->unk_248[i].unk_00 = NULL; } - actor = globalCtx->actorCtx.actorLists[ACTORCAT_DOOR].first; + actor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; i = 0; while (actor != NULL) { - if (func_80B80778(this, globalCtx, actor) && (i < 2)) { + if (func_80B80778(this, play, actor) && (i < 2)) { this->unk_248[i].unk_00 = actor; Matrix_Push(); @@ -317,7 +317,7 @@ void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { this->unk_2D0[i].unk_00 = NULL; } - actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; i = 0; while (actor != NULL) { if ((actor->id == ACTOR_EN_TORCH2) && (actor->update != NULL) && (i < ARRAY_COUNT(this->unk_2D0))) { @@ -341,7 +341,7 @@ void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { this->unk_3E0[i].unk_00 = NULL; } - actor = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; + actor = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; i = 0; while (actor != NULL) { if ((actor->update != NULL) && (actor->id != ACTOR_EN_WATER_EFFECT) && (i < ARRAY_COUNT(this->unk_3E0))) { @@ -363,7 +363,7 @@ void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { actor = actor->next; } - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; if (actor->update != NULL) { this->unk_520.unk_40 = actor->shape.rot; @@ -381,7 +381,7 @@ void func_80B80894(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_Pop(); } -void func_80B80C88(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B80C88(BgIkanaRotaryroom* this, PlayState* play) { s32 pad[5]; BgIkanaBlock* ikanaBlock = (BgIkanaBlock*)this->unk_204.unk_00; Player* player; @@ -452,7 +452,7 @@ void func_80B80C88(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { } } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player != NULL) { Matrix_Push(); @@ -470,7 +470,7 @@ void func_80B80C88(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_Pop(); } -s32 func_80B80F08(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +s32 func_80B80F08(BgIkanaRotaryroom* this, PlayState* play) { s32 pad; BgIkanaBlock* ikanaBlock = (BgIkanaBlock*)this->unk_204.unk_00; Vec3f sp34; @@ -492,16 +492,16 @@ s32 func_80B80F08(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_Pop(); if (Math3D_Vec3fDistSq(&sp34, &sp28) < 3.0f) { - if (!Flags_GetSwitch(globalCtx, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor))) { sp24 = true; } - Flags_SetSwitch(globalCtx, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor)); + Flags_SetSwitch(play, BGIKANAROTARYROOM_GET_7F00(&this->dyna.actor)); } } return sp24; } -void func_80B81010(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B81010(BgIkanaRotaryroom* this, PlayState* play) { s32 pad; f32 temp_f0; s32 temp_s2; @@ -538,7 +538,7 @@ void func_80B81010(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { sp84.y = ptr->prevPos.y + 50.0f; sp84.z = ptr->prevPos.z; - temp_f0 = BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &sp7C, &sp78, NULL, &sp84); + temp_f0 = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &sp7C, &sp78, NULL, &sp84); if (ptr->world.pos.y <= temp_f0) { ptr->world.pos.y = temp_f0; } else { @@ -568,9 +568,9 @@ void func_80B81010(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { } } -void func_80B81234(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B81234(BgIkanaRotaryroom* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BgIkanaRotaryroomStruct3* ptr; s32 sp64; Vec3f sp58; @@ -612,7 +612,7 @@ void func_80B81234(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { Matrix_Pop(); - temp_f0 = BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &sp40, &sp3C, NULL, &sp58); + temp_f0 = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &sp40, &sp3C, NULL, &sp58); if (ptr->unk_4C.y <= temp_f0) { ptr->unk_4C.y = temp_f0; } else { @@ -641,15 +641,15 @@ void func_80B81234(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { } } -void func_80B814B8(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { if (player->actor.bgCheckFlags & 0x100) { func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); - func_80169EFC(&globalCtx->state); + func_80169EFC(&play->state); func_800B8E58(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->unk_92); - globalCtx->unk_18845 = 1; + play->unk_18845 = 1; play_sound(NA_SE_OC_ABYSS); this->actionFunc = NULL; } @@ -658,7 +658,7 @@ void func_80B814B8(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { } } -void func_80B81570(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { +void func_80B81570(BgIkanaRotaryroom* this, PlayState* play) { s32 i; Vec3f sp70; Vec3f sp64; @@ -679,7 +679,7 @@ void func_80B81570(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { sp70.y += this->dyna.actor.world.pos.y; sp70.z += this->dyna.actor.world.pos.z; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0, 1); } Matrix_Pop(); @@ -698,27 +698,27 @@ s32 func_80B816A4(BgIkanaRotaryroom* this) { return count; } -void BgIkanaRotaryroom_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRotaryroom_Init(Actor* thisx, PlayState* play) { s32 pad; BgIkanaRotaryroom* this = THIS; s32 sp34 = BGIKANAROTARYROOM_GET_1(&this->dyna.actor); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(globalCtx, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { this->dyna.actor.shape.rot.x = -0x8000; } else { this->dyna.actor.shape.rot.x = 0; } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, D_80B82218[sp34]); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80B82218[sp34]); - Collider_InitJntSph(globalCtx, &this->collider); + Collider_InitJntSph(play, &this->collider); if (!sp34) { - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit1, this->colliderElements); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit1, this->colliderElements); } else { - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit2, this->colliderElements); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit2, this->colliderElements); } func_80B802E0(this); @@ -728,41 +728,41 @@ void BgIkanaRotaryroom_Init(Actor* thisx, GlobalContext* globalCtx) { } if (!sp34) { - func_80B80440(this, globalCtx); + func_80B80440(this, play); } else { - func_80B81570(this, globalCtx); + func_80B81570(this, play); } - func_80B80550(this, globalCtx); + func_80B80550(this, play); func_80B818B4(this); } -void BgIkanaRotaryroom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRotaryroom_Destroy(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; - 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_80B818B4(BgIkanaRotaryroom* this) { this->unk_200 = func_80B818C8; } -void func_80B818C8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B818C8(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; s32 sp20; if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; sp20 = BGIKANAROTARYROOM_GET_FE(&this->dyna.actor); - if (Flags_GetSwitch(globalCtx, sp20)) { - Flags_UnsetSwitch(globalCtx, sp20); + if (Flags_GetSwitch(play, sp20)) { + Flags_UnsetSwitch(play, sp20); } else { - Flags_SetSwitch(globalCtx, sp20); + Flags_SetSwitch(play, sp20); } func_80B81978(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -770,7 +770,7 @@ void func_80B81978(BgIkanaRotaryroom* this) { this->unk_200 = func_80B8198C; } -void func_80B8198C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B8198C(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; if (this->unk_204.unk_00 == NULL) { @@ -785,13 +785,13 @@ void func_80B819DC(BgIkanaRotaryroom* this) { this->unk_200 = func_80B819F0; } -void func_80B819F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B819F0(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); if (this->dyna.actor.cutscene >= 0) { - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_800B7298(play, &this->dyna.actor, 7); } func_80B81A64(this); } else { @@ -804,7 +804,7 @@ void func_80B81A64(BgIkanaRotaryroom* this) { this->unk_200 = func_80B81A80; } -void func_80B81A80(Actor* thisx, GlobalContext* globalCtx) { +void func_80B81A80(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; s32 pad; s32 i; @@ -818,7 +818,7 @@ void func_80B81A80(Actor* thisx, GlobalContext* globalCtx) { if (1) {} if (1) {} if (1) {} - func_80B80894(this, globalCtx); + func_80B80894(this, play); for (i = 0; i < ARRAY_COUNT(this->unk_2D0); i++) { ptr = &this->unk_2D0[i]; @@ -829,7 +829,7 @@ void func_80B81A80(Actor* thisx, GlobalContext* globalCtx) { func_80B81B84(this); } else if (this->unk_584 == 15) { - s16 sp26 = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 sp26 = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(sp26, 0x7B30); Quake_SetQuakeValues(sp26, 6, 0, 100, 0); @@ -842,7 +842,7 @@ void func_80B81B84(BgIkanaRotaryroom* this) { this->unk_200 = func_80B81BA0; } -void func_80B81BA0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B81BA0(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; s32 sp30 = 0; s32 i; @@ -856,14 +856,14 @@ void func_80B81BA0(Actor* thisx, GlobalContext* globalCtx) { thisx->shape.rot.x += 0x1F4; if (!(this->unk_584 & 7)) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x7B30); Quake_SetQuakeValues(quake, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0); Quake_SetCountdown(quake, 15); } - if (Flags_GetSwitch(globalCtx, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { + if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { if (this->dyna.actor.shape.rot.x < 0) { this->dyna.actor.shape.rot.x = -0x8000; sp30 = 1; @@ -873,10 +873,10 @@ void func_80B81BA0(Actor* thisx, GlobalContext* globalCtx) { sp30 = 1; } - func_80B80C88(this, globalCtx); + func_80B80C88(this, play); if (sp30 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); BgIkanaRotaryroomStruct1* ptr; BgIkanaBlock* block = (BgIkanaBlock*)this->unk_204.unk_00; @@ -913,7 +913,7 @@ void func_80B81DAC(BgIkanaRotaryroom* this) { this->unk_200 = func_80B81DC8; } -void func_80B81DC8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B81DC8(Actor* thisx, PlayState* play) { s32 pad; BgIkanaRotaryroom* this = THIS; @@ -926,7 +926,7 @@ void func_80B81DC8(Actor* thisx, GlobalContext* globalCtx) { ActorCutscene_Stop(this->dyna.actor.cutscene); func_80B818B4(this); } else if (this->unk_584 == 19) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x4E20); Quake_SetQuakeValues(quake, 5, 0, 40, 60); @@ -934,7 +934,7 @@ void func_80B81DC8(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIkanaRotaryroom_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRotaryroom_Update(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; BgIkanaRotaryroomStruct1* ptr; BgIkanaRotaryroomStruct1* ptr2; @@ -966,37 +966,37 @@ void BgIkanaRotaryroom_Update(Actor* thisx, GlobalContext* globalCtx) { } } - if (func_80B80F08(this, globalCtx)) { + if (func_80B80F08(this, play)) { if (this->unk_204.unk_00 != NULL) { ((BgIkanaBlock*)this->unk_204.unk_00)->unk_17E = 1; } } - this->unk_200(&this->dyna.actor, globalCtx); + this->unk_200(&this->dyna.actor, play); if (this->unk_578 != NULL) { - this->unk_578(this, globalCtx); + this->unk_578(this, play); } if (this->unk_57C != NULL) { - this->unk_57C(this, globalCtx); + this->unk_57C(this, play); } if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void BgIkanaRotaryroom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaRotaryroom_Draw(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; s32 param = BGIKANAROTARYROOM_GET_1(&this->dyna.actor); if (!param) { - Gfx_DrawDListOpa(globalCtx, object_ikana_obj_DL_0048A0); - Gfx_DrawDListXlu(globalCtx, object_ikana_obj_DL_004710); + Gfx_DrawDListOpa(play, object_ikana_obj_DL_0048A0); + Gfx_DrawDListXlu(play, object_ikana_obj_DL_004710); } else { - AnimatedMat_Draw(globalCtx, this->unk_1FC); - Gfx_DrawDListOpa(globalCtx, object_ikana_obj_DL_007448); - Gfx_DrawDListXlu(globalCtx, object_ikana_obj_DL_007360); + AnimatedMat_Draw(play, this->unk_1FC); + Gfx_DrawDListOpa(play, object_ikana_obj_DL_007448); + Gfx_DrawDListXlu(play, object_ikana_obj_DL_007360); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.h b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.h index 1e27fb485c..e818eb77db 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.h @@ -5,9 +5,9 @@ struct BgIkanaRotaryroom; -typedef void (*BgIkanaRotaryroomActionFunc)(struct BgIkanaRotaryroom*, GlobalContext*); -typedef void (*BgIkanaRotaryroomUnkFunc)(Actor*, GlobalContext*); -typedef void (*BgIkanaRotaryroomUnkFunc2)(struct BgIkanaRotaryroom*, GlobalContext*); +typedef void (*BgIkanaRotaryroomActionFunc)(struct BgIkanaRotaryroom*, PlayState*); +typedef void (*BgIkanaRotaryroomUnkFunc)(Actor*, PlayState*); +typedef void (*BgIkanaRotaryroomUnkFunc2)(struct BgIkanaRotaryroom*, PlayState*); #define BGIKANAROTARYROOM_GET_1(thisx) ((thisx)->params & 1) #define BGIKANAROTARYROOM_GET_FE(thisx) (((thisx)->params >> 1) & 0x7F) diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c index 16060bbd21..618cc3ae61 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c @@ -11,29 +11,29 @@ #define THIS ((BgIkanaShutter*)thisx) -void BgIkanaShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkanaShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkanaShutter_Init(Actor* thisx, PlayState* play); +void BgIkanaShutter_Destroy(Actor* thisx, PlayState* play); +void BgIkanaShutter_Update(Actor* thisx, PlayState* play); +void BgIkanaShutter_Draw(Actor* thisx, PlayState* play); void func_80BD5828(BgIkanaShutter* this); -void func_80BD5844(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5844(BgIkanaShutter* this, PlayState* play); void func_80BD5878(BgIkanaShutter* this); -void func_80BD5894(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5894(BgIkanaShutter* this, PlayState* play); void func_80BD58F0(BgIkanaShutter* this); -void func_80BD5910(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5910(BgIkanaShutter* this, PlayState* play); void func_80BD599C(BgIkanaShutter* this); -void func_80BD59C4(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD59C4(BgIkanaShutter* this, PlayState* play); void func_80BD59F8(BgIkanaShutter* this); -void func_80BD5A18(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5A18(BgIkanaShutter* this, PlayState* play); void func_80BD5AE8(BgIkanaShutter* this); -void func_80BD5B04(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5B04(BgIkanaShutter* this, PlayState* play); void func_80BD5B44(BgIkanaShutter* this); -void func_80BD5B60(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5B60(BgIkanaShutter* this, PlayState* play); void func_80BD5BC4(BgIkanaShutter* this); -void func_80BD5BD8(BgIkanaShutter* this, GlobalContext* globalCtx); +void func_80BD5BD8(BgIkanaShutter* this, PlayState* play); void BgIkanaShutter_SetupDoNothing(BgIkanaShutter* this); -void BgIkanaShutter_DoNothing(BgIkanaShutter* this, GlobalContext* globalCtx); +void BgIkanaShutter_DoNothing(BgIkanaShutter* this, PlayState* play); const ActorInit Bg_Ikana_Shutter_InitVars = { ACTOR_BG_IKANA_SHUTTER, @@ -54,38 +54,38 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -s32 BgIkanaShutter_AllSwitchesPressed(BgIkanaShutter* this, GlobalContext* globalCtx) { - return Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x7F) && - Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x7F) + 1) && - Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x7F) + 2) && - Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x7F) + 3); +s32 BgIkanaShutter_AllSwitchesPressed(BgIkanaShutter* this, PlayState* play) { + return Flags_GetSwitch(play, this->dyna.actor.params & 0x7F) && + Flags_GetSwitch(play, (this->dyna.actor.params & 0x7F) + 1) && + Flags_GetSwitch(play, (this->dyna.actor.params & 0x7F) + 2) && + Flags_GetSwitch(play, (this->dyna.actor.params & 0x7F) + 3); } -void BgIkanaShutter_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaShutter_Init(Actor* thisx, PlayState* play) { BgIkanaShutter* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ikana_obj_Colheader_000F28); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ikana_obj_Colheader_000F28); if (!((this->dyna.actor.params >> 8) & 1)) { - if (BgIkanaShutter_AllSwitchesPressed(this, globalCtx)) { + if (BgIkanaShutter_AllSwitchesPressed(this, play)) { func_80BD599C(this); return; } func_80BD5828(this); return; } - if (Flags_GetClear(globalCtx, this->dyna.actor.room)) { + if (Flags_GetClear(play, this->dyna.actor.room)) { BgIkanaShutter_SetupDoNothing(this); return; } func_80BD5AE8(this); } -void BgIkanaShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaShutter_Destroy(Actor* thisx, PlayState* play) { BgIkanaShutter* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80BD5828(BgIkanaShutter* this) { @@ -93,8 +93,8 @@ void func_80BD5828(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_80BD5844(BgIkanaShutter* this, GlobalContext* globalCtx) { - if (BgIkanaShutter_AllSwitchesPressed(this, globalCtx)) { +void func_80BD5844(BgIkanaShutter* this, PlayState* play) { + if (BgIkanaShutter_AllSwitchesPressed(this, play)) { func_80BD5878(this); } } @@ -104,7 +104,7 @@ void func_80BD5878(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_80BD5894(BgIkanaShutter* this, GlobalContext* globalCtx) { +void func_80BD5894(BgIkanaShutter* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); func_80BD58F0(this); @@ -118,7 +118,7 @@ void func_80BD58F0(BgIkanaShutter* this) { this->actionFunc = func_80BD5910; } -void func_80BD5910(BgIkanaShutter* this, GlobalContext* globalCtx) { +void func_80BD5910(BgIkanaShutter* this, PlayState* play) { Math_StepToF(&this->dyna.actor.velocity.y, 4.0f, 0.5f); if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 220.0f, 0.5f, this->dyna.actor.velocity.y, 1.0f) < 0.5f) { @@ -131,8 +131,8 @@ void func_80BD599C(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 220.0f; } -void func_80BD59C4(BgIkanaShutter* this, GlobalContext* globalCtx) { - if (BgIkanaShutter_AllSwitchesPressed(this, globalCtx) == 0) { +void func_80BD59C4(BgIkanaShutter* this, PlayState* play) { + if (BgIkanaShutter_AllSwitchesPressed(this, play) == 0) { func_80BD59F8(this); } } @@ -142,7 +142,7 @@ void func_80BD59F8(BgIkanaShutter* this) { this->dyna.actor.velocity.y = -23.0f; } -void func_80BD5A18(BgIkanaShutter* this, GlobalContext* globalCtx) { +void func_80BD5A18(BgIkanaShutter* this, PlayState* play) { s32 pad[2]; s16 quake; @@ -150,7 +150,7 @@ void func_80BD5A18(BgIkanaShutter* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.y *= 0.978f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x5420); Quake_SetQuakeValues(quake, 4, 0, 0, 0); Quake_SetCountdown(quake, 12); @@ -163,8 +163,8 @@ void func_80BD5AE8(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_80BD5B04(BgIkanaShutter* this, GlobalContext* globalCtx) { - if (Flags_GetClearTemp(globalCtx, this->dyna.actor.room)) { +void func_80BD5B04(BgIkanaShutter* this, PlayState* play) { + if (Flags_GetClearTemp(play, this->dyna.actor.room)) { func_80BD5B44(this); } } @@ -174,10 +174,10 @@ void func_80BD5B44(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_80BD5B60(BgIkanaShutter* this, GlobalContext* globalCtx) { +void func_80BD5B60(BgIkanaShutter* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); func_80BD5BC4(this); return; } @@ -188,7 +188,7 @@ void func_80BD5BC4(BgIkanaShutter* this) { this->actionFunc = func_80BD5BD8; } -void func_80BD5BD8(BgIkanaShutter* this, GlobalContext* globalCtx) { +void func_80BD5BD8(BgIkanaShutter* this, PlayState* play) { Math_StepToF(&this->dyna.actor.velocity.y, 4.0f, 0.5f); if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -220.0f, 0.5f, this->dyna.actor.velocity.y, 1.0f) < 0.5f) { @@ -201,15 +201,15 @@ void BgIkanaShutter_SetupDoNothing(BgIkanaShutter* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + -220.0f; } -void BgIkanaShutter_DoNothing(BgIkanaShutter* this, GlobalContext* globalCtx) { +void BgIkanaShutter_DoNothing(BgIkanaShutter* this, PlayState* play) { } -void BgIkanaShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkanaShutter_Update(Actor* thisx, PlayState* play) { BgIkanaShutter* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIkanaShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ikana_obj_DL_000CE8); +void BgIkanaShutter_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_ikana_obj_DL_000CE8); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.h b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.h index 37cadc3421..1d39f3593a 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.h @@ -5,7 +5,7 @@ struct BgIkanaShutter; -typedef void (*BgIkanaShutterActionFunc)(struct BgIkanaShutter*, GlobalContext*); +typedef void (*BgIkanaShutterActionFunc)(struct BgIkanaShutter*, PlayState*); typedef struct BgIkanaShutter { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index 7e05d6977e..49707b2af8 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -11,21 +11,21 @@ #define THIS ((BgIkninSusceil*)thisx) -void BgIkninSusceil_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkninSusceil_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkninSusceil_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkninSusceil_Init(Actor* thisx, PlayState* play); +void BgIkninSusceil_Destroy(Actor* thisx, PlayState* play); +void BgIkninSusceil_Update(Actor* thisx, PlayState* play); +void BgIkninSusceil_Draw(Actor* thisx, PlayState* play); -void func_80C0AB44(BgIkninSusceil* this, GlobalContext* globalCtx); +void func_80C0AB44(BgIkninSusceil* this, PlayState* play); void func_80C0AB88(BgIkninSusceil* this); -void func_80C0ABA8(BgIkninSusceil* this, GlobalContext* globalCtx); +void func_80C0ABA8(BgIkninSusceil* this, PlayState* play); void func_80C0AC74(BgIkninSusceil* this); -void func_80C0AC90(BgIkninSusceil* this, GlobalContext* globalCtx); +void func_80C0AC90(BgIkninSusceil* this, PlayState* play); void func_80C0ACD4(BgIkninSusceil* this); -void func_80C0ACE8(BgIkninSusceil* this, GlobalContext* globalCtx); +void func_80C0ACE8(BgIkninSusceil* this, PlayState* play); void func_80C0AD44(BgIkninSusceil* this); -void func_80C0AD64(BgIkninSusceil* this, GlobalContext* globalCtx); -void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx); +void func_80C0AD64(BgIkninSusceil* this, PlayState* play); +void func_80C0AE5C(BgIkninSusceil* this, PlayState* play); const ActorInit Bg_Iknin_Susceil_InitVars = { ACTOR_BG_IKNIN_SUSCEIL, @@ -49,27 +49,27 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -s32 func_80C0A740(BgIkninSusceil* this, GlobalContext* globalCtx) { +s32 func_80C0A740(BgIkninSusceil* this, PlayState* play) { s32 pad2[2]; Vec3f offset; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); return (D_80C0B0E8.x < offset.z) && (offset.z < D_80C0B0E8.z) && (offset.x > -240.0f) && (offset.x < D_80C0B0E4); } -void func_80C0A804(BgIkninSusceil* this, GlobalContext* globalCtx) { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_80C0A804(BgIkninSusceil* this, PlayState* play) { + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80C0A838(BgIkninSusceil* this, GlobalContext* globalCtx) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_80C0A838(BgIkninSusceil* this, PlayState* play) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 verticalMag, s16 countdown, s32 arg4) { +void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) { s32 pad; - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x7B30); Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0); @@ -83,11 +83,11 @@ void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 verticalM } } -s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) { +s32 func_80C0A95C(BgIkninSusceil* this, PlayState* play) { s32 phi_t0 = true; s32 i; f32 new_var; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f offset; f32 temp1, temp2, temp3, temp4; @@ -108,20 +108,20 @@ s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) { return phi_t0; } -void BgIkninSusceil_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninSusceil_Init(Actor* thisx, PlayState* play) { BgIkninSusceil* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ikninside_obj_Colheader_00CBAC); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ikninside_obj_Colheader_00CBAC); this->animatedTexture = Lib_SegmentedToVirtual(object_ikninside_obj_Matanimheader_00C670); func_80C0AC74(this); } -void BgIkninSusceil_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninSusceil_Destroy(Actor* thisx, PlayState* play) { BgIkninSusceil* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80C0AB14(BgIkninSusceil* this) { @@ -130,13 +130,13 @@ void func_80C0AB14(BgIkninSusceil* this) { this->actionFunc = func_80C0AB44; } -void func_80C0AB44(BgIkninSusceil* this, GlobalContext* globalCtx) { +void func_80C0AB44(BgIkninSusceil* this, PlayState* play) { if (this->timer > 0) { this->timer -= 1; return; } - if (func_80C0A740(this, globalCtx)) { + if (func_80C0A740(this, play)) { func_80C0AB88(this); } } @@ -146,13 +146,13 @@ void func_80C0AB88(BgIkninSusceil* this) { this->dyna.actor.velocity.y = -10.0f; } -void func_80C0ABA8(BgIkninSusceil* this, GlobalContext* globalCtx) { +void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y += -0.7f; this->dyna.actor.velocity.y *= 0.93f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - func_80C0A86C(this, globalCtx, 4, 14, 1); - Flags_UnsetSwitch(globalCtx, GET_SUSCEIL_SWITCHFLAG(this)); + func_80C0A86C(this, play, 4, 14, 1); + Flags_UnsetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this)); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); func_80C0AC74(this); } else { @@ -165,8 +165,8 @@ void func_80C0AC74(BgIkninSusceil* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } -void func_80C0AC90(BgIkninSusceil* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, GET_SUSCEIL_SWITCHFLAG(this))) { +void func_80C0AC90(BgIkninSusceil* this, PlayState* play) { + if (Flags_GetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this))) { func_80C0ACD4(this); } } @@ -175,7 +175,7 @@ void func_80C0ACD4(BgIkninSusceil* this) { this->actionFunc = func_80C0ACE8; } -void func_80C0ACE8(BgIkninSusceil* this, GlobalContext* globalCtx) { +void func_80C0ACE8(BgIkninSusceil* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); func_80C0AD44(this); @@ -189,12 +189,12 @@ void func_80C0AD44(BgIkninSusceil* this) { this->dyna.actor.velocity.y = 5.0f; } -void func_80C0AD64(BgIkninSusceil* this, GlobalContext* globalCtx) { +void func_80C0AD64(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y += 0.46f; this->dyna.actor.velocity.y *= 0.98f; if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 365.0f, 0.5f, this->dyna.actor.velocity.y, 1.0f) < 0.1f) { - func_80C0A86C(this, globalCtx, 1, 14, 3); + func_80C0A86C(this, play, 1, 14, 3); ActorCutscene_Stop(this->dyna.actor.cutscene); func_80C0AB14(this); } else { @@ -207,25 +207,25 @@ void func_80C0AE3C(BgIkninSusceil* this) { this->dyna.actor.velocity.y = 30.0f; } -void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx) { +void func_80C0AE5C(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y += -0.1f; this->dyna.actor.velocity.y *= 0.95f; this->dyna.actor.velocity.y = CLAMP_MIN(this->dyna.actor.velocity.y, 1.0f); this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + this->dyna.actor.velocity.y; if ((this->dyna.actor.home.pos.y + 365.0f) < this->dyna.actor.world.pos.y) { - func_80C0A86C(this, globalCtx, 3, 14, 2); + func_80C0A86C(this, play, 3, 14, 2); func_80C0AB14(this); } } -void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninSusceil_Update(Actor* thisx, PlayState* play) { s32 pad; BgIkninSusceil* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk168 == 0) && (this->unk166 > 0) && (player->stateFlags3 & 0x100) && (player->unk_B48 > 1000.0f)) { this->unk168 = 2; - if ((func_80C0A95C(this, globalCtx) != 0) && (this->actionFunc != func_80C0AE5C)) { + if ((func_80C0A95C(this, play) != 0) && (this->actionFunc != func_80C0AE5C)) { func_800B8E58(player, NA_SE_PL_BODY_HIT); func_80C0AE3C(this); } @@ -235,7 +235,7 @@ void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk168--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->dyna.actor.home.pos.y + 70.0f) < this->dyna.actor.world.pos.y) { this->unk166 = 0; @@ -247,15 +247,15 @@ void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { } } if (this->unk166 > 0) { - func_80C0A838(this, globalCtx); + func_80C0A838(this, play); } else { - func_80C0A804(this, globalCtx); + func_80C0A804(this, play); } } -void BgIkninSusceil_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninSusceil_Draw(Actor* thisx, PlayState* play) { BgIkninSusceil* this = THIS; - AnimatedMat_Draw(globalCtx, this->animatedTexture); - Gfx_DrawDListOpa(globalCtx, object_ikninside_obj_DL_00C308); + AnimatedMat_Draw(play, this->animatedTexture); + Gfx_DrawDListOpa(play, object_ikninside_obj_DL_00C308); } diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h index 3692f48649..f5f5b384f8 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h @@ -7,7 +7,7 @@ struct BgIkninSusceil; -typedef void (*BgIkninSusceilActionFunc)(struct BgIkninSusceil*, GlobalContext*); +typedef void (*BgIkninSusceilActionFunc)(struct BgIkninSusceil*, PlayState*); typedef struct BgIkninSusceil { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c index 2c22444252..50b17b5bb9 100644 --- a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c +++ b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c @@ -11,12 +11,12 @@ #define THIS ((BgIkninside*)thisx) -void BgIkninside_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIkninside_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIkninside_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIkninside_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIkninside_Init(Actor* thisx, PlayState* play); +void BgIkninside_Destroy(Actor* thisx, PlayState* play); +void BgIkninside_Update(Actor* thisx, PlayState* play); +void BgIkninside_Draw(Actor* thisx, PlayState* play); -void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx); +void func_80C072D0(BgIkninside* this, PlayState* play); const ActorInit Bg_Ikninside_InitVars = { ACTOR_BG_IKNINSIDE, @@ -52,7 +52,7 @@ static ColliderCylinderInit sCylinderInit = { { 32, 32, 0, { 0, 0, 0 } }, }; -void BgIkninside_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninside_Init(Actor* thisx, PlayState* play) { BgIkninside* this = THIS; CollisionHeader* colHeader = NULL; s32 pad; @@ -61,25 +61,25 @@ void BgIkninside_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80C072D0; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_ikninside_obj_Colheader_00DE48, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - if (Flags_GetSwitch(globalCtx, DMIKNINSIDE_GET_SWITCH(thisx))) { + if (Flags_GetSwitch(play, DMIKNINSIDE_GET_SWITCH(thisx))) { Actor_MarkForDeath(&this->dyna.actor); } } -void BgIkninside_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninside_Destroy(Actor* thisx, PlayState* play) { BgIkninside* this = THIS; - 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 func_80C07220(BgIkninside* this, GlobalContext* globalCtx) { +void func_80C07220(BgIkninside* this, PlayState* play) { } -void func_80C07230(BgIkninside* this, GlobalContext* globalCtx) { +void func_80C07230(BgIkninside* this, PlayState* play) { if (this->dyna.actor.cutscene == -1) { this->actionFunc = func_80C07220; } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -95,7 +95,7 @@ void func_80C07230(BgIkninside* this, GlobalContext* globalCtx) { static Vec3f D_80C076D4 = { 0.0f, -1.0f, 0.0f }; -void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx) { +void func_80C072D0(BgIkninside* this, PlayState* play) { s16 altitude; s16 azimuth; Vec3f pos; @@ -115,13 +115,13 @@ void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx) { pos.x = Rand_ZeroFloat(10.0f) * velocity.x + this->dyna.actor.world.pos.x; pos.y = Rand_ZeroFloat(1.0f) * velocity.y + this->dyna.actor.world.pos.y; pos.z = Rand_ZeroFloat(10.0f) * velocity.z + this->dyna.actor.world.pos.z; - EffectSsHahen_Spawn(globalCtx, &pos, &velocity, &D_80C076D4, 0, 30, OBJECT_IKNINSIDE_OBJ, 25, + EffectSsHahen_Spawn(play, &pos, &velocity, &D_80C076D4, 0, 30, OBJECT_IKNINSIDE_OBJ, 25, D_80C076A0[i & 1]); } - Flags_SetSwitch(globalCtx, DMIKNINSIDE_GET_SWITCH(&this->dyna.actor)); + Flags_SetSwitch(play, DMIKNINSIDE_GET_SWITCH(&this->dyna.actor)); this->actionFunc = func_80C07230; this->dyna.actor.draw = NULL; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } else { this->timer = 20; } @@ -137,21 +137,21 @@ void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx) { this->timer = 0; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgIkninside_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIkninside_Update(Actor* thisx, PlayState* play) { BgIkninside* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIkninside_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgIkninside_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_ikninside_obj_DL_00CC78); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.h b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.h index 954b15b0c4..84a66a88d7 100644 --- a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.h +++ b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.h @@ -7,7 +7,7 @@ struct BgIkninside; #define DMIKNINSIDE_GET_SWITCH(thisx) (((thisx)->params & 0xFE00) >> 9) -typedef void (*BgIkninsideActionFunc)(struct BgIkninside*, GlobalContext*); +typedef void (*BgIkninsideActionFunc)(struct BgIkninside*, PlayState*); typedef struct BgIkninside { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c index 92a109925b..20a753fe2d 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c @@ -10,17 +10,17 @@ #define THIS ((BgIknvDoukutu*)thisx) -void BgIknvDoukutu_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIknvDoukutu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIknvDoukutu_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIknvDoukutu_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIknvDoukutu_Init(Actor* thisx, PlayState* play); +void BgIknvDoukutu_Destroy(Actor* thisx, PlayState* play); +void BgIknvDoukutu_Update(Actor* thisx, PlayState* play); +void BgIknvDoukutu_Draw(Actor* thisx, PlayState* play); -void func_80BD716C(BgIknvDoukutu* this, GlobalContext* globalCtx); -void func_80BD71BC(BgIknvDoukutu* this, GlobalContext* globalCtx); -void func_80BD7250(BgIknvDoukutu* this, GlobalContext* globalCtx); -void func_80BD72BC(BgIknvDoukutu* this, GlobalContext* globalCtx); -void func_80BD7360(BgIknvDoukutu* this, GlobalContext* globalCtx); -void func_80BD73D0(BgIknvDoukutu* this, GlobalContext* globalCtx); +void func_80BD716C(BgIknvDoukutu* this, PlayState* play); +void func_80BD71BC(BgIknvDoukutu* this, PlayState* play); +void func_80BD7250(BgIknvDoukutu* this, PlayState* play); +void func_80BD72BC(BgIknvDoukutu* this, PlayState* play); +void func_80BD7360(BgIknvDoukutu* this, PlayState* play); +void func_80BD73D0(BgIknvDoukutu* this, PlayState* play); #if 0 const ActorInit Bg_Iknv_Doukutu_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h index 31c3c85f0e..e1373e8a6a 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h +++ b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h @@ -5,7 +5,7 @@ struct BgIknvDoukutu; -typedef void (*BgIknvDoukutuActionFunc)(struct BgIknvDoukutu*, GlobalContext*); +typedef void (*BgIknvDoukutuActionFunc)(struct BgIknvDoukutu*, PlayState*); typedef struct BgIknvDoukutu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 023b4b7064..81397039df 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -11,15 +11,15 @@ #define THIS ((BgIknvObj*)thisx) -void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx); -void BgIknvObj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgIknvObj_Update(Actor* thisx, GlobalContext* globalCtx); -void BgIknvObj_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgIknvObj_Init(Actor* thisx, PlayState* play); +void BgIknvObj_Destroy(Actor* thisx, PlayState* play); +void BgIknvObj_Update(Actor* thisx, PlayState* play); +void BgIknvObj_Draw(Actor* thisx, PlayState* play); -void BgIknvObj_DoNothing(BgIknvObj* this, GlobalContext* globalCtx); -void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, GlobalContext* globalCtx); -void BgIknvObj_UpdateRaisedDoor(BgIknvObj* this, GlobalContext* globalCtx); -void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, GlobalContext* globalCtx); +void BgIknvObj_DoNothing(BgIknvObj* this, PlayState* play); +void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play); +void BgIknvObj_UpdateRaisedDoor(BgIknvObj* this, PlayState* play); +void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, PlayState* play); const ActorInit Bg_Iknv_Obj_InitVars = { ACTOR_BG_IKNV_OBJ, @@ -53,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = { { 40, 40, 0, { 0, 0, 0 } }, }; -void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgIknvObj_Init(Actor* thisx, PlayState* play) { s32 pad; BgIknvObj* this = THIS; CollisionHeader* colHeader = NULL; @@ -71,7 +71,7 @@ void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { this->displayListPtr = object_iknv_obj_DL_011880; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_0119D4, &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 = BgIknvObj_UpdateRaisedDoor; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; break; @@ -80,8 +80,8 @@ void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgIknvObj_UpdateSakonDoor; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_012CA4, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; gSaveContext.save.weekEventReg[51] &= (u8)~0x10; @@ -92,18 +92,18 @@ void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgIknvObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIknvObj_Destroy(Actor* thisx, PlayState* play) { BgIknvObj* this = THIS; if (IKNV_OBJ_TYPE(this) != IKNV_OBJ_RAISED_DOOR) { if (IKNV_OBJ_TYPE(this) == IKNV_OBJ_SAKON_DOOR) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); gSaveContext.save.weekEventReg[51] &= (u8)~0x10; } else { return; } } - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } s32 func_80BD7CEC(BgIknvObj* this) { @@ -124,26 +124,26 @@ s32 func_80BD7CEC(BgIknvObj* this) { return false; } -void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, GlobalContext* globalCtx) { +void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) { if (gSaveContext.save.weekEventReg[14] & 4) { this->dyna.actor.shape.rot.z -= 0x64; func_800B9098(&this->dyna.actor); func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); } - if ((globalCtx->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.currentCsIndex == 4) && (globalCtx->csCtx.frames == 1495)) { + if ((play->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 4) && + (play->csCtx.frames == 1495)) { func_8019F128(NA_SE_EV_DOOR_UNLOCK); } } -s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, GlobalContext* globalCtx) { +s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, PlayState* play) { this->dyna.actor.shape.yOffset = 0.0f; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (targetRotation != this->dyna.actor.shape.rot.y) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.y, targetRotation, 2, 100, 100); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { this->dyna.actor.shape.yOffset = 5.0f; } func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); @@ -153,15 +153,15 @@ s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, GlobalContext* globalCtx) return true; } -void func_80BD7ED8(BgIknvObj* this, GlobalContext* globalCtx) { - if (func_80BD7E0C(this, this->dyna.actor.home.rot.y, globalCtx)) { +void func_80BD7ED8(BgIknvObj* this, PlayState* play) { + if (func_80BD7E0C(this, this->dyna.actor.home.rot.y, play)) { this->actionFunc = BgIknvObj_UpdateSakonDoor; gSaveContext.save.weekEventReg[51] &= (u8)~0x10; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { +void func_80BD7F4C(BgIknvObj* this, PlayState* play) { if (gSaveContext.save.time > CLOCK_TIME(19, 30)) { this->actionFunc = func_80BD7ED8; } @@ -169,50 +169,50 @@ void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->dyna.actor.home.rot.x = 0; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80BD7FDC(BgIknvObj* this, GlobalContext* globalCtx) { - if (func_80BD7E0C(this, this->dyna.actor.home.rot.y + 0x4000, globalCtx)) { +void func_80BD7FDC(BgIknvObj* this, PlayState* play) { + if (func_80BD7E0C(this, this->dyna.actor.home.rot.y + 0x4000, play)) { this->actionFunc = func_80BD7F4C; gSaveContext.save.weekEventReg[51] |= 0x10; this->dyna.actor.home.rot.x = 1; } } -void func_80BD8040(BgIknvObj* this, GlobalContext* globalCtx) { +void func_80BD8040(BgIknvObj* this, PlayState* play) { if (func_80BD7CEC(this)) { this->actionFunc = func_80BD7FDC; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, GlobalContext* globalCtx) { +void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, PlayState* play) { if (gSaveContext.save.weekEventReg[58] & 0x80) { this->actionFunc = func_80BD8040; gSaveContext.save.weekEventReg[89] |= 0x80; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void BgIknvObj_UpdateRaisedDoor(BgIknvObj* this, GlobalContext* globalCtx) { +void BgIknvObj_UpdateRaisedDoor(BgIknvObj* this, PlayState* play) { } -void BgIknvObj_DoNothing(BgIknvObj* this, GlobalContext* globalCtx) { +void BgIknvObj_DoNothing(BgIknvObj* this, PlayState* play) { } -void BgIknvObj_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIknvObj_Update(Actor* thisx, PlayState* play) { BgIknvObj* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIknvObj_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgIknvObj_Draw(Actor* thisx, PlayState* play) { BgIknvObj* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->displayListPtr); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.h b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.h index d583753c29..333b9d59e3 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.h +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.h @@ -5,7 +5,7 @@ struct BgIknvObj; -typedef void (*BgIknvObjActionFunc)(struct BgIknvObj*, GlobalContext*); +typedef void (*BgIknvObjActionFunc)(struct BgIknvObj*, PlayState*); #define IKNV_OBJ_TYPE(x) (x->dyna.actor.params & 0xF) 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 1cda3dc8c4..34e0eb4849 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -11,20 +11,20 @@ #define THIS ((BgIngate*)thisx) -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); -Actor* BgIngate_FindActor(BgIngate* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId); +Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCat, s16 actorId); s32 func_80953BEC(BgIngate* this); void func_80953B40(BgIngate* this); -void func_80953F8C(BgIngate* this, GlobalContext* globalCtx); -void func_80953F9C(BgIngate* this, GlobalContext* globalCtx); -void func_809541B8(BgIngate* this, GlobalContext* globalCtx); -void func_809542A0(BgIngate* this, GlobalContext* globalCtx); -void func_80954340(BgIngate* this, GlobalContext* globalCtx); -void func_809543D4(BgIngate* this, GlobalContext* globalCtx); +void func_80953F8C(BgIngate* this, PlayState* play); +void func_80953F9C(BgIngate* this, PlayState* play); +void func_809541B8(BgIngate* this, PlayState* play); +void func_809542A0(BgIngate* this, PlayState* play); +void func_80954340(BgIngate* this, PlayState* play); +void func_809543D4(BgIngate* this, PlayState* play); const ActorInit Bg_Ingate_InitVars = { ACTOR_BG_INGATE, @@ -42,17 +42,17 @@ const ActorInit Bg_Ingate_InitVars = { * @brief Searches for an actor based on the parameters given to the function. Returns Actor* of actor found or NULL * * @param this - * @param globalCtx + * @param play * @param actorCat - Category of Actor * @param actorId - ID of actor to search for * @return Actor* */ -Actor* BgIngate_FindActor(BgIngate* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCat, s16 actorId) { Actor* foundActor = NULL; Actor* tempActor; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); + foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); if ((foundActor == NULL) || (((this != (BgIngate*)foundActor)) && (foundActor->update != NULL))) { break; @@ -122,34 +122,34 @@ s32 func_80953BEC(BgIngate* this) { return false; } -s32 func_80953DA8(BgIngate* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); +s32 func_80953DA8(BgIngate* this, PlayState* play) { + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); if (gSaveContext.eventInf[3] & 0x20) { - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_800B7298(play, &this->dyna.actor, 7); } else { gSaveContext.eventInf[4] |= 2; } func_800DFAC8(camera, 47); - globalCtx->unk_1887C = 0x63; + play->unk_1887C = 0x63; return false; } -void func_80953E38(GlobalContext* globalCtx) { - func_800DFAC8(Play_GetCamera(globalCtx, CAM_ID_MAIN), 1); +void func_80953E38(PlayState* play) { + func_800DFAC8(Play_GetCamera(play, CAM_ID_MAIN), 1); if (!(gSaveContext.eventInf[3] & 0x20)) { gSaveContext.eventInf[4] &= (u8)~2; } - globalCtx->unk_1887C = -1; + play->unk_1887C = -1; } -void func_80953EA4(BgIngate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80953EA4(BgIngate* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_800B7298(globalCtx, &this->dyna.actor, 0x3A); + func_800B7298(play, &this->dyna.actor, 0x3A); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk160 &= ~0x4; @@ -157,15 +157,15 @@ void func_80953EA4(BgIngate* this, GlobalContext* globalCtx) { this->actionFunc = func_80954340; } -void func_80953F14(BgIngate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80953F14(BgIngate* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.shape.rot.y = this->dyna.actor.shape.rot.y; player->actor.world.rot.y = player->actor.shape.rot.y; player->currentYaw = player->actor.shape.rot.y; player->actor.focus.rot.y = player->actor.shape.rot.y; this->unk160 |= 0x10; - func_80953DA8(this, globalCtx); + func_80953DA8(this, play); if (this->timePath != NULL) { func_80953B40(this); } @@ -173,28 +173,28 @@ void func_80953F14(BgIngate* this, GlobalContext* globalCtx) { this->actionFunc = func_80953F9C; } -void func_80953F8C(BgIngate* this, GlobalContext* globalCtx) { +void func_80953F8C(BgIngate* this, PlayState* play) { } -void func_80953F9C(BgIngate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); +void func_80953F9C(BgIngate* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); if (!(gSaveContext.eventInf[4] & 1)) { if (!(gSaveContext.eventInf[3] & 0x20) && (this->unk160 & 0x10) && (this->unk16C == 0)) { this->dyna.actor.textId = 0x9E3; - Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk160 &= ~0x10; } if (this->unk160 & 2) { if (this->timePath->unk1 != 0xFF) { - func_80953E38(globalCtx); - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_80953E38(play); + func_800B7298(play, &this->dyna.actor, 7); this->dyna.actor.textId = 0x9E4; - Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk16C += 1; gSaveContext.save.weekEventReg[90] |= 0x40; this->actionFunc = func_809543D4; @@ -216,7 +216,7 @@ void func_80953F9C(BgIngate* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCurrentIndex() != -1) { func_800DFAC8(camera, 1); player->stateFlags1 |= 0x20; - globalCtx->actorCtx.unk5 &= ~0x4; + play->actorCtx.unk5 &= ~0x4; } else { func_800DFAC8(camera, 47); player->stateFlags1 &= ~0x20; @@ -225,16 +225,16 @@ void func_80953F9C(BgIngate* this, GlobalContext* globalCtx) { this->unk16E = ActorCutscene_GetCurrentIndex(); } -void func_809541B8(BgIngate* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809541B8(BgIngate* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk160 & 0x4) { if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & 1) && (this->dyna.actor.xzDistToPlayer < 40.0f)) { if (this->dyna.actor.playerHeightRel > 15.0f) { - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_800B7298(play, &this->dyna.actor, 7); this->dyna.actor.textId = 0x9E6; - Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->actionFunc = func_809543D4; } } @@ -243,93 +243,93 @@ void func_809541B8(BgIngate* this, GlobalContext* globalCtx) { } } -void func_809542A0(BgIngate* this, GlobalContext* globalCtx) { +void func_809542A0(BgIngate* this, PlayState* play) { if (gSaveContext.eventInf[5] & 1) { - globalCtx->nextEntranceIndex = 0xA820; + play->nextEntranceIndex = 0xA820; gSaveContext.eventInf[5] &= (u8)~1; } else { - globalCtx->nextEntranceIndex = 0xA810; + play->nextEntranceIndex = 0xA810; } gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; this->actionFunc = func_80953F8C; gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800FE498(); } -void func_80954340(BgIngate* this, GlobalContext* globalCtx) { +void func_80954340(BgIngate* this, PlayState* play) { if (!DECR(this->unk16A)) { if (this->timePath != NULL) { - func_800B7298(globalCtx, &this->dyna.actor, 6); - this->timePath = &globalCtx->setupPathList[this->timePath->unk1]; - func_80953F14(this, globalCtx); + func_800B7298(play, &this->dyna.actor, 6); + this->timePath = &play->setupPathList[this->timePath->unk1]; + func_80953F14(this, play); func_800FE484(); } } } -void func_809543D4(BgIngate* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void func_809543D4(BgIngate* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if (((talkState == 4) || (talkState == 5)) && Message_ShouldAdvance(globalCtx)) { + if (((talkState == 4) || (talkState == 5)) && Message_ShouldAdvance(play)) { switch (this->dyna.actor.textId) { case 0x9E4: this->dyna.actor.textId = 0x9E5; - func_80151938(globalCtx, this->dyna.actor.textId); + func_80151938(play, this->dyna.actor.textId); break; case 0x9E5: - if (globalCtx->msgCtx.choiceIndex == 0) { - func_800B7298(globalCtx, &this->dyna.actor, 6); + if (play->msgCtx.choiceIndex == 0) { + func_800B7298(play, &this->dyna.actor, 6); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; func_800FE498(); func_8019F208(); } else { if (this->timePath != NULL) { - this->timePath = &globalCtx->setupPathList[this->timePath->unk1]; + this->timePath = &play->setupPathList[this->timePath->unk1]; } - func_80953F14(this, globalCtx); + func_80953F14(this, play); gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_8019F230(); } - func_801477B4(globalCtx); + func_801477B4(play); break; case 0x9E6: - if (globalCtx->msgCtx.choiceIndex == 0) { - func_80953EA4(this, globalCtx); + if (play->msgCtx.choiceIndex == 0) { + func_80953EA4(this, play); gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_8019F208(); } else { - func_800B7298(globalCtx, &this->dyna.actor, 6); + func_800B7298(play, &this->dyna.actor, 6); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; func_800FE498(); func_8019F230(); } - func_801477B4(globalCtx); + func_801477B4(play); break; } } } -void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgIngate_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgIngate* this = THIS; s32 phi_a2; Vec3s* sp38; Vec3f sp2C; Vec3f sp20; - if (BgIngate_FindActor(this, globalCtx, ACTORCAT_BG, ACTOR_BG_INGATE) == NULL) { + if (BgIngate_FindActor(this, play, ACTORCAT_BG, ACTOR_BG_INGATE) == NULL) { DynaPolyActor_Init(&this->dyna, 3); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gSichitaiBoatCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gSichitaiBoatCol); this->unk160 = 0; this->unk160 |= 0x8; this->unk160 |= 0x10; Actor_SetScale(&this->dyna.actor, 1.0f); - this->timePath = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); this->dyna.actor.room = -1; if (gSaveContext.save.weekEventReg[20] & 2) { gSaveContext.save.weekEventReg[90] &= (u8)~0x40; @@ -340,10 +340,10 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = func_809541B8; } else { phi_a2 = 0; - if (globalCtx->curSpawn == 6) { - func_80953F14(this, globalCtx); + if (play->curSpawn == 6) { + func_80953F14(this, play); if (gSaveContext.eventInf[3] & 0x20) { - func_80112AFC(globalCtx); + func_80112AFC(play); } else { gSaveContext.eventInf[4] |= 2; } @@ -351,7 +351,7 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = func_80953F8C; } } - this->timePath = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), phi_a2); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), phi_a2); if (this->timePath != NULL) { sp38 = Lib_SegmentedToVirtual(this->timePath->points); Math_Vec3s_ToVec3f(&sp2C, &sp38[0]); @@ -362,32 +362,32 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { this->dyna.actor.world.pos.y = -15.0f; this->dyna.actor.world.pos.z = sp2C.z; } - this->timePath = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); } else { Actor_MarkForDeath(&this->dyna.actor); } } -void BgIngate_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgIngate_Destroy(Actor* thisx, PlayState* play) { BgIngate* this = THIS; if (this->unk160 & 8) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgIngate_Update(Actor* thisx, PlayState* play) { BgIngate* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgIngate_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSichitaiBoat); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 81b7bec9ba..b38ce2eeb4 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -5,7 +5,7 @@ struct BgIngate; -typedef void (*BgIngateActionFunc)(struct BgIngate*, GlobalContext*); +typedef void (*BgIngateActionFunc)(struct BgIngate*, PlayState*); #define BGINGATE_GET_FF(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c index 9ae16fb1ce..bd641bf4c1 100644 --- a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c +++ b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c @@ -11,9 +11,9 @@ #define THIS ((BgInibsMovebg*)thisx) -void BgInibsMovebg_Init(Actor* thisx, GlobalContext* globalCtx); -void BgInibsMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgInibsMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgInibsMovebg_Init(Actor* thisx, PlayState* play); +void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play); +void BgInibsMovebg_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Inibs_Movebg_InitVars = { ACTOR_BG_INIBS_MOVEBG, @@ -35,7 +35,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgInibsMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgInibsMovebg_Init(Actor* thisx, PlayState* play) { BgInibsMovebg* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -46,13 +46,13 @@ void BgInibsMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_164 = D_80B96570[BGINIBSMOVEBG_GET_F(thisx)]; } -void BgInibsMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play) { BgInibsMovebg* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgInibsMovebg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgInibsMovebg_Draw(Actor* thisx, PlayState* play) { BgInibsMovebg* this = THIS; AnimatedMaterial* animMat; @@ -61,16 +61,16 @@ void BgInibsMovebg_Draw(Actor* thisx, GlobalContext* globalCtx) { animMat = this->unk_164; if (animMat != NULL) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(this->unk_164)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_164)); } dl1 = this->unk_15C; if (dl1 != NULL) { - Gfx_DrawDListOpa(globalCtx, this->unk_15C); + Gfx_DrawDListOpa(play, this->unk_15C); } dl2 = this->unk_160; if (dl2 != NULL) { - Gfx_DrawDListXlu(globalCtx, this->unk_160); + Gfx_DrawDListXlu(play, this->unk_160); } } diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c index 24f18bb2f0..63ef9d3699 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c @@ -11,14 +11,14 @@ #define THIS ((BgKeikokuSaku*)thisx) -void BgKeikokuSaku_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSaku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSaku_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSaku_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKeikokuSaku_Init(Actor* thisx, PlayState* play); +void BgKeikokuSaku_Destroy(Actor* thisx, PlayState* play); +void BgKeikokuSaku_Update(Actor* thisx, PlayState* play); +void BgKeikokuSaku_Draw(Actor* thisx, PlayState* play); -void func_80A5389C(BgKeikokuSaku* this, GlobalContext* globalCtx); -void func_80A538E0(BgKeikokuSaku* this, GlobalContext* globalCtx); -void func_80A53994(BgKeikokuSaku* this, GlobalContext* globalCtx); +void func_80A5389C(BgKeikokuSaku* this, PlayState* play); +void func_80A538E0(BgKeikokuSaku* this, PlayState* play); +void func_80A53994(BgKeikokuSaku* this, PlayState* play); const ActorInit Bg_Keikoku_Saku_InitVars = { ACTOR_BG_KEIKOKU_SAKU, @@ -32,35 +32,35 @@ const ActorInit Bg_Keikoku_Saku_InitVars = { (ActorFunc)BgKeikokuSaku_Draw, }; -void BgKeikokuSaku_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSaku_Init(Actor* thisx, PlayState* play) { s32 pad; BgKeikokuSaku* this = THIS; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_keikoku_obj_Colheader_002300, &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->switchFlag = BGKEIKOKUSAKU_GET_SWITCHFLAG(thisx); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->dyna.actor.world.pos.z = 2659.0f; } else { this->actionFunc = func_80A5389C; } } -void BgKeikokuSaku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSaku_Destroy(Actor* thisx, PlayState* play) { BgKeikokuSaku* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80A5389C(BgKeikokuSaku* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void func_80A5389C(BgKeikokuSaku* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->actionFunc = func_80A538E0; } } -void func_80A538E0(BgKeikokuSaku* this, GlobalContext* globalCtx) { +void func_80A538E0(BgKeikokuSaku* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); this->dyna.actor.world.pos.z -= 2.0f + BREG(8); if (this->dyna.actor.world.pos.z < (BREG(9) + 2660.0f)) { @@ -70,13 +70,13 @@ void func_80A538E0(BgKeikokuSaku* this, GlobalContext* globalCtx) { } } -void func_80A53994(BgKeikokuSaku* this, GlobalContext* globalCtx) { +void func_80A53994(BgKeikokuSaku* this, PlayState* play) { if (this->timer == 0) { this->actionFunc = func_80A5389C; } } -void BgKeikokuSaku_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSaku_Update(Actor* thisx, PlayState* play) { BgKeikokuSaku* this = THIS; if (this->timer) { @@ -88,15 +88,15 @@ void BgKeikokuSaku_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.scale.x = (BREG(10) / 1000.0f) + 0.1f; this->dyna.actor.scale.y = (BREG(11) / 1000.0f) + 0.1f; this->dyna.actor.scale.z = (BREG(12) / 1000.0f) + 0.1f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgKeikokuSaku_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgKeikokuSaku_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_001640); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h index 8fa6634609..729dfcea9a 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h @@ -7,7 +7,7 @@ struct BgKeikokuSaku; -typedef void (*BgKeikokuSakuActionFunc)(struct BgKeikokuSaku*, GlobalContext*); +typedef void (*BgKeikokuSakuActionFunc)(struct BgKeikokuSaku*, PlayState*); typedef struct BgKeikokuSaku { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c index 28cea492c6..f54564e2df 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c @@ -11,10 +11,10 @@ #define THIS ((BgKeikokuSpr*)thisx) -void BgKeikokuSpr_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSpr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSpr_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKeikokuSpr_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKeikokuSpr_Init(Actor* thisx, PlayState* play); +void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play); +void BgKeikokuSpr_Update(Actor* thisx, PlayState* play); +void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Keikoku_Spr_InitVars = { ACTOR_BG_KEIKOKU_SPR, @@ -35,28 +35,28 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), }; -void BgKeikokuSpr_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSpr_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); } -void BgKeikokuSpr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play) { } -void BgKeikokuSpr_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSpr_Update(Actor* thisx, PlayState* play) { } -void BgKeikokuSpr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0001F8)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0001F8)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000100); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0003F8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0003F8)); gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000300); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0005F8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0005F8)); gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000500); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c index 510b76fe8a..60ca416bcc 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c @@ -10,17 +10,17 @@ #define THIS ((BgKin2Bombwall*)thisx) -void BgKin2Bombwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Bombwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Bombwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Bombwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKin2Bombwall_Init(Actor* thisx, PlayState* play); +void BgKin2Bombwall_Destroy(Actor* thisx, PlayState* play); +void BgKin2Bombwall_Update(Actor* thisx, PlayState* play); +void BgKin2Bombwall_Draw(Actor* thisx, PlayState* play); void BgKin2Bombwall_SetupWait(BgKin2Bombwall* this); -void BgKin2Bombwall_Wait(BgKin2Bombwall* this, GlobalContext* globalCtx); +void BgKin2Bombwall_Wait(BgKin2Bombwall* this, PlayState* play); void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this); -void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, GlobalContext* globalCtx); +void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play); void BgKin2Bombwall_SetupEndCutscene(BgKin2Bombwall* this); -void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, GlobalContext* globalCtx); +void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, PlayState* play); ActorInit Bg_Kin2_Bombwall_InitVars = { ACTOR_BG_KIN2_BOMBWALL, @@ -54,7 +54,7 @@ static ColliderCylinderInit sCylinderInit = { { 60, 60, 0, { 0, 0, 0 } }, }; -s32 BgKin2Bombwall_IsHitFromNearby(BgKin2Bombwall* this, GlobalContext* globalCtx) { +s32 BgKin2Bombwall_IsHitFromNearby(BgKin2Bombwall* this, PlayState* play) { Actor* bombwallCollider; if (this->collider.base.acFlags & AC_HIT) { @@ -74,7 +74,7 @@ static Vec3f sDustAccel = { 0.0f, 0.33f, 0.0f }; static s8 sRandomYOffsets[] = { -60, -34, -8, 18, 44 }; static s16 sScales[] = { 25, 23, 21, 19, 17, 15, 13, 10 }; // Scales for random explosion debris. -void BgKin2Bombwall_SpawnEffects(BgKin2Bombwall* this, GlobalContext* globalCtx) { +void BgKin2Bombwall_SpawnEffects(BgKin2Bombwall* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity; @@ -119,14 +119,13 @@ void BgKin2Bombwall_SpawnEffects(BgKin2Bombwall* this, GlobalContext* globalCtx) if (k < 2 || (s32)Rand_Next() > 0) { phi_s0 |= 1; phi_s1 = 1; - func_800B0E48(globalCtx, &pos, &gZeroVec3f, &sDustAccel, &sPrimColor, &sEnvColor, - (Rand_Next() >> 0x1B) + 70, + func_800B0E48(play, &pos, &gZeroVec3f, &sDustAccel, &sPrimColor, &sEnvColor, (Rand_Next() >> 0x1B) + 70, (Rand_Next() >> 0x1A) + 60); // for dust spawn } else { phi_s1 = 0; } - EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -550, phi_s0, 30, 0, 0, sScales[k], phi_s1, 0, 50, - -1, OBJECT_KIN2_OBJ, gOceanSpiderHouseBombableWallDebrisDL); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -550, phi_s0, 30, 0, 0, sScales[k], phi_s1, 0, 50, -1, + OBJECT_KIN2_OBJ, gOceanSpiderHouseBombableWallDebrisDL); } } } @@ -138,43 +137,43 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -void BgKin2Bombwall_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Bombwall_Init(Actor* thisx, PlayState* play) { BgKin2Bombwall* this = THIS; ColliderCylinder* bombwallCollider; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); bombwallCollider = &this->collider; - Collider_InitCylinder(globalCtx, bombwallCollider); - if (Flags_GetSwitch(globalCtx, BG_KIN2_BOMBWALL_SWITCH_FLAG(this))) { + Collider_InitCylinder(play, bombwallCollider); + if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this))) { Actor_MarkForDeath(&this->dyna.actor); } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gOceanSpiderHouseBombableWallCol); - Collider_SetCylinder(globalCtx, bombwallCollider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &gOceanSpiderHouseBombableWallCol); + Collider_SetCylinder(play, bombwallCollider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, bombwallCollider); Actor_SetFocus(&this->dyna.actor, 60.0f); BgKin2Bombwall_SetupWait(this); } } -void BgKin2Bombwall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Bombwall_Destroy(Actor* thisx, PlayState* play) { BgKin2Bombwall* this = THIS; - 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 BgKin2Bombwall_SetupWait(BgKin2Bombwall* this) { this->actionFunc = BgKin2Bombwall_Wait; } -void BgKin2Bombwall_Wait(BgKin2Bombwall* this, GlobalContext* globalCtx) { - if (BgKin2Bombwall_IsHitFromNearby(this, globalCtx)) { +void BgKin2Bombwall_Wait(BgKin2Bombwall* this, PlayState* play) { + if (BgKin2Bombwall_IsHitFromNearby(this, play)) { this->collider.base.acFlags &= ~AC_HIT; ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); BgKin2Bombwall_SetupPlayCutscene(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -182,14 +181,14 @@ void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this) { this->actionFunc = BgKin2Bombwall_PlayCutscene; } -void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, GlobalContext* globalCtx) { +void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - Flags_SetSwitch(globalCtx, BG_KIN2_BOMBWALL_SWITCH_FLAG(this)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; - BgKin2Bombwall_SpawnEffects(this, globalCtx); + BgKin2Bombwall_SpawnEffects(this, play); BgKin2Bombwall_SetupEndCutscene(this); } else { @@ -202,7 +201,7 @@ void BgKin2Bombwall_SetupEndCutscene(BgKin2Bombwall* this) { this->actionFunc = BgKin2Bombwall_EndCutscene; } -void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, GlobalContext* globalCtx) { +void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, PlayState* play) { this->timer--; if (this->timer <= 0) { ActorCutscene_Stop(this->dyna.actor.cutscene); @@ -210,15 +209,15 @@ void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, GlobalContext* globalCtx) } } -void BgKin2Bombwall_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Bombwall_Update(Actor* thisx, PlayState* play) { BgKin2Bombwall* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgKin2Bombwall_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Bombwall_Draw(Actor* thisx, PlayState* play) { BgKin2Bombwall* this = THIS; - Gfx_DrawDListOpa(globalCtx, gOceanSpiderHouseBombableWallDL); - Gfx_DrawDListXlu(globalCtx, gOceanSpiderHouseBombableWallCrackDL); + Gfx_DrawDListOpa(play, gOceanSpiderHouseBombableWallDL); + Gfx_DrawDListXlu(play, gOceanSpiderHouseBombableWallCrackDL); } diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h index c4d76c860a..86b0afab3d 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h @@ -7,7 +7,7 @@ struct BgKin2Bombwall; -typedef void (*BgKin2BombwallActionFunc)(struct BgKin2Bombwall*, GlobalContext*); +typedef void (*BgKin2BombwallActionFunc)(struct BgKin2Bombwall*, PlayState*); typedef struct BgKin2Bombwall { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index ae1563122a..bb996b85de 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -11,21 +11,21 @@ #define THIS ((BgKin2Fence*)thisx) -void BgKin2Fence_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Fence_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Fence_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Fence_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKin2Fence_Init(Actor* thisx, PlayState* play); +void BgKin2Fence_Destroy(Actor* thisx, PlayState* play); +void BgKin2Fence_Update(Actor* thisx, PlayState* play); +void BgKin2Fence_Draw(Actor* thisx, PlayState* play); void BgKin2Fence_SetupHandleMaskCode(BgKin2Fence* this); -void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx); +void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, PlayState* play); void BgKin2Fence_SetupPlayOpenCutscene(BgKin2Fence* this); -void BgKin2Fence_PlayOpenCutscene(BgKin2Fence* this, GlobalContext* globalCtx); +void BgKin2Fence_PlayOpenCutscene(BgKin2Fence* this, PlayState* play); void BgKin2Fence_SetupWaitBeforeOpen(BgKin2Fence* this); -void BgKin2Fence_WaitBeforeOpen(BgKin2Fence* this, GlobalContext* globalCtx); +void BgKin2Fence_WaitBeforeOpen(BgKin2Fence* this, PlayState* play); void BgKin2Fence_SetupRaiseFence(BgKin2Fence* this); -void BgKin2Fence_RaiseFence(BgKin2Fence* this, GlobalContext* globalCtx); +void BgKin2Fence_RaiseFence(BgKin2Fence* this, PlayState* play); void BgKin2Fence_SetupDoNothing(BgKin2Fence* this); -void BgKin2Fence_DoNothing(BgKin2Fence* this, GlobalContext* globalCtx); +void BgKin2Fence_DoNothing(BgKin2Fence* this, PlayState* play); const ActorInit Bg_Kin2_Fence_InitVars = { ACTOR_BG_KIN2_FENCE, @@ -137,7 +137,7 @@ s32 BgKin2Fence_CheckHitMask(BgKin2Fence* this) { return -1; } -void BgKin2Fence_SpawnEyeSparkles(BgKin2Fence* this, GlobalContext* globalCtx, s32 mask) { +void BgKin2Fence_SpawnEyeSparkles(BgKin2Fence* this, PlayState* play, s32 mask) { s32 i; Vec3f sp58; s32 pad[2]; @@ -147,19 +147,19 @@ void BgKin2Fence_SpawnEyeSparkles(BgKin2Fence* this, GlobalContext* globalCtx, s for (i = 0; i < 2; i++) { Matrix_MultVec3f(&eyeSparkleSpawnPositions[mask][i], &sp58); - EffectSsKirakira_SpawnDispersed(globalCtx, &sp58, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 6000, -10); + EffectSsKirakira_SpawnDispersed(play, &sp58, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 6000, -10); } } -void BgKin2Fence_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Fence_Init(Actor* thisx, PlayState* play) { BgKin2Fence* this = THIS; s32 i = 0; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_kin2_obj_Colheader_000908); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_kin2_obj_Colheader_000908); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); @@ -168,18 +168,18 @@ void BgKin2Fence_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateSpheres(i, &this->collider); } - if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x7F)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x7F)) { BgKin2Fence_SetupDoNothing(this); return; } BgKin2Fence_SetupHandleMaskCode(this); } -void BgKin2Fence_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Fence_Destroy(Actor* thisx, PlayState* play) { BgKin2Fence* this = THIS; - 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 BgKin2Fence_SetupHandleMaskCode(BgKin2Fence* this) { @@ -187,7 +187,7 @@ void BgKin2Fence_SetupHandleMaskCode(BgKin2Fence* this) { this->actionFunc = BgKin2Fence_HandleMaskCode; } -void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { +void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, PlayState* play) { s32 hitMask; s32 nextMask; @@ -198,7 +198,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { if (hitMask == nextMask) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); this->masksHit += 1; - BgKin2Fence_SpawnEyeSparkles(this, globalCtx, nextMask); + BgKin2Fence_SpawnEyeSparkles(this, play, nextMask); } else { play_sound(NA_SE_SY_ERROR); this->masksHit = 0; @@ -215,7 +215,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { this->cooldownTimer -= 1; return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -223,10 +223,10 @@ void BgKin2Fence_SetupPlayOpenCutscene(BgKin2Fence* this) { this->actionFunc = BgKin2Fence_PlayOpenCutscene; } -void BgKin2Fence_PlayOpenCutscene(BgKin2Fence* this, GlobalContext* globalCtx) { +void BgKin2Fence_PlayOpenCutscene(BgKin2Fence* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x7F); + Flags_SetSwitch(play, this->dyna.actor.params & 0x7F); BgKin2Fence_SetupWaitBeforeOpen(this); return; } @@ -238,7 +238,7 @@ void BgKin2Fence_SetupWaitBeforeOpen(BgKin2Fence* this) { this->actionFunc = BgKin2Fence_WaitBeforeOpen; } -void BgKin2Fence_WaitBeforeOpen(BgKin2Fence* this, GlobalContext* globalCtx) { +void BgKin2Fence_WaitBeforeOpen(BgKin2Fence* this, PlayState* play) { if (this->waitBeforeOpenTimer > 0) { this->waitBeforeOpenTimer -= 1; } else { @@ -250,7 +250,7 @@ void BgKin2Fence_SetupRaiseFence(BgKin2Fence* this) { this->actionFunc = BgKin2Fence_RaiseFence; } -void BgKin2Fence_RaiseFence(BgKin2Fence* this, GlobalContext* globalCtx) { +void BgKin2Fence_RaiseFence(BgKin2Fence* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 58.0f, 5.0f)) { BgKin2Fence_SetupDoNothing(this); } @@ -260,15 +260,15 @@ void BgKin2Fence_SetupDoNothing(BgKin2Fence* this) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 58.0f; } -void BgKin2Fence_DoNothing(BgKin2Fence* this, GlobalContext* globalCtx) { +void BgKin2Fence_DoNothing(BgKin2Fence* this, PlayState* play) { } -void BgKin2Fence_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Fence_Update(Actor* thisx, PlayState* play) { BgKin2Fence* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgKin2Fence_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gOceanSpiderHouseFireplaceGrateDL); +void BgKin2Fence_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gOceanSpiderHouseFireplaceGrateDL); } diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.h b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.h index 1272c4b544..00d08b85f9 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.h +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.h @@ -5,7 +5,7 @@ struct BgKin2Fence; -typedef void (*BgKin2FenceActionFunc)(struct BgKin2Fence*, GlobalContext*); +typedef void (*BgKin2FenceActionFunc)(struct BgKin2Fence*, PlayState*); typedef struct BgKin2Fence { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c index e9326d8cd7..59d7649bd0 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c @@ -10,16 +10,16 @@ #define THIS ((BgKin2Picture*)thisx) -void BgKin2Picture_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Picture_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Picture_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Picture_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKin2Picture_Init(Actor* thisx, PlayState* play); +void BgKin2Picture_Destroy(Actor* thisx, PlayState* play); +void BgKin2Picture_Update(Actor* thisx, PlayState* play); +void BgKin2Picture_Draw(Actor* thisx, PlayState* play); -void func_80B6F4D4(BgKin2Picture* this, GlobalContext* globalCtx); -void func_80B6F5B8(BgKin2Picture* this, GlobalContext* globalCtx); -void func_80B6F640(BgKin2Picture* this, GlobalContext* globalCtx); -void func_80B6F72C(BgKin2Picture* this, GlobalContext* globalCtx); -void func_80B6F90C(BgKin2Picture* this, GlobalContext* globalCtx); +void func_80B6F4D4(BgKin2Picture* this, PlayState* play); +void func_80B6F5B8(BgKin2Picture* this, PlayState* play); +void func_80B6F640(BgKin2Picture* this, PlayState* play); +void func_80B6F72C(BgKin2Picture* this, PlayState* play); +void func_80B6F90C(BgKin2Picture* this, PlayState* play); #if 0 const ActorInit Bg_Kin2_Picture_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.h b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.h index eb5432f789..1d2569d848 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.h +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.h @@ -5,7 +5,7 @@ struct BgKin2Picture; -typedef void (*BgKin2PictureActionFunc)(struct BgKin2Picture*, GlobalContext*); +typedef void (*BgKin2PictureActionFunc)(struct BgKin2Picture*, PlayState*); typedef struct BgKin2Picture { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c index 72828611b8..8080c4444e 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c @@ -11,17 +11,17 @@ #define THIS ((BgKin2Shelf*)thisx) -void BgKin2Shelf_Init(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Shelf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Shelf_Update(Actor* thisx, GlobalContext* globalCtx); -void BgKin2Shelf_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgKin2Shelf_Init(Actor* thisx, PlayState* play); +void BgKin2Shelf_Destroy(Actor* thisx, PlayState* play); +void BgKin2Shelf_Update(Actor* thisx, PlayState* play); +void BgKin2Shelf_Draw(Actor* thisx, PlayState* play); void func_80B700A8(BgKin2Shelf* this); -void func_80B700C0(BgKin2Shelf* this, GlobalContext* globalCtx); +void func_80B700C0(BgKin2Shelf* this, PlayState* play); void func_80B70214(BgKin2Shelf* this); -void func_80B70230(BgKin2Shelf* this, GlobalContext* globalCtx); +void func_80B70230(BgKin2Shelf* this, PlayState* play); void func_80B70498(BgKin2Shelf* this); -void func_80B704B4(BgKin2Shelf* this, GlobalContext* globalCtx); +void func_80B704B4(BgKin2Shelf* this, PlayState* play); const ActorInit Bg_Kin2_Shelf_InitVars = { ACTOR_BG_KIN2_SHELF, @@ -55,7 +55,7 @@ CollisionHeader* D_80B70780[] = { &gOceanSpiderHouseChestOfDrawersCol, &gOceanSp Gfx* D_80B70788[] = { gOceanSpiderHouseChestOfDrawersDL, gOceanSpiderHouseBookshelfDL }; -s32 func_80B6FB30(BgKin2Shelf* this, GlobalContext* globalCtx) { +s32 func_80B6FB30(BgKin2Shelf* this, PlayState* play) { s32 temp_v1 = BGKIN2SHELF_GET_1(&this->dyna.actor); f32 phi_f0; f32 spA4; @@ -94,11 +94,11 @@ s32 func_80B6FB30(BgKin2Shelf* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&sp94, &sp7C); Matrix_MultVec3f(&sp88, &sp70); - return BgCheck_EntityLineTest3(&globalCtx->colCtx, &sp7C, &sp70, &sp64, &sp54, true, false, false, true, &sp50, + return BgCheck_EntityLineTest3(&play->colCtx, &sp7C, &sp70, &sp64, &sp54, true, false, false, true, &sp50, &this->dyna.actor, 0.0f); } -s32 func_80B6FCA4(BgKin2Shelf* this, GlobalContext* globalCtx) { +s32 func_80B6FCA4(BgKin2Shelf* this, PlayState* play) { s32 pad; f32 spA0; s16 sp9E; @@ -136,18 +136,18 @@ s32 func_80B6FCA4(BgKin2Shelf* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&sp90, &sp78); Matrix_MultVec3f(&sp84, &sp6C); - return BgCheck_EntityLineTest3(&globalCtx->colCtx, &sp78, &sp6C, &sp60, &sp50, true, false, false, true, &sp4C, + return BgCheck_EntityLineTest3(&play->colCtx, &sp78, &sp6C, &sp60, &sp50, true, false, false, true, &sp4C, &this->dyna.actor, 0.0f); } -s32 func_80B6FE08(BgKin2Shelf* this, GlobalContext* globalCtx) { +s32 func_80B6FE08(BgKin2Shelf* this, PlayState* play) { if (this->unk_164 & (0x8 | 0x2)) { - return func_80B6FB30(this, globalCtx); + return func_80B6FB30(this, play); } - return func_80B6FCA4(this, globalCtx); + return func_80B6FCA4(this, play); } -s32 func_80B6FE48(BgKin2Shelf* this, GlobalContext* globalCtx) { +s32 func_80B6FE48(BgKin2Shelf* this, PlayState* play) { s32 params = BGKIN2SHELF_GET_1(&this->dyna.actor); u8 temp_v1 = D_80B70778[params] & this->unk_164; @@ -166,7 +166,7 @@ s32 func_80B6FE48(BgKin2Shelf* this, GlobalContext* globalCtx) { return temp_v1 & 5; } -s32 func_80B6FEBC(BgKin2Shelf* this, GlobalContext* globalCtx) { +s32 func_80B6FEBC(BgKin2Shelf* this, PlayState* play) { if (this->unk_164 & 1) { return this->unk_167 < 1; } @@ -185,12 +185,11 @@ s32 func_80B6FEBC(BgKin2Shelf* this, GlobalContext* globalCtx) { return false; } -s32 func_80B6FF28(BgKin2Shelf* this, GlobalContext* globalCtx) { - return (this->unk_165 > 8) && func_80B6FE48(this, globalCtx) && func_80B6FEBC(this, globalCtx) && - !func_80B6FE08(this, globalCtx); +s32 func_80B6FF28(BgKin2Shelf* this, PlayState* play) { + return (this->unk_165 > 8) && func_80B6FE48(this, play) && func_80B6FEBC(this, play) && !func_80B6FE08(this, play); } -void BgKin2Shelf_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Shelf_Init(Actor* thisx, PlayState* play) { s32 pad; BgKin2Shelf* this = THIS; s32 sp24 = BGKIN2SHELF_GET_1(&this->dyna.actor); @@ -209,14 +208,14 @@ void BgKin2Shelf_Init(Actor* thisx, GlobalContext* globalCtx) { } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, D_80B70780[sp24]); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80B70780[sp24]); func_80B700A8(this); } -void BgKin2Shelf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Shelf_Destroy(Actor* thisx, PlayState* play) { BgKin2Shelf* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B700A8(BgKin2Shelf* this) { @@ -224,7 +223,7 @@ void func_80B700A8(BgKin2Shelf* this) { this->actionFunc = func_80B700C0; } -void func_80B700C0(BgKin2Shelf* this, GlobalContext* globalCtx) { +void func_80B700C0(BgKin2Shelf* this, PlayState* play) { s16 temp_v0; u8 phi_v0_2; @@ -252,14 +251,14 @@ void func_80B700C0(BgKin2Shelf* this, GlobalContext* globalCtx) { this->unk_164 = 0; } - if (func_80B6FF28(this, globalCtx)) { + if (func_80B6FF28(this, play)) { if (this->unk_164 & (0x8 | 0x2)) { func_80B70214(this); } else { func_80B70498(this); } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; @@ -275,7 +274,7 @@ void func_80B70214(BgKin2Shelf* this) { this->actionFunc = func_80B70230; } -void func_80B70230(BgKin2Shelf* this, GlobalContext* globalCtx) { +void func_80B70230(BgKin2Shelf* this, PlayState* play) { f32 phi_f20; s32 sp40 = BGKIN2SHELF_GET_1(&this->dyna.actor); f32 phi_f2; @@ -290,7 +289,7 @@ void func_80B70230(BgKin2Shelf* this, GlobalContext* globalCtx) { this->unk_160 += phi_f2; if (this->unk_160 >= 1.0f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_160 = 1.0f; player->stateFlags2 &= ~0x10; @@ -327,7 +326,7 @@ void func_80B70498(BgKin2Shelf* this) { this->actionFunc = func_80B704B4; } -void func_80B704B4(BgKin2Shelf* this, GlobalContext* globalCtx) { +void func_80B704B4(BgKin2Shelf* this, PlayState* play) { f32 temp_f20; s32 sp40 = BGKIN2SHELF_GET_1(&this->dyna.actor); f32 phi_f20; @@ -337,7 +336,7 @@ void func_80B704B4(BgKin2Shelf* this, GlobalContext* globalCtx) { this->unk_160 += (Math_SinS(this->unk_160 * 0x8000) * 0.022f) + 0.022f; if (this->unk_160 >= 1.0f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_160 = 1.0f; player->stateFlags2 &= ~0x10; @@ -368,12 +367,12 @@ void func_80B704B4(BgKin2Shelf* this, GlobalContext* globalCtx) { } } -void BgKin2Shelf_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgKin2Shelf_Update(Actor* thisx, PlayState* play) { BgKin2Shelf* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgKin2Shelf_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80B70788[BGKIN2SHELF_GET_1(thisx)]); +void BgKin2Shelf_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, D_80B70788[BGKIN2SHELF_GET_1(thisx)]); } diff --git a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.h b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.h index 29a295851a..0ae259c047 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.h +++ b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.h @@ -5,7 +5,7 @@ struct BgKin2Shelf; -typedef void (*BgKin2ShelfActionFunc)(struct BgKin2Shelf*, GlobalContext*); +typedef void (*BgKin2ShelfActionFunc)(struct BgKin2Shelf*, PlayState*); #define BGKIN2SHELF_GET_1(thisx) ((thisx)->params & 1) diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c index de9b891aca..7df0145202 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c @@ -11,14 +11,14 @@ #define THIS ((BgLadder*)thisx) -void BgLadder_Init(Actor* thisx, GlobalContext* globalCtx); -void BgLadder_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgLadder_Update(Actor* thisx, GlobalContext* globalCtx); -void BgLadder_Draw(Actor* thisx, GlobalContext* globalCtx); -void BgLadder_ActionWait(BgLadder* this, GlobalContext* globalCtx); -void BgLadder_ActionStartCutscene(BgLadder* this, GlobalContext* globalCtx); -void BgLadder_ActionFadeIn(BgLadder* this, GlobalContext* globalCtx); -void BgLadder_ActionIdle(BgLadder* this, GlobalContext* globalCtx); +void BgLadder_Init(Actor* thisx, PlayState* play); +void BgLadder_Destroy(Actor* thisx, PlayState* play); +void BgLadder_Update(Actor* thisx, PlayState* play); +void BgLadder_Draw(Actor* thisx, PlayState* play); +void BgLadder_ActionWait(BgLadder* this, PlayState* play); +void BgLadder_ActionStartCutscene(BgLadder* this, PlayState* play); +void BgLadder_ActionFadeIn(BgLadder* this, PlayState* play); +void BgLadder_ActionIdle(BgLadder* this, PlayState* play); const ActorInit Bg_Ladder_InitVars = { ACTOR_BG_LADDER, @@ -43,7 +43,7 @@ static Gfx* sLadderDLists[] = { object_ladder_DL_000730, // 24 Rung }; -void BgLadder_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgLadder_Init(Actor* thisx, PlayState* play) { BgLadder* this = THIS; BgLadderSize size; @@ -56,19 +56,19 @@ void BgLadder_Init(Actor* thisx, GlobalContext* globalCtx) { size = thisx->params; if (size == LADDER_SIZE_12RUNG) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ladder_Colheader_0001D8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ladder_Colheader_0001D8); } else if (size == LADDER_SIZE_16RUNG) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ladder_Colheader_000408); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ladder_Colheader_000408); } else if (size == LADDER_SIZE_20RUNG) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ladder_Colheader_000638); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ladder_Colheader_000638); } else if (size == LADDER_SIZE_24RUNG) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_ladder_Colheader_000868); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_ladder_Colheader_000868); } else { Actor_MarkForDeath(&this->dyna.actor); return; } - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { // If the flag is set, then the ladder draws immediately this->alpha = 255; this->dyna.actor.flags &= ~ACTOR_FLAG_10; // always update = off @@ -76,27 +76,27 @@ void BgLadder_Init(Actor* thisx, GlobalContext* globalCtx) { } else { // Otherwise, the ladder doesn't draw; wait for the flag to be set this->alpha = 5; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->action = BgLadder_ActionWait; } } -void BgLadder_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgLadder_Destroy(Actor* thisx, PlayState* play) { BgLadder* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgLadder_ActionWait(BgLadder* this, GlobalContext* globalCtx) { +void BgLadder_ActionWait(BgLadder* this, PlayState* play) { // Wait for the flag to be set, then trigger the cutscene - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); this->action = BgLadder_ActionStartCutscene; } } -void BgLadder_ActionStartCutscene(BgLadder* this, GlobalContext* globalCtx) { +void BgLadder_ActionStartCutscene(BgLadder* this, PlayState* play) { // Trigger the cutscene, then make the ladder fade in if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -108,45 +108,45 @@ void BgLadder_ActionStartCutscene(BgLadder* this, GlobalContext* globalCtx) { } } -void BgLadder_ActionFadeIn(BgLadder* this, GlobalContext* globalCtx) { +void BgLadder_ActionFadeIn(BgLadder* this, PlayState* play) { // Fade in the ladder, then stop the cutscene & go idle this->alpha += 5; if (this->alpha >= 255) { this->alpha = 255; ActorCutscene_Stop(this->dyna.actor.cutscene); - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.flags &= ~ACTOR_FLAG_10; // always update = off this->action = BgLadder_ActionIdle; } } -void BgLadder_ActionIdle(BgLadder* this, GlobalContext* globalCtx) { +void BgLadder_ActionIdle(BgLadder* this, PlayState* play) { } -void BgLadder_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgLadder_Update(Actor* thisx, PlayState* play) { BgLadder* this = THIS; - this->action(this, globalCtx); + this->action(this, play); } -void BgLadder_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgLadder_Draw(Actor* thisx, PlayState* play) { BgLadder* this = THIS; s32 pad; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255) { - Scene_SetRenderModeXlu(globalCtx, 0, 0x01); + Scene_SetRenderModeXlu(play, 0, 0x01); gfx = POLY_OPA_DISP; } else { - Scene_SetRenderModeXlu(globalCtx, 1, 0x02); + Scene_SetRenderModeXlu(play, 1, 0x02); gfx = POLY_XLU_DISP; } gSPDisplayList(&gfx[0], &sSetupDL[6 * 0x19]); gDPSetEnvColor(&gfx[1], 255, 255, 255, this->alpha); - gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&gfx[2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&gfx[3], sLadderDLists[this->dyna.actor.params]); if (this->alpha == 255) { @@ -155,5 +155,5 @@ void BgLadder_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = gfx + 4; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h index fb4d8b4d2e..e5fe13b749 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h @@ -8,7 +8,7 @@ struct BgLadder; -typedef void (*BgLadderActionFn)(struct BgLadder*, GlobalContext*); +typedef void (*BgLadderActionFn)(struct BgLadder*, PlayState*); typedef struct BgLadder { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index 0e3a88029d..f47536123b 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -10,10 +10,10 @@ #define THIS ((BgLastBwall*)thisx) -void BgLastBwall_Init(Actor* thisx, GlobalContext* globalCtx); -void BgLastBwall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgLastBwall_Update(Actor* thisx, GlobalContext* globalCtx); -void BgLastBwall_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgLastBwall_Init(Actor* thisx, PlayState* play); +void BgLastBwall_Destroy(Actor* thisx, PlayState* play); +void BgLastBwall_Update(Actor* thisx, PlayState* play); +void BgLastBwall_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Bg_Last_Bwall_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h index fe529b13de..0ace6c5882 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h @@ -5,7 +5,7 @@ struct BgLastBwall; -typedef void (*BgLastBwallActionFunc)(struct BgLastBwall*, GlobalContext*); +typedef void (*BgLastBwallActionFunc)(struct BgLastBwall*, PlayState*); typedef struct BgLastBwall { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c b/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c index b0ad9d32eb..35d61af5e9 100644 --- a/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c +++ b/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c @@ -11,9 +11,9 @@ #define THIS ((BgLbfshot*)thisx) -void BgLbfshot_Init(Actor* thisx, GlobalContext* globalCtx); -void BgLbfshot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgLbfshot_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgLbfshot_Init(Actor* thisx, PlayState* play); +void BgLbfshot_Destroy(Actor* thisx, PlayState* play); +void BgLbfshot_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Lbfshot_InitVars = { ACTOR_BG_LBFSHOT, @@ -31,19 +31,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgLbfshot_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgLbfshot_Init(Actor* thisx, PlayState* play) { BgLbfshot* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.uncullZoneForward = 4000.0f; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_lbfshot_Colheader_0014D8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_lbfshot_Colheader_0014D8); } -void BgLbfshot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgLbfshot_Destroy(Actor* thisx, PlayState* play) { BgLbfshot* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgLbfshot_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_lbfshot_DL_000228); +void BgLbfshot_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_lbfshot_DL_000228); } diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index ccf8e2d430..6ac4ac8666 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -11,14 +11,14 @@ #define THIS ((BgLotus*)thisx) -void BgLotus_Init(Actor* thisx, GlobalContext* globalCtx); -void BgLotus_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgLotus_Update(Actor* thisx, GlobalContext* globalCtx); -void BgLotus_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgLotus_Init(Actor* thisx, PlayState* play); +void BgLotus_Destroy(Actor* thisx, PlayState* play); +void BgLotus_Update(Actor* thisx, PlayState* play); +void BgLotus_Draw(Actor* thisx, PlayState* play); -void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx); -void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx); -void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx); +void BgLotus_Wait(BgLotus* this, PlayState* play); +void BgLotus_Sink(BgLotus* this, PlayState* play); +void BgLotus_WaitToAppear(BgLotus* this, PlayState* play); const ActorInit Bg_Lotus_InitVars = { ACTOR_BG_LOTUS, @@ -36,25 +36,25 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgLotus_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgLotus_Init(Actor* thisx, PlayState* play) { BgLotus* this = THIS; s32 pad; s32 bgId; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_lotus_Colheader_000A20); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &thisx->floorPoly, &bgId, + DynaPolyActor_LoadMesh(play, &this->dyna, &object_lotus_Colheader_000A20); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &thisx->floorPoly, &bgId, &this->dyna.actor, &this->dyna.actor.world.pos); this->timer2 = 96; this->dyna.actor.world.rot.y = (s32)Rand_Next() >> 0x10; this->actionFunc = BgLotus_Wait; } -void BgLotus_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgLotus_Destroy(Actor* thisx, PlayState* play) { BgLotus* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void BgLotus_SetScaleXZ(BgLotus* this) { @@ -67,7 +67,7 @@ void BgLotus_SetScaleXZ(BgLotus* this) { } } -void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) { +void BgLotus_Wait(BgLotus* this, PlayState* play) { f32 moveDist; // distance for the xz position of the lilypad to move this->timer2--; @@ -93,8 +93,8 @@ void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) { if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { if (this->hasSpawnedRipples == 0) { - EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 0); - EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 8); + EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 0); + EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 8); this->timer = 40; } if (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) { @@ -117,7 +117,7 @@ void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) { BgLotus_SetScaleXZ(this); } -void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx) { +void BgLotus_Sink(BgLotus* this, PlayState* play) { if (this->height < this->dyna.actor.world.pos.y) { this->dyna.actor.world.pos.y = this->height; } @@ -136,7 +136,7 @@ void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.scale.x, 0, 0.0050000003539f)) { this->dyna.actor.draw = NULL; this->timer = 100; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgLotus_WaitToAppear; } @@ -144,12 +144,12 @@ void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx) { } } -void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx) { +void BgLotus_WaitToAppear(BgLotus* this, PlayState* play) { if (this->timer > 0) { this->timer--; } else if ((this->dyna.actor.xzDistToPlayer > 100.0f) && (this->dyna.actor.projectedPos.z < 0.0f)) { this->dyna.actor.draw = BgLotus_Draw; - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); Actor_SetScale(&this->dyna.actor, 0.1f); this->dyna.actor.world.pos.y = CLAMP_MIN(this->height, this->dyna.actor.floorHeight); this->dyna.actor.flags &= ~ACTOR_FLAG_10; @@ -160,16 +160,16 @@ void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx) { } } -void BgLotus_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgLotus_Update(Actor* thisx, PlayState* play) { BgLotus* this = THIS; s32 pad; WaterBox* waterBox; - WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, + WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &this->height, &waterBox); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgLotus_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_lotus_DL_000040); +void BgLotus_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_lotus_DL_000040); } diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h index 505e6720c7..a4d8f2ebbc 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h @@ -5,7 +5,7 @@ struct BgLotus; -typedef void (*BgLotusActionFunc)(struct BgLotus*, GlobalContext*); +typedef void (*BgLotusActionFunc)(struct BgLotus*, PlayState*); typedef struct BgLotus { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c index e25aeaf67a..8ac6c61c39 100644 --- a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c +++ b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c @@ -11,8 +11,8 @@ #define THIS ((BgMarketStep*)thisx) -void BgMarketStep_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMarketStep_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMarketStep_Init(Actor* thisx, PlayState* play); +void BgMarketStep_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Market_Step_InitVars = { ACTOR_BG_MARKET_STEP, ACTORCAT_BG, FLAGS, @@ -30,14 +30,14 @@ static InitChainEntry sInitChain[] = { Gfx* D_80AF0120[] = { object_market_obj_DL_01F050, object_market_obj_DL_018DA0 }; Gfx* D_80AF0128[] = { object_market_obj_DL_01EF10, object_market_obj_DL_018C60 }; -void BgMarketStep_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMarketStep_Init(Actor* thisx, PlayState* play) { BgMarketStep* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); } -void BgMarketStep_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgMarketStep_Draw(Actor* thisx, PlayState* play) { s32 index = thisx->params & 1; - Gfx_DrawDListOpa(globalCtx, D_80AF0120[index]); - Gfx_DrawDListOpa(globalCtx, D_80AF0128[index]); + Gfx_DrawDListOpa(play, D_80AF0120[index]); + Gfx_DrawDListOpa(play, D_80AF0128[index]); } diff --git a/src/overlays/actors/ovl_Bg_Mbar_Chair/z_bg_mbar_chair.c b/src/overlays/actors/ovl_Bg_Mbar_Chair/z_bg_mbar_chair.c index e5e300757e..f81e536110 100644 --- a/src/overlays/actors/ovl_Bg_Mbar_Chair/z_bg_mbar_chair.c +++ b/src/overlays/actors/ovl_Bg_Mbar_Chair/z_bg_mbar_chair.c @@ -11,10 +11,10 @@ #define THIS ((BgMbarChair*)thisx) -void BgMbarChair_Init(Actor* thisx, GlobalContext* globalCtx); -void BgMbarChair_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgMbarChair_Update(Actor* thisx, GlobalContext* globalCtx); -void BgMbarChair_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgMbarChair_Init(Actor* thisx, PlayState* play); +void BgMbarChair_Destroy(Actor* thisx, PlayState* play); +void BgMbarChair_Update(Actor* thisx, PlayState* play); +void BgMbarChair_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Mbar_Chair_InitVars = { ACTOR_BG_MBAR_CHAIR, @@ -35,23 +35,23 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgMbarChair_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgMbarChair_Init(Actor* thisx, PlayState* play) { BgMbarChair* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mbar_obj_Colheader_0019B4); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_mbar_obj_Colheader_0019B4); } -void BgMbarChair_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgMbarChair_Destroy(Actor* thisx, PlayState* play) { BgMbarChair* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgMbarChair_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgMbarChair_Update(Actor* thisx, PlayState* play) { } -void BgMbarChair_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_mbar_obj_DL_000288); +void BgMbarChair_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_mbar_obj_DL_000288); } diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index d30fd2d74e..4c0c109ea9 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -12,23 +12,23 @@ #define THIS ((BgNumaHana*)thisx) -void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx); -void BgNumaHana_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgNumaHana_Update(Actor* thisx, GlobalContext* globalCtx); -void BgNumaHana_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgNumaHana_Init(Actor* thisx, PlayState* play); +void BgNumaHana_Destroy(Actor* thisx, PlayState* play); +void BgNumaHana_Update(Actor* thisx, PlayState* play); +void BgNumaHana_Draw(Actor* thisx, PlayState* play); void BgNumaHana_SetupDoNothing(BgNumaHana* this); -void BgNumaHana_DoNothing(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_DoNothing(BgNumaHana* this, PlayState* play); void BgNumaHana_SetupClosedIdle(BgNumaHana* this); -void BgNumaHana_ClosedIdle(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_ClosedIdle(BgNumaHana* this, PlayState* play); void BgNumaHana_SetupUnfoldInnerPetals(BgNumaHana* this); -void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, PlayState* play); void BgNumaHana_SetupUnfoldOuterPetals(BgNumaHana* this); -void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, PlayState* play); void BgNumaHana_SetupRaiseFlower(BgNumaHana* this); -void BgNumaHana_RaiseFlower(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_RaiseFlower(BgNumaHana* this, PlayState* play); void BgNumaHana_SetupOpenedIdle(BgNumaHana* this); -void BgNumaHana_OpenedIdle(BgNumaHana* this, GlobalContext* globalCtx); +void BgNumaHana_OpenedIdle(BgNumaHana* this, PlayState* play); const ActorInit Bg_Numa_Hana_InitVars = { ACTOR_BG_NUMA_HANA, @@ -79,10 +79,10 @@ static InitChainEntry sInitChain[] = { * Spawns another wooden flower instance that handles the opened flower's collision. * Returns true if this wooden flower instance was succesfully spawned. */ -s32 BgNumaHana_SpawnOpenFlowerCollisionChild(BgNumaHana* this, GlobalContext* globalCtx) { +s32 BgNumaHana_SpawnOpenFlowerCollisionChild(BgNumaHana* this, PlayState* play) { Actor* child; - child = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_BG_NUMA_HANA, + child = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_NUMA_HANA, 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, BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION); @@ -136,7 +136,7 @@ void BgNumaHana_UpdateSettleRotation(s16* settleZRotation, s16* settleAngle, f32 *settleZRotation += (s16)(Math_SinS(*settleAngle) * *settleScale); } -void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgNumaHana_Init(Actor* thisx, PlayState* play) { s32 pad; DynaPolyActor* child; s32 type; @@ -147,22 +147,22 @@ void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 3); if (type == BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gWoodenFlowerOpenedFlowerCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodenFlowerOpenedFlowerCol); BgNumaHana_SetupDoNothing(this); this->dyna.actor.draw = NULL; } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gWoodenFlowerClosedFlowerCol); - FireObj_Init(globalCtx, &this->fire, &sFireObjInit, &this->dyna.actor); - Collider_InitCylinder(globalCtx, &this->torchCollider); - Collider_SetCylinder(globalCtx, &this->torchCollider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodenFlowerClosedFlowerCol); + FireObj_Init(play, &this->fire, &sFireObjInit, &this->dyna.actor); + Collider_InitCylinder(play, &this->torchCollider); + Collider_SetCylinder(play, &this->torchCollider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - if (!BgNumaHana_SpawnOpenFlowerCollisionChild(this, globalCtx)) { + if (!BgNumaHana_SpawnOpenFlowerCollisionChild(this, play)) { Actor_MarkForDeath(&this->dyna.actor); return; } if (gSaveContext.save.weekEventReg[12] & 1) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; this->innerPetalZRotation = 0x2000; @@ -176,12 +176,12 @@ void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 210.0f; FireObj_SetState2(&this->fire, 0.05f, 2); - Flags_SetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupOpenedIdle(this); } else { child = (DynaPolyActor*)this->dyna.actor.child; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - Flags_UnsetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + func_800C62BC(play, &play->colCtx.dyna, child->bgId); + Flags_UnsetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupClosedIdle(this); } @@ -189,13 +189,13 @@ void BgNumaHana_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void BgNumaHana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgNumaHana_Destroy(Actor* thisx, PlayState* play) { BgNumaHana* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if (BG_NUMA_HANA_GET_TYPE(&this->dyna.actor) == BG_NUMA_HANA_TYPE_NORMAL) { - FireObj_Destroy(globalCtx, &this->fire); - Collider_DestroyCylinder(globalCtx, &this->torchCollider); + FireObj_Destroy(play, &this->fire); + Collider_DestroyCylinder(play, &this->torchCollider); } } @@ -203,7 +203,7 @@ void BgNumaHana_SetupDoNothing(BgNumaHana* this) { this->actionFunc = BgNumaHana_DoNothing; } -void BgNumaHana_DoNothing(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_DoNothing(BgNumaHana* this, PlayState* play) { } void BgNumaHana_SetupClosedIdle(BgNumaHana* this) { @@ -214,13 +214,13 @@ void BgNumaHana_SetupClosedIdle(BgNumaHana* this) { * This function waits for the torch to be lit. Once it is, it starts * the cutscene where the petals unfold. */ -void BgNumaHana_ClosedIdle(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_ClosedIdle(BgNumaHana* this, PlayState* play) { if (this->fire.state != 3) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); gSaveContext.save.weekEventReg[12] |= 1; - Flags_SetSwitch(globalCtx, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); + Flags_SetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupUnfoldInnerPetals(this); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); @@ -237,7 +237,7 @@ void BgNumaHana_SetupUnfoldInnerPetals(BgNumaHana* this) { * Partially moves the flower to the "open" position by raising the "inner" * parts of the petals that are closest to the stalk. */ -void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, PlayState* play) { Math_StepToS(&this->innerPetalZRotationalVelocity, 240, 14); if (Math_ScaledStepToS(&this->innerPetalZRotation, 0x2000, this->innerPetalZRotationalVelocity)) { if (this->transitionTimer >= 11) { @@ -269,7 +269,7 @@ void BgNumaHana_SetupUnfoldOuterPetals(BgNumaHana* this) { * Partially moves the flower to the "open" position by lowering the "outer" * parts of the petals that are furthest to the stalk. */ -void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, PlayState* play) { Math_StepToS(&this->outerPetalZRotationalVelocity, 240, 14); if (Math_ScaledStepToS(&this->outerPetalZRotation, -0x4000, this->outerPetalZRotationalVelocity)) { if (this->transitionTimer >= 11) { @@ -299,7 +299,7 @@ void BgNumaHana_SetupRaiseFlower(BgNumaHana* this) { /** * This function slowly raises the flower to its final height and makes it start spinning. */ -void BgNumaHana_RaiseFlower(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_RaiseFlower(BgNumaHana* this, PlayState* play) { s32 pad; DynaPolyActor* child; @@ -314,8 +314,8 @@ void BgNumaHana_RaiseFlower(BgNumaHana* this, GlobalContext* globalCtx) { child = (DynaPolyActor*)this->dyna.actor.child; // Swaps out the "closed" flower collision for the "opened" collision. - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, child->bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; this->innerPetalZRotation = 0x2000; @@ -342,14 +342,14 @@ void BgNumaHana_SetupOpenedIdle(BgNumaHana* this) { /** * Spins the "opened" flower around the y-axis. */ -void BgNumaHana_OpenedIdle(BgNumaHana* this, GlobalContext* globalCtx) { +void BgNumaHana_OpenedIdle(BgNumaHana* this, PlayState* play) { this->dyna.actor.shape.rot.y += this->flowerRotationalVelocity; this->petalZRotation = this->innerPetalZRotation + this->settleZRotation; BgNumaHana_UpdatePetalPosRots(this); func_800B9010(&this->dyna.actor, NA_SE_EV_FLOWER_ROLLING - SFX_FLAG); } -void BgNumaHana_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgNumaHana_Update(Actor* thisx, PlayState* play) { s32 pad; BgNumaHana* this = THIS; s32 type = BG_NUMA_HANA_GET_TYPE(&this->dyna.actor); @@ -360,31 +360,31 @@ void BgNumaHana_Update(Actor* thisx, GlobalContext* globalCtx) { firePos.y = this->dyna.actor.world.pos.y + 10.5f; firePos.z = this->dyna.actor.world.pos.z; FireObj_SetPosition(&this->fire, &firePos); - FireObj_Update(globalCtx, &this->fire, &this->dyna.actor); + FireObj_Update(play, &this->fire, &this->dyna.actor); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (type == BG_NUMA_HANA_TYPE_NORMAL) { this->dyna.actor.child->shape.rot = this->dyna.actor.shape.rot; Collider_UpdateCylinder(&this->dyna.actor, &this->torchCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->torchCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->torchCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->torchCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->torchCollider.base); } } -void BgNumaHana_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void BgNumaHana_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgNumaHana* this = THIS; WoodenFlowerPetalPosRot* innerPetalPosRot; WoodenFlowerPetalPosRot* outerPetalPosRot; s32 objectIndex; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerStalkDL); for (i = 0; i < ARRAY_COUNT(this->innerPetalPosRot); i++) { @@ -394,27 +394,27 @@ void BgNumaHana_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_SetTranslateRotateYXZ(innerPetalPosRot->pos.x, innerPetalPosRot->pos.y, innerPetalPosRot->pos.z, &innerPetalPosRot->rot); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerInnerPetalDL); Matrix_SetTranslateRotateYXZ(outerPetalPosRot->pos.x, outerPetalPosRot->pos.y, outerPetalPosRot->pos.z, &outerPetalPosRot->rot); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gWoodenFlowerOuterPetalDL); } - objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_SYOKUDAI); - if ((objectIndex >= 0) && (Object_IsLoaded(&globalCtx->objectCtx, objectIndex))) { + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_SYOKUDAI); + if ((objectIndex >= 0) && (Object_IsLoaded(&play->objectCtx, objectIndex))) { Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y - 64.5f, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(1.5f, 1.5f, 1.5f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIndex].segment); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); gSPDisplayList(POLY_OPA_DISP++, gObjectSyokudaiTypeNoSwitchDL); } - FireObj_Draw(globalCtx, &this->fire); + FireObj_Draw(play, &this->fire); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h index 19d30a34f1..e715b5c09d 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h @@ -13,7 +13,7 @@ typedef enum { struct BgNumaHana; -typedef void (*BgNumaHanaActionFunc)(struct BgNumaHana*, GlobalContext*); +typedef void (*BgNumaHanaActionFunc)(struct BgNumaHana*, PlayState*); typedef struct { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index f1fa69810f..93502e46e5 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -10,14 +10,14 @@ #define THIS ((BgOpenShutter*)thisx) -void BgOpenShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void BgOpenShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgOpenShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void BgOpenShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgOpenShutter_Init(Actor* thisx, PlayState* play); +void BgOpenShutter_Destroy(Actor* thisx, PlayState* play); +void BgOpenShutter_Update(Actor* thisx, PlayState* play); +void BgOpenShutter_Draw(Actor* thisx, PlayState* play); -void func_80ACAD88(BgOpenShutter* this, GlobalContext* globalCtx); -void func_80ACAE5C(BgOpenShutter* this, GlobalContext* globalCtx); -void func_80ACAEF0(BgOpenShutter* this, GlobalContext* globalCtx); +void func_80ACAD88(BgOpenShutter* this, PlayState* play); +void func_80ACAE5C(BgOpenShutter* this, PlayState* play); +void func_80ACAEF0(BgOpenShutter* this, PlayState* play); #if 0 const ActorInit Bg_Open_Shutter_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.h b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.h index 90c682e732..2c00a57355 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.h +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.h @@ -5,7 +5,7 @@ struct BgOpenShutter; -typedef void (*BgOpenShutterActionFunc)(struct BgOpenShutter*, GlobalContext*); +typedef void (*BgOpenShutterActionFunc)(struct BgOpenShutter*, PlayState*); typedef struct BgOpenShutter { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c index 48d2cd4f25..0f800f97ba 100644 --- a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c +++ b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c @@ -11,10 +11,10 @@ #define THIS ((BgOpenSpot*)thisx) -void BgOpenSpot_Init(Actor* thisx, GlobalContext* globalCtx); -void BgOpenSpot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx); -void BgOpenSpot_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgOpenSpot_Init(Actor* thisx, PlayState* play); +void BgOpenSpot_Destroy(Actor* thisx, PlayState* play); +void BgOpenSpot_Update(Actor* thisx, PlayState* play); +void BgOpenSpot_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Open_Spot_InitVars = { ACTOR_BG_OPEN_SPOT, @@ -35,22 +35,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgOpenSpot_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgOpenSpot_Init(Actor* thisx, PlayState* play) { BgOpenSpot* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); this->texScrolls = Lib_SegmentedToVirtual(gSpotlightTexAnim); } -void BgOpenSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgOpenSpot_Destroy(Actor* thisx, PlayState* play) { } -void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgOpenSpot_Update(Actor* thisx, PlayState* play) { BgOpenSpot* this = THIS; u32 action; - if (Cutscene_CheckActorAction(globalCtx, 0x7D)) { - action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x7D)]->action; + if (Cutscene_CheckActorAction(play, 0x7D)) { + action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7D)]->action; if (action == 1) { this->actor.draw = NULL; } else if (action == 2) { @@ -59,18 +59,18 @@ void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void BgOpenSpot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgOpenSpot_Draw(Actor* thisx, PlayState* play) { s32 pad; BgOpenSpot* this = (BgOpenSpot*)thisx; - AnimatedMat_Draw(globalCtx, this->texScrolls); - OPEN_DISPS(globalCtx->state.gfxCtx); + AnimatedMat_Draw(play, this->texScrolls); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gDPSetColorDither(POLY_XLU_DISP++, G_CD_BAYER); gSPDisplayList(POLY_XLU_DISP++, gSpotlightLeftDL); gSPDisplayList(POLY_XLU_DISP++, gSpotlightRightDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c index e5bba655d6..fb8f04d789 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c @@ -18,11 +18,11 @@ #define THIS ((BgSinkaiKabe*)thisx) -void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSinkaiKabe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSinkaiKabe_Update(Actor* thisx, GlobalContext* globalCtx); +void BgSinkaiKabe_Init(Actor* thisx, PlayState* play); +void BgSinkaiKabe_Destroy(Actor* thisx, PlayState* play); +void BgSinkaiKabe_Update(Actor* thisx, PlayState* play); -void BgSinkaiKabe_WaitForPlayer(BgSinkaiKabe* this, GlobalContext* globalCtx); +void BgSinkaiKabe_WaitForPlayer(BgSinkaiKabe* this, PlayState* play); const ActorInit Bg_Sinkai_Kabe_InitVars = { ACTOR_BG_SINKAI_KABE, @@ -38,7 +38,7 @@ const ActorInit Bg_Sinkai_Kabe_InitVars = { static s32 sCurrentPythonIndex = 0; -void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { BgSinkaiKabe* this = THIS; s32 pad; CollisionHeader* colHeader = NULL; @@ -50,7 +50,7 @@ void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gPinnacleRockPythonDenCol, &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); Math_Vec3f_Copy(&pos, &this->dyna.actor.world.pos); pos.x += Math_SinS(this->dyna.actor.world.rot.y + 0x8000) * 3000.0f; pos.z += Math_CosS(this->dyna.actor.world.rot.y + 0x8000) * 3000.0f; @@ -68,9 +68,8 @@ void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx) { sCurrentPythonIndex++; if (!(gSaveContext.save.weekEventReg[13] & 1)) { - this->deepPython = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_DRAGON, pos.x, pos.y, pos.z, - 0, this->dyna.actor.world.rot.y, 1, this->dyna.actor.params); + this->deepPython = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_DRAGON, pos.x, pos.y, + pos.z, 0, this->dyna.actor.world.rot.y, 1, this->dyna.actor.params); if (this->deepPython != NULL) { EnDragon* dragon = (EnDragon*)this->deepPython; @@ -99,7 +98,7 @@ void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx) { pos.y += -100.0f; pos.z += (Math_CosS(this->dyna.actor.world.rot.y + 0x8000) * 500.0f); if (shouldSpawnSeahorse) { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OT, pos.x, pos.y, pos.z, 0, + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, pos.x, pos.y, pos.z, 0, this->dyna.actor.shape.rot.y, 0, 0x4000, this->dyna.actor.cutscene, this->dyna.actor.unk20, NULL); } @@ -110,22 +109,22 @@ void BgSinkaiKabe_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgSinkaiKabe_WaitForPlayer; } -void BgSinkaiKabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSinkaiKabe_Destroy(Actor* thisx, PlayState* play) { BgSinkaiKabe* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } /** * Extends this actor's Deep Python if the player gets close enough. */ -void BgSinkaiKabe_WaitForPlayer(BgSinkaiKabe* this, GlobalContext* globalCtx) { +void BgSinkaiKabe_WaitForPlayer(BgSinkaiKabe* this, PlayState* play) { if (this->deepPython != NULL) { if (this->deepPython->update != NULL) { EnDragon* dragon = (EnDragon*)this->deepPython; if (dragon->action == DEEP_PYTHON_ACTION_IDLE) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->dyna.actor.xzDistToPlayer < 500.0f) || ((ABS_ALT(BINANG_SUB(this->dyna.actor.yawTowardsPlayer, this->dyna.actor.world.rot.y)) < 0x2000) && @@ -145,8 +144,8 @@ void BgSinkaiKabe_WaitForPlayer(BgSinkaiKabe* this, GlobalContext* globalCtx) { } } -void BgSinkaiKabe_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSinkaiKabe_Update(Actor* thisx, PlayState* play) { BgSinkaiKabe* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h index 1a29f512f0..bc39da0ee1 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h @@ -6,7 +6,7 @@ struct BgSinkaiKabe; -typedef void (*BgSinkaiKabeActionFunc)(struct BgSinkaiKabe*, GlobalContext*); +typedef void (*BgSinkaiKabeActionFunc)(struct BgSinkaiKabe*, PlayState*); typedef struct BgSinkaiKabe { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index 5e3eed13bc..46eac0c138 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -11,18 +11,18 @@ #define THIS ((BgSpdweb*)thisx) -void BgSpdweb_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpdweb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpdweb_Update(Actor* thisx, GlobalContext* globalCtx); -void BgSpdweb_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgSpdweb_Init(Actor* thisx, PlayState* play); +void BgSpdweb_Destroy(Actor* thisx, PlayState* play); +void BgSpdweb_Update(Actor* thisx, PlayState* play); +void BgSpdweb_Draw(Actor* thisx, PlayState* play); void func_809CE068(BgSpdweb* this); -void func_809CE234(BgSpdweb* this, GlobalContext* globalCtx); -void func_809CE4C8(BgSpdweb* this, GlobalContext* globalCtx); -void func_809CE830(BgSpdweb* this, GlobalContext* globalCtx); -void func_809CEBC0(BgSpdweb* this, GlobalContext* globalCtx); +void func_809CE234(BgSpdweb* this, PlayState* play); +void func_809CE4C8(BgSpdweb* this, PlayState* play); +void func_809CE830(BgSpdweb* this, PlayState* play); +void func_809CEBC0(BgSpdweb* this, PlayState* play); void func_809CEE74(BgSpdweb* this); -void func_809CEEAC(BgSpdweb* this, GlobalContext* globalCtx); +void func_809CEEAC(BgSpdweb* this, PlayState* play); const ActorInit Bg_Spdweb_InitVars = { ACTOR_BG_SPDWEB, @@ -143,7 +143,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void BgSpdweb_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgSpdweb_Init(Actor* thisx, PlayState* play) { BgSpdweb* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -153,32 +153,32 @@ void BgSpdweb_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); if (this->dyna.actor.params == BGSPDWEB_FF_0) { - Collider_InitAndSetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit1, this->colliderElements); + Collider_InitAndSetTris(play, &this->collider, &this->dyna.actor, &sTrisInit1, this->colliderElements); func_809CE068(this); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spdweb_Colheader_002678); - this->unk_2F8 = globalCtx->colCtx.dyna.bgActors[this->dyna.bgId].colHeader->vtxList; + DynaPolyActor_LoadMesh(play, &this->dyna, &object_spdweb_Colheader_002678); + this->unk_2F8 = play->colCtx.dyna.bgActors[this->dyna.bgId].colHeader->vtxList; this->unk_164 = 0.0f; this->actionFunc = func_809CE4C8; } else { - Collider_InitAndSetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit2, this->colliderElements); + Collider_InitAndSetTris(play, &this->collider, &this->dyna.actor, &sTrisInit2, this->colliderElements); func_809CE068(this); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spdweb_Colheader_0011C0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_spdweb_Colheader_0011C0); this->actionFunc = func_809CEBC0; Actor_SetFocus(&this->dyna.actor, 30.0f); } this->unk_162 = 0; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { Actor_MarkForDeath(&this->dyna.actor); } } -void BgSpdweb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgSpdweb_Destroy(Actor* thisx, PlayState* play) { BgSpdweb* this = THIS; - 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_809CE068(BgSpdweb* this) { @@ -203,9 +203,9 @@ void func_809CE15C(BgSpdweb* this) { (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y) * 10.0f; } -void func_809CE1D0(BgSpdweb* this, GlobalContext* globalCtx) { +void func_809CE1D0(BgSpdweb* this, PlayState* play) { this->unk_162 = 30; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); if (this->dyna.actor.params == BGSPDWEB_FF_0) { this->actionFunc = func_809CE234; @@ -214,7 +214,7 @@ void func_809CE1D0(BgSpdweb* this, GlobalContext* globalCtx) { } } -void func_809CE234(BgSpdweb* this, GlobalContext* globalCtx) { +void func_809CE234(BgSpdweb* this, PlayState* play) { Vec3f spB4; Vec3f spA8; f32 temp_f20; @@ -258,17 +258,17 @@ void func_809CE234(BgSpdweb* this, GlobalContext* globalCtx) { spB4.y = 0.0f; spB4.z = 7.0f * temp_f22 * temp_f20; - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &spB4, &gZeroVec3f, &D_809CF208, &D_809CF20C, - 0x32, 8, 0xE); + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &spB4, &gZeroVec3f, &D_809CF208, &D_809CF20C, 0x32, + 8, 0xE); phi_s2 += 0x2AAA; } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); } } -void func_809CE4C8(BgSpdweb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809CE4C8(BgSpdweb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; ColliderTrisElement* element; s16 sp3A; @@ -280,7 +280,7 @@ void func_809CE4C8(BgSpdweb* this, GlobalContext* globalCtx) { sp40.z = this->dyna.actor.world.pos.z; sp3A = player->unk_B6A; - if (func_80123F48(globalCtx, &sp40, 70.0f, 50.0f)) { + if (func_80123F48(play, &sp40, 70.0f, 50.0f)) { this->dyna.actor.home.pos.x = player->swordInfo[0].tip.x; this->dyna.actor.home.pos.z = player->swordInfo[0].tip.z; func_809CEE74(this); @@ -347,11 +347,11 @@ void func_809CE4C8(BgSpdweb* this, GlobalContext* globalCtx) { } func_809CE15C(this); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } #ifdef NON_MATCHING -void func_809CE830(BgSpdweb* this, GlobalContext* globalCtx) { +void func_809CE830(BgSpdweb* this, PlayState* play) { Vec3f spDC; Vec3f spD0; Vec3f spC4; @@ -415,20 +415,20 @@ void func_809CE830(BgSpdweb* this, GlobalContext* globalCtx) { spDC.y = temp_f22 * ((6.5f * temp_f28) * spB0); spDC.z = (6.5f * temp_f28) * ((temp_f22 * sp90) - (spA4 * temp_f20)); - EffectSsDeadDb_Spawn(globalCtx, &this->dyna.actor.home.pos, &spDC, &gZeroVec3f, &D_809CF208, &D_809CF20C, - 0x3C, 8, 0xE); + EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &spDC, &gZeroVec3f, &D_809CF208, &D_809CF20C, 0x3C, + 8, 0xE); temp_s3 += 0x2AAA; } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); } } #else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spdweb/func_809CE830.s") #endif -void func_809CEBC0(BgSpdweb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809CEBC0(BgSpdweb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sp58; f32 temp_f10; f32 temp_f18; @@ -477,7 +477,7 @@ void func_809CEBC0(BgSpdweb* this, GlobalContext* globalCtx) { } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } void func_809CEE74(BgSpdweb* this) { @@ -485,42 +485,42 @@ void func_809CEE74(BgSpdweb* this) { this->actionFunc = func_809CEEAC; } -void func_809CEEAC(BgSpdweb* this, GlobalContext* globalCtx) { +void func_809CEEAC(BgSpdweb* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - func_809CE1D0(this, globalCtx); + func_809CE1D0(this, play); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); } } -void BgSpdweb_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgSpdweb_Update(Actor* thisx, PlayState* play) { BgSpdweb* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgSpdweb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void BgSpdweb_Draw(Actor* thisx, PlayState* play) { Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_XLU_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); if (thisx->params == BGSPDWEB_FF_1) { - gSPMatrix(&gfx[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[2], object_spdweb_DL_000060); } 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(&gfx[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[2], object_spdweb_DL_0012F0); } POLY_XLU_DISP = &gfx[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.h b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.h index 9a71c278fd..2ae0aca412 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.h +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.h @@ -5,7 +5,7 @@ struct BgSpdweb; -typedef void (*BgSpdwebActionFunc)(struct BgSpdweb*, GlobalContext*); +typedef void (*BgSpdwebActionFunc)(struct BgSpdweb*, PlayState*); #define BGSPDWEB_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c index 08a7087e36..c43a13a25d 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c @@ -10,13 +10,13 @@ #define THIS ((BgSpoutFire*)thisx) -void BgSpoutFire_Init(Actor* thisx, GlobalContext* globalCtx); -void BgSpoutFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgSpoutFire_Update(Actor* thisx, GlobalContext* globalCtx); +void BgSpoutFire_Init(Actor* thisx, PlayState* play); +void BgSpoutFire_Destroy(Actor* thisx, PlayState* play); +void BgSpoutFire_Update(Actor* thisx, PlayState* play); -void func_80A60C94(BgSpoutFire* this, GlobalContext* globalCtx); -void func_80A60CDC(BgSpoutFire* this, GlobalContext* globalCtx); -void func_80A60D10(BgSpoutFire* this, GlobalContext* globalCtx); +void func_80A60C94(BgSpoutFire* this, PlayState* play); +void func_80A60CDC(BgSpoutFire* this, PlayState* play); +void func_80A60D10(BgSpoutFire* this, PlayState* play); #if 0 const ActorInit Bg_Spout_Fire_InitVars = { diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h index 6fc19e4ca0..54260cf71f 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h @@ -5,7 +5,7 @@ struct BgSpoutFire; -typedef void (*BgSpoutFireActionFunc)(struct BgSpoutFire*, GlobalContext*); +typedef void (*BgSpoutFireActionFunc)(struct BgSpoutFire*, PlayState*); typedef struct BgSpoutFire { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index f9b76fd006..55276b2177 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -11,10 +11,10 @@ #define THIS ((BgTobira01*)thisx) -void BgTobira01_Init(Actor* thisx, GlobalContext* globalCtx); -void BgTobira01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgTobira01_Update(Actor* thisx, GlobalContext* globalCtx); -void BgTobira01_Draw(Actor* thisx, GlobalContext* globalCtx); +void BgTobira01_Init(Actor* thisx, PlayState* play); +void BgTobira01_Destroy(Actor* thisx, PlayState* play); +void BgTobira01_Update(Actor* thisx, PlayState* play); +void BgTobira01_Draw(Actor* thisx, PlayState* play); const ActorInit Bg_Tobira01_InitVars = { ACTOR_BG_TOBIRA01, @@ -28,8 +28,8 @@ const ActorInit Bg_Tobira01_InitVars = { (ActorFunc)BgTobira01_Draw, }; -void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void BgTobira01_Open(BgTobira01* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 cutsceneId = this->dyna.actor.cutscene; s16 prevTimer; @@ -43,10 +43,9 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { } else { ActorCutscene_SetIntentToPlay(cutsceneId); } - } else if (!(gSaveContext.save.weekEventReg[88] & 0x40) && (this->timer == 0) && - (globalCtx->actorCtx.unk1F5 != 0) && (globalCtx->actorCtx.unk1F4 == 0) && - (SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId) == - 6)) { + } else if (!(gSaveContext.save.weekEventReg[88] & 0x40) && (this->timer == 0) && (play->actorCtx.unk1F5 != 0) && + (play->actorCtx.unk1F4 == 0) && + (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { this->playCutscene = true; this->unk_16C = 0; // this variable is not used anywhere else } @@ -73,12 +72,12 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { } } -void BgTobira01_Init(Actor* thisx, GlobalContext* globalCtx) { +void BgTobira01_Init(Actor* thisx, PlayState* play) { BgTobira01* this = THIS; s32 pad; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spot11_obj_Colheader_0011C0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_spot11_obj_Colheader_0011C0); gSaveContext.save.weekEventReg[88] &= (u8)~0x40; Actor_SetScale(&this->dyna.actor, 1.0f); this->timer2 = gSaveContext.save.isNight; @@ -86,26 +85,26 @@ void BgTobira01_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgTobira01_Open; } -void BgTobira01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void BgTobira01_Destroy(Actor* thisx, PlayState* play) { BgTobira01* this = THIS; s32 pad; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgTobira01_Update(Actor* thisx, GlobalContext* globalCtx) { +void BgTobira01_Update(Actor* thisx, PlayState* play) { BgTobira01* this = THIS; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void BgTobira01_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void BgTobira01_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_spot11_obj_DL_000088); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h index eeed58695a..559ea6351d 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h @@ -5,7 +5,7 @@ struct BgTobira01; -typedef void (*BgTobira01ActionFunc)(struct BgTobira01*, struct GlobalContext*); +typedef void (*BgTobira01ActionFunc)(struct BgTobira01*, struct PlayState*); typedef struct BgTobira01 { /* 0x000 */ 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 72aa44fb7b..894ced5529 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -10,9 +10,9 @@ #define THIS ((BgUmajump*)thisx) -void BgUmajump_Init(Actor* thisx, GlobalContext* globalCtx); -void BgUmajump_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BgUmajump_Update(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); #if 0 const ActorInit Bg_Umajump_InitVars = { diff --git a/src/overlays/actors/ovl_Boss_01/z_boss_01.c b/src/overlays/actors/ovl_Boss_01/z_boss_01.c index 4a6ef6e662..0907a6e9a1 100644 --- a/src/overlays/actors/ovl_Boss_01/z_boss_01.c +++ b/src/overlays/actors/ovl_Boss_01/z_boss_01.c @@ -10,32 +10,32 @@ #define THIS ((Boss01*)thisx) -void Boss01_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss01_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss01_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss01_Init(Actor* thisx, PlayState* play); +void Boss01_Destroy(Actor* thisx, PlayState* play); +void Boss01_Update(Actor* thisx, PlayState* play); +void Boss01_Draw(Actor* thisx, PlayState* play); -void func_809D12B4(Boss01* this, GlobalContext* globalCtx); -void func_809D1B2C(Boss01* this, GlobalContext* globalCtx); -void func_809D1E74(Boss01* this, GlobalContext* globalCtx); -void func_809D20D0(Boss01* this, GlobalContext* globalCtx); -void func_809D25E8(Boss01* this, GlobalContext* globalCtx); -void func_809D26B8(Boss01* this, GlobalContext* globalCtx); -void func_809D27D4(Boss01* this, GlobalContext* globalCtx); -void func_809D2AA0(Boss01* this, GlobalContext* globalCtx); -void func_809D2BCC(Boss01* this, GlobalContext* globalCtx); -void func_809D2CDC(Boss01* this, GlobalContext* globalCtx); -void func_809D2E4C(Boss01* this, GlobalContext* globalCtx); -void func_809D30D0(Boss01* this, GlobalContext* globalCtx); -void func_809D345C(Boss01* this, GlobalContext* globalCtx); -void func_809D3530(Boss01* this, GlobalContext* globalCtx); -void func_809D3ADC(Boss01* this, GlobalContext* globalCtx); -void func_809D3CD0(Boss01* this, GlobalContext* globalCtx); -void func_809D4464(Boss01* this, GlobalContext* globalCtx); -void func_809D6314(Boss01* this, GlobalContext* globalCtx); -void func_809D6488(Boss01* this, GlobalContext* globalCtx); -void func_809D6588(Boss01* this, GlobalContext* globalCtx); -void func_809D65E0(Boss01* this, GlobalContext* globalCtx); +void func_809D12B4(Boss01* this, PlayState* play); +void func_809D1B2C(Boss01* this, PlayState* play); +void func_809D1E74(Boss01* this, PlayState* play); +void func_809D20D0(Boss01* this, PlayState* play); +void func_809D25E8(Boss01* this, PlayState* play); +void func_809D26B8(Boss01* this, PlayState* play); +void func_809D27D4(Boss01* this, PlayState* play); +void func_809D2AA0(Boss01* this, PlayState* play); +void func_809D2BCC(Boss01* this, PlayState* play); +void func_809D2CDC(Boss01* this, PlayState* play); +void func_809D2E4C(Boss01* this, PlayState* play); +void func_809D30D0(Boss01* this, PlayState* play); +void func_809D345C(Boss01* this, PlayState* play); +void func_809D3530(Boss01* this, PlayState* play); +void func_809D3ADC(Boss01* this, PlayState* play); +void func_809D3CD0(Boss01* this, PlayState* play); +void func_809D4464(Boss01* this, PlayState* play); +void func_809D6314(Boss01* this, PlayState* play); +void func_809D6488(Boss01* this, PlayState* play); +void func_809D6588(Boss01* this, PlayState* play); +void func_809D65E0(Boss01* this, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_Boss_01/z_boss_01.h b/src/overlays/actors/ovl_Boss_01/z_boss_01.h index 2d2b0e59b2..ff9b772dc3 100644 --- a/src/overlays/actors/ovl_Boss_01/z_boss_01.h +++ b/src/overlays/actors/ovl_Boss_01/z_boss_01.h @@ -5,7 +5,7 @@ struct Boss01; -typedef void (*Boss01ActionFunc)(struct Boss01*, GlobalContext*); +typedef void (*Boss01ActionFunc)(struct Boss01*, PlayState*); typedef struct Boss01 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 900ca2a7d7..18996dc51b 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -15,22 +15,22 @@ #define THIS ((Boss02*)thisx) -void Boss02_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss02_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss02_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss02_Init(Actor* thisx, PlayState* play); +void Boss02_Destroy(Actor* thisx, PlayState* play); +void Boss02_Update(Actor* thisx, PlayState* play); +void Boss02_Draw(Actor* thisx, PlayState* play); -void func_809DAA74(Boss02* this, GlobalContext* globalCtx); -void func_809DAA98(Boss02* this, GlobalContext* globalCtx); -void func_809DAAA8(Boss02* this, GlobalContext* globalCtx); -void func_809DAB78(Boss02* this, GlobalContext* globalCtx); -void func_809DC218(Actor* thisx, GlobalContext* globalCtx); -void func_809DC78C(Actor* thisx, GlobalContext* globalCtx); -void func_809DD0A8(Actor* thisx, GlobalContext* globalCtx); -void func_809DD0CC(GlobalContext* globalCtx); -void func_809DD2F8(GlobalContext* globalCtx); -void func_809DD934(Boss02* this, GlobalContext* globalCtx); -void func_809DEAC4(Boss02* this, GlobalContext* globalCtx); +void func_809DAA74(Boss02* this, PlayState* play); +void func_809DAA98(Boss02* this, PlayState* play); +void func_809DAAA8(Boss02* this, PlayState* play); +void func_809DAB78(Boss02* this, PlayState* play); +void func_809DC218(Actor* thisx, PlayState* play); +void func_809DC78C(Actor* thisx, PlayState* play); +void func_809DD0A8(Actor* thisx, PlayState* play); +void func_809DD0CC(PlayState* play); +void func_809DD2F8(PlayState* play); +void func_809DD934(Boss02* this, PlayState* play); +void func_809DEAC4(Boss02* this, PlayState* play); u8 D_809E0420; u8 D_809E0421; @@ -462,7 +462,7 @@ static Vec3f D_809DFA2C[] = { { -800.0f, -1000.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, { -800.0f, -1000.0f, 0.0f }, }; -void func_809DA1D0(GlobalContext* globalCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4) { +void func_809DA1D0(PlayState* play, u8 arg1, u8 arg2, u8 arg3, u8 arg4) { MREG(64) = 1; MREG(65) = arg1; MREG(66) = arg2; @@ -470,11 +470,11 @@ void func_809DA1D0(GlobalContext* globalCtx, u8 arg1, u8 arg2, u8 arg3, u8 arg4) MREG(68) = arg4; } -void func_809DA22C(GlobalContext* globalCtx, u8 arg1) { +void func_809DA22C(PlayState* play, u8 arg1) { MREG(68) = arg1; } -void func_809DA24C(GlobalContext* globalCtx) { +void func_809DA24C(PlayState* play) { MREG(64) = 0; } @@ -545,15 +545,15 @@ void func_809DA50C(s32 arg0, ColliderJntSph* collider, Vec3f* arg2) { collider->elements[arg0].dim.modelSphere.radius * collider->elements[arg0].dim.scale * D_809DF5B0; } -void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { +void Boss02_Init(Actor* thisx, PlayState* play) { Boss02* this = THIS; s32 i; s32 pad[2]; if ((gSaveContext.save.weekEventReg[52] & 0x20) && (this->actor.params == 0)) { - D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, - 0.0f, 60.0f, 0.0f, 0, 0, 0, 1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); + D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 60.0f, + 0.0f, 0, 0, 0, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); } this->actor.targetMode = 10; @@ -561,7 +561,7 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1D3C.y = 1.0f; if (this->actor.params == 200) { D_809E042C = this; - globalCtx->specialEffects = (void*)D_809E0438; + play->specialEffects = (void*)D_809E0438; this->actor.update = func_809DC78C; this->actor.draw = func_809DD0A8; this->actor.flags &= ~ACTOR_FLAG_1; @@ -574,8 +574,7 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { } XREG(41) = KREG(14) + 20; this->unk_01AC = 1.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON5, 0.0f, 1000.0f, 0.0f, 0, 0, - 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON5, 0.0f, 1000.0f, 0.0f, 0, 0, 0, 0); } else if (this->actor.params == 100) { this->actor.update = func_809DC218; this->actor.draw = NULL; @@ -583,9 +582,9 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { } else { if (this->actor.params != 35) { this->actor.params = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); + Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); D_809E0424 = this; - D_809E0428 = (Boss02*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_02, this->actor.world.pos.x, + D_809E0428 = (Boss02*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, 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, 35); D_809E0424->actor.colChkInfo.damageTable = &sDamageTable2; @@ -597,18 +596,18 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 20; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gTwinmoldHeadSkel, &gTwinmoldHeadFlyAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gTwinmoldHeadSkel, &gTwinmoldHeadFlyAnim, this->jointTable, this->morphTable, TWINMOLD_HEAD_LIMB_MAX); - Collider_InitAndSetJntSph(globalCtx, &this->colliderSphere1, &this->actor, &sJntSphInit1, + Collider_InitAndSetJntSph(play, &this->colliderSphere1, &this->actor, &sJntSphInit1, this->colliderSphere1Elements); - Collider_InitAndSetJntSph(globalCtx, &this->colliderSphere2, &this->actor, &sJntSphInit2, + Collider_InitAndSetJntSph(play, &this->colliderSphere2, &this->actor, &sJntSphInit2, this->colliderSphere2Elements); - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); if (D_809E0434 != NULL) { - func_809DAA74(this, globalCtx); + func_809DAA74(this, play); } else { - func_809DAAA8(this, globalCtx); + func_809DAAA8(this, play); } for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { @@ -619,23 +618,22 @@ void Boss02_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_014C = Rand_ZeroFloat(1000.0f); this->unk_1678 = 22; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, - 100); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 100); } } -void Boss02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Boss02_Destroy(Actor* thisx, PlayState* play) { } -void func_809DAA74(Boss02* this, GlobalContext* globalCtx) { +void func_809DAA74(Boss02* this, PlayState* play) { this->actionFunc = func_809DAA98; this->actor.world.pos.y = -3000.0f; } -void func_809DAA98(Boss02* this, GlobalContext* globalCtx) { +void func_809DAA98(Boss02* this, PlayState* play) { } -void func_809DAAA8(Boss02* this, GlobalContext* globalCtx) { +void func_809DAAA8(Boss02* this, PlayState* play) { this->actionFunc = func_809DAB78; Animation_MorphToLoop(&this->skelAnime, &gTwinmoldHeadFlyAnim, 0.0f); if (D_809E042C->unk_1D20 != 0) { @@ -654,10 +652,10 @@ void func_809DAAA8(Boss02* this, GlobalContext* globalCtx) { this->actor.world.pos.y = -500.0f; } -void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { +void func_809DAB78(Boss02* this, PlayState* play) { static Color_RGBA8 D_809DFA98 = { 185, 140, 70, 255 }; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); CollisionPoly* spDC; Vec3f spD0; f32 spCC; @@ -724,7 +722,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { spD0.y = 2000.0f; } - temp_f0 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &spDC, &spD0); + temp_f0 = BgCheck_EntityRaycastFloor1(&play->colCtx, &spDC, &spD0); if (((this->unk_017C.y < temp_f0) && (temp_f0 <= this->unk_0188.y)) || ((temp_f0 < this->unk_017C.y) && (this->unk_0188.y <= temp_f0))) { this->unk_0170 = this->unk_017C; @@ -866,8 +864,8 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.height = 200.0f * D_809DF5B0; this->colliderCylinder.dim.yShift = 0; Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } return; @@ -950,10 +948,10 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { this->unk_0146[0] = 3; for (i = 0; i < 35; i++) { - func_809DA344(globalCtx->specialEffects, &this->unk_147C[this->unk_1678]); + func_809DA344(play->specialEffects, &this->unk_147C[this->unk_1678]); } - func_809DA460(globalCtx->specialEffects, &this->unk_147C[this->unk_1678]); + func_809DA460(play->specialEffects, &this->unk_147C[this->unk_1678]); play_sound(NA_SE_EV_EXPLOSION); this->unk_1678--; @@ -992,7 +990,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { this->unk_0B1C[i].y += this->unk_0164; Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.1f, 0.07f); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); if (this->actor.bgCheckFlags & 1) { this->unk_0144 = 23; @@ -1007,7 +1005,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { play_sound(NA_SE_EV_LIGHTNING); for (i = 0; i < 30; i++) { - func_809DA344(globalCtx->specialEffects, &this->unk_0170); + func_809DA344(play->specialEffects, &this->unk_0170); } this->unk_0146[0] = 10; @@ -1028,8 +1026,8 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { spD0.x = this->unk_0170.x + sp90.x; spD0.y = this->unk_0170.y + (1000.0f * D_809DF5B0); spD0.z = this->unk_0170.z + sp90.z; - if (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp8C, &sp88, &spD0) != BGCHECK_Y_MIN) { - spA0 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp8C, &spD0); + if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp8C, &sp88, &spD0) != BGCHECK_Y_MIN) { + spA0 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp8C, &spD0); Matrix_MultVecZ(5.0f * D_809DF5B0, &sp70); sp70.y = 2.0f * D_809DF5B0; sp64.y = 0.3f * D_809DF5B0; @@ -1038,7 +1036,7 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { sp7C.x = spD0.x; sp7C.y = spA0; sp7C.z = spD0.z; - func_800B0F18(globalCtx, &sp7C, &sp70, &sp64, &D_809DFA98, &D_809DFA98, + func_800B0F18(play, &sp7C, &sp70, &sp64, &D_809DFA98, &D_809DFA98, (Rand_ZeroFloat(500.0f) + 1200.0f) * D_809DF5B0, 20.0f * D_809DF5B0, Rand_ZeroFloat(5.0f) + 14.0f); } @@ -1050,10 +1048,10 @@ void func_809DAB78(Boss02* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.height = 200.0f * D_809DF5B0; this->colliderCylinder.dim.yShift = 0; Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } -void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { +void func_809DBFB4(Boss02* this, PlayState* play) { Boss02* temp_s6 = this->unk_1674; s32 temp; s32 i; @@ -1098,7 +1096,7 @@ void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health <= 0) { Actor_MarkForDeath(this->actor.child); this->actor.child = NULL; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->skelAnime.playSpeed = 2.0f; this->unk_0144 = 20; @@ -1134,7 +1132,7 @@ void func_809DBFB4(Boss02* this, GlobalContext* globalCtx) { } } -void func_809DC218(Actor* thisx, GlobalContext* globalCtx) { +void func_809DC218(Actor* thisx, PlayState* play) { Boss02* this = THIS; s32 pad; Vec3f sp24; @@ -1150,8 +1148,7 @@ void func_809DC218(Actor* thisx, GlobalContext* globalCtx) { sp24.y = 2000.0f; } - if ((this->actor.focus.pos.y < BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp20, &sp24)) || - (D_809E0422 != 0)) { + if ((this->actor.focus.pos.y < BgCheck_EntityRaycastFloor1(&play->colCtx, &sp20, &sp24)) || (D_809E0422 != 0)) { this->actor.flags &= ~ACTOR_FLAG_1; } else { this->actor.flags |= ACTOR_FLAG_1; @@ -1159,7 +1156,7 @@ void func_809DC218(Actor* thisx, GlobalContext* globalCtx) { } } -void Boss02_Update(Actor* thisx, GlobalContext* globalCtx) { +void Boss02_Update(Actor* thisx, PlayState* play) { Vec3f sp3C; Boss02* this = THIS; s32 pad; @@ -1196,7 +1193,7 @@ void Boss02_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_014C++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_016C != 0) { if ((this->unk_016C == 60) && (this->unk_0144 < 20)) { @@ -1208,25 +1205,25 @@ void Boss02_Update(Actor* thisx, GlobalContext* globalCtx) { sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; - func_809DA264(globalCtx->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); + func_809DA264(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); } if ((this->unk_014C % 2) == 0) { sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; sp3C.y = randPlusMinusPoint5Scaled(50.0f * D_809DF5B0) + this->unk_0170.y; sp3C.z = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.z; - func_809DA264(globalCtx->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); + func_809DA264(play->specialEffects, &sp3C, Rand_ZeroFloat(3.0f) + 6.0f); } } if ((this->unk_0144 < 20) && (this->unk_0144 != 10)) { - func_809DBFB4(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere2.base); + func_809DBFB4(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSphere2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere2.base); } switch (this->unk_015C) { @@ -1277,27 +1274,27 @@ void Boss02_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_809DC78C(Actor* thisx, GlobalContext* globalCtx) { +void func_809DC78C(Actor* thisx, PlayState* play) { Boss02* this = THIS; this->unk_01AC = D_809DF5B0; - globalCtx->envCtx.sandstormState = 0xD; + play->envCtx.sandstormState = 0xD; if (D_809E0434 != NULL) { this->unk_1D74 = KREG(23) + -15.0f; D_801F4E30 = 0; - globalCtx->envCtx.lightSettingOverride = 1; - globalCtx->skyboxId = 1; + play->envCtx.lightSettingOverride = 1; + play->skyboxId = 1; } else if (D_809E0422 == 0) { this->unk_1D74 = 0.0f; D_801F4E30 = this->unk_1D7C; - globalCtx->envCtx.lightSettingOverride = 0; - globalCtx->skyboxId = 2; + play->envCtx.lightSettingOverride = 0; + play->skyboxId = 2; } else { this->unk_1D74 = KREG(23) + -15.0f; D_801F4E30 = ((KREG(24) * 0.1f) + 1.0f) * this->unk_1D7C; - globalCtx->envCtx.lightSettingOverride = 1; - globalCtx->skyboxId = 1; + play->envCtx.lightSettingOverride = 1; + play->skyboxId = 1; } Math_ApproachS(&this->unk_1D7C, this->unk_1D7E, 1, 3); @@ -1315,12 +1312,12 @@ void func_809DC78C(Actor* thisx, GlobalContext* globalCtx) { } } - func_809DD0CC(globalCtx); - func_809DEAC4(this, globalCtx); - func_809DD934(this, globalCtx); + func_809DD0CC(play); + func_809DEAC4(this, play); + func_809DD934(this, play); } -void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { +void Boss02_Draw(Actor* thisx, PlayState* play2) { static Gfx* D_809DFA9C[] = { gTwinmoldBodySegment1DL, gTwinmoldBodySegment2DL, gTwinmoldBodySegment3DL, gTwinmoldBodySegment4DL, gTwinmoldBodySegment5DL, gTwinmoldBodySegment6DL, gTwinmoldBodySegment7DL, gTwinmoldBodySegment8DL, @@ -1330,7 +1327,7 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { gTwinmoldBodySegment21DL, gTwinmoldBodyTailDL, }; static Vec3f D_809DFAF4 = { -10000.0f, -100000.0f, -100000.0f }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Boss02* this = THIS; s32 i; s32 idx; @@ -1345,11 +1342,11 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { f32 sp9C; f32 sp98; - mtxIter = mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Mtx) * 23); + mtxIter = mtx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 23); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->actor.params == 0) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gTwinmoldRedSkinTex)); @@ -1389,8 +1386,8 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 0x384, 0x44B); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); spA4 = 0.0f; spA0 = 0.0f; @@ -1425,7 +1422,7 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (sp98 < this->unk_01BC[phi_v0].y) { gSPDisplayList(POLY_OPA_DISP++, D_809DFA9C[i]); } - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); } if (i == 21) { @@ -1444,14 +1441,14 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { } func_809DA50C(1, &this->colliderSphere2, &this->unk_147C[i + 1]); - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->unk_147C[i + 1], &this->unk_167C, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->unk_147C[i + 1], &this->unk_167C, &this->actor.projectedW); } else { func_809DA50C(i, &this->colliderSphere1, &this->unk_147C[i + 1]); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (D_809E0422 == 0) { func_809DA50C(0, &this->colliderSphere2, &D_809DFAF4); @@ -1462,12 +1459,12 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_809DD0A8(Actor* thisx, GlobalContext* globalCtx) { - func_809DD2F8(globalCtx); +void func_809DD0A8(Actor* thisx, PlayState* play) { + func_809DD2F8(play); } -void func_809DD0CC(GlobalContext* globalCtx) { - Boss02Effects* effect = (Boss02Effects*)globalCtx->specialEffects; +void func_809DD0CC(PlayState* play) { + Boss02Effects* effect = (Boss02Effects*)play->specialEffects; f32 phi_f22; s16 i; @@ -1512,16 +1509,16 @@ void func_809DD0CC(GlobalContext* globalCtx) { } } -void func_809DD2F8(GlobalContext* globalCtx) { +void func_809DD2F8(PlayState* play) { u8 flag = false; - Boss02Effects* effect = (Boss02Effects*)globalCtx->specialEffects; + Boss02Effects* effect = (Boss02Effects*)play->specialEffects; s16 i; u8 phi_a0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effect++) { if (effect->unk_24 == 1) { @@ -1538,20 +1535,19 @@ void func_809DD2F8(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 185, 140, 70, phi_a0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->unk_26 + (i * 3), - (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, effect->unk_26 + (i * 3), (effect->unk_26 + (i * 3)) * 5, + 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustModelDL); } } - effect = (Boss02Effects*)globalCtx->specialEffects; + effect = (Boss02Effects*)play->specialEffects; for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { if (effect->unk_24 == 3) { if (!flag) { @@ -1566,13 +1562,12 @@ void func_809DD2F8(GlobalContext* globalCtx) { Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_01A620); } } - effect = (Boss02Effects*)globalCtx->specialEffects; + effect = (Boss02Effects*)play->specialEffects; for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { if (effect->unk_24 == 4) { if (!flag) { //! @bug - dev forgot to set flag to 1, should only apply to first entry? @@ -1583,16 +1578,15 @@ void func_809DD2F8(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)effect->unk_2C); Matrix_Translate(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL); } } - effect = (Boss02Effects*)globalCtx->specialEffects; + effect = (Boss02Effects*)play->specialEffects; for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { if (effect->unk_24 == 2) { if (!flag) { @@ -1603,24 +1597,23 @@ void func_809DD2F8(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 30, 30, 30, (u8)effect->unk_2C); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, effect->unk_26 + (i * 3), - (effect->unk_26 + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, effect->unk_26 + (i * 3), (effect->unk_26 + (i * 3)) * 5, + 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->unk_00.x, effect->unk_00.y, effect->unk_00.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_34 * D_809DF5B0, effect->unk_34 * D_809DF5B0, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustModelDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809DD934(Boss02* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809DD934(Boss02* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 i; Actor* temp_a0_5; Vec3f sp58; @@ -1633,10 +1626,10 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { switch (this->unk_1D18) { case 0: if (player->stateFlags1 & 0x100) { - Cutscene_Start(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); + Cutscene_Start(play, &play->csCtx); + this->unk_1D22 = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->unk_1D22, 7); func_8016566C(150); this->unk_1D14 = 0; this->unk_1D5C = 0.0f; @@ -1664,7 +1657,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 1: if ((this->unk_1D14 < 80U) && (D_809E0420 != 0) && - CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, + CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { this->unk_1D18++; this->unk_1D78 = 1; @@ -1713,7 +1706,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 10: if ((this->unk_1D14 < 30U) && (D_809E0421 != 0) && - CHECK_BTN_ANY(CONTROLLER1(&globalCtx->state)->press.button, + CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_A | BTN_B | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT)) { this->unk_1D18++; this->unk_1D78 = 1; @@ -1751,9 +1744,9 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { block_38: case 20: this->unk_1D18 = 0; - func_80169AFC(globalCtx, this->unk_1D22, 0); + func_80169AFC(play, this->unk_1D22, 0); this->unk_1D22 = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); + Cutscene_End(play, &play->csCtx); this->actor.flags |= ACTOR_FLAG_1; player->stateFlags1 &= ~0x100; this->unk_1D70 = 0.01f; @@ -1767,7 +1760,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { Actor_SetScale(&player->actor, this->unk_1D70); } - globalCtx->envCtx.lightSettings.fogNear = this->unk_1D74; + play->envCtx.lightSettings.fogNear = this->unk_1D74; if (sp57) { D_809E0422 = 1 - D_809E0422; @@ -1921,7 +1914,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { player->actor.home.pos = player->actor.world.pos; player->actor.prevPos = player->actor.world.pos; - temp_a0_5 = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; + temp_a0_5 = play->actorCtx.actorLists[ACTORCAT_BG].first; while (temp_a0_5 != NULL) { if (temp_a0_5->id == ACTOR_BG_INIBS_MOVEBG) { Actor_MarkForDeath(temp_a0_5); @@ -1932,10 +1925,10 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { { f32 tmp = D_809E0422 ? 3150.0f : 0.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_INIBS_MOVEBG, 0, tmp, 0, 0, 0, 0, D_809E0422); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_INIBS_MOVEBG, 0, tmp, 0, 0, 0, 0, D_809E0422); } - temp_a0_5 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + temp_a0_5 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (temp_a0_5 != NULL) { if ((temp_a0_5->id == ACTOR_EN_TANRON5) || (temp_a0_5->id == ACTOR_ITEM_B_HEART)) { if (D_809E0422 == 0) { @@ -1986,7 +1979,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 1: this->unk_1D7A = 0; - func_809DA1D0(globalCtx, 255, 255, 255, 0); + func_809DA1D0(play, 255, 255, 255, 0); this->unk_1D78 = 2; play_sound(NA_SE_SY_TRANSFORM_MASK_FLASH); @@ -1999,7 +1992,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { if (phi_v1 > 255) { phi_v1 = 255; } - func_809DA22C(globalCtx, phi_v1); + func_809DA22C(play, phi_v1); break; case 3: @@ -2007,13 +2000,13 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { if (this->unk_1D7A <= 0) { this->unk_1D7A = 0; this->unk_1D78 = 0; - func_809DA24C(globalCtx); + func_809DA24C(play); } else { phi_v1 = this->unk_1D7A; if (phi_v1 > 255) { phi_v1 = 255; } - func_809DA22C(globalCtx, phi_v1); + func_809DA22C(play, phi_v1); } break; } @@ -2033,13 +2026,13 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY); Matrix_MultVecY(1.0f, &this->unk_1D3C); - Play_CameraSetAtEyeUp(globalCtx, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); + Play_CameraSetAtEyeUp(play, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); ShrinkWindow_SetLetterboxTarget(27); } } -void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809DEAC4(Boss02* this, PlayState* play) { + Player* player = GET_PLAYER(play); Boss02* sp68; Vec3f sp5C; f32 sp58 = 0.0f; @@ -2059,10 +2052,10 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { if ((gSaveContext.save.weekEventReg[52] & 0x20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { break; } - Cutscene_Start(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); + Cutscene_Start(play, &play->csCtx); + this->unk_1D22 = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->unk_1D22, 7); this->unk_1D20 = 2; this->unk_1D1C = 0; @@ -2092,7 +2085,7 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { } if (this->unk_1D1C == 45) { - func_800B7298(globalCtx, &this->actor, 21); + func_800B7298(play, &this->actor, 21); D_809E0430 = KREG(91) + 43; } @@ -2106,7 +2099,7 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { } if (this->unk_1D1C == 100) { - func_800B7298(globalCtx, &this->actor, 0x73); + func_800B7298(play, &this->actor, 0x73); } if (this->unk_1D1C == 112) { @@ -2137,15 +2130,15 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { } if (this->unk_1D1C == (u32)(KREG(92) + 125)) { - TitleCard_InitBossName(&globalCtx->state, &globalCtx->actorCtx.titleCtxt, + TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, Lib_SegmentedToVirtual(gTwinmoldTitleCardTex), 160, 180, 128, 40); } if (this->unk_1D1C == (u32)(BREG(27) + 335)) { - func_80169AFC(globalCtx, this->unk_1D22, 0); + func_80169AFC(play, this->unk_1D22, 0); this->unk_1D22 = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); this->actor.flags |= ACTOR_FLAG_1; this->unk_1D20 = 0; D_809E0424->unk_0144 = D_809E0428->unk_0144 = 3; @@ -2156,10 +2149,10 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { case 100: if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); + Cutscene_Start(play, &play->csCtx); + this->unk_1D22 = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->unk_1D22, 7); this->unk_1D20 = 101; this->unk_1D1C = 0; this->unk_1D5C = 1.0f; @@ -2203,10 +2196,10 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { sp58 = Math_SinS(this->unk_0150); sp58 = (sp58 * this->unk_0146[0]) * 1.5f; if (this->unk_1D1C == 30) { - func_80169AFC(globalCtx, this->unk_1D22, 0); + func_80169AFC(play, this->unk_1D22, 0); this->unk_1D22 = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); this->unk_1D20 = 0; this->actor.flags |= ACTOR_FLAG_1; sp68->unk_0144 = 10; @@ -2215,16 +2208,14 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { this->unk_1D7E = 0; if (D_809E0422 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, - 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); phi_f0 = 60.0f; } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, 3153.0f, -15.0f, 0, 1, 0, - 35); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 3153.0f, -15.0f, 0, 1, 0, 35); phi_f0 = 3155.0f; } - D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, - ACTOR_DOOR_WARP1, 0.0f, phi_f0, 0.0f, 0, 0, 0, 1); + D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, + 0.0f, phi_f0, 0.0f, 0, 0, 0, 1); if (D_809E0422 == 0) { D_809E0434->unk_203 = 0; @@ -2241,7 +2232,7 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { if ((this->unk_1D20 != 0) && (this->unk_1D22 != 0)) { sp5C = this->unk_1D24; sp5C.y += sp58 * D_809DF5B0; - Play_CameraSetAtEyeUp(globalCtx, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); + Play_CameraSetAtEyeUp(play, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; this->unk_1D3C.y = 1.0f; ShrinkWindow_SetLetterboxTarget(27); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.h b/src/overlays/actors/ovl_Boss_02/z_boss_02.h index 6c20814fbc..6c4253aceb 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.h +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.h @@ -6,7 +6,7 @@ struct Boss02; -typedef void (*Boss02ActionFunc)(struct Boss02*, GlobalContext*); +typedef void (*Boss02ActionFunc)(struct Boss02*, PlayState*); typedef struct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 9691940d1e..91a4c88774 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -77,37 +77,37 @@ #define PLATFORM_HEIGHT 440.0f #define WATER_HEIGHT 430.0f -void Boss03_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss03_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss03_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss03_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss03_Init(Actor* thisx, PlayState* play); +void Boss03_Destroy(Actor* thisx, PlayState* play); +void Boss03_Update(Actor* thisx, PlayState* play); +void Boss03_Draw(Actor* thisx, PlayState* play); -void func_809E344C(Boss03* this, GlobalContext* globalCtx); -void func_809E34B8(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupChasePlayer(Boss03* this, GlobalContext* globalCtx); -void Boss03_ChasePlayer(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupCatchPlayer(Boss03* this, GlobalContext* globalCtx, u8 arg2); -void Boss03_CatchPlayer(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupChewPlayer(Boss03* this, GlobalContext* globalCtx); -void Boss03_ChewPlayer(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupPrepareCharge(Boss03* this, GlobalContext* globalCtx); -void Boss03_PrepareCharge(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupCharge(Boss03* this, GlobalContext* globalCtx); -void Boss03_Charge(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupJumpOverPlatform(Boss03* this, GlobalContext* globalCtx); -void Boss03_JumpOverPlatform(Boss03* this, GlobalContext* globalCtx); -void Boss03_SetupIntroCutscene(Boss03* this, GlobalContext* globalCtx); -void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx); -void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx); -void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx); -void Boss03_Stunned(Boss03* this, GlobalContext* globalCtx); -void Boss03_Damaged(Boss03* this, GlobalContext* globalCtx); +void func_809E344C(Boss03* this, PlayState* play); +void func_809E34B8(Boss03* this, PlayState* play); +void Boss03_SetupChasePlayer(Boss03* this, PlayState* play); +void Boss03_ChasePlayer(Boss03* this, PlayState* play); +void Boss03_SetupCatchPlayer(Boss03* this, PlayState* play, u8 arg2); +void Boss03_CatchPlayer(Boss03* this, PlayState* play); +void Boss03_SetupChewPlayer(Boss03* this, PlayState* play); +void Boss03_ChewPlayer(Boss03* this, PlayState* play); +void Boss03_SetupPrepareCharge(Boss03* this, PlayState* play); +void Boss03_PrepareCharge(Boss03* this, PlayState* play); +void Boss03_SetupCharge(Boss03* this, PlayState* play); +void Boss03_Charge(Boss03* this, PlayState* play); +void Boss03_SetupJumpOverPlatform(Boss03* this, PlayState* play); +void Boss03_JumpOverPlatform(Boss03* this, PlayState* play); +void Boss03_SetupIntroCutscene(Boss03* this, PlayState* play); +void Boss03_IntroCutscene(Boss03* this, PlayState* play); +void Boss03_DeathCutscene(Boss03* this, PlayState* play); +void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play); +void Boss03_Stunned(Boss03* this, PlayState* play); +void Boss03_Damaged(Boss03* this, PlayState* play); -void Boss03_UpdateEffects(GlobalContext* globalCtx); -void Boss03_DrawEffects(GlobalContext* globalCtx); +void Boss03_UpdateEffects(PlayState* play); +void Boss03_DrawEffects(PlayState* play); -void Boss03_SeaweedUpdate(Actor* thisx, GlobalContext* globalCtx); -void Boss03_SeaweedDraw(Actor* thisx, GlobalContext* globalCtx); +void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play); +void Boss03_SeaweedDraw(Actor* thisx, PlayState* play); u8 D_809E9840; // Timer used to start playing the boss background music if the intro cutscene was skipped (because it was already @@ -130,9 +130,9 @@ void Boss03_PlayUnderwaterSfx(Vec3f* projectedPos, u16 sfxId) { /* Start of SpawnEffect section */ -void Boss03_SpawnEffectWetSpot(GlobalContext* globalCtx, Vec3f* pos) { +void Boss03_SpawnEffectWetSpot(PlayState* play, Vec3f* pos) { s16 i; - GyorgEffect* eff = globalCtx->specialEffects; + GyorgEffect* eff = play->specialEffects; for (i = 0; i < GYORG_EFFECT_COUNT; i++) { if ((eff->type == GYORG_EFFECT_NONE) || (eff->type == GYORG_EFFECT_BUBBLE)) { @@ -151,9 +151,9 @@ void Boss03_SpawnEffectWetSpot(GlobalContext* globalCtx, Vec3f* pos) { } } -void Boss03_SpawnEffectDroplet(GlobalContext* globalCtx, Vec3f* pos) { +void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) { s16 i; - GyorgEffect* eff = globalCtx->specialEffects; + GyorgEffect* eff = play->specialEffects; for (i = 0; i < GYORG_EFFECT_COUNT; i++) { if ((eff->type == GYORG_EFFECT_NONE) || (eff->type == GYORG_EFFECT_BUBBLE)) { @@ -175,10 +175,10 @@ void Boss03_SpawnEffectDroplet(GlobalContext* globalCtx, Vec3f* pos) { } } -void Boss03_SpawnEffectSplash(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity) { +void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) { Vec3f accel = { 0.0f, -1.0f, 0.0f }; f32 temp_f2; - GyorgEffect* eff = globalCtx->specialEffects; + GyorgEffect* eff = play->specialEffects; s16 i; for (i = 0; i < GYORG_EFFECT_COUNT; i++) { @@ -199,9 +199,9 @@ void Boss03_SpawnEffectSplash(GlobalContext* globalCtx, Vec3f* pos, Vec3f* veloc } } -void Boss03_SpawnEffectBubble(GlobalContext* globalCtx, Vec3f* pos) { +void Boss03_SpawnEffectBubble(PlayState* play, Vec3f* pos) { s16 i; - GyorgEffect* eff = globalCtx->specialEffects; + GyorgEffect* eff = play->specialEffects; for (i = 0; i < GYORG_EFFECT_COUNT; i++) { if (eff->type == GYORG_EFFECT_NONE) { @@ -263,8 +263,8 @@ f32 Boss03_RandZeroOne(void) { /* End of RNG section */ // ACTOR_BG_DBLUE_MOVEBG is never spawned naturally on Gyorg's fight -Actor* Boss03_FindActorDblueMovebg(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +Actor* Boss03_FindActorDblueMovebg(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_BG].first; while (actor != NULL) { if (actor->id == ACTOR_BG_DBLUE_MOVEBG) { @@ -421,7 +421,7 @@ Color_RGBA8 sGyorgDustEnvColor = { 40, 30, 30, 255 }; /** * Used when chasing Player and Gyorg is near the bottom */ -void Boss03_SpawnDust(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SpawnDust(Boss03* this, PlayState* play) { if (this->insideJawPos.y < 80.0f) { u8 i; Vec3f pos; @@ -441,22 +441,22 @@ void Boss03_SpawnDust(Boss03* this, GlobalContext* globalCtx) { pos.z = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.z; pos.x = randPlusMinusPoint5Scaled(150.0f) + this->insideJawPos.x; - func_800B0EB0(globalCtx, &pos, &velocity, &accel, &sGyorgDustPrimColor, &sGyorgDustEnvColor, + func_800B0EB0(play, &pos, &velocity, &accel, &sGyorgDustPrimColor, &sGyorgDustEnvColor, Rand_ZeroFloat(200.0f) + 400.0f, 10, Rand_ZeroFloat(10.0f) + 25.0f); } } } -void Boss03_Init(Actor* thisx, GlobalContext* globalCtx2) { +void Boss03_Init(Actor* thisx, PlayState* play2) { Boss03* this = THIS; s32 i; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Vec3f sp70; if (gSaveContext.save.weekEventReg[55] & 0x80) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, PLATFORM_HEIGHT, - 200.0f, 0, 0, 0, ENDOORWARP1_FF_1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, 0.0f, PLATFORM_HEIGHT, 0.0f, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, PLATFORM_HEIGHT, 200.0f, 0, 0, + 0, ENDOORWARP1_FF_1); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, PLATFORM_HEIGHT, 0.0f, 0, 0, 0, 0); Actor_MarkForDeath(&this->actor); return; } @@ -497,13 +497,13 @@ void Boss03_Init(Actor* thisx, GlobalContext* globalCtx2) { Matrix_MultVecZ((rand * 800.0f) + 400.0f, &sp70); rand = Boss03_RandZeroOne(); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BOSS_03, sp70.x, sp70.y, sp70.z, 0, rand * 0x10000, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_03, sp70.x, sp70.y, sp70.z, 0, rand * 0x10000, 0, GYORG_PARAM_SEAWEED); } sGyorgBossInstance = this; - globalCtx->specialEffects = sGyorgEffects; + play->specialEffects = sGyorgEffects; for (i = 0; i < ARRAY_COUNT(sGyorgEffects); i++) { sGyorgEffects[i].type = GYORG_EFFECT_NONE; @@ -513,12 +513,10 @@ void Boss03_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 10; - Collider_InitAndSetJntSph(globalCtx, &this->headCollider, &this->actor, &sHeadJntSphInit, - this->headColliderElements); - Collider_InitAndSetJntSph(globalCtx, &this->bodyCollider, &this->actor, &sBodyJntSphInit, - this->bodyColliderElements); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGyorgSkel, &gGyorgCrawlingAnim, this->jointTable, - this->morphTable, GYORG_LIMB_MAX); + Collider_InitAndSetJntSph(play, &this->headCollider, &this->actor, &sHeadJntSphInit, this->headColliderElements); + Collider_InitAndSetJntSph(play, &this->bodyCollider, &this->actor, &sBodyJntSphInit, this->bodyColliderElements); + SkelAnime_InitFlex(play, &this->skelAnime, &gGyorgSkel, &gGyorgCrawlingAnim, this->jointTable, this->morphTable, + GYORG_LIMB_MAX); Actor_SetScale(&this->actor, 0.2f); // gSaveContext.eventInf[5] & 0x40: intro cutscene already watched @@ -527,7 +525,7 @@ void Boss03_Init(Actor* thisx, GlobalContext* globalCtx2) { D_809E9842 = false; Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); } else { - Boss03_SetupIntroCutscene(this, globalCtx); + Boss03_SetupIntroCutscene(this, play); D_809E9842 = true; } @@ -535,14 +533,14 @@ void Boss03_Init(Actor* thisx, GlobalContext* globalCtx2) { this->waterHeight = WATER_HEIGHT; } -void Boss03_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Boss03_Destroy(Actor* thisx, PlayState* play) { Boss03* this = THIS; } /* Start of ActionFuncs section */ -void func_809E344C(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809E344C(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); // Mid-air if (player->actor.world.pos.y < 540.0f) { @@ -556,14 +554,14 @@ void func_809E344C(Boss03* this, GlobalContext* globalCtx) { /** * Swims randomly until WORK_TIMER_UNK1_A runs out */ -void func_809E34B8(Boss03* this, GlobalContext* globalCtx) { +void func_809E34B8(Boss03* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; f32 bodyYRotTarget; s32 pad; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_WAIT_OLD - SFX_FLAG); @@ -626,18 +624,18 @@ void func_809E34B8(Boss03* this, GlobalContext* globalCtx) { if (this->workTimer[WORK_TIMER_UNK1_A] == 0) { // Player is above water && Player is standing on ground if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { - Boss03_SetupPrepareCharge(this, globalCtx); + Boss03_SetupPrepareCharge(this, play); } else if ((player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU)) { if (KREG(70) == 0) { - Boss03_SetupChasePlayer(this, globalCtx); + Boss03_SetupChasePlayer(this, play); } else if (this->numSpawnedSmallFish <= 0) { - Boss03_SetupChasePlayer(this, globalCtx); + Boss03_SetupChasePlayer(this, play); } } } } -void Boss03_SetupChasePlayer(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupChasePlayer(Boss03* this, PlayState* play) { this->actionFunc = Boss03_ChasePlayer; Animation_MorphToLoop(&this->skelAnime, &gGyorgFastSwimmingAnim, -10.0f); this->workTimer[WORK_TIMER_CURRENT_ACTION] = 100; @@ -650,8 +648,8 @@ void Boss03_SetupChasePlayer(Boss03* this, GlobalContext* globalCtx) { /** * Approach Player until near enough, then try to catch Player, unless it has since got back on the platform */ -void Boss03_ChasePlayer(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Boss03_ChasePlayer(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xDiff; f32 yDiff; f32 zDiff; @@ -693,7 +691,7 @@ void Boss03_ChasePlayer(Boss03* this, GlobalContext* globalCtx) { player->csMode = 0; } - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 100; } else { if ((this->waterHeight - 80.0f) < player->actor.world.pos.y) { @@ -722,11 +720,11 @@ void Boss03_ChasePlayer(Boss03* this, GlobalContext* globalCtx) { // Near enough to Player? if (sqrtf(SQ(xDiff) + SQ(zDiff)) < phi_f2) { - Boss03_SetupCatchPlayer(this, globalCtx, sp43); + Boss03_SetupCatchPlayer(this, play, sp43); if (sp43 != 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, player->actor.world.pos.x, - this->waterHeight, player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, player->actor.world.pos.x, this->waterHeight, + player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_SINK_OLD); } @@ -734,10 +732,10 @@ void Boss03_ChasePlayer(Boss03* this, GlobalContext* globalCtx) { } } - Boss03_SpawnDust(this, globalCtx); + Boss03_SpawnDust(this, play); } -void Boss03_SetupCatchPlayer(Boss03* this, GlobalContext* globalCtx, u8 arg2) { +void Boss03_SetupCatchPlayer(Boss03* this, PlayState* play, u8 arg2) { this->actionFunc = Boss03_CatchPlayer; Animation_MorphToLoop(&this->skelAnime, &gGyorgFastSwimmingAnim, -15.0f); this->workTimer[WORK_TIMER_CURRENT_ACTION] = 100; @@ -746,8 +744,8 @@ void Boss03_SetupCatchPlayer(Boss03* this, GlobalContext* globalCtx, u8 arg2) { this->unk_242 = arg2; } -void Boss03_CatchPlayer(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Boss03_CatchPlayer(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xDiff; f32 yDiff; f32 zDiff; @@ -789,7 +787,7 @@ void Boss03_CatchPlayer(Boss03* this, GlobalContext* globalCtx) { func_80165690(); } - func_809E344C(this, globalCtx); + func_809E344C(this, play); // WORK_TIMER_UNK1_A wasn't set } else { f32 phi_f0; @@ -807,11 +805,11 @@ void Boss03_CatchPlayer(Boss03* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_2B8, 100.0f, 1.0f, phi_f0); if (this->unk_2B8 > 30.0f) { - if ((&this->actor != player->actor.parent) && (globalCtx->grabPlayer(globalCtx, player) != 0)) { + if ((&this->actor != player->actor.parent) && (play->grabPlayer(play, player) != 0)) { player->actor.parent = &this->actor; Audio_PlaySfxGeneral(NA_SE_VO_LI_DAMAGE_S, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); - Boss03_SetupChewPlayer(this, globalCtx); + Boss03_SetupChewPlayer(this, play); } } else { Math_ApproachS(&this->jawZRot, 0x3200, 2, 0xC00 * phi_f0); @@ -823,10 +821,10 @@ void Boss03_CatchPlayer(Boss03* this, GlobalContext* globalCtx) { Math_ApproachS(&player->actor.shape.rot.y, this->unk_2A2.y, 1, 0x400); } - Boss03_SpawnDust(this, globalCtx); + Boss03_SpawnDust(this, play); } -void Boss03_SetupChewPlayer(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupChewPlayer(Boss03* this, PlayState* play) { s16 pitchAngle; Vec3f out; @@ -846,9 +844,9 @@ void Boss03_SetupChewPlayer(Boss03* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } -void Boss03_ChewPlayer(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(&globalCtx->state); +void Boss03_ChewPlayer(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Input* input = CONTROLLER1(&play->state); f32 jawZRotTarget; f32 xDiff; f32 yDiff; @@ -915,10 +913,10 @@ void Boss03_ChewPlayer(Boss03* this, GlobalContext* globalCtx) { player->actor.parent = NULL; player->csMode = 0; func_80165690(); - func_800B8D50(globalCtx, NULL, 10.0f, this->actor.shape.rot.y, 0.0f, 0x20); + func_800B8D50(play, NULL, 10.0f, this->actor.shape.rot.y, 0.0f, 0x20); } - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = Rand_ZeroFloat(100.0f) + 200.0f; return; @@ -945,7 +943,7 @@ void Boss03_ChewPlayer(Boss03* this, GlobalContext* globalCtx) { } } -void Boss03_SetupPrepareCharge(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupPrepareCharge(Boss03* this, PlayState* play) { this->actionFunc = Boss03_PrepareCharge; Animation_MorphToLoop(&this->skelAnime, &gGyorgBackingUpAnim, -15.0f); this->workTimer[WORK_TIMER_CURRENT_ACTION] = Rand_ZeroFloat(30.0f) + 80.0f; @@ -966,9 +964,9 @@ void Boss03_SetupPrepareCharge(Boss03* this, GlobalContext* globalCtx) { /** * Slowly turns back while looking at Player during WORK_TIMER_CURRENT_ACTION frames, then prepares to charge */ -void Boss03_PrepareCharge(Boss03* this, GlobalContext* globalCtx) { +void Boss03_PrepareCharge(Boss03* this, PlayState* play) { f32 posYTarget; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->workTimer[WORK_TIMER_UNK1_B] != 0) { Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_WAIT_OLD - SFX_FLAG); @@ -994,10 +992,10 @@ void Boss03_PrepareCharge(Boss03* this, GlobalContext* globalCtx) { // Player is above water && Player is standing on ground if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { if (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0) { - Boss03_SetupCharge(this, globalCtx); + Boss03_SetupCharge(this, play); } } else if (player->actor.world.pos.y <= this->waterHeight) { - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 20; } @@ -1006,8 +1004,8 @@ void Boss03_PrepareCharge(Boss03* this, GlobalContext* globalCtx) { Actor_MoveWithoutGravityReverse(&this->actor); } -void Boss03_SetupCharge(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Boss03_SetupCharge(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actionFunc = Boss03_Charge; Animation_MorphToLoop(&this->skelAnime, &gGyorgFastSwimmingAnim, -15.0f); @@ -1017,11 +1015,11 @@ void Boss03_SetupCharge(Boss03* this, GlobalContext* globalCtx) { /** * Charge against the platform, either by clashing against the platform or by preparing to jump over it */ -void Boss03_Charge(Boss03* this, GlobalContext* globalCtx) { +void Boss03_Charge(Boss03* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 rotXTarget; this->skelAnime.playSpeed = 2.0f; @@ -1047,7 +1045,7 @@ void Boss03_Charge(Boss03* this, GlobalContext* globalCtx) { // Jump over platform if (this->unk_242 == 1) { if (sqrtf(SQXZ(this->actor.world.pos)) < 700.0f) { - Boss03_SetupJumpOverPlatform(this, globalCtx); + Boss03_SetupJumpOverPlatform(this, play); return; } } @@ -1055,23 +1053,23 @@ void Boss03_Charge(Boss03* this, GlobalContext* globalCtx) { // Attack platform if (this->actor.bgCheckFlags & 8) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, globalCtx, 20, 15); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, - 0x96, ENWATEREFFECT_780); + func_800BC848(&this->actor, play, 20, 15); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96, + ENWATEREFFECT_780); // Player is above water && Player is standing on ground if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { - func_800B8D50(globalCtx, NULL, 7.0f, Math_FAtan2F(player->actor.world.pos.z, player->actor.world.pos.x), + func_800B8D50(play, NULL, 7.0f, Math_FAtan2F(player->actor.world.pos.z, player->actor.world.pos.x), 7.0f, 0); } - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; } } } -void Boss03_SetupJumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupJumpOverPlatform(Boss03* this, PlayState* play) { this->actionFunc = Boss03_JumpOverPlatform; this->actor.gravity = -2.0f; this->actor.velocity.y = 30.0f; @@ -1079,7 +1077,7 @@ void Boss03_SetupJumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_JUMP_OLD); } -void Boss03_JumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { +void Boss03_JumpOverPlatform(Boss03* this, PlayState* play) { this->bubbleEffectSpawnCount = 0; Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); @@ -1095,7 +1093,7 @@ void Boss03_JumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; Math_ApproachZeroF(&this->actor.velocity.y, 1.0f, 1.0f); if (this->actor.velocity.y == 0.0f) { - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; } } else { @@ -1106,7 +1104,7 @@ void Boss03_JumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { sp30.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(150.0f); sp30.y = this->actor.world.pos.y; sp30.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(150.0f); - Boss03_SpawnEffectDroplet(globalCtx, &sp30); + Boss03_SpawnEffectDroplet(play, &sp30); } } } @@ -1115,7 +1113,7 @@ void Boss03_JumpOverPlatform(Boss03* this, GlobalContext* globalCtx) { /* Start of Gyorg's Cutscenes section */ -void Boss03_SetupIntroCutscene(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupIntroCutscene(Boss03* this, PlayState* play) { this->actionFunc = Boss03_IntroCutscene; Animation_MorphToLoop(&this->skelAnime, &gGyorgFastSwimmingAnim, -10.0f); this->skelAnime.playSpeed = 2.0f; @@ -1127,7 +1125,7 @@ Vec3f D_809E9104[] = { { 0.0f, 450.0f, 0.0f }, }; -void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { +void Boss03_IntroCutscene(Boss03* this, PlayState* play) { s16 i; Vec3f effectPos; f32 xDiff; @@ -1139,7 +1137,7 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { s16 pad2; s16 bubblesToSpawnNum = 0; f32 phi_f2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->bubbleEffectSpawnCount = 0; this->csTimer++; @@ -1150,11 +1148,11 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { switch (this->csState) { case 0: if (player->actor.world.pos.y < 1350.0f) { - Cutscene_Start(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 7); - this->csCamId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->csCamId, 7); + Cutscene_Start(play, &play->csCtx); + func_800B7298(play, &this->actor, 7); + this->csCamId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->csCamId, 7); this->actor.world.rot.y = -0x7B30; this->prevPlayerPos.y = 1850.0f; @@ -1262,7 +1260,7 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { if (this->csTimer == 5) { // Rotates Player towards Gyorg - func_800B7298(globalCtx, &this->actor, 8); + func_800B7298(play, &this->actor, 8); } this->csCamEye.x = player->actor.world.pos.x + 30.0f; @@ -1321,7 +1319,7 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); if (this->csTimer == 30) { - TitleCard_InitBossName(&globalCtx->state, &globalCtx->actorCtx.titleCtxt, + TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, Lib_SegmentedToVirtual(gGyorgTitleCardTex), 160, 180, 128, 40); } @@ -1344,7 +1342,7 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { effectPos.y = this->actor.world.pos.y; effectPos.z = randPlusMinusPoint5Scaled(150.0f) + this->actor.world.pos.z; - Boss03_SpawnEffectDroplet(globalCtx, &effectPos); + Boss03_SpawnEffectDroplet(play, &effectPos); } this->csCamTargetAt.x = this->actor.world.pos.x; @@ -1365,18 +1363,18 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { Math_ApproachF(&this->csCamAt.z, this->csCamTargetAt.z, 0.5f, 100.0f); if (this->csTimer == 145) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->csCamEye; camera->eyeNext = this->csCamEye; camera->at = this->csCamAt; - func_80169AFC(globalCtx, this->csCamId, 0); - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + func_80169AFC(play, this->csCamId, 0); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); this->csCamId = 0; - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; gSaveContext.eventInf[5] |= 0x40; @@ -1406,17 +1404,17 @@ void Boss03_IntroCutscene(Boss03* this, GlobalContext* globalCtx) { effectPos.y = (randPlusMinusPoint5Scaled(100.0f) + this->csCamAt.y) - 150.0f; effectPos.z = randPlusMinusPoint5Scaled(100.0f) + this->csCamAt.z; - Boss03_SpawnEffectBubble(globalCtx, &effectPos); + Boss03_SpawnEffectBubble(play, &effectPos); } } if (this->csCamId != 0) { - Play_CameraSetAtEye(globalCtx, this->csCamId, &this->csCamAt, &this->csCamEye); - Play_CameraSetFov(globalCtx, this->csCamId, this->cameraFov); + Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); + Play_CameraSetFov(play, this->csCamId, this->cameraFov); } } -void Boss03_SetupDeathCutscene(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupDeathCutscene(Boss03* this, PlayState* play) { this->actionFunc = Boss03_DeathCutscene; Animation_MorphToLoop(&this->skelAnime, &gGyorgFloppingAnim, -10.0f); this->floppingAnimLastFrame = Animation_GetLastFrame(&gGyorgFloppingAnim); @@ -1427,7 +1425,7 @@ void Boss03_SetupDeathCutscene(Boss03* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { +void Boss03_DeathCutscene(Boss03* this, PlayState* play) { s16 i; Vec3f sp90; Vec3f sp84; @@ -1437,12 +1435,12 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { s32 pad; f32 pad2; f32 sp64; - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); Player* player; f32 sp4C; aux2 = 0.0f; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); sp64 = this->actor.scale.x * 5.0f; this->csTimer++; @@ -1450,11 +1448,11 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { switch (this->csState) { case 0: if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 1); - this->csCamId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->csCamId, 7); + Cutscene_Start(play, &play->csCtx); + func_800B7298(play, &this->actor, 1); + this->csCamId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->csCamId, 7); this->unk_2BE = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x); // Player is above water && Player is standing on ground @@ -1529,8 +1527,8 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { if ((this->workTimer[WORK_TIMER_UNK0_C] == 0) && ((this->waterHeight - 100.0f) < this->actor.world.pos.y)) { this->workTimer[WORK_TIMER_UNK0_C] = Rand_ZeroFloat(15.0f) + 15.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, - this->waterHeight, this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight, + this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); if (this->actionFunc == Boss03_DeathCutscene) { if ((D_809E9840 % 2) != 0) { @@ -1605,16 +1603,16 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { sp78.x = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.x; sp78.y = this->actor.world.pos.y; sp78.z = randPlusMinusPoint5Scaled(sp4C) + this->actor.world.pos.z; - Boss03_SpawnEffectDroplet(globalCtx, &sp78); + Boss03_SpawnEffectDroplet(play, &sp78); } Actor_MoveWithGravity(&this->actor); if (this->actor.scale.x <= 0.0111f) { this->unk_242 = 2; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, - PLATFORM_HEIGHT, 200.0f, 0, 0, 0, ENDOORWARP1_FF_1); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.focus.pos.x, - PLATFORM_HEIGHT, this->actor.focus.pos.z, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, PLATFORM_HEIGHT, 200.0f, + 0, 0, 0, ENDOORWARP1_FF_1); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.focus.pos.x, PLATFORM_HEIGHT, + this->actor.focus.pos.z, 0, 0, 0, 0); this->csTimer = 0; Actor_SetScale(&this->actor, 0.0f); Audio_StopSfxByPos(&this->actor.projectedPos); @@ -1624,14 +1622,14 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { case 2: Math_ApproachZeroF(&this->unk_56C, 1.0f, 0.0005f); if (this->csTimer == 60) { - camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->csCamEye; camera->eyeNext = this->csCamEye; camera->at = this->csCamAt; - func_80169AFC(globalCtx, this->csCamId, 0); + func_80169AFC(play, this->csCamId, 0); this->csCamId = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); this->csState = 3; func_80165690(); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_INIT_OLD); @@ -1645,30 +1643,30 @@ void Boss03_DeathCutscene(Boss03* this, GlobalContext* globalCtx) { } if (this->csCamId != 0) { - Play_CameraSetAtEye(globalCtx, this->csCamId, &this->csCamAt, &this->csCamEye); + Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); } } -void Boss03_SetupSpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupSpawnSmallFishesCutscene(Boss03* this, PlayState* play) { this->actionFunc = Boss03_SpawnSmallFishesCutscene; Animation_MorphToLoop(&this->skelAnime, &gGyorgBackingUpAnim, -15.0f); this->csState = 0; this->csTimer = 0; } -void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->csTimer++; switch (this->csState) { case 0: if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 1); - this->csCamId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->csCamId, 7); + Cutscene_Start(play, &play->csCtx); + func_800B7298(play, &this->actor, 1); + this->csCamId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->csCamId, 7); this->csState = 1; this->unk_2BE = 0xBB8; @@ -1705,7 +1703,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { Math_ApproachS(&this->jawZRot, 0x3200, 5, 0x500); if ((this->csTimer >= 90) && (this->csTimer < 130)) { if ((this->csTimer % 2) != 0) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON3, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON3, this->actor.world.pos.x - 110.0f, this->actor.world.pos.y - 20.0f, this->actor.world.pos.z - 110.0f, 0, this->actor.shape.rot.y, 0, 0); this->numSpawnedSmallFish++; @@ -1719,17 +1717,17 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { if (this->csTimer >= 150) { Camera* camera; - camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = this->csCamEye; camera->eyeNext = this->csCamEye; camera->at = this->csCamAt; - func_80169AFC(globalCtx, this->csCamId, 0); + func_80169AFC(play, this->csCamId, 0); this->csCamId = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; } } @@ -1737,7 +1735,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { } if (this->csCamId != 0) { - Play_CameraSetAtEye(globalCtx, this->csCamId, &this->csCamAt, &this->csCamEye); + Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); } } @@ -1745,8 +1743,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, GlobalContext* globalCtx) { /* Start of Gyorg's More actionFuncs and Update section */ -void Boss03_SetupStunned(Boss03* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void Boss03_SetupStunned(Boss03* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actionFunc != Boss03_Stunned) { Animation_MorphToLoop(&this->skelAnime, &gGyorgStunnedAnim, -15.0f); @@ -1764,7 +1762,7 @@ void Boss03_SetupStunned(Boss03* this, GlobalContext* globalCtx) { this->unk_240 = 0; } -void Boss03_Stunned(Boss03* this, GlobalContext* globalCtx) { +void Boss03_Stunned(Boss03* this, PlayState* play) { this->actor.hintId = 0x29; if (this->unk_240 >= 16) { @@ -1778,7 +1776,7 @@ void Boss03_Stunned(Boss03* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); if (this->actor.bgCheckFlags & 2) { play_sound(NA_SE_IT_WALL_HIT_HARD); - func_800BC848(&this->actor, globalCtx, 10, 10); + func_800BC848(&this->actor, play, 10, 10); } } else { Math_ApproachS(&this->actor.shape.rot.z, -0x6000, 0xA, 0x900); @@ -1791,12 +1789,12 @@ void Boss03_Stunned(Boss03* this, GlobalContext* globalCtx) { } if (this->workTimer[WORK_TIMER_STUNNED] == 0) { - func_809E344C(this, globalCtx); + func_809E344C(this, play); // WORK_TIMER_UNK1_A wasn't set } } -void Boss03_SetupDamaged(Boss03* this, GlobalContext* globalCtx) { +void Boss03_SetupDamaged(Boss03* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gGyorgFloppingAnim, -10.0f); this->actionFunc = Boss03_Damaged; this->workTimer[WORK_TIMER_CURRENT_ACTION] = 30; @@ -1805,7 +1803,7 @@ void Boss03_SetupDamaged(Boss03* this, GlobalContext* globalCtx) { /** * Invulnerability period by being damaged by Player */ -void Boss03_Damaged(Boss03* this, GlobalContext* globalCtx) { +void Boss03_Damaged(Boss03* this, PlayState* play) { this->unk_25C = 15; SkelAnime_Update(&this->skelAnime); @@ -1817,22 +1815,22 @@ void Boss03_Damaged(Boss03* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health <= 5) { if (!this->hasSpwanedSmallFishes) { this->hasSpwanedSmallFishes++; - Boss03_SetupSpawnSmallFishesCutscene(this, globalCtx); + Boss03_SetupSpawnSmallFishesCutscene(this, play); return; } } - func_809E344C(this, globalCtx); + func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 100; } } /* End of ActionFuncs section */ -void Boss03_UpdateCollision(Boss03* this, GlobalContext* globalCtx) { +void Boss03_UpdateCollision(Boss03* this, PlayState* play) { ColliderInfo* hitbox; u8 sp4B = true; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s32 phi_v1; u32 phi_v0; @@ -1885,10 +1883,10 @@ void Boss03_UpdateCollision(Boss03* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health <= 0) { Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_DEAD_OLD); Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_DEAD2_OLD); - Boss03_SetupDeathCutscene(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Boss03_SetupDeathCutscene(this, play); + Enemy_StartFinishingBlow(play, &this->actor); } else { - Boss03_SetupDamaged(this, globalCtx); + Boss03_SetupDamaged(this, play); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_DAMAGE_OLD); } return; @@ -1903,7 +1901,7 @@ void Boss03_UpdateCollision(Boss03* this, GlobalContext* globalCtx) { this->unk_25C = 15; if (this->actionFunc != stunnedActionFunc) { - Boss03_SetupStunned(this, globalCtx); + Boss03_SetupStunned(this, play); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_DAMAGE_OLD); if (&this->actor == player->actor.parent) { @@ -1933,10 +1931,10 @@ void Boss03_UpdateCollision(Boss03* this, GlobalContext* globalCtx) { if ((s8)this->actor.colChkInfo.health <= 0) { Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_DEAD_OLD); Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_DEAD2_OLD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); - Boss03_SetupDeathCutscene(this, globalCtx); + Enemy_StartFinishingBlow(play, &this->actor); + Boss03_SetupDeathCutscene(this, play); } else { - Boss03_SetupDamaged(this, globalCtx); + Boss03_SetupDamaged(this, play); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_DAMAGE_OLD); } } @@ -1946,11 +1944,11 @@ void Boss03_UpdateCollision(Boss03* this, GlobalContext* globalCtx) { } } -void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Boss03_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Boss03* this = THIS; Actor* dblueActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; Vec3f wetSpotPos; Vec3f bubblePos; @@ -1992,13 +1990,13 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_25E--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != Boss03_DeathCutscene) { Math_ApproachS(&this->actor.shape.rot.z, 0, 0xA, 0x800); this->actor.world.pos.y -= 100.0f; this->actor.prevPos.y -= 100.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 150.0f, 100.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 5); this->actor.world.pos.y += 100.0f; this->actor.prevPos.y += 100.0f; } @@ -2014,8 +2012,8 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_SINK_OLD); } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, - this->waterHeight, this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight, + this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_777); this->unk_280 = 27; this->unk_284 = this->actor.world.pos.x; @@ -2031,29 +2029,29 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { this->bodyCollider.base.colType = COLTYPE_METAL; } - Boss03_UpdateCollision(this, globalCtx); + Boss03_UpdateCollision(this, play); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); if (player->transformation == PLAYER_FORM_HUMAN) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->headCollider.base); } if (!this->unk_2BD) { if (player->transformation != PLAYER_FORM_HUMAN) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->headCollider.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->actionFunc != Boss03_Stunned) && (!this->unk_2BD)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->headCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); } } - dblueActor = Boss03_FindActorDblueMovebg(globalCtx); + dblueActor = Boss03_FindActorDblueMovebg(play); if (dblueActor != NULL) { dblueActor->world.pos.y = this->waterHeight; } @@ -2079,12 +2077,12 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { bubblePos.y = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.y; bubblePos.z = randPlusMinusPoint5Scaled(100.0f) + this->actor.world.pos.z; - Boss03_SpawnEffectBubble(globalCtx, &bubblePos); + Boss03_SpawnEffectBubble(play, &bubblePos); } } this->bubbleEffectSpawnCount = 1; - Boss03_UpdateEffects(globalCtx); + Boss03_UpdateEffects(play); if (D_809E9841 != 0) { D_809E9841--; @@ -2110,7 +2108,7 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { wetSpotPos.x = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.x; wetSpotPos.y = PLATFORM_HEIGHT; wetSpotPos.z = randPlusMinusPoint5Scaled(50.0f) + player->actor.world.pos.z; - Boss03_SpawnEffectWetSpot(globalCtx, &wetSpotPos); + Boss03_SpawnEffectWetSpot(play, &wetSpotPos); } } @@ -2137,7 +2135,7 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { dropletPos.z += this->unk_28C + randPlusMinusPoint5Scaled(40.0f); if (sqrtf(SQ(dropletPos.x) + SQ(dropletPos.z)) < 355.0f) { - Boss03_SpawnEffectDroplet(globalCtx, &dropletPos); + Boss03_SpawnEffectDroplet(play, &dropletPos); i++; } @@ -2153,21 +2151,20 @@ void Boss03_Update(Actor* thisx, GlobalContext* globalCtx2) { /* Start of Gyorg's Draw section */ -void Boss03_SetObject(GlobalContext* globalCtx, s16 objectId) { - s32 objectIndex = Object_GetIndex(&globalCtx->objectCtx, objectId); +void Boss03_SetObject(PlayState* play, s16 objectId) { + s32 objectIndex = Object_GetIndex(&play->objectCtx, objectId); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIndex].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[objectIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 Boss03_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 Boss03_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { Boss03* this = THIS; if ((limbIndex == GYORG_LIMB_UPPER_TRUNK) || (limbIndex == GYORG_LIMB_LOWER_TRUNK) || @@ -2226,12 +2223,12 @@ Vec3f D_809E9154[] = { Vec3f D_809E91A8 = { 100000.0f, 100000.0f, 100000.0f }; Vec3f D_809E91B4 = { 300.0f, -100.0f, -200.0f }; -void Boss03_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void Boss03_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { Boss03* this = THIS; s32 pad; s8 sphereElementIndex; Vec3f spherePos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (limbIndex == GYORG_LIMB_HEAD) { Matrix_MultVec3f(&D_809E9148, &this->actor.focus.pos); @@ -2262,12 +2259,12 @@ void Boss03_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void Boss03_Draw(Actor* thisx, GlobalContext* globalCtx) { +void Boss03_Draw(Actor* thisx, PlayState* play) { Boss03* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (!this->unk_2D5) { if ((this->unk_25E % 2) != 0) { @@ -2276,24 +2273,24 @@ void Boss03_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateYF(this->unk_260, MTXMODE_APPLY); Matrix_Translate(0.0f, -600.0f, 0.0f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, Boss03_OverrideLimbDraw, Boss03_PostLimbDraw, &this->actor); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Boss03_OverrideLimbDraw, Boss03_PostLimbDraw, &this->actor); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); } this->unk_2BC = 0; - Boss03_DrawEffects(globalCtx); + Boss03_DrawEffects(play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /* End of Gyorg's Draw section */ /* Start of Effect Update/Draw section */ -void Boss03_UpdateEffects(GlobalContext* globalCtx) { - GyorgEffect* eff = globalCtx->specialEffects; +void Boss03_UpdateEffects(PlayState* play) { + GyorgEffect* eff = play->specialEffects; s16 i; Vec3f sp94; Vec3f velocity; @@ -2330,7 +2327,7 @@ void Boss03_UpdateEffects(GlobalContext* globalCtx) { if (eff->pos.y <= WATER_HEIGHT) { eff->type = GYORG_EFFECT_NONE; eff->pos.y = WATER_HEIGHT; - EffectSsGRipple_Spawn(globalCtx, &eff->pos, 0, 80, 0); + EffectSsGRipple_Spawn(play, &eff->pos, 0, 80, 0); } else if (eff->pos.y <= PLATFORM_HEIGHT) { s16 j; @@ -2349,7 +2346,7 @@ void Boss03_UpdateEffects(GlobalContext* globalCtx) { sp94.y = Rand_ZeroFloat(4.0f) + 2.0f; sp94.z = Rand_ZeroFloat(1.5f) + 1.5f; Matrix_MultVec3f(&sp94, &velocity); - Boss03_SpawnEffectSplash(globalCtx, &eff->pos, &velocity); + Boss03_SpawnEffectSplash(play, &eff->pos, &velocity); } } } else if (eff->type == GYORG_EFFECT_SPLASH) { @@ -2388,17 +2385,17 @@ void Boss03_UpdateEffects(GlobalContext* globalCtx) { } } -void Boss03_DrawEffects(GlobalContext* globalCtx) { +void Boss03_DrawEffects(PlayState* play) { u8 flag = false; s16 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; - GyorgEffect* eff = globalCtx->specialEffects; + GyorgEffect* eff = play->specialEffects; GyorgEffect* effFirst = eff; OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); func_8012C28C(gfxCtx); for (i = 0; i < GYORG_EFFECT_COUNT; i++, eff++) { @@ -2413,17 +2410,16 @@ void Boss03_DrawEffects(GlobalContext* globalCtx) { Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); Matrix_Scale(eff->unk_34.x, eff->unk_34.x, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGyorgBubbleModelDL); } } eff = effFirst; - Boss03_SetObject(globalCtx, OBJECT_WATER_EFFECT); + Boss03_SetObject(play, OBJECT_WATER_EFFECT); flag = false; @@ -2445,10 +2441,10 @@ void Boss03_DrawEffects(GlobalContext* globalCtx) { Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); if (eff->type == GYORG_EFFECT_DROPLET) { - Matrix_RotateYF(Camera_GetInputDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) * (M_PI / 0x8000), + Matrix_RotateYF(Camera_GetInputDirYaw(play->cameraPtrs[play->activeCamera]) * (M_PI / 0x8000), MTXMODE_APPLY); } else { // GYORG_EFFECT_SPLASH - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(eff->unk_34.x, eff->unk_34.y, 1.0f, MTXMODE_APPLY); @@ -2488,7 +2484,7 @@ void Boss03_DrawEffects(GlobalContext* globalCtx) { } } - Boss03_SetObject(globalCtx, OBJECT_BOSS03); + Boss03_SetObject(play, OBJECT_BOSS03); CLOSE_DISPS(gfxCtx); } @@ -2501,13 +2497,13 @@ void Boss03_DrawEffects(GlobalContext* globalCtx) { #define SEAWEED_FLAG_INTERACT_PLAYER 1 #define SEAWEED_FLAG_INTERACT_GYORG 2 -void Boss03_SeaweedUpdate(Actor* thisx, GlobalContext* globalCtx) { +void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) { Boss03* this = THIS; s16 i; s16 pad; s16 maxBendSpeed; u8 flag; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distanceBetweenSeaweedAndDisturbance; f32 disturbanceFactor; f32 xDiff; @@ -2595,15 +2591,15 @@ Gfx* sGyorgSeaweedDLs[] = { gGyorgSeaweedPiece3DL, gGyorgSeaweedPiece2DL, gGyorgSeaweedPiece1DL, }; -void Boss03_SeaweedDraw(Actor* thisx, GlobalContext* globalCtx) { +void Boss03_SeaweedDraw(Actor* thisx, PlayState* play) { Boss03* this = THIS; s16 i; // Why 10 Mtxs? This seems to only use the first 6 elements - Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Mtx) * 10); + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 10); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); @@ -2630,7 +2626,7 @@ void Boss03_SeaweedDraw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(4000.0f, 0.0f, 0.0f, MTXMODE_APPLY); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /* End of Seaweed section */ diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.h b/src/overlays/actors/ovl_Boss_03/z_boss_03.h index f5af516c00..96dd4fc3f1 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.h +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.h @@ -6,7 +6,7 @@ struct Boss03; -typedef void (*Boss03ActionFunc)(struct Boss03*, GlobalContext*); +typedef void (*Boss03ActionFunc)(struct Boss03*, PlayState*); #define GYORG_WORK_TIMER_MAX 3 diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 659fdbe3fc..d731cac90e 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -11,19 +11,19 @@ #define THIS ((Boss04*)thisx) -void Boss04_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss04_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss04_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss04_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss04_Init(Actor* thisx, PlayState* play); +void Boss04_Destroy(Actor* thisx, PlayState* play); +void Boss04_Update(Actor* thisx, PlayState* play); +void Boss04_Draw(Actor* thisx, PlayState* play); void func_809EC544(Boss04* this); -void func_809EC568(Boss04* this, GlobalContext* globalCtx); -void func_809ECD00(Boss04* this, GlobalContext* globalCtx); -void func_809ECD18(Boss04* this, GlobalContext* globalCtx); +void func_809EC568(Boss04* this, PlayState* play); +void func_809ECD00(Boss04* this, PlayState* play); +void func_809ECD18(Boss04* this, PlayState* play); void func_809ECEF4(Boss04* this); -void func_809ECF58(Boss04* this, GlobalContext* globalCtx); +void func_809ECF58(Boss04* this, PlayState* play); void func_809ED224(Boss04* this); -void func_809ED2A0(Boss04* this, GlobalContext* globalCtx); +void func_809ED2A0(Boss04* this, PlayState* play); static u8 D_809EE4D0; @@ -136,14 +136,14 @@ void func_809EC040(s32 index, ColliderJntSph* collider, Vec3f* arg2) { collider->elements[index].dim.modelSphere.radius * collider->elements[index].dim.scale; } -void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { +void Boss04_Init(Actor* thisx, PlayState* play2) { static Vec3f D_809EE1F8[] = { { -1000.0f, 0.0f, 0.0f }, { 1000.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, -1000.0f }, { 0.0f, 0.0f, 1000.0f }, }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Boss04* this = THIS; s32 i; CollisionPoly* spC0; @@ -156,7 +156,7 @@ void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { s16 phi_s0_2; s32 pad; - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); return; } @@ -170,16 +170,16 @@ void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_700 = 1.0f; this->unk_6FC = 1.0f; this->unk_6F8 = 1.0f; - Collider_InitAndSetJntSph(globalCtx, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); - Collider_InitAndSetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boss04_Skel_0045E8, &object_boss04_Anim_00004C, - this->jointTable, this->morphtable, 9); + Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); + Collider_InitAndSetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); + SkelAnime_InitFlex(play, &this->skelAnime, &object_boss04_Skel_0045E8, &object_boss04_Anim_00004C, this->jointTable, + this->morphtable, 9); spA8.y = this->actor.world.pos.y + 200.0f; for (i = 0; i < ARRAY_COUNT(D_809EE1F8); i++) { spA8.x = D_809EE1F8[i].x + this->actor.world.pos.x; spA8.z = D_809EE1F8[i].z + this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &spA8, &spB4, &spC0, true, false, false, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &spA8, &spB4, &spC0, true, false, false, true, &spA4)) { if (i == 0) { this->unk_6D8 = spB4.x; @@ -197,10 +197,10 @@ void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_6F0 = this->unk_6E0 + ((this->unk_6E4 - this->unk_6E0) * 0.5f); this->actor.world.pos.x = this->unk_6E8; this->actor.world.pos.z = this->unk_6F0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 4); if ((KREG(64) != 0) || (gSaveContext.eventInf[6] & 1)) { - func_809ECD00(this, globalCtx); + func_809ECD00(this, play); this->actor.world.pos.y = this->actor.floorHeight + 160.0f; phi_f24 = this->actor.floorHeight; D_809EE4D0 = KREG(41) + 50; @@ -216,17 +216,17 @@ void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < 82; i++) { Matrix_RotateYS(phi_s0_2, MTXMODE_NEW); Matrix_MultVecZ(phi_f20, &sp90); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON2, this->unk_6E8 + sp90.x, - phi_f24, this->unk_6F0 + sp90.z, 0, 0, 0, i); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON2, this->unk_6E8 + sp90.x, phi_f24, + this->unk_6F0 + sp90.z, 0, 0, 0, i); phi_f20 += 2.5f; phi_s0_2 += 0x1300; } - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON2, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 100); } -void Boss04_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Boss04_Destroy(Actor* thisx, PlayState* play) { } void func_809EC544(Boss04* this) { @@ -234,8 +234,8 @@ void func_809EC544(Boss04* this) { this->actor.flags &= ~ACTOR_FLAG_1; } -void func_809EC568(Boss04* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809EC568(Boss04* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 x; f32 y; f32 z; @@ -259,11 +259,11 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { this->unk_708 = 10; this->unk_704 = 0; - Cutscene_Start(globalCtx, &globalCtx->csCtx); - this->unk_70A = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->unk_70A, 7); - func_800B7298(globalCtx, &this->actor, 7); + Cutscene_Start(play, &play->csCtx); + this->unk_70A = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->unk_70A, 7); + func_800B7298(play, &this->actor, 7); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; player->actor.shape.rot.y = 0x7FFF; @@ -274,7 +274,7 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { func_8016566C(150); this->unk_744 = 60.0f; - boss = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + boss = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (boss != NULL) { if (boss->id == ACTOR_EN_WATER_EFFECT) { Actor_MarkForDeath(boss); @@ -313,7 +313,7 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { if (this->unk_704 == 45) { this->unk_708 = 1; this->unk_704 = 0; - func_800B7298(globalCtx, &this->actor, 0x15); + func_800B7298(play, &this->actor, 0x15); this->actor.gravity = 0.0f; break; } @@ -329,8 +329,8 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { this->unk_708 = 13; this->unk_704 = 0; this->unk_2DA = 10; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SPLASH); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SPLASH); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); this->unk_748 = 20; } @@ -380,17 +380,17 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { } if (this->unk_704 > 140) { - Camera* sp5C = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* sp5C = Play_GetCamera(play, CAM_ID_MAIN); this->unk_708 = 0; - func_809ECD00(this, globalCtx); + func_809ECD00(this, play); sp5C->eye = this->unk_70C; sp5C->eyeNext = this->unk_70C; sp5C->at = this->unk_718; - func_80169AFC(globalCtx, this->unk_70A, 0); + func_80169AFC(play, this->unk_70A, 0); this->unk_70A = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); func_80165690(); gSaveContext.eventInf[6] |= 1; } @@ -406,8 +406,8 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { } Math_Vec3f_Copy(&sp50, &this->unk_718); sp50.y += Math_SinS(this->unk_748 * 0x4000) * this->unk_748 * 1.5f; - Play_CameraSetAtEye(globalCtx, this->unk_70A, &sp50, &this->unk_70C); - Play_CameraSetFov(globalCtx, this->unk_70A, this->unk_744); + Play_CameraSetAtEye(play, this->unk_70A, &sp50, &this->unk_70C); + Play_CameraSetFov(play, this->unk_70A, this->unk_744); Math_ApproachF(&this->unk_744, 60.0f, 0.1f, 1.0f); } this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -417,12 +417,12 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = Math_Atan2S(-y, sqrtf(SQ(x) + SQ(z))); } -void func_809ECD00(Boss04* this, GlobalContext* globalCtx) { +void func_809ECD00(Boss04* this, PlayState* play) { this->actionFunc = func_809ECD18; } -void func_809ECD18(Boss04* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809ECD18(Boss04* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1F4 >= 0x500) { this->unk_1F4 -= 0x300; @@ -464,7 +464,7 @@ void func_809ECEF4(Boss04* this) { this->actor.gravity = -3.0f; } -void func_809ECF58(Boss04* this, GlobalContext* globalCtx) { +void func_809ECF58(Boss04* this, PlayState* play) { Vec3f sp3C; if ((this->unk_1FE == 14) || ((this->actor.bgCheckFlags & 8) && (this->unk_1F8 == 0))) { @@ -481,12 +481,12 @@ void func_809ECF58(Boss04* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, globalCtx, 15, 10); + func_800BC848(&this->actor, play, 15, 10); this->unk_6F4 = 15; sp3C.x = this->actor.focus.pos.x; sp3C.y = this->actor.focus.pos.y; sp3C.z = this->actor.focus.pos.z; - func_800BBFB0(globalCtx, &sp3C, 100.0f, 40, 500, 10, 0); + func_800BBFB0(play, &sp3C, 100.0f, 40, 500, 10, 0); } } @@ -500,7 +500,7 @@ void func_809ECF58(Boss04* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.floorHeight + 2.0f; sp3C.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp3C, 1400, 500, 0); + EffectSsGRipple_Spawn(play, &sp3C, 1400, 500, 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); } } @@ -526,7 +526,7 @@ void func_809ED224(Boss04* this) { this->unk_1F6 = 10; } -void func_809ED2A0(Boss04* this, GlobalContext* globalCtx) { +void func_809ED2A0(Boss04* this, PlayState* play) { this->unk_2DA = 10; if (this->unk_1F8 >= 5) { @@ -549,9 +549,9 @@ void func_809ED2A0(Boss04* this, GlobalContext* globalCtx) { } if ((this->unk_1F8 == 2) || (this->unk_1F8 == 5)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_BIG_BOMB_EXPLOSION); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_IT_BIG_BOMB_EXPLOSION); } if (this->unk_1FA == 3) { @@ -563,7 +563,7 @@ void func_809ED2A0(Boss04* this, GlobalContext* globalCtx) { } } -void func_809ED45C(Boss04* this, GlobalContext* globalCtx) { +void func_809ED45C(Boss04* this, PlayState* play) { ColliderJntSphElement* temp_v0; u8 damage; @@ -576,7 +576,7 @@ void func_809ED45C(Boss04* this, GlobalContext* globalCtx) { func_809ED224(this); this->unk_1FE = 100; this->unk_200 = 100; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->unk_2DA = 15; this->unk_1FE = 15; @@ -669,8 +669,8 @@ void func_809ED50C(Boss04* this) { Matrix_MultZero(&this->unk_6B0); } -void Boss04_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Boss04_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Boss04* this = THIS; s16 temp_v0_8; s32 pad; @@ -704,12 +704,12 @@ void Boss04_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_6F4--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); this->actor.world.pos.y -= 100.0f; this->actor.prevPos.y -= 100.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 100.0f, 120.0f, 200.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 120.0f, 200.0f, 5); this->actor.world.pos.y += 100.0f; this->actor.prevPos.y += 100.0f; } @@ -744,16 +744,16 @@ void Boss04_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_6FC = (Math_CosS(this->unk_6F4 * 0x3000) * this->unk_6F4 * 0.02f) + 1.0f; this->unk_6F8 = this->unk_6FC; this->actor.shape.yOffset = (this->unk_6FC - 1.0f) * 1000.0f; - func_809ED45C(this, globalCtx); + func_809ED45C(this, play); if (this->unk_2CC > 3000.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); this->actor.flags |= ACTOR_FLAG_1; } else { this->actor.flags &= ~ACTOR_FLAG_1; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); func_809ED50C(this); } @@ -769,8 +769,7 @@ void Boss04_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 Boss04_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 Boss04_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { Boss04* this = THIS; if (limbIndex == KREG(32)) { @@ -798,7 +797,7 @@ s32 Boss04_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void Boss04_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void Boss04_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_809EE228 = { 0.0f, -200.0f, 0.0f }; static Vec3f D_809EE234 = { 0.0f, 720.0f, 0.0f }; Boss04* this = THIS; @@ -813,12 +812,12 @@ void Boss04_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void Boss04_Draw(Actor* thisx, GlobalContext* globalCtx) { +void Boss04_Draw(Actor* thisx, PlayState* play) { Boss04* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_200 & 1) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099); @@ -826,13 +825,13 @@ void Boss04_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 800.0f, MTXMODE_APPLY); Matrix_Scale(this->unk_6F8, this->unk_6FC, this->unk_700, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, Boss04_OverrideLimbDraw, Boss04_PostLimbDraw, &this->actor); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); if (this->actionFunc != func_809EC568) { - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 150); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_004510); @@ -842,9 +841,9 @@ void Boss04_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, -20.0f, MTXMODE_APPLY); Matrix_Scale(this->unk_6F8 * 1.8f, 0.0f, this->unk_700 * 2.8f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_004550); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.h b/src/overlays/actors/ovl_Boss_04/z_boss_04.h index 267688ab0e..579032aa23 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.h +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.h @@ -5,7 +5,7 @@ struct Boss04; -typedef void (*Boss04ActionFunc)(struct Boss04*, GlobalContext*); +typedef void (*Boss04ActionFunc)(struct Boss04*, PlayState*); typedef struct Boss04 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.c b/src/overlays/actors/ovl_Boss_05/z_boss_05.c index a88ad80089..b214a511d6 100644 --- a/src/overlays/actors/ovl_Boss_05/z_boss_05.c +++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.c @@ -10,23 +10,23 @@ #define THIS ((Boss05*)thisx) -void Boss05_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss05_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss05_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss05_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss05_Init(Actor* thisx, PlayState* play); +void Boss05_Destroy(Actor* thisx, PlayState* play); +void Boss05_Update(Actor* thisx, PlayState* play); +void Boss05_Draw(Actor* thisx, PlayState* play); -void func_809EEDE8(Boss05* this, GlobalContext* globalCtx); -void func_809EF9BC(Boss05* this, GlobalContext* globalCtx); -void func_809EFAB4(Boss05* this, GlobalContext* globalCtx); -void func_809F010C(Boss05* this, GlobalContext* globalCtx); -void func_809F0244(Boss05* this, GlobalContext* globalCtx); -void func_809F0374(Boss05* this, GlobalContext* globalCtx); -void func_809F04C0(Boss05* this, GlobalContext* globalCtx); -void func_809F0590(Boss05* this, GlobalContext* globalCtx); -void func_809F06B8(Boss05* this, GlobalContext* globalCtx); -void func_809F0780(Boss05* this, GlobalContext* globalCtx); -void func_809F0ABC(Boss05* this, GlobalContext* globalCtx); -void func_809F0B0C(Boss05* this, GlobalContext* globalCtx); +void func_809EEDE8(Boss05* this, PlayState* play); +void func_809EF9BC(Boss05* this, PlayState* play); +void func_809EFAB4(Boss05* this, PlayState* play); +void func_809F010C(Boss05* this, PlayState* play); +void func_809F0244(Boss05* this, PlayState* play); +void func_809F0374(Boss05* this, PlayState* play); +void func_809F04C0(Boss05* this, PlayState* play); +void func_809F0590(Boss05* this, PlayState* play); +void func_809F06B8(Boss05* this, PlayState* play); +void func_809F0780(Boss05* this, PlayState* play); +void func_809F0ABC(Boss05* this, PlayState* play); +void func_809F0B0C(Boss05* this, PlayState* play); #if 0 // static ColliderJntSphElementInit sJntSphElementsInit[2] = { diff --git a/src/overlays/actors/ovl_Boss_05/z_boss_05.h b/src/overlays/actors/ovl_Boss_05/z_boss_05.h index 85a2cdf9db..039eeb7502 100644 --- a/src/overlays/actors/ovl_Boss_05/z_boss_05.h +++ b/src/overlays/actors/ovl_Boss_05/z_boss_05.h @@ -5,7 +5,7 @@ struct Boss05; -typedef void (*Boss05ActionFunc)(struct Boss05*, GlobalContext*); +typedef void (*Boss05ActionFunc)(struct Boss05*, PlayState*); typedef struct Boss05 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 07016aff91..4467a5658b 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -14,19 +14,19 @@ #define THIS ((Boss06*)thisx) -void Boss06_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss06_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss06_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss06_Init(Actor* thisx, PlayState* play); +void Boss06_Destroy(Actor* thisx, PlayState* play); +void Boss06_Update(Actor* thisx, PlayState* play); +void Boss06_Draw(Actor* thisx, PlayState* play); void func_809F24A8(Boss06* this); -void func_809F24C8(Boss06* this, GlobalContext* globalCtx); -void func_809F2B64(Boss06* this, GlobalContext* globalCtx); -void func_809F2C44(Boss06* this, GlobalContext* globalCtx); -void func_809F2E14(Boss06* this, GlobalContext* globalCtx); -void func_809F2E34(Boss06* this, GlobalContext* globalCtx); -void func_809F2ED0(Boss06* this, GlobalContext* globalCtx); -void func_809F2EE8(Boss06* this, GlobalContext* globalCtx); +void func_809F24C8(Boss06* this, PlayState* play); +void func_809F2B64(Boss06* this, PlayState* play); +void func_809F2C44(Boss06* this, PlayState* play); +void func_809F2E14(Boss06* this, PlayState* play); +void func_809F2E34(Boss06* this, PlayState* play); +void func_809F2ED0(Boss06* this, PlayState* play); +void func_809F2EE8(Boss06* this, PlayState* play); static Vec3f D_809F4370[128]; static EnKnight* D_809F4970; @@ -127,7 +127,7 @@ f32 func_809F2140(void) { return fabsf(temp_f2); } -void Boss06_Init(Actor* thisx, GlobalContext* globalCtx) { +void Boss06_Init(Actor* thisx, PlayState* play) { Boss06* this = THIS; u8* temp_v0; s32 i; @@ -144,7 +144,7 @@ void Boss06_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); Math_Vec3f_Copy(&this->actor.world.pos, &D_809F40EC[ENBOSS06_GET_PARAMS(&this->actor)]); this->actor.shape.rot.y = -0x8000; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); temp_v0 = SEGMENTED_TO_VIRTUAL(&object_knight_Tex_019490); for (i = 0; i < ARRAY_COUNT(this->unk_200); i++) { @@ -154,7 +154,7 @@ void Boss06_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void Boss06_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void Boss06_Destroy(Actor* thisx, PlayState* play) { } void func_809F23CC(Boss06* this) { @@ -183,9 +183,9 @@ void func_809F24A8(Boss06* this) { #ifdef NON_MATCHING // Weird loading of 1 -void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { +void func_809F24C8(Boss06* this, PlayState* play) { s16 sp4E = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* temp_s0; Actor* temp_v0_2; Actor* child; @@ -198,18 +198,18 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { break; } - Cutscene_Start(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 7); - this->unk_A00 = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->unk_A00, 7); + Cutscene_Start(play, &play->csCtx); + func_800B7298(play, &this->actor, 7); + this->unk_A00 = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->unk_A00, 7); D_809F4970->unk_151 = 1; this->unk_1C9 = 1; this->unk_1C8 = 1; this->unk_1E0 = 255.0f; this->unk_1DC = 0.0f; - temp_s0 = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + temp_s0 = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (temp_s0 != NULL) { if (temp_s0->id == ACTOR_EN_ARROW) { Actor_MarkForDeath(temp_s0); @@ -220,11 +220,11 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { case 1: if (this->unk_1CA >= 10) { Math_ApproachF(&this->unk_1E4, 30.0f, 0.2f, 1.0f); - globalCtx->envCtx.fillScreen = 1; - globalCtx->envCtx.screenFillColor[2] = 0; - globalCtx->envCtx.screenFillColor[1] = 0; - globalCtx->envCtx.screenFillColor[0] = 0; - globalCtx->envCtx.screenFillColor[3] = this->unk_A2C; + play->envCtx.fillScreen = 1; + play->envCtx.screenFillColor[2] = 0; + play->envCtx.screenFillColor[1] = 0; + play->envCtx.screenFillColor[0] = 0; + play->envCtx.screenFillColor[3] = this->unk_A2C; Math_ApproachF(&this->unk_A2C, 75.0f, 1.0f, 3.0f); } @@ -233,13 +233,13 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { } if (this->unk_1CA >= 60) { - globalCtx->envCtx.fillScreen = 0; + play->envCtx.fillScreen = 0; this->unk_1C8 = 0; this->unk_1DC = 0.0f; this->unk_1D8 = 0.0f; if (this->unk_1CA == 60) { D_809F4970->unk_154++; - func_800B7298(globalCtx, &this->actor, 0x84); + func_800B7298(play, &this->actor, 0x84); player->actor.shape.rot.y = 0; player->actor.world.rot.y = player->actor.shape.rot.y; } @@ -253,7 +253,7 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { this->unk_A10.z = player->actor.world.pos.z; if (this->unk_1CA >= 75) { - temp_v0_2 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + temp_v0_2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (temp_v0_2 != NULL) { if ((temp_v0_2->id == ACTOR_EN_KNIGHT) && (&D_809F4970->actor == temp_v0_2) && (D_809F4970->unk_680 != 0)) { @@ -287,9 +287,8 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { this->unk_1E0 = 255.0f; this->unk_19C = 1.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_MIR_RAY2, - this->actor.world.pos.x, this->actor.world.pos.y - 200.0f, - this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_MIR_RAY2, this->actor.world.pos.x, + this->actor.world.pos.y - 200.0f, this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); if (ENBOSS06_GET_PARAMS(&this->actor) == 0) { this->unk_A04.x = this->actor.world.pos.x - 200.0f; @@ -329,11 +328,11 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_A28, 1.0f, 1.0f, 0.001f); if (this->unk_1CA > 80) { - func_809F2ED0(this, globalCtx); - func_80169AFC(globalCtx, this->unk_A00, 0); + func_809F2ED0(this, play); + func_80169AFC(play, this->unk_A00, 0); this->unk_A00 = 0; - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); D_809F4970->unk_151 = 0; } break; @@ -341,14 +340,14 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { if (this->unk_A00 != 0) { ShrinkWindow_SetLetterboxTarget(27); - Play_CameraSetAtEye(globalCtx, this->unk_A00, &this->unk_A10, &this->unk_A04); + Play_CameraSetAtEye(play, this->unk_A00, &this->unk_A10, &this->unk_A04); } } #else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Boss_06/func_809F24C8.s") #endif -void func_809F2B64(Boss06* this, GlobalContext* globalCtx) { +void func_809F2B64(Boss06* this, PlayState* play) { this->actionFunc = func_809F2C44; this->unk_144 = 3; this->unk_1A8 = 110.0f; @@ -357,12 +356,12 @@ void func_809F2B64(Boss06* this, GlobalContext* globalCtx) { this->unk_1E4 = 30.0f; this->unk_1AC = 0.0f; this->unk_19C = 1.0f; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_MIR_RAY2, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_MIR_RAY2, this->actor.world.pos.x, this->actor.world.pos.y - 200.0f, this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); D_809F4970->unk_154++; } -void func_809F2C44(Boss06* this, GlobalContext* globalCtx) { +void func_809F2C44(Boss06* this, PlayState* play) { if (D_809F4970->unk_153 != 0) { this->unk_A28 = 0.008f; Math_ApproachF(&this->unk_1E4, 0.0f, 0.2f, this->unk_A28 * 30.0f); @@ -384,34 +383,34 @@ void func_809F2C44(Boss06* this, GlobalContext* globalCtx) { if (D_809F4970->unk_153 == 2) { Actor_MarkForDeath(this->actor.child); this->actor.child = NULL; - func_809F2E14(this, globalCtx); + func_809F2E14(this, play); } } -void func_809F2E14(Boss06* this, GlobalContext* globalCtx) { +void func_809F2E14(Boss06* this, PlayState* play) { this->actionFunc = func_809F2E34; this->unk_144 = 1; } -void func_809F2E34(Boss06* this, GlobalContext* globalCtx) { +void func_809F2E34(Boss06* this, PlayState* play) { this->unk_1E0 = 200.0f; this->unk_1DC = 15.0f; func_809F23CC(this); Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.pos.z = (this->actor.world.pos.z - 50.0f) + 100.0f; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void func_809F2ED0(Boss06* this, GlobalContext* globalCtx) { +void func_809F2ED0(Boss06* this, PlayState* play) { this->actionFunc = func_809F2EE8; } -void func_809F2EE8(Boss06* this, GlobalContext* globalCtx) { +void func_809F2EE8(Boss06* this, PlayState* play) { this->unk_1E0 = 100.0f; this->unk_1DC = 13.0f; } -void Boss06_Update(Actor* thisx, GlobalContext* globalCtx) { +void Boss06_Update(Actor* thisx, PlayState* play) { Boss06* this = THIS; s32 i; Vec3f sp7C; @@ -419,7 +418,7 @@ void Boss06_Update(Actor* thisx, GlobalContext* globalCtx) { f32 phi_f26; f32 phi_f24; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_146 != 0) { this->unk_146--; @@ -499,8 +498,8 @@ void Boss06_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void Boss06_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; Boss06* this = THIS; s32 i; f32 spE0 = 0.0f; @@ -514,10 +513,10 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { s32 maxColor = 255; //! FAKE: f32 sp68; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); temp_v0 = gSaveContext.save.time; if (temp_v0 > CLOCK_TIME(12, 0)) { @@ -571,13 +570,13 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { child->world.pos.z = (this->actor.world.pos.z - 170.0f) + (temp_f10 * 0.1f); } - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_knight_Matanimheader_019360)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_knight_Matanimheader_019360)); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y - 234.0f, this->actor.world.pos.z + 30.0f, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -1112.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 155, 255, maxColor, (u8)((140.0f * sp68) + 115.0f), spD3); gSPDisplayList(POLY_XLU_DISP++, object_knight_DL_018CF0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 255, 255, maxColor, (u8)((100.0f * sp68) + 65.0f), spD2); @@ -594,7 +593,7 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, 0.0f, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_knight_DL_0193B0); if (this->unk_1D8 > 0.0f) { @@ -611,8 +610,8 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - ((globalCtx->gameplayFrames + (i * 10)) * -20) % 512, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + ((play->gameplayFrames + (i * 10)) * -20) % 512, 0x20, 0x80)); Matrix_Translate((D_809F4370[i].x - 32.0f) * -2.4f, (D_809F4370[i].y - 32.0f) * -2.4f, 0.0f, MTXMODE_APPLY); @@ -624,7 +623,7 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(-0.02f / 10.0f, -this->unk_1D8, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); @@ -647,11 +646,11 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 205, (u8)((100.0f * sp68) + 65.0f), 128); Matrix_Scale(this->unk_1DC, this->unk_1DC, 1.0f, MTXMODE_APPLY); - Matrix_RotateZS(globalCtx->gameplayFrames * 64, MTXMODE_APPLY); + Matrix_RotateZS(play->gameplayFrames * 64, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.h b/src/overlays/actors/ovl_Boss_06/z_boss_06.h index d7e6875a20..a720d2b24a 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.h +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.h @@ -5,7 +5,7 @@ struct Boss06; -typedef void (*Boss06ActionFunc)(struct Boss06*, GlobalContext*); +typedef void (*Boss06ActionFunc)(struct Boss06*, PlayState*); #define ENBOSS06_GET_PARAMS(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.c b/src/overlays/actors/ovl_Boss_07/z_boss_07.c index 9e88410345..ba2a30072d 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.c +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.c @@ -10,47 +10,47 @@ #define THIS ((Boss07*)thisx) -void Boss07_Init(Actor* thisx, GlobalContext* globalCtx); -void Boss07_Destroy(Actor* thisx, GlobalContext* globalCtx); -void Boss07_Update(Actor* thisx, GlobalContext* globalCtx); -void Boss07_Draw(Actor* thisx, GlobalContext* globalCtx); +void Boss07_Init(Actor* thisx, PlayState* play); +void Boss07_Destroy(Actor* thisx, PlayState* play); +void Boss07_Update(Actor* thisx, PlayState* play); +void Boss07_Draw(Actor* thisx, PlayState* play); -void func_809F5E88(Boss07* this, GlobalContext* globalCtx); -void func_809F65F4(Boss07* this, GlobalContext* globalCtx); -void func_809F748C(Boss07* this, GlobalContext* globalCtx); -void func_809F76D0(Boss07* this, GlobalContext* globalCtx); -void func_809F77A8(Boss07* this, GlobalContext* globalCtx); -void func_809F7968(Boss07* this, GlobalContext* globalCtx); -void func_809F7BC4(Boss07* this, GlobalContext* globalCtx); -void func_809F805C(Boss07* this, GlobalContext* globalCtx); -void func_809F86B8(Boss07* this, GlobalContext* globalCtx); -void func_809F87C8(Boss07* this, GlobalContext* globalCtx); -void func_809F8908(Boss07* this, GlobalContext* globalCtx); -void func_809F8B1C(Boss07* this, GlobalContext* globalCtx); -void func_809F8D04(Boss07* this, GlobalContext* globalCtx); -void func_809F8EC8(Boss07* this, GlobalContext* globalCtx); -void func_809F91D4(Boss07* this, GlobalContext* globalCtx); -void func_809FCCCC(Boss07* this, GlobalContext* globalCtx); -void func_809FD710(Boss07* this, GlobalContext* globalCtx); -void func_809FD89C(Boss07* this, GlobalContext* globalCtx); -void func_809FDAB0(Boss07* this, GlobalContext* globalCtx); -void func_809FDF54(Boss07* this, GlobalContext* globalCtx); -void func_809FE0E4(Boss07* this, GlobalContext* globalCtx); -void func_809FE348(Boss07* this, GlobalContext* globalCtx); -void func_809FE524(Boss07* this, GlobalContext* globalCtx); -void func_809FE734(Boss07* this, GlobalContext* globalCtx); -void func_809FFA80(Boss07* this, GlobalContext* globalCtx); -void func_809FFEAC(Boss07* this, GlobalContext* globalCtx); -void func_80A00274(Boss07* this, GlobalContext* globalCtx); -void func_80A00554(Boss07* this, GlobalContext* globalCtx); -void func_80A00720(Boss07* this, GlobalContext* globalCtx); -void func_80A01750(Boss07* this, GlobalContext* globalCtx); -void func_80A0264C(Boss07* this, GlobalContext* globalCtx); -void func_80A04890(Boss07* this, GlobalContext* globalCtx); -void func_80A04E5C(Boss07* this, GlobalContext* globalCtx); -void func_80A05608(Boss07* this, GlobalContext* globalCtx); -void func_80A05B50(Boss07* this, GlobalContext* globalCtx); -void func_80A05DDC(Boss07* this, GlobalContext* globalCtx); +void func_809F5E88(Boss07* this, PlayState* play); +void func_809F65F4(Boss07* this, PlayState* play); +void func_809F748C(Boss07* this, PlayState* play); +void func_809F76D0(Boss07* this, PlayState* play); +void func_809F77A8(Boss07* this, PlayState* play); +void func_809F7968(Boss07* this, PlayState* play); +void func_809F7BC4(Boss07* this, PlayState* play); +void func_809F805C(Boss07* this, PlayState* play); +void func_809F86B8(Boss07* this, PlayState* play); +void func_809F87C8(Boss07* this, PlayState* play); +void func_809F8908(Boss07* this, PlayState* play); +void func_809F8B1C(Boss07* this, PlayState* play); +void func_809F8D04(Boss07* this, PlayState* play); +void func_809F8EC8(Boss07* this, PlayState* play); +void func_809F91D4(Boss07* this, PlayState* play); +void func_809FCCCC(Boss07* this, PlayState* play); +void func_809FD710(Boss07* this, PlayState* play); +void func_809FD89C(Boss07* this, PlayState* play); +void func_809FDAB0(Boss07* this, PlayState* play); +void func_809FDF54(Boss07* this, PlayState* play); +void func_809FE0E4(Boss07* this, PlayState* play); +void func_809FE348(Boss07* this, PlayState* play); +void func_809FE524(Boss07* this, PlayState* play); +void func_809FE734(Boss07* this, PlayState* play); +void func_809FFA80(Boss07* this, PlayState* play); +void func_809FFEAC(Boss07* this, PlayState* play); +void func_80A00274(Boss07* this, PlayState* play); +void func_80A00554(Boss07* this, PlayState* play); +void func_80A00720(Boss07* this, PlayState* play); +void func_80A01750(Boss07* this, PlayState* play); +void func_80A0264C(Boss07* this, PlayState* play); +void func_80A04890(Boss07* this, PlayState* play); +void func_80A04E5C(Boss07* this, PlayState* play); +void func_80A05608(Boss07* this, PlayState* play); +void func_80A05B50(Boss07* this, PlayState* play); +void func_80A05DDC(Boss07* this, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.h b/src/overlays/actors/ovl_Boss_07/z_boss_07.h index b8ace3f9ce..f8a4d4d91a 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.h +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.h @@ -5,7 +5,7 @@ struct Boss07; -typedef void (*Boss07ActionFunc)(struct Boss07*, GlobalContext*); +typedef void (*Boss07ActionFunc)(struct Boss07*, PlayState*); typedef struct Boss07 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c index d8ebaf7eb1..7b854fb95a 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c @@ -10,26 +10,26 @@ #define THIS ((BossHakugin*)thisx) -void BossHakugin_Init(Actor* thisx, GlobalContext* globalCtx); -void BossHakugin_Destroy(Actor* thisx, GlobalContext* globalCtx); -void BossHakugin_Update(Actor* thisx, GlobalContext* globalCtx); -void BossHakugin_Draw(Actor* thisx, GlobalContext* globalCtx); +void BossHakugin_Init(Actor* thisx, PlayState* play); +void BossHakugin_Destroy(Actor* thisx, PlayState* play); +void BossHakugin_Update(Actor* thisx, PlayState* play); +void BossHakugin_Draw(Actor* thisx, PlayState* play); -void func_80B08018(BossHakugin* this, GlobalContext* globalCtx); -void func_80B0813C(BossHakugin* this, GlobalContext* globalCtx); -void func_80B082AC(BossHakugin* this, GlobalContext* globalCtx); -void func_80B0863C(BossHakugin* this, GlobalContext* globalCtx); -void func_80B08960(BossHakugin* this, GlobalContext* globalCtx); -void func_80B08CB8(BossHakugin* this, GlobalContext* globalCtx); -void func_80B091D8(BossHakugin* this, GlobalContext* globalCtx); -void func_80B094E0(BossHakugin* this, GlobalContext* globalCtx); -void func_80B098BC(BossHakugin* this, GlobalContext* globalCtx); -void func_80B09C78(BossHakugin* this, GlobalContext* globalCtx); -void func_80B09E20(BossHakugin* this, GlobalContext* globalCtx); -void func_80B09EDC(BossHakugin* this, GlobalContext* globalCtx); -void func_80B0A2A4(BossHakugin* this, GlobalContext* globalCtx); -void func_80B0A638(BossHakugin* this, GlobalContext* globalCtx); -void func_80B0A8C4(BossHakugin* this, GlobalContext* globalCtx); +void func_80B08018(BossHakugin* this, PlayState* play); +void func_80B0813C(BossHakugin* this, PlayState* play); +void func_80B082AC(BossHakugin* this, PlayState* play); +void func_80B0863C(BossHakugin* this, PlayState* play); +void func_80B08960(BossHakugin* this, PlayState* play); +void func_80B08CB8(BossHakugin* this, PlayState* play); +void func_80B091D8(BossHakugin* this, PlayState* play); +void func_80B094E0(BossHakugin* this, PlayState* play); +void func_80B098BC(BossHakugin* this, PlayState* play); +void func_80B09C78(BossHakugin* this, PlayState* play); +void func_80B09E20(BossHakugin* this, PlayState* play); +void func_80B09EDC(BossHakugin* this, PlayState* play); +void func_80B0A2A4(BossHakugin* this, PlayState* play); +void func_80B0A638(BossHakugin* this, PlayState* play); +void func_80B0A8C4(BossHakugin* this, PlayState* play); #if 0 const ActorInit Boss_Hakugin_InitVars = { diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h index 3aa7d122a4..ce809a32a1 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h @@ -5,7 +5,7 @@ struct BossHakugin; -typedef void (*BossHakuginActionFunc)(struct BossHakugin*, GlobalContext*); +typedef void (*BossHakuginActionFunc)(struct BossHakugin*, PlayState*); typedef struct BossHakuginEffect { /* 0x00 */ Vec3f unk_0; 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 01e8852fc6..8b5deef593 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -12,18 +12,18 @@ #define THIS ((DemoEffect*)thisx) -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 func_808CD940(DemoEffect* this, GlobalContext* globalCtx); -void func_808CD998(DemoEffect* this, GlobalContext* globalCtx); -void func_808CDBDC(DemoEffect* this, GlobalContext* globalCtx); -void func_808CDCEC(DemoEffect* this, GlobalContext* globalCtx); -void func_808CDD70(DemoEffect* this, GlobalContext* globalCtx); -void func_808CDDE0(DemoEffect* this, GlobalContext* globalCtx); -void func_808CDFF8(Actor* thisx, GlobalContext* globalCtx); -void func_808CE078(Actor* thisx, GlobalContext* globalCtx2); +void func_808CD940(DemoEffect* this, PlayState* play); +void func_808CD998(DemoEffect* this, PlayState* play); +void func_808CDBDC(DemoEffect* this, PlayState* play); +void func_808CDCEC(DemoEffect* this, PlayState* play); +void func_808CDD70(DemoEffect* this, PlayState* play); +void func_808CDDE0(DemoEffect* this, PlayState* play); +void func_808CDFF8(Actor* thisx, PlayState* play); +void func_808CE078(Actor* thisx, PlayState* play2); const ActorInit Demo_Effect_InitVars = { ACTOR_DEMO_EFFECT, @@ -37,7 +37,7 @@ const ActorInit Demo_Effect_InitVars = { (ActorFunc)NULL, }; -void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Init(Actor* thisx, PlayState* play) { static s16 sEffectTypeObjects[] = { OBJECT_EFC_TW, OBJECT_EFC_TW, OBJECT_EFC_TW, OBJECT_EFC_TW, GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP, @@ -54,7 +54,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) { if (sEffectTypeObjects[type] == GAMEPLAY_KEEP) { objectIndex = 0; } else { - objectIndex = Object_GetIndex(&globalCtx->objectCtx, sEffectTypeObjects[type]); + objectIndex = Object_GetIndex(&play->objectCtx, sEffectTypeObjects[type]); } if (objectIndex < 0) { @@ -103,7 +103,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808CD940; } -void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Destroy(Actor* thisx, PlayState* play) { DemoEffect* this = THIS; switch (DEMO_EFFECT_GET_TYPE(&this->actor)) { @@ -111,7 +111,7 @@ void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { case DEMO_EFFECT_TYPE_1: case DEMO_EFFECT_TYPE_2: case DEMO_EFFECT_TYPE_3: - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); break; default: @@ -119,21 +119,21 @@ void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_808CD940(DemoEffect* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->initObjectIndex)) { +void func_808CD940(DemoEffect* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->initObjectIndex)) { this->actor.objBankIndex = this->initObjectIndex; this->actor.draw = this->initDrawFunc; this->actionFunc = this->initActionFunc; } } -void func_808CD998(DemoEffect* this, GlobalContext* globalCtx) { +void func_808CD998(DemoEffect* this, PlayState* play) { s32 type = DEMO_EFFECT_GET_TYPE(&this->actor); - if (SkelCurve_Init(globalCtx, &this->skelCurve, &object_efc_tw_Skel_0012E8, &object_efc_tw_CurveAnim_000050)) {} + if (SkelCurve_Init(play, &this->skelCurve, &object_efc_tw_Skel_0012E8, &object_efc_tw_CurveAnim_000050)) {} SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_CurveAnim_000050, 1.0f, 59.0f, 1.0f, 1.7f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); this->actionFunc = func_808CDCEC; switch (type) { @@ -176,7 +176,7 @@ void func_808CDAD0(f32 alphaScale) { } } -void func_808CDBDC(DemoEffect* this, GlobalContext* globalCtx) { +void func_808CDBDC(DemoEffect* this, PlayState* play) { s32 type = DEMO_EFFECT_GET_TYPE(&this->actor); f32 scale; f32 alphaScale; @@ -217,17 +217,17 @@ void func_808CDBDC(DemoEffect* this, GlobalContext* globalCtx) { } } -void func_808CDCEC(DemoEffect* this, GlobalContext* globalCtx) { +void func_808CDCEC(DemoEffect* this, PlayState* play) { func_800B8FE8(&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, &object_efc_tw_CurveAnim_000050, 1.0f, 60.0f, 59.0f, 0.0f); this->actionFunc = func_808CDBDC; this->timer = 0; } } -void func_808CDD70(DemoEffect* this, GlobalContext* globalCtx) { +void func_808CDD70(DemoEffect* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x - 0.02f); this->timer++; @@ -236,7 +236,7 @@ void func_808CDD70(DemoEffect* this, GlobalContext* globalCtx) { } } -void func_808CDDE0(DemoEffect* this, GlobalContext* globalCtx) { +void func_808CDDE0(DemoEffect* this, PlayState* play) { Actor_SetScale(&this->actor, (this->actor.scale.x * 0.5f) + 0.2f); this->timer++; @@ -245,28 +245,28 @@ void func_808CDDE0(DemoEffect* this, GlobalContext* globalCtx) { } } -void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoEffect_Update(Actor* thisx, PlayState* play) { DemoEffect* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 func_808CDE78(GlobalContext* globalCtx, SkelCurve* skelCurve, s32 limbIndex, Actor* thisx) { +s32 func_808CDE78(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, Actor* thisx) { s32 pad; DemoEffect* this = THIS; - u32 frames = globalCtx->gameplayFrames; + u32 frames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (frames * 6) % 1024, 255 - ((frames * 16) % 256), 0x100, - 0x40, 1, (frames * 4) % 512, 127 - ((frames * 12) % 128), 0x80, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (frames * 6) % 1024, 255 - ((frames * 16) % 256), 0x100, 0x40, 1, + (frames * 4) % 512, 127 - ((frames * 12) % 128), 0x80, 0x20)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (limbIndex == 0) { s16* transform = skelCurve->jointTable[0]; @@ -278,8 +278,8 @@ s32 func_808CDE78(GlobalContext* globalCtx, SkelCurve* skelCurve, s32 limbIndex, return true; } -void func_808CDFF8(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_808CDFF8(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; DemoEffect* this = THIS; OPEN_DISPS(gfxCtx); @@ -287,37 +287,37 @@ void func_808CDFF8(Actor* thisx, GlobalContext* globalCtx) { 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, func_808CDE78, NULL, 1, &this->actor); + SkelCurve_Draw(&this->actor, play, &this->skelCurve, func_808CDE78, NULL, 1, &this->actor); CLOSE_DISPS(gfxCtx); } -void func_808CE078(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_808CE078(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoEffect* this = THIS; s16 zRot = (this->timer * 0x400) & 0xFFFF; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Push(); Matrix_RotateZS(zRot, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023288); Matrix_Pop(); Matrix_RotateZS(-zRot, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023288); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); D_801F4E32 = 1; D_801F4E38.x = thisx->world.pos.x; 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 775bfcb0f5..749ead9467 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 (*DemoEffectActionFunc)(struct DemoEffect*, GlobalContext*); +typedef void (*DemoEffectActionFunc)(struct DemoEffect*, PlayState*); #define DEMO_EFFECT_GET_TYPE(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c index 9e6661fd0a..7a767d8dec 100644 --- a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c +++ b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c @@ -10,9 +10,9 @@ #define THIS ((DemoGetitem*)thisx) -void DemoGetitem_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoGetitem_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoGetitem_Update(Actor* thisx, GlobalContext* globalCtx); +void DemoGetitem_Init(Actor* thisx, PlayState* play); +void DemoGetitem_Destroy(Actor* thisx, PlayState* play); +void DemoGetitem_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Demo_Getitem_InitVars = { diff --git a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h index 880f79fe22..c7b9338119 100644 --- a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h +++ b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h @@ -5,7 +5,7 @@ struct DemoGetitem; -typedef void (*DemoGetitemActionFunc)(struct DemoGetitem*, GlobalContext*); +typedef void (*DemoGetitemActionFunc)(struct DemoGetitem*, PlayState*); typedef struct DemoGetitem { /* 0x0000 */ Actor actor; 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 179d480de0..57347e4e22 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -12,12 +12,12 @@ #define THIS ((DemoKankyo*)thisx) -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 DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx); +void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, PlayState* play); static u8 sLostWoodsSparklesMutex = false; // make sure only one can exist at once static s16 sLostWoodsSkyFishParticleNum = 0; @@ -40,7 +40,7 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, PlayState* play) { s32 pad; s32 i; f32 randSkyfishParticleNum; @@ -53,16 +53,16 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa f32 posCenterY; f32 posCenterZ; Vec3f eyeToAt; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (globalCtx->roomCtx.unk7A[1] != 0) { - if (globalCtx->envCtx.unk_F2[3] != 0) { - globalCtx->envCtx.unk_F2[3]--; + if (play->roomCtx.unk7A[1] != 0) { + if (play->envCtx.unk_F2[3] != 0) { + play->envCtx.unk_F2[3]--; } else { Actor_MarkForDeath(&this->actor); } - } else if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { - globalCtx->envCtx.unk_F2[3] += 16; + } else if (play->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { + play->envCtx.unk_F2[3] += 16; } // note: DemoKankyo can crash if placed in an area that snows (ObjectKankyo) @@ -70,12 +70,12 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa // causing DemoKankyo to write beyond its efffect array boundry // this crash can occur if the two actors are in different scenes connected by an exit // e.g. if you add DemoKankyo to GoronShrine, you will crash entering/leaving through door - for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { + for (i = 0; i < play->envCtx.unk_F2[3]; i++) { repositionLimit = 130.0f; - eyeToAt.x = globalCtx->view.at.x - globalCtx->view.eye.x; - eyeToAt.y = globalCtx->view.at.y - globalCtx->view.eye.y; - eyeToAt.z = globalCtx->view.at.z - globalCtx->view.eye.z; + eyeToAt.x = play->view.at.x - play->view.eye.x; + eyeToAt.y = play->view.at.y - play->view.eye.y; + eyeToAt.z = play->view.at.z - play->view.eye.z; eyeToAtMag = sqrtf(SQXYZ(eyeToAt)); eyeToAtNormX = eyeToAt.x / eyeToAtMag; eyeToAtNormY = eyeToAt.y / eyeToAtMag; @@ -83,9 +83,9 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa switch (this->effects[i].state) { case DEMO_KANKYO_STATE_INIT: - this->effects[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * 80.0f); - this->effects[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * 80.0f); - this->effects[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * 80.0f); + this->effects[i].posBase.x = play->view.eye.x + (eyeToAtNormX * 80.0f); + this->effects[i].posBase.y = play->view.eye.y + (eyeToAtNormY * 80.0f); + this->effects[i].posBase.z = play->view.eye.z + (eyeToAtNormZ * 80.0f); this->effects[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * 160.0f; this->effects[i].posOffset.y = 30.0f; @@ -109,9 +109,9 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa case DEMO_KANKYO_STATE_SINGLE: case DEMO_KANKYO_STATE_SKYFISH: this->effects[i].alphaClock++; - posCenterX = globalCtx->view.eye.x + (eyeToAtNormX * 80.0f); - posCenterY = globalCtx->view.eye.y + (eyeToAtNormY * 80.0f); - posCenterZ = globalCtx->view.eye.z + (eyeToAtNormZ * 80.0f); + posCenterX = play->view.eye.x + (eyeToAtNormX * 80.0f); + posCenterY = play->view.eye.y + (eyeToAtNormY * 80.0f); + posCenterZ = play->view.eye.z + (eyeToAtNormZ * 80.0f); this->effects[i].posOffsetPrev.x = this->effects[i].posOffset.x; this->effects[i].posOffsetPrev.y = this->effects[i].posOffset.y; this->effects[i].posOffsetPrev.z = this->effects[i].posOffset.z; @@ -278,8 +278,8 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa } } -void DemoKakyo_GiantObjectCheck(DemoKankyo* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objectId)) { +void DemoKakyo_GiantObjectCheck(DemoKankyo* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objectId)) { this->isSafeToDrawGiants = true; this->actor.objBankIndex = this->objectId; DemoKankyo_SetupAction(this, DemoKakyo_MoonSparklesActionFunc); @@ -289,7 +289,7 @@ void DemoKakyo_GiantObjectCheck(DemoKankyo* this, GlobalContext* globalCtx) { /* * used by Moon AND giants types */ -void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx) { +void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, PlayState* play) { s32 i; Vec3f eyeToAt; f32 eyeToAtNormX; @@ -304,13 +304,13 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx s32 pad1; Vec3f worldPos; - if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { - globalCtx->envCtx.unk_F2[3] += 16; + if (play->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { + play->envCtx.unk_F2[3] += 16; } - eyeToAt.x = globalCtx->view.at.x - globalCtx->view.eye.x; - eyeToAt.y = globalCtx->view.at.y - globalCtx->view.eye.y; - eyeToAt.z = globalCtx->view.at.z - globalCtx->view.eye.z; + eyeToAt.x = play->view.at.x - play->view.eye.x; + eyeToAt.y = play->view.at.y - play->view.eye.y; + eyeToAt.z = play->view.at.z - play->view.eye.z; eyeToAtMag = sqrtf(SQXYZ(eyeToAt)); eyeToAtNormX = eyeToAt.x / eyeToAtMag; eyeToAtNormY = eyeToAt.y / eyeToAtMag; @@ -318,12 +318,12 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx halfScreenHeight = SCREEN_HEIGHT / 2; - for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { + for (i = 0; i < play->envCtx.unk_F2[3]; i++) { switch (this->effects[i].state) { case DEMO_KANKYO_STATE_INIT: - this->effects[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * halfScreenHeight); - this->effects[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight); - this->effects[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * halfScreenHeight); + this->effects[i].posBase.x = play->view.eye.x + (eyeToAtNormX * halfScreenHeight); + this->effects[i].posBase.y = play->view.eye.y + (eyeToAtNormY * halfScreenHeight); + this->effects[i].posBase.z = play->view.eye.z + (eyeToAtNormZ * halfScreenHeight); this->effects[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); this->effects[i].posOffset.y = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); @@ -351,12 +351,12 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx if (this->actor.params == DEMO_KANKYO_TYPE_MOON) { // this function gets reused for giants too this->effects[i].posBase.y = - globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight) + (SCREEN_HEIGHT / 3); + play->view.eye.y + (eyeToAtNormY * halfScreenHeight) + (SCREEN_HEIGHT / 3); } - newEye.x = globalCtx->view.eye.x + (eyeToAtNormX * halfScreenHeight); - newEye.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight); - newEye.z = globalCtx->view.eye.z + (eyeToAtNormZ * halfScreenHeight); + newEye.x = play->view.eye.x + (eyeToAtNormX * halfScreenHeight); + newEye.y = play->view.eye.y + (eyeToAtNormY * halfScreenHeight); + newEye.z = play->view.eye.z + (eyeToAtNormZ * halfScreenHeight); Math_SmoothStepToF(&this->effects[i].scale, 0.2f, 0.1f, 0.001f, 0.00001f); Math_SmoothStepToF(&this->effects[i].speed, this->effects[i].speedTarget, 0.5f, 0.2f, 0.02f); @@ -403,7 +403,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - randZeroOne = Math_Vec3f_DistXZ(&worldPos, &globalCtx->view.eye) / 200.0f; + randZeroOne = Math_Vec3f_DistXZ(&worldPos, &play->view.eye) / 200.0f; randZeroOne = CLAMP(randZeroOne, 0.0f, 1.0f); halfScreenWidth = 100.0f + randZeroOne + 60.0f; // range 160 to 161...? thats about half screen width @@ -433,7 +433,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx } } -void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Init(Actor* thisx, PlayState* play) { DemoKankyo* this = THIS; s32 pad; s32 i; @@ -460,7 +460,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { case DEMO_KANKYO_TYPE_GIANTS: this->isSafeToDrawGiants = false; - objId = Object_GetIndex(&globalCtx->objectCtx, sObjectBubbleIndex); + objId = Object_GetIndex(&play->objectCtx, sObjectBubbleIndex); DemoKankyo_SetupAction(this, DemoKakyo_GiantObjectCheck); break; @@ -481,20 +481,20 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Destroy(Actor* thisx, PlayState* play) { DemoKankyo* this = THIS; Actor_MarkForDeath(&this->actor); } -void DemoKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Update(Actor* thisx, PlayState* play) { DemoKankyo* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoKankyo* this = THIS; s16 i; f32 scaleAlpha; @@ -502,20 +502,20 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { Vec3f screenPos; // if not underwater - if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (!(play->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100)) { + OPEN_DISPS(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gSun1Tex)); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07AB10); - for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { + for (i = 0; i < play->envCtx.unk_F2[3]; i++) { worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x; worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(globalCtx, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT // checking if particle is on screen if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && @@ -570,22 +570,22 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { break; } - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07AB58); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } // draw, giants and moon -void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DemoKankyo* this = THIS; s16 i; f32 alphaScale; @@ -594,17 +594,17 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { Vec3f worldPos; Vec3f screenPos; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); func_8012C2DC(gfxCtx); - for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { + for (i = 0; i < play->envCtx.unk_F2[3]; i++) { worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x; worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(globalCtx, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT // checking if effect is on screen if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && @@ -616,7 +616,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { } Matrix_Scale(this->effects[i].scale * alphaScale, this->effects[i].scale * alphaScale, this->effects[i].scale * alphaScale, MTXMODE_APPLY); - alphaScale = Math_Vec3f_DistXYZ(&worldPos, &globalCtx->view.eye) / 300.0f; + alphaScale = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye) / 300.0f; alphaScale = CLAMP(1.0f - alphaScale, 0.0f, 1.0f); if (this->actor.params == DEMO_KANKYO_TYPE_GIANTS) { @@ -641,11 +641,11 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, &gLightOrb1DL); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params == DEMO_KANKYO_TYPE_GIANTS) { @@ -660,17 +660,17 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { } } -void DemoKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoKankyo_Draw(Actor* thisx, PlayState* play) { DemoKankyo* this = THIS; switch (this->actor.params) { case DEMO_KANKYO_TYPE_LOSTWOODS: - DemoKakyo_DrawLostWoodsSparkle(&this->actor, globalCtx); + DemoKakyo_DrawLostWoodsSparkle(&this->actor, play); break; case DEMO_KANKYO_TYPE_GIANTS: case DEMO_KANKYO_TYPE_MOON: - DemoKankyo_DrawMoonAndGiant(&this->actor, globalCtx); + DemoKankyo_DrawMoonAndGiant(&this->actor, play); break; } } 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 e614117eef..7c7885b147 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -5,7 +5,7 @@ struct DemoKankyo; -typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, GlobalContext*); +typedef void (*DemoKankyoActionFunc)(struct DemoKankyo*, PlayState*); typedef struct { /* 0x000 */ u8 state; diff --git a/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c b/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c index 9ed7a0c274..c051ccf494 100644 --- a/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c +++ b/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.c @@ -10,10 +10,10 @@ #define THIS ((DemoMoonend*)thisx) -void DemoMoonend_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoMoonend_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoMoonend_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoMoonend_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoMoonend_Init(Actor* thisx, PlayState* play); +void DemoMoonend_Destroy(Actor* thisx, PlayState* play); +void DemoMoonend_Update(Actor* thisx, PlayState* play); +void DemoMoonend_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Demo_Moonend_InitVars = { diff --git a/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.h b/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.h index 463e867436..c7cd1fb100 100644 --- a/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.h +++ b/src/overlays/actors/ovl_Demo_Moonend/z_demo_moonend.h @@ -5,7 +5,7 @@ struct DemoMoonend; -typedef void (*DemoMoonendActionFunc)(struct DemoMoonend*, GlobalContext*); +typedef void (*DemoMoonendActionFunc)(struct DemoMoonend*, PlayState*); typedef struct DemoMoonend { /* 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 faedc1b748..0078f8959a 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -10,10 +10,10 @@ #define THIS ((DemoShd*)thisx) -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); const ActorInit Demo_Shd_InitVars = { ACTOR_DEMO_SHD, @@ -27,11 +27,11 @@ const ActorInit Demo_Shd_InitVars = { (ActorFunc)DemoShd_Draw, }; -void DemoShd_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Init(Actor* thisx, PlayState* play) { } -void DemoShd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Destroy(Actor* thisx, PlayState* play) { } -void DemoShd_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Update(Actor* thisx, PlayState* play) { } -void DemoShd_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoShd_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 72f101d182..524414e1ce 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -11,19 +11,19 @@ #define THIS ((DemoSyoten*)thisx) -void DemoSyoten_Init(Actor* thisx, GlobalContext* globalCtx); -void DemoSyoten_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DemoSyoten_Update(Actor* thisx, GlobalContext* globalCtx); -void DemoSyoten_Draw(Actor* thisx, GlobalContext* globalCtx); +void DemoSyoten_Init(Actor* thisx, PlayState* play); +void DemoSyoten_Destroy(Actor* thisx, PlayState* play); +void DemoSyoten_Update(Actor* thisx, PlayState* play); +void DemoSyoten_Draw(Actor* thisx, PlayState* play); -void func_80C16A64(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C16A74(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C16BD4(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C16DD4(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C16EAC(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C17008(DemoSyoten* this, GlobalContext* globalCtx); -void func_80C173B4(Actor* thisx, GlobalContext* globalCtx); -void func_80C17690(Actor* thisx, GlobalContext* globalCtx); +void func_80C16A64(DemoSyoten* this, PlayState* play); +void func_80C16A74(DemoSyoten* this, PlayState* play); +void func_80C16BD4(DemoSyoten* this, PlayState* play); +void func_80C16DD4(DemoSyoten* this, PlayState* play); +void func_80C16EAC(DemoSyoten* this, PlayState* play); +void func_80C17008(DemoSyoten* this, PlayState* play); +void func_80C173B4(Actor* thisx, PlayState* play); +void func_80C17690(Actor* thisx, PlayState* play); const ActorInit Demo_Syoten_InitVars = { ACTOR_DEMO_SYOTEN, @@ -57,7 +57,7 @@ Color_RGBA8 D_80C17834[] = { { 60, 50, 100, 255 }, }; -void DemoSyoten_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoSyoten_Init(Actor* thisx, PlayState* play) { s32 pad; DemoSyoten* this = THIS; @@ -78,9 +78,9 @@ void DemoSyoten_Init(Actor* thisx, GlobalContext* globalCtx) { func_801835EC(&this->unk_144, &object_syoten_Blob_00023C); this->actor.draw = NULL; this->actionFunc = func_80C16A74; - this->actor.child = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, 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, 0); + this->actor.child = + 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, 0); this->unk_3F0 = 0x215; Actor_SetScale(&this->actor, 0.05f); break; @@ -127,7 +127,7 @@ void DemoSyoten_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DemoSyoten_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoSyoten_Destroy(Actor* thisx, PlayState* play) { DemoSyoten* this = THIS; if (DEMOSYOTEN_GET_F(&this->actor) == DEMOSYOTEN_F_0) { @@ -135,14 +135,14 @@ void DemoSyoten_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80C16760(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16760(DemoSyoten* this, PlayState* play) { s32 pad; Vec3s* points; Vec3f sp2C; this->unk_3EC = 0; if (DEMOSYOTEN_GET_7E00(&this->actor) != DEMOSYOTEN_7E00_3F) { - this->unk_3E8 = &globalCtx->setupPathList[DEMOSYOTEN_GET_7E00(&this->actor)]; + this->unk_3E8 = &play->setupPathList[DEMOSYOTEN_GET_7E00(&this->actor)]; if (this->unk_3E8 != NULL) { points = Lib_SegmentedToVirtual(this->unk_3E8->points); Math_Vec3s_ToVec3f(&this->actor.world.pos, &points[0]); @@ -179,7 +179,7 @@ s32 func_80C16818(DemoSyoten* this) { return false; } -void func_80C168D0(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C168D0(DemoSyoten* this, PlayState* play) { s32 pad; Path* path = this->unk_3E8; Vec3s* points; @@ -191,7 +191,7 @@ void func_80C168D0(DemoSyoten* this, GlobalContext* globalCtx) { points = Lib_SegmentedToVirtual(this->unk_3E8->points); points += this->unk_3EC; Math_Vec3s_ToVec3f(&sp30, points); - Actor_GetProjectedPos(globalCtx, &sp30, &sp24, &sp20); + Actor_GetProjectedPos(play, &sp30, &sp24, &sp20); Math_Vec3f_Copy(&sp30, &this->actor.projectedPos); sp30.z = sp30.y; sp24.z = sp24.y; @@ -215,21 +215,21 @@ void func_80C16974(f32 arg0) { } } -void func_80C16A64(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16A64(DemoSyoten* this, PlayState* play) { } -void func_80C16A74(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16A74(DemoSyoten* this, PlayState* play) { u16 temp_a0; func_80183DE0(&this->unk_144); - if (Cutscene_CheckActorAction(globalCtx, this->unk_3F0)) { - if ((globalCtx->csCtx.frames >= 160) && (globalCtx->csCtx.frames < 322)) { + if (Cutscene_CheckActorAction(play, this->unk_3F0)) { + if ((play->csCtx.frames >= 160) && (play->csCtx.frames < 322)) { func_800B9010(&this->actor, NA_SE_EV_IKANA_SOUL_LV - SFX_FLAG); - } else if (globalCtx->csCtx.frames == 322) { + } else if (play->csCtx.frames == 322) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_IKANA_SOUL_TRANSFORM); } - temp_a0 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->action; + temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; if (this->unk_3F2 != temp_a0) { this->unk_3F2 = temp_a0; switch (temp_a0) { @@ -269,12 +269,12 @@ void func_80C16A74(DemoSyoten* this, GlobalContext* globalCtx) { } } -void func_80C16BD4(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16BD4(DemoSyoten* this, PlayState* play) { s32 pad; u16 temp_a0; - if (Cutscene_CheckActorAction(globalCtx, this->unk_3F0)) { - temp_a0 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->action; + if (Cutscene_CheckActorAction(play, this->unk_3F0)) { + temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; if (this->unk_3F2 != temp_a0) { this->unk_3F2 = temp_a0; switch (temp_a0) { @@ -297,7 +297,7 @@ void func_80C16BD4(DemoSyoten* this, GlobalContext* globalCtx) { case 4: this->actor.draw = DemoSyoten_Draw; - func_80C16760(this, globalCtx); + func_80C16760(this, play); this->unk_3E4 |= 4; this->unk_3E4 &= ~1; break; @@ -314,13 +314,12 @@ void func_80C16BD4(DemoSyoten* this, GlobalContext* globalCtx) { case 4: this->actor.speedXZ = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->urot.z * - 0.005493164f; + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->urot.z * 0.005493164f; if (this->unk_3EC < this->unk_3E8->count) { if (func_80C16818(this)) { this->unk_3EC++; } - func_80C168D0(this, globalCtx); + func_80C168D0(this, play); } break; } @@ -329,12 +328,12 @@ void func_80C16BD4(DemoSyoten* this, GlobalContext* globalCtx) { } } -void func_80C16DD4(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16DD4(DemoSyoten* this, PlayState* play) { s32 pad; u16 temp_a0; - if (Cutscene_CheckActorAction(globalCtx, this->unk_3F0)) { - temp_a0 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->action; + if (Cutscene_CheckActorAction(play, this->unk_3F0)) { + temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; if (this->unk_3F2 != temp_a0) { this->unk_3F2 = temp_a0; switch (temp_a0) { @@ -358,12 +357,12 @@ void func_80C16DD4(DemoSyoten* this, GlobalContext* globalCtx) { } } -void func_80C16EAC(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C16EAC(DemoSyoten* this, PlayState* play) { s32 pad; u16 temp_a0; - if (Cutscene_CheckActorAction(globalCtx, this->unk_3F0)) { - temp_a0 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->action; + if (Cutscene_CheckActorAction(play, this->unk_3F0)) { + temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; if (this->unk_3F2 != temp_a0) { this->unk_3F2 = temp_a0; switch (temp_a0) { @@ -401,11 +400,11 @@ void func_80C16EAC(DemoSyoten* this, GlobalContext* globalCtx) { func_80C16974(this->unk_3D8); } -void func_80C17008(DemoSyoten* this, GlobalContext* globalCtx) { +void func_80C17008(DemoSyoten* this, PlayState* play) { u16 temp_a0; - if (Cutscene_CheckActorAction(globalCtx, this->unk_3F0)) { - temp_a0 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_3F0)]->action; + if (Cutscene_CheckActorAction(play, this->unk_3F0)) { + temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; if (this->unk_3F2 != temp_a0) { this->unk_3F2 = temp_a0; switch (temp_a0) { @@ -428,14 +427,14 @@ void func_80C17008(DemoSyoten* this, GlobalContext* globalCtx) { } } -void DemoSyoten_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoSyoten_Update(Actor* thisx, PlayState* play) { DemoSyoten* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 func_80C170F8(GlobalContext* globalCtx, UNK_TYPE arg1, s32 arg2, UNK_TYPE arg3, UNK_TYPE arg4, Actor* thisx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +s32 func_80C170F8(PlayState* play, UNK_TYPE arg1, s32 arg2, UNK_TYPE arg3, UNK_TYPE arg4, Actor* thisx) { + GraphicsContext* gfxCtx = play->state.gfxCtx; DemoSyoten* this = THIS; OPEN_DISPS(gfxCtx); @@ -478,27 +477,27 @@ s32 func_80C170F8(GlobalContext* globalCtx, UNK_TYPE arg1, s32 arg2, UNK_TYPE ar return true; } -void func_80C173B4(Actor* thisx, GlobalContext* globalCtx) { +void func_80C173B4(Actor* thisx, PlayState* play) { s32 pad; DemoSyoten* this = THIS; Mtx* matrix; - AnimatedMat_DrawXlu(globalCtx, Lib_SegmentedToVirtual(&object_syoten_Matanimheader_001298)); + AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(&object_syoten_Matanimheader_001298)); - matrix = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * this->unk_144.unk_18->unk_1)); + matrix = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * this->unk_144.unk_18->unk_1)); if (matrix != NULL) { - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - func_8018450C(globalCtx, &this->unk_144, matrix, (void*)func_80C170F8, 0, &this->actor); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + func_8018450C(play, &this->unk_144, matrix, (void*)func_80C170F8, 0, &this->actor); } } -void func_80C17468(GlobalContext* globalCtx) { +void func_80C17468(PlayState* play) { Color_RGBA8 sp2C; Color_RGBA8 sp28; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_800FE7A8(D_80C17824, &sp2C); func_800FE7A8(D_80C17834, &sp28); @@ -506,70 +505,70 @@ void func_80C17468(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sp2C.r, sp2C.g, sp2C.b, 255); gDPSetEnvColor(POLY_XLU_DISP++, sp28.r, sp28.g, sp28.b, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DemoSyoten_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DemoSyoten_Draw(Actor* thisx, PlayState* play) { s32 pad; DemoSyoten* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (this->unk_3E4 & 4) { Matrix_RotateZS(-this->actor.shape.rot.z, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); Matrix_Scale(1.0f, 5.0f, 1.0f, MTXMODE_APPLY); } if (this->unk_3E4 & 1) { - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); } if (this->unk_3E4 & 8) { - func_80C17468(globalCtx); + func_80C17468(play); } if (this->unk_3E0 != NULL) { if (this->unk_3E4 & 2) { - AnimatedMat_DrawStepXlu(globalCtx, this->unk_3E0, this->unk_3E6); + AnimatedMat_DrawStepXlu(play, this->unk_3E0, this->unk_3E6); } else { - AnimatedMat_DrawXlu(globalCtx, this->unk_3E0); + AnimatedMat_DrawXlu(play, this->unk_3E0); } } if (this->unk_3DC != NULL) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, this->unk_3DC); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80C17690(Actor* thisx, GlobalContext* globalCtx) { +void func_80C17690(Actor* thisx, PlayState* play) { s32 pad; DemoSyoten* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); if (this->unk_3E4 & 8) { - func_80C17468(globalCtx); + func_80C17468(play); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - AnimatedMat_DrawStepXlu(globalCtx, this->unk_3E0, this->unk_3E6); + AnimatedMat_DrawStepXlu(play, this->unk_3E0, this->unk_3E6); gSPDisplayList(POLY_XLU_DISP++, object_syoten_DL_002880); - AnimatedMat_DrawStepXlu(globalCtx, this->unk_3E0, this->unk_3E6 + 5); + AnimatedMat_DrawStepXlu(play, this->unk_3E0, this->unk_3E6 + 5); gSPDisplayList(POLY_XLU_DISP++, object_syoten_DL_002A20); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h index 204243f47c..b9625d75e8 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h @@ -5,7 +5,7 @@ struct DemoSyoten; -typedef void (*DemoSyotenActionFunc)(struct DemoSyoten*, GlobalContext*); +typedef void (*DemoSyotenActionFunc)(struct DemoSyoten*, PlayState*); #define DEMOSYOTEN_GET_F(thisx) ((thisx)->params & 0xF) #define DEMOSYOTEN_GET_7E00(thisx) (((thisx)->params & 0x7E00) >> 9) 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 d76de38a3d..ca833fe0ef 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 @@ -12,16 +12,16 @@ #define THIS ((DemoTreLgt*)thisx) -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 DemoTreLgt_SetupWait(DemoTreLgt* this); -void DemoTreLgt_Wait(DemoTreLgt* this, GlobalContext* globalCtx); -void DemoTreLgt_SetupAnimate(DemoTreLgt* this, GlobalContext* globalCtx, f32 frame); -void DemoTreLgt_Animate(DemoTreLgt* this, GlobalContext* globalCtx); +void DemoTreLgt_Wait(DemoTreLgt* this, PlayState* play); +void DemoTreLgt_SetupAnimate(DemoTreLgt* this, PlayState* play, f32 frame); +void DemoTreLgt_Animate(DemoTreLgt* this, PlayState* play); typedef struct { f32 unk0; @@ -62,10 +62,10 @@ static DemoTreLgtActionFunc sActionFuncs[] = { DemoTreLgt_Animate, }; -void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Init(Actor* thisx, PlayState* play) { DemoTreLgt* this = THIS; - SkelCurve_Init(globalCtx, &this->skelCurve, &gBoxLightCurveSkel, sBoxLightAnimations[0]); + SkelCurve_Init(play, &this->skelCurve, &gBoxLightCurveSkel, sBoxLightAnimations[0]); this->colorAlpha1 = 255; this->colorAlpha2 = 255; this->status = 0; @@ -78,34 +78,34 @@ void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { DemoTreLgt_SetupWait(this); } -void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Destroy(Actor* thisx, PlayState* play) { DemoTreLgt* this = THIS; - SkelCurve_Destroy(globalCtx, &this->skelCurve); + SkelCurve_Destroy(play, &this->skelCurve); } void DemoTreLgt_SetupWait(DemoTreLgt* this) { this->action = DEMO_TRE_LGT_ACTION_WAIT; } -void DemoTreLgt_Wait(DemoTreLgt* this, GlobalContext* globalCtx) { +void DemoTreLgt_Wait(DemoTreLgt* this, PlayState* play) { EnBox* chest = (EnBox*)this->actor.parent; if (chest != NULL) { if (Animation_OnFrame(&chest->skelAnime, 10.0f)) { - DemoTreLgt_SetupAnimate(this, globalCtx, chest->skelAnime.curFrame); + DemoTreLgt_SetupAnimate(this, play, chest->skelAnime.curFrame); } } } -void DemoTreLgt_SetupAnimate(DemoTreLgt* this, GlobalContext* globalCtx, f32 frame) { +void DemoTreLgt_SetupAnimate(DemoTreLgt* this, PlayState* play, f32 frame) { this->action = DEMO_TRE_LGT_ACTION_ANIMATE; SkelCurve_SetAnim(&this->skelCurve, sBoxLightAnimations[this->animationType], 1.0f, D_808E1490[this->animationType].unk4 + D_808E1490[this->animationType].unk8, frame, 1.0f); - SkelCurve_Update(globalCtx, &this->skelCurve); + SkelCurve_Update(play, &this->skelCurve); } -void DemoTreLgt_Animate(DemoTreLgt* this, GlobalContext* globalCtx) { +void DemoTreLgt_Animate(DemoTreLgt* this, PlayState* play) { f32 curFrame = this->skelCurve.curFrame; if (curFrame < D_808E1490[this->animationType].unk4) { @@ -130,26 +130,26 @@ void DemoTreLgt_Animate(DemoTreLgt* this, GlobalContext* globalCtx) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_FLASH); } } - if (SkelCurve_Update(globalCtx, &this->skelCurve)) { + if (SkelCurve_Update(play, &this->skelCurve)) { Actor_MarkForDeath(&this->actor); } } -void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) { +void DemoTreLgt_Update(Actor* thisx, PlayState* play) { DemoTreLgt* this = THIS; - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); } -s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, Actor* thisx) { +s32 DemoTreLgt_OverrideLimbDraw(PlayState* play, SkelCurve* skelCuve, s32 limbIndex, Actor* thisx) { s32 pad; DemoTreLgt* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); 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 == OBJECT_BOX_LIGHT_LIMB_01) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha1); @@ -158,20 +158,20 @@ s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelCurve* skelCuve, s gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha2); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return true; } -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 = THIS; OPEN_DISPS(gfxCtx); if (this->action == DEMO_TRE_LGT_ACTION_ANIMATE) { func_8012C2DC(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); } 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 27f6d09b1c..83a210b8c5 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* this, GlobalContext* globalCtx); +typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt* this, PlayState* play); typedef struct DemoTreLgt { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index ede7baa1da..4a4fc69561 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -10,13 +10,13 @@ #define THIS ((DmAh*)thisx) -void DmAh_Init(Actor* thisx, GlobalContext* globalCtx); -void DmAh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmAh_Update(Actor* thisx, GlobalContext* globalCtx); -void DmAh_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmAh_Init(Actor* thisx, PlayState* play); +void DmAh_Destroy(Actor* thisx, PlayState* play); +void DmAh_Update(Actor* thisx, PlayState* play); +void DmAh_Draw(Actor* thisx, PlayState* play); -void func_80C1D7FC(DmAh* this, GlobalContext* globalCtx); -void func_80C1D92C(DmAh* this, GlobalContext* globalCtx); +void func_80C1D7FC(DmAh* this, PlayState* play); +void func_80C1D92C(DmAh* this, PlayState* play); #if 0 const ActorInit Dm_Ah_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h index 20ca6c4972..c49f049d11 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h @@ -5,7 +5,7 @@ struct DmAh; -typedef void (*DmAhActionFunc)(struct DmAh*, GlobalContext*); +typedef void (*DmAhActionFunc)(struct DmAh*, PlayState*); typedef struct DmAh { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c index d289b99ec3..a19de97b08 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -10,12 +10,12 @@ #define THIS ((DmAl*)thisx) -void DmAl_Init(Actor* thisx, GlobalContext* globalCtx); -void DmAl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmAl_Update(Actor* thisx, GlobalContext* globalCtx); -void DmAl_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmAl_Init(Actor* thisx, PlayState* play); +void DmAl_Destroy(Actor* thisx, PlayState* play); +void DmAl_Update(Actor* thisx, PlayState* play); +void DmAl_Draw(Actor* thisx, PlayState* play); -void func_80C1BDD8(DmAl* this, GlobalContext* globalCtx); +void func_80C1BDD8(DmAl* this, PlayState* play); #if 0 const ActorInit Dm_Al_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h index df89f9150c..5e9a3d91dd 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h @@ -5,7 +5,7 @@ struct DmAl; -typedef void (*DmAlActionFunc)(struct DmAl*, GlobalContext*); +typedef void (*DmAlActionFunc)(struct DmAl*, PlayState*); typedef struct DmAl { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 19f7844ac6..01f71f179f 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -12,14 +12,14 @@ #define THIS ((DmAn*)thisx) -void DmAn_Init(Actor* thisx, GlobalContext* globalCtx); -void DmAn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmAn_Update(Actor* thisx, GlobalContext* globalCtx); +void DmAn_Init(Actor* thisx, PlayState* play); +void DmAn_Destroy(Actor* thisx, PlayState* play); +void DmAn_Update(Actor* thisx, PlayState* play); -void func_80C1C958(DmAn* this, GlobalContext* globalCtx); -void func_80C1CAB0(DmAn* this, GlobalContext* globalCtx); -void func_80C1CC80(DmAn* this, GlobalContext* globalCtx); -void func_80C1D0B0(Actor* this, GlobalContext* globalCtx); +void func_80C1C958(DmAn* this, PlayState* play); +void func_80C1CAB0(DmAn* this, PlayState* play); +void func_80C1CC80(DmAn* this, PlayState* play); +void func_80C1D0B0(Actor* this, PlayState* play); const ActorInit Dm_An_InitVars = { ACTOR_DM_AN, @@ -50,7 +50,7 @@ static AnimationInfoS sAnimations[] = { { &object_an4_Anim_00506C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, }; -s32 func_80C1C410(DmAn* this, GlobalContext* globalCtx) { +s32 func_80C1C410(DmAn* this, PlayState* play) { s8 objectIndex = this->actor.objBankIndex; s8 objectIndex2; s32 ret = false; @@ -62,14 +62,14 @@ s32 func_80C1C410(DmAn* this, GlobalContext* globalCtx) { } if (objectIndex2 >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex2].segment); ret = SkelAnime_Update(&this->skelAnime); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex].segment); } return ret; } -s32 func_80C1C4D8(DmAn* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80C1C4D8(DmAn* this, PlayState* play, s32 arg2) { s8 objectIndex = this->actor.objBankIndex; s8 objectIndex2; s32 ret = false; @@ -81,10 +81,10 @@ s32 func_80C1C4D8(DmAn* this, GlobalContext* globalCtx, s32 arg2) { } if ((objectIndex2 >= 0) && (arg2 != this->unk_2C8)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex2].segment); this->unk_2C8 = arg2; ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex].segment); } return ret; } @@ -99,7 +99,7 @@ void func_80C1C5B4(DmAn* this) { } } -s32 func_80C1C62C(DmAn* this, GlobalContext* globalCtx) { +s32 func_80C1C62C(DmAn* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; @@ -130,9 +130,9 @@ s32 func_80C1C62C(DmAn* this, GlobalContext* globalCtx) { return true; } -s32 func_80C1C83C(DmAn* this, GlobalContext* globalCtx) { +s32 func_80C1C83C(DmAn* this, PlayState* play) { if (this->unk_2B4 != NULL) { - func_80C1C62C(this, globalCtx); + func_80C1C62C(this, play); this->unk_2AE &= ~1; this->unk_2AE |= 2; } else if (this->unk_2AE & 2) { @@ -148,12 +148,12 @@ s32 func_80C1C83C(DmAn* this, GlobalContext* globalCtx) { return true; } -Actor* func_80C1C8E8(GlobalContext* globalCtx) { +Actor* func_80C1C8E8(PlayState* play) { Actor* tempActor; Actor* foundActor = NULL; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); + foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); if ((foundActor == NULL) || (foundActor->update != NULL)) { break; @@ -169,23 +169,23 @@ Actor* func_80C1C8E8(GlobalContext* globalCtx) { return foundActor; } -void func_80C1C958(DmAn* this, GlobalContext* globalCtx) { - if ((this->unk_2AC >= 0) && SubS_IsObjectLoaded(this->unk_2AC, globalCtx) && (this->unk_2AD >= 0) && - SubS_IsObjectLoaded(this->unk_2AD, globalCtx)) { +void func_80C1C958(DmAn* this, PlayState* play) { + if ((this->unk_2AC >= 0) && SubS_IsObjectLoaded(this->unk_2AC, play) && (this->unk_2AD >= 0) && + SubS_IsObjectLoaded(this->unk_2AD, play)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_an1_Skel_012618, NULL, this->jointTable, - this->morphTable, OBJECT_AN1_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &object_an1_Skel_012618, NULL, this->jointTable, this->morphTable, + OBJECT_AN1_LIMB_MAX); this->unk_2C8 = -1; - func_80C1C4D8(this, globalCtx, 0); + func_80C1C4D8(this, play, 0); this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); this->unk_2AE |= 1; this->actor.draw = func_80C1D0B0; - if ((globalCtx->sceneNum == SCENE_YADOYA) && (globalCtx->curSpawn == 4)) { - this->unk_2B4 = func_80C1C8E8(globalCtx); - func_80C1C4D8(this, globalCtx, 1); + if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + this->unk_2B4 = func_80C1C8E8(play); + func_80C1C4D8(this, play, 1); this->actionFunc = func_80C1CC80; } else { this->actionFunc = func_80C1CAB0; @@ -193,12 +193,12 @@ void func_80C1C958(DmAn* this, GlobalContext* globalCtx) { } } -void func_80C1CAB0(DmAn* this, GlobalContext* globalCtx) { +void func_80C1CAB0(DmAn* this, PlayState* play) { s32 sp28[] = { 0, 0, 12, 2, 4, 6, 8, 10, 11, 3 }; u16 action; s32 sp20; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (this->unk_2D0 == 0) { this->unk_2B0 = 255; this->unk_2D0 = 1; @@ -206,14 +206,14 @@ void func_80C1CAB0(DmAn* this, GlobalContext* globalCtx) { this->unk_2CC = this->unk_2C8; } - if (Cutscene_CheckActorAction(globalCtx, 0x22D)) { - sp20 = Cutscene_GetActorActionIndex(globalCtx, 0x22D); - action = globalCtx->csCtx.actorActions[sp20]->action; + if (Cutscene_CheckActorAction(play, 0x22D)) { + sp20 = Cutscene_GetActorActionIndex(play, 0x22D); + action = play->csCtx.actorActions[sp20]->action; if (this->unk_2B0 != (action & 0xFF)) { this->unk_2B0 = action; this->unk_2D4 = 1; - func_80C1C4D8(this, globalCtx, sp28[action]); + func_80C1C4D8(this, play, sp28[action]); } switch (this->unk_2B0) { @@ -225,72 +225,72 @@ void func_80C1CAB0(DmAn* this, GlobalContext* globalCtx) { case 8: if ((this->unk_2C8 == 12) || (this->unk_2C8 == 4) || (this->unk_2C8 == 6) || (this->unk_2C8 == 8)) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80C1C4D8(this, globalCtx, this->unk_2C8 + 1); + func_80C1C4D8(this, play, this->unk_2C8 + 1); } } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, sp20); + Cutscene_ActorTranslateAndYaw(&this->actor, play, sp20); } } else if (this->unk_2D0 != 0) { this->unk_2D0 = 0; this->unk_2D4 = 0; - func_80C1C4D8(this, globalCtx, this->unk_2CC); + func_80C1C4D8(this, play, this->unk_2CC); } } -void func_80C1CC80(DmAn* this, GlobalContext* globalCtx) { +void func_80C1CC80(DmAn* this, PlayState* play) { } -void DmAn_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmAn_Init(Actor* thisx, PlayState* play) { DmAn* this = THIS; - this->unk_2AC = SubS_GetObjectIndex(OBJECT_AN4, globalCtx); - this->unk_2AD = SubS_GetObjectIndex(OBJECT_MSMO, globalCtx); + this->unk_2AC = SubS_GetObjectIndex(OBJECT_AN4, play); + this->unk_2AD = SubS_GetObjectIndex(OBJECT_MSMO, play); this->actionFunc = func_80C1C958; } -void DmAn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmAn_Destroy(Actor* thisx, PlayState* play) { } -void DmAn_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmAn_Update(Actor* thisx, PlayState* play) { DmAn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80C1C83C(this, globalCtx); + func_80C1C83C(this, play); if (this->actor.draw != NULL) { - func_80C1C410(this, globalCtx); + func_80C1C410(this, play); func_80C1C5B4(this); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } Vec3f D_80C1D2C8 = { 450.0f, 700.0f, -760.0f }; Vec3s D_80C1D2D4 = { 0x238C, 0, -0x3FFC }; Vec3f D_80C1D2DC = { 1000.0f, 0.0f, 0.0f }; -void func_80C1CD80(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80C1CD80(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad[2]; DmAn* this = THIS; s8 sp2B = this->actor.objBankIndex; s8 sp2A = this->unk_2AD; if ((limbIndex == OBJECT_AN1_LIMB_05) && (this->unk_2D4 != 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_TranslateRotateZYX(&D_80C1D2C8, &D_80C1D2D4); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[sp2A].segment); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[sp2A].segment); gSPDisplayList(POLY_OPA_DISP++, gMoonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[sp2B].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[sp2B].segment); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == OBJECT_AN1_LIMB_09) { @@ -299,7 +299,7 @@ void func_80C1CD80(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void func_80C1CEFC(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void func_80C1CEFC(PlayState* play, s32 limbIndex, Actor* thisx) { DmAn* this = THIS; s16 stepRot; s16 overrideRot; @@ -351,18 +351,18 @@ TexturePtr D_80C1D2F4[] = { object_an1_Tex_00FDA0, object_an1_Tex_00F9A0, object_an1_Tex_0103A0, }; -void func_80C1D0B0(Actor* thisx, GlobalContext* globalCtx) { +void func_80C1D0B0(Actor* thisx, PlayState* play) { DmAn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1D2F4[this->unk_2B8])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1D2E8[0])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, func_80C1CD80, func_80C1CEFC, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.h b/src/overlays/actors/ovl_Dm_An/z_dm_an.h index 1b2b6f354e..676d215a49 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.h +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.h @@ -6,7 +6,7 @@ struct DmAn; -typedef void (*DmAnActionFunc)(struct DmAn*, GlobalContext*); +typedef void (*DmAnActionFunc)(struct DmAn*, PlayState*); typedef struct DmAn { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index 93845cc5c3..e6864bf3e1 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -10,13 +10,13 @@ #define THIS ((DmBal*)thisx) -void DmBal_Init(Actor* thisx, GlobalContext* globalCtx); -void DmBal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmBal_Update(Actor* thisx, GlobalContext* globalCtx); -void DmBal_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmBal_Init(Actor* thisx, PlayState* play); +void DmBal_Destroy(Actor* thisx, PlayState* play); +void DmBal_Update(Actor* thisx, PlayState* play); +void DmBal_Draw(Actor* thisx, PlayState* play); void func_80C1EAC4(DmBal* this); -void func_80C1EAD8(DmBal* this, GlobalContext* globalCtx); +void func_80C1EAD8(DmBal* this, PlayState* play); const ActorInit Dm_Bal_InitVars = { ACTOR_DM_BAL, @@ -47,42 +47,42 @@ static AnimationInfo D_80C1F170[] = { { &object_bal_Anim_001804, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -2.0f }, }; -void DmBal_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmBal_Init(Actor* thisx, PlayState* play) { DmBal* this = THIS; this->actor.targetMode = 1; this->actor.uncullZoneForward = 3000.0f; Actor_SetScale(&this->actor, 0.02f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bal_Skel_00A6D0, &object_bal_Anim_0005FC, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bal_Skel_00A6D0, &object_bal_Anim_0005FC, this->jointTable, this->morphTable, OBJECT_BAL_LIMB_MAX); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->timer = 60; this->eyeIndex = 0; this->unk_336 = 0; func_80C1EAC4(this); } -void DmBal_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmBal_Destroy(Actor* thisx, PlayState* play) { } void func_80C1EAC4(DmBal* this) { this->actionFunc = func_80C1EAD8; } -void func_80C1EAD8(DmBal* this, GlobalContext* globalCtx) { +void func_80C1EAD8(DmBal* this, PlayState* play) { } -void func_80C1EAE8(DmBal* this, GlobalContext* globalCtx) { +void func_80C1EAE8(DmBal* this, PlayState* play) { static u16 D_80C1F2C0 = 0x63; s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 0x238)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 0x238); + if (Cutscene_CheckActorAction(play, 0x238)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x238); - if (D_80C1F2C0 != globalCtx->csCtx.actorActions[actionIndex]->action) { - D_80C1F2C0 = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (D_80C1F2C0 != play->csCtx.actorActions[actionIndex]->action) { + D_80C1F2C0 = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_336 = 0; this->eyeIndex = 0; @@ -104,7 +104,7 @@ void func_80C1EAE8(DmBal* this, GlobalContext* globalCtx) { this->eyeIndex = 0; } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); this->actor.home.pos = this->actor.world.pos; } else { this->unk_336 = 0; @@ -113,7 +113,7 @@ void func_80C1EAE8(DmBal* this, GlobalContext* globalCtx) { } } -void func_80C1EC60(DmBal* this, GlobalContext* globalCtx) { +void func_80C1EC60(DmBal* this, PlayState* play) { f32 temp_fv1_2; this->unk_338 += 0x320; @@ -138,8 +138,8 @@ void func_80C1ED0C(DmBal* this) { } } -void func_80C1ED64(DmBal* this, GlobalContext* globalCtx, Vec3f* arg2, Vec3f* arg3, f32 arg4) { - Actor* paper = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PAPER, arg2->x, arg2->y, arg2->z, 0, 0, 0, 0); +void func_80C1ED64(DmBal* this, PlayState* play, Vec3f* arg2, Vec3f* arg3, f32 arg4) { + Actor* paper = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PAPER, arg2->x, arg2->y, arg2->z, 0, 0, 0, 0); if (paper != NULL) { paper->velocity = *arg3; @@ -149,7 +149,7 @@ void func_80C1ED64(DmBal* this, GlobalContext* globalCtx, Vec3f* arg2, Vec3f* ar Vec3f D_80C1F2C4 = { 0.0f, 9.0f, 0.0f }; -void DmBal_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmBal_Update(Actor* thisx, PlayState* play) { s32 pad; DmBal* this = THIS; Vec3f sp3C; @@ -163,17 +163,17 @@ void DmBal_Update(Actor* thisx, GlobalContext* globalCtx) { sp3C.z += 7.0f * Math_CosS(this->actor.shape.rot.y); sp30.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; sp30.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - func_80C1ED64(this, globalCtx, &sp3C, &sp30, -0.4f); - func_80C1ED64(this, globalCtx, &sp3C, &sp30, -0.5f); + func_80C1ED64(this, play, &sp3C, &sp30, -0.4f); + func_80C1ED64(this, play, &sp3C, &sp30, -0.5f); } - this->actionFunc(this, globalCtx); - func_80C1EAE8(this, globalCtx); - func_80C1EC60(this, globalCtx); + this->actionFunc(this, play); + func_80C1EAE8(this, play); + func_80C1EC60(this, play); func_80C1ED0C(this); SkelAnime_Update(&this->skelAnime); } -s32 DmBal_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 DmBal_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { DmBal* this = THIS; Vec3s rots; @@ -188,18 +188,18 @@ s32 DmBal_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void DmBal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmBal_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } TexturePtr sEyeTextures[] = { object_bal_Tex_006050, object_bal_Tex_0094D0 }; -void DmBal_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmBal_Draw(Actor* thisx, PlayState* play) { DmBal* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(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, DmBal_OverrideLimbDraw, DmBal_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.h b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.h index 1a09abb1b7..bda05149f2 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.h +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.h @@ -6,7 +6,7 @@ struct DmBal; -typedef void (*DmBalActionFunc)(struct DmBal*, GlobalContext*); +typedef void (*DmBalActionFunc)(struct DmBal*, PlayState*); typedef struct DmBal { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index ce9f844d02..2a3144be3e 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -12,13 +12,13 @@ #define THIS ((DmChar00*)thisx) -void DmChar00_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar00_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar00_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar00_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar00_Init(Actor* thisx, PlayState* play); +void DmChar00_Destroy(Actor* thisx, PlayState* play); +void DmChar00_Update(Actor* thisx, PlayState* play); +void DmChar00_Draw(Actor* thisx, PlayState* play); -void func_80AA67F8(DmChar00* this, GlobalContext* globalCtx); -void func_80AA695C(DmChar00* this, GlobalContext* globalCtx); +void func_80AA67F8(DmChar00* this, PlayState* play); +void func_80AA695C(DmChar00* this, PlayState* play); const ActorInit Dm_Char00_InitVars = { ACTOR_DM_CHAR00, @@ -148,9 +148,9 @@ void func_80AA5580(SkelAnime* skelAnime, AnimationInfo* animation, u16 idx) { animation->mode, animation->morphFrames); } -void func_80AA561C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA561C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames + 20) { + switch (play->csCtx.frames + 20) { case 503: case 926: case 979: @@ -169,7 +169,7 @@ void func_80AA561C(DmChar00* this, GlobalContext* globalCtx) { break; } } else { - switch (globalCtx->csCtx.frames + 20) { + switch (play->csCtx.frames + 20) { case 503: case 926: case 979: @@ -187,15 +187,15 @@ void func_80AA561C(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5720(DmChar00* this, GlobalContext* globalCtx) { - if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (globalCtx->csCtx.frames == 505)) { +void func_80AA5720(DmChar00* this, PlayState* play) { + if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 505)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPOT_LIGHT_OPEN); } } -void func_80AA575C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA575C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 474: case 489: case 495: @@ -227,24 +227,24 @@ void func_80AA575C(DmChar00* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_BRAKE); break; } - } else if (globalCtx->csCtx.frames == 660) { + } else if (play->csCtx.frames == 660) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONDO_SURPRISE); } } -void func_80AA5890(DmChar00* this, GlobalContext* globalCtx) { - if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (globalCtx->csCtx.frames == 20)) { +void func_80AA5890(DmChar00* this, PlayState* play) { + if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 20)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } -void func_80AA58CC(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA58CC(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - if (globalCtx->csCtx.frames == 568) { + if (play->csCtx.frames == 568) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 375: case 479: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -257,16 +257,16 @@ void func_80AA58CC(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5950(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5950(DmChar00* this, PlayState* play) { } -void func_80AA5960(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5960(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - if (globalCtx->csCtx.frames == 280) { + if (play->csCtx.frames == 280) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 87: case 190: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -279,9 +279,9 @@ void func_80AA5960(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA59E4(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA59E4(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 125: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -291,14 +291,14 @@ void func_80AA59E4(DmChar00* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } - } else if (globalCtx->csCtx.frames == 125) { + } else if (play->csCtx.frames == 125) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } -void func_80AA5A6C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5A6C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 44: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -308,14 +308,14 @@ void func_80AA5A6C(DmChar00* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } - } else if (globalCtx->csCtx.frames == 44) { + } else if (play->csCtx.frames == 44) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } -void func_80AA5AF4(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5AF4(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 352: case 401: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); @@ -330,7 +330,7 @@ void func_80AA5AF4(DmChar00* this, GlobalContext* globalCtx) { break; } } else { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 362: case 401: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -341,15 +341,15 @@ void func_80AA5AF4(DmChar00* this, GlobalContext* globalCtx) { break; } - if ((globalCtx->csCtx.frames >= 500) && (globalCtx->csCtx.frames < 602)) { + if ((play->csCtx.frames >= 500) && (play->csCtx.frames < 602)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SHIVER - SFX_FLAG); } } } -void func_80AA5BF8(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5BF8(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 762: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_SHOT_DASH); break; @@ -358,7 +358,7 @@ void func_80AA5BF8(DmChar00* this, GlobalContext* globalCtx) { break; } } else { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 762: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_SHOT_DASH); break; @@ -374,15 +374,15 @@ void func_80AA5BF8(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5CD4(DmChar00* this, GlobalContext* globalCtx) { - if ((DMCHAR00_GET(&this->actor) != DMCHAR00_0) && (globalCtx->csCtx.frames == 467)) { +void func_80AA5CD4(DmChar00* this, PlayState* play) { + if ((DMCHAR00_GET(&this->actor) != DMCHAR00_0) && (play->csCtx.frames == 467)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } -void func_80AA5D10(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5D10(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 8: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; @@ -394,9 +394,9 @@ void func_80AA5D10(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5D6C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5D6C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 2: case 166: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); @@ -409,9 +409,9 @@ void func_80AA5D6C(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5DC8(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5DC8(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 233: case 415: case 593: @@ -425,9 +425,9 @@ void func_80AA5DC8(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5E2C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA5E2C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_1) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 32: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -447,87 +447,87 @@ void func_80AA5E2C(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA5EBC(DmChar00* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - switch (globalCtx->sceneNum) { +void func_80AA5EBC(DmChar00* this, PlayState* play) { + if (play->csCtx.state != 0) { + switch (play->sceneNum) { case SCENE_LOST_WOODS: if (gSaveContext.sceneSetupIndex == 1) { - func_80AA561C(this, globalCtx); + func_80AA561C(this, play); } break; case SCENE_OPENINGDAN: if (gSaveContext.sceneSetupIndex == 0) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AA5720(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - func_80AA575C(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 2) { - func_80AA5890(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AA5720(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + func_80AA575C(this, play); + } else if (play->csCtx.currentCsIndex == 2) { + func_80AA5890(this, play); } } break; case SCENE_OKUJOU: if (gSaveContext.sceneSetupIndex == 0) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AA58CC(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - func_80AA5950(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 2) { - func_80AA5960(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AA58CC(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + func_80AA5950(this, play); + } else if (play->csCtx.currentCsIndex == 2) { + func_80AA5960(this, play); } } else if (gSaveContext.sceneSetupIndex == 2) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AA59E4(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - func_80AA5A6C(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AA59E4(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + func_80AA5A6C(this, play); } } break; case SCENE_00KEIKOKU: if (gSaveContext.sceneSetupIndex == 3) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AA5AF4(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 2) { - func_80AA5E2C(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AA5AF4(this, play); + } else if (play->csCtx.currentCsIndex == 2) { + func_80AA5E2C(this, play); } } else if (gSaveContext.sceneSetupIndex == 7) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AA5BF8(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - func_80AA5CD4(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AA5BF8(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + func_80AA5CD4(this, play); } } break; case SCENE_MITURIN: - if ((gSaveContext.sceneSetupIndex == 0) && (globalCtx->csCtx.currentCsIndex == 1)) { - func_80AA5DC8(this, globalCtx); + if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) { + func_80AA5DC8(this, play); } break; case SCENE_INSIDETOWER: - if ((gSaveContext.sceneSetupIndex == 0) && (globalCtx->csCtx.currentCsIndex == 0)) { - func_80AA5D10(this, globalCtx); + if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) { + func_80AA5D10(this, play); } break; case SCENE_PIRATE: - if ((gSaveContext.sceneSetupIndex == 0) && (globalCtx->csCtx.currentCsIndex == 0)) { - func_80AA5D6C(this, globalCtx); + if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) { + func_80AA5D6C(this, play); } break; } } } -void DmChar00_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmChar00_Init(Actor* thisx, PlayState* play) { s32 pad; DmChar00* this = THIS; - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(globalCtx)) { + if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(thisx); } @@ -539,30 +539,30 @@ void DmChar00_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_262 = DMCHAR00_GET_F800(thisx); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, - this->jointTable, this->morphTable, 7); + SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, + this->morphTable, 7); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); func_80AA5580(&this->skelAnime, sAnimations, 0); Actor_SetScale(thisx, 0.01f); this->actionFunc = func_80AA67F8; } -void DmChar00_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmChar00_Destroy(Actor* thisx, PlayState* play) { } -void func_80AA62FC(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA62FC(DmChar00* this, PlayState* play) { u16 sp26 = DMCHAR00_GET(&this->actor) + 113; s32 temp_v0; s32 pad; - if (Cutscene_CheckActorAction(globalCtx, sp26)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, sp26); + if (Cutscene_CheckActorAction(play, sp26)) { + temp_v0 = Cutscene_GetActorActionIndex(play, sp26); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[temp_v0]->startFrame) { - if (this->unk_260 != globalCtx->csCtx.actorActions[temp_v0]->action) { - this->unk_260 = globalCtx->csCtx.actorActions[temp_v0]->action; + if (play->csCtx.frames == play->csCtx.actorActions[temp_v0]->startFrame) { + if (this->unk_260 != play->csCtx.actorActions[temp_v0]->action) { + this->unk_260 = play->csCtx.actorActions[temp_v0]->action; - switch (globalCtx->csCtx.actorActions[temp_v0]->action) { + switch (play->csCtx.actorActions[temp_v0]->action) { case 0x1: this->unk_261 = 0; break; @@ -786,7 +786,7 @@ void func_80AA62FC(DmChar00* this, GlobalContext* globalCtx) { func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } else { this->unk_260 = 99; } @@ -850,11 +850,10 @@ void func_80AA62FC(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA67F8(DmChar00* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AA67F8(DmChar00* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->csCtx.state == 0) && (gSaveContext.sceneSetupIndex == 0) && - (globalCtx->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state == 0) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) { if (this->unk_261 != 42) { this->unk_261 = 42; func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); @@ -873,7 +872,7 @@ void func_80AA67F8(DmChar00* this, GlobalContext* globalCtx) { } } -void func_80AA695C(DmChar00* this, GlobalContext* globalCtx) { +void func_80AA695C(DmChar00* this, PlayState* play) { if (this->unk_261 == 44) { Math_SmoothStepToF(&this->actor.world.pos.x, 0.0f, 0.5f, 0.5f, 0.001f); Math_SmoothStepToF(&this->actor.world.pos.y, 30.0f, 0.5f, 0.5f, 0.001f); @@ -881,20 +880,20 @@ void func_80AA695C(DmChar00* this, GlobalContext* globalCtx) { } } -void DmChar00_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmChar00_Update(Actor* thisx, PlayState* play) { DmChar00* this = THIS; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_262++; - func_80AA5EBC(this, globalCtx); - func_80AA62FC(this, globalCtx); + func_80AA5EBC(this, play); + func_80AA62FC(this, play); } -s32 DmChar00_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 DmChar00_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { DmChar00* this = THIS; f32 sp28; Vec3f sp1C; @@ -908,23 +907,22 @@ s32 DmChar00_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void DmChar00_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DmChar00_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DmChar00* this = THIS; s32 phi_a0; s32 pad; - Gfx* gfx = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); + Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); - if ((globalCtx->csCtx.state == 0) && - ((globalCtx->sceneNum != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || - (globalCtx->roomCtx.currRoom.num != 0) || (globalCtx->csCtx.currentCsIndex != 1) || - (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { + if ((play->csCtx.state == 0) && ((play->sceneNum != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || + (play->roomCtx.currRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || + (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C94C(globalCtx->state.gfxCtx); + func_8012C94C(play->state.gfxCtx); do { phi_a0 = (this->unk_262 * 50) & 511; @@ -945,8 +943,8 @@ void DmChar00_Draw(Actor* thisx, GlobalContext* globalCtx2) { (u8)(s8)this->unk_250.unk_08, (u8)(s8)((f32)phi_a0 * 1)); gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar00_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h index 52adfe794b..d28232eb36 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h @@ -5,7 +5,7 @@ struct DmChar00; -typedef void (*DmChar00ActionFunc)(struct DmChar00*, GlobalContext*); +typedef void (*DmChar00ActionFunc)(struct DmChar00*, PlayState*); #define DMCHAR00_GET(thisx) ((thisx)->params) #define DMCHAR00_GET_F800(thisx) ((thisx)->params << 0xB) diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 375edda4a8..3f3e833829 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -11,21 +11,21 @@ #define THIS ((DmChar01*)thisx) -void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar01_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar01_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar01_Init(Actor* thisx, PlayState* play); +void DmChar01_Destroy(Actor* thisx, PlayState* play); +void DmChar01_Update(Actor* thisx, PlayState* play); +void DmChar01_Draw(Actor* thisx, PlayState* play); -void func_80AA8698(DmChar01* this, GlobalContext* globalCtx); -void func_80AA884C(DmChar01* this, GlobalContext* globalCtx); -void func_80AA88A8(DmChar01* this, GlobalContext* globalCtx); -void func_80AA892C(DmChar01* this, GlobalContext* globalCtx); -void func_80AA8C28(DmChar01* this, GlobalContext* globalCtx); -void func_80AA8F1C(DmChar01* this, GlobalContext* globalCtx); -void func_80AA8F2C(DmChar01* this, GlobalContext* globalCtx); -void func_80AA9020(DmChar01* this, GlobalContext* globalCtx); -void func_80AA90AC(DmChar01* this, GlobalContext* globalCtx); -void func_80AA90F4(DmChar01* this, GlobalContext* globalCtx); +void func_80AA8698(DmChar01* this, PlayState* play); +void func_80AA884C(DmChar01* this, PlayState* play); +void func_80AA88A8(DmChar01* this, PlayState* play); +void func_80AA892C(DmChar01* this, PlayState* play); +void func_80AA8C28(DmChar01* this, PlayState* play); +void func_80AA8F1C(DmChar01* this, PlayState* play); +void func_80AA8F2C(DmChar01* this, PlayState* play); +void func_80AA9020(DmChar01* this, PlayState* play); +void func_80AA90AC(DmChar01* this, PlayState* play); +void func_80AA90F4(DmChar01* this, PlayState* play); s16 D_80AAAE20; s16 D_80AAAE22; @@ -52,7 +52,7 @@ static InitChainEntry sInitChain[] = { s16 D_80AAAAB4 = false; -void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmChar01_Init(Actor* thisx, PlayState* play) { DmChar01* this = THIS; s32 i; @@ -73,8 +73,8 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.sceneSetupIndex == 0) { - globalCtx->envCtx.unk_1F = 5; - globalCtx->envCtx.unk_20 = 5; + play->envCtx.unk_1F = 5; + play->envCtx.unk_20 = 5; } this->unk_348 = 255.0f; @@ -83,7 +83,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { } DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mtoride_Colheader_009E4C); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_009E4C); this->unk_34D = true; if (gSaveContext.sceneSetupIndex == 1) { @@ -113,7 +113,7 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.shape.rot.y += 0x8000; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mtoride_Colheader_010C3C); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_010C3C); this->unk_34D = true; this->unk_348 = 200.0f; this->actionFunc = func_80AA8F2C; @@ -127,9 +127,9 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0, 0x80); + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0, 0x80); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mtoride_Colheader_00FE5C); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_00FE5C); this->unk_34D = true; if (!(gSaveContext.save.weekEventReg[20] & 2)) { @@ -146,17 +146,17 @@ void DmChar01_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DmChar01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmChar01_Destroy(Actor* thisx, PlayState* play) { DmChar01* this = THIS; if (this->unk_34D) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_80AA8698(DmChar01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); +void func_80AA8698(DmChar01* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); if (gSaveContext.save.weekEventReg[20] & 1) { return; @@ -173,8 +173,8 @@ void func_80AA8698(DmChar01* this, GlobalContext* globalCtx) { D_80AAAAB4 = false; } - if ((player->transformation == PLAYER_FORM_DEKU) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 0)) { + if ((player->transformation == PLAYER_FORM_DEKU) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 0)) { if ((player2->actor.world.pos.x > -40.0f) && (player2->actor.world.pos.x < 40.0f) && (player2->actor.world.pos.z > 1000.0f) && (player2->actor.world.pos.z < 1078.0f)) { @@ -184,7 +184,7 @@ void func_80AA8698(DmChar01* this, GlobalContext* globalCtx) { } } -void func_80AA884C(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA884C(DmChar01* this, PlayState* play) { s16 sp1E = this->dyna.actor.cutscene; if (ActorCutscene_GetCanPlayNext(sp1E)) { @@ -195,10 +195,9 @@ void func_80AA884C(DmChar01* this, GlobalContext* globalCtx) { } } -void func_80AA88A8(DmChar01* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 135)) { - if (globalCtx->csCtx.frames == - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 135)]->startFrame) { +void func_80AA88A8(DmChar01* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 135)) { + if (play->csCtx.frames == play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]->startFrame) { D_80AAAE24 = 1; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FORT_RISING); } @@ -207,7 +206,7 @@ void func_80AA88A8(DmChar01* this, GlobalContext* globalCtx) { } } -void func_80AA892C(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA892C(DmChar01* this, PlayState* play) { f32 temp_f18; s32 temp_v0_4; s32 i; @@ -268,7 +267,7 @@ void func_80AA892C(DmChar01* this, GlobalContext* globalCtx) { } } -void func_80AA8C28(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA8C28(DmChar01* this, PlayState* play) { f32 temp_f18; s32 temp_v0_4; s32 i; @@ -320,72 +319,72 @@ void func_80AA8C28(DmChar01* this, GlobalContext* globalCtx) { } } -void func_80AA8F0C(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA8F0C(DmChar01* this, PlayState* play) { } -void func_80AA8F1C(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA8F1C(DmChar01* this, PlayState* play) { } -void func_80AA8F2C(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA8F2C(DmChar01* this, PlayState* play) { if (D_80AAAE26 != 0) { Math_SmoothStepToF(&this->dyna.actor.world.pos.y, 0.0f, 0.05f, 6.0f, 0.001f); Math_SmoothStepToF(&this->unk_348, 0.0f, 0.01f, 0.5f, 0.4f); if ((s32)this->dyna.actor.world.pos.y >= 0) { D_80AAAE26 = 2; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0, 0x80); + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0, 0x80); this->actionFunc = func_80AA90F4; } } - func_80AA8F0C(this, globalCtx); + func_80AA8F0C(this, play); } -void func_80AA9020(DmChar01* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 135)) { - CsCmdActorAction* temp_v1 = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 135)]; +void func_80AA9020(DmChar01* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 135)) { + CsCmdActorAction* temp_v1 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]; - if ((temp_v1->startFrame == globalCtx->csCtx.frames) && (temp_v1->action == 2)) { + if ((temp_v1->startFrame == play->csCtx.frames) && (temp_v1->action == 2)) { gSaveContext.save.weekEventReg[20] |= 2; this->actionFunc = func_80AA90AC; } } } -void func_80AA90AC(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA90AC(DmChar01* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.world.pos.y, 0.0f, 0.05f, 2.0f, 0.001f); } -void func_80AA90F4(DmChar01* this, GlobalContext* globalCtx) { +void func_80AA90F4(DmChar01* this, PlayState* play) { Math_SmoothStepToF(&this->unk_348, 0.0f, 0.02f, 0.8f, 0.4f); } -void DmChar01_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DmChar01_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DmChar01* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_34D) { if (DMCHAR01_GET(&this->dyna.actor) == DMCHAR01_0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->actor.world.pos.y > 5.0f) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } } if (DMCHAR01_GET(&this->dyna.actor) == DMCHAR01_2) { if (this->dyna.actor.xzDistToPlayer > 600.0f) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } } } } -void DmChar01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmChar01_Draw(Actor* thisx, PlayState* play) { static f32 D_80AAAAB8 = 0.0f; static f32 D_80AAAABC = 0.0f; static s16 D_80AAAAC0 = 0; @@ -402,52 +401,52 @@ void DmChar01_Draw(Actor* thisx, GlobalContext* globalCtx) { case DMCHAR01_0: switch (this->unk_34C) { case 0: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00AA50)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_00A8F8); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00AA50)); + Gfx_DrawDListOpa(play, object_mtoride_DL_00A8F8); break; case 1: if (gSaveContext.sceneSetupIndex == 1) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_010FD8); - Gfx_DrawDListXlu(globalCtx, object_mtoride_DL_010EF0); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8)); + Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8); + Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0); Matrix_Translate(0.0f, 10.0f, 0.0f, MTXMODE_APPLY); } - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_009D70)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_009D70)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((u8)this->unk_348 == 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x96, 255, 255, 255, 255); gSPSegment(POLY_OPA_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_mtoride_DL_009928); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x96, 255, 255, 255, (u8)this->unk_348); gSPSegment(POLY_XLU_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_009928); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); break; case 2: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_010FD8); - Gfx_DrawDListXlu(globalCtx, object_mtoride_DL_010EF0); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8)); + Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8); + Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0); break; } break; @@ -455,36 +454,36 @@ void DmChar01_Draw(Actor* thisx, GlobalContext* globalCtx) { case DMCHAR01_1: switch (this->unk_34C) { case 0: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00A5C0)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_00A398); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00A5C0)); + Gfx_DrawDListOpa(play, object_mtoride_DL_00A398); break; case 1: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00B1A0)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_00AF98); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00B1A0)); + Gfx_DrawDListOpa(play, object_mtoride_DL_00AF98); break; } break; case DMCHAR01_2: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00FE90)); - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_00DF18); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00FE90)); + Gfx_DrawDListOpa(play, object_mtoride_DL_00DF18); if ((this->unk_34C != 0) && ((u8)this->unk_348 != 0)) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00F768)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00F768)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (u8)this->unk_348); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_00F3C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (D_80AAAE24 != 0) { @@ -517,29 +516,29 @@ void DmChar01_Draw(Actor* thisx, GlobalContext* globalCtx) { s16 temp; spBC = Rand_ZeroOne() * D_80AAAAC8; - if ((globalCtx->state.frames % 2) != 0) { + if ((play->state.frames % 2) != 0) { sp44.x = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2); sp44.y = D_80AAAAB8; sp44.z = (Rand_ZeroOne() * D_80AAAAC4) + phi_f2; temp = (s16)spBC + D_80AAAACC; - EffectSsGSplash_Spawn(globalCtx, &sp44, NULL, NULL, 0, temp); + EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp); } else { sp44.x = -phi_f2 - (Rand_ZeroOne() * D_80AAAAC4); sp44.y = D_80AAAAB8; sp44.z = (Rand_ZeroOne() - 0.5f) * (2.0f * phi_f2); temp = (s16)spBC + D_80AAAACC; - EffectSsGSplash_Spawn(globalCtx, &sp44, NULL, NULL, 0, temp); + EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, temp); } } } } - Gfx_DrawDListXlu(globalCtx, object_mtoride_DL_00DE50); + Gfx_DrawDListXlu(play, object_mtoride_DL_00DE50); break; case DMCHAR01_3: if (thisx->world.pos.y > -120.0f) { - Gfx_DrawDListOpa(globalCtx, object_mtoride_DL_00FAE8); + Gfx_DrawDListOpa(play, object_mtoride_DL_00FAE8); } break; } diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.h b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.h index b2c235f561..e972f89ab0 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.h +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.h @@ -5,7 +5,7 @@ struct DmChar01; -typedef void (*DmChar01ActionFunc)(struct DmChar01*, GlobalContext*); +typedef void (*DmChar01ActionFunc)(struct DmChar01*, PlayState*); #define DMCHAR01_GET(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 72258b70bf..590045fa02 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -10,12 +10,12 @@ #define THIS ((DmChar02*)thisx) -void DmChar02_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar02_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar02_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar02_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar02_Init(Actor* thisx, PlayState* play); +void DmChar02_Destroy(Actor* thisx, PlayState* play); +void DmChar02_Update(Actor* thisx, PlayState* play); +void DmChar02_Draw(Actor* thisx, PlayState* play); -void func_80AAB04C(DmChar02* this, GlobalContext* globalCtx); +void func_80AAB04C(DmChar02* this, PlayState* play); #if 0 const ActorInit Dm_Char02_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h index 987e353bc6..276a7b0268 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h @@ -5,7 +5,7 @@ struct DmChar02; -typedef void (*DmChar02ActionFunc)(struct DmChar02*, GlobalContext*); +typedef void (*DmChar02ActionFunc)(struct DmChar02*, PlayState*); typedef struct DmChar02 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c index 1508f95a21..4245f73712 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -10,14 +10,14 @@ #define THIS ((DmChar03*)thisx) -void DmChar03_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar03_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar03_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar03_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar03_Init(Actor* thisx, PlayState* play); +void DmChar03_Destroy(Actor* thisx, PlayState* play); +void DmChar03_Update(Actor* thisx, PlayState* play); +void DmChar03_Draw(Actor* thisx, PlayState* play); -void func_80AAB5F8(DmChar03* this, GlobalContext* globalCtx); -void func_80AAB644(DmChar03* this, GlobalContext* globalCtx); -void func_80AAB700(DmChar03* this, GlobalContext* globalCtx); +void func_80AAB5F8(DmChar03* this, PlayState* play); +void func_80AAB644(DmChar03* this, PlayState* play); +void func_80AAB700(DmChar03* this, PlayState* play); #if 0 const ActorInit Dm_Char03_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h index 95d7ee3a5c..f06e8085e6 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h @@ -5,7 +5,7 @@ struct DmChar03; -typedef void (*DmChar03ActionFunc)(struct DmChar03*, GlobalContext*); +typedef void (*DmChar03ActionFunc)(struct DmChar03*, PlayState*); typedef struct DmChar03 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c index eff96b7e50..9bec4b6cc6 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c @@ -10,10 +10,10 @@ #define THIS ((DmChar04*)thisx) -void DmChar04_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar04_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar04_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar04_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar04_Init(Actor* thisx, PlayState* play); +void DmChar04_Destroy(Actor* thisx, PlayState* play); +void DmChar04_Update(Actor* thisx, PlayState* play); +void DmChar04_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Dm_Char04_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h index cb2fa75de8..7bb8efc041 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h @@ -5,7 +5,7 @@ struct DmChar04; -typedef void (*DmChar04ActionFunc)(struct DmChar04*, GlobalContext*); +typedef void (*DmChar04ActionFunc)(struct DmChar04*, PlayState*); typedef struct DmChar04 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 94935db3c2..face0bef5c 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -11,29 +11,29 @@ #define THIS ((DmChar05*)thisx) -void DmChar05_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar05_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar05_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar05_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar05_Init(Actor* thisx, PlayState* play); +void DmChar05_Destroy(Actor* thisx, PlayState* play); +void DmChar05_Update(Actor* thisx, PlayState* play); +void DmChar05_Draw(Actor* thisx, PlayState* play); -void func_80AAC990(DmChar05* this, GlobalContext* globalCtx); -void func_80AAC9DC(DmChar05* this, GlobalContext* globalCtx); -void func_80AACA98(DmChar05* this, GlobalContext* globalCtx); -void func_80AACAE4(DmChar05* this, GlobalContext* globalCtx); -void func_80AACBE4(DmChar05* this, GlobalContext* globalCtx); -void func_80AACC48(DmChar05* this, GlobalContext* globalCtx); -void func_80AACC6C(DmChar05* this, GlobalContext* globalCtx); -void func_80AACCD4(DmChar05* this, GlobalContext* globalCtx); -void func_80AACD0C(DmChar05* this, GlobalContext* globalCtx); -void func_80AACD1C(DmChar05* this, GlobalContext* globalCtx); -void func_80AACD68(DmChar05* this, GlobalContext* globalCtx); -void func_80AACE10(DmChar05* this, GlobalContext* globalCtx); -void func_80AACE5C(DmChar05* this, GlobalContext* globalCtx); -void func_80AADD9C(GlobalContext* globalCtx, DmChar05* this); -void func_80AADE78(GlobalContext* globalCtx, DmChar05* this); -void func_80AADF54(GlobalContext* globalCtx, DmChar05* this); -void func_80AAE030(GlobalContext* globalCtx, DmChar05* this); -void func_80AAE114(GlobalContext* globalCtx, DmChar05* this); +void func_80AAC990(DmChar05* this, PlayState* play); +void func_80AAC9DC(DmChar05* this, PlayState* play); +void func_80AACA98(DmChar05* this, PlayState* play); +void func_80AACAE4(DmChar05* this, PlayState* play); +void func_80AACBE4(DmChar05* this, PlayState* play); +void func_80AACC48(DmChar05* this, PlayState* play); +void func_80AACC6C(DmChar05* this, PlayState* play); +void func_80AACCD4(DmChar05* this, PlayState* play); +void func_80AACD0C(DmChar05* this, PlayState* play); +void func_80AACD1C(DmChar05* this, PlayState* play); +void func_80AACD68(DmChar05* this, PlayState* play); +void func_80AACE10(DmChar05* this, PlayState* play); +void func_80AACE5C(DmChar05* this, PlayState* play); +void func_80AADD9C(PlayState* play, DmChar05* this); +void func_80AADE78(PlayState* play, DmChar05* this); +void func_80AADF54(PlayState* play, DmChar05* this); +void func_80AAE030(PlayState* play, DmChar05* this); +void func_80AAE114(PlayState* play, DmChar05* this); const ActorInit Dm_Char05_InitVars = { ACTOR_DM_CHAR05, @@ -70,11 +70,11 @@ void func_80AAC5A0(SkelAnime* skelAnime, AnimationInfo* animation, u16 arg2) { animation->mode, animation->morphFrames); } -void func_80AAC63C(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAC63C(Actor* thisx, PlayState* play) { DmChar05* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_010B0, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_010B0, NULL, NULL, NULL, 0); if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { func_80AAC5A0(&this->skelAnime, &sAnimations[0], 0); } else { @@ -83,40 +83,40 @@ void func_80AAC63C(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80AACC48; } -void func_80AAC6E4(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAC6E4(Actor* thisx, PlayState* play) { DmChar05* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_042B0, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_042B0, NULL, NULL, NULL, 0); func_80AAC5A0(&this->skelAnime, &sAnimations[1], 0); this->actionFunc = func_80AACC48; } -void func_80AAC770(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAC770(Actor* thisx, PlayState* play) { DmChar05* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dmask_Skel_001D0, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dmask_Skel_001D0, NULL, NULL, NULL, 0); func_80AAC5A0(&this->skelAnime, &sAnimations[3], 0); this->actionFunc = func_80AACC48; } -void func_80AAC7FC(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAC7FC(Actor* thisx, PlayState* play) { DmChar05* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dmask_Skel_013D0, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_013D0, NULL, NULL, NULL, 0); func_80AAC5A0(&this->skelAnime, &sAnimations[4], 0); this->actionFunc = func_80AACC48; } -void func_80AAC888(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAC888(Actor* thisx, PlayState* play) { DmChar05* this = THIS; this->actionFunc = func_80AACA98; } -void DmChar05_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmChar05_Init(Actor* thisx, PlayState* play) { DmChar05* this = THIS; this->unk_18C = 0; @@ -131,23 +131,23 @@ void DmChar05_Init(Actor* thisx, GlobalContext* globalCtx) { switch (DMCHAR05_GET(&this->actor)) { case DMCHAR05_0: - func_80AAC63C(thisx, globalCtx); + func_80AAC63C(thisx, play); break; case DMCHAR05_1: - func_80AAC6E4(thisx, globalCtx); + func_80AAC6E4(thisx, play); break; case DMCHAR05_2: - func_80AAC770(thisx, globalCtx); + func_80AAC770(thisx, play); break; case DMCHAR05_3: - func_80AAC7FC(thisx, globalCtx); + func_80AAC7FC(thisx, play); break; case DMCHAR05_4: - func_80AAC888(thisx, globalCtx); + func_80AAC888(thisx, play); break; case DMCHAR05_5: @@ -164,11 +164,11 @@ void DmChar05_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); } -void DmChar05_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmChar05_Destroy(Actor* thisx, PlayState* play) { } -void func_80AAC990(DmChar05* this, GlobalContext* globalCtx) { - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_GOLONMASK); +void func_80AAC990(DmChar05* this, PlayState* play) { + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GI_GOLONMASK); if (objectIdx >= 0) { this->unk_18F = objectIdx; @@ -176,21 +176,21 @@ void func_80AAC990(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AAC9DC(DmChar05* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 109) != 0) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 109); +void func_80AAC9DC(DmChar05* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 109) != 0) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 109); - if (globalCtx->csCtx.actorActions[actionIndex]->action == 4) { + if (play->csCtx.actorActions[actionIndex]->action == 4) { this->unk_18E = 1; - this->unk_190.x = globalCtx->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = globalCtx->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = globalCtx->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; + this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; + this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; } } } -void func_80AACA98(DmChar05* this, GlobalContext* globalCtx) { - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MASK13); +void func_80AACA98(DmChar05* this, PlayState* play) { + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GI_MASK13); if (objectIdx >= 0) { this->unk_18F = objectIdx; @@ -198,31 +198,31 @@ void func_80AACA98(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACAE4(DmChar05* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 564)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 564); +void func_80AACAE4(DmChar05* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 564)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 564); - if (globalCtx->csCtx.actorActions[actionIndex]->action == 2) { - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - Item_Give(globalCtx, ITEM_MASK_COUPLE); + if (play->csCtx.actorActions[actionIndex]->action == 2) { + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + Item_Give(play, ITEM_MASK_COUPLE); } this->unk_18E = 1; - this->unk_190.x = globalCtx->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = globalCtx->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = globalCtx->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; + this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; + this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; } else { this->unk_18E = 0; } } } -void func_80AACBE4(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACBE4(DmChar05* this, PlayState* play) { static s16 D_80AAE2F0[] = { OBJECT_GI_MASK17, OBJECT_GI_MASK14, OBJECT_GI_MASK10, OBJECT_GI_MASK21, OBJECT_GI_MASK11, OBJECT_GI_MASK20, OBJECT_GI_RABIT_MASK, OBJECT_GI_MASK12, }; s32 params = DMCHAR05_GET(&this->actor) - DMCHAR05_5; - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, D_80AAE2F0[params]); + s32 objectIdx = Object_GetIndex(&play->objectCtx, D_80AAE2F0[params]); if (objectIdx >= 0) { this->unk_18F = objectIdx; @@ -230,13 +230,13 @@ void func_80AACBE4(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACC48(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACC48(DmChar05* this, PlayState* play) { if (this->unk_1B4 != 0) { this->actionFunc = func_80AACC6C; } } -void func_80AACC6C(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACC6C(DmChar05* this, PlayState* play) { if (this->unk_19C < 247) { this->unk_19C += 8; } @@ -255,7 +255,7 @@ void func_80AACC6C(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACCD4(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACCD4(DmChar05* this, PlayState* play) { if (this->unk_1AC < 975) { this->unk_1AC += 25; } else { @@ -264,11 +264,11 @@ void func_80AACCD4(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACD0C(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACD0C(DmChar05* this, PlayState* play) { } -void func_80AACD1C(DmChar05* this, GlobalContext* globalCtx) { - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_ZORAMASK); +void func_80AACD1C(DmChar05* this, PlayState* play) { + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GI_ZORAMASK); if (objectIdx >= 0) { this->unk_18F = objectIdx; @@ -276,19 +276,19 @@ void func_80AACD1C(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACD68(DmChar05* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 473)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 473); +void func_80AACD68(DmChar05* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 473)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 473); this->unk_18E = 1; - this->unk_190.x = globalCtx->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = globalCtx->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = globalCtx->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; + this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; + this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; } } -void func_80AACE10(DmChar05* this, GlobalContext* globalCtx) { - s32 objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_MASK15); +void func_80AACE10(DmChar05* this, PlayState* play) { + s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GI_MASK15); if (objectIdx >= 0) { this->unk_18F = objectIdx; @@ -296,28 +296,28 @@ void func_80AACE10(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AACE5C(DmChar05* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 518)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 518); +void func_80AACE5C(DmChar05* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 518)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 518); this->unk_18E = 1; - this->unk_190.x = globalCtx->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = globalCtx->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = globalCtx->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; + this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; + this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; } } -void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { +void func_80AACF04(DmChar05* this, PlayState* play) { u8 sp2F = true; s32 actionIndex; switch (DMCHAR05_GET(&this->actor)) { case DMCHAR05_0: - if (Cutscene_CheckActorAction(globalCtx, 109)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 109); + if (Cutscene_CheckActorAction(play, 109)) { + actionIndex = Cutscene_GetActorActionIndex(play, 109); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: sp2F = false; break; @@ -331,7 +331,7 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { break; case 4: - Item_Give(globalCtx, ITEM_MASK_GORON); + Item_Give(play, ITEM_MASK_GORON); sp2F = false; this->actionFunc = func_80AAC990; break; @@ -351,16 +351,16 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } break; case DMCHAR05_1: - if (Cutscene_CheckActorAction(globalCtx, 473)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 473); + if (Cutscene_CheckActorAction(play, 473)) { + actionIndex = Cutscene_GetActorActionIndex(play, 473); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: sp2F = false; break; @@ -375,7 +375,7 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { break; case 4: - Item_Give(globalCtx, ITEM_MASK_ZORA); + Item_Give(play, ITEM_MASK_ZORA); sp2F = false; this->actionFunc = func_80AACD1C; break; @@ -395,16 +395,16 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } break; case DMCHAR05_2: - if (Cutscene_CheckActorAction(globalCtx, 518)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 518); + if (Cutscene_CheckActorAction(play, 518)) { + actionIndex = Cutscene_GetActorActionIndex(play, 518); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: sp2F = false; break; @@ -418,7 +418,7 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { break; case 4: - Item_Give(globalCtx, ITEM_MASK_GIBDO); + Item_Give(play, ITEM_MASK_GIBDO); sp2F = false; this->actionFunc = func_80AACE10; break; @@ -438,16 +438,16 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } break; case DMCHAR05_3: - if (Cutscene_CheckActorAction(globalCtx, 559)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 559); + if (Cutscene_CheckActorAction(play, 559)) { + actionIndex = Cutscene_GetActorActionIndex(play, 559); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + switch (play->csCtx.actorActions[actionIndex]->action) { default: sp2F = false; break; @@ -474,10 +474,10 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { } } - if (globalCtx->csCtx.actorActions[actionIndex]->action != 4) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + if (play->csCtx.actorActions[actionIndex]->action != 4) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } else { - Cutscene_ActorTranslate(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslate(&this->actor, play, actionIndex); } } @@ -491,30 +491,30 @@ void func_80AACF04(DmChar05* this, GlobalContext* globalCtx) { } } -void func_80AAD3F8(DmChar05* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 490) { +void func_80AAD3F8(DmChar05* this, PlayState* play) { + if (play->csCtx.frames == 490) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); } - if (globalCtx->csCtx.frames > 550) { + if (play->csCtx.frames > 550) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } -void func_80AAD450(DmChar05* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 262) { +void func_80AAD450(DmChar05* this, PlayState* play) { + if (play->csCtx.frames == 262) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); } - if (globalCtx->csCtx.frames > 318) { + if (play->csCtx.frames > 318) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } -void func_80AAD4A8(DmChar05* this, GlobalContext* globalCtx) { +void func_80AAD4A8(DmChar05* this, PlayState* play) { if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { - if (Cutscene_CheckActorAction(globalCtx, 109) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 109)]->action == 3)) { + if (Cutscene_CheckActorAction(play, 109) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action == 3)) { if (Animation_OnFrame(&this->skelAnime, 14.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); } else if (Animation_OnFrame(&this->skelAnime, 19.0f)) { @@ -522,15 +522,15 @@ void func_80AAD4A8(DmChar05* this, GlobalContext* globalCtx) { } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_1) { - if (Cutscene_CheckActorAction(globalCtx, 473)) { - if ((globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 473)]->action == 3) && + if (Cutscene_CheckActorAction(play, 473)) { + if ((play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action == 3) && Animation_OnFrame(&this->skelAnime, 5.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_SAND); } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_2) { - if (Cutscene_CheckActorAction(globalCtx, 518) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 518)]->action == 2)) { + if (Cutscene_CheckActorAction(play, 518) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action == 2)) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); } @@ -544,161 +544,160 @@ void func_80AAD4A8(DmChar05* this, GlobalContext* globalCtx) { } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { - if (globalCtx->sceneNum == SCENE_OKUJOU) { + if (play->sceneNum == SCENE_OKUJOU) { if (gSaveContext.sceneSetupIndex == 2) { - if (globalCtx->csCtx.currentCsIndex == 0) { - func_80AAD3F8(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - func_80AAD450(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + func_80AAD3F8(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + func_80AAD450(this, play); } } - } else if (globalCtx->sceneNum == SCENE_SPOT00) { + } else if (play->sceneNum == SCENE_SPOT00) { if (gSaveContext.sceneSetupIndex == 9) { - if ((globalCtx->csCtx.currentCsIndex == 0) && (globalCtx->csCtx.frames == 255)) { + if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); } - } else if ((gSaveContext.sceneSetupIndex == 0xB) && (globalCtx->csCtx.frames == 115)) { + } else if ((gSaveContext.sceneSetupIndex == 0xB) && (play->csCtx.frames == 115)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); } } } } -void DmChar05_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmChar05_Update(Actor* thisx, PlayState* play) { DmChar05* this = THIS; - func_80AACF04(this, globalCtx); - if (Cutscene_CheckActorAction(globalCtx, 109)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 109)]->action == 3) { + func_80AACF04(this, play); + if (Cutscene_CheckActorAction(play, 109)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action == 3) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(globalCtx, 473)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 473)]->action == 3) { + } else if (Cutscene_CheckActorAction(play, 473)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action == 3) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(globalCtx, 518)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 518)]->action == 2) { + } else if (Cutscene_CheckActorAction(play, 518)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action == 2) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(globalCtx, 559)) { - if ((globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 559)]->action == 2) || - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 559)]->action == 3)) { + } else if (Cutscene_CheckActorAction(play, 559)) { + if ((play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 2) || + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 3)) { SkelAnime_Update(&this->skelAnime); } - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 559)]->action == 4) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 4) { this->actor.world.rot.y += 0x258; this->actor.shape.rot.y += 0x258; } } - this->actionFunc(this, globalCtx); - func_80AAD4A8(this, globalCtx); + this->actionFunc(this, play); + func_80AAD4A8(this, play); } -s32 DmChar05_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 DmChar05_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void DmChar05_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmChar05_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void func_80AAD998(Actor* thisx, GlobalContext* globalCtx) { +void func_80AAD998(Actor* thisx, PlayState* play) { DmChar05* this = THIS; s32 pad[2]; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(globalCtx, 109) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 109)]->action != 1)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + if (Cutscene_CheckActorAction(play, 109) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action != 1)) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, this->unk_19C, this->unk_1A0, this->unk_1A4, this->unk_1A8, this->unk_1AC, this->unk_1B0); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar05_OverrideLimbDraw, + DmChar05_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } else if (this->unk_18E == 1) { - func_80AADD9C(globalCtx, this); + func_80AADD9C(play, this); } } -void func_80AADA90(Actor* thisx, GlobalContext* globalCtx) { +void func_80AADA90(Actor* thisx, PlayState* play) { DmChar05* this = THIS; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(globalCtx, 473) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 473)]->action != 1)) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + if (Cutscene_CheckActorAction(play, 473) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action != 1)) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar05_OverrideLimbDraw, + DmChar05_PostLimbDraw, &this->actor); } } else if (this->unk_18E == 1) { - func_80AADE78(globalCtx, this); + func_80AADE78(play, this); } } -void func_80AADB4C(Actor* thisx, GlobalContext* globalCtx) { +void func_80AADB4C(Actor* thisx, PlayState* play) { DmChar05* this = THIS; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(globalCtx, 518) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 518)]->action != 1)) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + if (Cutscene_CheckActorAction(play, 518) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action != 1)) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); } } else if (this->unk_18E == 1) { - func_80AADF54(globalCtx, this); + func_80AADF54(play, this); } } -void func_80AADC00(Actor* thisx, GlobalContext* globalCtx) { +void func_80AADC00(Actor* thisx, PlayState* play) { s32 pad; DmChar05* this = THIS; s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 559)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 559); + if (Cutscene_CheckActorAction(play, 559)) { + actionIndex = Cutscene_GetActorActionIndex(play, 559); - if ((globalCtx->csCtx.actorActions[actionIndex]->action != 1) && - (globalCtx->csCtx.actorActions[actionIndex]->action != 4)) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); + if ((play->csCtx.actorActions[actionIndex]->action != 1) && + (play->csCtx.actorActions[actionIndex]->action != 4)) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar05_OverrideLimbDraw, + DmChar05_PostLimbDraw, &this->actor); } - if (globalCtx->csCtx.actorActions[actionIndex]->action == 4) { + if (play->csCtx.actorActions[actionIndex]->action == 4) { Matrix_Translate(-600.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, object_dmask_DL_001E70); + Gfx_DrawDListOpa(play, object_dmask_DL_001E70); } } } -void DmChar05_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmChar05_Draw(Actor* thisx, PlayState* play) { DmChar05* this = THIS; switch (DMCHAR05_GET(&this->actor)) { case DMCHAR05_0: - func_80AAD998(thisx, globalCtx); + func_80AAD998(thisx, play); break; case DMCHAR05_1: - func_80AADA90(thisx, globalCtx); + func_80AADA90(thisx, play); break; case DMCHAR05_2: - func_80AADB4C(thisx, globalCtx); + func_80AADB4C(thisx, play); break; case DMCHAR05_3: - func_80AADC00(thisx, globalCtx); + func_80AADC00(thisx, play); break; case DMCHAR05_4: - func_80AAE030(globalCtx, this); + func_80AAE030(play, this); break; case DMCHAR05_5: @@ -709,66 +708,66 @@ void DmChar05_Draw(Actor* thisx, GlobalContext* globalCtx) { case DMCHAR05_10: case DMCHAR05_11: case DMCHAR05_12: - func_80AAE114(globalCtx, this); + func_80AAE114(play, this); break; } } -void func_80AADD9C(GlobalContext* globalCtx, DmChar05* this) { +void func_80AADD9C(PlayState* play, DmChar05* this) { if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, 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, GID_44); + GetItem_Draw(play, GID_44); } - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { this->actor.objBankIndex = this->unk_18F; } } -void func_80AADE78(GlobalContext* globalCtx, DmChar05* this) { +void func_80AADE78(PlayState* play, DmChar05* this) { if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, 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, GID_45); + GetItem_Draw(play, GID_45); } - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { this->actor.objBankIndex = this->unk_18F; } } -void func_80AADF54(GlobalContext* globalCtx, DmChar05* this) { +void func_80AADF54(PlayState* play, DmChar05* this) { if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, 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, GID_6B); + GetItem_Draw(play, GID_6B); } - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { this->actor.objBankIndex = this->unk_18F; } } -void func_80AAE030(GlobalContext* globalCtx, DmChar05* this) { +void func_80AAE030(PlayState* play, DmChar05* this) { if (this->unk_18E != 0) { if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, 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, GID_03); + GetItem_Draw(play, GID_03); } - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { this->actor.objBankIndex = this->unk_18F; } } } -void func_80AAE114(GlobalContext* globalCtx, DmChar05* this) { +void func_80AAE114(PlayState* play, DmChar05* this) { s32 sp34; s16 sp24[] = { GID_02, GID_6A, GID_70, GID_3A, GID_0E, GID_0F, GID_3E, GID_71, @@ -777,12 +776,12 @@ void func_80AAE114(GlobalContext* globalCtx, DmChar05* this) { sp34 = DMCHAR05_GET(&this->actor) - DMCHAR05_5; if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 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, sp24[sp34]); + GetItem_Draw(play, sp24[sp34]); } - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_18F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { this->actor.objBankIndex = this->unk_18F; } } diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h index 83bb679486..85a422e96c 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.h @@ -5,7 +5,7 @@ struct DmChar05; -typedef void (*DmChar05ActionFunc)(struct DmChar05*, GlobalContext*); +typedef void (*DmChar05ActionFunc)(struct DmChar05*, PlayState*); #define DMCHAR05_GET(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c index e35328af04..191fb16c4d 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c @@ -10,12 +10,12 @@ #define THIS ((DmChar06*)thisx) -void DmChar06_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar06_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar06_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar06_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar06_Init(Actor* thisx, PlayState* play); +void DmChar06_Destroy(Actor* thisx, PlayState* play); +void DmChar06_Update(Actor* thisx, PlayState* play); +void DmChar06_Draw(Actor* thisx, PlayState* play); -void func_80AAE6F0(DmChar06* this, GlobalContext* globalCtx); +void func_80AAE6F0(DmChar06* this, PlayState* play); void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc); diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h index a7e1e22eeb..5e51fc516c 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h @@ -5,7 +5,7 @@ struct DmChar06; -typedef void (*DmChar06ActionFunc)(struct DmChar06*, GlobalContext*); +typedef void (*DmChar06ActionFunc)(struct DmChar06*, PlayState*); typedef struct DmChar06 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.c b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.c index d2aac5a7cd..7058500a95 100644 --- a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.c +++ b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.c @@ -11,12 +11,12 @@ #define THIS ((DmChar07*)thisx) -void DmChar07_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar07_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar07_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar07_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar07_Init(Actor* thisx, PlayState* play); +void DmChar07_Destroy(Actor* thisx, PlayState* play); +void DmChar07_Update(Actor* thisx, PlayState* play); +void DmChar07_Draw(Actor* thisx, PlayState* play); -void DmChar07_DoNothing(DmChar07* this, GlobalContext* globalCtx); +void DmChar07_DoNothing(DmChar07* this, PlayState* play); const ActorInit Dm_Char07_InitVars = { ACTOR_DM_CHAR07, @@ -34,7 +34,7 @@ void DmChar07_SetupAction(DmChar07* this, DmChar07ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DmChar07_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmChar07_Init(Actor* thisx, PlayState* play) { DmChar07* this = THIS; this->isStage = 0; @@ -45,44 +45,44 @@ void DmChar07_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); this->isStage = 1; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_milkbar_Colheader_006688); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_milkbar_Colheader_006688); } else { Actor_SetScale(&this->dyna.actor, 1.0f); } DmChar07_SetupAction(this, DmChar07_DoNothing); } -void DmChar07_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmChar07_Destroy(Actor* thisx, PlayState* play) { DmChar07* this = THIS; if (this->isStage) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void DmChar07_DoNothing(DmChar07* this, GlobalContext* globalCtx) { +void DmChar07_DoNothing(DmChar07* this, PlayState* play) { } -void DmChar07_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmChar07_Update(Actor* thisx, PlayState* play) { DmChar07* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void DmChar07_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmChar07_Draw(Actor* thisx, PlayState* play) { DmChar07* this = THIS; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch (this->dyna.actor.params) { case DMCHAR07_STAGE: gSPDisplayList(POLY_OPA_DISP++, object_milkbar_DL_002CD0); break; case DMCHAR07_CREDITS_STAGE: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_milkbar_Matanimheader_0105F8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_milkbar_Matanimheader_0105F8)); gSPDisplayList(POLY_OPA_DISP++, object_milkbar_DL_007918); gSPDisplayList(POLY_OPA_DISP++, object_milkbar_DL_000240); gSPDisplayList(POLY_OPA_DISP++, object_milkbar_DL_000790); @@ -112,8 +112,8 @@ void DmChar07_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch (this->dyna.actor.params) { case DMCHAR07_STAGE: gSPDisplayList(POLY_XLU_DISP++, object_milkbar_DL_002BA0); @@ -147,5 +147,5 @@ void DmChar07_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h index 2a151012bc..5ea5fa36c5 100644 --- a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h +++ b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h @@ -5,7 +5,7 @@ struct DmChar07; -typedef void (*DmChar07ActionFunc)(struct DmChar07*, GlobalContext*); +typedef void (*DmChar07ActionFunc)(struct DmChar07*, PlayState*); #define DMCHAR07_GET_SPOTLIGHTFLAGS(thisx) (((thisx)->params >> 8) & 0x1F) #define DMCHAR07_GET_TYPE(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index f944c9c630..ed86257953 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -10,10 +10,10 @@ #define THIS ((DmChar08*)thisx) -void DmChar08_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar08_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar08_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar08_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar08_Init(Actor* thisx, PlayState* play); +void DmChar08_Destroy(Actor* thisx, PlayState* play); +void DmChar08_Update(Actor* thisx, PlayState* play); +void DmChar08_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Dm_Char08_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h index 6e31b5c342..7633e89184 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h @@ -5,7 +5,7 @@ struct DmChar08; -typedef void (*DmChar08ActionFunc)(struct DmChar08*, GlobalContext*); +typedef void (*DmChar08ActionFunc)(struct DmChar08*, PlayState*); typedef struct DmChar08 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 7fb20d1a0b..b9847da81f 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -10,14 +10,14 @@ #define THIS ((DmChar09*)thisx) -void DmChar09_Init(Actor* thisx, GlobalContext* globalCtx); -void DmChar09_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmChar09_Update(Actor* thisx, GlobalContext* globalCtx); -void DmChar09_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmChar09_Init(Actor* thisx, PlayState* play); +void DmChar09_Destroy(Actor* thisx, PlayState* play); +void DmChar09_Update(Actor* thisx, PlayState* play); +void DmChar09_Draw(Actor* thisx, PlayState* play); -void func_80AB1FDC(DmChar09* this, GlobalContext* globalCtx); -void func_80AB2258(DmChar09* this, GlobalContext* globalCtx); -void func_80AB2268(DmChar09* this, GlobalContext* globalCtx); +void func_80AB1FDC(DmChar09* this, PlayState* play); +void func_80AB2258(DmChar09* this, PlayState* play); +void func_80AB2268(DmChar09* this, PlayState* play); #if 0 const ActorInit Dm_Char09_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h index 280607ee28..22e57726e3 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h @@ -5,7 +5,7 @@ struct DmChar09; -typedef void (*DmChar09ActionFunc)(struct DmChar09*, GlobalContext*); +typedef void (*DmChar09ActionFunc)(struct DmChar09*, PlayState*); typedef struct DmChar09 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index a6970e050a..2e0aef68bf 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -12,14 +12,14 @@ #define THIS ((DmGm*)thisx) -void DmGm_Init(Actor* thisx, GlobalContext* globalCtx); -void DmGm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmGm_Update(Actor* thisx, GlobalContext* globalCtx); +void DmGm_Init(Actor* thisx, PlayState* play); +void DmGm_Destroy(Actor* thisx, PlayState* play); +void DmGm_Update(Actor* thisx, PlayState* play); -void func_80C248A8(DmGm* this, GlobalContext* globalCtx); -void func_80C24A00(DmGm* this, GlobalContext* globalCtx); -void func_80C24BD0(DmGm* this, GlobalContext* globalCtx); -void func_80C25000(Actor* thisx, GlobalContext* globalCtx); +void func_80C248A8(DmGm* this, PlayState* play); +void func_80C24A00(DmGm* this, PlayState* play); +void func_80C24BD0(DmGm* this, PlayState* play); +void func_80C25000(Actor* thisx, PlayState* play); const ActorInit Dm_Gm_InitVars = { ACTOR_DM_GM, @@ -50,7 +50,7 @@ static AnimationInfoS sAnimations[] = { { &object_an4_Anim_00506C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, }; -s32 func_80C24360(DmGm* this, GlobalContext* globalCtx) { +s32 func_80C24360(DmGm* this, PlayState* play) { s8 objectIndex = this->actor.objBankIndex; s8 objectIndex2; s32 ret = false; @@ -62,14 +62,14 @@ s32 func_80C24360(DmGm* this, GlobalContext* globalCtx) { } if (objectIndex2 >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex2].segment); ret = SkelAnime_Update(&this->skelAnime); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex].segment); } return ret; } -s32 func_80C24428(DmGm* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80C24428(DmGm* this, PlayState* play, s32 arg2) { s8 objectIndex = this->actor.objBankIndex; s8 objectIndex2; s32 ret = false; @@ -81,10 +81,10 @@ s32 func_80C24428(DmGm* this, GlobalContext* globalCtx, s32 arg2) { } if ((objectIndex2 >= 0) && (arg2 != this->unk_2C8)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex2].segment); this->unk_2C8 = arg2; ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objectIndex].segment); } return ret; } @@ -99,7 +99,7 @@ void func_80C24504(DmGm* this) { } } -s32 func_80C2457C(DmGm* this, GlobalContext* globalCtx) { +s32 func_80C2457C(DmGm* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; @@ -130,9 +130,9 @@ s32 func_80C2457C(DmGm* this, GlobalContext* globalCtx) { return true; } -s32 func_80C2478C(DmGm* this, GlobalContext* globalCtx) { +s32 func_80C2478C(DmGm* this, PlayState* play) { if (this->unk_2B4 != NULL) { - func_80C2457C(this, globalCtx); + func_80C2457C(this, play); this->unk_2AE &= ~1; this->unk_2AE |= 2; } else if (this->unk_2AE & 2) { @@ -148,12 +148,12 @@ s32 func_80C2478C(DmGm* this, GlobalContext* globalCtx) { return true; } -Actor* func_80C24838(GlobalContext* globalCtx) { +Actor* func_80C24838(PlayState* play) { Actor* tempActor; Actor* foundActor = NULL; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); + foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); if ((foundActor == NULL) || (foundActor->update != NULL)) { break; @@ -169,23 +169,23 @@ Actor* func_80C24838(GlobalContext* globalCtx) { return foundActor; } -void func_80C248A8(DmGm* this, GlobalContext* globalCtx) { - if ((this->unk_2AC >= 0) && SubS_IsObjectLoaded(this->unk_2AC, globalCtx) && (this->unk_2AD >= 0) && - SubS_IsObjectLoaded(this->unk_2AD, globalCtx)) { +void func_80C248A8(DmGm* this, PlayState* play) { + if ((this->unk_2AC >= 0) && SubS_IsObjectLoaded(this->unk_2AC, play) && (this->unk_2AD >= 0) && + SubS_IsObjectLoaded(this->unk_2AD, play)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_an1_Skel_012618, NULL, this->jointTable, - this->morphTable, OBJECT_AN1_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &object_an1_Skel_012618, NULL, this->jointTable, this->morphTable, + OBJECT_AN1_LIMB_MAX); this->unk_2C8 = -1; - func_80C24428(this, globalCtx, 0); + func_80C24428(this, play, 0); this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); this->unk_2AE |= 1; this->actor.draw = func_80C25000; - if ((globalCtx->sceneNum == SCENE_YADOYA) && (globalCtx->curSpawn == 4)) { - this->unk_2B4 = func_80C24838(globalCtx); - func_80C24428(this, globalCtx, 1); + if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + this->unk_2B4 = func_80C24838(play); + func_80C24428(this, play, 1); this->actionFunc = func_80C24BD0; } else { this->actionFunc = func_80C24A00; @@ -193,12 +193,12 @@ void func_80C248A8(DmGm* this, GlobalContext* globalCtx) { } } -void func_80C24A00(DmGm* this, GlobalContext* globalCtx) { +void func_80C24A00(DmGm* this, PlayState* play) { s32 sp28[] = { 0, 0, 12, 2, 4, 6, 8, 10, 11, 3 }; u16 action; s32 sp20; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (this->unk_2D0 == 0) { this->unk_2B0 = 255; this->unk_2D0 = 1; @@ -206,14 +206,14 @@ void func_80C24A00(DmGm* this, GlobalContext* globalCtx) { this->unk_2CC = this->unk_2C8; } - if (Cutscene_CheckActorAction(globalCtx, 0x22D)) { - sp20 = Cutscene_GetActorActionIndex(globalCtx, 0x22D); - action = globalCtx->csCtx.actorActions[sp20]->action; + if (Cutscene_CheckActorAction(play, 0x22D)) { + sp20 = Cutscene_GetActorActionIndex(play, 0x22D); + action = play->csCtx.actorActions[sp20]->action; if (this->unk_2B0 != (action & 0xFF)) { this->unk_2B0 = action; this->unk_2D4 = 1; - func_80C24428(this, globalCtx, sp28[action]); + func_80C24428(this, play, sp28[action]); } switch (this->unk_2B0) { @@ -225,72 +225,72 @@ void func_80C24A00(DmGm* this, GlobalContext* globalCtx) { case 8: if ((this->unk_2C8 == 12) || (this->unk_2C8 == 4) || (this->unk_2C8 == 6) || (this->unk_2C8 == 8)) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80C24428(this, globalCtx, this->unk_2C8 + 1); + func_80C24428(this, play, this->unk_2C8 + 1); } } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, sp20); + Cutscene_ActorTranslateAndYaw(&this->actor, play, sp20); } } else if (this->unk_2D0 != 0) { this->unk_2D0 = 0; this->unk_2D4 = 0; - func_80C24428(this, globalCtx, this->unk_2CC); + func_80C24428(this, play, this->unk_2CC); } } -void func_80C24BD0(DmGm* this, GlobalContext* globalCtx) { +void func_80C24BD0(DmGm* this, PlayState* play) { } -void DmGm_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmGm_Init(Actor* thisx, PlayState* play) { DmGm* this = THIS; - this->unk_2AC = SubS_GetObjectIndex(OBJECT_AN4, globalCtx); - this->unk_2AD = SubS_GetObjectIndex(OBJECT_MSMO, globalCtx); + this->unk_2AC = SubS_GetObjectIndex(OBJECT_AN4, play); + this->unk_2AD = SubS_GetObjectIndex(OBJECT_MSMO, play); this->actionFunc = func_80C248A8; } -void DmGm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmGm_Destroy(Actor* thisx, PlayState* play) { } -void DmGm_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmGm_Update(Actor* thisx, PlayState* play) { DmGm* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80C2478C(this, globalCtx); + func_80C2478C(this, play); if (this->actor.draw != NULL) { - func_80C24360(this, globalCtx); + func_80C24360(this, play); func_80C24504(this); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } Vec3f D_80C25218 = { 450.0f, 700.0f, -760.0f }; Vec3s D_80C25224 = { 0x238C, 0, -0x3FFC }; Vec3f D_80C2522C = { 1000.0f, 0.0f, 0.0f }; -void DmGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad[2]; DmGm* this = THIS; s8 sp2B = this->actor.objBankIndex; s8 sp2A = this->unk_2AD; if ((limbIndex == OBJECT_AN1_LIMB_05) && (this->unk_2D4 != 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_TranslateRotateZYX(&D_80C25218, &D_80C25224); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[sp2A].segment); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[sp2A].segment); gSPDisplayList(POLY_OPA_DISP++, gMoonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[sp2B].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[sp2B].segment); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == OBJECT_AN1_LIMB_09) { @@ -299,7 +299,7 @@ void DmGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void DmGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void DmGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { DmGm* this = THIS; s16 stepRot; s16 overrideRot; @@ -351,19 +351,19 @@ TexturePtr D_80C25244[] = { object_an1_Tex_00FDA0, object_an1_Tex_00F9A0, object_an1_Tex_0103A0, }; -void func_80C25000(Actor* thisx, GlobalContext* globalCtx) { +void func_80C25000(Actor* thisx, PlayState* play) { DmGm* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C25244[this->unk_2B8])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C25238[0])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, DmGm_PostLimbDraw, DmGm_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h index 6f2307378b..74efd4c1e0 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h @@ -6,7 +6,7 @@ struct DmGm; -typedef void (*DmGmActionFunc)(struct DmGm*, GlobalContext*); +typedef void (*DmGmActionFunc)(struct DmGm*, PlayState*); typedef struct DmGm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c index a30e836209..07c2d2bdd9 100644 --- a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c +++ b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c @@ -10,15 +10,15 @@ #define THIS ((DmHina*)thisx) -void DmHina_Init(Actor* thisx, GlobalContext* globalCtx); -void DmHina_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmHina_Update(Actor* thisx, GlobalContext* globalCtx); -void DmHina_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmHina_Init(Actor* thisx, PlayState* play); +void DmHina_Destroy(Actor* thisx, PlayState* play); +void DmHina_Update(Actor* thisx, PlayState* play); +void DmHina_Draw(Actor* thisx, PlayState* play); -void func_80A1F470(DmHina* this, GlobalContext* globalCtx); -void func_80A1F56C(DmHina* this, GlobalContext* globalCtx); -void func_80A1F5AC(DmHina* this, GlobalContext* globalCtx); -void func_80A1F63C(DmHina* this, GlobalContext* globalCtx); +void func_80A1F470(DmHina* this, PlayState* play); +void func_80A1F56C(DmHina* this, PlayState* play); +void func_80A1F5AC(DmHina* this, PlayState* play); +void func_80A1F63C(DmHina* this, PlayState* play); #if 0 const ActorInit Dm_Hina_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h index 00385a1d1a..32bd6aa39b 100644 --- a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h +++ b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.h @@ -5,7 +5,7 @@ struct DmHina; -typedef void (*DmHinaActionFunc)(struct DmHina*, GlobalContext*); +typedef void (*DmHinaActionFunc)(struct DmHina*, PlayState*); typedef struct DmHina { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index 102ecd95ef..57f1fb0e07 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -11,10 +11,10 @@ #define THIS ((DmNb*)thisx) -void DmNb_Init(Actor* thisx, GlobalContext* globalCtx); -void DmNb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmNb_Update(Actor* thisx, GlobalContext* globalCtx); -void DmNb_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmNb_Init(Actor* thisx, PlayState* play); +void DmNb_Destroy(Actor* thisx, PlayState* play); +void DmNb_Update(Actor* thisx, PlayState* play); +void DmNb_Draw(Actor* thisx, PlayState* play); const ActorInit Dm_Nb_InitVars = { ACTOR_DM_NB, @@ -40,25 +40,25 @@ s32 func_80C1DED0(DmNb* this, s32 arg1) { return ret; } -void func_80C1DF18(DmNb* this, GlobalContext* globalCtx) { +void func_80C1DF18(DmNb* this, PlayState* play) { s32 sp2C[] = { 0, 0, 0, 0, 0 }; u16 actionUnk0; s32 actionIndex; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (this->unk1F8 == 0) { this->unk1EC = 0xFF; this->unk1F8 = 1; this->unk1F4 = this->unk1F0; } - if (Cutscene_CheckActorAction(globalCtx, 562)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 562); - actionUnk0 = globalCtx->csCtx.actorActions[actionIndex]->action; + if (Cutscene_CheckActorAction(play, 562)) { + actionIndex = Cutscene_GetActorActionIndex(play, 562); + actionUnk0 = play->csCtx.actorActions[actionIndex]->action; if (this->unk1EC != (actionUnk0 & 0xFF)) { this->unk1EC = actionUnk0; func_80C1DED0(this, sp2C[actionUnk0]); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } } else if (this->unk1F8 != 0) { this->unk1F8 = 0; @@ -66,12 +66,11 @@ void func_80C1DF18(DmNb* this, GlobalContext* globalCtx) { } } -void DmNb_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmNb_Init(Actor* thisx, PlayState* play) { DmNb* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_nb_Skel_008C40, NULL, this->jointTable, this->morphTable, - 8); + SkelAnime_InitFlex(play, &this->skelAnime, &object_nb_Skel_008C40, NULL, this->jointTable, this->morphTable, 8); this->unk1F0 = -1; func_80C1DED0(this, 0); this->actor.flags &= ~ACTOR_FLAG_1; @@ -79,24 +78,24 @@ void DmNb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80C1DF18; } -void DmNb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmNb_Destroy(Actor* thisx, PlayState* play) { } -void DmNb_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmNb_Update(Actor* thisx, PlayState* play) { DmNb* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } -void DmNb_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void DmNb_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void DmNb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmNb_Draw(Actor* thisx, PlayState* play) { DmNb* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, DmNb_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h index a417ea0703..eafc4ef996 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h @@ -5,7 +5,7 @@ struct DmNb; -typedef void (*DmNbActionFunc)(struct DmNb*, GlobalContext*); +typedef void (*DmNbActionFunc)(struct DmNb*, PlayState*); typedef struct DmNb { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c index 565c14ea3f..0ee7b3ed47 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c @@ -11,12 +11,12 @@ #define THIS ((DmOpstage*)thisx) -void DmOpstage_Init(Actor* thisx, GlobalContext* globalCtx); -void DmOpstage_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmOpstage_Update(Actor* thisx, GlobalContext* globalCtx); -void DmOpstage_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmOpstage_Init(Actor* thisx, PlayState* play); +void DmOpstage_Destroy(Actor* thisx, PlayState* play); +void DmOpstage_Update(Actor* thisx, PlayState* play); +void DmOpstage_Draw(Actor* thisx, PlayState* play); -void DmOpstage_FollowCutsceneScript(DmOpstage* this, GlobalContext* globalCtx); +void DmOpstage_FollowCutsceneScript(DmOpstage* this, PlayState* play); const ActorInit Dm_Opstage_InitVars = { ACTOR_DM_OPSTAGE, @@ -38,7 +38,7 @@ void DmOpstage_SetupAction(DmOpstage* this, DmOpstageActionFunc actionFunc) { this->actionFunc = actionFunc; } -void DmOpstage_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmOpstage_Init(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -46,7 +46,7 @@ void DmOpstage_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_keikoku_demo_Colheader_001C98); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_keikoku_demo_Colheader_001C98); } if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DM_OPSTAGE_TYPE_FLOOR) { this->pos.x = this->dyna.actor.world.pos.x; @@ -58,47 +58,45 @@ void DmOpstage_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void DmOpstage_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmOpstage_Destroy(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void DmOpstage_FollowCutsceneScript(DmOpstage* this, GlobalContext* globalCtx) { +void DmOpstage_FollowCutsceneScript(DmOpstage* this, PlayState* play) { s32 actionIndex; if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DM_OPSTAGE_TYPE_FLOOR) { - if (Cutscene_CheckActorAction(globalCtx, 0x73)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 0x73); - if (globalCtx->csCtx.actorActions[actionIndex]->action == 2) { + if (Cutscene_CheckActorAction(play, 0x73)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x73); + if (play->csCtx.actorActions[actionIndex]->action == 2) { this->dyna.actor.scale.x = 0.075f; this->dyna.actor.scale.z = 0.3f; } else { this->dyna.actor.scale.x = 0.1f; this->dyna.actor.scale.z = 0.1f; } - Cutscene_ActorTranslateAndYaw(&this->dyna.actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, actionIndex); } - } else if (Cutscene_CheckActorAction(globalCtx, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)) { - Cutscene_ActorTranslateAndYaw( - &this->dyna.actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)); + } else if (Cutscene_CheckActorAction(play, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)) { + Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, + Cutscene_GetActorActionIndex(play, DMOPSTAGE_GET_08(&this->dyna.actor) + 0x74)); } } -void DmOpstage_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmOpstage_Update(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; - this->actionFunc(this, globalCtx); - if ((globalCtx->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && - (globalCtx->csCtx.frames == 480)) { + this->actionFunc(this, play); + if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) { func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH); } } -void DmOpstage_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmOpstage_Draw(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) > DM_OPSTAGE_TYPE_FLOOR) { @@ -109,23 +107,23 @@ void DmOpstage_Draw(Actor* thisx, GlobalContext* globalCtx) { } switch (DMOPSTAGE_GET_TYPE(&this->dyna.actor)) { case DM_OPSTAGE_TYPE_FLOOR: - Gfx_DrawDListOpa(globalCtx, object_keikoku_demo_DL_000978); - Gfx_DrawDListXlu(globalCtx, object_keikoku_demo_DL_000970); + Gfx_DrawDListOpa(play, object_keikoku_demo_DL_000978); + Gfx_DrawDListXlu(play, object_keikoku_demo_DL_000970); break; case DM_OPSTAGE_TYPE_TREE1: - Gfx_DrawDListOpa(globalCtx, object_keikoku_demo_DL_002878); - Gfx_DrawDListXlu(globalCtx, object_keikoku_demo_DL_002870); + Gfx_DrawDListOpa(play, object_keikoku_demo_DL_002878); + Gfx_DrawDListXlu(play, object_keikoku_demo_DL_002870); break; case DM_OPSTAGE_TYPE_TREE2: - Gfx_DrawDListOpa(globalCtx, object_keikoku_demo_DL_003068); - Gfx_DrawDListXlu(globalCtx, object_keikoku_demo_DL_003060); + Gfx_DrawDListOpa(play, object_keikoku_demo_DL_003068); + Gfx_DrawDListXlu(play, object_keikoku_demo_DL_003060); break; case DM_OPSTAGE_TYPE_TREE3: - Gfx_DrawDListOpa(globalCtx, object_keikoku_demo_DL_003728); - Gfx_DrawDListXlu(globalCtx, object_keikoku_demo_DL_003720); + Gfx_DrawDListOpa(play, object_keikoku_demo_DL_003728); + Gfx_DrawDListXlu(play, object_keikoku_demo_DL_003720); break; } } diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h index 96fa6d31b9..a8f4b0c607 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h @@ -8,7 +8,7 @@ struct DmOpstage; -typedef void (*DmOpstageActionFunc)(struct DmOpstage*, GlobalContext*); +typedef void (*DmOpstageActionFunc)(struct DmOpstage*, PlayState*); typedef struct DmOpstage { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ UNK_TYPE1 pad_15C[0x44]; diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index 25a68056ef..afcd2b55d9 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -10,11 +10,11 @@ #define THIS ((DmRavine*)thisx) -void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx); -void DmRavine_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmRavine_DoNothing(DmRavine* this, GlobalContext* globalCtx); -void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx); -void DmRavine_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmRavine_Init(Actor* thisx, PlayState* play); +void DmRavine_Destroy(Actor* thisx, PlayState* play); +void DmRavine_DoNothing(DmRavine* this, PlayState* play); +void DmRavine_Update(Actor* thisx, PlayState* play); +void DmRavine_Draw(Actor* thisx, PlayState* play); const ActorInit Dm_Ravine_InitVars = { ACTOR_DM_RAVINE, @@ -28,7 +28,7 @@ const ActorInit Dm_Ravine_InitVars = { (ActorFunc)DmRavine_Draw, }; -void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmRavine_Init(Actor* thisx, PlayState* play) { s32 pad; DmRavine* this = THIS; @@ -38,20 +38,20 @@ void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) { } this->isActive = false; - globalCtx->roomCtx.unk7A[0] = 1; - globalCtx->roomCtx.unk7A[1] = 0; + play->roomCtx.unk7A[0] = 1; + play->roomCtx.unk7A[1] = 0; this->state = 0; Actor_SetScale(&this->actor, 1.0f); this->actionFunc = DmRavine_DoNothing; } -void DmRavine_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmRavine_Destroy(Actor* thisx, PlayState* play) { } -void DmRavine_DoNothing(DmRavine* this, GlobalContext* globalCtx) { +void DmRavine_DoNothing(DmRavine* this, PlayState* play) { } -void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmRavine_Update(Actor* thisx, PlayState* play) { DmRavine* this = THIS; RoomContext* roomCtx; @@ -60,12 +60,12 @@ void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx) { return; case DM_RAVINE_STATE_ACTIVE: this->isActive = true; - globalCtx->roomCtx.unk7A[1]++; - if (globalCtx->roomCtx.unk7A[1] > 254) { - globalCtx->roomCtx.unk7A[1] = 254; - if (globalCtx->csCtx.frames > 700) { - globalCtx->roomCtx.unk7A[1] = 255; - globalCtx->roomCtx.unk7A[0] = 0; + play->roomCtx.unk7A[1]++; + if (play->roomCtx.unk7A[1] > 254) { + play->roomCtx.unk7A[1] = 254; + if (play->csCtx.frames > 700) { + play->roomCtx.unk7A[1] = 255; + play->roomCtx.unk7A[0] = 0; this->state++; // -> DM_RAVINE_STATE_PENDING_DEATH } } @@ -76,5 +76,5 @@ void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void DmRavine_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmRavine_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.h b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.h index 87e77f1593..d634ec5e93 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.h +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.h @@ -5,7 +5,7 @@ struct DmRavine; -typedef void (*DmRavineActionFunc)(struct DmRavine*, GlobalContext*); +typedef void (*DmRavineActionFunc)(struct DmRavine*, PlayState*); typedef enum { /* 0 */ DM_RAVINE_STATE_INITIALIZED, diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c index 88932cd714..aaaeea362a 100644 --- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c +++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c @@ -11,12 +11,12 @@ #define THIS ((DmSa*)thisx) -void DmSa_Init(Actor* thisx, GlobalContext* globalCtx); -void DmSa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmSa_Update(Actor* thisx, GlobalContext* globalCtx); -void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmSa_Init(Actor* thisx, PlayState* play); +void DmSa_Destroy(Actor* thisx, PlayState* play); +void DmSa_Update(Actor* thisx, PlayState* play); +void DmSa_Draw(Actor* thisx, PlayState* play); -void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx); +void DmSa_DoNothing(DmSa* this, PlayState* play); const ActorInit Dm_Sa_InitVars = { ACTOR_DM_SA, @@ -45,41 +45,41 @@ void func_80A2E960(SkelAnime* arg0, AnimationInfo* animations, u16 index) { animations->mode, animations->morphFrames); } -void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmSa_Init(Actor* thisx, PlayState* play) { DmSa* this = THIS; this->unk2E0 = 0; this->alpha = 0xFF; this->actor.targetArrowOffset = 3000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); func_80A2E960(&this->skelAnime, D_80A2ED00, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmSa_DoNothing; } -void DmSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmSa_Destroy(Actor* thisx, PlayState* play) { } -void DmSa_DoNothing(DmSa* this, GlobalContext* globalCtx) { +void DmSa_DoNothing(DmSa* this, PlayState* play) { } -void DmSa_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmSa_Update(Actor* thisx, PlayState* play) { DmSa* this = THIS; SkelAnime_Update(&this->skelAnime); this->alpha += 0; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 DmSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 DmSa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void DmSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmSa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void DmSa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void DmSa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } Gfx* func_80A2EB58(GraphicsContext* gfxCtx, u32 alpha) { @@ -105,22 +105,22 @@ Gfx* func_80A2EBB0(GraphicsContext* gfxCtx, u32 alpha) { return dList; } -void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmSa_Draw(Actor* thisx, PlayState* play) { DmSa* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->alpha < 0xFF) { - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EB58(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EB58(play->state.gfxCtx, this->alpha)); } else { - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EBB0(globalCtx->state.gfxCtx, this->alpha)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80A2EBB0(play->state.gfxCtx, this->alpha)); } - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmSa_OverrideLimbDraw, DmSa_PostLimbDraw, DmSa_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h index e8b3f502f0..d1d37128b8 100644 --- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h +++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.h @@ -5,7 +5,7 @@ struct DmSa; -typedef void (*DmSaActionFunc)(struct DmSa*, GlobalContext*); +typedef void (*DmSaActionFunc)(struct DmSa*, PlayState*); typedef struct DmSa { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c b/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c index 6c9d11170c..62c267322f 100644 --- a/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c +++ b/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c @@ -11,10 +11,10 @@ #define THIS ((DmStatue*)thisx) -void DmStatue_Init(Actor* thisx, GlobalContext* globalCtx); -void DmStatue_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmStatue_Update(Actor* thisx, GlobalContext* globalCtx); -void DmStatue_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmStatue_Init(Actor* thisx, PlayState* play); +void DmStatue_Destroy(Actor* thisx, PlayState* play); +void DmStatue_Update(Actor* thisx, PlayState* play); +void DmStatue_Draw(Actor* thisx, PlayState* play); const ActorInit Dm_Statue_InitVars = { ACTOR_DM_STATUE, @@ -28,19 +28,19 @@ const ActorInit Dm_Statue_InitVars = { (ActorFunc)DmStatue_Draw, }; -void DmStatue_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmStatue_Init(Actor* thisx, PlayState* play) { DmStatue* this = THIS; Actor_SetScale(&this->actor, 10.0f); } -void DmStatue_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmStatue_Destroy(Actor* thisx, PlayState* play) { } -void DmStatue_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmStatue_Update(Actor* thisx, PlayState* play) { } -void DmStatue_Draw(Actor* thisx, GlobalContext* globalCtx) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_smtower_Matanimheader_001788)); - Gfx_DrawDListXlu(globalCtx, object_smtower_DL_000520); +void DmStatue_Draw(Actor* thisx, PlayState* play) { + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_smtower_Matanimheader_001788)); + Gfx_DrawDListXlu(play, object_smtower_DL_000520); } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 10cd5550c2..8ec435a611 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -16,25 +16,25 @@ #define THIS ((DmStk*)thisx) -void DmStk_Init(Actor* thisx, GlobalContext* globalCtx); -void DmStk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmStk_Update(Actor* thisx, GlobalContext* globalCtx); -void DmStk_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmStk_Init(Actor* thisx, PlayState* play); +void DmStk_Destroy(Actor* thisx, PlayState* play); +void DmStk_Update(Actor* thisx, PlayState* play); +void DmStk_Draw(Actor* thisx, PlayState* play); -void DmStk_ClockTower_DoNothing(DmStk* this, GlobalContext* globalCtx); -void DmStk_DoNothing(DmStk* this, GlobalContext* globalCtx); -void DmStk_WaitForTelescope(DmStk* this, GlobalContext* globalCtx); -void DmStk_StartTelescopeCutscene(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_DeflectHit(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_IdleWithOcarina(DmStk* this, GlobalContext* globalCtx); -void DmStk_ClockTower_Idle(DmStk* this, GlobalContext* globalCtx); +void DmStk_ClockTower_DoNothing(DmStk* this, PlayState* play); +void DmStk_DoNothing(DmStk* this, PlayState* play); +void DmStk_WaitForTelescope(DmStk* this, PlayState* play); +void DmStk_StartTelescopeCutscene(DmStk* this, PlayState* play); +void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, PlayState* play); +void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, PlayState* play); +void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, PlayState* play); +void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* play); +void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, PlayState* play); +void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, PlayState* play); +void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play); +void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, PlayState* play); +void DmStk_ClockTower_IdleWithOcarina(DmStk* this, PlayState* play); +void DmStk_ClockTower_Idle(DmStk* this, PlayState* play); typedef enum { /* 0 */ SK_ANIMATION_SHAKE_HEAD, @@ -297,7 +297,7 @@ static AnimationInfo sAnimations[] = { /** * Ensures the correct object for the current animation is in segment 6. */ -void DmStk_LoadObjectForAnimation(DmStk* this, GlobalContext* globalCtx) { +void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { s32 objectIndex; if (((this->animationId >= SK_ANIMATION_SHAKE_HEAD) && (this->animationId <= SK_ANIMATION_BENT_OVER_HEAD_TWITCH)) || @@ -313,16 +313,16 @@ void DmStk_LoadObjectForAnimation(DmStk* this, GlobalContext* globalCtx) { } if (objectIndex >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment); } } /** * This function is always called with unusedExtraOffset = 0. */ -void DmStk_ChangeAnimation(DmStk* this, GlobalContext* globalCtx, SkelAnime* skelAnime, AnimationInfo* animation, +void DmStk_ChangeAnimation(DmStk* this, PlayState* play, SkelAnime* skelAnime, AnimationInfo* animation, u16 unusedExtraOffset) { - DmStk_LoadObjectForAnimation(this, globalCtx); + DmStk_LoadObjectForAnimation(this, play); animation += unusedExtraOffset; @@ -337,8 +337,8 @@ void DmStk_ChangeAnimation(DmStk* this, GlobalContext* globalCtx, SkelAnime* ske * that starts when the player start a new game and ends when the screen fades to white * after Skull Kid steals Epona. */ -void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames + 20) { +void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { + switch (play->csCtx.frames + 20) { case 1195: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); break; @@ -428,8 +428,8 @@ void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, GlobalContext* globalCt * looking at the moon on top of the Clock Tower. However, it doesn't actually play * any sound in-game, since all sound effects are muted when it plays. */ -void DmStk_PlaySfxForTitleCutscene(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 535) { +void DmStk_PlaySfxForTitleCutscene(DmStk* this, PlayState* play) { + if (play->csCtx.frames == 535) { func_8019F128(NA_SE_EV_CLOCK_TOWER_BELL); } } @@ -438,8 +438,8 @@ void DmStk_PlaySfxForTitleCutscene(DmStk* this, GlobalContext* globalCtx) { * Handles sound effects for the second part of the intro cutscene, i.e., the cutscene * that starts after the fade-to-white and ends when the player gains control. */ -void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 78: case 89: case 100: @@ -470,8 +470,8 @@ void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, GlobalContext* globalC * Handles sound effects for the cutscene where Skull Kid steals Majora's Mask from * the Happy Mask Salesman. */ -void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 18: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_GASAGOSO); break; @@ -491,8 +491,8 @@ void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, GlobalContext* gl * that starts when Link falls down the large hole and ends with a fade-to-black to * the hallucinatory Deku Scrubs scene. */ -void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 415: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 100); break; @@ -517,10 +517,10 @@ void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, GlobalContext* globalCt * that starts once the hallucinatory Deku Scrubs scene is over and ends when the player * gains control. */ -void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 10: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 50); break; @@ -560,7 +560,7 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, GlobalContext* globalC if (player) {} - if ((globalCtx->csCtx.frames >= 263) && (globalCtx->csCtx.frames < 698)) { + if ((play->csCtx.frames >= 263) && (play->csCtx.frames < 698)) { Actor_PlaySfxAtPos(&player->actor, NA_SE_EN_STALKIDS_BODY_LEV - SFX_FLAG); } } @@ -570,10 +570,10 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, GlobalContext* globalC * it handles the variation of the cutscene that plays the first time the player reaches the * top of the Clock Tower, which is slightly longer. */ -void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, GlobalContext* globalCtx) { +void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* play) { static s32 sMoonCallTimer = 0; - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 140: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 80); break; @@ -596,7 +596,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, GlobalContext* break; } - if ((this->animationId == SK_ANIMATION_OCARINA_JUGGLE) && (globalCtx->csCtx.frames < 700)) { + if ((this->animationId == SK_ANIMATION_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { if (Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); } else if (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { @@ -604,7 +604,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, GlobalContext* } } - if (globalCtx->csCtx.frames >= 700) { + if (play->csCtx.frames >= 700) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON); @@ -622,8 +622,8 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, GlobalContext* /** * Handles sound effects for the cutscene where Skull Kid drops the Ocarina of Time. */ -void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.frames == 3) { +void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, PlayState* play) { + if (play->csCtx.frames == 3) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL06_SURPRISED); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); } @@ -632,8 +632,8 @@ void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, GlobalContext* globalC /** * Handles sound effects for the cutscene where Skull Kid is shivering in the rain. */ -void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.frames >= 642) && (globalCtx->csCtx.frames < 845)) { +void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, PlayState* play) { + if ((play->csCtx.frames >= 642) && (play->csCtx.frames < 845)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_NE_STAL23_COLD - SFX_FLAG); } } @@ -642,8 +642,8 @@ void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, GlobalContext* globalC * Handles sound effects for the cutscene where Skull Kid is playing with Tatl and Tael * in Termina Field. */ -void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 58: case 61: case 68: @@ -669,8 +669,8 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, GlobalContext* glob * that starts after the Dawn of the New Day screen and ends with a fade to black as * the Giants are walking away. */ -void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 5: func_801A4A28(12); break; @@ -685,10 +685,10 @@ void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, GlobalContext* globalC * Handles sound effects for the second part of the ending cutscene, i.e., the cutscene * that starts after a fade-to-black and ends after the credits start. */ -void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 5: func_801A4A28(12); break; @@ -758,10 +758,10 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, GlobalContext* global * it handles the variation of the cutscene that plays the second or later time the player * reaches the top of the Clock Tower, which is slightly shorter. */ -void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, GlobalContext* globalCtx) { +void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, PlayState* play) { static s32 sMoonCallTimer = 0; - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 40: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 80); break; @@ -780,7 +780,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, GlobalContext* break; } - if (globalCtx->csCtx.frames >= 408) { + if (play->csCtx.frames >= 408) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON); @@ -799,12 +799,12 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, GlobalContext* * Handles sound effects for the cutscene that plays after the player plays the * Oath to Order at the top of the Clock Tower. */ -void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, GlobalContext* globalCtx) { +void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* play) { this->oathToOrderCutsceneVoicePos.x = this->actor.projectedPos.x; this->oathToOrderCutsceneVoicePos.y = this->actor.projectedPos.y; this->oathToOrderCutsceneVoicePos.z = this->actor.projectedPos.z; - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 64: Audio_PlaySfxAtPos(&this->oathToOrderCutsceneVoicePos, NA_SE_EN_STAL06_SURPRISED); break; @@ -848,15 +848,15 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, GlobalContext* if (1) {} - if ((globalCtx->csCtx.frames >= 62) && (globalCtx->csCtx.frames < 273)) { - if ((Rand_ZeroOne() < 0.75f) && ((globalCtx->state.frames % 2) != 0)) { + if ((play->csCtx.frames >= 62) && (play->csCtx.frames < 273)) { + if ((Rand_ZeroOne() < 0.75f) && ((play->state.frames % 2) != 0)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_EARTHQUAKE); } } - if ((globalCtx->csCtx.frames >= 498) && (globalCtx->csCtx.frames < 577)) { - if ((globalCtx->state.frames % 4) == 0) { - if ((globalCtx->state.frames & 4) != 0) { + if ((play->csCtx.frames >= 498) && (play->csCtx.frames < 577)) { + if ((play->state.frames % 4) == 0) { + if ((play->state.frames & 4) != 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); @@ -864,7 +864,7 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, GlobalContext* } } - if (globalCtx->csCtx.frames >= 290) { + if (play->csCtx.frames >= 290) { func_8019F128(NA_SE_EV_KYOJIN_VOICE_SUCCESS - SFX_FLAG); } } @@ -874,8 +874,8 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, GlobalContext* * it handles the variation of the cutscene that plays the first time the player warps to the * moon, which is slightly longer. */ -void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 551: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; @@ -896,8 +896,8 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, GlobalContext* global * it handles the variation of the cutscene that plays the second or later time the player * warps to the moon, which is slightly shorter. */ -void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { + switch (play->csCtx.frames) { case 311: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; @@ -916,67 +916,67 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, GlobalContext* global /** * Handles sound effects for all cutscenes. */ -void DmStk_PlaySfxForCutscenes(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0) { - switch (globalCtx->sceneNum) { +void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { + if (play->csCtx.state != 0) { + switch (play->sceneNum) { case SCENE_LOST_WOODS: if (gSaveContext.sceneSetupIndex == 1) { - DmStk_PlaySfxForIntroCutsceneFirstPart(this, globalCtx); + DmStk_PlaySfxForIntroCutsceneFirstPart(this, play); } else if (gSaveContext.sceneSetupIndex == 0) { - DmStk_PlaySfxForIntroCutsceneSecondPart(this, globalCtx); - } else if ((gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.currentCsIndex == 0)) { - DmStk_PlaySfxForObtainingMajorasMaskCutscene(this, globalCtx); + DmStk_PlaySfxForIntroCutsceneSecondPart(this, play); + } else if ((gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) { + DmStk_PlaySfxForObtainingMajorasMaskCutscene(this, play); } break; case SCENE_CLOCKTOWER: if (gSaveContext.sceneSetupIndex == 1) { - DmStk_PlaySfxForTitleCutscene(this, globalCtx); + DmStk_PlaySfxForTitleCutscene(this, play); } break; case SCENE_OPENINGDAN: if (gSaveContext.sceneSetupIndex == 0) { - if (globalCtx->csCtx.currentCsIndex == 0) { - DmStk_PlaySfxForCurseCutsceneFirstPart(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - DmStk_PlaySfxForCurseCutsceneSecondPart(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + DmStk_PlaySfxForCurseCutsceneFirstPart(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + DmStk_PlaySfxForCurseCutsceneSecondPart(this, play); } } break; case SCENE_OKUJOU: if (gSaveContext.sceneSetupIndex == 0) { - if (globalCtx->csCtx.currentCsIndex == 0) { - DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - DmStk_PlaySfxForDroppingOcarinaCutscene(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 2) { - DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 3) { - DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + DmStk_PlaySfxForDroppingOcarinaCutscene(this, play); + } else if (play->csCtx.currentCsIndex == 2) { + DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(this, play); + } else if (play->csCtx.currentCsIndex == 3) { + DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(this, play); } } else if (gSaveContext.sceneSetupIndex == 2) { - if (globalCtx->csCtx.currentCsIndex == 0) { - DmStk_PlaySfxForMoonWarpCutsceneVersion1(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - DmStk_PlaySfxForMoonWarpCutsceneVersion2(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + DmStk_PlaySfxForMoonWarpCutsceneVersion1(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + DmStk_PlaySfxForMoonWarpCutsceneVersion2(this, play); } } break; case SCENE_00KEIKOKU: if (gSaveContext.sceneSetupIndex == 3) { - if (globalCtx->csCtx.currentCsIndex == 0) { - DmStk_PlaySfxForShiveringInRainCutscene(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 2) { - DmStk_PlaySfxForPlayingWithFairiesCutscene(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + DmStk_PlaySfxForShiveringInRainCutscene(this, play); + } else if (play->csCtx.currentCsIndex == 2) { + DmStk_PlaySfxForPlayingWithFairiesCutscene(this, play); } } else if (gSaveContext.sceneSetupIndex == 7) { - if (globalCtx->csCtx.currentCsIndex == 0) { - DmStk_PlaySfxForEndingCutsceneFirstPart(this, globalCtx); - } else if (globalCtx->csCtx.currentCsIndex == 1) { - DmStk_PlaySfxForEndingCutsceneSecondPart(this, globalCtx); + if (play->csCtx.currentCsIndex == 0) { + DmStk_PlaySfxForEndingCutsceneFirstPart(this, play); + } else if (play->csCtx.currentCsIndex == 1) { + DmStk_PlaySfxForEndingCutsceneSecondPart(this, play); } } break; @@ -1007,16 +1007,16 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, GlobalContext* globalCtx) { } } -void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmStk_Init(Actor* thisx, PlayState* play) { s32 pad; DmStk* this = THIS; this->shouldDraw = true; if (DM_STK_GET_TYPE(&this->actor) != DM_STK_TYPE_MAJORAS_MASK) { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_NOT_READY; - this->objectStkObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_STK); - this->objectStk2ObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_STK2); - this->objectStk3ObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_STK3); + this->objectStkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_STK); + this->objectStk2ObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_STK2); + this->objectStk3ObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_STK3); if (this->objectStkObjectIndex < 0) { Actor_MarkForDeath(&this->actor); } @@ -1025,24 +1025,24 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { this->deflectCount = 0; this->maskType = SK_MASK_TYPE_NORMAL; this->animationId = SK_ANIMATION_IDLE; - this->fogR = globalCtx->lightCtx.unk7; - this->fogG = globalCtx->lightCtx.unk8; - this->fogB = globalCtx->lightCtx.unk9; + this->fogR = play->lightCtx.unk7; + this->fogG = play->lightCtx.unk8; + this->fogB = play->lightCtx.unk9; - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { this->alpha = 0; this->fogN = 0; this->fogF = 1000; this->fogScale = 1.0f; this->actionFunc = DmStk_DoNothing; - } else if (globalCtx->sceneNum == SCENE_OKUJOU) { + } else if (play->sceneNum == SCENE_OKUJOU) { this->alpha = 255; this->fogN = 996; this->fogF = 1000; this->fogScale = 0.7f; this->hasBeenHit = false; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); if (gSaveContext.save.entranceIndex == 0x2C00) { if (gSaveContext.sceneSetupIndex == 0) { @@ -1086,11 +1086,11 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = DmStk_ClockTower_Idle; } - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - } else if ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) { - if (!(globalCtx->actorCtx.unk5 & 2)) { + } else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) { + if (!(play->actorCtx.unk5 & 2)) { Actor_MarkForDeath(&this->actor); } @@ -1102,7 +1102,7 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { this->animationId = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; this->actionFunc = DmStk_WaitForTelescope; } else { - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(globalCtx)) { + if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } @@ -1122,38 +1122,38 @@ void DmStk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 1100.0f; this->csAction = 99; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); } Actor_SetScale(&this->actor, 0.01f); - if ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (globalCtx->csCtx.currentCsIndex > 0)) { - globalCtx->envCtx.unk_17 = 15; - globalCtx->envCtx.unk_18 = 15; + if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && + (play->csCtx.currentCsIndex > 0)) { + play->envCtx.unk_17 = 15; + play->envCtx.unk_18 = 15; } } -void DmStk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmStk_Destroy(Actor* thisx, PlayState* play) { } -void DmStk_ClockTower_DoNothing(DmStk* this, GlobalContext* globalCtx) { +void DmStk_ClockTower_DoNothing(DmStk* this, PlayState* play) { } -void DmStk_DoNothing(DmStk* this, GlobalContext* globalCtx) { +void DmStk_DoNothing(DmStk* this, PlayState* play) { } /** * Waits around until the player zooms the telescope in on Skull Kid, * then starts the telescope cutscene. */ -void DmStk_WaitForTelescope(DmStk* this, GlobalContext* globalCtx) { +void DmStk_WaitForTelescope(DmStk* this, PlayState* play) { Vec3f screenPos; if (!(gSaveContext.save.weekEventReg[74] & 0x20)) { - func_80169474(globalCtx, &this->actor.world.pos, &screenPos); - if (globalCtx->view.fovy < 25.0f) { + func_80169474(play, &this->actor.world.pos, &screenPos); + if (play->view.fovy < 25.0f) { if ((screenPos.x >= 70.0f) && (screenPos.x < 250.0f) && (screenPos.y >= 30.0f) && (screenPos.y < 210.0f)) { func_800FE484(); this->actionFunc = DmStk_StartTelescopeCutscene; @@ -1165,7 +1165,7 @@ void DmStk_WaitForTelescope(DmStk* this, GlobalContext* globalCtx) { /** * Plays the cutscene in the telescope where the Moon's Tear falls. */ -void DmStk_StartTelescopeCutscene(DmStk* this, GlobalContext* globalCtx) { +void DmStk_StartTelescopeCutscene(DmStk* this, PlayState* play) { s16 dayOneAndTwoCutscene = this->actor.cutscene; s16 dayThreeCutscene = ActorCutscene_GetAdditionalCutscene(dayOneAndTwoCutscene); s16 finalHoursCutscene = ActorCutscene_GetAdditionalCutscene(dayThreeCutscene); @@ -1189,7 +1189,7 @@ void DmStk_StartTelescopeCutscene(DmStk* this, GlobalContext* globalCtx) { } } -void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, GlobalContext* globalCtx) { +void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(9)) { ActorCutscene_Start(9, &this->actor); this->actionFunc = DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd; @@ -1198,16 +1198,16 @@ void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, GlobalContext* glo } } -void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { +void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, PlayState* play) { + if (play->csCtx.state == 0) { this->animationId = SK_ANIMATION_CALL_DOWN_MOON_LOOP; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); this->actionFunc = DmStk_ClockTower_IdleWithOcarina; } } -void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, GlobalContext* globalCtx) { +void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(11)) { ActorCutscene_Start(11, &this->actor); this->actionFunc = DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd; @@ -1216,15 +1216,15 @@ void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, GlobalContext* glo } } -void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { +void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* play) { + if (play->csCtx.state == 0) { this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); this->actionFunc = DmStk_ClockTower_Idle; } } -void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, GlobalContext* globalCtx) { +void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(10)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DAMAGE); ActorCutscene_Start(10, &this->actor); @@ -1238,8 +1238,8 @@ void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, GlobalContext* globa } } -void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != 0) && (globalCtx->csCtx.frames > 20)) { +void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, PlayState* play) { + if ((play->csCtx.state != 0) && (play->csCtx.frames > 20)) { this->actionFunc = DmStk_ClockTower_Idle; } } @@ -1247,8 +1247,8 @@ void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, GlobalContext /** * Makes Skull Kid bob up and down and face the player. */ -void DmStk_ClockTower_AdjustHeightAndRotation(DmStk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DmStk_ClockTower_AdjustHeightAndRotation(DmStk* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sin; this->bobPhase += 0x4B0; @@ -1266,21 +1266,21 @@ void DmStk_ClockTower_AdjustHeightAndRotation(DmStk* this, GlobalContext* global * Starts the deflection animation and, depending on how many times Skull Kid has been hit, * prints a message taunting the player. */ -void DmStk_ClockTower_DeflectHit(DmStk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - DmStk_ClockTower_AdjustHeightAndRotation(this, globalCtx); + DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->deflectCount++; if (this->deflectCount >= 3) { this->deflectCount = 0; if (!(player->stateFlags2 & 0x8000000)) { // That won't do you any good - Message_StartTextbox(globalCtx, 0x2013, &this->actor); + Message_StartTextbox(play, 0x2013, &this->actor); } } this->animationId = SK_ANIMATION_DEFLECT_ATTACK; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); this->actionFunc = DmStk_ClockTower_WaitForDeflectionToEnd; } @@ -1289,11 +1289,11 @@ void DmStk_ClockTower_DeflectHit(DmStk* this, GlobalContext* globalCtx) { * Resets Skull Kid back to his idle state once the deflection animation ends. * If he is hit again before the animation ends, this function will make his deflection restart. */ -void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, GlobalContext* globalCtx) { - DmStk_ClockTower_AdjustHeightAndRotation(this, globalCtx); +void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, PlayState* play) { + DmStk_ClockTower_AdjustHeightAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); this->actionFunc = DmStk_ClockTower_Idle; } @@ -1306,23 +1306,23 @@ void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, GlobalContext* globalC * Updates a variety of states based on Skull Kid's current cutscene, including his current * animation, his hand/mask type, his fade in/fade out state, and his current cutscene action. */ -void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { +void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { s32 pad; s32 actorActionIndex; - if (Cutscene_CheckActorAction(globalCtx, 107)) { - actorActionIndex = Cutscene_GetActorActionIndex(globalCtx, 107); + if (Cutscene_CheckActorAction(play, 107)) { + actorActionIndex = Cutscene_GetActorActionIndex(play, 107); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actorActionIndex]->startFrame) { - if (this->csAction != globalCtx->csCtx.actorActions[actorActionIndex]->action) { - this->csAction = globalCtx->csCtx.actorActions[actorActionIndex]->action; - if (globalCtx->sceneNum == SCENE_CLOCKTOWER) { + if (play->csCtx.frames == play->csCtx.actorActions[actorActionIndex]->startFrame) { + if (this->csAction != play->csCtx.actorActions[actorActionIndex]->action) { + this->csAction = play->csCtx.actorActions[actorActionIndex]->action; + if (play->sceneNum == SCENE_CLOCKTOWER) { this->handType = SK_HAND_TYPE_HOLDING_FLUTE; } else { this->handType = SK_HAND_TYPE_DEFAULT; } - switch (globalCtx->csCtx.actorActions[actorActionIndex]->action) { + switch (play->csCtx.actorActions[actorActionIndex]->action) { case 0: case 1: this->animationId = SK_ANIMATION_IDLE; @@ -1578,11 +1578,11 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { break; } - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actorActionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actorActionIndex); } else { this->csAction = 99; } @@ -1595,9 +1595,9 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { this->fadeInState++; } - this->fogR = globalCtx->lightCtx.unk7 * this->fogScale; - this->fogG = globalCtx->lightCtx.unk8 * this->fogScale; - this->fogB = globalCtx->lightCtx.unk9 * this->fogScale; + this->fogR = play->lightCtx.unk7 * this->fogScale; + this->fogG = play->lightCtx.unk8 * this->fogScale; + this->fogB = play->lightCtx.unk9 * this->fogScale; } else if (this->fadeInState == SK_FADE_IN_STATE_INCREASE_FOG) { if (this->fogN < 996) { this->fogN += 10; @@ -1632,7 +1632,7 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { this->alpha = 0; this->fadeOutState = SK_FADE_OUT_STATE_NONE; gSaveContext.save.weekEventReg[12] |= 4; - if (!(globalCtx->actorCtx.unk5 & 2)) { + if (!(play->actorCtx.unk5 & 2)) { Actor_MarkForDeath(&this->actor); } else { this->shouldDraw = false; @@ -1667,14 +1667,14 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { case SK_ANIMATION_LOOK_LEFT_START: case SK_ANIMATION_SNIFF: this->animationId++; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); break; case SK_ANIMATION_LOWER_MASK: this->animationId = SK_ANIMATION_IDLE; this->maskType = SK_MASK_TYPE_NORMAL; this->handType = SK_HAND_TYPE_DEFAULT; - DmStk_ChangeAnimation(this, globalCtx, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); break; } } @@ -1685,7 +1685,7 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK; } else if (((this->animationId >= SK_ANIMATION_HUDDLE_WITH_FAIRIES) && (this->animationId <= SK_ANIMATION_DRAW)) || ((this->animationId >= SK_ANIMATION_PLAY_FLUTE) && (this->animationId <= SK_ANIMATION_CARTWHEEL)) || - ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { + ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { this->maskType = SK_MASK_TYPE_NO_MASK; if ((this->animationId == SK_ANIMATION_HOLD_UP_MASK_START) || (this->animationId == SK_ANIMATION_HOLD_UP_MASK_LOOP)) { @@ -1698,12 +1698,12 @@ void DmStk_UpdateCutscenes(DmStk* this, GlobalContext* globalCtx) { } } -void DmStk_UpdateCollision(DmStk* this, GlobalContext* globalCtx) { +void DmStk_UpdateCollision(DmStk* this, PlayState* play) { s32 pad; 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); } /** @@ -1713,18 +1713,18 @@ void DmStk_UpdateCollision(DmStk* this, GlobalContext* globalCtx) { * If the player waits a while while Skull Kid is in this state, they will see a message * from Tatl telling them to hurry up and do something. */ -void DmStk_ClockTower_IdleWithOcarina(DmStk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DmStk_ClockTower_IdleWithOcarina(DmStk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state == 0) { - DmStk_ClockTower_AdjustHeightAndRotation(this, globalCtx); + if (play->csCtx.state == 0) { + DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; this->tatlMessageTimer++; if (this->tatlMessageTimer > 800) { this->tatlMessageTimer = 0; if (!(player->stateFlags2 & 0x8000000)) { // Why are you just standing around? - Message_StartTextbox(globalCtx, 0x2014, &this->actor); + Message_StartTextbox(play, 0x2014, &this->actor); } } @@ -1740,9 +1740,9 @@ void DmStk_ClockTower_IdleWithOcarina(DmStk* this, GlobalContext* globalCtx) { * has been returned to the player. * If he is hit in this state, he will just deflect the attack. */ -void DmStk_ClockTower_Idle(DmStk* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { - DmStk_ClockTower_AdjustHeightAndRotation(this, globalCtx); +void DmStk_ClockTower_Idle(DmStk* this, PlayState* play) { + if (play->csCtx.state == 0) { + DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; if (this->animationId == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { @@ -1758,7 +1758,7 @@ void DmStk_ClockTower_Idle(DmStk* this, GlobalContext* globalCtx) { } } -void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmStk_Update(Actor* thisx, PlayState* play) { DmStk* this = THIS; if (DM_STK_GET_TYPE(&this->actor) != DM_STK_TYPE_MAJORAS_MASK) { @@ -1768,7 +1768,7 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 6.0f); } - DmStk_LoadObjectForAnimation(this, globalCtx); + DmStk_LoadObjectForAnimation(this, play); if (this->animationId != SK_ANIMATION_LIE_FLAT) { SkelAnime_Update(&this->skelAnime); @@ -1776,23 +1776,22 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { this->alpha = this->alpha; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (globalCtx->sceneNum == SCENE_OKUJOU) { - DmStk_UpdateCollision(this, globalCtx); + if (play->sceneNum == SCENE_OKUJOU) { + DmStk_UpdateCollision(this, play); } - DmStk_UpdateCutscenes(this, globalCtx); - DmStk_PlaySfxForCutscenes(this, globalCtx); + DmStk_UpdateCutscenes(this, play); + DmStk_PlaySfxForCutscenes(this, play); // This handles the cutscene where the player takes out the Deku Pipes for the first time. switch (this->dekuPipesCutsceneState) { case SK_DEKU_PIPES_CS_STATE_READY: - if (func_800B8718(&this->actor, &globalCtx->state)) { + if (func_800B8718(&this->actor, &play->state)) { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_PLAYER_USED_OCARINA; } else { - func_800B874C(&this->actor, globalCtx, this->actor.xzDistToPlayer, - fabsf(this->actor.playerHeightRel)); + func_800B874C(&this->actor, play, this->actor.xzDistToPlayer, fabsf(this->actor.playerHeightRel)); } break; @@ -1807,7 +1806,7 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { break; case SK_DEKU_PIPES_CS_STATE_START: - if (globalCtx->csCtx.state == 0) { + if (play->csCtx.state == 0) { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_END; } break; @@ -1815,10 +1814,9 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { // This code is responsible for making in-game time pass while using the telescope in the Astral Observatory. // Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes. - if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.msgMode != 0) && - (globalCtx->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&globalCtx->state) && - (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && - (globalCtx->csCtx.state == 0)) { + if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && + !FrameAdvance_IsEnabled(&play->state) && (play->sceneLoadFlag == 0) && + (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15); if (REG(15) != 0) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed); @@ -1826,14 +1824,14 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { } } - if ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (globalCtx->csCtx.currentCsIndex > 0)) { - globalCtx->envCtx.unk_17 = 15; - globalCtx->envCtx.unk_18 = 15; + if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && + (play->csCtx.currentCsIndex > 0)) { + play->envCtx.unk_17 = 15; + play->envCtx.unk_18 = 15; } } -s32 DmStk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 DmStk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { DmStk* this = THIS; if (limbIndex == SKULL_KID_LIMB_RIGHT_HAND) { @@ -1864,7 +1862,7 @@ s32 DmStk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { s32 pad; s32 pad2; DmStk* this = THIS; @@ -1872,9 +1870,9 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V if (limbIndex == SKULL_KID_LIMB_HEAD) { Matrix_MultZero(&this->headPos); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((this->animationId == SK_ANIMATION_LOOK_LEFT_LOOP) || (this->animationId == SK_ANIMATION_LAUGH_LOOP) || (this->animationId == SK_ANIMATION_LAUGH_AFTER_SNIFF)) { @@ -1890,15 +1888,15 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V break; case SK_MASK_TYPE_NORMAL: - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.frames < 1400)) { + if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) && + (play->csCtx.frames < 1400)) { if (this->fogN == this->fogF) { this->fogF = this->fogN; } POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, this->fogR, this->fogG, this->fogB, this->fogA, this->fogN, this->fogF); gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); } else { gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL); } @@ -1908,36 +1906,34 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL); gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMaskEyesDL); - if (Cutscene_CheckActorAction(globalCtx, 513) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 513)]->action == 2) && + if (Cutscene_CheckActorAction(play, 513) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 513)]->action == 2) && (this->objectStk2ObjectIndex >= 0)) { Matrix_Push(); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSegments[6] = - PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectStk2ObjectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStk2ObjectIndex].segment); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objectStk2ObjectIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStk2ObjectIndex].segment); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gSkullKidMajorasMaskCurseOverlayTexAnim)); - Gfx_DrawDListOpa(globalCtx, gSkullKidMajorasMaskCurseOverlayDL); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectStkObjectIndex].segment); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gSkullKidMajorasMaskCurseOverlayTexAnim)); + Gfx_DrawDListOpa(play, gSkullKidMajorasMaskCurseOverlayDL); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objectStkObjectIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStkObjectIndex].segment); Matrix_Pop(); } break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == SKULL_KID_LIMB_RIGHT_HAND) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->handType != SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } switch (this->handType) { @@ -1954,7 +1950,7 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V case SK_HAND_TYPE_HOLDING_OCARINA: gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaHoldingRightHand); - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } break; @@ -1964,19 +1960,19 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_RotateYS(0x6142, MTXMODE_APPLY); Matrix_RotateXS(-0x1988, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL); break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == SKULL_KID_LIMB_LEFT_HAND) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); switch (this->handType) { case SK_HAND_TYPE_HOLDING_LINK_MASK_AND_FLUTE: @@ -1992,7 +1988,7 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V break; case SK_HAND_TYPE_HOLDING_OCARINA: - if ((globalCtx->sceneNum != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) { + if ((play->sceneNum != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } gSPDisplayList(POLY_OPA_DISP++, gSkullKidTwoFingersExtendedLeftHand); @@ -2014,52 +2010,52 @@ void DmStk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void DmStk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmStk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { DmStk* this = THIS; - DmStk_PostLimbDraw2(globalCtx, limbIndex, dList, rot, &this->actor, NULL); + DmStk_PostLimbDraw2(play, limbIndex, dList, rot, &this->actor, NULL); } -void DmStk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmStk_Draw(Actor* thisx, PlayState* play) { DmStk* this = THIS; if (this->shouldDraw) { if (DM_STK_GET_TYPE(&this->actor) == DM_STK_TYPE_MAJORAS_MASK) { - Gfx_DrawDListOpa(globalCtx, gSkullKidMajorasMask1DL); + Gfx_DrawDListOpa(play, gSkullKidMajorasMask1DL); return; } - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objectStkObjectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->alpha = this->alpha; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->alpha < 255) { - func_8012C2DC(globalCtx->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + func_8012C2DC(play->state.gfxCtx); + Scene_SetRenderModeXlu(play, 1, 2); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, DmStk_PostLimbDraw2, &this->actor, POLY_XLU_DISP); } else { - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmStk_OverrideLimbDraw, DmStk_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h index 4e69c1dfc4..1933c7727f 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h @@ -6,7 +6,7 @@ struct DmStk; -typedef void (*DmStkActionFunc)(struct DmStk*, GlobalContext*); +typedef void (*DmStkActionFunc)(struct DmStk*, PlayState*); #define DM_STK_GET_TYPE(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c index 6290b41e00..b74c43940e 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c @@ -10,13 +10,13 @@ #define THIS ((DmTag*)thisx) -void DmTag_Init(Actor* thisx, GlobalContext* globalCtx); -void DmTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmTag_Update(Actor* thisx, GlobalContext* globalCtx); +void DmTag_Init(Actor* thisx, PlayState* play); +void DmTag_Destroy(Actor* thisx, PlayState* play); +void DmTag_Update(Actor* thisx, PlayState* play); -void func_80C229AC(DmTag* this, GlobalContext* globalCtx); -void func_80C229EC(DmTag* this, GlobalContext* globalCtx); -void func_80C229FC(DmTag* this, GlobalContext* globalCtx); +void func_80C229AC(DmTag* this, PlayState* play); +void func_80C229EC(DmTag* this, PlayState* play); +void func_80C229FC(DmTag* this, PlayState* play); #if 0 const ActorInit Dm_Tag_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.h b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.h index 2bb9e3a5c0..6d568cd50b 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.h +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.h @@ -5,7 +5,7 @@ struct DmTag; -typedef void (*DmTagActionFunc)(struct DmTag*, GlobalContext*); +typedef void (*DmTagActionFunc)(struct DmTag*, PlayState*); typedef struct DmTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.c b/src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.c index 9ed86ba2c9..ab0aca40ef 100644 --- a/src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.c +++ b/src/overlays/actors/ovl_Dm_Tsg/z_dm_tsg.c @@ -10,10 +10,10 @@ #define THIS ((DmTsg*)thisx) -void DmTsg_Init(Actor* thisx, GlobalContext* globalCtx); -void DmTsg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmTsg_Update(Actor* thisx, GlobalContext* globalCtx); -void DmTsg_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmTsg_Init(Actor* thisx, PlayState* play); +void DmTsg_Destroy(Actor* thisx, PlayState* play); +void DmTsg_Update(Actor* thisx, PlayState* play); +void DmTsg_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Dm_Tsg_InitVars = { diff --git a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c index a4c2852334..57ef38bf66 100644 --- a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c +++ b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c @@ -10,12 +10,12 @@ #define THIS ((DmZl*)thisx) -void DmZl_Init(Actor* thisx, GlobalContext* globalCtx); -void DmZl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DmZl_Update(Actor* thisx, GlobalContext* globalCtx); -void DmZl_Draw(Actor* thisx, GlobalContext* globalCtx); +void DmZl_Init(Actor* thisx, PlayState* play); +void DmZl_Destroy(Actor* thisx, PlayState* play); +void DmZl_Update(Actor* thisx, PlayState* play); +void DmZl_Draw(Actor* thisx, PlayState* play); -void DmZl_DoNothing(DmZl* this, GlobalContext* globalCtx); +void DmZl_DoNothing(DmZl* this, PlayState* play); const ActorInit Dm_Zl_InitVars = { ACTOR_DM_ZL, @@ -108,7 +108,7 @@ void DmZl_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo animation[], u16 u animation->mode, animation->morphFrames); } -void DmZl_Init(Actor* thisx, GlobalContext* globalCtx) { +void DmZl_Init(Actor* thisx, PlayState* play) { s32 pad; DmZl* this = THIS; @@ -117,27 +117,27 @@ void DmZl_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 1000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); // these three set to NULL should mean they are dynamically allocated - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZl4Skeleton, NULL, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gZl4Skeleton, NULL, NULL, NULL, 0); DmZl_ChangeAnimation(&this->skelAnime, &sAnimations[this->animationIndex], 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmZl_DoNothing; } -void DmZl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DmZl_Destroy(Actor* thisx, PlayState* play) { } -void DmZl_DoNothing(DmZl* this, GlobalContext* globalCtx) { +void DmZl_DoNothing(DmZl* this, PlayState* play) { } -void DmZl_UpdateCutscene(DmZl* this, GlobalContext* globalCtx) { +void DmZl_UpdateCutscene(DmZl* this, PlayState* play) { s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 0x66)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 0x66); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { + if (Cutscene_CheckActorAction(play, 0x66)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x66); + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { s16 nextAnimationIndex = ZELDA_ANIM_FACING_AWAY; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { default: case 1: break; @@ -158,7 +158,7 @@ void DmZl_UpdateCutscene(DmZl* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -250,38 +250,38 @@ void DmZl_UpdateFace(DmZl* this) { } } -void DmZl_Update(Actor* thisx, GlobalContext* globalCtx) { +void DmZl_Update(Actor* thisx, PlayState* play) { DmZl* this = THIS; DmZl_UpdateFace(this); SkelAnime_Update(&this->skelAnime); - DmZl_UpdateCutscene(this, globalCtx); - this->actionFunc(this, globalCtx); + DmZl_UpdateCutscene(this, play); + this->actionFunc(this, play); } -s32 DmZl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 DmZl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void DmZl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void DmZl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { DmZl* this = THIS; if (limbIndex == ZL4_LIMB_RIGHT_HAND) { if ((this->animationIndex >= ZELDA_ANIM_GIVING_OCARINA_START) && (this->animationIndex <= ZELDA_ANIM_PLAYING_OCARINA)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gDmZl4OcarinaDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void DmZl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DmZl_Draw(Actor* thisx, PlayState* play) { DmZl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIndexRight])); @@ -289,9 +289,9 @@ void DmZl_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(sMouthTextures[this->mouthTextureIndex])); - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmZl_OverrideLimbDraw, DmZl_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h index ec3e442960..1d9a80166d 100644 --- a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h +++ b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h @@ -6,7 +6,7 @@ struct DmZl; -typedef void (*DmZlActionFunc)(struct DmZl*, GlobalContext*); +typedef void (*DmZlActionFunc)(struct DmZl*, PlayState*); typedef struct DmZl { /* 0x000 */ 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 0d1daa6b5c..4ec0706ec8 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -11,14 +11,14 @@ #define THIS ((DoorAna*)thisx) -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_GrabLink(DoorAna* this, GlobalContext* globalCtx); +void DoorAna_WaitClosed(DoorAna* this, PlayState* play); +void DoorAna_WaitOpen(DoorAna* this, PlayState* play); +void DoorAna_GrabLink(DoorAna* this, PlayState* play); const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, @@ -61,7 +61,7 @@ void DoorAna_SetupAction(DoorAna* this, DoorAnaActionFunc actionFunction) { this->actionFunc = actionFunction; } -void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Init(Actor* thisx, PlayState* play) { DoorAna* this = THIS; s32 grottoType = DOORANA_GET_TYPE(&this->actor); @@ -69,7 +69,7 @@ void DoorAna_Init(Actor* thisx, GlobalContext* globalCtx) { if (grottoType == DOORANA_TYPE_HIDDEN_STORMS || grottoType == DOORANA_TYPE_HIDDEN_BOMB) { if (grottoType == DOORANA_TYPE_HIDDEN_BOMB) { - Collider_InitAndSetCylinder(globalCtx, &this->bombCollider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->bombCollider, &this->actor, &sCylinderInit); } else { this->actor.flags |= ACTOR_FLAG_10; // always update } @@ -84,22 +84,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 = THIS; s32 grottoType = DOORANA_GET_TYPE(&this->actor); if (grottoType == DOORANA_TYPE_HIDDEN_BOMB) { - Collider_DestroyCylinder(globalCtx, &this->bombCollider); + Collider_DestroyCylinder(play, &this->bombCollider); } } -void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { s32 grottoIsOpen = false; u32 grottoType = DOORANA_GET_TYPE(&this->actor); if (grottoType == DOORANA_TYPE_HIDDEN_STORMS) { //! @bug Implementation from OoT is not updated for MM, grotto does not open on Song of Storms - if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && EnvFlags_Get(globalCtx, 5)) { + if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && EnvFlags_Get(play, 5)) { grottoIsOpen = true; this->actor.flags &= ~ACTOR_FLAG_10; // always update OFF } @@ -107,11 +107,11 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { } else { if (this->bombCollider.base.acFlags & AC_HIT) { // bomb collision grottoIsOpen = true; - Collider_DestroyCylinder(globalCtx, &this->bombCollider); + Collider_DestroyCylinder(play, &this->bombCollider); } else { Collider_UpdateCylinder(&this->actor, &this->bombCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bombCollider.base); } } @@ -121,25 +121,25 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { play_sound(NA_SE_SY_CORRECT_CHIME); } - func_800B8C50(&this->actor, globalCtx); + func_800B8C50(&this->actor, play); } -void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 grottoType = DOORANA_GET_TYPE(&this->actor); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { - if (this->actor.targetMode != 0 && globalCtx->sceneLoadFlag == 0 && globalCtx->unk_18B4A == 0 && + if (this->actor.targetMode != 0 && play->sceneLoadFlag == 0 && play->unk_18B4A == 0 && (player->stateFlags1 & 0x80000000) && player->unk_AE7 == 0) { if (grottoType == DOORANA_TYPE_VISIBLE_SCENE_EXIT) { s32 exitIndex = DOORANA_GET_EXIT_INDEX(&this->actor); - globalCtx->nextEntranceIndex = globalCtx->setupExitList[exitIndex]; + play->nextEntranceIndex = play->setupExitList[exitIndex]; } else { s32 destinationIdx = DOORANA_GET_ENTRANCE(&this->actor); - Play_SetupRespawnPoint(&globalCtx->state, RESPAWN_MODE_UNK_3, 0x4FF); + Play_SetupRespawnPoint(&play->state, RESPAWN_MODE_UNK_3, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_UNK_3].pos.y = this->actor.world.pos.y; gSaveContext.respawn[RESPAWN_MODE_UNK_3].yaw = this->actor.home.rot.y; @@ -151,12 +151,12 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { destinationIdx = DOORANA_GET_EX_ENTRANCE(&this->actor); } - globalCtx->nextEntranceIndex = sEntranceIndexes[destinationIdx]; + play->nextEntranceIndex = sEntranceIndexes[destinationIdx]; } DoorAna_SetupAction(this, DoorAna_GrabLink); - } else if (!Play_InCsMode(globalCtx) && !(player->stateFlags1 & 0x08800000) && + } else if (!Play_InCsMode(play) && !(player->stateFlags1 & 0x08800000) && (this->actor.xzDistToPlayer <= 20.0f) && (this->actor.playerHeightRel >= -50.0f) && (this->actor.playerHeightRel <= 15.0f)) { player->stateFlags1 |= 0x80000000; @@ -170,7 +170,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); } -void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { +void DoorAna_GrabLink(DoorAna* this, PlayState* play) { Player* player; s8 pad[2]; @@ -183,19 +183,19 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { } if (this->actor.playerHeightRel <= 0.0f && this->actor.xzDistToPlayer > 20.0f) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 20.0f + this->actor.world.pos.x; player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 20.0f + this->actor.world.pos.z; } } -void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorAna_Update(Actor* thisx, PlayState* play) { DoorAna* this = THIS; - this->actionFunc(this, globalCtx); - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + this->actionFunc(this, play); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); } -void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListXlu(globalCtx, gameplay_field_keep_DL_000C40); +void DoorAna_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListXlu(play, gameplay_field_keep_DL_000C40); } 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 0cff726e96..980d0140f9 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h @@ -5,7 +5,7 @@ struct DoorAna; -typedef void (*DoorAnaActionFunc)(struct DoorAna*, GlobalContext*); +typedef void (*DoorAnaActionFunc)(struct DoorAna*, PlayState*); typedef struct DoorAna { /* 0x000 */ 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 fe52a82880..8601a4bfbd 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -22,21 +22,21 @@ #define THIS ((DoorShutter*)thisx) -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorShutter_Update(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_SetupType(DoorShutter* this, GlobalContext* globalCtx); -void func_808A0F88(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1080(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1090(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1548(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1618(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1684(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1784(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1B48(DoorShutter* this, GlobalContext* globalCtx); -void func_808A1C50(DoorShutter* this, GlobalContext* globalCtx); -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorShutter_SetupType(DoorShutter* this, PlayState* play); +void func_808A0F88(DoorShutter* this, PlayState* play); +void func_808A1080(DoorShutter* this, PlayState* play); +void func_808A1090(DoorShutter* this, PlayState* play); +void func_808A1548(DoorShutter* this, PlayState* play); +void func_808A1618(DoorShutter* this, PlayState* play); +void func_808A1684(DoorShutter* this, PlayState* play); +void func_808A1784(DoorShutter* this, PlayState* play); +void func_808A1B48(DoorShutter* this, PlayState* play); +void func_808A1C50(DoorShutter* this, PlayState* play); +void DoorShutter_Draw(Actor* thisx, PlayState* play); const ActorInit Door_Shutter_InitVars = { ACTOR_DOOR_SHUTTER, @@ -137,8 +137,8 @@ void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc this->unk_167 = 0; } -s32 func_808A0900(DoorShutter* this, GlobalContext* globalCtx) { - TransitionActorEntry* transitionEntry = &globalCtx->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)]; +s32 func_808A0900(DoorShutter* this, PlayState* play) { + TransitionActorEntry* transitionEntry = &play->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)]; s8 frontRoom = transitionEntry->sides[0].room; if (frontRoom == transitionEntry->sides[1].room) { @@ -149,12 +149,12 @@ s32 func_808A0900(DoorShutter* this, GlobalContext* globalCtx) { return frontRoom == this->actor.room; } -s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { +s32 DoorShutter_SetupDoor(DoorShutter* this, PlayState* play) { ShutterObjectInfo* sp24 = &D_808A2180[this->unk_163]; s32 doorType = this->doorType; if (doorType != 4) { - if (func_808A0900(this, globalCtx)) { + if (func_808A0900(this, play)) { if ((doorType == 7) || (doorType == 6)) { doorType = 1; } else if (doorType == 5) { @@ -172,13 +172,13 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { } if (doorType == 1) { - if (!Flags_GetClear(globalCtx, this->actor.room)) { + if (!Flags_GetClear(play, this->actor.room)) { DoorShutter_SetupAction(this, func_808A0F88); this->unk_168 = 1.0f; return true; } } else if ((doorType == 2) || (doorType == 7)) { - if (!Flags_GetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor))) { + if (!Flags_GetSwitch(play, DOORSHUTTER_GET_7F(&this->actor))) { DoorShutter_SetupAction(this, func_808A1548); this->unk_168 = 1.0f; return true; @@ -194,8 +194,8 @@ s32 DoorShutter_SetupDoor(DoorShutter* this, GlobalContext* globalCtx) { return false; } -void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void DoorShutter_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; DoorShutter* this = THIS; s32 sp24; s32 i; @@ -209,7 +209,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { ShutterSceneInfo* shutterSceneInfo = &D_808A2258[0]; for (i = 0; i < ARRAY_COUNT(D_808A2258) - 1; i++, shutterSceneInfo++) { - if (globalCtx->sceneNum == shutterSceneInfo->sceneNum) { + if (play->sceneNum == shutterSceneInfo->sceneNum) { break; } } @@ -222,8 +222,7 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { BossDoorInfo* bossDoorInfo = &D_808A22A0[0]; for (i = 0; i < ARRAY_COUNT(D_808A22A0) - 1; i++, bossDoorInfo++) { - if ((globalCtx->sceneNum == bossDoorInfo->dungeonScene) || - (globalCtx->sceneNum == bossDoorInfo->bossScene)) { + if ((play->sceneNum == bossDoorInfo->dungeonScene) || (play->sceneNum == bossDoorInfo->bossScene)) { break; } } @@ -234,14 +233,14 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { } // clang-format off - objId = Object_GetIndex(&globalCtx->objectCtx, D_808A2180[sp24].objectId); this->requiredObjBankIndex = objId; if (objId < 0) { Actor_MarkForDeath(&this->actor); return; } + objId = Object_GetIndex(&play->objectCtx, D_808A2180[sp24].objectId); this->requiredObjBankIndex = objId; if (objId < 0) { Actor_MarkForDeath(&this->actor); return; } // clang-format on DoorShutter_SetupAction(this, DoorShutter_SetupType); this->unk_163 = sp24; if ((this->doorType == 4) || (this->doorType == 5)) { - if (!Flags_GetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor))) { + if (!Flags_GetSwitch(play, DOORSHUTTER_GET_7F(&this->actor))) { this->unk_166 = 10; } } @@ -249,27 +248,27 @@ void DoorShutter_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetFocus(&this->actor, 60.0f); } -void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Destroy(Actor* thisx, PlayState* play) { DoorShutter* this = THIS; if (this->actor.room >= 0) { s32 transitionActorId = DOORSHUTTER_GET_FC00(&this->actor); - globalCtx->doorCtx.transitionActorList[transitionActorId].id = - -globalCtx->doorCtx.transitionActorList[transitionActorId].id; + play->doorCtx.transitionActorList[transitionActorId].id = + -play->doorCtx.transitionActorList[transitionActorId].id; } } -void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex) && ((MREG(64) == 0) || (MREG(68) == 0))) { +void DoorShutter_SetupType(DoorShutter* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex) && ((MREG(64) == 0) || (MREG(68) == 0))) { this->actor.objBankIndex = this->requiredObjBankIndex; this->actor.draw = DoorShutter_Draw; - DoorShutter_SetupDoor(this, globalCtx); + DoorShutter_SetupDoor(this, play); } } -f32 func_808A0D90(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { - Player* player = GET_PLAYER(globalCtx); +f32 func_808A0D90(PlayState* play, DoorShutter* this, f32 arg2, f32 arg3, f32 arg4) { + Player* player = GET_PLAYER(play); Vec3f sp28; Vec3f sp1C; @@ -285,12 +284,12 @@ f32 func_808A0D90(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg return sp1C.z; } -s32 func_808A0E28(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808A0E28(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(&globalCtx->state)) { + if (!Player_InCsMode(&play->state)) { ShutterInfo* shutterInfo = &D_808A21B0[this->unk_164]; - f32 temp_f0 = func_808A0D90(globalCtx, this, 0.0f, shutterInfo->unk_0A, shutterInfo->unk_0B); + f32 temp_f0 = func_808A0D90(play, this, 0.0f, shutterInfo->unk_0A, shutterInfo->unk_0B); if (fabsf(temp_f0) < 50.0f) { s16 temp_v0_2 = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); @@ -307,8 +306,8 @@ s32 func_808A0E28(DoorShutter* this, GlobalContext* globalCtx) { return false; } -void func_808A0F88(DoorShutter* this, GlobalContext* globalCtx) { - if (Flags_GetClear(globalCtx, this->actor.room) || Flags_GetClearTemp(globalCtx, this->actor.room)) { +void func_808A0F88(DoorShutter* this, PlayState* play) { + if (Flags_GetClear(play, this->actor.room) || Flags_GetClearTemp(play, this->actor.room)) { this->unk_160 = this->actor.cutscene; if (this->doorType == 7) { if (this->unk_160 != -1) { @@ -318,14 +317,14 @@ void func_808A0F88(DoorShutter* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->unk_160)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_160, &this->actor); - Flags_SetClear(globalCtx, this->actor.room); + Flags_SetClear(play, this->actor.room); DoorShutter_SetupAction(this, func_808A1784); this->unk_167 = -1; } else { ActorCutscene_SetIntentToPlay(this->unk_160); } - } else if (func_808A0E28(this, globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_808A0E28(this, play)) { + Player* player = GET_PLAYER(play); player->doorType = -1; player->doorActor = &this->actor; @@ -334,15 +333,15 @@ void func_808A0F88(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_808A1080(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1080(DoorShutter* this, PlayState* play) { } -void func_808A1090(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1090(DoorShutter* this, PlayState* play) { if (this->unk_15C != 0) { DoorShutter_SetupAction(this, func_808A1684); this->actor.velocity.y = 0.0f; if (this->unk_166 != 0) { - Flags_SetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor)); + Flags_SetSwitch(play, DOORSHUTTER_GET_7F(&this->actor)); if (this->doorType != 5) { gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); @@ -351,10 +350,10 @@ void func_808A1090(DoorShutter* this, GlobalContext* globalCtx) { } } } else { - s32 doorDirection = func_808A0E28(this, globalCtx); + s32 doorDirection = func_808A0E28(this, play); if (doorDirection != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->doorType = 2; player->doorDirection = doorDirection; @@ -390,13 +389,13 @@ void func_808A1090(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_808A1288(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1288(DoorShutter* this, PlayState* play) { if (this->actor.category == ACTORCAT_DOOR) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp38 = this->unk_164; s32 sp34 = 0xF; - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { sp34 = 0x20; } @@ -405,15 +404,15 @@ void func_808A1288(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = sp38; this->unk_168 = 0.0f; - func_800DFFAC(globalCtx->cameraPtrs[CAM_ID_MAIN], &this->actor, player->unk_3BA, this->unk_168, 12, sp34, 10); + func_800DFFAC(play->cameraPtrs[CAM_ID_MAIN], &this->actor, player->unk_3BA, this->unk_168, 12, sp34, 10); } } -s32 func_808A1340(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_808A1340(DoorShutter* this, PlayState* play) { Vec3f sp2C; if (this->actor.velocity.y == 0.0f) { - func_808A1288(this, globalCtx); + func_808A1288(this, play); if (this->unk_163 != 7) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIDE_DOOR_OPEN); } @@ -443,7 +442,7 @@ s32 func_808A1340(DoorShutter* this, GlobalContext* globalCtx) { return false; } -s32 func_808A1478(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { +s32 func_808A1478(DoorShutter* this, PlayState* play, f32 arg2) { f32 temp = 1.0f - arg2; if (temp == this->unk_168) { @@ -454,7 +453,7 @@ s32 func_808A1478(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { } if ((this->unk_160 != -1) && (ActorCutscene_GetCurrentIndex() == this->unk_160)) { - func_800B724C(globalCtx, &this->actor, 1); + func_800B724C(play, &this->actor, 1); } } @@ -464,9 +463,9 @@ s32 func_808A1478(DoorShutter* this, GlobalContext* globalCtx, f32 arg2) { return false; } -void func_808A1548(DoorShutter* this, GlobalContext* globalCtx) { - if (func_808A1478(this, globalCtx, 1.0f)) { - if (Flags_GetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor))) { +void func_808A1548(DoorShutter* this, PlayState* play) { + if (func_808A1478(this, play, 1.0f)) { + if (Flags_GetSwitch(play, DOORSHUTTER_GET_7F(&this->actor))) { this->unk_160 = this->actor.cutscene; if (ActorCutscene_GetCanPlayNext(this->unk_160)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_160, &this->actor); @@ -475,8 +474,8 @@ void func_808A1548(DoorShutter* this, GlobalContext* globalCtx) { } else { ActorCutscene_SetIntentToPlay(this->unk_160); } - } else if (func_808A0E28(this, globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + } else if (func_808A0E28(this, play)) { + Player* player = GET_PLAYER(play); player->doorType = -1; player->doorActor = &this->actor; @@ -486,18 +485,18 @@ void func_808A1548(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_808A1618(DoorShutter* this, GlobalContext* globalCtx) { - if ((this->unk_15C == 0) && !Flags_GetSwitch(globalCtx, DOORSHUTTER_GET_7F(&this->actor))) { +void func_808A1618(DoorShutter* this, PlayState* play) { + if ((this->unk_15C == 0) && !Flags_GetSwitch(play, DOORSHUTTER_GET_7F(&this->actor))) { DoorShutter_SetupAction(this, func_808A1548); } else { - func_808A1090(this, globalCtx); + func_808A1090(this, play); } } -void func_808A1684(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1684(DoorShutter* this, PlayState* play) { f32 phi_f0; - if ((DECR(this->unk_166) == 0) && (globalCtx->roomCtx.unk31 == 0) && func_808A1340(this, globalCtx)) { + if ((DECR(this->unk_166) == 0) && (play->roomCtx.unk31 == 0) && func_808A1340(this, play)) { if (this->doorType == 5) { phi_f0 = 20.0f; } else { @@ -508,7 +507,7 @@ void func_808A1684(DoorShutter* this, GlobalContext* globalCtx) { if (this->unk_163 == 7) { this->actor.velocity.y = 0.0f; } else { - if (DoorShutter_SetupDoor(this, globalCtx)) { + if (DoorShutter_SetupDoor(this, play)) { this->actor.velocity.y = 30.0f; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIDE_DOOR_CLOSE); @@ -518,22 +517,22 @@ void func_808A1684(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_808A1784(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1784(DoorShutter* this, PlayState* play) { if (this->unk_167 != 0) { if (func_800F22C4(this->unk_160, &this->actor)) { if (this->unk_167 < 0) { - if ((globalCtx->state.frames % 2) != 0) { + if ((play->state.frames % 2) != 0) { this->unk_167++; } } else { this->unk_167--; } } - } else if (func_808A1478(this, globalCtx, 0.0f)) { + } else if (func_808A1478(this, play, 0.0f)) { u8 doorType = this->doorType; if ((doorType != 0) && (doorType != 1) && - (((doorType != 7) && (doorType != 6)) || !func_808A0900(this, globalCtx))) { + (((doorType != 7) && (doorType != 6)) || !func_808A0900(this, play))) { DoorShutter_SetupAction(this, func_808A1618); } else { DoorShutter_SetupAction(this, func_808A1090); @@ -542,37 +541,36 @@ void func_808A1784(DoorShutter* this, GlobalContext* globalCtx) { } } -void func_808A1884(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808A1884(DoorShutter* this, PlayState* play) { + Player* player = GET_PLAYER(play); s8 room = this->actor.room; Vec3f sp44; if (this->actor.room >= 0) { Actor_OffsetOfPointInActorCoords(&this->actor, &sp44, &player->actor.world.pos); - this->actor.room = globalCtx->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)] - .sides[(sp44.z < 0.0f) ? 0 : 1] - .room; + this->actor.room = + play->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)].sides[(sp44.z < 0.0f) ? 0 : 1].room; if (room != this->actor.room) { - Room temp = globalCtx->roomCtx.currRoom; + Room temp = play->roomCtx.currRoom; - globalCtx->roomCtx.currRoom = globalCtx->roomCtx.prevRoom; - globalCtx->roomCtx.prevRoom = temp; - globalCtx->roomCtx.activeMemPage ^= 1; + play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.prevRoom = temp; + play->roomCtx.activeMemPage ^= 1; } - func_8012EBF8(globalCtx, &globalCtx->roomCtx); + func_8012EBF8(play, &play->roomCtx); } this->unk_15C = 0; this->actor.velocity.y = 0.0f; - if (DoorShutter_SetupDoor(this, globalCtx) && !(player->stateFlags1 & 0x800)) { + if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & 0x800)) { DoorShutter_SetupAction(this, func_808A1C50); if (ActorCutscene_GetCurrentIndex() == 0x7D) { - func_801226E0(globalCtx, ((void)0, gSaveContext.respawn[RESTART_MODE_DOWN].data)); + func_801226E0(play, ((void)0, gSaveContext.respawn[RESTART_MODE_DOWN].data)); player->unk_A86 = -1; - func_800B7298(globalCtx, NULL, 0x73); + func_800B7298(play, NULL, 0x73); } } } @@ -600,39 +598,39 @@ s32 func_808A1A70(DoorShutter* this) { return false; } -void func_808A1B48(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1B48(DoorShutter* this, PlayState* play) { s16 quake; if (func_808A1A70(this)) { if (this->actor.velocity.y > 20.0f) { this->actor.floorHeight = this->actor.home.pos.y; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND); - quake = Quake_Add(Play_GetCamera(globalCtx, 0), 3); + quake = Quake_Add(Play_GetCamera(play, 0), 3); Quake_SetSpeed(quake, -32536); Quake_SetQuakeValues(quake, 2, 0, 0, 0); Quake_SetCountdown(quake, 10); func_8013ECE0(this->actor.xyzDistToPlayerSq, 180, 20, 100); - func_808A1884(this, globalCtx); + func_808A1884(this, play); } } -void func_808A1C50(DoorShutter* this, GlobalContext* globalCtx) { +void func_808A1C50(DoorShutter* this, PlayState* play) { if (this->unk_167++ > 30) { - if (GET_PLAYER(globalCtx)->csMode == 0x73) { - func_800B7298(globalCtx, NULL, 6); + if (GET_PLAYER(play)->csMode == 0x73) { + func_800B7298(play, NULL, 6); } - DoorShutter_SetupDoor(this, globalCtx); + DoorShutter_SetupDoor(this, play); } } -void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x100004C0) || (this->actionFunc == DoorShutter_SetupType)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_163 == 7) { this->actor.home.rot.z = Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) * -100.0f; @@ -640,15 +638,15 @@ void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_808A1D68(DoorShutter* this, GlobalContext* globalCtx) { +s32 func_808A1D68(DoorShutter* this, PlayState* play) { s32 temp_a0; s32 temp_a1; - if (Player_InCsMode(&globalCtx->state)) { + if (Player_InCsMode(&play->state)) { return true; } - temp_a0 = BINANG_SUB(Actor_YawToPoint(&this->actor, &globalCtx->view.eye), this->actor.shape.rot.y); + temp_a0 = BINANG_SUB(Actor_YawToPoint(&this->actor, &play->view.eye), this->actor.shape.rot.y); temp_a1 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); temp_a0 = ABS_ALT(temp_a0); @@ -660,17 +658,17 @@ s32 func_808A1D68(DoorShutter* this, GlobalContext* globalCtx) { return true; } -void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorShutter_Draw(Actor* thisx, PlayState* play) { s32 pad; DoorShutter* this = THIS; ShutterInfo* sp44; - if (func_808A1D68(this, globalCtx)) { + if (func_808A1D68(this, play)) { sp44 = &D_808A21B0[this->unk_164]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_164 == 7) { Matrix_Translate(0.0f, 64.96f, 0.0f, MTXMODE_APPLY); @@ -680,11 +678,11 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { if (sp44->unk_04 != 0) { TransitionActorEntry* transitionEntry = - &globalCtx->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)]; + &play->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)]; - if ((globalCtx->roomCtx.prevRoom.num >= 0) || + if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { - s16 yaw = this->actor.shape.rot.y - Math_Vec3f_Yaw(&globalCtx->view.eye, &this->actor.world.pos); + s16 yaw = this->actor.shape.rot.y - Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); if (ABS_ALT(yaw) < 0x4000) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); @@ -696,22 +694,21 @@ void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808A22DC[this->unk_15E])); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp44->unk_00); if ((this->unk_168 != 0.0f) && (sp44->unk_04 != 0)) { Matrix_Translate(0.0f, sp44->unk_08 * (1.0f - this->unk_168), sp44->translateZ, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp44->unk_04); } if (this->unk_166 != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); - Actor_DrawDoorLock(globalCtx, this->unk_166, (this->doorType == 5) ? DOORLOCK_BOSS : DOORLOCK_NORMAL); + Actor_DrawDoorLock(play, this->unk_166, (this->doorType == 5) ? DOORLOCK_BOSS : DOORLOCK_NORMAL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 0b796d442f..78861d55c9 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -5,7 +5,7 @@ struct DoorShutter; -typedef void (*DoorShutterActionFunc)(struct DoorShutter*, GlobalContext*); +typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); #define DOORSHUTTER_GET_1F(thisx) ((thisx)->params & 0x1F) #define DOORSHUTTER_GET_7F(thisx) ((thisx)->params & 0x7F) diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index a2bc8a0be8..1d9c72ccbe 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -62,14 +62,14 @@ typedef struct { /* 0x02 */ u8 objectType; } SpiralSceneInfo; -void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx); -void DoorSpiral_Destroy(Actor* thisx, GlobalContext* globalCtx); -void DoorSpiral_Update(Actor* thisx, GlobalContext* globalCtx); -void DoorSpiral_Draw(Actor* thisx, GlobalContext* globalCtx); +void DoorSpiral_Init(Actor* thisx, PlayState* play); +void DoorSpiral_Destroy(Actor* thisx, PlayState* play); +void DoorSpiral_Update(Actor* thisx, PlayState* play); +void DoorSpiral_Draw(Actor* thisx, PlayState* play); -void DoorSpiral_WaitForObject(DoorSpiral* this, GlobalContext* globalCtx); -void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx); -void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx); +void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play); +void DoorSpiral_Wait(DoorSpiral* this, PlayState* play); +void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play); const ActorInit Door_Spiral_InitVars = { ACTOR_DOOR_SPIRAL, @@ -114,13 +114,13 @@ void DoorSpiral_SetupAction(DoorSpiral* this, DoorSpiralActionFunc actionFunc) { /** * Sets this->spiralType, which is derived from `sSpiralObjectInfo`, and is used as an index to `sSpiralInfo`. */ -s32 DoorSpiral_SetSpiralType(DoorSpiral* this, GlobalContext* globalCtx) { +s32 DoorSpiral_SetSpiralType(DoorSpiral* this, PlayState* play) { SpiralObjectInfo* doorObjectInfo = &sSpiralObjectInfo[this->objectType]; this->spiralType = doorObjectInfo->spiralType; if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && globalCtx->roomCtx.currRoom.enablePosLights)) { + ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.currRoom.enablePosLights)) { if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; } @@ -138,7 +138,7 @@ s32 DoorSpiral_SetSpiralType(DoorSpiral* this, GlobalContext* globalCtx) { * It first checks `sSpiralSceneInfo`, but if the current scene is not found it will fall back to the default spiral * (overworld or dungeon). */ -s32 DoorSpiral_GetObjectType(GlobalContext* globalCtx) { +s32 DoorSpiral_GetObjectType(PlayState* play) { // Defines which object type should be used for specific scenes static SpiralSceneInfo spiralSceneInfo[] = { { SCENE_MITURIN, SPIRAL_OBJECT_WOODFALL }, { SCENE_HAKUGIN, SPIRAL_OBJECT_SNOWHEAD }, @@ -151,7 +151,7 @@ s32 DoorSpiral_GetObjectType(GlobalContext* globalCtx) { s32 type; for (i = 0; i < ARRAY_COUNT(spiralSceneInfo); sceneInfo++, i++) { - if (globalCtx->sceneNum == sceneInfo->sceneNum) { + if (play->sceneNum == sceneInfo->sceneNum) { break; } } @@ -162,8 +162,8 @@ s32 DoorSpiral_GetObjectType(GlobalContext* globalCtx) { type = sceneInfo->objectType; } else { // Set the type based on if link is in a dungeon scene, or the overworld - type = (Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_DANGEON_KEEP) >= 0) ? SPIRAL_OBJECT_DUNGEON - : SPIRAL_OBJECT_OVERWORLD; + type = (Object_GetIndex(&play->objectCtx, GAMEPLAY_DANGEON_KEEP) >= 0) ? SPIRAL_OBJECT_DUNGEON + : SPIRAL_OBJECT_OVERWORLD; } return type; @@ -176,13 +176,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), }; -void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorSpiral_Init(Actor* thisx, PlayState* play) { DoorSpiral* this = THIS; s32 pad; s32 transition = GET_TRANSITION_ID_PARAM(thisx); s8 objBankId; - if (this->actor.room != globalCtx->doorCtx.transitionActorList[transition].sides[0].room) { + if (this->actor.room != play->doorCtx.transitionActorList[transition].sides[0].room) { Actor_MarkForDeath(&this->actor); return; } @@ -190,8 +190,8 @@ void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); this->unk145 = GET_UNK145_PARAM(thisx); // set but never used this->orientation = GET_ORIENTATION_PARAM(thisx); - this->objectType = DoorSpiral_GetObjectType(globalCtx); - objBankId = Object_GetIndex(&globalCtx->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId); + this->objectType = DoorSpiral_GetObjectType(play); + objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId); this->bankIndex = objBankId; if (objBankId < 0) { @@ -203,28 +203,27 @@ void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 60.0f); } -void DoorSpiral_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorSpiral_Destroy(Actor* thisx, PlayState* play) { s32 transition = GET_TRANSITION_ID_PARAM(thisx); - globalCtx->doorCtx.transitionActorList[transition].id *= -1; + play->doorCtx.transitionActorList[transition].id *= -1; } /** * Waits for the required object to be loaded. */ -void DoorSpiral_WaitForObject(DoorSpiral* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { +void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - DoorSpiral_SetSpiralType(this, globalCtx); + DoorSpiral_SetSpiralType(this, play); } } /** * Finds the distance between the stairs and the player. */ -f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 yOffset, f32 spiralWidth, - f32 spiralHeight) { - Player* player = GET_PLAYER(globalCtx); +f32 DoorSpiral_GetDistFromPlayer(PlayState* play, DoorSpiral* this, f32 yOffset, f32 spiralWidth, f32 spiralHeight) { + Player* player = GET_PLAYER(play); Vec3f target; Vec3f offset; @@ -244,13 +243,12 @@ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 /** * Checks if the player should climb the stairs. */ -s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Player_InCsMode(&globalCtx->state)) { + if (!Player_InCsMode(&play->state)) { SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; - f32 dist = - DoorSpiral_GetDistFromPlayer(globalCtx, this, 0.0f, spiralInfo->spiralWidth, spiralInfo->spiralHeight); + f32 dist = DoorSpiral_GetDistFromPlayer(play, this, 0.0f, spiralInfo->spiralWidth, spiralInfo->spiralHeight); if (fabsf(dist) < 64.0f) { s16 angle = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -271,20 +269,20 @@ s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) { /** * Wait for the player to interact with the stairs. */ -void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { +void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) { Player* player; s32 transition; if (this->shouldClimb) { DoorSpiral_SetupAction(this, DoorSpiral_PlayerClimb); - } else if (DoorSpiral_PlayerShouldClimb(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + } else if (DoorSpiral_PlayerShouldClimb(this, play)) { + player = GET_PLAYER(play); player->doorType = 4; player->doorDirection = this->orientation; player->doorActor = &this->actor; transition = GET_TRANSITION_ID_PARAM(this); - player->doorNext = ((u16)globalCtx->doorCtx.transitionActorList[transition].params) >> 10; + player->doorNext = ((u16)play->doorCtx.transitionActorList[transition].params) >> 10; func_80122F28(player); } @@ -293,8 +291,8 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { /** * Player is climbing the stairs. */ -void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x20000000)) { DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); @@ -302,17 +300,17 @@ void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) { } } -void DoorSpiral_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorSpiral_Update(Actor* thisx, PlayState* play) { DoorSpiral* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((!(player->stateFlags1 & 0x100004C0)) || (this->actionFunc == DoorSpiral_WaitForObject)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void DoorSpiral_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorSpiral_Draw(Actor* thisx, PlayState* play) { s32 pad; DoorSpiral* this = THIS; @@ -324,15 +322,14 @@ void DoorSpiral_Draw(Actor* thisx, GlobalContext* globalCtx) { dList = spiralInfo->spiralDL[this->orientation]; if (dList != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, spiralInfo->spiralDL[this->orientation]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h index cf191949ab..207765e383 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h @@ -5,7 +5,7 @@ struct DoorSpiral; -typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, GlobalContext*); +typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*); typedef struct DoorSpiral { /* 0x000 */ Actor actor; 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 6217361f2d..a848f878ec 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -11,40 +11,40 @@ #define THIS ((DoorWarp1*)thisx) -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_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc); -void func_808B8924(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B8A7C(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B8C48(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B8E78(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9094(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B90CC(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B921C(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B93A0(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B94A4(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9524(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B958C(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B96A0(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B96B0(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B977C(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9840(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B98A8(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9B30(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9BE8(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9CE8(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9E94(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9ED8(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9F10(DoorWarp1* this, GlobalContext* globalCtx); -void func_808B9FD0(DoorWarp1* this, GlobalContext* globalCtx); -void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx); -void func_808BA550(DoorWarp1* this, GlobalContext* globalCtx); -void func_808BAAF4(DoorWarp1* this, GlobalContext* globalCtx); -void func_808BABF4(DoorWarp1* this, GlobalContext* globalCtx); -void func_808BB8D4(DoorWarp1* this, GlobalContext* globalCtx, s32 arg2); +void func_808B8924(DoorWarp1* this, PlayState* play); +void func_808B8A7C(DoorWarp1* this, PlayState* play); +void func_808B8C48(DoorWarp1* this, PlayState* play); +void func_808B8E78(DoorWarp1* this, PlayState* play); +void func_808B9094(DoorWarp1* this, PlayState* play); +void func_808B90CC(DoorWarp1* this, PlayState* play); +void func_808B921C(DoorWarp1* this, PlayState* play); +void func_808B93A0(DoorWarp1* this, PlayState* play); +void func_808B94A4(DoorWarp1* this, PlayState* play); +void func_808B9524(DoorWarp1* this, PlayState* play); +void func_808B958C(DoorWarp1* this, PlayState* play); +void func_808B96A0(DoorWarp1* this, PlayState* play); +void func_808B96B0(DoorWarp1* this, PlayState* play); +void func_808B977C(DoorWarp1* this, PlayState* play); +void func_808B9840(DoorWarp1* this, PlayState* play); +void func_808B98A8(DoorWarp1* this, PlayState* play); +void func_808B9B30(DoorWarp1* this, PlayState* play); +void func_808B9BE8(DoorWarp1* this, PlayState* play); +void func_808B9CE8(DoorWarp1* this, PlayState* play); +void func_808B9E94(DoorWarp1* this, PlayState* play); +void func_808B9ED8(DoorWarp1* this, PlayState* play); +void func_808B9F10(DoorWarp1* this, PlayState* play); +void func_808B9FD0(DoorWarp1* this, PlayState* play); +void func_808BA10C(DoorWarp1* this, PlayState* play); +void func_808BA550(DoorWarp1* this, PlayState* play); +void func_808BAAF4(DoorWarp1* this, PlayState* play); +void func_808BABF4(DoorWarp1* this, PlayState* play); +void func_808BB8D4(DoorWarp1* this, PlayState* play, s32 arg2); static s16 D_808BC000; static f32 D_808BC004; @@ -72,34 +72,34 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { this->actionFunc = actionFunc; } -s32 func_808B849C(DoorWarp1* this, GlobalContext* globalCtx) { +s32 func_808B849C(DoorWarp1* this, PlayState* play) { s32 ret = 0; - if ((globalCtx->sceneNum == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { + if ((play->sceneNum == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { ret = 1; - } else if ((globalCtx->sceneNum == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { + } else if ((play->sceneNum == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { ret = 2; - } else if ((globalCtx->sceneNum == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { + } else if ((play->sceneNum == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { ret = 3; - } else if ((globalCtx->sceneNum == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { + } else if ((play->sceneNum == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { ret = 4; } return ret; } -void func_808B8568(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B8568(DoorWarp1* this, PlayState* play) { s32 pad[2]; Lights_PointNoGlowSetInfo(&this->unk_1E0, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, 0); - this->unk_1DC = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->unk_1E0); + this->unk_1DC = LightContext_InsertLight(play, &play->lightCtx, &this->unk_1E0); Lights_PointNoGlowSetInfo(&this->unk_1F4, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, 0); - this->unk_1F0 = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->unk_1F4); + this->unk_1F0 = LightContext_InsertLight(play, &play->lightCtx, &this->unk_1F4); } -s32 func_808B866C(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808B866C(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; if ((fabsf(this->dyna.actor.xzDistToPlayer) < 60.0f) && @@ -110,7 +110,7 @@ s32 func_808B866C(DoorWarp1* this, GlobalContext* globalCtx) { return ret; } -void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Init(Actor* thisx, PlayState* play) { DoorWarp1* this = THIS; this->unk_1CC = 0; @@ -133,17 +133,17 @@ void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { case ENDOORWARP1_FF_3: case ENDOORWARP1_FF_4: case ENDOORWARP1_FF_5: - func_808B8568(this, globalCtx); + func_808B8568(this, play); break; } switch (DOORWARP1_GET_FF(&this->dyna.actor)) { case ENDOORWARP1_FF_0: - func_808B8924(this, globalCtx); + func_808B8924(this, play); break; case ENDOORWARP1_FF_1: - func_808B8A7C(this, globalCtx); + func_808B8A7C(this, play); break; case ENDOORWARP1_FF_2: @@ -152,43 +152,43 @@ void DoorWarp1_Init(Actor* thisx, GlobalContext* globalCtx) { case ENDOORWARP1_FF_5: this->unk_1D3 = 1; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_warp1_Colheader_008BD4); - func_808B8C48(this, globalCtx); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_warp1_Colheader_008BD4); + func_808B8C48(this, play); break; case ENDOORWARP1_FF_6: - func_808B8E78(this, globalCtx); + func_808B8E78(this, play); break; } - if ((globalCtx->sceneNum == SCENE_MITURIN_BS) || (globalCtx->sceneNum == SCENE_HAKUGIN_BS) || - (globalCtx->sceneNum == SCENE_INISIE_BS) || (globalCtx->sceneNum == SCENE_SEA_BS)) { + if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || + (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { func_800FE484(); - globalCtx->interfaceCtx.restrictions.unk_312 = 1; - globalCtx->interfaceCtx.restrictions.songOfSoaring = 1; + play->interfaceCtx.restrictions.unk_312 = 1; + play->interfaceCtx.restrictions.songOfSoaring = 1; } } -void DoorWarp1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Destroy(Actor* thisx, PlayState* play) { s32 pad; DoorWarp1* this = THIS; s16 i; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->unk_1DC); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->unk_1F0); + LightContext_RemoveLight(play, &play->lightCtx, this->unk_1DC); + LightContext_RemoveLight(play, &play->lightCtx, this->unk_1F0); - for (i = 0; i < ARRAY_COUNT(globalCtx->envCtx.lightSettings.diffuseColor1); i++) { - globalCtx->envCtx.lightSettings.diffuseColor1[i] = 0; - globalCtx->envCtx.lightSettings.fogColor[i] = globalCtx->envCtx.lightSettings.diffuseColor1[i]; - globalCtx->envCtx.lightSettings.ambientColor[i] = globalCtx->envCtx.lightSettings.diffuseColor1[i]; + for (i = 0; i < ARRAY_COUNT(play->envCtx.lightSettings.diffuseColor1); i++) { + play->envCtx.lightSettings.diffuseColor1[i] = 0; + play->envCtx.lightSettings.fogColor[i] = play->envCtx.lightSettings.diffuseColor1[i]; + play->envCtx.lightSettings.ambientColor[i] = play->envCtx.lightSettings.diffuseColor1[i]; } if (this->unk_1D3 != 0) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_808B8924(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B8924(DoorWarp1* this, PlayState* play) { this->unk_1C4 = 0; this->unk_1C6 = -140; this->unk_1C8 = -80; @@ -209,8 +209,8 @@ void func_808B8924(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, func_808B96B0); } -void func_808B8A7C(DoorWarp1* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &object_warp1_Skel_002CA8, &object_warp1_Anim_001374, NULL, NULL, 0); +void func_808B8A7C(DoorWarp1* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &object_warp1_Skel_002CA8, &object_warp1_Anim_001374, NULL, NULL, 0); Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, 1.0f, 1.0f, 2, 40.0f, 1); this->unk_1C4 = 0; this->unk_1C6 = -140; @@ -232,7 +232,7 @@ void func_808B8A7C(DoorWarp1* this, GlobalContext* globalCtx) { DoorWarp1_SetupAction(this, func_808B9B30); } -void func_808B8C48(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B8C48(DoorWarp1* this, PlayState* play) { this->dyna.actor.shape.yOffset = 0.0f; Actor_SetScale(&this->dyna.actor, 0.1f); Lights_PointNoGlowSetInfo(&this->unk_1E0, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, @@ -246,17 +246,17 @@ void func_808B8C48(DoorWarp1* this, GlobalContext* globalCtx) { s16 params = DOORWARP1_GET_FF00_2(&this->dyna.actor); params |= 6; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_DOOR_WARP1, - this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 10.0f, - this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, - this->dyna.actor.world.rot.z, params); + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DOOR_WARP1, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y + 10.0f, this->dyna.actor.world.pos.z, + this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, + params); DoorWarp1_SetupAction(this, func_808BAAF4); } else { DoorWarp1_SetupAction(this, func_808BABF4); } } -void func_808B8E78(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B8E78(DoorWarp1* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, 0.1f); Lights_PointNoGlowSetInfo(&this->unk_1E0, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 200, 255, 255, 0); @@ -268,7 +268,7 @@ void func_808B8E78(DoorWarp1* this, GlobalContext* globalCtx) { this->unk_1A8 = 0.0f; this->unk_1AC = 0.0f; this->unk_1A4 = 700.0f; - if (globalCtx->sceneNum == SCENE_INISIE_N) { + if (play->sceneNum == SCENE_INISIE_N) { DoorWarp1_SetupAction(this, func_808B96A0); } else if (gSaveContext.save.weekEventReg[86] & 0x80) { this->unk_1D4 = 0; @@ -278,16 +278,16 @@ void func_808B8E78(DoorWarp1* this, GlobalContext* globalCtx) { } } -s32 func_808B900C(DoorWarp1* this, GlobalContext* globalCtx) { +s32 func_808B900C(DoorWarp1* this, PlayState* play) { s32 index; u8 ret = false; - if (Cutscene_CheckActorAction(globalCtx, 569)) { - index = Cutscene_GetActorActionIndex(globalCtx, 569); + if (Cutscene_CheckActorAction(play, 569)) { + index = Cutscene_GetActorActionIndex(play, 569); - if (this->unk_208 != globalCtx->csCtx.actorActions[index]->action) { - this->unk_208 = globalCtx->csCtx.actorActions[index]->action; - if (globalCtx->csCtx.actorActions[index]->action == 2) { + if (this->unk_208 != play->csCtx.actorActions[index]->action) { + this->unk_208 = play->csCtx.actorActions[index]->action; + if (play->csCtx.actorActions[index]->action == 2) { ret = true; } } @@ -296,30 +296,30 @@ s32 func_808B900C(DoorWarp1* this, GlobalContext* globalCtx) { return ret; } -void func_808B9094(DoorWarp1* this, GlobalContext* globalCtx) { - if (func_808B900C(this, globalCtx)) { +void func_808B9094(DoorWarp1* this, PlayState* play) { + if (func_808B900C(this, play)) { DoorWarp1_SetupAction(this, func_808B90CC); } } -void func_808B90CC(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B90CC(DoorWarp1* this, PlayState* play) { s32 pad[2]; s16 sp2E = 0; f32 phi_f0 = 0.0f; - if (globalCtx->sceneNum == SCENE_MITURIN) { + if (play->sceneNum == SCENE_MITURIN) { sp2E = -10; phi_f0 = -5.0f; - } else if (globalCtx->sceneNum == SCENE_HAKUGIN) { + } else if (play->sceneNum == SCENE_HAKUGIN) { sp2E = -20; - } else if (globalCtx->sceneNum == SCENE_SEA) { + } else if (play->sceneNum == SCENE_SEA) { sp2E = -20; } Math_SmoothStepToF(&this->unk_1AC, 40.0f, 0.5f, 1.2f + phi_f0, 0.01f); Math_SmoothStepToF(&this->unk_1A4, 0.0f, 0.5f, 12.0f, 0.1f); if ((this->unk_1A4 < 460.0f) && (this->unk_1A4 > 100.0f)) { - func_808BB8D4(this, globalCtx, 6); + func_808BB8D4(this, play, 6); } if (this->unk_1A4 < 0.1f) { @@ -331,7 +331,7 @@ void func_808B90CC(DoorWarp1* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE_ENERGY - SFX_FLAG); } -void func_808B921C(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B921C(DoorWarp1* this, PlayState* play) { if (this->unk_1D0 != 0) { this->unk_1D0--; return; @@ -340,62 +340,62 @@ void func_808B921C(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_1A8, 1.0f, 0.2f, 0.05f, 0.01f); this->unk_203 = (u8)(this->unk_1A8 * 200.0f); if (this->unk_1A8 > 0.8f) { - func_808BB8D4(this, globalCtx, 1); + func_808BB8D4(this, play, 1); } - if (func_808B866C(this, globalCtx) && !Play_InCsMode(globalCtx)) { - func_800B7298(globalCtx, &this->dyna.actor, 7); - Message_StartTextbox(globalCtx, 0xF2, &this->dyna.actor); + if (func_808B866C(this, play) && !Play_InCsMode(play)) { + func_800B7298(play, &this->dyna.actor, 7); + Message_StartTextbox(play, 0xF2, &this->dyna.actor); DoorWarp1_SetupAction(this, func_808B93A0); } Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } -void func_808B93A0(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B93A0(DoorWarp1* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (Message_GetState(&globalCtx->msgCtx) == 4 && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_GetState(&play->msgCtx) == 4 && Message_ShouldAdvance(play)) { + func_801477B4(play); + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - func_800B7298(globalCtx, &this->dyna.actor, 9); + func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 1; DoorWarp1_SetupAction(this, func_808B9524); } else { func_8019F230(); - func_800B7298(globalCtx, &this->dyna.actor, 6); + func_800B7298(play, &this->dyna.actor, 6); DoorWarp1_SetupAction(this, func_808B94A4); } } - func_808BB8D4(this, globalCtx, 1); + func_808BB8D4(this, play, 1); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } -void func_808B94A4(DoorWarp1* this, GlobalContext* globalCtx) { - if (!func_808B866C(this, globalCtx) && (ActorCutscene_GetCurrentIndex() != globalCtx->playerActorCsIds[8])) { +void func_808B94A4(DoorWarp1* this, PlayState* play) { + if (!func_808B866C(this, play) && (ActorCutscene_GetCurrentIndex() != play->playerActorCsIds[8])) { DoorWarp1_SetupAction(this, func_808B921C); } - func_808BB8D4(this, globalCtx, 1); + func_808BB8D4(this, play, 1); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } -void func_808B9524(DoorWarp1* this, GlobalContext* globalCtx) { - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); +void func_808B9524(DoorWarp1* this, PlayState* play) { + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); + ActorCutscene_Start(play->playerActorCsIds[9], NULL); DoorWarp1_SetupAction(this, func_808B958C); } } -void func_808B958C(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B958C(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_808BB8D4(this, globalCtx, 1); + func_808BB8D4(this, play, 1); if (this->unk_1CA > 100) { if (player->actor.velocity.y < 10.0f) { @@ -409,8 +409,8 @@ void func_808B958C(DoorWarp1* this, GlobalContext* globalCtx) { this->unk_1D0++; if ((this->unk_1D0 > 120) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) { - func_808BA10C(this, globalCtx); - globalCtx->unk_1887F = 3; + func_808BA10C(this, play); + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } @@ -418,10 +418,10 @@ void func_808B958C(DoorWarp1* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_LINK_WARP - SFX_FLAG); } -void func_808B96A0(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B96A0(DoorWarp1* this, PlayState* play) { } -void func_808B96B0(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B96B0(DoorWarp1* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->unk_1B0, 255.0f, 0.4f, 10.0f, 0.01f); Math_SmoothStepToF(&this->unk_1B4, 255.0f, 0.4f, 10.0f, 0.01f); @@ -441,13 +441,13 @@ void func_808B96B0(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808B977C(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B977C(DoorWarp1* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if (func_808B866C(this, globalCtx) && !Play_InCsMode(globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + if (func_808B866C(this, play) && !Play_InCsMode(play)) { + Player* player = GET_PLAYER(play); Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); - func_800B7298(globalCtx, &this->dyna.actor, 9); + func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 1; @@ -455,17 +455,17 @@ void func_808B977C(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808B9840(DoorWarp1* this, GlobalContext* globalCtx) { - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); +void func_808B9840(DoorWarp1* this, PlayState* play) { + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); + ActorCutscene_Start(play->playerActorCsIds[9], NULL); DoorWarp1_SetupAction(this, func_808B98A8); } } -void func_808B98A8(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808B98A8(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1CA > 100) { if (player->actor.velocity.y < 10.0f) { @@ -484,11 +484,11 @@ void func_808B98A8(DoorWarp1* this, GlobalContext* globalCtx) { if ((gSaveContext.nextCutsceneIndex == 0xFFEF) && (D_808BC000 < this->unk_1D0) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) { if (DOORWARP1_GET_FF00_1(&this->dyna.actor) != 0xFF) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; } else { - func_80169FDC(&globalCtx->state); + func_80169FDC(&play->state); } } } @@ -502,19 +502,18 @@ void func_808B98A8(DoorWarp1* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->dyna.actor.shape.yOffset, 0.0f, 0.5f, 2.0f, 0.1f); } -void func_808B9B30(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B9B30(DoorWarp1* this, PlayState* play) { if (fabsf(this->dyna.actor.xzDistToPlayer) >= 60.0f) { - if (func_808B849C(this, globalCtx)) { - this->unk_1A0 = - (DmHina*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_DM_HINA, - this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, - this->dyna.actor.world.pos.z, 0, 0, 0, func_808B849C(this, globalCtx) - 1); + if (func_808B849C(this, play)) { + this->unk_1A0 = (DmHina*)Actor_SpawnAsChild( + &play->actorCtx, &this->dyna.actor, play, ACTOR_DM_HINA, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0, func_808B849C(this, play) - 1); } DoorWarp1_SetupAction(this, func_808B9BE8); } } -void func_808B9BE8(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B9BE8(DoorWarp1* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->unk_1B0, 255.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->unk_1B4, 255.0f, 0.2f, 2.0f, 0.1f); @@ -532,7 +531,7 @@ void func_808B9BE8(DoorWarp1* this, GlobalContext* globalCtx) { } this->dyna.actor.parent = NULL; - if (func_808B849C(this, globalCtx)) { + if (func_808B849C(this, play)) { this->unk_202 = 1; DoorWarp1_SetupAction(this, func_808B9CE8); } else { @@ -540,18 +539,18 @@ void func_808B9BE8(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808B9CE8(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B9CE8(DoorWarp1* this, PlayState* play) { if (this->unk_203 != 0) { if (1) {} return; } - if (!Actor_HasParent(&this->dyna.actor, globalCtx)) { - Actor_PickUp(&this->dyna.actor, globalCtx, func_808B849C(this, globalCtx) + 84, 30.0f, 80.0f); + if (!Actor_HasParent(&this->dyna.actor, play)) { + Actor_PickUp(&this->dyna.actor, play, func_808B849C(this, play) + 84, 30.0f, 80.0f); return; } - switch (globalCtx->sceneNum) { + switch (play->sceneNum) { case SCENE_MITURIN_BS: gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.save.unk_ECC[1]) & 0xFF); @@ -575,31 +574,31 @@ void func_808B9CE8(DoorWarp1* this, GlobalContext* globalCtx) { gSaveContext.save.unk_ECC[1] = (gSaveContext.save.unk_ECC[1] & 0xFFFFFF00) | ((((u8)gSaveContext.save.unk_ECC[1]) + 1) & 0xFF); - Item_Give(globalCtx, func_808B849C(this, globalCtx) + (ITEM_REMAINS_ODOLWA - 1)); + Item_Give(play, func_808B849C(this, play) + (ITEM_REMAINS_ODOLWA - 1)); DoorWarp1_SetupAction(this, func_808B9E94); } -void func_808B9E94(DoorWarp1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 2) { +void func_808B9E94(DoorWarp1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 2) { this->unk_1CE = 110; DoorWarp1_SetupAction(this, func_808B9ED8); } } -void func_808B9ED8(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B9ED8(DoorWarp1* this, PlayState* play) { this->unk_1CE--; if (this->unk_1CE <= 0) { - func_808BA10C(this, globalCtx); + func_808BA10C(this, play); } } -void func_808B9F10(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808B9F10(DoorWarp1* this, PlayState* play) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); - if ((this->unk_203 == 0) && func_808B866C(this, globalCtx) && !Play_InCsMode(globalCtx) && (this->unk_203 == 0)) { - Player* player = GET_PLAYER(globalCtx); + if ((this->unk_203 == 0) && func_808B866C(this, play) && !Play_InCsMode(play) && (this->unk_203 == 0)) { + Player* player = GET_PLAYER(play); Interface_ChangeAlpha(1); - func_800B7298(globalCtx, &this->dyna.actor, 9); + func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; this->unk_1CA = 20; @@ -607,19 +606,19 @@ void func_808B9F10(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808B9FD0(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); +void func_808B9FD0(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); if (this->unk_1CA != 0) { this->unk_1CA--; return; } - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); + ActorCutscene_Start(play->playerActorCsIds[9], NULL); Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, Animation_GetLastFrame(&object_warp1_Anim_001374.common), @@ -630,21 +629,21 @@ void func_808B9FD0(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808BA10C(DoorWarp1* this, PlayState* play) { s32 phi_v0_2; u8 phi_a0; s32 phi_v0_3; - if ((globalCtx->sceneNum == SCENE_MITURIN_BS) || (globalCtx->sceneNum == SCENE_HAKUGIN_BS) || - (globalCtx->sceneNum == SCENE_INISIE_BS) || (globalCtx->sceneNum == SCENE_SEA_BS)) { - D_801F4DE2 = globalCtx->sceneNum; - if (globalCtx->sceneNum == SCENE_MITURIN_BS) { + if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || + (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { + D_801F4DE2 = play->sceneNum; + if (play->sceneNum == SCENE_MITURIN_BS) { phi_v0_2 = 0; - } else if (globalCtx->sceneNum == SCENE_HAKUGIN_BS) { + } else if (play->sceneNum == SCENE_HAKUGIN_BS) { phi_v0_2 = 1; - } else if (globalCtx->sceneNum == SCENE_INISIE_BS) { + } else if (play->sceneNum == SCENE_INISIE_BS) { phi_v0_2 = 2; - } else if (globalCtx->sceneNum == SCENE_SEA_BS) { + } else if (play->sceneNum == SCENE_SEA_BS) { phi_v0_2 = 3; } else { phi_v0_2 = 0; @@ -699,63 +698,63 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { break; } - globalCtx->nextEntranceIndex = 0xCC00; + play->nextEntranceIndex = 0xCC00; if (phi_v0_3 < 10) { gSaveContext.nextCutsceneIndex = phi_v0_3 + 0xFFF0; } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } else { switch (phi_v0_2) { case 0: if (gSaveContext.save.weekEventReg[20] & 2) { gSaveContext.save.weekEventReg[7] |= 0x80; - globalCtx->nextEntranceIndex = 0x3010; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->nextEntranceIndex = 0x3010; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } else { - globalCtx->nextEntranceIndex = 0x8600; + play->nextEntranceIndex = 0x8600; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } break; case 1: gSaveContext.save.weekEventReg[33] |= 0x80; - globalCtx->nextEntranceIndex = 0xAE70; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->nextEntranceIndex = 0xAE70; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; break; case 3: if (gSaveContext.save.weekEventReg[55] & 0x80) { - globalCtx->nextEntranceIndex = 0x6A90; + play->nextEntranceIndex = 0x6A90; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } else { gSaveContext.save.weekEventReg[55] |= 0x80; - globalCtx->nextEntranceIndex = 0x6A80; + play->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } break; case 2: gSaveContext.save.weekEventReg[52] |= 0x20; - globalCtx->nextEntranceIndex = 0x20F0; + play->nextEntranceIndex = 0x20F0; gSaveContext.nextCutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; break; } @@ -764,17 +763,17 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { if (DOORWARP1_GET_FF(&this->dyna.actor) == ENDOORWARP1_FF_6) { gSaveContext.respawnFlag = ~1; } - globalCtx->nextEntranceIndex = globalCtx->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; } else { - func_80169FDC(&globalCtx->state); + func_80169FDC(&play->state); } } -void func_808BA550(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player2 = GET_PLAYER(globalCtx); - Player* player = GET_PLAYER(globalCtx); +void func_808BA550(DoorWarp1* this, PlayState* play) { + Player* player2 = GET_PLAYER(play); + Player* player = GET_PLAYER(play); s16 i; s32 temp_f16; f32 temp_f0; @@ -829,19 +828,19 @@ void func_808BA550(DoorWarp1* this, GlobalContext* globalCtx) { this->unk_1D0++; if ((D_808BC000 < this->unk_1D0) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) { - func_808BA10C(this, globalCtx); + func_808BA10C(this, play); } if (this->unk_1D0 > 140) { - globalCtx->envCtx.fillScreen = 1; + play->envCtx.fillScreen = 1; temp_f0 = (this->unk_1D0 - 140) / 20.0f; if (temp_f0 > 1.0f) { temp_f0 = 1.0f; } - globalCtx->envCtx.screenFillColor[0] = 160; - globalCtx->envCtx.screenFillColor[1] = 160; - globalCtx->envCtx.screenFillColor[2] = 160; - globalCtx->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[0] = 160; + play->envCtx.screenFillColor[1] = 160; + play->envCtx.screenFillColor[2] = 160; + play->envCtx.screenFillColor[3] = 255.0f * temp_f0; } Lights_PointNoGlowSetInfo(&this->unk_1E0, player->actor.world.pos.x + 10.0f, player->actor.world.pos.y + 10.0f, @@ -864,25 +863,25 @@ void func_808BA550(DoorWarp1* this, GlobalContext* globalCtx) { temp_f16 = -255.0f * temp_f0; for (i = 0; i < 3; i++) { - globalCtx->envCtx.lightSettings.diffuseColor1[i] = temp_f16; - globalCtx->envCtx.lightSettings.fogColor[i] = temp_f16; - globalCtx->envCtx.lightSettings.ambientColor[i] = temp_f16; + play->envCtx.lightSettings.diffuseColor1[i] = temp_f16; + play->envCtx.lightSettings.fogColor[i] = temp_f16; + play->envCtx.lightSettings.ambientColor[i] = temp_f16; } - globalCtx->envCtx.lightSettings.fogNear = -500.0f * temp_f0; - if (globalCtx->envCtx.lightSettings.fogNear < -300) { - globalCtx->roomCtx.currRoom.segment = NULL; + play->envCtx.lightSettings.fogNear = -500.0f * temp_f0; + if (play->envCtx.lightSettings.fogNear < -300) { + play->roomCtx.currRoom.segment = NULL; } } } -void func_808BAAF4(DoorWarp1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808BAAF4(DoorWarp1* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 cutscene; f32 phi_f2; phi_f2 = 200.0f; - if (globalCtx->sceneNum == SCENE_SEA) { + if (play->sceneNum == SCENE_SEA) { phi_f2 = 85.0f; } @@ -901,10 +900,10 @@ void func_808BAAF4(DoorWarp1* this, GlobalContext* globalCtx) { } } -void func_808BABF4(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808BABF4(DoorWarp1* this, PlayState* play) { } -void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Update(Actor* thisx, PlayState* play) { DoorWarp1* this = THIS; if (this->unk_203 == 0) { @@ -917,35 +916,35 @@ void DoorWarp1_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_1A0->unk_15C = this->unk_204; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (DOORWARP1_GET_FF(&this->dyna.actor) < ENDOORWARP1_FF_2) { Actor_SetScale(&this->dyna.actor, this->unk_1C4 / 100.0f); } } -void func_808BACCC(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808BACCC(DoorWarp1* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0xFF, 200, 255, 255, (u8)this->unk_1B8); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, (u8)this->unk_1B8); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); SkelAnime_Update(&this->skelAnime); } -void func_808BAE9C(DoorWarp1* this, GlobalContext* globalCtx) { +void func_808BAE9C(DoorWarp1* this, PlayState* play) { s32 pad; s32 pad2; - s32 sp94 = globalCtx->state.frames * 10; + s32 sp94 = play->state.frames * 10; f32 sp90; f32 sp8C; f32 phi_f12; @@ -963,11 +962,11 @@ void func_808BAE9C(DoorWarp1* this, GlobalContext* globalCtx) { sp8C = 1.0f - this->unk_1A8; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); sp84 = 1.0f - ((2.0f - this->unk_1A4) / 1.7f); this->unk_1AC += sp84 * 15.0f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255.0f * sp84, 255, 255, (u8)this->unk_1B4); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255.0f * sp84, 255, 255); @@ -980,17 +979,17 @@ void func_808BAE9C(DoorWarp1* this, GlobalContext* globalCtx) { } Matrix_Scale(phi_f12, phi_f12, phi_f12, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x0A, Matrix_NewMtx(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x0A, Matrix_NewMtx(play->state.gfxCtx)); Matrix_Push(); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sp94 & 0xFF, -((s16)(2.0f * this->unk_1AC) & 0x1FF), 0x100, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -((s16)(2.0f * this->unk_1AC) & 0x1FF), 0x100, 0x100, 1, sp94 & 0xFF, -((s16)(2.0f * this->unk_1AC) & 0x1FF), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_1A4 * 230.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(((this->unk_1C6 * sp90) / 100.0f) + 1.0f, 1.0f, ((this->unk_1C6 * sp90) / 100.0f) + 1.0f, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx)); gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0); Matrix_Pop(); @@ -1001,26 +1000,26 @@ void func_808BAE9C(DoorWarp1* this, GlobalContext* globalCtx) { sp94 *= 2; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, - 0x100, 1, sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, 0x100)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, 0x100, 1, + sp94 & 0xFF, -((s16)this->unk_1AC & 0x1FF), 0x100, 0x100)); Matrix_Translate(0.0f, this->unk_1A8 * 60.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(((this->unk_1C8 * sp8C) / 100.0f) + 1.0f, 1.0f, ((this->unk_1C8 * sp8C) / 100.0f) + 1.0f, MTXMODE_APPLY); - gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx)); gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808BB4C4(DoorWarp1* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_warp1_DL_0076C0); +void func_808BB4C4(DoorWarp1* this, PlayState* play) { + Gfx_DrawDListOpa(play, object_warp1_DL_0076C0); } -void func_808BB4F4(DoorWarp1* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_808BB4F4(DoorWarp1* this, PlayState* play2) { + PlayState* play = play2; s32 pad; Color_RGB8 sp64[] = { { 50, 150, 0 }, @@ -1034,17 +1033,17 @@ void func_808BB4F4(DoorWarp1* this, GlobalContext* globalCtx2) { Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->unk_1A4, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(4.0f, this->unk_1AC, 4.0f, MTXMODE_APPLY); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0044D8)); - Gfx_DrawDListXlu(globalCtx, object_warp1_DL_003230); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0044D8)); + Gfx_DrawDListXlu(play, object_warp1_DL_003230); return; } - if (globalCtx->sceneNum != SCENE_MITURIN) { - if (globalCtx->sceneNum == SCENE_HAKUGIN) { + if (play->sceneNum != SCENE_MITURIN) { + if (play->sceneNum == SCENE_HAKUGIN) { sp60 = 1; - } else if (globalCtx->sceneNum == SCENE_SEA) { + } else if (play->sceneNum == SCENE_SEA) { sp60 = 2; - } else if (globalCtx->sceneNum == SCENE_INISIE_R) { + } else if (play->sceneNum == SCENE_INISIE_R) { sp60 = 3; } } @@ -1053,64 +1052,64 @@ void func_808BB4F4(DoorWarp1* this, GlobalContext* globalCtx2) { MTXMODE_NEW); Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY); Matrix_Scale(1.0f, this->unk_1A8, 1.0f, MTXMODE_APPLY); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0057D8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0057D8)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_004690); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_warp1_Matanimheader_007238)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_007238)); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY); Matrix_Scale(1.0f, 0.0f, 1.0f, MTXMODE_APPLY); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, this->unk_203); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0058C8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void DoorWarp1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void DoorWarp1_Draw(Actor* thisx, PlayState* play) { DoorWarp1* this = THIS; switch (DOORWARP1_GET_FF(&this->dyna.actor)) { case ENDOORWARP1_FF_0: - func_808BAE9C(this, globalCtx); + func_808BAE9C(this, play); break; case ENDOORWARP1_FF_1: - func_808BACCC(this, globalCtx); - func_808BAE9C(this, globalCtx); + func_808BACCC(this, play); + func_808BAE9C(this, play); break; case ENDOORWARP1_FF_2: case ENDOORWARP1_FF_3: case ENDOORWARP1_FF_4: case ENDOORWARP1_FF_5: - func_808BB4C4(this, globalCtx); + func_808BB4C4(this, play); break; case ENDOORWARP1_FF_6: - func_808BB4F4(this, globalCtx); + func_808BB4F4(this, play); break; } } -void func_808BB8D4(DoorWarp1* this, GlobalContext* globalCtx, s32 arg2) { +void func_808BB8D4(DoorWarp1* this, PlayState* play, s32 arg2) { static Vec3f sVelocity = { 0.0f, 0.05f, 0.0f }; static Vec3f sAccel = { 0.0f, 0.25f, 0.0f }; Vec3f pos; @@ -1148,6 +1147,6 @@ void func_808BB8D4(DoorWarp1* this, GlobalContext* globalCtx, s32 arg2) { sVelocity.x = -Math_SinS(rand - 0x8000) * 5.0f; sVelocity.z = Math_CosS(rand - 0x8000) * 5.0f; } - EffectSsKirakira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAccel, &primColor, &envColor, scale, life); + EffectSsKirakira_SpawnDispersed(play, &pos, &sVelocity, &sAccel, &primColor, &envColor, scale, life); } } 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 ca177006bd..bc66c2480c 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -6,7 +6,7 @@ struct DoorWarp1; -typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, GlobalContext*); +typedef void (*DoorWarp1ActionFunc)(struct DoorWarp1*, PlayState*); #define DOORWARP1_GET_FF(thisx) ((thisx)->params & 0xFF) #define DOORWARP1_GET_FF00_1(thisx) (((thisx)->params >> 8) & 0xFF) diff --git a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c index d7bd601f08..127a24ddf1 100644 --- a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c +++ b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c @@ -10,9 +10,9 @@ #define THIS ((EffChange*)thisx) -void EffChange_Init(Actor* thisx, GlobalContext* globalCtx); -void EffChange_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffChange_Update(Actor* thisx, GlobalContext* globalCtx); +void EffChange_Init(Actor* thisx, PlayState* play); +void EffChange_Destroy(Actor* thisx, PlayState* play); +void EffChange_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Eff_Change_InitVars = { diff --git a/src/overlays/actors/ovl_Eff_Change/z_eff_change.h b/src/overlays/actors/ovl_Eff_Change/z_eff_change.h index 0c6c7a5341..9f45088a2c 100644 --- a/src/overlays/actors/ovl_Eff_Change/z_eff_change.h +++ b/src/overlays/actors/ovl_Eff_Change/z_eff_change.h @@ -5,7 +5,7 @@ struct EffChange; -typedef void (*EffChangeActionFunc)(struct EffChange*, GlobalContext*); +typedef void (*EffChangeActionFunc)(struct EffChange*, PlayState*); typedef struct EffChange { /* 0x0000 */ Actor actor; 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 211b32412a..b2d896a14c 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -12,17 +12,17 @@ #define THIS ((EffDust*)thisx) -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 func_80918D64(EffDust* this, GlobalContext* globalCtx); -void func_80918FE4(EffDust* this, GlobalContext* globalCtx); -void func_80919230(EffDust* this, GlobalContext* globalCtx); +void func_80918D64(EffDust* this, PlayState* play); +void func_80918FE4(EffDust* this, PlayState* play); +void func_80919230(EffDust* this, PlayState* play); -void func_80919768(Actor* thisx, GlobalContext* globalCtx); -void func_809199FC(Actor* thisx, GlobalContext* globalCtx); +void func_80919768(Actor* thisx, PlayState* play); +void func_809199FC(Actor* thisx, PlayState* play); const ActorInit Eff_Dust_InitVars = { ACTOR_EFF_DUST, @@ -49,7 +49,7 @@ void func_80918B40(EffDust* this) { this->index = 0; } -void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Init(Actor* thisx, PlayState* play) { EffDust* this = THIS; u32 type = this->actor.params; @@ -100,10 +100,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 func_80918D64(EffDust* this, GlobalContext* globalCtx) { +void func_80918D64(EffDust* this, PlayState* play) { s16 theta; s16 fi; s32 i; @@ -134,7 +134,7 @@ void func_80918D64(EffDust* this, GlobalContext* globalCtx) { } } -void func_80918FE4(EffDust* this, GlobalContext* globalCtx) { +void func_80918FE4(EffDust* this, PlayState* play) { s16 theta; s16 fi; f32* distanceTraveled = this->distanceTraveled; @@ -163,9 +163,9 @@ void func_80918FE4(EffDust* this, GlobalContext* globalCtx) { } } -void func_80919230(EffDust* this, GlobalContext* globalCtx) { +void func_80919230(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; @@ -243,20 +243,20 @@ void func_80919230(EffDust* this, GlobalContext* globalCtx) { } } -void EffDust_Update(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Update(Actor* thisx, PlayState* play) { EffDust* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } Gfx D_80919DB0[] = { gsSPEndDisplayList(), }; -void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { +void func_80919768(Actor* thisx, PlayState* play2) { EffDust* this = THIS; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx2->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play2->state.gfxCtx; f32* distanceTraveled; Vec3f* initialPositions; s32 i; @@ -264,7 +264,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { s16 sp92; Vec3f activeCamEye; - activeCamEye = GET_ACTIVE_CAM(globalCtx)->eye; + activeCamEye = GET_ACTIVE_CAM(play)->eye; sp92 = Math_Vec3f_Yaw(&activeCamEye, &thisx->world.pos); OPEN_DISPS(gfxCtx); @@ -290,7 +290,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { initialPositions->z * ((this->dz * aux) + (1.0f - this->dz)), MTXMODE_APPLY); Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -307,15 +307,15 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx); } -void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { +void func_809199FC(Actor* thisx, PlayState* play2) { EffDust* this = THIS; - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx2->state.gfxCtx; + PlayState* play = play2; + GraphicsContext* gfxCtx = play2->state.gfxCtx; f32* distanceTraveled; Vec3f* initialPositions; s32 i; f32 aux; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); OPEN_DISPS(gfxCtx); func_8012C28C(gfxCtx); @@ -347,7 +347,7 @@ void func_809199FC(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); @@ -363,8 +363,8 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx); } -void EffDust_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EffDust_Draw(Actor* thisx, PlayState* play) { EffDust* this = THIS; - 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 ec03b49d0d..d214453b2e 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -5,7 +5,7 @@ struct EffDust; -typedef void (*EffDustActionFunc)(struct EffDust*, GlobalContext*); +typedef void (*EffDustActionFunc)(struct EffDust*, PlayState*); typedef struct EffDust { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c index 687ae1b96f..f644ad9dca 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c @@ -10,9 +10,9 @@ #define THIS ((EffKamejimaWave*)thisx) -void EffKamejimaWave_Init(Actor* thisx, GlobalContext* globalCtx); -void EffKamejimaWave_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffKamejimaWave_Update(Actor* thisx, GlobalContext* globalCtx); +void EffKamejimaWave_Init(Actor* thisx, PlayState* play); +void EffKamejimaWave_Destroy(Actor* thisx, PlayState* play); +void EffKamejimaWave_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Eff_Kamejima_Wave_InitVars = { diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h index 2f20aed920..93fb666b36 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h @@ -5,7 +5,7 @@ struct EffKamejimaWave; -typedef void (*EffKamejimaWaveActionFunc)(struct EffKamejimaWave*, GlobalContext*); +typedef void (*EffKamejimaWaveActionFunc)(struct EffKamejimaWave*, PlayState*); typedef struct EffKamejimaWave { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c index 3901c01796..c700aa2204 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c @@ -10,15 +10,15 @@ #define THIS ((EffLastday*)thisx) -void EffLastday_Init(Actor* thisx, GlobalContext* globalCtx); -void EffLastday_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffLastday_Update(Actor* thisx, GlobalContext* globalCtx); -void EffLastday_Draw(Actor* thisx, GlobalContext* globalCtx); +void EffLastday_Init(Actor* thisx, PlayState* play); +void EffLastday_Destroy(Actor* thisx, PlayState* play); +void EffLastday_Update(Actor* thisx, PlayState* play); +void EffLastday_Draw(Actor* thisx, PlayState* play); -void func_80BEBD0C(EffLastday* this, GlobalContext* globalCtx); -void func_80BEBDF8(EffLastday* this, GlobalContext* globalCtx); -void func_80BEBEB8(EffLastday* this, GlobalContext* globalCtx); -void func_80BEBF78(EffLastday* this, GlobalContext* globalCtx); +void func_80BEBD0C(EffLastday* this, PlayState* play); +void func_80BEBDF8(EffLastday* this, PlayState* play); +void func_80BEBEB8(EffLastday* this, PlayState* play); +void func_80BEBF78(EffLastday* this, PlayState* play); #if 0 const ActorInit Eff_Lastday_InitVars = { diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h index 74ecf94fec..175ac5a20d 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h @@ -5,7 +5,7 @@ struct EffLastday; -typedef void (*EffLastdayActionFunc)(struct EffLastday*, GlobalContext*); +typedef void (*EffLastdayActionFunc)(struct EffLastday*, PlayState*); typedef struct EffLastday { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.c b/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.c index b54bba5770..7784171392 100644 --- a/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.c +++ b/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.c @@ -10,10 +10,10 @@ #define THIS ((EffStk*)thisx) -void EffStk_Init(Actor* thisx, GlobalContext* globalCtx); -void EffStk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffStk_Update(Actor* thisx, GlobalContext* globalCtx); -void EffStk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EffStk_Init(Actor* thisx, PlayState* play); +void EffStk_Destroy(Actor* thisx, PlayState* play); +void EffStk_Update(Actor* thisx, PlayState* play); +void EffStk_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Eff_Stk_InitVars = { diff --git a/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.h b/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.h index 5181933752..3df7fe2247 100644 --- a/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.h +++ b/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.h @@ -5,7 +5,7 @@ struct EffStk; -typedef void (*EffStkActionFunc)(struct EffStk*, GlobalContext*); +typedef void (*EffStkActionFunc)(struct EffStk*, PlayState*); typedef struct EffStk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c index 8ed8c6db44..8c365167df 100644 --- a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c +++ b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c @@ -10,12 +10,12 @@ #define THIS ((EffZoraband*)thisx) -void EffZoraband_Init(Actor* thisx, GlobalContext* globalCtx); -void EffZoraband_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EffZoraband_Update(Actor* thisx, GlobalContext* globalCtx); -void EffZoraband_Draw(Actor* thisx, GlobalContext* globalCtx); +void EffZoraband_Init(Actor* thisx, PlayState* play); +void EffZoraband_Destroy(Actor* thisx, PlayState* play); +void EffZoraband_Update(Actor* thisx, PlayState* play); +void EffZoraband_Draw(Actor* thisx, PlayState* play); -void func_80C07790(EffZoraband* this, GlobalContext* globalCtx); +void func_80C07790(EffZoraband* this, PlayState* play); #if 0 const ActorInit Eff_Zoraband_InitVars = { diff --git a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.h b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.h index 6b1a5d6665..c1213c666b 100644 --- a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.h +++ b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.h @@ -5,7 +5,7 @@ struct EffZoraband; -typedef void (*EffZorabandActionFunc)(struct EffZoraband*, GlobalContext*); +typedef void (*EffZorabandActionFunc)(struct EffZoraband*, PlayState*); typedef struct EffZoraband { /* 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 372a21d11c..5cd49cbb8f 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -10,9 +10,9 @@ #define THIS ((ElfMsg*)thisx) -void ElfMsg_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg_Update(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_SetupAction(ElfMsg* this, ElfMsgActionFunc actionFunc); 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 7d46680bd8..dd9accf937 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.h @@ -5,7 +5,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 5397ca5d6f..7c244d2553 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -10,11 +10,11 @@ #define THIS ((ElfMsg2*)thisx) -void ElfMsg2_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg2_Update(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 func_8096EFD0(ElfMsg2* this, GlobalContext* globalCtx); +void func_8096EFD0(ElfMsg2* this, PlayState* play); void ElfMsg2_SetupAction(ElfMsg2* this, ElfMsg2ActionFunc actionFunc); 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 9429df0b52..82194009a2 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h @@ -5,7 +5,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_Elf_Msg3/z_elf_msg3.c b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c index dc0e5eb72f..b81bb2963a 100644 --- a/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c +++ b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c @@ -10,9 +10,9 @@ #define THIS ((ElfMsg3*)thisx) -void ElfMsg3_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg3_Update(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg3_Init(Actor* thisx, PlayState* play); +void ElfMsg3_Destroy(Actor* thisx, PlayState* play); +void ElfMsg3_Update(Actor* thisx, PlayState* play); void ElfMsg3_SetupAction(ElfMsg3* this, ElfMsg3ActionFunc actionFunc); diff --git a/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.h b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.h index 409847755b..73b285dba1 100644 --- a/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.h +++ b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.h @@ -5,7 +5,7 @@ struct ElfMsg3; -typedef void (*ElfMsg3ActionFunc)(struct ElfMsg3*, GlobalContext*); +typedef void (*ElfMsg3ActionFunc)(struct ElfMsg3*, PlayState*); typedef struct ElfMsg3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c index ca79813623..4606d6c088 100644 --- a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c +++ b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c @@ -10,12 +10,12 @@ #define THIS ((ElfMsg4*)thisx) -void ElfMsg4_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg4_Update(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg4_Init(Actor* thisx, PlayState* play); +void ElfMsg4_Destroy(Actor* thisx, PlayState* play); +void ElfMsg4_Update(Actor* thisx, PlayState* play); -void func_80AFD668(ElfMsg4* this, GlobalContext* globalCtx); -void func_80AFD770(ElfMsg4* this, GlobalContext* globalCtx); +void func_80AFD668(ElfMsg4* this, PlayState* play); +void func_80AFD770(ElfMsg4* this, PlayState* play); #if 0 const ActorInit Elf_Msg4_InitVars = { diff --git a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.h b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.h index ae14857084..85cc0bc1b4 100644 --- a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.h +++ b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.h @@ -5,7 +5,7 @@ struct ElfMsg4; -typedef void (*ElfMsg4ActionFunc)(struct ElfMsg4*, GlobalContext*); +typedef void (*ElfMsg4ActionFunc)(struct ElfMsg4*, PlayState*); typedef struct ElfMsg4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.c b/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.c index aceb36807d..1400291631 100644 --- a/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.c +++ b/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.c @@ -10,11 +10,11 @@ #define THIS ((ElfMsg5*)thisx) -void ElfMsg5_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg5_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg5_Update(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg5_Init(Actor* thisx, PlayState* play); +void ElfMsg5_Destroy(Actor* thisx, PlayState* play); +void ElfMsg5_Update(Actor* thisx, PlayState* play); -void func_80AFDB38(ElfMsg5* this, GlobalContext* globalCtx); +void func_80AFDB38(ElfMsg5* this, PlayState* play); #if 0 const ActorInit Elf_Msg5_InitVars = { diff --git a/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.h b/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.h index f2cff67a7f..be4ff4116c 100644 --- a/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.h +++ b/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.h @@ -5,7 +5,7 @@ struct ElfMsg5; -typedef void (*ElfMsg5ActionFunc)(struct ElfMsg5*, GlobalContext*); +typedef void (*ElfMsg5ActionFunc)(struct ElfMsg5*, PlayState*); typedef struct ElfMsg5 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c index 68c22f2d11..e8c874df44 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c @@ -11,17 +11,17 @@ #define THIS ((ElfMsg6*)thisx) -void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg6_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ElfMsg6_Update(Actor* thisx, GlobalContext* globalCtx); +void ElfMsg6_Init(Actor* thisx, PlayState* play); +void ElfMsg6_Destroy(Actor* thisx, PlayState* play); +void ElfMsg6_Update(Actor* thisx, PlayState* play); -void func_80BA1CF8(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA1E30(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA1F80(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA2038(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA2048(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA215C(ElfMsg6* this, GlobalContext* globalCtx); -void func_80BA21C4(ElfMsg6* this, GlobalContext* globalCtx); +void func_80BA1CF8(ElfMsg6* this, PlayState* play); +void func_80BA1E30(ElfMsg6* this, PlayState* play); +void func_80BA1F80(ElfMsg6* this, PlayState* play); +void func_80BA2038(ElfMsg6* this, PlayState* play); +void func_80BA2048(ElfMsg6* this, PlayState* play); +void func_80BA215C(ElfMsg6* this, PlayState* play); +void func_80BA21C4(ElfMsg6* this, PlayState* play); const ActorInit Elf_Msg6_InitVars = { ACTOR_ELF_MSG6, @@ -78,7 +78,7 @@ void func_80BA165C(void) { } } -s32 func_80BA16F4(ElfMsg6* this, GlobalContext* globalCtx) { +s32 func_80BA16F4(ElfMsg6* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[31] & 4) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->actor.textId = 0x216; return false; @@ -123,7 +123,7 @@ s32 func_80BA16F4(ElfMsg6* this, GlobalContext* globalCtx) { return true; } -void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg6_Init(Actor* thisx, PlayState* play) { ElfMsg6* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -146,7 +146,7 @@ void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ELFMSG6_GET_F(&this->actor)) { case 0: this->actionFunc = func_80BA1E30; - if (func_80BA16F4(this, globalCtx)) { + if (func_80BA16F4(this, play)) { Actor_MarkForDeath(&this->actor); return; } @@ -155,7 +155,7 @@ void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx) { case 1: this->actionFunc = func_80BA1F80; if ((this->actor.cutscene == -1) || ((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && - Flags_GetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor)))) { + Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)))) { Actor_MarkForDeath(&this->actor); return; } @@ -201,7 +201,7 @@ void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx) { case 3: if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && - Flags_GetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor))) || + Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor))) || (gSaveContext.save.weekEventReg[88] & 0x10) || (gSaveContext.save.weekEventReg[91] & 1) || (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA)) { Actor_MarkForDeath(&this->actor); @@ -232,7 +232,7 @@ void ElfMsg6_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ElfMsg6_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg6_Destroy(Actor* thisx, PlayState* play) { } s32 func_80BA1C00(ElfMsg6* this) { @@ -240,8 +240,8 @@ s32 func_80BA1C00(ElfMsg6* this) { ((this->actor.playerHeightRel >= 0.0f) && (this->actor.playerHeightRel < (100.0f * this->actor.scale.y))); } -void func_80BA1C88(ElfMsg6* this, GlobalContext* globalCtx, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA1C88(ElfMsg6* this, PlayState* play, s16 arg2) { + Player* player = GET_PLAYER(play); EnElf* sp20 = (EnElf*)player->tatlActor; if (player->tatlActor != NULL) { @@ -254,15 +254,15 @@ void func_80BA1C88(ElfMsg6* this, GlobalContext* globalCtx, s16 arg2) { } } -void func_80BA1CF8(ElfMsg6* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA1CF8(ElfMsg6* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* sp20 = (EnElf*)player->tatlActor; if (player->tatlActor == NULL) { return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { switch (this->actor.textId) { case 0x224: gSaveContext.save.weekEventReg[79] |= 0x10; @@ -288,15 +288,15 @@ void func_80BA1CF8(ElfMsg6* this, GlobalContext* globalCtx) { } } -void func_80BA1E30(ElfMsg6* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA1E30(ElfMsg6* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnElf* sp20 = (EnElf*)player->tatlActor; if (player->tatlActor == NULL) { return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { switch (this->actor.textId) { case 0x216: gSaveContext.save.weekEventReg[31] |= 4; @@ -329,7 +329,7 @@ void func_80BA1E30(ElfMsg6* this, GlobalContext* globalCtx) { } } -void func_80BA1F80(ElfMsg6* this, GlobalContext* globalCtx) { +void func_80BA1F80(ElfMsg6* this, PlayState* play) { if (((ELFMSG6_GET_F0(&this->actor)) == 1) && (gSaveContext.save.weekEventReg[83] & 2)) { Actor_MarkForDeath(&this->actor); return; @@ -338,7 +338,7 @@ void func_80BA1F80(ElfMsg6* this, GlobalContext* globalCtx) { if (func_80BA1C00(this)) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, NULL); - Flags_SetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)); Actor_MarkForDeath(&this->actor); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -346,22 +346,22 @@ void func_80BA1F80(ElfMsg6* this, GlobalContext* globalCtx) { } } -void func_80BA2038(ElfMsg6* this, GlobalContext* globalCtx) { +void func_80BA2038(ElfMsg6* this, PlayState* play) { } -void func_80BA2048(ElfMsg6* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnElf* sp20 = (EnElf*)GET_PLAYER(globalCtx)->tatlActor; +void func_80BA2048(ElfMsg6* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnElf* sp20 = (EnElf*)GET_PLAYER(play)->tatlActor; sp20->unk_264 |= 0x20; if (ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) { - Flags_SetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)); } Actor_MarkForDeath(&this->actor); return; } - if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor))) || + if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor))) || (gSaveContext.save.weekEventReg[88] & 0x10) || (gSaveContext.save.weekEventReg[91] & 1) || (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA)) { Actor_MarkForDeath(&this->actor); @@ -369,46 +369,46 @@ void func_80BA2048(ElfMsg6* this, GlobalContext* globalCtx) { } if (func_80BA1C00(this)) { - func_80BA1C88(this, globalCtx, 0x24D); + func_80BA1C88(this, play, 0x24D); } } -void func_80BA215C(ElfMsg6* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BA215C(ElfMsg6* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Actor_MarkForDeath(&this->actor); return; } if (func_80BA1C00(this)) { - func_80BA1C88(this, globalCtx, -this->actor.textId); + func_80BA1C88(this, play, -this->actor.textId); } } -void func_80BA21C4(ElfMsg6* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnElf* sp20 = (EnElf*)GET_PLAYER(globalCtx)->tatlActor; +void func_80BA21C4(ElfMsg6* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnElf* sp20 = (EnElf*)GET_PLAYER(play)->tatlActor; sp20->unk_264 |= 0x20; if (ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) { - Flags_SetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)); } Actor_MarkForDeath(&this->actor); return; } - if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(globalCtx, ELFMSG6_SWITCHFLAG(&this->actor))) || + if (((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor))) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { Actor_MarkForDeath(&this->actor); return; } if (func_80BA1C00(this)) { - func_80BA1C88(this, globalCtx, this->actor.textId); + func_80BA1C88(this, play, this->actor.textId); } } -void ElfMsg6_Update(Actor* thisx, GlobalContext* globalCtx) { +void ElfMsg6_Update(Actor* thisx, PlayState* play) { ElfMsg6* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.h b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.h index 78f970de05..c8875a7d53 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.h +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.h @@ -5,7 +5,7 @@ struct ElfMsg6; -typedef void (*ElfMsg6ActionFunc)(struct ElfMsg6*, GlobalContext*); +typedef void (*ElfMsg6ActionFunc)(struct ElfMsg6*, PlayState*); #define ELFMSG6_GET_F(thisx) ((thisx)->params & 0xF) #define ELFMSG6_GET_F0(thisx) (((thisx)->params & 0xF0) >> 4) diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index dd719d6fb1..fae0025d20 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -11,13 +11,13 @@ #define THIS ((EnAh*)thisx) -void EnAh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAh_Init(Actor* thisx, PlayState* play); +void EnAh_Destroy(Actor* thisx, PlayState* play); +void EnAh_Update(Actor* thisx, PlayState* play); +void EnAh_Draw(Actor* thisx, PlayState* play); -void func_80BD36B8(EnAh* this, GlobalContext* globalCtx); -void func_80BD3768(EnAh* this, GlobalContext* globalCtx); +void func_80BD36B8(EnAh* this, PlayState* play); +void func_80BD3768(EnAh* this, PlayState* play); static u8 D_80BD3DB0[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_YADOYA, 0x21 - 0x04), @@ -105,12 +105,12 @@ TexturePtr D_80BD3F14[] = { object_ah_Tex_006D70, object_ah_Tex_007570, object_ah_Tex_007D70, object_ah_Tex_007570, object_ah_Tex_008570, }; -s32 func_80BD2A30(EnAh* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +s32 func_80BD2A30(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) { Actor* tempActor; Actor* foundActor = NULL; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); + foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); if ((foundActor == NULL) || (((EnAh*)foundActor != this) && (foundActor->update != NULL))) { break; @@ -152,16 +152,16 @@ s32 func_80BD2B0C(EnAh* this, s32 arg1) { return ret; } -void func_80BD2BA4(EnAh* this, GlobalContext* globalCtx) { +void func_80BD2BA4(EnAh* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80BD2BE8(EnAh* this, GlobalContext* globalCtx) { +s32 func_80BD2BE8(EnAh* this, PlayState* play) { s32 ret = false; if (this->unk_2D8 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_2D8, 0, 7); ret = true; this->unk_2D8 |= 8; @@ -211,13 +211,13 @@ void func_80BD2C6C(EnAh* this) { } } -Actor* func_80BD2DA0(EnAh* this, GlobalContext* globalCtx) { +Actor* func_80BD2DA0(EnAh* this, PlayState* play) { Actor* actor; if (this->unk_1DC == 3) { actor = this->actor.child; } else { - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; } return actor; } @@ -254,8 +254,8 @@ void func_80BD2DC8(EnAh* this) { this->unk_2F0 = CLAMP(this->unk_2F0, -0xE38, 0xE38); } -void func_80BD2FD0(EnAh* this, GlobalContext* globalCtx) { - this->unk_1E4 = func_80BD2DA0(this, globalCtx); +void func_80BD2FD0(EnAh* this, PlayState* play) { + this->unk_1E4 = func_80BD2DA0(this, play); if ((this->unk_2D8 & 8) && (this->unk_1E4 != NULL)) { if (DECR(this->unk_2F4) == 0) { @@ -280,7 +280,7 @@ void func_80BD2FD0(EnAh* this, GlobalContext* globalCtx) { } } -s32 func_80BD30C0(EnAh* this, GlobalContext* globalCtx) { +s32 func_80BD30C0(EnAh* this, PlayState* play) { switch (this->unk_1DC) { case 1: func_80BD2B0C(this, 0); @@ -293,7 +293,7 @@ s32 func_80BD30C0(EnAh* this, GlobalContext* globalCtx) { return false; } -void func_80BD3118(EnAh* this, GlobalContext* globalCtx) { +void func_80BD3118(EnAh* this, PlayState* play) { if (this->unk_2FE == 0) { func_80BD2B0C(this, 2); this->unk_2FE++; @@ -303,9 +303,9 @@ void func_80BD3118(EnAh* this, GlobalContext* globalCtx) { } } -s32 func_80BD3198(EnAh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp = globalCtx->msgCtx.currentTextId; +s32 func_80BD3198(EnAh* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp = play->msgCtx.currentTextId; if (player->stateFlags1 & 0x40) { if (this->unk_2DA != temp) { @@ -334,18 +334,18 @@ s32 func_80BD3198(EnAh* this, GlobalContext* globalCtx) { this->unk_2D8 &= ~0x100; this->unk_2F6 = 0; this->unk_2F8 = 4; - func_80BD30C0(this, globalCtx); + func_80BD30C0(this, play); } if (this->unk_18C != NULL) { - this->unk_18C(this, globalCtx); + this->unk_18C(this, play); } return false; } -s32* func_80BD3294(EnAh* this, GlobalContext* globalCtx) { - s32 mask = Player_GetMask(globalCtx); +s32* func_80BD3294(EnAh* this, PlayState* play) { + s32 mask = Player_GetMask(play); if (PLAYER_MASK_KAFEIS_MASK == mask) { return D_80BD3E08; @@ -364,10 +364,10 @@ s32* func_80BD3294(EnAh* this, GlobalContext* globalCtx) { return NULL; } -s32 func_80BD3320(EnAh* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +s32 func_80BD3320(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) { s32 pad; s32 ret = false; - Actor* temp_v0 = func_80BD2A30(this, globalCtx, actorCat, actorId); + Actor* temp_v0 = func_80BD2A30(this, play, actorCat, actorId); if (temp_v0 != NULL) { this->actor.child = temp_v0; @@ -376,7 +376,7 @@ s32 func_80BD3320(EnAh* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId return ret; } -s32 func_80BD3374(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleResult* arg2) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3EC4.pos); @@ -388,7 +388,7 @@ s32 func_80BD3374(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -s32 func_80BD33FC(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleResult* arg2) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3ED8.pos); @@ -400,10 +400,10 @@ s32 func_80BD33FC(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -s32 func_80BD3484(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80BD3320(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AN)) { + if (func_80BD3320(this, play, ACTORCAT_NPC, ACTOR_EN_AN)) { if (sREG(81) == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3EEC.pos); Math_Vec3s_Copy(&this->actor.world.rot, &D_80BD3EEC.rot); @@ -419,7 +419,7 @@ s32 func_80BD3484(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BD3548(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleResult* arg2) { s32 ret; this->unk_2D8 = 0; @@ -430,21 +430,21 @@ s32 func_80BD3548(EnAh* this, GlobalContext* globalCtx, ScheduleResult* arg2) { break; case 1: - ret = func_80BD3374(this, globalCtx, arg2); + ret = func_80BD3374(this, play, arg2); break; case 2: - ret = func_80BD33FC(this, globalCtx, arg2); + ret = func_80BD33FC(this, play, arg2); break; case 3: - ret = func_80BD3484(this, globalCtx, arg2); + ret = func_80BD3484(this, play, arg2); break; } return ret; } -s32 func_80BD35BC(EnAh* this, GlobalContext* globalCtx) { +s32 func_80BD35BC(EnAh* this, PlayState* play) { s16 temp; s16 temp2; @@ -464,18 +464,18 @@ s32 func_80BD35BC(EnAh* this, GlobalContext* globalCtx) { } } -void func_80BD3658(EnAh* this, GlobalContext* globalCtx) { +void func_80BD3658(EnAh* this, PlayState* play) { if ((this->unk_1DC == 1) || (this->unk_1DC == 2) || (this->unk_1DC == 3)) { - func_80BD35BC(this, globalCtx); + func_80BD35BC(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80BD36B8(EnAh* this, GlobalContext* globalCtx) { +void func_80BD36B8(EnAh* this, PlayState* play) { ScheduleResult sp18; - if (!Schedule_RunScript(globalCtx, D_80BD3DB0, &sp18) || - ((this->unk_1DC != sp18.result) && !func_80BD3548(this, globalCtx, &sp18))) { + if (!Schedule_RunScript(play, D_80BD3DB0, &sp18) || + ((this->unk_1DC != sp18.result) && !func_80BD3548(this, play, &sp18))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp18.result = 0; @@ -484,15 +484,15 @@ void func_80BD36B8(EnAh* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; } this->unk_1DC = sp18.result; - func_80BD3658(this, globalCtx); + func_80BD3658(this, play); } -void func_80BD3768(EnAh* this, GlobalContext* globalCtx) { +void func_80BD3768(EnAh* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; - if (func_8010BF58(&this->actor, globalCtx, func_80BD3294(this, globalCtx), NULL, &this->unk_1E0)) { + if (func_8010BF58(&this->actor, play, func_80BD3294(this, play), NULL, &this->unk_1E0)) { SubS_UpdateFlags(&this->unk_2D8, 3, 7); this->unk_2D8 &= ~8; this->unk_2D8 |= 0x80; @@ -508,20 +508,19 @@ void func_80BD3768(EnAh* this, GlobalContext* globalCtx) { } } -void EnAh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAh_Init(Actor* thisx, PlayState* play) { EnAh* this = THIS; - if (func_80BD2A30(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AH)) { + if (func_80BD2A30(this, play, ACTORCAT_NPC, ACTOR_EN_AH)) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ah_Skel_009E70, NULL, this->jointTable, this->morphTable, - 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ah_Skel_009E70, NULL, this->jointTable, this->morphTable, 17); this->unk_300 = -1; func_80BD2B0C(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); @@ -529,42 +528,42 @@ void EnAh_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2D8 = 0; this->actionFunc = func_80BD36B8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnAh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAh_Destroy(Actor* thisx, PlayState* play) { EnAh* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnAh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAh_Update(Actor* thisx, PlayState* play) { EnAh* this = THIS; f32 radius; f32 height; - func_80BD2BE8(this, globalCtx); + func_80BD2BE8(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1DC != 0) { - func_80BD3198(this, globalCtx); + func_80BD3198(this, play); func_80BD2AE0(this); func_80BD2C6C(this); - func_80BD2FD0(this, globalCtx); + func_80BD2FD0(this, play); radius = this->collider.dim.radius + 60; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_2D8 & 7); + func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_2D8 & 7); if (!(this->unk_2D8 & 0x10)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } - func_80BD2BA4(this, globalCtx); + func_80BD2BA4(this, play); } } -void EnAh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnAh* this = THIS; if (limbIndex == 7) { @@ -573,7 +572,7 @@ void EnAh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnAh_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnAh_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnAh* this = THIS; s32 stepRot; s32 overrideRot; @@ -614,21 +613,21 @@ void EnAh_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnAh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAh_Draw(Actor* thisx, PlayState* play) { EnAh* this = THIS; if (this->unk_1DC != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BD3F14[this->unk_2FA])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80BD3F0C[this->unk_2FC])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnAh_PostLimbDraw, EnAh_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.h b/src/overlays/actors/ovl_En_Ah/z_en_ah.h index 85263e04b7..b1c18287f6 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.h +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.h @@ -5,8 +5,8 @@ struct EnAh; -typedef void (*EnAhActionFunc)(struct EnAh*, GlobalContext*); -typedef void (*EnAhUnkFunc)(struct EnAh*, GlobalContext*); +typedef void (*EnAhActionFunc)(struct EnAh*, PlayState*); +typedef void (*EnAhUnkFunc)(struct EnAh*, PlayState*); typedef struct EnAh { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 22b2a02288..2446422254 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -11,25 +11,25 @@ #define THIS ((EnAkindonuts*)thisx) -void EnAkindonuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAkindonuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAkindonuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAkindonuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAkindonuts_Init(Actor* thisx, PlayState* play); +void EnAkindonuts_Destroy(Actor* thisx, PlayState* play); +void EnAkindonuts_Update(Actor* thisx, PlayState* play); +void EnAkindonuts_Draw(Actor* thisx, PlayState* play); -void func_80BEEDC0(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEEE10(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEEFA8(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF18C(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF20C(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF360(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF450(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF4B8(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF518(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF770(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF83C(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEF9F0(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEFAF0(EnAkindonuts* this, GlobalContext* globalCtx); -void func_80BEFD74(EnAkindonuts* this, GlobalContext* globalCtx); +void func_80BEEDC0(EnAkindonuts* this, PlayState* play); +void func_80BEEE10(EnAkindonuts* this, PlayState* play); +void func_80BEEFA8(EnAkindonuts* this, PlayState* play); +void func_80BEF18C(EnAkindonuts* this, PlayState* play); +void func_80BEF20C(EnAkindonuts* this, PlayState* play); +void func_80BEF360(EnAkindonuts* this, PlayState* play); +void func_80BEF450(EnAkindonuts* this, PlayState* play); +void func_80BEF4B8(EnAkindonuts* this, PlayState* play); +void func_80BEF518(EnAkindonuts* this, PlayState* play); +void func_80BEF770(EnAkindonuts* this, PlayState* play); +void func_80BEF83C(EnAkindonuts* this, PlayState* play); +void func_80BEF9F0(EnAkindonuts* this, PlayState* play); +void func_80BEFAF0(EnAkindonuts* this, PlayState* play); +void func_80BEFD74(EnAkindonuts* this, PlayState* play); const ActorInit En_Akindonuts_InitVars = { ACTOR_EN_AKINDONUTS, @@ -143,14 +143,14 @@ void func_80BECBE0(EnAkindonuts* this, s16 arg1) { Actor_UpdatePos(&this->actor); } -void func_80BECC7C(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BECC7C(EnAkindonuts* this, PlayState* play) { if (this->unk_32C & 4) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->unk_32C & 2) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); } } @@ -253,8 +253,8 @@ s32 func_80BED034(EnAkindonuts* this) { return 0; } -void func_80BED090(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BED090(PlayState* play) { + Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { gSaveContext.save.weekEventReg[63] |= 8; @@ -271,8 +271,8 @@ void func_80BED090(GlobalContext* globalCtx) { } } -s32 func_80BED140(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BED140(PlayState* play) { + Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { if ((gSaveContext.save.weekEventReg[63] & 8) && !(gSaveContext.save.weekEventReg[63] & 0x10)) { @@ -359,8 +359,8 @@ s32 func_80BED35C(EnAkindonuts* this) { return 3; } -void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BED3BC(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -425,8 +425,8 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C &= ~0x1; this->unk_32C |= 0x40; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -445,7 +445,7 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { case 0x15E5: this->unk_33C = 0x15E6; - func_80BED090(globalCtx); + func_80BED090(play); gSaveContext.save.weekEventReg[61] |= 0x10; this->unk_32C |= 0x20; break; @@ -455,13 +455,13 @@ void func_80BED3BC(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BED680(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BED680(EnAkindonuts* this, PlayState* play) { switch (this->unk_33C) { case 0: - if (func_80BED140(globalCtx) && !(gSaveContext.save.weekEventReg[61] & 0x40)) { + if (func_80BED140(play) && !(gSaveContext.save.weekEventReg[61] & 0x40)) { gSaveContext.save.weekEventReg[61] |= 0x40; this->unk_33C = 0x15F0; break; @@ -508,8 +508,8 @@ void func_80BED680(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -526,11 +526,11 @@ void func_80BED680(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BED8A4(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BED8A4(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -603,8 +603,8 @@ void func_80BED8A4(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -632,11 +632,11 @@ void func_80BED8A4(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEDB88(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEDB88(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -686,8 +686,8 @@ void func_80BEDB88(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -704,11 +704,11 @@ void func_80BEDB88(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEDDAC(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEDDAC(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -776,8 +776,8 @@ void func_80BEDDAC(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -805,11 +805,11 @@ void func_80BEDDAC(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEE070(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEE070(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -854,8 +854,8 @@ void func_80BEE070(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x161A; this->actionFunc = func_80BEF360; return; @@ -872,11 +872,11 @@ void func_80BEE070(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEE274(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEE274(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -937,8 +937,8 @@ void func_80BEE274(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x1629; this->actionFunc = func_80BEF360; return; @@ -966,11 +966,11 @@ void func_80BEE274(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEE530(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEE530(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_33C) { case 0: @@ -1015,8 +1015,8 @@ void func_80BEE530(EnAkindonuts* this, GlobalContext* globalCtx) { func_8019F208(); this->unk_32C |= 0x40; this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -1033,14 +1033,14 @@ void func_80BEE530(EnAkindonuts* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } -void func_80BEE73C(EnAkindonuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BEE73C(EnAkindonuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s32 params = ENAKINDONUTS_GET_3(&this->actor); - s32 itemActionParam = func_80123810(globalCtx); + s32 itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { if (itemActionParam == PLAYER_AP_DEED_LAND) { @@ -1084,15 +1084,15 @@ void func_80BEE73C(EnAkindonuts* this, GlobalContext* globalCtx) { this->unk_33C = player->actor.textId; this->actionFunc = func_80BEF18C; } - func_801477B4(globalCtx); + func_801477B4(play); } else if (itemActionParam < PLAYER_AP_NONE) { this->unk_33C = D_80BF04AC[params]; - func_80151938(globalCtx, this->unk_33C); + func_80151938(play, this->unk_33C); this->actionFunc = func_80BEF18C; } } -void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEE938(EnAkindonuts* this, PlayState* play) { switch (ENAKINDONUTS_GET_3(&this->actor)) { case 0: if (gSaveContext.save.weekEventReg[61] & 0x10) { @@ -1152,7 +1152,7 @@ void func_80BEE938(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEEB20(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEEB20(EnAkindonuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 sp24 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); s16 phi_v0; @@ -1213,24 +1213,24 @@ void func_80BEEB20(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEEDC0(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEEDC0(EnAkindonuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80BEEE10; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); } } -void func_80BEEE10(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEEE10(EnAkindonuts* 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->state)) { - this->unk_2DC(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->unk_2DC(this, play); this->actionFunc = func_80BEEFA8; } else if (((this->actor.xzDistToPlayer < 100.0f) && (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } else if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_338 = 4; @@ -1239,62 +1239,62 @@ void func_80BEEE10(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEEFA8(EnAkindonuts* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_32C & 1) { this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0; this->actionFunc = func_80BEEE10; } else if (this->unk_32C & 0x20) { this->unk_32C &= ~0x20; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_32C &= ~0x4; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_338 = 8; this->unk_33C = 0; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); this->actionFunc = func_80BEF518; } else { - this->unk_2DC(this, globalCtx); + this->unk_2DC(this, play); } } } else if (temp_v0 == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: this->unk_32C |= 0x8; - this->unk_2DC(this, globalCtx); + this->unk_2DC(this, play); break; case 1: func_8019F230(); this->unk_32C |= 0x10; - this->unk_2DC(this, globalCtx); + this->unk_2DC(this, play); break; } } } else if (temp_v0 == 16) { - func_80BEE73C(this, globalCtx); + func_80BEE73C(this, play); } } -void func_80BEF18C(EnAkindonuts* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void func_80BEF18C(EnAkindonuts* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_33C = 0; this->actionFunc = func_80BEEE10; } } -void func_80BEF20C(EnAkindonuts* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_80BEF20C(EnAkindonuts* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); s16 sp24 = this->skelAnime.curFrame; s16 sp22 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); @@ -1310,53 +1310,53 @@ void func_80BEF20C(EnAkindonuts* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 6); } - if ((sp27 == 5) && Message_ShouldAdvance(globalCtx)) { + if ((sp27 == 5) && Message_ShouldAdvance(play)) { if (this->unk_32C & 1) { this->unk_32C &= ~0x1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BEF360; } else { - this->unk_2DC(this, globalCtx); + this->unk_2DC(this, play); } } } -void func_80BEF360(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEF360(EnAkindonuts* this, PlayState* play) { if (this->unk_32C & 0x40) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_801159EC(this->unk_364); this->unk_32C &= ~0x40; this->actionFunc = func_80BEF450; } else { - Actor_PickUp(&this->actor, globalCtx, func_80BED034(this), 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, func_80BED034(this), 300.0f, 300.0f); } - } else if (Actor_HasParent(&this->actor, globalCtx)) { + } else if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80BEF450; } else { - Actor_PickUp(&this->actor, globalCtx, func_80BECFBC(this), 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, func_80BECFBC(this), 300.0f, 300.0f); } } -void func_80BEF450(EnAkindonuts* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); +void func_80BEF450(EnAkindonuts* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + func_800B85E0(&this->actor, play, 400.0f, -1); this->actionFunc = func_80BEF4B8; } } -void func_80BEF4B8(EnAkindonuts* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - this->unk_2DC(this, globalCtx); +void func_80BEF4B8(EnAkindonuts* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->unk_2DC(this, play); this->actionFunc = func_80BEEFA8; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80BEF518(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEF518(EnAkindonuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 sp24 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); @@ -1441,7 +1441,7 @@ void func_80BEF518(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEF770(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEF770(EnAkindonuts* this, PlayState* play) { f32 sp24 = this->unk_358 - this->actor.world.pos.y; Vec3f sp18; @@ -1450,7 +1450,7 @@ void func_80BEF770(EnAkindonuts* this, GlobalContext* globalCtx) { sp18.x = this->actor.world.pos.x; sp18.y = this->unk_358; sp18.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp18); + func_800B14D4(play, 20.0f, &sp18); } if (sp24 > 5.0f) { @@ -1462,7 +1462,7 @@ void func_80BEF770(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEF83C(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEF83C(EnAkindonuts* this, PlayState* play) { Vec3f sp34; s16 sp32 = this->skelAnime.curFrame; s16 sp30 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); @@ -1479,14 +1479,14 @@ void func_80BEF83C(EnAkindonuts* this, GlobalContext* globalCtx) { if (DECR(this->unk_33A) == 0) { if (!(this->unk_35C & 3)) { sp34 = this->actor.world.pos; - func_800B14D4(globalCtx, 20.0f, &sp34); + func_800B14D4(play, 20.0f, &sp34); } this->actor.velocity.y = 5.0f; } else if (!(this->unk_35C & 3)) { sp34.x = this->actor.world.pos.x; sp34.y = this->unk_358; sp34.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp34); + func_800B14D4(play, 20.0f, &sp34); } if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { this->unk_34C = 0.3f; @@ -1497,7 +1497,7 @@ void func_80BEF83C(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEF9F0(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEF9F0(EnAkindonuts* this, PlayState* play) { this->unk_352 += this->unk_362; if (this->unk_34C >= 1.0f) { this->unk_34C = 1.0f; @@ -1519,7 +1519,7 @@ void func_80BEF9F0(EnAkindonuts* this, GlobalContext* globalCtx) { } } -void func_80BEFAF0(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { Vec3s sp38; f32 sp34; s16 sp32 = false; @@ -1585,19 +1585,19 @@ void func_80BEFAF0(EnAkindonuts* this, GlobalContext* globalCtx) { this->unk_356++; } -void func_80BEFD74(EnAkindonuts* this, GlobalContext* globalCtx) { +void func_80BEFD74(EnAkindonuts* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } -void EnAkindonuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAkindonuts_Init(Actor* thisx, PlayState* play) { s32 pad; EnAkindonuts* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, this->morphTable, 28); - 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.01f); @@ -1606,7 +1606,7 @@ void EnAkindonuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; if (!ENAKINDONUTS_GET_4(&this->actor)) { - this->path = SubS_GetPathByIndex(globalCtx, ENAKINDONUTS_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENAKINDONUTS_GET_FC00(&this->actor), 0x3F); if (this->path == NULL) { Actor_MarkForDeath(&this->actor); return; @@ -1618,33 +1618,32 @@ void EnAkindonuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_32C |= 0x4; this->unk_338 = 4; this->cutscene = this->actor.cutscene; - func_80BEE938(this, globalCtx); + func_80BEE938(this, play); this->actionFunc = func_80BEEB20; } -void EnAkindonuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAkindonuts_Destroy(Actor* thisx, PlayState* play) { EnAkindonuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnAkindonuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAkindonuts_Update(Actor* thisx, PlayState* play) { EnAkindonuts* this = THIS; Actor_SetFocus(&this->actor, 60.0f); SkelAnime_Update(&this->skelAnime); Actor_MoveWithGravity(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_32C & 0x80) { func_800B9010(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); } - func_80BECC7C(this, globalCtx); + func_80BECC7C(this, play); } -s32 EnAkindonuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnAkindonuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnAkindonuts* this = THIS; if (((this->unk_338 == 4) && (this->unk_33E == 0)) || ((this->unk_338 == 8) && (this->unk_33E == 0)) || @@ -1684,10 +1683,10 @@ s32 EnAkindonuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnAkindonuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAkindonuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnAkindonuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnAkindonuts_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnAkindonuts* this = THIS; if (((this->unk_33E == 1) || (this->unk_33E == 2)) && ((limbIndex == 23) || (limbIndex == 24))) { @@ -1703,11 +1702,11 @@ void EnAkindonuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Act } } -void EnAkindonuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAkindonuts_Draw(Actor* thisx, PlayState* play) { EnAkindonuts* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAkindonuts_OverrideLimbDraw, EnAkindonuts_PostLimbDraw, EnAkindonuts_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h index e5d134f454..a148987362 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h @@ -5,8 +5,8 @@ struct EnAkindonuts; -typedef void (*EnAkindonutsActionFunc)(struct EnAkindonuts*, GlobalContext*); -typedef void (*EnAkindonutsUnkFunc)(struct EnAkindonuts*, GlobalContext*); +typedef void (*EnAkindonutsActionFunc)(struct EnAkindonuts*, PlayState*); +typedef void (*EnAkindonutsUnkFunc)(struct EnAkindonuts*, PlayState*); #define ENAKINDONUTS_GET_3(thisx) ((thisx)->params & 3) #define ENAKINDONUTS_GET_4(thisx) (((thisx)->params & 4) >> 2) diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index a14b2e1064..ca51389710 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -11,13 +11,13 @@ #define THIS ((EnAl*)thisx) -void EnAl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAl_Init(Actor* thisx, PlayState* play); +void EnAl_Destroy(Actor* thisx, PlayState* play); +void EnAl_Update(Actor* thisx, PlayState* play); +void EnAl_Draw(Actor* thisx, PlayState* play); -void func_80BDF5E8(EnAl* this, GlobalContext* globalCtx); -void func_80BDF6C4(EnAl* this, GlobalContext* globalCtx); +void func_80BDF5E8(EnAl* this, PlayState* play); +void func_80BDF6C4(EnAl* this, PlayState* play); static u8 D_80BDFC70[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(3, 0x11 - 0x04), @@ -133,12 +133,12 @@ Gfx* D_80BE007C[] = { object_al_DL_0057D0, object_al_DL_005728, object_al_DL_005680, }; -Actor* func_80BDE1A0(EnAl* this, GlobalContext* globalCtx, u8 arg0, s16 arg1) { +Actor* func_80BDE1A0(EnAl* this, PlayState* play, u8 arg0, s16 arg1) { Actor* foundActor = NULL; Actor* temp; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, arg0, arg1); + foundActor = SubS_FindActor(play, foundActor, arg0, arg1); if (foundActor == NULL) { break; @@ -184,25 +184,25 @@ s32 func_80BDE27C(EnAl* this, s32 arg1) { return ret; } -void func_80BDE318(EnAl* this, GlobalContext* globalCtx) { +void func_80BDE318(EnAl* this, PlayState* play) { s32 pad; f32 temp; Collider_UpdateCylinder(&this->actor, &this->unk_310); temp = this->actor.focus.pos.y - this->actor.world.pos.y; this->unk_310.dim.height = temp; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_310.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_310.base); } -Actor* func_80BDE384(EnAl* this, GlobalContext* globalCtx) { +Actor* func_80BDE384(EnAl* this, PlayState* play) { Actor* actor; switch (this->unk_35C) { case 2: if (!(gSaveContext.save.weekEventReg[89] & 8) && (gSaveContext.save.weekEventReg[85] & 0x80)) { - actor = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_PM); + actor = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_PM); } else { - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; } break; @@ -211,7 +211,7 @@ Actor* func_80BDE384(EnAl* this, GlobalContext* globalCtx) { break; default: - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; break; } @@ -314,7 +314,7 @@ s32 func_80BDE678(EnAl* this, s16* arg1, s16 arg2) { return ret; } -s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { +s32 func_80BDE7FC(EnAl* this, PlayState* play) { s32 pad; s16 sp2A = func_80BDE484(this, 0); s32 pad2; @@ -331,8 +331,7 @@ s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { case 6: case 8: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), - this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); } this->unk_4E6++; sp20 = true; @@ -342,7 +341,7 @@ s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { case 3: case 5: case 7: - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); this->unk_4E6++; sp20 = true; break; @@ -356,10 +355,10 @@ s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { return sp20; } -s32 func_80BDE92C(EnAl* this, GlobalContext* globalCtx) { +s32 func_80BDE92C(EnAl* this, PlayState* play) { s32 pad[2]; - Actor* sp1C = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_GM); - Actor* temp_v0 = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TOTO); + Actor* sp1C = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((sp1C == NULL) || (sp1C->update == NULL) || (temp_v0 == NULL) || (temp_v0->update == NULL)) { this->unk_4E6++; @@ -403,7 +402,7 @@ s32 func_80BDE92C(EnAl* this, GlobalContext* globalCtx) { return true; } -s32 func_80BDEA14(EnAl* this, GlobalContext* globalCtx) { +s32 func_80BDEA14(EnAl* this, PlayState* play) { s32 pad; s32 sp18 = false; @@ -427,8 +426,8 @@ s32 func_80BDEA14(EnAl* this, GlobalContext* globalCtx) { return sp18; } -s32* func_80BDEABC(EnAl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32* func_80BDEABC(EnAl* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_35C == 3) { this->unk_4EC = func_80BDE92C; @@ -445,7 +444,7 @@ s32* func_80BDEABC(EnAl* this, GlobalContext* globalCtx) { return D_80BDFE8C; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { return D_80BDFE7C; } return D_80BDFE84; @@ -457,7 +456,7 @@ s32* func_80BDEABC(EnAl* this, GlobalContext* globalCtx) { } this->unk_4EC = func_80BDEA14; - if (Player_GetMask(globalCtx) != PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) != PLAYER_MASK_KAFEIS_MASK) { return D_80BDFDE8; } @@ -473,11 +472,11 @@ s32* func_80BDEABC(EnAl* this, GlobalContext* globalCtx) { return NULL; } -s32 func_80BDEC2C(EnAl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BDEC2C(EnAl* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; - if ((this->unk_4C2 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if ((this->unk_4C2 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_4C2 &= ~0x1800; if (player->exchangeItemId == 0x33) { this->unk_4C2 |= 0x800; @@ -490,7 +489,7 @@ s32 func_80BDEC2C(EnAl* this, GlobalContext* globalCtx) { this->unk_4E6 = 0; this->unk_4EC = 0; this->actor.child = this->unk_368; - this->unk_360 = func_80BDEABC(this, globalCtx); + this->unk_360 = func_80BDEABC(this, play); this->unk_4C2 |= 0x20; this->actionFunc = func_80BDF6C4; ret = true; @@ -545,7 +544,7 @@ void func_80BDEE5C(EnAl* this) { } } -void func_80BDEF3C(EnAl* this, GlobalContext* globalCtx) { +void func_80BDEF3C(EnAl* this, PlayState* play) { if (this->unk_4E4 == 0) { func_80BDE27C(this, 7); this->unk_4C2 &= ~0x20; @@ -559,7 +558,7 @@ void func_80BDEF3C(EnAl* this, GlobalContext* globalCtx) { } } -void func_80BDEFE4(EnAl* this, GlobalContext* globalCtx) { +void func_80BDEFE4(EnAl* this, PlayState* play) { if (this->unk_4E4 == 0) { func_80BDE27C(this, 6); this->unk_4E4 += 1; @@ -569,11 +568,11 @@ void func_80BDEFE4(EnAl* this, GlobalContext* globalCtx) { } } -s32 func_80BDF064(EnAl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 sp22 = globalCtx->msgCtx.currentTextId; - Actor* sp1C = func_80BDE1A0(this, globalCtx, 4, 0xA4); - Actor* temp_v0 = func_80BDE1A0(this, globalCtx, 4, 0x234); +s32 func_80BDF064(EnAl* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 sp22 = play->msgCtx.currentTextId; + Actor* sp1C = func_80BDE1A0(this, play, 4, 0xA4); + Actor* temp_v0 = func_80BDE1A0(this, play, 4, 0x234); if (player->stateFlags1 & 0x40) { this->unk_4C2 |= 0x400; @@ -629,16 +628,16 @@ s32 func_80BDF064(EnAl* this, GlobalContext* globalCtx) { } if (this->unk_18C != NULL) { - this->unk_18C(this, globalCtx); + this->unk_18C(this, play); } return false; } -s32 func_80BDF244(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - Actor* sp20 = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_GM); - Actor* temp_v0 = func_80BDE1A0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TOTO); + Actor* sp20 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((sp20 != NULL) && (sp20->update != NULL) && (temp_v0 != NULL) && (temp_v0->update != NULL)) { func_80BDE27C(this, 0); @@ -650,7 +649,7 @@ s32 func_80BDF244(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BDF308(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleResult* arg2) { SubS_UpdateFlags(&this->unk_4C2, 3, 7); switch (arg2->result) { @@ -667,7 +666,7 @@ s32 func_80BDF308(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -s32 func_80BDF390(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleResult* arg2) { s32 ret; this->actor.flags |= ACTOR_FLAG_1; @@ -678,12 +677,12 @@ s32 func_80BDF390(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { switch (arg2->result) { case 3: - ret = func_80BDF244(this, globalCtx, arg2); + ret = func_80BDF244(this, play, arg2); break; case 1: case 2: - ret = func_80BDF308(this, globalCtx, arg2); + ret = func_80BDF308(this, play, arg2); break; default: @@ -693,7 +692,7 @@ s32 func_80BDF390(EnAl* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -void func_80BDF414(EnAl* this, GlobalContext* globalCtx) { +void func_80BDF414(EnAl* this, PlayState* play) { s16 temp_v0; switch (this->unk_4EA) { @@ -727,30 +726,30 @@ void func_80BDF414(EnAl* this, GlobalContext* globalCtx) { } } -void func_80BDF568(EnAl* this, GlobalContext* globalCtx) { +void func_80BDF568(EnAl* this, PlayState* play) { } -void func_80BDF578(EnAl* this, GlobalContext* globalCtx) { +void func_80BDF578(EnAl* this, PlayState* play) { switch (this->unk_35C) { case 1: case 3: - func_80BDF568(this, globalCtx); + func_80BDF568(this, play); break; case 2: - func_80BDF414(this, globalCtx); + func_80BDF414(this, play); break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80BDF5E8(EnAl* this, GlobalContext* globalCtx) { +void func_80BDF5E8(EnAl* this, PlayState* play) { ScheduleResult sp20; this->unk_4E0 = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BDFC70, &sp20) || - ((this->unk_35C != sp20.result) && !func_80BDF390(this, globalCtx, &sp20))) { + if (!Schedule_RunScript(play, D_80BDFC70, &sp20) || + ((this->unk_35C != sp20.result) && !func_80BDF390(this, play, &sp20))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp20.result = 0; @@ -759,12 +758,12 @@ void func_80BDF5E8(EnAl* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; } this->unk_35C = sp20.result; - this->unk_368 = func_80BDE384(this, globalCtx); - func_80BDF578(this, globalCtx); + this->unk_368 = func_80BDE384(this, play); + func_80BDF578(this, play); } -void func_80BDF6C4(EnAl* this, GlobalContext* globalCtx) { - if (func_8010BF58(&this->actor, globalCtx, this->unk_360, this->unk_4EC, &this->unk_364)) { +void func_80BDF6C4(EnAl* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, this->unk_360, this->unk_4EC, &this->unk_364)) { SubS_UpdateFlags(&this->unk_4C2, 3, 7); this->unk_4C2 &= ~0x20; this->unk_4C2 |= 0x200; @@ -777,47 +776,46 @@ void func_80BDF6C4(EnAl* this, GlobalContext* globalCtx) { } } -void EnAl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAl_Init(Actor* thisx, PlayState* play) { EnAl* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_al_Skel_00A0D8, NULL, this->jointTable, this->morphTable, - 27); + SkelAnime_InitFlex(play, &this->skelAnime, &object_al_Skel_00A0D8, NULL, this->jointTable, this->morphTable, 27); this->unk_4F8 = -1; func_80BDE27C(this, 1); - Collider_InitAndSetCylinder(globalCtx, &this->unk_310, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->unk_310, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->unk_35C = 0; this->actionFunc = func_80BDF5E8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnAl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAl_Destroy(Actor* thisx, PlayState* play) { EnAl* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->unk_310); + Collider_DestroyCylinder(play, &this->unk_310); } -void EnAl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAl_Update(Actor* thisx, PlayState* play) { EnAl* this = THIS; - func_80BDEC2C(this, globalCtx); + func_80BDEC2C(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80BDF064(this, globalCtx); + func_80BDF064(this, play); if (this->unk_35C != 0) { func_80BDE250(this); func_80BDEE5C(this); - func_8013C964(&this->actor, globalCtx, this->unk_4D4, 30.0f, this->unk_4F0, this->unk_4C2 & 7); - func_80BDE318(this, globalCtx); + func_8013C964(&this->actor, play, this->unk_4D4, 30.0f, this->unk_4F0, this->unk_4C2 & 7); + func_80BDE318(this, play); } } -s32 EnAl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnAl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { switch (limbIndex) { case 3: case 11: @@ -834,7 +832,7 @@ s32 EnAl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnAl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnAl* this = THIS; switch (limbIndex) { @@ -869,7 +867,7 @@ void EnAl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnAl_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnAl_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnAl* this = THIS; s32 stepRot; s32 overrideRot; @@ -899,27 +897,26 @@ void EnAl_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnAl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAl_Draw(Actor* thisx, PlayState* play) { EnAl* this = THIS; s32 i; if (this->unk_35C != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(0.0f, 0.0f, 850.0f, MTXMODE_APPLY); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAl_OverrideLimbDraw, EnAl_PostLimbDraw, EnAl_TransformLimbDraw, &this->actor); for (i = 0; i < ARRAY_COUNT(this->unk_190); i++) { Matrix_Put(&this->unk_190[i]); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80BE007C[i]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.h b/src/overlays/actors/ovl_En_Al/z_en_al.h index 9e5ee8872e..42fe81ef2f 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.h +++ b/src/overlays/actors/ovl_En_Al/z_en_al.h @@ -5,9 +5,9 @@ struct EnAl; -typedef void (*EnAlActionFunc)(struct EnAl*, GlobalContext*); -typedef s32 (*EnAlUnkFunc)(struct EnAl*, GlobalContext*); -typedef void (*EnAlUnkFunc2)(struct EnAl*, GlobalContext*); +typedef void (*EnAlActionFunc)(struct EnAl*, PlayState*); +typedef s32 (*EnAlUnkFunc)(struct EnAl*, PlayState*); +typedef void (*EnAlUnkFunc2)(struct EnAl*, PlayState*); typedef struct EnAl { /* 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 00c07327e6..7bc18e5c5c 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -12,30 +12,30 @@ #define THIS ((EnAm*)thisx) -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 func_808AFF9C(EnAm* this); -void EnAm_RemoveEnemyTexture(EnAm* this, GlobalContext* globalCtx); +void EnAm_RemoveEnemyTexture(EnAm* this, PlayState* play); void EnAm_WakeUp(EnAm* this); -void EnAm_ApplyEnemyTexture(EnAm* this, GlobalContext* globalCtx); +void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play); void func_808B0358(EnAm* this); -void func_808B03C0(EnAm* this, GlobalContext* globalCtx); +void func_808B03C0(EnAm* this, PlayState* play); void func_808B0460(EnAm* this); -void func_808B04A8(EnAm* this, GlobalContext* globalCtx); -void func_808B0508(EnAm* this, GlobalContext* globalCtx); +void func_808B04A8(EnAm* this, PlayState* play); +void func_808B0508(EnAm* this, PlayState* play); void func_808B057C(EnAm* this); -void func_808B05C8(EnAm* this, GlobalContext* globalCtx); +void func_808B05C8(EnAm* this, PlayState* play); void func_808B0640(EnAm* this); -void func_808B066C(EnAm* this, GlobalContext* globalCtx); -void EnAm_TakeDamage(EnAm* this, GlobalContext* globalCtx); -void func_808B07A8(EnAm* this, GlobalContext* globalCtx); +void func_808B066C(EnAm* this, PlayState* play); +void EnAm_TakeDamage(EnAm* this, PlayState* play); +void func_808B07A8(EnAm* this, PlayState* play); void func_808B0820(EnAm* this); -void func_808B0894(EnAm* this, GlobalContext* globalCtx); -void func_808B0B4C(EnAm* this, GlobalContext* globalCtx); -void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor); +void func_808B0894(EnAm* this, PlayState* play); +void func_808B0B4C(EnAm* this, PlayState* play); +void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor); const ActorInit En_Am_InitVars = { ACTOR_EN_AM, @@ -162,15 +162,15 @@ static Vec3f D_808B117C[] = { { 800.0f, -1000.0f, -1000.0f }, }; -void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Init(Actor* thisx, PlayState* play) { EnAm* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 300.0f / 7.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_am_Skel_005948, &gArmosPushedBackAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_am_Skel_005948, &gArmosPushedBackAnim, this->jointTable, this->morphTable, OBJECT_AM_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->enemyCollider, &this->actor, &sEnemyCylinderInit); - Collider_InitAndSetCylinder(globalCtx, &this->interactCollider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->enemyCollider, &this->actor, &sEnemyCylinderInit); + Collider_InitAndSetCylinder(play, &this->interactCollider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->actor.home.pos.x -= 9.0f * Math_SinS(this->actor.shape.rot.y); this->actor.home.pos.z -= 9.0f * Math_CosS(this->actor.shape.rot.y); @@ -179,14 +179,14 @@ void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) { func_808AFF9C(this); } -void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Destroy(Actor* thisx, PlayState* play) { EnAm* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->enemyCollider); - Collider_DestroyCylinder(globalCtx, &this->interactCollider); + Collider_DestroyCylinder(play, &this->enemyCollider); + Collider_DestroyCylinder(play, &this->interactCollider); } -void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { +void EnAm_SpawnEffects(EnAm* this, PlayState* play) { s32 i; Vec3f effectPos; s32 pad; @@ -196,10 +196,10 @@ void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) { effectPos.x = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.x; effectPos.y = randPlusMinusPoint5Scaled(10.0f) + (this->actor.world.pos.y + 40.0f); effectPos.z = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.z; - EffectSsKirakira_SpawnSmall(globalCtx, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); + EffectSsKirakira_SpawnSmall(play, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_WALK); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 4.0f, 3, 8.0f, 300, 15, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 4.0f, 3, 8.0f, 300, 15, 0); } void func_808AFF9C(EnAm* this) { @@ -215,7 +215,7 @@ void func_808AFF9C(EnAm* this) { this->actionFunc = EnAm_RemoveEnemyTexture; } -void EnAm_RemoveEnemyTexture(EnAm* this, GlobalContext* globalCtx) { +void EnAm_RemoveEnemyTexture(EnAm* this, PlayState* play) { if (((this->enemyCollider.base.ocFlags1 & OC1_HIT) && (this->enemyCollider.base.ocFlags2 & OC2_HIT_PLAYER)) || (this->interactCollider.base.acFlags & AC_HIT)) { if (this->textureBlend == 0) { @@ -237,7 +237,7 @@ void EnAm_WakeUp(EnAm* this) { this->actionFunc = EnAm_ApplyEnemyTexture; } -void EnAm_ApplyEnemyTexture(EnAm* this, GlobalContext* globalCtx) { +void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play) { s32 tempTextureBlend; f32 cos; u8 pad; @@ -263,7 +263,7 @@ void EnAm_ApplyEnemyTexture(EnAm* this, GlobalContext* globalCtx) { } } -void func_808B0208(EnAm* this, GlobalContext* globalCtx) { +void func_808B0208(EnAm* this, PlayState* play) { // If the armos is against a wall, rotate and turn away from it if ((this->actor.speedXZ > 0.0f) && (this->actor.bgCheckFlags & 8)) { this->actor.world.rot.y = (this->actor.wallYaw * 2) - this->actor.world.rot.y; @@ -281,7 +281,7 @@ void func_808B0208(EnAm* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, this->armosYaw, 0x1F40); this->actor.speedXZ = 0.0f; if (this->actor.bgCheckFlags & 2) { - EnAm_SpawnEffects(this, globalCtx); + EnAm_SpawnEffects(this, play); } } } @@ -299,9 +299,9 @@ void func_808B0358(EnAm* this) { this->actionFunc = func_808B03C0; } -void func_808B03C0(EnAm* this, GlobalContext* globalCtx) { +void func_808B03C0(EnAm* this, PlayState* play) { this->armosYaw = this->actor.yawTowardsPlayer; - func_808B0208(this, globalCtx); + func_808B0208(this, play); if (this->actor.bgCheckFlags & 2) { this->explodeTimer--; } @@ -319,8 +319,8 @@ void func_808B0460(EnAm* this) { this->actionFunc = func_808B04A8; } -void func_808B04A8(EnAm* this, GlobalContext* globalCtx) { - func_808B0208(this, globalCtx); +void func_808B04A8(EnAm* this, PlayState* play) { + func_808B0208(this, play); if (this->armosYaw == this->actor.world.rot.y) { func_808B057C(this); } @@ -332,8 +332,8 @@ void func_808B04E4(EnAm* this) { this->actionFunc = func_808B0508; } -void func_808B0508(EnAm* this, GlobalContext* globalCtx) { - func_808B0208(this, globalCtx); +void func_808B0508(EnAm* this, PlayState* play) { + func_808B0208(this, play); if (!(this->actor.bgCheckFlags & 1)) { Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 2.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 2.0f); @@ -350,9 +350,9 @@ void func_808B057C(EnAm* this) { this->actionFunc = func_808B05C8; } -void func_808B05C8(EnAm* this, GlobalContext* globalCtx) { +void func_808B05C8(EnAm* this, PlayState* play) { this->armosYaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); - func_808B0208(this, globalCtx); + func_808B0208(this, play); if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 8.0f) { func_808B04E4(this); } @@ -365,12 +365,12 @@ void func_808B0640(EnAm* this) { this->actionFunc = func_808B066C; } -void func_808B066C(EnAm* this, GlobalContext* globalCtx) { +void func_808B066C(EnAm* this, PlayState* play) { if (this->explodeTimer != 0) { this->explodeTimer--; } else { this->armosYaw = this->actor.yawTowardsPlayer; - func_808B0208(this, globalCtx); + func_808B0208(this, play); if (this->armosYaw == this->actor.shape.rot.y) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_VOICE); func_808B0358(this); @@ -378,7 +378,7 @@ void func_808B066C(EnAm* this, GlobalContext* globalCtx) { } } -void EnAm_TakeDamage(EnAm* this, GlobalContext* globalCtx) { +void EnAm_TakeDamage(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosTakeDamageAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gArmosTakeDamageAnim) - 6, 2, 0.0f); func_800BE504(&this->actor, &this->enemyCollider); @@ -390,7 +390,7 @@ void EnAm_TakeDamage(EnAm* this, GlobalContext* globalCtx) { this->actionFunc = func_808B07A8; } -void func_808B07A8(EnAm* this, GlobalContext* globalCtx) { +void func_808B07A8(EnAm* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { @@ -412,29 +412,29 @@ void func_808B0820(EnAm* this) { this->actionFunc = func_808B0894; } -void func_808B0894(EnAm* this, GlobalContext* globalCtx) { +void func_808B0894(EnAm* this, PlayState* play) { s32 i; Vec3f dustPos; s32 pad; this->explodeTimer--; this->armosYaw = this->actor.yawTowardsPlayer; - func_808B0208(this, globalCtx); + func_808B0208(this, play); if (this->explodeTimer == 1) { - EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + EnBom* 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, 2, 0); if (bomb != NULL) { bomb->timer = 0; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEAD); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); for (i = 0; i < 8; i++) { dustPos.x = (Math_SinS(0) * 7.0f) + this->actor.world.pos.x; dustPos.y = (randPlusMinusPoint5Scaled(10.0f) * 6.0f) + (this->actor.world.pos.y + 40.0f); dustPos.z = (Math_CosS(0) * 7.0f) + this->actor.world.pos.z; - func_800B0EB0(globalCtx, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_808B1120, &D_808B1124, 200, 45, 12); + func_800B0EB0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_808B1120, &D_808B1124, 200, 45, 12); } } else if (this->explodeTimer == 0) { Actor_MarkForDeath(&this->actor); @@ -448,26 +448,26 @@ void func_808B0894(EnAm* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += this->actor.world.rot.z; } -void func_808B0AD0(EnAm* this, GlobalContext* globalCtx) { +void func_808B0AD0(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosPushedBackAnim, 1.0f, 0.0f, 8.0f, 2, 0.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -6.0f; this->actionFunc = func_808B0B4C; } -void func_808B0B4C(EnAm* this, GlobalContext* globalCtx) { +void func_808B0B4C(EnAm* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { func_808B0358(this); } } -s32 EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { +s32 EnAm_UpdateDamage(EnAm* this, PlayState* play) { if (this->enemyCollider.base.acFlags & AC_HIT) { this->enemyCollider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->enemyCollider.info); if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } if (this->actor.colChkInfo.damageEffect == 0xD) { return true; @@ -479,54 +479,54 @@ s32 EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect == 0x4) { this->drawDmgEffScale = 0.7f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->enemyCollider.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->enemyCollider.info.bumper.hitPos.x, this->enemyCollider.info.bumper.hitPos.y, this->enemyCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } - EnAm_TakeDamage(this, globalCtx); + EnAm_TakeDamage(this, play); return true; } return false; } -void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Update(Actor* thisx, PlayState* play) { EnAm* this = THIS; s32 pad; - if (EnAm_UpdateDamage(this, globalCtx) == false) { + if (EnAm_UpdateDamage(this, play) == false) { if (this->enemyCollider.base.atFlags & AT_BOUNCED) { this->enemyCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); if (this->actor.colChkInfo.health == 0) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; } else { - func_808B0AD0(this, globalCtx); + func_808B0AD0(this, play); } } } if (this->returnHomeTimer != 0) { this->returnHomeTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, 0x1D); Actor_SetFocus(&this->actor, 64.0f); Collider_UpdateCylinder(&this->actor, &this->enemyCollider); Collider_UpdateCylinder(&this->actor, &this->interactCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->enemyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->enemyCollider.base); if (this->enemyCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->enemyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->enemyCollider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->interactCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->interactCollider.base); if (this->enemyCollider.base.atFlags & AC_ON) { this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->enemyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->enemyCollider.base); } Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.35f; this->drawDmgEffScale = (this->drawDmgEffScale > 0.7f) ? 0.7f : this->drawDmgEffScale; } -void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 i; s32 phi_s3; Vec3f* phi_s1; @@ -555,18 +555,18 @@ void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAm_Draw(Actor* thisx, PlayState* play) { Gfx* gfx; EnAm* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); gDPSetEnvColor(&gfx[1], 0, 0, 0, this->textureBlend); POLY_OPA_DISP = &gfx[2]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, - 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); - CLOSE_DISPS(globalCtx->state.gfxCtx); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, 0.0f, + this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); + CLOSE_DISPS(play->state.gfxCtx); } 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 2199a832f7..50770ccfcc 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 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_An/z_en_an.c b/src/overlays/actors/ovl_En_An/z_en_an.c index 9144d34fa0..33638774e0 100644 --- a/src/overlays/actors/ovl_En_An/z_en_an.c +++ b/src/overlays/actors/ovl_En_An/z_en_an.c @@ -10,13 +10,13 @@ #define THIS ((EnAn*)thisx) -void EnAn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAn_Update(Actor* thisx, GlobalContext* globalCtx); +void EnAn_Init(Actor* thisx, PlayState* play); +void EnAn_Destroy(Actor* thisx, PlayState* play); +void EnAn_Update(Actor* thisx, PlayState* play); -void func_80B577F0(EnAn* this, GlobalContext* globalCtx); -void func_80B578F8(EnAn* this, GlobalContext* globalCtx); -void func_80B57A44(EnAn* this, GlobalContext* globalCtx); +void func_80B577F0(EnAn* this, PlayState* play); +void func_80B578F8(EnAn* this, PlayState* play); +void func_80B57A44(EnAn* this, PlayState* play); #if 0 const ActorInit En_An_InitVars = { diff --git a/src/overlays/actors/ovl_En_An/z_en_an.h b/src/overlays/actors/ovl_En_An/z_en_an.h index 67328bacd5..71eff9d4e0 100644 --- a/src/overlays/actors/ovl_En_An/z_en_an.h +++ b/src/overlays/actors/ovl_En_An/z_en_an.h @@ -5,7 +5,7 @@ struct EnAn; -typedef void (*EnAnActionFunc)(struct EnAn*, GlobalContext*); +typedef void (*EnAnActionFunc)(struct EnAn*, PlayState*); typedef struct EnAn { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_And/z_en_and.c b/src/overlays/actors/ovl_En_And/z_en_and.c index 437bd17500..04c4619080 100644 --- a/src/overlays/actors/ovl_En_And/z_en_and.c +++ b/src/overlays/actors/ovl_En_And/z_en_and.c @@ -10,12 +10,12 @@ #define THIS ((EnAnd*)thisx) -void EnAnd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAnd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAnd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAnd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAnd_Init(Actor* thisx, PlayState* play); +void EnAnd_Destroy(Actor* thisx, PlayState* play); +void EnAnd_Update(Actor* thisx, PlayState* play); +void EnAnd_Draw(Actor* thisx, PlayState* play); -void func_80C18C50(EnAnd* this, GlobalContext* globalCtx); +void func_80C18C50(EnAnd* this, PlayState* play); #if 0 const ActorInit En_And_InitVars = { diff --git a/src/overlays/actors/ovl_En_And/z_en_and.h b/src/overlays/actors/ovl_En_And/z_en_and.h index 6cb5982235..680a179dae 100644 --- a/src/overlays/actors/ovl_En_And/z_en_and.h +++ b/src/overlays/actors/ovl_En_And/z_en_and.h @@ -5,7 +5,7 @@ struct EnAnd; -typedef void (*EnAndActionFunc)(struct EnAnd*, GlobalContext*); +typedef void (*EnAndActionFunc)(struct EnAnd*, PlayState*); typedef struct EnAnd { /* 0x0000 */ Actor actor; 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 2f03bec060..3264bd95aa 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -19,25 +19,25 @@ #define ANI_STATE_FALLING (1 << 3) // clang-format on -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); void EnAni_DefaultBlink(EnAni* this); void EnAni_WaitForEyeClose(EnAni* this); void EnAni_WaitForEyeOpen(EnAni* this); -void EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId); +void EnAni_SetText(EnAni* this, PlayState* play, u16 textId); -void EnAni_HangInTree(EnAni* this, GlobalContext* globalCtx); -void EnAni_LoseBalance(EnAni* this, GlobalContext* globalCtx); -void EnAni_FallToGround(EnAni* this, GlobalContext* globalCtx); -void EnAni_LandOnFoot(EnAni* this, GlobalContext* globalCtx); -void EnAni_FallOverInPain(EnAni* this, GlobalContext* globalCtx); -void EnAni_IdleInPain(EnAni* this, GlobalContext* globalCtx); -void EnAni_Talk(EnAni* this, GlobalContext* globalCtx); -void EnAni_IdleStanding(EnAni* this, GlobalContext* globalCtx); +void EnAni_HangInTree(EnAni* this, PlayState* play); +void EnAni_LoseBalance(EnAni* this, PlayState* play); +void EnAni_FallToGround(EnAni* this, PlayState* play); +void EnAni_LandOnFoot(EnAni* this, PlayState* play); +void EnAni_FallOverInPain(EnAni* this, PlayState* play); +void EnAni_IdleInPain(EnAni* this, PlayState* play); +void EnAni_Talk(EnAni* this, PlayState* play); +void EnAni_IdleStanding(EnAni* this, PlayState* play); const ActorInit En_Ani_InitVars = { ACTOR_EN_ANI, @@ -110,17 +110,17 @@ void EnAni_WaitForEyeOpen(EnAni* this) { } } -void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Init(Actor* thisx, PlayState* play) { s32 pad; EnAni* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gAniSkeleton, &gAniStandingNormalAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gAniSkeleton, &gAniStandingNormalAnim, this->jointTable, this->morphTable, ANI_LIMB_MAX); Animation_PlayOnce(&this->skelAnime, &gAniStandingNormalAnim); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider2); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->stateFlags = ANI_STATE_STANDING; @@ -151,46 +151,46 @@ void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Destroy(Actor* thisx, PlayState* play) { EnAni* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) { +void EnAni_SetText(EnAni* this, PlayState* play, u16 textId) { s16 diffAngle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; this->actor.textId = textId; if ((this->stateFlags & ANI_STATE_WRITHING) || ABS_ALT(diffAngle) <= 0x4300) { if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } } -void EnAni_IdleStanding(EnAni* this, GlobalContext* globalCtx) { +void EnAni_IdleStanding(EnAni* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnAni_Talk(EnAni* this, GlobalContext* globalCtx) { +void EnAni_Talk(EnAni* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) == 2 && globalCtx->msgCtx.currentTextId == 0x6DE) { + if (Message_GetState(&play->msgCtx) == 2 && play->msgCtx.currentTextId == 0x6DE) { this->actionFunc = EnAni_IdleInPain; } } -void EnAni_IdleInPain(EnAni* this, GlobalContext* globalCtx) { +void EnAni_IdleInPain(EnAni* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnAni_Talk; } else { // telling you not to take his rupees you knocked from the tree - EnAni_SetText(this, globalCtx, 0x6DE); + EnAni_SetText(this, play, 0x6DE); } } -void EnAni_FallOverInPain(EnAni* this, GlobalContext* globalCtx) { +void EnAni_FallOverInPain(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->blinkFunc = EnAni_WaitForEyeOpen; this->actionFunc = EnAni_IdleInPain; @@ -199,7 +199,7 @@ void EnAni_FallOverInPain(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_LandOnFoot(EnAni* this, GlobalContext* globalCtx) { +void EnAni_LandOnFoot(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = EnAni_FallOverInPain; Animation_Change(&this->skelAnime, &gAniFallOverHoldingFootAnim, 1.0f, 0.0f, @@ -207,7 +207,7 @@ void EnAni_LandOnFoot(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_FallToGround(EnAni* this, GlobalContext* globalCtx) { +void EnAni_FallToGround(EnAni* this, PlayState* play) { s32 pad; s16 quakeValue; @@ -219,7 +219,7 @@ void EnAni_FallToGround(EnAni* this, GlobalContext* globalCtx) { // the animation gets cut short, (first 16 frames only) only the landing part is seen Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 1.0f, 0.0f, 16.0f, ANIMMODE_ONCE, 0.0f); this->stateFlags |= ANI_STATE_WRITHING; - quakeValue = Quake_Add(globalCtx->cameraPtrs[0], 3); + quakeValue = Quake_Add(play->cameraPtrs[0], 3); Quake_SetSpeed(quakeValue, 0x6978); Quake_SetQuakeValues(quakeValue, 7, 0, 0, 0); Quake_SetCountdown(quakeValue, 0x14); @@ -230,7 +230,7 @@ void EnAni_FallToGround(EnAni* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } -void EnAni_LoseBalance(EnAni* this, GlobalContext* globalCtx) { +void EnAni_LoseBalance(EnAni* this, PlayState* play) { s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -245,7 +245,7 @@ void EnAni_LoseBalance(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_HangInTree(EnAni* this, GlobalContext* globalCtx) { +void EnAni_HangInTree(EnAni* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->treeReachTimer > 0) { this->treeReachTimer--; @@ -271,15 +271,15 @@ void EnAni_HangInTree(EnAni* this, GlobalContext* globalCtx) { } } -void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAni_Update(Actor* thisx, PlayState* play) { EnAni* this = THIS; f32 minVelocity; Collider_UpdateCylinder(&this->actor, &this->collider1); Collider_UpdateCylinder(&this->actor, &this->collider2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (!(this->stateFlags & ANI_STATE_UNK)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } this->actor.velocity.y += this->actor.gravity; @@ -289,10 +289,10 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); if (this->actor.xzDistToPlayer < 100.0f && !(this->stateFlags & ANI_STATE_CLIMBING)) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRot, &this->chestRot, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->chestRot, this->actor.focus.pos); this->chestRot.x = this->chestRot.y = this->chestRot.z = 0; } else { Math_SmoothStepToS(&this->headRot.x, 0, 0x6, 0x1838, 0x64); @@ -308,7 +308,7 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->actor.cutscene)), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->actor.cutscene)), &this->actor); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -316,7 +316,7 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnAni_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnAni* this = THIS; if (limbIndex == ANI_LIMB_HEAD) { @@ -327,7 +327,7 @@ s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAni_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_809686A4 = { 800.0f, 500.0f, 0.0f }; if (limbIndex == ANI_LIMB_HEAD) { @@ -335,20 +335,20 @@ 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 TexturePtr sEyeTextures[] = { gAniOpenEyeTex, gAniClosingEyeTex, gAniClosedEyeTex }; s32 pad; EnAni* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, 0.0f, -1000.0f, MTXMODE_APPLY); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); - 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->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 21dced2c18..52e60fc317 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 void (*EnAniBlinkFunc)(struct EnAni*); diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 3fc7566a5b..91c543f7ea 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -12,25 +12,25 @@ #define THIS ((EnAob01*)thisx) -void EnAob01_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAob01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAob01_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAob01_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAob01_Init(Actor* thisx, PlayState* play); +void EnAob01_Destroy(Actor* thisx, PlayState* play); +void EnAob01_Update(Actor* thisx, PlayState* play); +void EnAob01_Draw(Actor* thisx, PlayState* play); -void func_809C1C9C(EnAob01* this, GlobalContext* globalCtx); -void func_809C1D64(EnAob01* this, GlobalContext* globalCtx); -void func_809C2060(EnAob01* this, GlobalContext* globalCtx); -void func_809C21E0(EnAob01* this, GlobalContext* globalCtx); -void func_809C26E4(EnAob01* this, GlobalContext* globalCtx); -void func_809C2730(EnAob01* this, GlobalContext* globalCtx); -void func_809C2788(EnAob01* this, GlobalContext* globalCtx); -void func_809C2824(EnAob01* this, GlobalContext* globalCtx); -void func_809C28B8(EnAob01* this, GlobalContext* globalCtx); -void func_809C2A64(EnAob01* this, GlobalContext* globalCtx); -void func_809C2BE4(EnAob01* this, GlobalContext* globalCtx); -void func_809C2C9C(EnAob01* this, GlobalContext* globalCtx); -void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx); -s32 func_809C2EC4(EnAob01* this, GlobalContext* globalCtx); +void func_809C1C9C(EnAob01* this, PlayState* play); +void func_809C1D64(EnAob01* this, PlayState* play); +void func_809C2060(EnAob01* this, PlayState* play); +void func_809C21E0(EnAob01* this, PlayState* play); +void func_809C26E4(EnAob01* this, PlayState* play); +void func_809C2730(EnAob01* this, PlayState* play); +void func_809C2788(EnAob01* this, PlayState* play); +void func_809C2824(EnAob01* this, PlayState* play); +void func_809C28B8(EnAob01* this, PlayState* play); +void func_809C2A64(EnAob01* this, PlayState* play); +void func_809C2BE4(EnAob01* this, PlayState* play); +void func_809C2C9C(EnAob01* this, PlayState* play); +void func_809C2D0C(EnAob01* this, PlayState* play); +s32 func_809C2EC4(EnAob01* this, PlayState* play); const ActorInit En_Aob_01_InitVars = { ACTOR_EN_AOB_01, @@ -104,41 +104,41 @@ void func_809C1124(void) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed); } -void func_809C1158(EnAob01* this, GlobalContext* globalCtx) { +void func_809C1158(EnAob01* this, PlayState* play) { s32 temp_s0 = ENAOB01_GET_7E00_2(&this->actor); s16 i = 0; if (temp_s0 != 0x3F) { do { - this->unk_1D8[i] = SubS_GetPathByIndex(globalCtx, temp_s0, 0x3F); + this->unk_1D8[i] = SubS_GetPathByIndex(play, temp_s0, 0x3F); temp_s0 = this->unk_1D8[i]->unk1; i++; } while (temp_s0 != 0xFF); } } -void func_809C11EC(EnAob01* this, GlobalContext* globalCtx) { +void func_809C11EC(EnAob01* this, PlayState* play) { s32 unk; s16 i; - func_809C1158(this, globalCtx); + func_809C1158(this, play); for (i = 0; i < ARRAY_COUNT(D_809C384C); i++) { unk = (this->unk_1D8[D_809C384C[i].unk_06]->unk1 << 0xA) | (i << 5); this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_DG, D_809C384C[i].unk_00.x, D_809C384C[i].unk_00.y, - D_809C384C[i].unk_00.z, 0, D_809C384C[i].unk_04 * 182.04445f, 0, unk, 0xFFFF, this->actor.unk20, NULL); + &play->actorCtx, play, ACTOR_EN_DG, D_809C384C[i].unk_00.x, D_809C384C[i].unk_00.y, D_809C384C[i].unk_00.z, + 0, D_809C384C[i].unk_04 * 182.04445f, 0, unk, 0xFFFF, this->actor.unk20, NULL); } } -void func_809C1304(EnAob01* this, GlobalContext* globalCtx) { +void func_809C1304(EnAob01* this, PlayState* play) { s16 i; for (i = 0; i < ARRAY_COUNT(this->unk_3F8); i++) { this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_RACEDOG, (i * 15.0f) + -3897.0f, 130.0f, 1290.0f - (i * 10.0f), 0, - 0x1555, 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), 0xFFFF, this->actor.unk20, NULL); + &play->actorCtx, play, ACTOR_EN_RACEDOG, (i * 15.0f) + -3897.0f, 130.0f, 1290.0f - (i * 10.0f), 0, 0x1555, + 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), 0xFFFF, this->actor.unk20, NULL); } } @@ -197,16 +197,16 @@ s32 func_809C15BC(EnAob01* this) { return false; } -void func_809C165C(EnAob01* this, GlobalContext* globalCtx) { +void func_809C165C(EnAob01* this, PlayState* play) { 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; - 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_809C16DC(EnAob01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C16DC(EnAob01* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_210) { case 0: @@ -384,7 +384,7 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { } gSaveContext.unk_3F5C = this->unk_434; - globalCtx->msgCtx.bankRupees = this->unk_434; + play->msgCtx.bankRupees = this->unk_434; this->unk_210 = 0x3529; break; @@ -392,9 +392,9 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { if (this->unk_2D2 & 2) { this->unk_2D2 &= ~2; func_801159EC(-this->unk_434); - func_800B7298(globalCtx, NULL, 7); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + func_800B7298(play, NULL, 7); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_809C1C9C; return; } @@ -407,41 +407,41 @@ void func_809C16DC(EnAob01* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); } -void func_809C1C9C(EnAob01* this, GlobalContext* globalCtx) { +void func_809C1C9C(EnAob01* this, PlayState* play) { if (gSaveContext.rupeeAccumulator == 0) { gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_2D2 |= 0x20; func_800FD750(0x40); - globalCtx->nextEntranceIndex = 0x7C10; - globalCtx->unk_1887F = 0x40; + play->nextEntranceIndex = 0x7C10; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 2; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 7) | (this->unk_432 * 8); - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } -void func_809C1D64(EnAob01* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_809C1D64(EnAob01* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); this->unk_210 = 0x3524; - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); } else { func_8019F208(); this->unk_2D2 |= 4; this->unk_2D2 |= 0x10; this->unk_210 = 0x3522; - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); this->actionFunc = func_809C21E0; } break; @@ -449,26 +449,26 @@ void func_809C1D64(EnAob01* this, GlobalContext* globalCtx) { case 1: func_8019F230(); this->unk_210 = 0x3535; - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); break; } } - } else if ((temp_v0 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + } else if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_210 = 0; this->actionFunc = func_809C2060; } } -void func_809C1EC8(EnAob01* this, GlobalContext* globalCtx) { +void func_809C1EC8(EnAob01* this, PlayState* play) { static TrackOptionsSet sTrackOptions = { { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f point; SkelAnime_Update(&this->skelAnime); @@ -487,45 +487,45 @@ void func_809C1EC8(EnAob01* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } func_809C10B0(this, 3); - SubS_FillLimbRotTables(globalCtx, this->unk_2F8, this->unk_318, ARRAY_COUNT(this->unk_2F8)); - func_809C165C(this, globalCtx); + SubS_FillLimbRotTables(play, this->unk_2F8, this->unk_318, ARRAY_COUNT(this->unk_2F8)); + func_809C165C(this, play); if (player->stateFlags1 & 0x20) { func_809C1124(); } } -void func_809C2060(EnAob01* this, GlobalContext* globalCtx) { +void func_809C2060(EnAob01* this, PlayState* play) { if (func_809C15BC(this)) { - if (func_809C2EC4(this, globalCtx) && !(this->unk_2D2 & 0x100)) { + if (func_809C2EC4(this, play) && !(this->unk_2D2 & 0x100)) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); this->unk_2D2 |= 8; this->actionFunc = func_809C21E0; } - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_2D2 & 0x100)) { + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_2D2 & 0x100)) { this->unk_2D2 &= ~0x100; this->unk_2E6 = this->trackTarget; this->unk_2EC = this->headRot; this->unk_2F2 = this->torsoRot; - func_809C16DC(this, globalCtx); + func_809C16DC(this, play); this->actionFunc = func_809C21E0; } else { this->unk_2D2 &= ~0x100; if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) { this->unk_2D2 |= 0x100; - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } } } -void func_809C21E0(EnAob01* this, GlobalContext* globalCtx) { - u8 sp2F = Message_GetState(&globalCtx->msgCtx); +void func_809C21E0(EnAob01* this, PlayState* play) { + u8 sp2F = Message_GetState(&play->msgCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 4000, 1); - if ((this->unk_2D2 & 8) && !func_809C2EC4(this, globalCtx)) { + if ((this->unk_2D2 & 8) && !func_809C2EC4(this, play)) { if ((this->unk_210 != 0) && (this->unk_210 != 0x3535) && (this->unk_210 != 0x3524) && (this->unk_210 != 0x3548) && (this->unk_210 != 0x3549) && (this->unk_210 != 0x354A)) { this->unk_210 = 0x3523; @@ -546,58 +546,58 @@ void func_809C21E0(EnAob01* this, GlobalContext* globalCtx) { } if (this->unk_2D2 & 8) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); if (this->unk_2D2 & 4) { - func_809C16DC(this, globalCtx); + func_809C16DC(this, play); this->unk_2D2 &= ~4; } else { this->unk_2D2 |= 0x10; this->unk_2D2 |= 0x40; this->unk_43C = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); - Message_StartTextbox(globalCtx, 0x354B, &this->actor); + Message_StartTextbox(play, 0x354B, &this->actor); } this->unk_2D2 &= ~8; } } else if (sp2F == 4) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->unk_2D2 |= 2; - func_809C16DC(this, globalCtx); + func_809C16DC(this, play); break; case 1: func_8019F230(); - func_809C16DC(this, globalCtx); + func_809C16DC(this, play); break; } } } else if (sp2F == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; if (this->unk_2D2 & 0x10) { this->unk_2D2 &= ~0x10; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_809C2060; } else { - func_809C16DC(this, globalCtx); + func_809C16DC(this, play); } } - } else if ((sp2F == 14) && Message_ShouldAdvance(globalCtx)) { + } else if ((sp2F == 14) && Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; - this->unk_434 = globalCtx->msgCtx.bankRupeesSelected; - func_809C16DC(this, globalCtx); + this->unk_434 = play->msgCtx.bankRupeesSelected; + func_809C16DC(this, play); } } -s32 func_809C2504(EnAob01* this, GlobalContext* globalCtx) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +s32 func_809C2504(EnAob01* this, PlayState* play) { + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npc != NULL) { if ((npc->id == ACTOR_EN_RACEDOG) && (func_800F2178(this->unk_430) == ((EnRacedog*)npc)->currentPoint)) { @@ -612,8 +612,8 @@ s32 func_809C2504(EnAob01* this, GlobalContext* globalCtx) { return false; } -s32 func_809C2594(EnAob01* this, GlobalContext* globalCtx) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +s32 func_809C2594(EnAob01* this, PlayState* play) { + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npc != NULL) { if ((npc->id == ACTOR_EN_RACEDOG) && (((EnRacedog*)npc)->index == ((EnRacedog*)npc)->selectedDogIndex)) { @@ -626,8 +626,8 @@ s32 func_809C2594(EnAob01* this, GlobalContext* globalCtx) { return false; } -s32 func_809C25E4(EnAob01* this, GlobalContext* globalCtx) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +s32 func_809C25E4(EnAob01* this, PlayState* play) { + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; s16 count = 0; while (npc != NULL) { @@ -655,33 +655,33 @@ s32 func_809C2680(EnAob01* this) { return false; } -void func_809C26E4(EnAob01* this, GlobalContext* globalCtx) { +void func_809C26E4(EnAob01* this, PlayState* play) { ActorCutscene_Stop(this->unk_430); this->unk_430 = ActorCutscene_GetAdditionalCutscene(this->unk_430); this->actionFunc = func_809C2824; } -void func_809C2730(EnAob01* this, GlobalContext* globalCtx) { - if (func_809C2504(this, globalCtx) || func_809C2680(this)) { +void func_809C2730(EnAob01* this, PlayState* play) { + if (func_809C2504(this, play) || func_809C2680(this)) { ActorCutscene_SetIntentToPlay(this->unk_430); this->actionFunc = func_809C2824; } } -void func_809C2788(EnAob01* this, GlobalContext* globalCtx) { +void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; - if (func_809C25E4(this, globalCtx)) { + if (func_809C25E4(this, play)) { if (func_801A8A50(0) != 0x41) { - globalCtx->nextEntranceIndex = 0x7C10; + play->nextEntranceIndex = 0x7C10; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; - globalCtx->unk_1887F = 0x40; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 3; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } } -void func_809C2824(EnAob01* this, GlobalContext* globalCtx) { +void func_809C2824(EnAob01* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_430)) { ActorCutscene_Start(this->unk_430, this->unk_3F4); switch (func_800F2178(this->unk_430)) { @@ -701,10 +701,10 @@ void func_809C2824(EnAob01* this, GlobalContext* globalCtx) { } } -void func_809C28B8(EnAob01* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_809C28B8(EnAob01* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); this->unk_434 = gSaveContext.unk_3F5C; switch ((gSaveContext.eventInf[0] & 0xF8) >> 3) { case 1: @@ -712,7 +712,7 @@ void func_809C28B8(EnAob01* this, GlobalContext* globalCtx) { this->unk_2D2 |= 0x80; this->unk_434 *= 3; func_801159EC(this->unk_434); - globalCtx->msgCtx.bankRupees = this->unk_434; + play->msgCtx.bankRupees = this->unk_434; break; case 2: @@ -720,7 +720,7 @@ void func_809C28B8(EnAob01* this, GlobalContext* globalCtx) { this->unk_2D2 |= 0x80; this->unk_434 *= 2; func_801159EC(this->unk_434); - globalCtx->msgCtx.bankRupees = this->unk_434; + play->msgCtx.bankRupees = this->unk_434; break; case 3: @@ -738,24 +738,24 @@ void func_809C28B8(EnAob01* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); this->actionFunc = func_809C2D0C; } else if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void func_809C2A64(EnAob01* this, GlobalContext* globalCtx) { - u8 sp2F = Message_GetState(&globalCtx->msgCtx); +void func_809C2A64(EnAob01* this, PlayState* play) { + u8 sp2F = Message_GetState(&play->msgCtx); if (func_809C15BC(this)) { - if ((sp2F == 5) && Message_ShouldAdvance(globalCtx)) { + if ((sp2F == 5) && Message_ShouldAdvance(play)) { this->unk_434 = 0; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->trackTarget = this->unk_2E6; this->headRot = this->unk_2EC; this->torsoRot = this->unk_2F2; @@ -768,17 +768,17 @@ void func_809C2A64(EnAob01* this, GlobalContext* globalCtx) { this->actionFunc = func_809C2BE4; } } else if (gSaveContext.save.weekEventReg[8] & 0x20) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); } } } -void func_809C2BE4(EnAob01* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_809C2BE4(EnAob01* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); - if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(globalCtx)) { + if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(play)) { if (gSaveContext.save.weekEventReg[63] & 2) { gSaveContext.save.weekEventReg[63] &= (u8)~2; } @@ -788,24 +788,24 @@ void func_809C2BE4(EnAob01* this, GlobalContext* globalCtx) { } this->unk_210 = 0; - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); gSaveContext.eventInf[0] &= (u8)~7; this->actionFunc = func_809C2C9C; } } -void func_809C2C9C(EnAob01* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_809C2C9C(EnAob01* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_210 = 0x354C; - func_80151938(globalCtx, this->unk_210); + func_80151938(play, this->unk_210); this->actionFunc = func_809C1D64; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx) { - u8 sp2F = Message_GetState(&globalCtx->msgCtx); +void func_809C2D0C(EnAob01* this, PlayState* play) { + u8 sp2F = Message_GetState(&play->msgCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 4000, 1); @@ -819,12 +819,12 @@ void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx) { } } - if ((sp2F == 5) && Message_ShouldAdvance(globalCtx)) { + if ((sp2F == 5) && Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; this->unk_2D2 &= ~0x80; if (this->unk_434 >= 150) { this->unk_210 = 0x352E; - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); this->actionFunc = func_809C2A64; } else { this->trackTarget = this->unk_2E6; @@ -842,15 +842,15 @@ void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx) { } this->unk_210 = 0x354C; - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); this->actionFunc = func_809C1D64; gSaveContext.eventInf[0] &= (u8)~7; } } } -s32 func_809C2EC4(EnAob01* this, GlobalContext* globalCtx) { - Actor* dog = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; +s32 func_809C2EC4(EnAob01* this, PlayState* play) { + Actor* dog = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; while (dog != NULL) { if (dog->id == ACTOR_EN_DG) { @@ -869,8 +869,8 @@ s32 func_809C2EC4(EnAob01* this, GlobalContext* globalCtx) { return false; } -void func_809C2F34(EnAob01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C2F34(EnAob01* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.world.pos.x = -4134.0f; player->actor.world.pos.z = 1464.0f; @@ -920,15 +920,15 @@ void func_809C2FA0(void) { } } -void EnAob01_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnAob01_Init(Actor* thisx, PlayState* play) { s32 pad; EnAob01* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMamamuYanSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gMamamuYanSkel, NULL, this->jointTable, this->morphTable, MAMAMU_YAN_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); this->unk_43C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 0); Actor_SetScale(&this->actor, 0.01f); @@ -936,26 +936,26 @@ void EnAob01_Init(Actor* thisx, GlobalContext* globalCtx) { switch (gSaveContext.eventInf[0] & 7) { case 0: func_809C2FA0(); - func_809C11EC(this, globalCtx); + func_809C11EC(this, play); this->actor.flags |= ACTOR_FLAG_1; this->actionFunc = func_809C2060; break; case 2: this->unk_440 = 500; - func_809C1304(this, globalCtx); + func_809C1304(this, play); this->actor.draw = NULL; this->unk_430 = this->actor.cutscene; - func_809C2594(this, globalCtx); + func_809C2594(this, play); ActorCutscene_SetIntentToPlay(this->unk_430); this->actor.flags &= ~ACTOR_FLAG_1; - func_809C2F34(this, globalCtx); + func_809C2F34(this, play); this->actionFunc = func_809C2824; break; case 3: func_809C2FA0(); - func_809C11EC(this, globalCtx); + func_809C11EC(this, play); this->actor.flags |= ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_809C28B8; @@ -963,24 +963,23 @@ void EnAob01_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnAob01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAob01_Destroy(Actor* thisx, PlayState* play) { EnAob01* this = THIS; if (!(this->unk_2D2 & 0x20)) { gSaveContext.save.weekEventReg[63] &= (u8)~1; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnAob01_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAob01_Update(Actor* thisx, PlayState* play) { EnAob01* this = THIS; - this->actionFunc(this, globalCtx); - func_809C1EC8(this, globalCtx); + this->actionFunc(this, play); + func_809C1EC8(this, play); } -s32 EnAob01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnAob01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnAob01* this = THIS; TexturePtr eyeTextures[] = { gMamamuYanEyeOpenTex, @@ -989,13 +988,13 @@ s32 EnAob01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis }; if (limbIndex == MAMAMU_YAN_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); *dList = gMamamuYanHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(eyeTextures[this->eyeIndex])); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == MAMAMU_YAN_LIMB_HEAD) { @@ -1018,7 +1017,7 @@ s32 EnAob01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnAob01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnAob01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_809C3968 = { 0.0f, 0.0f, 0.0f }; EnAob01* this = THIS; @@ -1027,35 +1026,35 @@ void EnAob01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnAob01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnAob01_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnAob01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAob01_Draw(Actor* thisx, PlayState* play) { s32 pad; EnAob01* this = THIS; Vec3f sp5C; Vec3f sp50; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 50, 80, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 50, 80, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 50, 80, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 50, 80, 0, 0)); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAob01_OverrideLimbDraw, EnAob01_PostLimbDraw, EnAob01_TransformLimbDraw, &this->actor); if (this->actor.draw != NULL) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp5C = this->actor.world.pos; sp50.x = 0.5f; sp50.y = 0.5f; sp50.z = 0.5f; - func_800BC620(&sp5C, &sp50, 0xFF, globalCtx); + func_800BC620(&sp5C, &sp50, 0xFF, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h index 3f85587445..7414f18900 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h @@ -6,7 +6,7 @@ struct EnAob01; -typedef void (*EnAob01ActionFunc)(struct EnAob01*, GlobalContext*); +typedef void (*EnAob01ActionFunc)(struct EnAob01*, PlayState*); #define ENAOB01_GET_7E00_1(thisx) ((thisx)->params & 0x7E00) #define ENAOB01_GET_7E00_2(thisx) (((thisx)->params & 0x7E00) >> 9) 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 0a8eeffce4..39fdd6167b 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -12,15 +12,15 @@ #define THIS ((EnArrow*)thisx) -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 func_8088A594(EnArrow* this, GlobalContext* globalCtx); -void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx); -void func_8088B630(EnArrow* this, GlobalContext* globalCtx); -void func_8088B6B0(EnArrow* this, GlobalContext* globalCtx); +void func_8088A594(EnArrow* this, PlayState* play); +void func_8088ACE0(EnArrow* this, PlayState* play); +void func_8088B630(EnArrow* this, PlayState* play); +void func_8088B6B0(EnArrow* this, PlayState* play); const ActorInit En_Arrow_InitVars = { ACTOR_EN_ARROW, @@ -58,7 +58,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(terminalVelocity, -150, ICHAIN_STOP), }; -void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Init(Actor* thisx, PlayState* play) { static EffectBlureInit2 D_8088C234 = { 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 }, @@ -84,7 +84,7 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params < ENARROW_6) { - SkelAnime_Init(globalCtx, &this->arrow.skelAnime, &gameplay_keep_Skel_014560, &gameplay_keep_Anim_0128BC, + SkelAnime_Init(play, &this->arrow.skelAnime, &gameplay_keep_Skel_014560, &gameplay_keep_Anim_0128BC, this->arrow.jointTable, this->arrow.jointTable, 5); if (this->actor.params < ENARROW_3) { if (this->actor.params == ENARROW_1) { @@ -92,18 +92,18 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { } else { D_8088C234.elemDuration = 16; } - Effect_Add(globalCtx, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C234); + Effect_Add(play, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C234); } else if (this->actor.params == ENARROW_3) { - Effect_Add(globalCtx, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C258); + Effect_Add(play, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C258); } else if (this->actor.params == ENARROW_4) { - Effect_Add(globalCtx, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C27C); + Effect_Add(play, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C27C); } else if (this->actor.params == ENARROW_5) { - Effect_Add(globalCtx, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C2A0); + Effect_Add(play, &this->unk_240, EFFECT_BLURE2, 0, 0, &D_8088C2A0); } } - 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); if (this->actor.params < ENARROW_6) { this->collider.info.toucherFlags &= ~(TOUCH_SFX_WOOD | TOUCH_SFX_HARD); @@ -125,21 +125,21 @@ void EnArrow_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_8088A594; } -void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Destroy(Actor* thisx, PlayState* play) { EnArrow* this = THIS; if (this->actor.params < ENARROW_6) { - Effect_Destroy(globalCtx, this->unk_240); + Effect_Destroy(play, this->unk_240); } - Collider_DestroyQuad(globalCtx, &this->collider); + Collider_DestroyQuad(play, &this->collider); if ((this->unk_264 != NULL) && (this->unk_264->update != NULL)) { this->unk_264->flags &= ~0x8000; } if ((this->actor.params >= ENARROW_3) && (this->actor.params < ENARROW_6) && (this->actor.child == NULL)) { - func_80115D5C(&globalCtx->state); + func_80115D5C(&play->state); } } @@ -149,8 +149,8 @@ void func_8088A514(EnArrow* this) { Actor_SetSpeeds(&this->actor, CLAMP(temp_f0, 1.0f, 80.0f)); } -void func_8088A594(EnArrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088A594(EnArrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.parent != NULL) { if (this->actor.params == ENARROW_7) { @@ -162,13 +162,13 @@ void func_8088A594(EnArrow* this, GlobalContext* globalCtx) { this->bubble.unk_148++; if (this->bubble.unk_148 > 20) { this->actionFunc = func_8088ACE0; - func_80115D5C(&globalCtx->state); + func_80115D5C(&play->state); } } } else { if ((this->actor.params != ENARROW_8) && (player->unk_D57 == 0)) { if (this->actor.params == ENARROW_7) { - func_80115D5C(&globalCtx->state); + func_80115D5C(&play->state); } Actor_MarkForDeath(&this->actor); return; @@ -202,7 +202,7 @@ void func_8088A594(EnArrow* this, GlobalContext* globalCtx) { this->bubble.unk_144 = CLAMP_MIN(this->bubble.unk_144, 3.5f); func_8088A514(this); this->unk_260 = 99; - func_80115D5C(&globalCtx->state); + func_80115D5C(&play->state); } else if (this->actor.params >= ENARROW_6) { if ((this->actor.params == ENARROW_8) && (this->actor.world.rot.x < 0)) { Actor_SetScale(&this->actor, 0.009f); @@ -221,7 +221,7 @@ void func_8088A594(EnArrow* this, GlobalContext* globalCtx) { } } -void func_8088A7D8(GlobalContext* globalCtx, EnArrow* this) { +void func_8088A7D8(PlayState* play, EnArrow* this) { this->actionFunc = func_8088B6B0; Animation_PlayOnce(&this->arrow.skelAnime, &gameplay_keep_Anim_012860); this->actor.world.rot.y += (s32)(0x6000 * (Rand_ZeroOne() - 0.5f)) + 0x8000; @@ -231,7 +231,7 @@ void func_8088A7D8(GlobalContext* globalCtx, EnArrow* this) { this->unk_263 = 1; } -void func_8088A894(EnArrow* this, GlobalContext* globalCtx) { +void func_8088A894(EnArrow* this, PlayState* play) { CollisionPoly* sp74; Vec3f sp68; Vec3f sp5C; @@ -256,8 +256,8 @@ void func_8088A894(EnArrow* this, GlobalContext* globalCtx) { temp_f0 = sp4C / temp_f0; Math_Vec3f_Scale(&sp68, temp_f0); Math_Vec3f_Sum(&this->unk_264->world.pos, &sp68, &sp5C); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->unk_264->world.pos, &sp5C, &sp50, &sp74, true, true, true, - true, &sp44)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->unk_264->world.pos, &sp5C, &sp50, &sp74, true, true, true, true, + &sp44)) { this->unk_264->world.pos.x = ((sp5C.x <= sp50.x) ? 1.0f : -1.0f) + sp50.x; this->unk_264->world.pos.y = ((sp5C.y <= sp50.y) ? 1.0f : -1.0f) + sp50.y; this->unk_264->world.pos.z = ((sp5C.z <= sp50.z) ? 1.0f : -1.0f) + sp50.z; @@ -266,14 +266,13 @@ void func_8088A894(EnArrow* this, GlobalContext* globalCtx) { } } -void func_8088AA98(EnArrow* this, GlobalContext* globalCtx) { +void func_8088AA98(EnArrow* this, PlayState* play) { WaterBox* sp54; f32 sp50 = this->actor.world.pos.y; Vec3f sp44; f32 temp_f0; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, - &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && (this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & 0x20)) { this->actor.bgCheckFlags |= 0x20; @@ -287,18 +286,18 @@ void func_8088AA98(EnArrow* this, GlobalContext* globalCtx) { sp44.x = this->actor.home.pos.x + (sp44.x * temp_f0); sp44.y = sp50; sp44.z = this->actor.home.pos.z + (sp44.z * temp_f0); - EffectSsGSplash_Spawn(globalCtx, &sp44, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, 300); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); - EffectSsGRipple_Spawn(globalCtx, &sp44, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &sp44, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &sp44, 100, 500, 8); + EffectSsGRipple_Spawn(play, &sp44, 100, 500, 0); + EffectSsGRipple_Spawn(play, &sp44, 100, 500, 4); + EffectSsGRipple_Spawn(play, &sp44, 100, 500, 8); if ((this->actor.params == ENARROW_4) || (this->actor.params == ENARROW_3)) { if ((this->actor.params == ENARROW_4) && (func_8088B6B0 != this->actionFunc)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_ICEFLOE, sp44.x, sp44.y, sp44.z, 0, 0, 0, 300); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_ICEFLOE, sp44.x, sp44.y, sp44.z, 0, 0, 0, 300); Actor_MarkForDeath(&this->actor); return; } @@ -311,7 +310,7 @@ void func_8088AA98(EnArrow* this, GlobalContext* globalCtx) { return; } - func_80115D5C(&globalCtx->state); + func_80115D5C(&play->state); } } } @@ -319,7 +318,7 @@ void func_8088AA98(EnArrow* this, GlobalContext* globalCtx) { #ifdef NON_MATCHING // Stack. Scoped variable required to fix code gen at the bottom, likely sp60/54 there, // but sp50 must be declared below those so maybe not? -void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { +void func_8088ACE0(EnArrow* this, PlayState* play) { CollisionPoly* spAC; s32 spA8; Vec3f sp9C; @@ -350,17 +349,17 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { } if ((this->unk_262 != 0) || phi_a2) { - EffectSsStone1_Spawn(globalCtx, &this->actor.world.pos, 0); + EffectSsStone1_Spawn(play, &this->actor.world.pos, 0); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_IT_DEKUNUTS_BUBLE_VANISH); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_IT_DEKUNUTS_BUBLE_VANISH); if ((this->unk_262 != 0) && (this->actor.wallBgId == BG_ACTOR_MAX)) { Math_Vec3f_Copy(&sp84.pos, &this->actor.world.pos); sp84.colPoly = this->actor.wallPoly; sp84.scale = this->bubble.unk_144; - EffectSs_Spawn(globalCtx, EFFECT_SS_SBN, 128, &sp84); + EffectSs_Spawn(play, EFFECT_SS_SBN, 128, &sp84); } } Actor_MarkForDeath(&this->actor); @@ -380,24 +379,24 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { if (this->actor.params == ENARROW_8) { 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, this->actor.speedXZ == 0.0f); + 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, this->actor.speedXZ == 0.0f); sp82 = NA_SE_IT_DEKU; } else { sp82 = NA_SE_IT_SLING_REFLECT; } - EffectSsStone1_Spawn(globalCtx, &this->actor.world.pos, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, sp82); + EffectSsStone1_Spawn(play, &this->actor.world.pos, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, sp82); Actor_MarkForDeath(&this->actor); } else { - EffectSsHitMark_SpawnCustomScale(globalCtx, 0, 150, &this->actor.world.pos); + EffectSsHitMark_SpawnCustomScale(play, 0, 150, &this->actor.world.pos); if (sp50 && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) { sp7C = this->collider.base.at; if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && (sp7C->flags & 0x4000)) { this->unk_264 = sp7C; - func_8088A894(this, globalCtx); + func_8088A894(this, play); Math_Vec3f_Diff(&sp7C->world.pos, &this->actor.world.pos, &this->unk_268); sp7C->flags |= 0x8000; this->collider.base.atFlags &= ~AT_HIT; @@ -407,7 +406,7 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { this->unk_261 |= 1; this->unk_261 |= 2; Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); - func_8088A7D8(globalCtx, this); + func_8088A7D8(play, this); Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HOOKSHOT_STICK_CRE); } } else if (this->unk_262 != 0) { @@ -426,7 +425,7 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { } } } else { - func_8088AA98(this, globalCtx); + func_8088AA98(this, play); if (this->actor.params == ENARROW_7) { if (this->bubble.unk_149 == 0) { sp78 = sqrtf(SQ(this->actor.speedXZ) + SQ(this->actor.velocity.y)); @@ -471,10 +470,10 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } - this->unk_262 = BgCheck_ProjectileLineTest(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, - &sp9C, &this->actor.wallPoly, true, true, true, true, &spA8); + this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp9C, + &this->actor.wallPoly, true, true, true, true, &spA8); if (this->unk_262 != 0) { - func_800B90AC(globalCtx, &this->actor, this->actor.wallPoly, spA8, &sp9C); + func_800B90AC(play, &this->actor, this->actor.wallPoly, spA8, &sp9C); Math_Vec3f_Copy(&this->actor.world.pos, &sp9C); this->actor.wallBgId = spA8; } @@ -491,8 +490,7 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->unk_228, &this->unk_268, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_268, &sp54); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp60, &sp54, &sp9C, &spAC, true, true, true, true, - &spA8)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &sp54, &sp9C, &spAC, true, true, true, true, &spA8)) { this->unk_264->world.pos.x = ((sp54.x <= sp9C.x) ? 1.0f : -1.0f) + sp9C.x; this->unk_264->world.pos.y = ((sp54.y <= sp9C.y) ? 1.0f : -1.0f) + sp9C.y; this->unk_264->world.pos.z = ((sp54.z <= sp9C.z) ? 1.0f : -1.0f) + sp9C.z; @@ -517,11 +515,11 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Arrow/func_8088ACE0.s") #endif -void func_8088B630(EnArrow* this, GlobalContext* globalCtx) { +void func_8088B630(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->arrow.skelAnime); if (this->actor.wallBgId != BG_ACTOR_MAX) { - BgCheck2_UpdateActorAttachedToMesh(&globalCtx->colCtx, this->actor.wallBgId, &this->actor); + BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.wallBgId, &this->actor); } if (DECR(this->unk_260) == 0) { @@ -529,40 +527,40 @@ void func_8088B630(EnArrow* this, GlobalContext* globalCtx) { } } -void func_8088B6B0(EnArrow* this, GlobalContext* globalCtx) { +void func_8088B6B0(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->arrow.skelAnime); Actor_MoveWithGravity(&this->actor); - func_8088AA98(this, globalCtx); + func_8088AA98(this, play); if (DECR(this->unk_260) == 0) { Actor_MarkForDeath(&this->actor); } } -void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Update(Actor* thisx, PlayState* play) { static Vec3f D_8088C2CC = { 0.0f, 0.5f, 0.0f }; static Vec3f D_8088C2D8 = { 0.0f, 0.5f, 0.0f }; static Color_RGBA8 D_8088C2E4 = { 255, 255, 100, 255 }; static Color_RGBA8 D_8088C2E8 = { 255, 50, 0, 0 }; s32 pad; EnArrow* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_263 != 0) || ((this->actor.params >= ENARROW_0) && ((this->actor.params == ENARROW_7) || (player->unk_D57 != 0))) || - !func_80123358(globalCtx, player)) { - this->actionFunc(this, globalCtx); + !func_80123358(play, player)) { + this->actionFunc(this, play); } if ((this->actor.params >= ENARROW_3) && (this->actor.params < ENARROW_6)) { s16 sp44[] = { ACTOR_ARROW_FIRE, ACTOR_ARROW_ICE, ACTOR_ARROW_LIGHT }; if (this->actor.child == NULL) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, sp44[this->actor.params - ENARROW_3], + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, sp44[this->actor.params - ENARROW_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 == ENARROW_0) { - func_800B0EB0(globalCtx, &this->unk_234, &D_8088C2CC, &D_8088C2D8, &D_8088C2E4, &D_8088C2E8, 100, 0, 8); + func_800B0EB0(play, &this->unk_234, &D_8088C2CC, &D_8088C2D8, &D_8088C2E4, &D_8088C2E8, 100, 0, 8); } Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.prevPos); } @@ -573,7 +571,7 @@ typedef struct { /* 0x48 */ Vec3f unk_48; } EnArrowUnkStruct; // size = 0x54 -void func_8088B88C(GlobalContext* globalCtx, EnArrow* this, EnArrowUnkStruct* arg2) { +void func_8088B88C(PlayState* play, EnArrow* this, EnArrowUnkStruct* arg2) { Vec3f* sp4C; Vec3f sp40; Vec3f sp34; @@ -584,14 +582,14 @@ void func_8088B88C(GlobalContext* globalCtx, EnArrow* this, EnArrowUnkStruct* ar if (!this->unk_244.active) { sp4C = arg2->unk_00; } else { - sp4C = arg2->unk_18[globalCtx->gameplayFrames % 2]; + sp4C = arg2->unk_18[play->gameplayFrames % 2]; } Matrix_MultVec3f(&sp4C[0], &sp40); Matrix_MultVec3f(&sp4C[1], &sp34); if (this->actor.params < ENARROW_8) { sp30 = this->actor.params < ENARROW_6; if (this->unk_264 == 0) { - sp30 &= func_80126440(globalCtx, &this->collider, &this->unk_244, &sp40, &sp34); + sp30 &= func_80126440(play, &this->collider, &this->unk_244, &sp40, &sp34); } else if (sp30 && (sp40.x == this->unk_244.tip.x) && (sp40.y == this->unk_244.tip.y) && (sp40.z == this->unk_244.tip.z) && (sp34.x == this->unk_244.base.x) && (sp34.y == this->unk_244.base.y) && (sp34.z == this->unk_244.base.z)) { @@ -604,7 +602,7 @@ void func_8088B88C(GlobalContext* globalCtx, EnArrow* this, EnArrowUnkStruct* ar } } -void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnArrow_Draw(Actor* thisx, PlayState* play) { static EnArrowUnkStruct D_8088C2EC[] = { { { @@ -645,20 +643,20 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 phi_v0; if (this->actor.params < ENARROW_6) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawLod(globalCtx, this->arrow.skelAnime.skeleton, this->arrow.skelAnime.jointTable, NULL, NULL, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawLod(play, this->arrow.skelAnime.skeleton, this->arrow.skelAnime.jointTable, NULL, NULL, &this->actor, this->actor.projectedPos.z < 160.0f ? 0 : 1); } else if (this->actor.params == ENARROW_7) { s32 spA4 = 255 - (s32)(this->bubble.unk_144 * 4.0f); f32 spA0 = (this->actor.speedXZ * 0.1f) + 1.0f; f32 sp9C = (1.0f / spA0); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->bubble.unk_149 >= 0) { - func_8088B88C(globalCtx, this, &D_8088C2EC[1]); + func_8088B88C(play, this, &D_8088C2EC[1]); } else { - Collider_ResetQuadAT(globalCtx, &this->collider.base); + Collider_ResetQuadAT(play, &this->collider.base); } sp9C *= 0.002f; @@ -669,7 +667,7 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 460.0f, MTXMODE_APPLY); if (this->actor.speedXZ == 0.0f) { - func_800B8118(&this->actor, globalCtx, MTXMODE_NEW); + func_800B8118(&this->actor, play, MTXMODE_NEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_06F380); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); @@ -679,32 +677,30 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_ReplaceRotation(&gIdentityMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 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++, gameplay_keep_DL_06F9F0); } else { - func_800B8050(&this->actor, globalCtx, MTXMODE_NEW); + func_800B8050(&this->actor, play, MTXMODE_NEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06F380); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, 0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x7F, 230, 225, 150, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06FAE0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return; } else if (this->actor.speedXZ != 0.0f) { u8 sp63 = (Math_CosS(this->unk_260 * 5000) * 127.5f) + 127.5f; f32 sp5C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C240(globalCtx->state.gfxCtx); + func_8012C240(play->state.gfxCtx); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); @@ -719,34 +715,34 @@ void EnArrow_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); if (this->actor.speedXZ == 0.0f) { phi_v0 = 0; } else { - phi_v0 = (globalCtx->gameplayFrames % 256) * 4000; + phi_v0 = (play->gameplayFrames % 256) * 4000; } Matrix_RotateZS(phi_v0, MTXMODE_APPLY); Matrix_Scale(sp5C, sp5C, sp5C, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); Matrix_Pop(); Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_APPLY); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (this->actor.velocity.y != 0.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_8012C28C(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_058BA0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } - func_8088B88C(globalCtx, this, &D_8088C2EC[0]); + func_8088B88C(play, this, &D_8088C2EC[0]); } 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 654e8bea62..fadf7fbf25 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h @@ -5,7 +5,7 @@ struct EnArrow; -typedef void (*EnArrowActionFunc)(struct EnArrow*, GlobalContext*); +typedef void (*EnArrowActionFunc)(struct EnArrow*, PlayState*); enum { /* -8 */ ENARROW_MINUS8 = -8, 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 548e1e68df..6a7bd87ad3 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 @@ -11,14 +11,14 @@ #define THIS ((EnAttackNiw*)thisx) -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 EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, GlobalContext* globalCtx); -void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, GlobalContext* globalCtx); -void EnAttackNiw_FlyAway(EnAttackNiw* this, GlobalContext* globalCtx); +void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play); +void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play); +void EnAttackNiw_FlyAway(EnAttackNiw* this, PlayState* play); const ActorInit En_Attack_Niw_InitVars = { ACTOR_EN_ATTACK_NIW, @@ -38,12 +38,12 @@ 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 = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); // probably copy pasted from EnNiw, which has this same code, but AttackNiw has no params @@ -64,7 +64,7 @@ void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnAttackNiw_EnterViewFromOffscreen; } -void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { EnAttackNiw* this = THIS; EnNiw* parent = (EnNiw*)this->actor.parent; @@ -80,7 +80,7 @@ void EnAttackNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { * * EnNiw has its own version of this function, probably copy paste since AttackNiw only uses two animationState (2/5) */ -void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, GlobalContext* globalCtx, s16 animationState) { +void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animationState) { if (this->unkTimer24C == 0) { if (animationState == 0) { this->targetBodyRotY = 0.0f; @@ -192,12 +192,12 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, GlobalContext* globalCtx, s1 } } -s32 EnAttackNiw_IsOnScreen(EnAttackNiw* this, GlobalContext* globalCtx) { +s32 EnAttackNiw_IsOnScreen(EnAttackNiw* this, PlayState* play) { s16 posX; s16 posY; Actor_SetFocus(&this->actor, this->targetHeight); - Actor_GetScreenPos(globalCtx, &this->actor, &posX, &posY); + Actor_GetScreenPos(play, &this->actor, &posX, &posY); if ((this->actor.projectedPos.z < -20.0f) || (posX < 0) || (posX > SCREEN_WIDTH) || (posY < 0) || (posY > SCREEN_HEIGHT)) { @@ -206,7 +206,7 @@ s32 EnAttackNiw_IsOnScreen(EnAttackNiw* this, GlobalContext* globalCtx) { return true; } -void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, GlobalContext* globalCtx) { +void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { s16 posX; s16 posY; Vec3f viewOffset; @@ -217,14 +217,14 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, GlobalContext* global // randomTargetCenterOffset is set in _Init, only needs to be set once // but the view is moving, so now we need to re-calculate the spot in space - viewOffset.x = this->randomTargetCenterOffset.x + globalCtx->view.at.x - globalCtx->view.eye.x; - viewOffset.y = this->randomTargetCenterOffset.y + globalCtx->view.at.y - globalCtx->view.eye.y; - viewOffset.z = this->randomTargetCenterOffset.z + globalCtx->view.at.z - globalCtx->view.eye.z; + viewOffset.x = this->randomTargetCenterOffset.x + play->view.at.x - play->view.eye.x; + viewOffset.y = this->randomTargetCenterOffset.y + play->view.at.y - play->view.eye.y; + viewOffset.z = this->randomTargetCenterOffset.z + play->view.at.z - play->view.eye.z; // this is the 3D spot in space where the cucco is trying to fly into (until it lands or gets close) - flightTarget.x = globalCtx->view.at.x + viewOffset.x; - flightTarget.y = globalCtx->view.at.y + viewOffset.y; - flightTarget.z = globalCtx->view.at.z + viewOffset.z; + flightTarget.x = play->view.at.x + viewOffset.x; + flightTarget.y = play->view.at.y + viewOffset.y; + flightTarget.z = play->view.at.z + viewOffset.z; this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &flightTarget); this->targetRotX = Math_Vec3f_Pitch(&this->actor.world.pos, &flightTarget) * -1.0f; @@ -234,7 +234,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, GlobalContext* global Math_ApproachF(&this->rotStep, 5000.0f, 1.0f, 100.0f); Actor_SetFocus(&this->actor, this->targetHeight); - Actor_GetScreenPos(globalCtx, &this->actor, &posX, &posY); + Actor_GetScreenPos(play, &this->actor, &posX, &posY); if (this->actor.bgCheckFlags & 8) { // touching a wall this->targetRotY = this->actor.yawTowardsPlayer; @@ -276,12 +276,12 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, GlobalContext* global this->unkTimer24C = 10; this->targetBodyRotY = -10000.0f; this->targetHeadRotZ = -3000.0f; - EnAttackNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } } -void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!EnAttackNiw_IsOnScreen(this, globalCtx)) { +void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) { + if (!EnAttackNiw_IsOnScreen(this, play)) { Actor_MarkForDeath(&this->actor); return; } @@ -325,15 +325,15 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, GlobalContext* globalCtx) { this->actionFunc = EnAttackNiw_FlyAway; } else if (this->actor.bgCheckFlags & 1) { // touching floor - EnAttackNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); } else { - EnAttackNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } } -void EnAttackNiw_FlyAway(EnAttackNiw* this, GlobalContext* globalCtx) { - if (!EnAttackNiw_IsOnScreen(this, globalCtx)) { +void EnAttackNiw_FlyAway(EnAttackNiw* this, PlayState* play) { + if (!EnAttackNiw_IsOnScreen(this, play)) { Actor_MarkForDeath(&this->actor); return; } @@ -341,14 +341,14 @@ void EnAttackNiw_FlyAway(EnAttackNiw* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.x, this->targetRotX, 5, this->rotStep, 0); Math_ApproachF(&this->rotStep, 5000.0f, 1.0f, 100.0f); Math_ApproachF(&this->actor.velocity.y, 5.0f, 0.3f, 1.0f); - EnAttackNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } -void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Update(Actor* thisx, PlayState* play) { EnAttackNiw* this = THIS; s32 pad; EnNiw* parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; Vec3f splashPos; @@ -365,9 +365,9 @@ void EnAttackNiw_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_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if (this->actionFunc == EnAttackNiw_EnterViewFromOffscreen) { Actor_MoveWithoutGravity(&this->actor); @@ -382,7 +382,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { (this->actionFunc != EnAttackNiw_FlyAway)) { Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); splashPos.y += this->actor.depthInWater; - EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, 0, 400); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, 400); this->rotStep = 0.0f; this->actor.gravity = 0.0f; this->targetXZSpeed = 0.0f; @@ -399,7 +399,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (parent != NULL) && (parent->unkAttackNiwTimer == 0) && (player->invincibilityTimer == 0)) { // this updates some player values based on what we pass, need player decomp to know what this is doing - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); + func_800B8D50(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); parent->unkAttackNiwTimer = 70; } } @@ -416,8 +416,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnAttackNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnAttackNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnAttackNiw* this = THIS; if (limbIndex == NIW_LIMB_UPPER_BODY) { @@ -442,10 +441,10 @@ s32 EnAttackNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnAttackNiw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnAttackNiw_Draw(Actor* thisx, PlayState* play) { EnAttackNiw* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAttackNiw_OverrideLimbDraw, NULL, &this->actor); } 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 c4dcaf8d0e..a1e29d6278 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 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index f815991c19..c025a6f777 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -10,21 +10,21 @@ #define THIS ((EnAz*)thisx) -void EnAz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnAz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnAz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnAz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnAz_Init(Actor* thisx, PlayState* play); +void EnAz_Destroy(Actor* thisx, PlayState* play); +void EnAz_Update(Actor* thisx, PlayState* play); +void EnAz_Draw(Actor* thisx, PlayState* play); -void func_80A95CEC(EnAz* this, GlobalContext* globalCtx); -void func_80A95E88(EnAz* this, GlobalContext* globalCtx); -void func_80A95FE8(EnAz* this, GlobalContext* globalCtx); -void func_80A979F4(EnAz* this, GlobalContext* globalCtx); -void func_80A97A40(EnAz* this, GlobalContext* globalCtx); -void func_80A97AB4(EnAz* this, GlobalContext* globalCtx); -void func_80A97C24(EnAz* this, GlobalContext* globalCtx); -void func_80A97C4C(EnAz* this, GlobalContext* globalCtx); -void func_80A97E48(EnAz* this, GlobalContext* globalCtx); -void func_80A97F9C(EnAz* this, GlobalContext* globalCtx); +void func_80A95CEC(EnAz* this, PlayState* play); +void func_80A95E88(EnAz* this, PlayState* play); +void func_80A95FE8(EnAz* this, PlayState* play); +void func_80A979F4(EnAz* this, PlayState* play); +void func_80A97A40(EnAz* this, PlayState* play); +void func_80A97AB4(EnAz* this, PlayState* play); +void func_80A97C24(EnAz* this, PlayState* play); +void func_80A97C4C(EnAz* this, PlayState* play); +void func_80A97E48(EnAz* this, PlayState* play); +void func_80A97F9C(EnAz* this, PlayState* play); #if 0 const ActorInit En_Az_InitVars = { diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.h b/src/overlays/actors/ovl_En_Az/z_en_az.h index 89d7c1a09b..ee141bfb3a 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.h +++ b/src/overlays/actors/ovl_En_Az/z_en_az.h @@ -5,7 +5,7 @@ struct EnAz; -typedef void (*EnAzActionFunc)(struct EnAz*, GlobalContext*); +typedef void (*EnAzActionFunc)(struct EnAz*, PlayState*); typedef struct EnAz { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index b0c32be57a..c7386e403c 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -12,22 +12,22 @@ #define THIS ((EnBaba*)thisx) -void EnBaba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBaba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBaba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBaba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBaba_Init(Actor* thisx, PlayState* play); +void EnBaba_Destroy(Actor* thisx, PlayState* play); +void EnBaba_Update(Actor* thisx, PlayState* play); +void EnBaba_Draw(Actor* thisx, PlayState* play); -void func_80BA9480(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9758(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9848(EnBaba* this, GlobalContext* globalCtx); -void func_80BA98EC(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9AB8(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9B24(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9B80(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9CD4(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9E00(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9E10(EnBaba* this, GlobalContext* globalCtx); -void func_80BA9E48(EnBaba* this, GlobalContext* globalCtx); +void func_80BA9480(EnBaba* this, PlayState* play); +void func_80BA9758(EnBaba* this, PlayState* play); +void func_80BA9848(EnBaba* this, PlayState* play); +void func_80BA98EC(EnBaba* this, PlayState* play); +void func_80BA9AB8(EnBaba* this, PlayState* play); +void func_80BA9B24(EnBaba* this, PlayState* play); +void func_80BA9B80(EnBaba* this, PlayState* play); +void func_80BA9CD4(EnBaba* this, PlayState* play); +void func_80BA9E00(EnBaba* this, PlayState* play); +void func_80BA9E10(EnBaba* this, PlayState* play); +void func_80BA9E48(EnBaba* this, PlayState* play); const ActorInit En_Baba_InitVars = { ACTOR_EN_BABA, @@ -128,8 +128,8 @@ static TrackOptionsSet sTrackOptions = { { 0x1770, 4, 1, 6 }, }; -s32 func_80BA8820(EnBaba* this, GlobalContext* globalCtx) { - this->unk_144 = (EnOssan*)SubS_FindActor(globalCtx, &this->unk_144->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN); +s32 func_80BA8820(EnBaba* this, PlayState* play) { + this->unk_144 = (EnOssan*)SubS_FindActor(play, &this->unk_144->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN); if (this->unk_144 != NULL) { return true; @@ -137,8 +137,8 @@ s32 func_80BA8820(EnBaba* this, GlobalContext* globalCtx) { return false; } -void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA886C(EnBaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_1E0) { case 0: @@ -186,41 +186,41 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { break; case 0x660: - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); + Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); this->unk_1E0 = 0x661; break; case 0x661: - Actor_ChangeFocus(&this->unk_144->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor); this->unk_1E0 = 0x662; break; case 0x662: - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); + Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); this->unk_1E0 = 0x663; gSaveContext.save.weekEventReg[73] |= 1; this->unk_40A |= 1; break; case 0x65A: - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); + Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); this->unk_1E0 = 0x65B; break; case 0x65B: - Actor_ChangeFocus(&this->unk_144->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor); this->unk_1E0 = 0x65C; break; case 0x65C: - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); + Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); this->unk_1E0 = 0x65D; gSaveContext.save.weekEventReg[73] |= 2; this->unk_40A |= 1; break; case 0x65E: - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk_144->actor); + Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); this->unk_1E0 = 0x65F; this->unk_40A |= 1; break; @@ -246,30 +246,30 @@ void func_80BA886C(EnBaba* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, this->unk_1E0, &this->actor); + Message_StartTextbox(play, this->unk_1E0, &this->actor); if (this->unk_40A & 1) { if (this->unk_40A & 0x40) { this->unk_40A &= ~0x40; - func_80151BB4(globalCtx, 0x33); + func_80151BB4(play, 0x33); } - func_80151BB4(globalCtx, 4); + func_80151BB4(play, 4); } } -void func_80BA8C4C(GlobalContext* globalCtx, u16 nextEntrance) { - globalCtx->nextEntranceIndex = nextEntrance; - globalCtx->unk_1887F = 0x40; +void func_80BA8C4C(PlayState* play, u16 nextEntrance) { + play->nextEntranceIndex = nextEntrance; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } -void func_80BA8C90(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA8C90(EnBaba* this, PlayState* play) { this->collider.dim.pos.x = this->actor.world.pos.x + 5.0f; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z + 22.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); } s32 func_80BA8D2C(EnBaba* this, f32 arg1) { @@ -288,8 +288,8 @@ s32 func_80BA8D2C(EnBaba* this, f32 arg1) { return ret; } -void func_80BA8DF4(EnBaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA8DF4(EnBaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f point; SkelAnime_Update(&this->skelAnime); @@ -311,20 +311,20 @@ void func_80BA8DF4(EnBaba* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } - SubS_FillLimbRotTables(globalCtx, this->unk_302, this->unk_326, ARRAY_COUNT(this->unk_302)); + SubS_FillLimbRotTables(play, this->unk_302, this->unk_326, ARRAY_COUNT(this->unk_302)); if (this->unk_40A & 2) { - func_80BA8C90(this, globalCtx); + func_80BA8C90(this, play); } } -s32 func_80BA8F88(EnBaba* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BA8F88(EnBaba* this, PlayState* play, ScheduleResult* arg2) { u16 sp26 = SCHEDULE_TIME_NOW; u16 temp; u8 sp23 = ENBABA_GET_3F00(&this->actor); if (D_80BAA4A8[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp23, D_80BAA4A8[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAA4A8[arg2->result]); } if (this->timePath == NULL) { @@ -352,7 +352,7 @@ s32 func_80BA8F88(EnBaba* this, GlobalContext* globalCtx, ScheduleResult* arg2) return true; } -s32 func_80BA9110(EnBaba* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BA9110(EnBaba* this, PlayState* play, ScheduleResult* arg2) { s32 ret; switch (arg2->result) { @@ -361,7 +361,7 @@ s32 func_80BA9110(EnBaba* this, GlobalContext* globalCtx, ScheduleResult* arg2) break; case 2: - ret = func_80BA8F88(this, globalCtx, arg2); + ret = func_80BA8F88(this, play, arg2); break; case 1: @@ -371,7 +371,7 @@ s32 func_80BA9110(EnBaba* this, GlobalContext* globalCtx, ScheduleResult* arg2) return ret; } -s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { +s32 func_80BA9160(EnBaba* this, PlayState* play) { f32 knots[265]; Vec3f sp70; Vec3f sp64; @@ -388,7 +388,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; this->unk_438 = 1; } else { @@ -398,7 +398,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { this->actor.world.pos.x = timePathTargetPos.x; this->actor.world.pos.z = timePathTargetPos.z; - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { sp54 = this->timePathElapsedTime; sp50 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -416,7 +416,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); } - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; @@ -425,18 +425,18 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) { return false; } -void func_80BA93AC(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA93AC(EnBaba* this, PlayState* play) { if (this->unk_434 != 1) { if (this->unk_434 == 2) { gSaveContext.save.weekEventReg[58] |= 0x40; this->unk_40A |= 2; - func_80BA9160(this, globalCtx); + func_80BA9160(this, play); } } else { this->unk_40C = 3; this->unk_1E0 = 10800; this->actor.speedXZ = 0.0f; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->unk_40A |= 4; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_40C); this->actionFunc = func_80BA9CD4; @@ -444,20 +444,20 @@ void func_80BA93AC(EnBaba* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } -void func_80BA9480(EnBaba* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBbaSkel, &gBbaWalkingHoldingBagAnim, this->jointTable, +void func_80BA9480(EnBaba* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gBbaSkel, &gBbaWalkingHoldingBagAnim, this->jointTable, this->morphTable, 0x12); this->actor.draw = EnBaba_Draw; this->unk_40A |= 0x80; this->actor.flags |= ACTOR_FLAG_1; - if (globalCtx->sceneNum == SCENE_BOMYA) { + if (play->sceneNum == SCENE_BOMYA) { this->unk_40A |= 2; this->unk_40C = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); this->actionFunc = func_80BA9758; - } else if (globalCtx->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneNum == SCENE_BACKTOWN) { if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_0) && (gSaveContext.save.entranceIndex != 0xD670) && ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F)) { if ((gSaveContext.save.weekEventReg[58] & 0x40) || @@ -509,10 +509,10 @@ void func_80BA9480(EnBaba* this, GlobalContext* globalCtx) { } } -void func_80BA9758(EnBaba* this, GlobalContext* globalCtx) { - if ((this->unk_40A & 8) || (this->unk_144 != NULL) || func_80BA8820(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BA886C(this, globalCtx); +void func_80BA9758(EnBaba* this, PlayState* play) { + if ((this->unk_40A & 8) || (this->unk_144 != NULL) || func_80BA8820(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BA886C(this, play); if (this->unk_40A & 8) { this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -521,41 +521,41 @@ void func_80BA9758(EnBaba* this, GlobalContext* globalCtx) { if (this->unk_40A & 8) { this->actor.flags |= ACTOR_FLAG_10000; } - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } } -void func_80BA9848(EnBaba* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80BA9848(EnBaba* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); - if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BA9B80; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); } -void func_80BA98EC(EnBaba* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80BA98EC(EnBaba* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_40A & 1) { this->unk_40A &= ~1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (this->unk_40A & 8) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if (globalCtx->msgCtx.unk120B1 == 0) { + if (play->msgCtx.unk120B1 == 0) { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(globalCtx, 0xD670); + func_80BA8C4C(play, 0xD670); return; } } else { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(globalCtx, 0xD670); + func_80BA8C4C(play, 0xD670); } } else { this->unk_1E0 = 0; @@ -563,47 +563,47 @@ void func_80BA98EC(EnBaba* this, GlobalContext* globalCtx) { } } else if (this->unk_40A & 0x20) { this->unk_40A &= ~0x20; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BA9AB8; } else { - func_80BA886C(this, globalCtx); + func_80BA886C(this, play); } } } else if (temp_v0 == 6) { - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.unk120B1 == 0)) { + if (Message_ShouldAdvance(play) && (play->msgCtx.unk120B1 == 0)) { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(globalCtx, 0xD670); + func_80BA8C4C(play, 0xD670); } } } -void func_80BA9AB8(EnBaba* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80BA9AB8(EnBaba* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->unk_40A |= 0x40; this->actionFunc = func_80BA9B24; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_BLAST, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_MASK_BLAST, 300.0f, 300.0f); } } -void func_80BA9B24(EnBaba* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BA886C(this, globalCtx); +void func_80BA9B24(EnBaba* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BA886C(this, play); this->actionFunc = func_80BA98EC; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80BA9B80(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA9B80(EnBaba* this, PlayState* play) { ScheduleResult sp20; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BAA488, &sp20) || - ((this->unk_434 != sp20.result) && !func_80BA9110(this, globalCtx, &sp20))) { + if (!Schedule_RunScript(play, D_80BAA488, &sp20) || + ((this->unk_434 != sp20.result) && !func_80BA9110(this, play, &sp20))) { this->unk_40A &= ~0x80; this->actor.flags &= ~ACTOR_FLAG_1; sp20.result = false; @@ -613,20 +613,20 @@ void func_80BA9B80(EnBaba* this, GlobalContext* globalCtx) { } this->unk_434 = sp20.result; - func_80BA93AC(this, globalCtx); + func_80BA93AC(this, play); if (this->unk_40A & 2) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x2A39, &this->actor); // "I'm sorry" + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x2A39, &this->actor); // "I'm sorry" this->actionFunc = func_80BA9848; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); } -void func_80BA9CD4(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA9CD4(EnBaba* this, PlayState* play) { s16 sp2E = this->skelAnime.curFrame; s16 sp2C = Animation_GetLastFrame(sAnimations[this->unk_40C].animation); @@ -645,35 +645,35 @@ void func_80BA9CD4(EnBaba* this, GlobalContext* globalCtx) { } else { if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->unk_404) == 0)) { Audio_QueueSeqCmd(0x101400FF); - func_80BA8C4C(globalCtx, 0xD670); + func_80BA8C4C(play, 0xD670); } else { Actor_MoveWithGravity(&this->actor); } } } -void func_80BA9E00(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA9E00(EnBaba* this, PlayState* play) { } -void func_80BA9E10(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA9E10(EnBaba* this, PlayState* play) { if (func_80BA8D2C(this, 1.0f)) { this->unk_1E8 = 0; } } -void func_80BA9E48(EnBaba* this, GlobalContext* globalCtx) { +void func_80BA9E48(EnBaba* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; } -void EnBaba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBaba_Init(Actor* thisx, PlayState* play) { s32 pad; EnBaba* this = THIS; - 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->path = SubS_GetPathByIndex(globalCtx, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F); + this->path = SubS_GetPathByIndex(play, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F); Actor_SetScale(&this->actor, 0.01f); @@ -682,23 +682,22 @@ void EnBaba_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80BA9480; } -void EnBaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBaba_Destroy(Actor* thisx, PlayState* play) { EnBaba* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnBaba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBaba_Update(Actor* thisx, PlayState* play) { EnBaba* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - func_80BA8DF4(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + func_80BA8DF4(this, play); } -s32 EnBaba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBaba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBaba* this = THIS; if (limbIndex == 6) { @@ -713,7 +712,7 @@ s32 EnBaba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY); } - if ((limbIndex == 6) && (this->unk_1E2 != 0) && ((globalCtx->state.frames % 2) == 0)) { + if ((limbIndex == 6) && (this->unk_1E2 != 0) && ((play->state.frames % 2) == 0)) { Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); } @@ -730,7 +729,7 @@ s32 EnBaba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return 0; } -void EnBaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnBaba* this = THIS; Vec3f sp18 = { 0.0f, 0.0f, 0.0f }; @@ -742,29 +741,29 @@ void EnBaba_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnBaba_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnBaba_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnBaba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBaba_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBaba* this = THIS; Vec3f sp4C; Vec3f sp40; if (this->unk_40A & 2) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBbaEyeTex)); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBaba_OverrideLimbDraw, EnBaba_PostLimbDraw, EnBaba_TransformLimbDraw, &this->actor); if (this->unk_40A & 0x80) { if ((this->unk_40C == 3) || (this->unk_40C == 4)) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp4C.x = this->actor.world.pos.x + 20.0f; sp4C.y = this->actor.world.pos.y; sp4C.z = this->actor.world.pos.z + 20.0f; @@ -773,9 +772,9 @@ void EnBaba_Draw(Actor* thisx, GlobalContext* globalCtx) { } sp40.x = sp40.y = sp40.z = 0.3f; - func_800BC620(&sp4C, &sp40, 255, globalCtx); + func_800BC620(&sp4C, &sp40, 255, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.h b/src/overlays/actors/ovl_En_Baba/z_en_baba.h index f95020f956..8c00f10e5e 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.h +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.h @@ -5,7 +5,7 @@ struct EnBaba; -typedef void (*EnBabaActionFunc)(struct EnBaba*, GlobalContext*); +typedef void (*EnBabaActionFunc)(struct EnBaba*, PlayState*); #define ENBABA_GET_3F00(thisx) (((thisx)->params & 0x3F00) >> 8) #define ENBABA_GET_C000(thisx) (((thisx)->params & 0xC000) >> 0xE) diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c index 66ba49919a..46b40b9a90 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -11,20 +11,20 @@ #define THIS ((EnBaguo*)thisx) -void EnBaguo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBaguo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBaguo_Update(Actor* thisx, GlobalContext* globalCtx); +void EnBaguo_Init(Actor* thisx, PlayState* play); +void EnBaguo_Destroy(Actor* thisx, PlayState* play); +void EnBaguo_Update(Actor* thisx, PlayState* play); -void EnBaguo_UndergroundIdle(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_EmergeFromUnderground(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_Idle(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_Roll(EnBaguo* this, GlobalContext* globalCtx); +void EnBaguo_UndergroundIdle(EnBaguo* this, PlayState* play); +void EnBaguo_EmergeFromUnderground(EnBaguo* this, PlayState* play); +void EnBaguo_Idle(EnBaguo* this, PlayState* play); +void EnBaguo_Roll(EnBaguo* this, PlayState* play); void EnBaguo_SetupRetreatUnderground(EnBaguo* this); -void EnBaguo_RetreatUnderground(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_DrawBody(Actor* thisx, GlobalContext* globalCtx); +void EnBaguo_RetreatUnderground(EnBaguo* this, PlayState* play); +void EnBaguo_DrawBody(Actor* thisx, PlayState* play); void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer); -void EnBaguo_UpdateEffects(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_DrawEffects(EnBaguo* this, GlobalContext* globalCtx); +void EnBaguo_UpdateEffects(EnBaguo* this, PlayState* play); +void EnBaguo_DrawEffects(EnBaguo* this, PlayState* play); typedef enum { /* 0x0 */ NEJIRON_ACTION_INACTIVE, // The Nejiron is either underground or emerging from underground @@ -121,12 +121,11 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, NEJIRON_DMGEFF_KILL), }; -void EnBaguo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBaguo_Init(Actor* thisx, PlayState* play) { EnBaguo* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gNejironSkel, NULL, this->jointTable, this->morphTable, - NEJIRON_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gNejironSkel, NULL, this->jointTable, this->morphTable, NEJIRON_LIMB_MAX); this->actor.hintId = 0xB; this->maxDistanceFromHome = 240.0f; this->maxDistanceFromHome += this->actor.world.rot.z * 40.0f; @@ -135,7 +134,7 @@ void EnBaguo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 2; - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.modelSphere.radius = 30; this->collider.elements[0].dim.scale = 1.0f; this->collider.elements[0].dim.modelSphere.center.x = 80; @@ -151,15 +150,15 @@ void EnBaguo_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnBaguo_UndergroundIdle; } -void EnBaguo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBaguo_Destroy(Actor* thisx, PlayState* play) { EnBaguo* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnBaguo_UndergroundIdle(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_UndergroundIdle(EnBaguo* this, PlayState* play) { this->action = NEJIRON_ACTION_INACTIVE; - if (this->actor.xzDistToPlayer < 200.0f && Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { + if (this->actor.xzDistToPlayer < 200.0f && Player_GetMask(play) != PLAYER_MASK_STONE) { this->actor.draw = EnBaguo_DrawBody; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_APPEAR); this->actor.world.rot.z = 0; @@ -171,12 +170,12 @@ void EnBaguo_UndergroundIdle(EnBaguo* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnBaguo_EmergeFromUnderground(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_EmergeFromUnderground(EnBaguo* this, PlayState* play) { this->actor.world.rot.y += 0x1518; this->actor.shape.rot.y = this->actor.world.rot.y; - if ((globalCtx->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 10, 8.0f, 500, 10, 1); + if ((play->gameplayFrames % 8) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, 10, + 8.0f, 500, 10, 1); } Math_ApproachF(&this->actor.shape.shadowScale, 50.0f, 0.3f, 5.0f); Math_ApproachF(&this->actor.shape.yOffset, 2700.0f, 100.0f, 500.0f); @@ -188,7 +187,7 @@ void EnBaguo_EmergeFromUnderground(EnBaguo* this, GlobalContext* globalCtx) { } } -void EnBaguo_Idle(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_Idle(EnBaguo* this, PlayState* play) { s16 absoluteYaw; s16 yaw; @@ -203,8 +202,8 @@ void EnBaguo_Idle(EnBaguo* this, GlobalContext* globalCtx) { if ((this->timer & 8) != 0) { if (fabsf(this->actor.world.rot.y - this->actor.yawTowardsPlayer) > 200.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 30, 300, 1000); - if ((globalCtx->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, + if ((play->gameplayFrames % 8) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_VOICE); } @@ -234,12 +233,12 @@ void EnBaguo_Idle(EnBaguo* this, GlobalContext* globalCtx) { } } -void EnBaguo_Roll(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_Roll(EnBaguo* this, PlayState* play) { f32 xDistanceFromHome = this->actor.home.pos.x - this->actor.world.pos.x; f32 zDistanceFromHome = this->actor.home.pos.z - this->actor.world.pos.z; if ((sqrtf(SQ(xDistanceFromHome) + SQ(zDistanceFromHome)) > this->maxDistanceFromHome) || - (Player_GetMask(globalCtx) == PLAYER_MASK_STONE)) { + (Player_GetMask(play) == PLAYER_MASK_STONE)) { EnBaguo_SetupRetreatUnderground(this); } else if (this->timer == 0) { this->timer = 100; @@ -276,12 +275,12 @@ void EnBaguo_SetupRetreatUnderground(EnBaguo* this) { this->actor.speedXZ = 0.0f; } -void EnBaguo_RetreatUnderground(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_RetreatUnderground(EnBaguo* this, PlayState* play) { this->actor.world.rot.y -= 0x1518; this->actor.shape.rot.y = this->actor.world.rot.y; - if ((globalCtx->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 10, 8.0f, 500, 10, 1); + if ((play->gameplayFrames % 8) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, 10, + 8.0f, 500, 10, 1); } Math_ApproachF(&this->actor.shape.yOffset, -3000.0f, 100.0f, 500.0f); @@ -298,17 +297,17 @@ void EnBaguo_RetreatUnderground(EnBaguo* this, GlobalContext* globalCtx) { } } -void EnBaguo_PostDetonation(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_PostDetonation(EnBaguo* this, PlayState* play) { if (this->timer == 0) { Actor_MarkForDeath(&this->actor); } if (this->timer >= 26) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } -void EnBaguo_CheckForDetonation(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_CheckForDetonation(EnBaguo* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; s32 i; @@ -345,8 +344,8 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, GlobalContext* globalCtx) { (Rand_ZeroFloat(1.0f) * 0.01f) + 0.003f, 90); } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_POP); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_POP); Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_DEAD); @@ -356,26 +355,26 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0f); this->collider.elements->dim.scale = 3.0f; this->collider.elements->info.toucher.damage = 8; - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xB0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xB0); this->actionFunc = EnBaguo_PostDetonation; } } } } -void EnBaguo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBaguo_Update(Actor* thisx, PlayState* play) { EnBaguo* this = THIS; Actor_SetFocus(&this->actor, 30.0f); - EnBaguo_UpdateEffects(this, globalCtx); - EnBaguo_CheckForDetonation(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBaguo_UpdateEffects(this, play); + EnBaguo_CheckForDetonation(this, play); + this->actionFunc(this, play); DECR(this->blinkTimer); DECR(this->timer); if (this->action != NEJIRON_ACTION_EXPLODING && this->action != NEJIRON_ACTION_INACTIVE) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->action != NEJIRON_ACTION_EXPLODING) { @@ -391,32 +390,32 @@ void EnBaguo_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if (this->action != NEJIRON_ACTION_INACTIVE) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->action != NEJIRON_ACTION_EXPLODING) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void EnBaguo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBaguo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnBaguo* this = THIS; Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnBaguo_DrawBody(Actor* thisx, GlobalContext* globalCtx) { +void EnBaguo_DrawBody(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { &gNejironEyeOpenTex, &gNejironEyeHalfTex, &gNejironEyeClosedTex }; EnBaguo* this = THIS; Gfx* gfx; s32 eyeIndex; void* virtualAddress; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -426,12 +425,12 @@ void EnBaguo_DrawBody(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = &gfx[1]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBaguo_PostLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBaguo_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - EnBaguo_DrawEffects(this, globalCtx); + EnBaguo_DrawEffects(this, play); } void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer) { @@ -454,7 +453,7 @@ void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* } } -void EnBaguo_UpdateEffects(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_UpdateEffects(EnBaguo* this, PlayState* play) { s32 i; NejironEffect* effect = this->effects; @@ -486,14 +485,14 @@ void EnBaguo_UpdateEffects(EnBaguo* this, GlobalContext* globalCtx) { } } -void EnBaguo_DrawEffects(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_DrawEffects(EnBaguo* this, PlayState* play) { s16 i; NejironEffect* effect = this->effects; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h index 553a77f48f..6c98eeaeb0 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h @@ -6,7 +6,7 @@ struct EnBaguo; -typedef void (*EnBaguoActionFunc)(struct EnBaguo*, GlobalContext*); +typedef void (*EnBaguoActionFunc)(struct EnBaguo*, PlayState*); /** * When a Nejiron explodes, rock particles fly out from where it exploded. diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 193c899c99..d00a92aa26 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -11,17 +11,17 @@ #define THIS ((EnBaisen*)thisx) -void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBaisen_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBaisen_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBaisen_Init(Actor* thisx, PlayState* play); +void EnBaisen_Destroy(Actor* thisx, PlayState* play); +void EnBaisen_Update(Actor* thisx, PlayState* play); +void EnBaisen_Draw(Actor* thisx, PlayState* play); -void func_80BE87B0(EnBaisen* this, GlobalContext* globalCtx); +void func_80BE87B0(EnBaisen* this, PlayState* play); void func_80BE87FC(EnBaisen* this); -void func_80BE887C(EnBaisen* this, GlobalContext* globalCtx); -void func_80BE895C(EnBaisen* this, GlobalContext* globalCtx); -void func_80BE8AAC(EnBaisen* this, GlobalContext* globalCtx); -void func_80BE89D8(EnBaisen* this, GlobalContext* globalCtx); +void func_80BE887C(EnBaisen* this, PlayState* play); +void func_80BE895C(EnBaisen* this, PlayState* play); +void func_80BE8AAC(EnBaisen* this, PlayState* play); +void func_80BE89D8(EnBaisen* this, PlayState* play); const ActorInit En_Baisen_InitVars = { ACTOR_EN_BAISEN, @@ -61,11 +61,11 @@ static AnimationHeader* D_80BE8E4C[] = { &object_bai_Anim_0011C0, &object_bai_An static u8 animModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; -void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBaisen_Init(Actor* thisx, PlayState* play) { EnBaisen* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, this->morphTable, 20); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->paramCopy = this->actor.params; @@ -86,7 +86,7 @@ void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx) { } this->actor.targetMode = 6; this->actor.gravity = -3.0f; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (this->paramCopy == 0) { this->actionFunc = func_80BE87B0; } else { @@ -94,10 +94,10 @@ void EnBaisen_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBaisen_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBaisen_Destroy(Actor* thisx, PlayState* play) { EnBaisen* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnBaisen_ChangeAnimation(EnBaisen* this, s32 animIndex) { @@ -122,8 +122,8 @@ void func_80BE871C(EnBaisen* this) { } } -void func_80BE87B0(EnBaisen* this, GlobalContext* globalCtx) { - Actor* actorIterator = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +void func_80BE87B0(EnBaisen* this, PlayState* play) { + Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actorIterator != NULL) { if (actorIterator->id == ACTOR_EN_HEISHI) { @@ -149,33 +149,33 @@ void func_80BE87FC(EnBaisen* this) { this->actionFunc = func_80BE887C; } -void func_80BE887C(EnBaisen* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BE895C(this, globalCtx); +void func_80BE887C(EnBaisen* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BE895C(this, play); } else { if (this->paramCopy != 0) { this->textIdIndex = 0; if (gSaveContext.save.weekEventReg[60] & 8) { this->textIdIndex = 1; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_COUPLE) { + if (Player_GetMask(play) == PLAYER_MASK_COUPLE) { this->textIdIndex = 6; } if (this->unk2AC == 1) { - func_80BE895C(this, globalCtx); + func_80BE895C(this, play); return; } } this->actor.textId = sTextIds[this->textIdIndex]; - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } -void func_80BE895C(EnBaisen* this, GlobalContext* globalCtx) { +void func_80BE895C(EnBaisen* this, PlayState* play) { if (this->unk2A4 != NULL) { this->unk290 = true; this->unk2AC = 1; - Actor_ChangeFocus(this->unk2A4, globalCtx, this->unk2A4); + Actor_ChangeFocus(this->unk2A4, play, this->unk2A4); } this->unk29C = 1; if (this->paramCopy == 0) { @@ -186,7 +186,7 @@ void func_80BE895C(EnBaisen* this, GlobalContext* globalCtx) { } } -void func_80BE89D8(EnBaisen* this, GlobalContext* globalCtx) { +void func_80BE89D8(EnBaisen* this, PlayState* play) { if (&this->actor == this->unk2A4) { this->unk29E = this->actor.world.rot.y; if (this->animIndex == 0) { @@ -198,8 +198,8 @@ void func_80BE89D8(EnBaisen* this, GlobalContext* globalCtx) { EnBaisen_ChangeAnimation(this, 0); } } - if ((globalCtx->msgCtx.currentTextId == 0x2AC6) || (globalCtx->msgCtx.currentTextId == 0x2AC7) || - (globalCtx->msgCtx.currentTextId == 0x2AC8)) { + if ((play->msgCtx.currentTextId == 0x2AC6) || (play->msgCtx.currentTextId == 0x2AC7) || + (play->msgCtx.currentTextId == 0x2AC8)) { this->skelAnime.playSpeed = 0.0f; this->unk29E = this->actor.yawTowardsPlayer; } @@ -208,7 +208,7 @@ void func_80BE89D8(EnBaisen* this, GlobalContext* globalCtx) { } } -void func_80BE8AAC(EnBaisen* this, GlobalContext* globalCtx) { +void func_80BE8AAC(EnBaisen* this, PlayState* play) { if ((this->textIdIndex % 2) != 0) { this->unk29E = this->actor.world.rot.y; if (this->animIndex == 0) { @@ -222,24 +222,24 @@ void func_80BE8AAC(EnBaisen* this, GlobalContext* globalCtx) { EnBaisen_ChangeAnimation(this, 0); } } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->textIdIndex++; if (this->textIdIndex < 6) { - func_80151938(globalCtx, sTextIds[this->textIdIndex]); + func_80151938(play, sTextIds[this->textIdIndex]); if ((this->textIdIndex % 2) == 0) { this->unk2A4 = this->heishiPointer; } else { this->unk2A4 = &this->actor; } - Actor_ChangeFocus(this->unk2A4, globalCtx, this->unk2A4); + Actor_ChangeFocus(this->unk2A4, play, this->unk2A4); } else { func_80BE87FC(this); } } } -void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBaisen_Update(Actor* thisx, PlayState* play) { s32 pad; EnBaisen* this = THIS; @@ -252,9 +252,9 @@ void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Actor_SetScale(&this->actor, 0.01f); if (this->unk290) { func_80BE871C(this); @@ -263,11 +263,10 @@ void EnBaisen_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 0xBB8, 0); Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 0x3E8, 0); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnBaisen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBaisen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBaisen* this = THIS; if (limbIndex == 9) { @@ -279,10 +278,10 @@ s32 EnBaisen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnBaisen_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBaisen_Draw(Actor* thisx, PlayState* play) { EnBaisen* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBaisen_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h index f903ec15d5..3fb45f70a7 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h @@ -5,7 +5,7 @@ struct EnBaisen; -typedef void (*EnBaisenActionFunc)(struct EnBaisen*, GlobalContext*); +typedef void (*EnBaisenActionFunc)(struct EnBaisen*, PlayState*); typedef struct EnBaisen { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.c b/src/overlays/actors/ovl_En_Bal/z_en_bal.c index 2f57c28042..98f3e6c4a3 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.c +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.c @@ -10,10 +10,10 @@ #define THIS ((EnBal*)thisx) -void EnBal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBal_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBal_Init(Actor* thisx, PlayState* play); +void EnBal_Destroy(Actor* thisx, PlayState* play); +void EnBal_Update(Actor* thisx, PlayState* play); +void EnBal_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Bal_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.h b/src/overlays/actors/ovl_En_Bal/z_en_bal.h index ecd4309a0c..3bb22cb34a 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.h +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.h @@ -5,7 +5,7 @@ struct EnBal; -typedef void (*EnBalActionFunc)(struct EnBal*, GlobalContext*); +typedef void (*EnBalActionFunc)(struct EnBal*, PlayState*); typedef struct EnBal { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index ab76d88c84..c85cd3410a 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -10,15 +10,15 @@ #define THIS ((EnBat*)thisx) -void EnBat_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBat_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBat_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBat_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBat_Init(Actor* thisx, PlayState* play); +void EnBat_Destroy(Actor* thisx, PlayState* play); +void EnBat_Update(Actor* thisx, PlayState* play); +void EnBat_Draw(Actor* thisx, PlayState* play); -void func_80A438D4(EnBat* this, GlobalContext* globalCtx); -void func_80A4392C(EnBat* this, GlobalContext* globalCtx); -void func_80A43CE8(EnBat* this, GlobalContext* globalCtx); -void func_80A44114(EnBat* this, GlobalContext* globalCtx); +void func_80A438D4(EnBat* this, PlayState* play); +void func_80A4392C(EnBat* this, PlayState* play); +void func_80A43CE8(EnBat* this, PlayState* play); +void func_80A44114(EnBat* this, PlayState* play); #if 0 const ActorInit En_Bat_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.h b/src/overlays/actors/ovl_En_Bat/z_en_bat.h index 2ccaaa8928..3a8a2e0a1d 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.h +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.h @@ -5,7 +5,7 @@ struct EnBat; -typedef void (*EnBatActionFunc)(struct EnBat*, GlobalContext*); +typedef void (*EnBatActionFunc)(struct EnBat*, PlayState*); typedef struct EnBat { /* 0x0000 */ Actor actor; 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 65d582eb36..0be4ae957c 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -11,23 +11,23 @@ #define THIS ((EnBb*)thisx) -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBb_Init(Actor* thisx, PlayState* play); +void EnBb_Destroy(Actor* thisx, PlayState* play); +void EnBb_Update(Actor* thisx, PlayState* play); +void EnBb_Draw(Actor* thisx, PlayState* play); void EnBb_SetupFlyIdle(EnBb* this); -void EnBb_FlyIdle(EnBb* this, GlobalContext* globalCtx); +void EnBb_FlyIdle(EnBb* this, PlayState* play); void EnBb_SetupAttack(EnBb* this); -void EnBb_Attack(EnBb* this, GlobalContext* globalCtx); -void EnBb_Down(EnBb* this, GlobalContext* globalCtx); -void EnBb_Dead(EnBb* this, GlobalContext* globalCtx); -void EnBb_Damage(EnBb* this, GlobalContext* globalCtx); -void EnBb_Frozen(EnBb* this, GlobalContext* globalCtx); +void EnBb_Attack(EnBb* this, PlayState* play); +void EnBb_Down(EnBb* this, PlayState* play); +void EnBb_Dead(EnBb* this, PlayState* play); +void EnBb_Damage(EnBb* this, PlayState* play); +void EnBb_Frozen(EnBb* this, PlayState* play); void EnBb_SetupWaitForRevive(EnBb* this); -void EnBb_WaitForRevive(EnBb* this, GlobalContext* globalCtx); +void EnBb_WaitForRevive(EnBb* this, PlayState* play); void EnBb_SetupRevive(EnBb* this); -void EnBb_Revive(EnBb* this, GlobalContext* globalCtx); +void EnBb_Revive(EnBb* this, PlayState* play); typedef enum { /* -1 */ BB_BODY_PART_DRAW_STATUS_BROKEN = -1, @@ -134,13 +134,13 @@ static s8 sLimbIndexToBodyPartsIndex[] = { */ static Vec3f sDuplicateCraniumBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; -void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Init(Actor* thisx, PlayState* play) { EnBb* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gBubbleSkel, &gBubbleFlyingAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBubbleSkel, &gBubbleFlyingAnim, this->jointTable, this->morphTable, BUBBLE_LIMB_MAX); - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); ActorShape_Init(&this->actor.shape, 1500.0f, ActorShadow_DrawCircle, 35.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -157,10 +157,10 @@ void EnBb_Init(Actor* thisx, GlobalContext* globalCtx) { EnBb_SetupFlyIdle(this); } -void EnBb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Destroy(Actor* thisx, PlayState* play) { EnBb* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } /** @@ -192,12 +192,11 @@ void EnBb_Freeze(EnBb* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void EnBb_Thaw(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Thaw(EnBb* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, - 0.15f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, 0.15f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -252,7 +251,7 @@ void EnBb_SetupFlyIdle(EnBb* this) { /** * Makes the Bubble fly in circles around its home. */ -void EnBb_FlyIdle(EnBb* this, GlobalContext* globalCtx) { +void EnBb_FlyIdle(EnBb* this, PlayState* play) { EnBb_UpdateStateForFlying(this); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { @@ -265,7 +264,7 @@ void EnBb_FlyIdle(EnBb* this, GlobalContext* globalCtx) { this->timer--; if ((this->attackWaitTimer == 0) && (this->actor.xzDistToPlayer < this->attackRange) && - (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + (Player_GetMask(play) != PLAYER_MASK_STONE)) { EnBb_SetupAttack(this); } else if (this->timer == 0) { EnBb_SetupFlyIdle(this); @@ -284,7 +283,7 @@ void EnBb_SetupAttack(EnBb* this) { /** * Makes the Bubble actively move towards the player. */ -void EnBb_Attack(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Attack(EnBb* this, PlayState* play) { this->targetYRotation = this->actor.yawTowardsPlayer; EnBb_UpdateStateForFlying(this); @@ -299,7 +298,7 @@ void EnBb_Attack(EnBb* this, GlobalContext* globalCtx) { this->timer--; if (((this->attackRange + 120.0f) < this->actor.xzDistToPlayer) || (this->timer == 0) || - (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || + (Player_GetMask(play) == PLAYER_MASK_STONE) || (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 400.0f)) { EnBb_SetupFlyIdle(this); } @@ -322,7 +321,7 @@ void EnBb_SetupDown(EnBb* this) { /** * Makes the Bubble hop along the ground. */ -void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Down(EnBb* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnBb_CheckForWall(this); @@ -341,7 +340,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } this->actor.bgCheckFlags &= ~1; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(this->actor.yawTowardsPlayer, 0x8000), 0xBB8); } @@ -355,7 +354,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_SetupDead(EnBb* this, GlobalContext* globalCtx) { +void EnBb_SetupDead(EnBb* this, PlayState* play) { Vec3f* bodyPartVelocity; Vec3f posDiff; f32 magnitude; @@ -365,8 +364,8 @@ void EnBb_SetupDead(EnBb* this, GlobalContext* globalCtx) { this->timer = 15; this->actor.shape.rot.x += 0x4E20; this->actor.speedXZ = 0.0f; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; this->bodyPartDrawStatus = BB_BODY_PART_DRAW_STATUS_DEAD; @@ -390,7 +389,7 @@ void EnBb_SetupDead(EnBb* this, GlobalContext* globalCtx) { this->actionFunc = EnBb_Dead; } -void EnBb_Dead(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Dead(EnBb* this, PlayState* play) { s32 i; this->timer--; @@ -398,8 +397,8 @@ void EnBb_Dead(EnBb* this, GlobalContext* globalCtx) { if (this->timer == 0) { for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { - func_800B3030(globalCtx, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } EnBb_SetupWaitForRevive(this); @@ -435,7 +434,7 @@ void EnBb_SetupDamage(EnBb* this) { this->actionFunc = 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.bgCheckFlags & 1) && (this->actor.speedXZ < 0.1f)) { EnBb_SetupDown(this); @@ -452,13 +451,13 @@ void EnBb_SetupFrozen(EnBb* this) { this->actionFunc = EnBb_Frozen; } -void EnBb_Frozen(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Frozen(EnBb* this, PlayState* play) { DECR(this->timer); if (this->timer == 0) { - EnBb_Thaw(this, globalCtx); + EnBb_Thaw(this, play); if (this->actor.colChkInfo.health == 0) { - EnBb_SetupDead(this, globalCtx); + EnBb_SetupDead(this, play); } else { EnBb_SetupDown(this); } @@ -479,7 +478,7 @@ void EnBb_SetupWaitForRevive(EnBb* this) { this->actionFunc = EnBb_WaitForRevive; } -void EnBb_WaitForRevive(EnBb* this, GlobalContext* globalCtx) { +void EnBb_WaitForRevive(EnBb* this, PlayState* play) { this->timer--; if (this->timer == 0) { EnBb_SetupRevive(this); @@ -498,7 +497,7 @@ void EnBb_SetupRevive(EnBb* this) { this->actionFunc = EnBb_Revive; } -void EnBb_Revive(EnBb* this, GlobalContext* globalCtx) { +void EnBb_Revive(EnBb* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y += 0x1F00; @@ -515,7 +514,7 @@ void EnBb_Revive(EnBb* this, GlobalContext* globalCtx) { this->actor.scale.y = ((0.01f - this->actor.scale.x) * 0.5f) + 0.01f; } -void EnBb_UpdateDamage(EnBb* this, GlobalContext* globalCtx) { +void EnBb_UpdateDamage(EnBb* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); @@ -525,10 +524,10 @@ void EnBb_UpdateDamage(EnBb* this, GlobalContext* globalCtx) { Actor_SetDropFlag(&this->actor, &this->collider.info); this->flameScaleY = 0.0f; this->flameScaleX = 0.0f; - EnBb_Thaw(this, globalCtx); + EnBb_Thaw(this, play); if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } if (this->actor.colChkInfo.damageEffect == EN_BB_DMGEFF_ICE_ARROW) { @@ -540,7 +539,7 @@ void EnBb_UpdateDamage(EnBb* this, GlobalContext* globalCtx) { EnBb_SetupFrozen(this); } else if (this->actor.colChkInfo.health == 0) { - EnBb_SetupDead(this, globalCtx); + EnBb_SetupDead(this, play); } else { EnBb_SetupDamage(this); } @@ -549,7 +548,7 @@ void EnBb_UpdateDamage(EnBb* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.4f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); } @@ -579,14 +578,14 @@ void EnBb_UpdateDamage(EnBb* this, GlobalContext* globalCtx) { } } -void EnBb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Update(Actor* thisx, PlayState* play) { EnBb* this = THIS; - EnBb_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBb_UpdateDamage(this, play); + this->actionFunc(this, play); if ((this->actionFunc != EnBb_Dead) && (this->actionFunc != EnBb_WaitForRevive)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 40.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 40.0f, 7); this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + 15.0f; @@ -598,15 +597,15 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_ON) { this->actor.flags |= ACTOR_FLAG_1000000; - 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->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -621,7 +620,7 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnBb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnBb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBb* this = THIS; if (this->bodyPartDrawStatus == BB_BODY_PART_DRAW_STATUS_BROKEN) { @@ -632,7 +631,7 @@ s32 EnBb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnBb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnBb* this = THIS; MtxF* currentMatrixState; @@ -658,56 +657,55 @@ void EnBb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } else { if (sLimbIndexToBodyPartsIndex[limbIndex] != -1) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); currentMatrixState = Matrix_GetCurrent(); currentMatrixState->mf[3][0] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].x; currentMatrixState->mf[3][1] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].y; currentMatrixState->mf[3][2] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].z; Matrix_RotateZS(thisx->world.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->limbDList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBb_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBb* this = THIS; MtxF* currentMatrixState; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); POLY_OPA_DISP = &gfx[1]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBb_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBb_OverrideLimbDraw, EnBb_PostLimbDraw, &this->actor); if (this->flameScaleX > 0.0f) { currentMatrixState = Matrix_GetCurrent(); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_RotateYS( - ((Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) - this->actor.shape.rot.y) + 0x8000), + ((Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamera]) - this->actor.shape.rot.y) + 0x8000), MTXMODE_APPLY); Matrix_Scale(this->flameScaleX, this->flameScaleY, 1.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - (globalCtx->gameplayFrames * -20) & 0x1FF, 32, 128)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) & 0x1FF, 32, 128)); currentMatrixState->mf[3][1] -= 47.0f * this->flameScaleY; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 7d5da25b37..e6171065a8 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -8,7 +8,7 @@ struct EnBb; -typedef void (*EnBbActionFunc)(struct EnBb*, GlobalContext*); +typedef void (*EnBbActionFunc)(struct EnBb*, PlayState*); typedef struct EnBb { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 2f932023ab..ae6e8921c2 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -19,14 +19,14 @@ #define THIS ((EnBba01*)thisx) -void EnBba01_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBba01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBba01_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBba01_Init(Actor* thisx, PlayState* play); +void EnBba01_Destroy(Actor* thisx, PlayState* play); +void EnBba01_Update(Actor* thisx, PlayState* play); +void EnBba01_Draw(Actor* thisx, PlayState* play); -void EnBba01_Walk(EnHy* this, GlobalContext* globalCtx); -void EnBba01_FaceFoward(EnHy* this, GlobalContext* globalCtx); -void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx); +void EnBba01_Walk(EnHy* this, PlayState* play); +void EnBba01_FaceFoward(EnHy* this, PlayState* play); +void EnBba01_Talk(EnHy* this, PlayState* play); const ActorInit En_Bba_01_InitVars = { ACTOR_EN_BBA_01, @@ -104,11 +104,11 @@ static TrackOptionsSet sTrackOptions = { { 0x1770, 4, 1, 6 }, }; -void EnBba01_UpdateModel(EnBba01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBba01_UpdateModel(EnBba01* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f point; - EnHy_UpdateSkelAnime(&this->enHy, globalCtx); + EnHy_UpdateSkelAnime(&this->enHy, play); if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { point.x = player->actor.world.pos.x; point.y = player->bodyPartsPos[7].y + 3.0f; @@ -123,15 +123,15 @@ void EnBba01_UpdateModel(EnBba01* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1); Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1); } - SubS_FillLimbRotTables(globalCtx, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, + SubS_FillLimbRotTables(play, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, ARRAY_COUNT(this->enHy.limbRotTableY)); - EnHy_UpdateCollider(&this->enHy, globalCtx); + EnHy_UpdateCollider(&this->enHy, play); } -s32 EnBba01_TestIsTalking(EnBba01* this, GlobalContext* globalCtx) { +s32 EnBba01_TestIsTalking(EnBba01* this, PlayState* play) { s32 isTalking = false; - if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->enHy.actor, &play->state)) { isTalking = true; this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox this->enHy.tmptrackTarget = this->enHy.trackTarget; @@ -143,22 +143,22 @@ s32 EnBba01_TestIsTalking(EnBba01* this, GlobalContext* globalCtx) { return isTalking; } -s32 func_809CC270(EnBba01* this, GlobalContext* globalCtx) { +s32 func_809CC270(EnBba01* this, PlayState* play) { s16 x; s16 y; - Actor_GetScreenPos(globalCtx, &this->enHy.actor, &x, &y); + Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); //! @bug: Both x and y conditionals are always true, || should be an && if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { - func_800B85E0(&this->enHy.actor, globalCtx, 30.0f, EXCH_ITEM_2E); + func_800B85E0(&this->enHy.actor, play, 30.0f, EXCH_ITEM_2E); } return true; } -void EnBba01_FinishInit(EnHy* this, GlobalContext* globalCtx) { +void EnBba01_FinishInit(EnHy* this, PlayState* play) { //! @bug: gBbaSkel does not match EnHy's skeleton assumptions. //! Since gBbaSkel has more limbs than expected, joint and morph tables will overflow - if (EnHy_Init(this, globalCtx, &gBbaSkel, ENHY_ANIMATION_BBA_6)) { + if (EnHy_Init(this, play, &gBbaSkel, ENHY_ANIMATION_BBA_6)) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnBba01_Draw; this->waitingOnInit = false; @@ -170,29 +170,29 @@ void EnBba01_FinishInit(EnHy* this, GlobalContext* globalCtx) { } } -void EnBba01_Walk(EnHy* this, GlobalContext* globalCtx) { +void EnBba01_Walk(EnHy* this, PlayState* play) { if (EnHy_MoveForwards(this, 1.0f)) { this->curPoint = 0; } } -void EnBba01_FaceFoward(EnHy* this, GlobalContext* globalCtx) { +void EnBba01_FaceFoward(EnHy* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; } -void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx) { +void EnBba01_Talk(EnHy* this, PlayState* play) { s16 yaw; u8 talkState; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); - talkState = Message_GetState(&globalCtx->msgCtx); + talkState = Message_GetState(&play->msgCtx); this->inMsgState3 = (talkState == 3) ? true : false; switch (talkState) { case 0: yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); if (yaw < 0x64) { - Message_StartTextbox(globalCtx, this->textId, NULL); + Message_StartTextbox(play, this->textId, NULL); } break; case 2: @@ -207,48 +207,47 @@ void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx) { } } -void EnBba01_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBba01_Init(Actor* thisx, PlayState* play) { s32 pad; EnBba01* this = THIS; - this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); - this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); - this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); - this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); + this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_BBA, play); + this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_BBA, play); + this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_BBA, play); + this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_BBA, play); if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || (this->enHy.skelLowerObjIndex < 0)) { Actor_MarkForDeath(&this->enHy.actor); } this->enHy.actor.draw = NULL; - Collider_InitCylinder(globalCtx, &this->enHy.collider); - Collider_SetCylinder(globalCtx, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->enHy.collider); + Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->enHy.actor.flags &= ~ACTOR_FLAG_1; - this->enHy.path = SubS_GetPathByIndex(globalCtx, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH); + this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH); this->enHy.waitingOnInit = true; Actor_SetScale(&this->enHy.actor, 0.01f); this->enHy.actionFunc = EnBba01_FinishInit; } -void EnBba01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBba01_Destroy(Actor* thisx, PlayState* play) { EnBba01* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->enHy.collider); + Collider_DestroyCylinder(play, &this->enHy.collider); } -void EnBba01_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBba01_Update(Actor* thisx, PlayState* play) { EnBba01* this = THIS; - EnBba01_TestIsTalking(this, globalCtx); - this->enHy.actionFunc(&this->enHy, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); - EnBba01_UpdateModel(this, globalCtx); - func_809CC270(this, globalCtx); + EnBba01_TestIsTalking(this, play); + this->enHy.actionFunc(&this->enHy, play); + Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); + EnBba01_UpdateModel(this, play); + func_809CC270(this, play); } -s32 EnBba01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBba01* this = THIS; s8 bodyPart; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -259,11 +258,11 @@ s32 EnBba01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelLowerObjIndex].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -277,8 +276,7 @@ s32 EnBba01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_RotateZS(-this->enHy.torsoRot.x, MTXMODE_APPLY); } - if ((limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) && this->enHy.inMsgState3 && - ((globalCtx->state.frames % 2) == 0)) { + if ((limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) && this->enHy.inMsgState3 && ((play->state.frames % 2) == 0)) { Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); } @@ -290,16 +288,16 @@ s32 EnBba01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnBba01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBba01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnBba01* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (limbIndex == BBA_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { @@ -307,22 +305,22 @@ void EnBba01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnBba01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnBba01_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBba01_Draw(Actor* thisx, PlayState* play) { EnBba01* this = THIS; s32 i; - u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); u8* shadowTexIter; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 55, 55, 255, 0)); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 55, 55, 255, 0)); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable, this->enHy.skelAnime.dListCount, EnBba01_OverrideLimbDraw, EnBba01_PostLimbDraw, EnBba01_TransformLimbDraw, &this->enHy.actor); Matrix_RotateXS(0, MTXMODE_NEW); @@ -334,7 +332,7 @@ void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx) { SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts); } - SubS_DrawShadowTex(&this->enHy.actor, &globalCtx->state, shadowTex); + SubS_DrawShadowTex(&this->enHy.actor, &play->state, shadowTex); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h index b670dea012..04bab2ff12 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h @@ -5,7 +5,7 @@ struct EnBba01; -typedef void (*EnBba01ActionFunc)(struct EnBba01*, GlobalContext*); +typedef void (*EnBba01ActionFunc)(struct EnBba01*, PlayState*); #define ENBBA01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) #define ENBBA01_NO_PATH 0x3F diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 9e55e85080..e2deeb38a2 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -11,23 +11,23 @@ #define THIS ((EnBbfall*)thisx) -void EnBbfall_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBbfall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBbfall_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBbfall_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBbfall_Init(Actor* thisx, PlayState* play); +void EnBbfall_Destroy(Actor* thisx, PlayState* play); +void EnBbfall_Update(Actor* thisx, PlayState* play); +void EnBbfall_Draw(Actor* thisx, PlayState* play); void EnBbfall_SetupWaitForPlayer(EnBbfall* this); -void EnBbfall_WaitForPlayer(EnBbfall* this, GlobalContext* globalCtx); +void EnBbfall_WaitForPlayer(EnBbfall* this, PlayState* play); void EnBbfall_SetupEmerge(EnBbfall* this); -void EnBbfall_Emerge(EnBbfall* this, GlobalContext* globalCtx); +void EnBbfall_Emerge(EnBbfall* this, PlayState* play); void EnBbfall_SetupFly(EnBbfall* this); -void EnBbfall_Fly(EnBbfall* this, GlobalContext* globalCtx); +void EnBbfall_Fly(EnBbfall* this, PlayState* play); void EnBbfall_SetupSinkIntoLava(EnBbfall* this); -void EnBbfall_SinkIntoLava(EnBbfall* this, GlobalContext* globalCtx); -void EnBbfall_Down(EnBbfall* this, GlobalContext* globalCtx); -void EnBbfall_Dead(EnBbfall* this, GlobalContext* globalCtx); -void EnBbfall_Damage(EnBbfall* this, GlobalContext* globalCtx); -void EnBbfall_Frozen(EnBbfall* this, GlobalContext* globalCtx); +void EnBbfall_SinkIntoLava(EnBbfall* this, PlayState* play); +void EnBbfall_Down(EnBbfall* this, PlayState* play); +void EnBbfall_Dead(EnBbfall* this, PlayState* play); +void EnBbfall_Damage(EnBbfall* this, PlayState* play); +void EnBbfall_Frozen(EnBbfall* this, PlayState* play); typedef enum { /* -1 */ BBFALL_BODY_PART_DRAW_STATUS_BROKEN = -1, @@ -163,15 +163,15 @@ static s8 sLimbIndexToBodyPartsIndex[] = { */ static Vec3f sDuplicateCraniumBodyPartOffset = { 1000.0f, -700.0f, 0.0f }; -void EnBbfall_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBbfall_Init(Actor* thisx, PlayState* play) { EnBbfall* this = THIS; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gBubbleSkel, &gBubbleFlyingAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBubbleSkel, &gBubbleFlyingAnim, this->jointTable, this->morphTable, BUBBLE_LIMB_MAX); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); ActorShape_Init(&this->actor.shape, 1500.0f, ActorShadow_DrawCircle, 35.0f); this->timer = 0; EnBbfall_SetupWaitForPlayer(this); @@ -181,10 +181,10 @@ void EnBbfall_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBbfall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBbfall_Destroy(Actor* thisx, PlayState* play) { EnBbfall* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnBbfall_Freeze(EnBbfall* this) { @@ -197,12 +197,11 @@ void EnBbfall_Freeze(EnBbfall* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void EnBbfall_Thaw(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Thaw(EnBbfall* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, - 0.15f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.2f, 0.15f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -210,9 +209,9 @@ void EnBbfall_Thaw(EnBbfall* this, GlobalContext* globalCtx) { /** * Returns true if the Bubble is touching a floor that it should "sink into" (i.e., if it's touching lava). */ -s32 EnBbfall_IsTouchingLava(EnBbfall* this, GlobalContext* globalCtx) { - if (!SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { - u32 floorType = func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); +s32 EnBbfall_IsTouchingLava(EnBbfall* this, PlayState* play) { + if (!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + u32 floorType = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { return true; @@ -289,10 +288,10 @@ void EnBbfall_SetupWaitForPlayer(EnBbfall* this) { this->actionFunc = EnBbfall_WaitForPlayer; } -void EnBbfall_WaitForPlayer(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_WaitForPlayer(EnBbfall* this, PlayState* play) { if (this->timer != 0) { this->timer--; - } else if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && (this->actor.xyzDistToPlayerSq <= SQ(250.0f))) { + } else if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xyzDistToPlayerSq <= SQ(250.0f))) { EnBbfall_SetupEmerge(this); } } @@ -311,7 +310,7 @@ void EnBbfall_SetupEmerge(EnBbfall* this) { this->actionFunc = EnBbfall_Emerge; } -void EnBbfall_Emerge(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Emerge(EnBbfall* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.home.pos.y < this->actor.world.pos.y) { EnBbfall_SetupFly(this); @@ -329,13 +328,13 @@ void EnBbfall_SetupFly(EnBbfall* this) { this->actionFunc = EnBbfall_Fly; } -void EnBbfall_Fly(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Fly(EnBbfall* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->flameScaleY, 0.8f, 0.1f); Math_StepToF(&this->flameScaleX, 1.0f, 0.1f); EnBbfall_CheckForWall(this); if (this->actor.bgCheckFlags & 1) { - if (EnBbfall_IsTouchingLava(this, globalCtx)) { + if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); } else { // Bounce upwards off the ground @@ -357,7 +356,7 @@ void EnBbfall_SetupSinkIntoLava(EnBbfall* this) { this->actionFunc = EnBbfall_SinkIntoLava; } -void EnBbfall_SinkIntoLava(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_SinkIntoLava(EnBbfall* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.world.pos.y < (this->actor.floorHeight - 90.0f)) { this->timer = 10; @@ -382,12 +381,12 @@ void EnBbfall_SetupDown(EnBbfall* this) { this->actionFunc = EnBbfall_Down; } -void EnBbfall_Down(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Down(EnBbfall* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnBbfall_CheckForWall(this); if (this->actor.bgCheckFlags & 1) { - if (EnBbfall_IsTouchingLava(this, globalCtx)) { + if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); return; } @@ -408,7 +407,7 @@ void EnBbfall_Down(EnBbfall* this, GlobalContext* globalCtx) { } this->actor.bgCheckFlags &= ~1; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(this->actor.yawTowardsPlayer, 0x8000), 0xBB8); } @@ -422,7 +421,7 @@ void EnBbfall_Down(EnBbfall* this, GlobalContext* globalCtx) { } } -void EnBbfall_SetupDead(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_SetupDead(EnBbfall* this, PlayState* play) { Vec3f* bodyPartVelocity; Vec3f posDiff; f32 magnitude; @@ -432,8 +431,8 @@ void EnBbfall_SetupDead(EnBbfall* this, GlobalContext* globalCtx) { this->timer = 15; this->actor.shape.rot.x += 0x4E20; this->actor.speedXZ = 0.0f; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; this->bodyPartDrawStatus = BBFALL_BODY_PART_DRAW_STATUS_DEAD; @@ -455,7 +454,7 @@ void EnBbfall_SetupDead(EnBbfall* this, GlobalContext* globalCtx) { this->actionFunc = EnBbfall_Dead; } -void EnBbfall_Dead(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Dead(EnBbfall* this, PlayState* play) { s32 i; this->timer--; @@ -463,8 +462,8 @@ void EnBbfall_Dead(EnBbfall* this, GlobalContext* globalCtx) { if (this->timer == 0) { for (i = 0; i < ARRAY_COUNT(this->bodyPartsPos); i++) { - func_800B3030(globalCtx, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &this->bodyPartsPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->bodyPartsPos[i], 11, NA_SE_EN_EXTINCT); } Actor_MarkForDeath(&this->actor); @@ -499,10 +498,10 @@ void EnBbfall_SetupDamage(EnBbfall* this) { this->actionFunc = EnBbfall_Damage; } -void EnBbfall_Damage(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Damage(EnBbfall* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ < 0.1f)) { - if (EnBbfall_IsTouchingLava(this, globalCtx)) { + if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); } else { EnBbfall_SetupDown(this); @@ -520,20 +519,20 @@ void EnBbfall_SetupFrozen(EnBbfall* this) { this->actionFunc = EnBbfall_Frozen; } -void EnBbfall_Frozen(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_Frozen(EnBbfall* this, PlayState* play) { DECR(this->timer); if (this->timer == 0) { - EnBbfall_Thaw(this, globalCtx); + EnBbfall_Thaw(this, play); if (this->actor.colChkInfo.health == 0) { - EnBbfall_SetupDead(this, globalCtx); + EnBbfall_SetupDead(this, play); } else { EnBbfall_SetupDown(this); } } } -void EnBbfall_UpdateDamage(EnBbfall* this, GlobalContext* globalCtx) { +void EnBbfall_UpdateDamage(EnBbfall* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); @@ -545,10 +544,10 @@ void EnBbfall_UpdateDamage(EnBbfall* this, GlobalContext* globalCtx) { this->flameScaleY = 0.0f; this->flameScaleX = 0.0f; EnBbfall_DisableColliders(this); - EnBbfall_Thaw(this, globalCtx); + EnBbfall_Thaw(this, play); if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } if (this->actor.colChkInfo.damageEffect == EN_BBFALL_DMGEFF_ICE_ARROW) { @@ -560,7 +559,7 @@ void EnBbfall_UpdateDamage(EnBbfall* this, GlobalContext* globalCtx) { EnBbfall_SetupFrozen(this); } else if (this->actor.colChkInfo.health == 0) { - EnBbfall_SetupDead(this, globalCtx); + EnBbfall_SetupDead(this, play); } else { EnBbfall_SetupDamage(this); } @@ -569,8 +568,7 @@ void EnBbfall_UpdateDamage(EnBbfall* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.4f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.elements[0].info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements[0].info.bumper.hitPos.x, this->collider.elements[0].info.bumper.hitPos.y, this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); } @@ -588,7 +586,7 @@ void EnBbfall_UpdateDamage(EnBbfall* this, GlobalContext* globalCtx) { } } -void EnBbfall_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBbfall_Update(Actor* thisx, PlayState* play) { EnBbfall* this = THIS; Sphere16* sphere; Vec3f diff; @@ -596,12 +594,12 @@ void EnBbfall_Update(Actor* thisx, GlobalContext* globalCtx) { f32 scale; s32 pad[2]; - EnBbfall_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBbfall_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnBbfall_Dead) { Actor_MoveWithGravity(&this->actor); if (this->isBgCheckCollisionEnabled) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 20.0f, 7); } for (i = ARRAY_COUNT(this->flamePos) - 1; i >= 2; i--) { @@ -631,15 +629,15 @@ void EnBbfall_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_ON) { this->actor.flags |= ACTOR_FLAG_1000000; - 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->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -654,8 +652,7 @@ void EnBbfall_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnBbfall_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBbfall_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBbfall* this = THIS; if (this->bodyPartDrawStatus == BBFALL_BODY_PART_DRAW_STATUS_BROKEN) { @@ -666,7 +663,7 @@ s32 EnBbfall_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnBbfall_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBbfall_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnBbfall* this = THIS; MtxF* currentMatrixState; @@ -692,24 +689,23 @@ void EnBbfall_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } else { if (sLimbIndexToBodyPartsIndex[limbIndex] != -1) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); currentMatrixState = Matrix_GetCurrent(); currentMatrixState->mf[3][0] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].x; currentMatrixState->mf[3][1] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].y; currentMatrixState->mf[3][2] = this->bodyPartsPos[sLimbIndexToBodyPartsIndex[limbIndex]].z; Matrix_RotateZS(thisx->world.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->limbDList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnBbfall_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBbfall_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBbfall* this = THIS; MtxF* currentMatrixState; Gfx* gfx; @@ -717,18 +713,18 @@ void EnBbfall_Draw(Actor* thisx, GlobalContext* globalCtx2) { Vec3f* pos; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); POLY_OPA_DISP = &gfx[1]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBbfall_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBbfall_OverrideLimbDraw, EnBbfall_PostLimbDraw, &this->actor); if (this->flameOpacity > 0) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_RotateYS( - ((Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) - this->actor.shape.rot.y) + 0x8000), + ((Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamera]) - this->actor.shape.rot.y) + 0x8000), MTXMODE_APPLY); Matrix_Scale(this->flameScaleX, this->flameScaleY, 1.0f, MTXMODE_APPLY); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -739,14 +735,13 @@ void EnBbfall_Draw(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(this->flamePos); i++, pos++) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, - ((globalCtx->gameplayFrames + (i * 10)) * (-20 + i * 2)) & 0x1FF, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, + ((play->gameplayFrames + (i * 10)) * (-20 + i * 2)) & 0x1FF, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, opacity); currentMatrixState->mf[3][0] = pos->x; currentMatrixState->mf[3][1] = pos->y; currentMatrixState->mf[3][2] = pos->z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); opacity -= 35; @@ -758,9 +753,9 @@ void EnBbfall_Draw(Actor* thisx, GlobalContext* globalCtx2) { } } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h index 411c4b17f3..e835015e19 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.h @@ -6,7 +6,7 @@ struct EnBbfall; -typedef void (*EnBbfallActionFunc)(struct EnBbfall*, GlobalContext*); +typedef void (*EnBbfallActionFunc)(struct EnBbfall*, PlayState*); typedef struct EnBbfall { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index ecb64cb910..f53b58bf64 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -10,13 +10,13 @@ #define THIS ((EnBee*)thisx) -void EnBee_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBee_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBee_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBee_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBee_Init(Actor* thisx, PlayState* play); +void EnBee_Destroy(Actor* thisx, PlayState* play); +void EnBee_Update(Actor* thisx, PlayState* play); +void EnBee_Draw(Actor* thisx, PlayState* play); -void func_80B5A9E8(EnBee* this, GlobalContext* globalCtx); -void func_80B5AC3C(EnBee* this, GlobalContext* globalCtx); +void func_80B5A9E8(EnBee* this, PlayState* play); +void func_80B5AC3C(EnBee* this, PlayState* play); #if 0 const ActorInit En_Bee_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.h b/src/overlays/actors/ovl_En_Bee/z_en_bee.h index 8a5be7de3d..3cf0dbd511 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.h +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.h @@ -5,7 +5,7 @@ struct EnBee; -typedef void (*EnBeeActionFunc)(struct EnBee*, GlobalContext*); +typedef void (*EnBeeActionFunc)(struct EnBee*, PlayState*); typedef struct EnBee { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.c b/src/overlays/actors/ovl_En_Bh/z_en_bh.c index ff6cb047d5..01284d2bf9 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.c +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.c @@ -10,10 +10,10 @@ #define THIS ((EnBh*)thisx) -void EnBh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBh_Init(Actor* thisx, PlayState* play); +void EnBh_Destroy(Actor* thisx, PlayState* play); +void EnBh_Update(Actor* thisx, PlayState* play); +void EnBh_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Bh_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.h b/src/overlays/actors/ovl_En_Bh/z_en_bh.h index 54723bfa7b..11c475e3ff 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.h +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.h @@ -5,7 +5,7 @@ struct EnBh; -typedef void (*EnBhActionFunc)(struct EnBh*, GlobalContext*); +typedef void (*EnBhActionFunc)(struct EnBh*, PlayState*); typedef struct EnBh { /* 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 e25d1e02a1..e14da9e04c 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -11,25 +11,25 @@ #define THIS ((EnBigokuta*)thisx) -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_80AC2B4C(GlobalContext* globalCtx, EnBigokuta* this); +void func_80AC2B4C(PlayState* play, EnBigokuta* this); void EnBigokuta_SetupIdle(EnBigokuta* this); -void EnBigokuta_Idle(EnBigokuta* this, GlobalContext* globalCtx); -void EnBigokuta_SetupRise(EnBigokuta* this, GlobalContext* globalCtx); -void EnBigokuta_RiseOutOfWater(EnBigokuta* this, GlobalContext* globalCtx); +void EnBigokuta_Idle(EnBigokuta* this, PlayState* play); +void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play); +void EnBigokuta_RiseOutOfWater(EnBigokuta* this, PlayState* play); void EnBigokuta_SetupIdleAboveWater(EnBigokuta* this); -void EnBigokuta_IdleAboveWater(EnBigokuta* this, GlobalContext* globalCtx); -void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, GlobalContext* globalCtx); -void EnBigokuta_SuckInPlayer(EnBigokuta* this, GlobalContext* globalCtx); +void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play); +void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play); +void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play); void EnBigokuta_SetupHoldPlayer(EnBigokuta* this); -void EnBigokuta_HoldPlayer(EnBigokuta* this, GlobalContext* globalCtx); -void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, GlobalContext* globalCtx); +void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play); +void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play); void EnBigokuta_SetupDeathEffects(EnBigokuta* this); -void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx); +void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play); const ActorInit En_Bigokuta_InitVars = { ACTOR_EN_BIGOKUTA, @@ -93,20 +93,20 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 33, ICHAIN_STOP), }; -void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBigOctoSkel, &gBigOctoIdleAnim, this->jointTable, - this->morphTable, BIGOKUTA_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gBigOctoSkel, &gBigOctoIdleAnim, this->jointTable, this->morphTable, + BIGOKUTA_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->shellCollider, &this->actor, &sShellCylinderInit); - Collider_InitAndSetCylinder(globalCtx, &this->bodyCollider, &this->actor, &sBodyCylinderInit); + Collider_InitAndSetCylinder(play, &this->shellCollider, &this->actor, &sShellCylinderInit); + Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); if (gSaveContext.save.weekEventReg[20] & 2 || - ((this->actor.params != 0xFF) && Flags_GetSwitch(globalCtx, this->actor.params))) { + ((this->actor.params != 0xFF) && Flags_GetSwitch(play, this->actor.params))) { Actor_MarkForDeath(&this->actor); } else { this->actor.world.pos.y -= 99.0f; @@ -120,19 +120,19 @@ void EnBigokuta_Init(Actor* thisx, GlobalContext* globalCtx) { this->unkFunc = func_80AC2B4C; // set but never called } -void EnBigokuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->shellCollider); - Collider_DestroyCylinder(globalCtx, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->shellCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); } -void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, GlobalContext* globalCtx, Vec3f* at, Vec3f* eye) { +void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* at, Vec3f* eye) { s16 angle; ActorCutscene_Start(this->actor.cutscene, &this->actor); this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - Play_CameraSetAtEye(globalCtx, this->camId, at, eye); + Play_CameraSetAtEye(play, this->camId, at, eye); angle = BINANG_SUB(Actor_YawToPoint(&this->actor, eye), this->actor.home.rot.y); if (angle > 0) { @@ -146,27 +146,27 @@ void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, GlobalContext* globalCtx, this->camEye.z = (Math_CosS(angle) * 250.0f) + this->camAt.z; } -void EnBigokuta_MoveCamera(EnBigokuta* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); +void EnBigokuta_MoveCamera(EnBigokuta* this, PlayState* play) { + Camera* camera = Play_GetCamera(play, this->camId); Math_Vec3f_StepTo(&camera->eye, &this->camEye, 20.0f); Math_Vec3f_StepTo(&camera->at, &this->camAt, 20.0f); - Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye); + Play_CameraSetAtEye(play, this->camId, &camera->at, &camera->eye); } -void EnBigokuta_ResetCamera(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { Camera* camera; if (this->camId != 0) { - camera = Play_GetCamera(globalCtx, this->camId); - Play_CameraSetAtEye(globalCtx, 0, &camera->at, &camera->eye); + camera = Play_GetCamera(play, this->camId); + Play_CameraSetAtEye(play, 0, &camera->at, &camera->eye); this->camId = 0; ActorCutscene_Stop(this->actor.cutscene); } } -void EnBigokuta_ShootPlayer(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigokuta_ShootPlayer(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (&this->actor == player->actor.parent) { player->actor.parent = NULL; @@ -174,22 +174,22 @@ void EnBigokuta_ShootPlayer(EnBigokuta* this, GlobalContext* globalCtx) { player->actor.velocity.y = 0.0f; player->actor.world.pos.x += 20.0f * Math_SinS(this->actor.home.rot.y); player->actor.world.pos.z += 20.0f * Math_CosS(this->actor.home.rot.y); - func_800B8D50(globalCtx, &this->actor, 10.0f, this->actor.home.rot.y, 10.0f, 4); + func_800B8D50(play, &this->actor, 10.0f, this->actor.home.rot.y, 10.0f, 4); } - EnBigokuta_ResetCamera(this, globalCtx); + EnBigokuta_ResetCamera(this, play); } -void func_80AC2B4C(GlobalContext* globalCtx, EnBigokuta* this) { - func_8013A530(globalCtx, &this->actor, 3, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +void func_80AC2B4C(PlayState* play, EnBigokuta* this) { + func_8013A530(play, &this->actor, 3, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); } -s32 EnBigokuta_IsInWater(EnBigokuta* this, GlobalContext* globalCtx) { +s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { WaterBox* box; s32 bgId; - this->actor.floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, - &this->actor, &this->actor.world.pos); - if (!WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + this->actor.floorHeight = + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); + if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->actor.home.pos.y, &box) || (this->actor.home.pos.y <= this->actor.floorHeight)) { return false; @@ -198,13 +198,13 @@ s32 EnBigokuta_IsInWater(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_SpawnRipple(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_SpawnRipple(EnBigokuta* this, PlayState* play) { Vec3f ripplePos; ripplePos.x = this->actor.world.pos.x; ripplePos.y = this->actor.home.pos.y; ripplePos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 1000, 1400, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 1000, 1400, 0); } void EnBigokuta_SetupIdle(EnBigokuta* this) { @@ -212,18 +212,18 @@ void EnBigokuta_SetupIdle(EnBigokuta* this) { this->actionFunc = EnBigokuta_Idle; } -void EnBigokuta_Idle(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigokuta_Idle(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 99.0f, 2.5f); Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); if ((this->actor.xzDistToPlayer < 300.0f) && ((player->actor.world.pos.y - this->actor.home.pos.y) < 100.0f)) { - EnBigokuta_SetupRise(this, globalCtx); + EnBigokuta_SetupRise(this, play); } } -void EnBigokuta_SetupRise(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play) { Vec3f splashPos; s32 i; s16 angle = 0; @@ -233,14 +233,14 @@ void EnBigokuta_SetupRise(EnBigokuta* this, GlobalContext* globalCtx) { for (i = 0; i < 8; i++) { splashPos.x = Math_SinS(angle) * 70.0f + this->actor.world.pos.x; splashPos.z = Math_CosS(angle) * 70.0f + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, 0, Rand_S16Offset(1000, 200)); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, Rand_S16Offset(1000, 200)); angle = BINANG_ADD(angle, 0x2000); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_LAND); this->actionFunc = EnBigokuta_RiseOutOfWater; } -void EnBigokuta_RiseOutOfWater(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_RiseOutOfWater(EnBigokuta* this, PlayState* play) { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 15.0f); if (SkelAnime_Update(&this->skelAnime)) { EnBigokuta_SetupIdleAboveWater(this); @@ -252,7 +252,7 @@ void EnBigokuta_SetupIdleAboveWater(EnBigokuta* this) { this->actionFunc = EnBigokuta_IdleAboveWater; } -void EnBigokuta_IdleAboveWater(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 2.5f); Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); @@ -260,27 +260,27 @@ void EnBigokuta_IdleAboveWater(EnBigokuta* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer > 400.0f) || (this->actor.playerHeightRel > 200.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_SINK); EnBigokuta_SetupIdle(this); - } else if ((this->actor.xzDistToPlayer < 200.0f) && globalCtx->grabPlayer(globalCtx, GET_PLAYER(globalCtx))) { - EnBigokuta_SetupSuckInPlayer(this, globalCtx); + } else if ((this->actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { + EnBigokuta_SetupSuckInPlayer(this, play); } } -void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { if (this->actor.cutscene != -1) { if (this->camId != 0) { - EnBigokuta_MoveCamera(this, globalCtx); + EnBigokuta_MoveCamera(this, play); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - Camera* camera = Play_GetCamera(globalCtx, 0); + Camera* camera = Play_GetCamera(play, 0); - EnBigokuta_SetupCutsceneCamera(this, globalCtx, &camera->at, &camera->eye); + EnBigokuta_SetupCutsceneCamera(this, play, &camera->at, &camera->eye); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } } -void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.parent = &this->actor; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -298,10 +298,10 @@ void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, GlobalContext* globalCtx) { this->actionFunc = EnBigokuta_SuckInPlayer; } -void EnBigokuta_SuckInPlayer(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); - EnBigokuta_UpdateOrSetupCam(this, globalCtx); + EnBigokuta_UpdateOrSetupCam(this, play); SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 49.5f, 10.0f); @@ -336,16 +336,16 @@ void EnBigokuta_SetupHoldPlayer(EnBigokuta* this) { this->actionFunc = EnBigokuta_HoldPlayer; } -void EnBigokuta_HoldPlayer(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->timer--; if (this->timer >= 0) { - EnBigokuta_UpdateOrSetupCam(this, globalCtx); + EnBigokuta_UpdateOrSetupCam(this, play); Math_Vec3f_Copy(&player->actor.world.pos, &this->playerHoldPos); if (this->timer == 0) { - EnBigokuta_ShootPlayer(this, globalCtx); + EnBigokuta_ShootPlayer(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); } } else if (this->timer == -24) { @@ -360,7 +360,7 @@ void EnBigokuta_SetupDeathCutscene(EnBigokuta* this) { this->actionFunc = EnBigokuta_PlayDeathCutscene; } -void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { Player* player; this->actor.colorFilterTimer = Animation_GetLastFrame(&gBigOctoDeathAnim); @@ -370,16 +370,16 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); EnBigokuta_SetupDeathEffects(this); } } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(globalCtx, &this->actor, 7); + func_800B724C(play, &this->actor, 7); } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->stateFlags1 |= 0x20; } @@ -401,7 +401,7 @@ void EnBigokuta_SetupDeathEffects(EnBigokuta* this) { this->actionFunc = EnBigokuta_PlayDeathEffects; } -void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { static Vec3f D_80AC45A4 = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 D_80AC45B0 = { 255, 255, 255, 255 }; static Color_RGBA8 D_80AC45B4 = { 100, 255, 255, 255 }; @@ -420,7 +420,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx) { dustPos.y = this->actor.world.pos.y + 150.0f; dustPos.z = this->actor.world.pos.z; - func_800B0DE0(globalCtx, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_80AC45B0, &D_80AC45B4, 1200, 20); + func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_80AC45B0, &D_80AC45B4, 1200, 20); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } } else { @@ -431,7 +431,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx) { Vec3f bubbleVel; Vec3f bubblePos; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); bubblePos.y = this->actor.world.pos.y; for (i = 0; i < 20; i++) { @@ -441,21 +441,21 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx) { bubblePos.x = this->actor.world.pos.x + (2.0f * bubbleVel.x); bubblePos.z = this->actor.world.pos.z + (2.0f * bubbleVel.z); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0, + EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0, &D_80AC45B8, Rand_S16Offset(150, 50), 25, 0); } if (this->actor.params != 0xFF) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); } ActorCutscene_Stop(this->cutscene); Actor_MarkForDeath(&this->actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(globalCtx, &this->actor, 6); + func_800B724C(play, &this->actor, 6); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags1 &= ~0x20; } @@ -470,8 +470,8 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, GlobalContext* globalCtx) { } } -s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, GlobalContext* globalCtx) { - this->actor.child = SubS_FindActor(globalCtx, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); +s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { + this->actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); if ((this->actor.child != NULL) && (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < 250.0f)) { return true; @@ -480,12 +480,12 @@ s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, GlobalContext* globalCtx) { } } -void EnBigokuta_CheckOneHitKill(EnBigokuta* this, GlobalContext* globalCtx) { +void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { if ((this->bodyCollider.base.acFlags & AC_ON) && ((this->bodyCollider.base.acFlags & AC_HIT) || - ((globalCtx->sceneNum == SCENE_20SICHITAI || globalCtx->sceneNum == SCENE_20SICHITAI2) && - EnBigokuta_IsNearSwampBoat(this, globalCtx)))) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + ((play->sceneNum == SCENE_20SICHITAI || play->sceneNum == SCENE_20SICHITAI2) && + EnBigokuta_IsNearSwampBoat(this, play)))) { + Enemy_StartFinishingBlow(play, &this->actor); if (this->bodyCollider.base.acFlags & AC_HIT) { if (this->bodyCollider.info.acHitInfo->toucher.dmgFlags & 0x1000) { // Ice Arrow @@ -497,34 +497,34 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, GlobalContext* globalCtx) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 1.2f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->bodyCollider.info.bumper.hitPos.x, this->bodyCollider.info.bumper.hitPos.y, - this->bodyCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->bodyCollider.info.bumper.hitPos.x, + this->bodyCollider.info.bumper.hitPos.y, this->bodyCollider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); } } this->bodyCollider.base.acFlags &= ~AC_HIT; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); - EnBigokuta_ShootPlayer(this, globalCtx); + EnBigokuta_ShootPlayer(this, play); EnBigokuta_SetupDeathCutscene(this); } } -void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Update(Actor* thisx, PlayState* play) { s32 pad; EnBigokuta* this = THIS; - if (!EnBigokuta_IsInWater(this, globalCtx)) { + if (!EnBigokuta_IsInWater(this, play)) { Actor_MarkForDeath(&this->actor); return; } - if (globalCtx->gameplayFrames % 7 == 0) { - EnBigokuta_SpawnRipple(this, globalCtx); + if (play->gameplayFrames % 7 == 0) { + EnBigokuta_SpawnRipple(this, play); } - EnBigokuta_CheckOneHitKill(this, globalCtx); - this->actionFunc(this, globalCtx); + EnBigokuta_CheckOneHitKill(this, play); + this->actionFunc(this, play); if ((this->bodyCollider.base.acFlags & AC_ON)) { this->shellCollider.dim.pos.x = Math_SinS(this->actor.shape.rot.y) * -20.0f + this->actor.world.pos.x; @@ -535,9 +535,9 @@ void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx) { this->bodyCollider.dim.pos.y = this->shellCollider.dim.pos.y; this->bodyCollider.dim.pos.z = this->shellCollider.dim.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->shellCollider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->shellCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shellCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->shellCollider.base); Actor_SetFocus(&this->actor, 82.5f); } @@ -552,8 +552,8 @@ void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { if (limbIndex == BIGOKUTA_LIMB_HEAD) { EnBigokuta* this = THIS; s32 envColor; @@ -621,8 +621,7 @@ s32 EnBigokuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnBigokuta_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnBigokuta_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static s8 D_80AC45BC[] = { -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, 8, 4, -1, 5, -1, -1, -1, -1, 6, 7, }; @@ -647,32 +646,32 @@ void EnBigokuta_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnBigokuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBigokuta_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBigokuta* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actionFunc != EnBigokuta_PlayDeathEffects) || (this->timer != 0)) { - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); gDPSetEnvColor(&gfx[1], 255, 255, 255, 255); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnBigokuta_OverrideLimbDraw, - EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnBigokuta_OverrideLimbDraw, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); } else { - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); gfx = POLY_XLU_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); gDPSetEnvColor(&gfx[1], 0, 0, 0, (this->actor.scale.y * 7727.273f)); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, NULL, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 0f07c4d7f1..2838727631 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -5,8 +5,8 @@ struct EnBigokuta; -typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, GlobalContext*); -typedef void (*EnBigokutaUnkFunc)(GlobalContext*, struct EnBigokuta*); +typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); +typedef void (*EnBigokutaUnkFunc)(PlayState*, struct EnBigokuta*); typedef enum { /* 00 */ BIGOKUTA_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 2fbd609276..42eb1c2950 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -10,25 +10,25 @@ #define THIS ((EnBigpamet*)thisx) -void EnBigpamet_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBigpamet_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBigpamet_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBigpamet_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBigpamet_Init(Actor* thisx, PlayState* play); +void EnBigpamet_Destroy(Actor* thisx, PlayState* play); +void EnBigpamet_Update(Actor* thisx, PlayState* play); +void EnBigpamet_Draw(Actor* thisx, PlayState* play); -void func_80A281DC(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A282C8(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A283A0(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A2844C(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A2855C(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A2866C(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28708(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A287E8(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A289C8(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28A98(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28D0C(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28DC0(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28E98(EnBigpamet* this, GlobalContext* globalCtx); -void func_80A28EE8(EnBigpamet* this, GlobalContext* globalCtx); +void func_80A281DC(EnBigpamet* this, PlayState* play); +void func_80A282C8(EnBigpamet* this, PlayState* play); +void func_80A283A0(EnBigpamet* this, PlayState* play); +void func_80A2844C(EnBigpamet* this, PlayState* play); +void func_80A2855C(EnBigpamet* this, PlayState* play); +void func_80A2866C(EnBigpamet* this, PlayState* play); +void func_80A28708(EnBigpamet* this, PlayState* play); +void func_80A287E8(EnBigpamet* this, PlayState* play); +void func_80A289C8(EnBigpamet* this, PlayState* play); +void func_80A28A98(EnBigpamet* this, PlayState* play); +void func_80A28D0C(EnBigpamet* this, PlayState* play); +void func_80A28DC0(EnBigpamet* this, PlayState* play); +void func_80A28E98(EnBigpamet* this, PlayState* play); +void func_80A28EE8(EnBigpamet* this, PlayState* play); #if 0 const ActorInit En_Bigpamet_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h index a37d331db1..e845aad908 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h @@ -5,7 +5,7 @@ struct EnBigpamet; -typedef void (*EnBigpametActionFunc)(struct EnBigpamet*, GlobalContext*); +typedef void (*EnBigpametActionFunc)(struct EnBigpamet*, PlayState*); typedef struct EnBigpamet { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 4c4261a4c4..087328c4d2 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -12,10 +12,10 @@ #define THIS ((EnBigpo*)thisx) -void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_UpdateFire(Actor* thisx, GlobalContext* globalCtx); +void EnBigpo_Init(Actor* thisx, PlayState* play); +void EnBigpo_Destroy(Actor* thisx, PlayState* play); +void EnBigpo_Update(Actor* thisx, PlayState* play); +void EnBigpo_UpdateFire(Actor* thisx, PlayState* play); void EnBigpo_InitWellBigpo(EnBigpo* this); void EnBigpo_HitStun(EnBigpo* this); @@ -25,62 +25,62 @@ void EnBigpo_InitHiddenFire(EnBigpo* this); void EnBigpo_SetupFireRevealed(EnBigpo* this); void EnBigpo_SetupSpawnCutscene(EnBigpo* this); -void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_SpawnCutsceneStage2(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, PlayState* play); +void EnBigpo_SpawnCutsceneStage2(EnBigpo* this, PlayState* play); void EnBigpo_SpawnCutsceneStage3(EnBigpo* this); -void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, PlayState* play); void EnBigpo_SpawnCutsceneStage5(EnBigpo* this); -void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, PlayState* play); void EnBigpo_SpawnCutsceneStage7(EnBigpo* this); -void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play); -s32 EnBigpo_ApplyDamage(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_WellWaitForProximity(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_WaitCutsceneQueue(EnBigpo* this, GlobalContext* globalCtx); +s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play); +void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, PlayState* play); +void EnBigpo_WellWaitForProximity(EnBigpo* this, PlayState* play); +void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play); void EnBigpo_SetupWarpOut(EnBigpo* this); -void EnBigpo_WarpingOut(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_SetupWarpIn(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_WarpingIn(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_WarpingOut(EnBigpo* this, PlayState* play); +void EnBigpo_SetupWarpIn(EnBigpo* this, PlayState* play); +void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play); void EnBigpo_SetupIdleFlying(EnBigpo* this); -void EnBigpo_IdleFlying(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play); void EnBigpo_SetupSpinUp(EnBigpo* this); -void EnBigpo_SpinningUp(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpinningUp(EnBigpo* this, PlayState* play); void EnBigpo_SetupSpinAttack(EnBigpo* this); -void EnBigpo_SpinAttack(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpinAttack(EnBigpo* this, PlayState* play); void EnBigpo_SetupSpinDown(EnBigpo* this); -void EnBigpo_SpinningDown(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_CheckHealth(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_SpinningDown(EnBigpo* this, PlayState* play); +void EnBigpo_CheckHealth(EnBigpo* this, PlayState* play); void EnBigpo_SetupDeath(EnBigpo* this); -void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_SetupLanternDrop(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_LanternFalling(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_BurnAwayDeath(EnBigpo* this, PlayState* play); +void EnBigpo_SetupLanternDrop(EnBigpo* this, PlayState* play); +void EnBigpo_LanternFalling(EnBigpo* this, PlayState* play); void EnBigpo_SpawnScoopSoul(EnBigpo* this); -void EnBigpo_ScoopSoulAppearing(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_ScoopSoulAppearing(EnBigpo* this, PlayState* play); void EnBigpo_SetupScoopSoulIdle(EnBigpo* this); -void EnBigpo_ScoopSoulIdle(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play); void EnBigpo_SetupScoopSoulLeaving(EnBigpo* this); -void EnBigpo_ScoopSoulFadingAway(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_Die(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_FireCounting(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_ScoopSoulFadingAway(EnBigpo* this, PlayState* play); +void EnBigpo_Die(EnBigpo* this, PlayState* play); +void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play); +void EnBigpo_FireCounting(EnBigpo* this, PlayState* play); +void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, PlayState* play); void EnBigpo_SetupFlameCircleCutscene(EnBigpo* this); -void EnBigpo_FlameCircleCutscene(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_FlameCircleCutscene(EnBigpo* this, PlayState* play); void EnBigpo_UpdateColor(EnBigpo* this); void EnBigpo_FlickerLanternLight(EnBigpo* this); void EnBigpo_SetupRevealedFireIdle(EnBigpo* this); -void EnBigpo_RevealedFireIdle(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_DoNothing(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_WaitingForDampe(EnBigpo* this, GlobalContext* globalCtx); -void EnBigpo_RevealedFireGrowing(EnBigpo* this, GlobalContext* globalCtx); +void EnBigpo_RevealedFireIdle(EnBigpo* this, PlayState* play); +void EnBigpo_DoNothing(EnBigpo* this, PlayState* play); +void EnBigpo_WaitingForDampe(EnBigpo* this, PlayState* play); +void EnBigpo_RevealedFireGrowing(EnBigpo* this, PlayState* play); // draw funcs -void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx); -void EnBigpo_RevealedFire(Actor* thisx, GlobalContext* globalCtx); +void EnBigpo_DrawMainBigpo(Actor* thisx, PlayState* play); +void EnBigpo_DrawScoopSoul(Actor* thisx, PlayState* play); +void EnBigpo_DrawLantern(Actor* thisx, PlayState* play); +void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play); +void EnBigpo_RevealedFire(Actor* thisx, PlayState* play); extern const ActorInit En_Bigpo_InitVars; @@ -173,8 +173,8 @@ static Vec3f D_80B65084[] = { { -1000.0f, 1500.0f, 2000.0f }, }; -void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBigpo_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBigpo* this = THIS; EnBigpoFireEffect* firesPtr; s32 i; @@ -185,7 +185,7 @@ void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->switchFlags = GET_BIGPO_SWITCHFLAGS(thisx); thisx->params &= 0xFF; if (thisx->params == ENBIGPO_POSSIBLEFIRE) { - if (Flags_GetSwitch(globalCtx, this->switchFlags)) { + if (Flags_GetSwitch(play, this->switchFlags)) { Actor_MarkForDeath(&this->actor); } else { thisx->update = Actor_Noop; @@ -194,14 +194,14 @@ void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx2) { return; } - SkelAnime_Init(globalCtx, &this->skelAnime, &gBigpoSkeleton, &gBigpoFloatAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBigpoSkeleton, &gBigpoFloatAnim, this->jointTable, this->morphTable, ENBIGPO_LIMBCOUNT); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); for (i = 0; i < ARRAY_COUNT(this->fires); i++) { firesPtr = &this->fires[i]; - firesPtr->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &firesPtr->info); + firesPtr->light = LightContext_InsertLight(play, &play->lightCtx, &firesPtr->info); Lights_PointNoGlowSetInfo(&firesPtr->info, thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, 255, 255, 255, 0); @@ -215,7 +215,7 @@ void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx2) { this->mainColor.b = 210; this->mainColor.a = 0; // fully invisible - if ((this->switchFlags != 0xFF) && (Flags_GetSwitch(globalCtx, this->switchFlags))) { + if ((this->switchFlags != 0xFF) && (Flags_GetSwitch(play, this->switchFlags))) { Actor_MarkForDeath(&this->actor); } @@ -228,8 +228,8 @@ void EnBigpo_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBigpo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBigpo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBigpo* this = THIS; s32 fireCount; @@ -238,9 +238,9 @@ void EnBigpo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { // if NOT a fire type, *ENBIGPO_REGULAR and ENBIGPO_SUMMONED (combat types only) if (1) {} for (fireCount = 0; fireCount < ARRAY_COUNT(this->fires); fireCount++) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->fires[fireCount].light); + LightContext_RemoveLight(play, &play->lightCtx, this->fires[fireCount].light); } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -268,17 +268,17 @@ void EnBigpo_UpdateSpin(EnBigpo* this) { /* * Lowers the position/eye of the camera during the Big Poe spawn cutscene */ -void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, GlobalContext* globalContext) { +void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, PlayState* play) { Camera* subCam; if (this->cutsceneSubCamId != CAM_ID_MAIN) { - subCam = Play_GetCamera(globalContext, this->cutsceneSubCamId); + subCam = Play_GetCamera(play, this->cutsceneSubCamId); subCam->eye.y -= this->actor.velocity.y; if (this->actor.velocity.y > 0.0f) { subCam->eye.x -= 1.5f * Math_SinS(this->actor.yawTowardsPlayer); subCam->eye.z -= 1.5f * Math_CosS(this->actor.yawTowardsPlayer); } - Play_CameraSetAtEye(globalContext, this->cutsceneSubCamId, &this->actor.focus.pos, &subCam->eye); + Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCam->eye); } } @@ -288,7 +288,7 @@ void EnBigpo_InitWellBigpo(EnBigpo* this) { this->fireRadius = 200.0f; } -void EnBigpo_WellWaitForProximity(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_WellWaitForProximity(EnBigpo* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { EnBigpo_SetupSpawnCutscene(this); } @@ -299,15 +299,15 @@ void EnBigpo_SetupSpawnCutscene(EnBigpo* this) { this->actionFunc = EnBigpo_WaitCutsceneQueue; } -void EnBigpo_WaitCutsceneQueue(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); - func_800B724C(globalCtx, &this->actor, 7); + func_800B724C(play, &this->actor, 7); this->cutsceneSubCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); if (this->actor.params == ENBIGPO_REGULAR) { // and SUMMONED, got switched earlier - EnBigpo_SpawnCutsceneStage1(this, globalCtx); + EnBigpo_SpawnCutsceneStage1(this, play); } else { // ENBIGPO_REVEALEDFIRE - EnBigpo_SetupFlameCirclePositions(this, globalCtx); + EnBigpo_SetupFlameCirclePositions(this, play); } } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -317,7 +317,7 @@ void EnBigpo_WaitCutsceneQueue(EnBigpo* this, GlobalContext* globalCtx) { /* * stage 1: fires are set to draw, size set to tiny, camera pointed */ -void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, PlayState* play) { s32 i; this->actor.draw = EnBigpo_DrawCircleFlames; @@ -338,7 +338,7 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, GlobalContext* globalCtx) { subCamEye.x = ((this->actor.world.pos.x - this->fires[0].pos.x) * 1.8f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = ((this->actor.world.pos.z - this->fires[0].pos.z) * 1.8f) + this->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_SpawnCutsceneStage2; } @@ -346,7 +346,7 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, GlobalContext* globalCtx) { /* * stage 2: fires are growing to full size */ -void EnBigpo_SpawnCutsceneStage2(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpawnCutsceneStage2(EnBigpo* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { EnBigpo_SpawnCutsceneStage3(this); } @@ -367,7 +367,7 @@ void EnBigpo_SpawnCutsceneStage3(EnBigpo* this) { /* * stage 4: fires are circling inward toward each other */ -void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, PlayState* play) { s32 i; if (Math_StepToF(&this->fireRadius, 30.0f, 5.0f)) { @@ -383,7 +383,7 @@ void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, GlobalContext* globalCtx) { } this->actor.world.pos.y += this->actor.velocity.y; - EnBigpo_LowerCutsceneSubCamera(this, globalCtx); + EnBigpo_LowerCutsceneSubCamera(this, play); if (this->actor.velocity.y >= 4.0f) { EnBigpo_SpawnCutsceneStage5(this); } @@ -405,7 +405,7 @@ void EnBigpo_SpawnCutsceneStage5(EnBigpo* this) { * stage 6: big poe becoming more visible in the flames * and flames dissapearing */ -void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, PlayState* play) { s32 i; s32 alphaPlus; // color alpha + 10 @@ -426,7 +426,7 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, GlobalContext* globalCtx) { this->fires[i].pos.y += this->actor.velocity.y; } - EnBigpo_LowerCutsceneSubCamera(this, globalCtx); + EnBigpo_LowerCutsceneSubCamera(this, play); if (alphaPlus >= 255) { this->mainColor.a = 255; // fully visible EnBigpo_SpawnCutsceneStage7(this); @@ -452,18 +452,18 @@ void EnBigpo_SpawnCutsceneStage7(EnBigpo* this) { * also sets the main camera to align with the subCamera * and switches back from the subCamera back to the main camera */ -void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { Actor* dampe; Camera* subCam; SkelAnime_Update(&this->skelAnime); this->idleTimer--; if (this->idleTimer == 0) { - subCam = Play_GetCamera(globalCtx, this->cutsceneSubCamId); - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + subCam = Play_GetCamera(play, this->cutsceneSubCamId); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->cutsceneSubCamId = CAM_ID_MAIN; if (this->actor.params == ENBIGPO_SUMMONED) { - dampe = SubS_FindActor(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_TK); + dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); if (dampe != NULL) { // if dampe exists, switch to viewing his running away cutscene dampe->params = this->actor.cutscene; @@ -473,7 +473,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx) { } else { // ENBIGPO_REGULAR ActorCutscene_Stop(this->actor.cutscene); } - func_800B724C(globalCtx, &this->actor, 6); + func_800B724C(play, &this->actor, 6); EnBigpo_SetupIdleFlying(this); // setup idle flying } } @@ -489,7 +489,7 @@ void EnBigpo_SetupWarpOut(EnBigpo* this) { this->actionFunc = EnBigpo_WarpingOut; } -void EnBigpo_WarpingOut(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_WarpingOut(EnBigpo* this, PlayState* play) { DECR(this->idleTimer); this->actor.shape.rot.y += this->rotVelocity; if (this->idleTimer < 16) { @@ -498,12 +498,12 @@ void EnBigpo_WarpingOut(EnBigpo* this, GlobalContext* globalCtx) { this->mainColor.a = this->idleTimer * (255.0f / 32.0f); if (this->idleTimer == 0) { this->mainColor.a = 0; // fully invisible - EnBigpo_SetupWarpIn(this, globalCtx); + EnBigpo_SetupWarpIn(this, play); } } -void EnBigpo_SetupWarpIn(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigpo_SetupWarpIn(EnBigpo* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distance = CLAMP_MIN(this->actor.xzDistToPlayer, 200.0f); s16 randomYaw = ((s32)Rand_Next() >> 0x14) + this->actor.yawTowardsPlayer; @@ -515,7 +515,7 @@ void EnBigpo_SetupWarpIn(EnBigpo* this, GlobalContext* globalCtx) { this->actionFunc = EnBigpo_WarpingIn; } -void EnBigpo_WarpingIn(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play) { this->idleTimer++; this->actor.shape.rot.y -= this->rotVelocity; if (this->idleTimer >= 16) { @@ -548,8 +548,8 @@ void EnBigpo_SetupIdleFlying(EnBigpo* this) { this->actionFunc = EnBigpo_IdleFlying; } -void EnBigpo_IdleFlying(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); DECR(this->idleTimer); @@ -585,7 +585,7 @@ void EnBigpo_SetupSpinUp(EnBigpo* this) { this->actor.speedXZ = 0.0f; } -void EnBigpo_SpinningUp(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SpinningUp(EnBigpo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->rotVelocity += 0x200; EnBigpo_UpdateSpin(this); @@ -600,8 +600,8 @@ void EnBigpo_SetupSpinAttack(EnBigpo* this) { this->actionFunc = EnBigpo_SpinAttack; } -void EnBigpo_SpinAttack(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigpo_SpinAttack(EnBigpo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; SkelAnime_Update(&this->skelAnime); @@ -625,8 +625,8 @@ void EnBigpo_SetupSpinDown(EnBigpo* this) { this->actionFunc = EnBigpo_SpinningDown; } -void EnBigpo_SpinningDown(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigpo_SpinningDown(EnBigpo* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 100.0f, 0.3f, 5.0f, 1.0f); @@ -657,7 +657,7 @@ void EnBigpo_HitStun(EnBigpo* this) { /* * check if just damaged or dead */ -void EnBigpo_CheckHealth(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_CheckHealth(EnBigpo* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { @@ -680,7 +680,7 @@ void EnBigpo_SetupDeath(EnBigpo* this) { /* * from [red damaged poe] to [burning up poe] to [shinking into the lantern] */ -void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_BurnAwayDeath(EnBigpo* this, PlayState* play) { Vec3f tempVec; f32 unkTemp2; // dont really know what these unktemps are doing s16 camYaw; @@ -689,7 +689,7 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { this->idleTimer++; if (this->idleTimer < 8) { - camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800; + camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800; if (this->idleTimer < 5) { unkTemp = (this->idleTimer << 0xC) - 0x4000; // 1.4.0...1 is NOT 1.4, the rodata demands it @@ -706,16 +706,16 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { // not sure what we're turning this into, but its based on the timer modifiedTimer = ((f32)((this->idleTimer * 10) + 80) * 1.4000001f); - func_800B3030(globalCtx, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); + func_800B3030(play, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); tempVec.x = (2.0f * this->actor.world.pos.x) - tempVec.x; tempVec.z = (2.0f * this->actor.world.pos.z) - tempVec.z; - func_800B3030(globalCtx, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); + func_800B3030(play, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); tempVec.x = this->actor.world.pos.x; tempVec.z = this->actor.world.pos.z; - func_800B3030(globalCtx, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); + func_800B3030(play, &tempVec, &D_80B6506C, &gZeroVec3f, modifiedTimer, 0, 2); } else if (this->idleTimer >= 28) { - EnBigpo_SetupLanternDrop(this, globalCtx); + EnBigpo_SetupLanternDrop(this, play); } else if (this->idleTimer >= 19) { this->actor.scale.x = ((28 - this->idleTimer) * 0.014f) * 0.1f; @@ -731,7 +731,7 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { } } -void EnBigpo_SetupLanternDrop(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SetupLanternDrop(EnBigpo* this, PlayState* play) { this->actor.draw = EnBigpo_DrawLantern; this->actor.shape.shadowDraw = NULL; this->actor.world.pos.x = this->drawMtxF.xw; @@ -744,19 +744,19 @@ void EnBigpo_SetupLanternDrop(EnBigpo* this, GlobalContext* globalCtx) { this->actor.shape.rot.x = -0x8000; this->actor.velocity.y = 0.0f; this->actor.world.pos.y -= 15.0f; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_MISC); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); // targetable OFF, enemy music OFF this->actor.bgCheckFlags &= ~0x400; this->actionFunc = EnBigpo_LanternFalling; } -void EnBigpo_LanternFalling(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_LanternFalling(EnBigpo* this, PlayState* play) { if (this->actor.bgCheckFlags & 1 || this->actor.floorHeight == BGCHECK_Y_MIN) { if (this->switchFlags != 0xFF) { - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); } - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_BIGPO, 10, + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_BIGPO, 10, gBigpoDrawLanternFallingDL); EnBigpo_SpawnScoopSoul(this); } @@ -801,7 +801,7 @@ void EnBigpo_SpawnScoopSoul(EnBigpo* this) { this->actionFunc = EnBigpo_ScoopSoulAppearing; } -void EnBigpo_ScoopSoulAppearing(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_ScoopSoulAppearing(EnBigpo* this, PlayState* play) { this->savedHeight += 2.0f; EnBigpo_AdjustPoAlpha(this, 20); // increase visibility if (this->mainColor.a == 255) { // fully visible @@ -817,16 +817,16 @@ void EnBigpo_SetupScoopSoulIdle(EnBigpo* this) { this->actionFunc = EnBigpo_ScoopSoulIdle; } -void EnBigpo_ScoopSoulIdle(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) { DECR(this->idleTimer); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_MarkForDeath(&this->actor); } else if (this->idleTimer == 0) { // took too long, soul is leaving Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); EnBigpo_SetupScoopSoulLeaving(this); } else { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 35.0f, 60.0f); + Actor_PickUp(&this->actor, play, GI_MAX, 35.0f, 60.0f); this->actor.world.pos.y = (sin_rad(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight; } } @@ -836,7 +836,7 @@ void EnBigpo_SetupScoopSoulLeaving(EnBigpo* this) { this->actionFunc = EnBigpo_ScoopSoulFadingAway; } -void EnBigpo_ScoopSoulFadingAway(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_ScoopSoulFadingAway(EnBigpo* this, PlayState* play) { EnBigpo_AdjustPoAlpha(this, -13); if (this->mainColor.a == 0) { // fully invisible Actor_MarkForDeath(&this->actor); @@ -851,7 +851,7 @@ void EnBigpo_InitDampeMainPo(EnBigpo* this) { /* * dampe fires are in 3/N random locations, here we pick them randomly */ -void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { Actor* enemyPtr; EnBigpo* randomFirePo; s32 fireIndex; @@ -859,7 +859,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) s32 fireCount = 0; // count the number of possible fires we can find (4 in vanilla) - for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) { + for (enemyPtr = GET_FIRST_ENEMY(play); enemyPtr != NULL; enemyPtr = enemyPtr->next) { if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { fireCount++; } @@ -869,7 +869,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) if (fireCount < ARRAY_COUNT(this->fires)) { this->actor.draw = EnBigpo_DrawMainBigpo; Actor_SetScale(&this->actor, 0.014f); - EnBigpo_SetupWarpIn(this, globalCtx); + EnBigpo_SetupWarpIn(this, play); Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); this->actor.world.pos.y += 100.0f; return; @@ -877,7 +877,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) // for available possiblefires, pick three to be random fires for (fireIndex = 0; fireIndex < ARRAY_COUNT(this->fires); fireIndex++, fireCount--) { - enemyPtr = GET_FIRST_ENEMY(globalCtx); + enemyPtr = GET_FIRST_ENEMY(play); randomIndex = ((s32)Rand_ZeroFloat(fireCount)) % fireCount; while (enemyPtr != NULL) { @@ -888,7 +888,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) Math_Vec3f_Copy(&this->fires[fireIndex].pos, &randomFirePo->actor.world.pos); randomFirePo->actor.parent = (Actor*)this; randomFirePo->actor.update = EnBigpo_UpdateFire; - func_800BC154(globalCtx, &globalCtx->actorCtx, &randomFirePo->actor, ACTORCAT_PROP); + func_800BC154(play, &play->actorCtx, &randomFirePo->actor, ACTORCAT_PROP); randomFirePo->unk20C = fireIndex; randomFirePo->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF // make invisible by size: 0 @@ -910,7 +910,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) } // remove unused fires - for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) { + for (enemyPtr = GET_FIRST_ENEMY(play); enemyPtr != NULL; enemyPtr = enemyPtr->next) { if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { randomFirePo = (EnBigpo*)enemyPtr; randomFirePo->actionFunc = EnBigpo_Die; @@ -929,7 +929,7 @@ void EnBigpo_ChangeToFireCounting(EnBigpo* this) { * count fires already found by Dampe, * once enough: spawn big poe for fight */ -void EnBigpo_FireCounting(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_FireCounting(EnBigpo* this, PlayState* play) { EnBigpo* firePo; s32 activatedFireCount = 0; @@ -944,7 +944,7 @@ void EnBigpo_FireCounting(EnBigpo* this, GlobalContext* globalCtx) { } } -void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, PlayState* play) { EnBigpo* firePo; Vec3f subCamEye; @@ -958,13 +958,13 @@ void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, GlobalContext* globalCtx) subCamEye.x = (Math_SinS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = (Math_CosS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_DoNothing; } -void EnBigpo_DoNothing(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_DoNothing(EnBigpo* this, PlayState* play) { } void EnBigpo_InitHiddenFire(EnBigpo* this) { @@ -976,13 +976,13 @@ void EnBigpo_InitHiddenFire(EnBigpo* this) { * idle until dampe finds this file by * changing this file params from ENBIGPO_POSSIBLEFIRE into ENBIGPO_REVEALEDFIRE */ -void EnBigpo_WaitingForDampe(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_WaitingForDampe(EnBigpo* this, PlayState* play) { if (this->actor.params == ENBIGPO_REVEALEDFIRE) { EnBigpo_SetupFireRevealed(this); } } -void EnBigpo_Die(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_Die(EnBigpo* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -992,7 +992,7 @@ void EnBigpo_SetupFireRevealed(EnBigpo* this) { this->actionFunc = EnBigpo_RevealedFireGrowing; } -void EnBigpo_RevealedFireGrowing(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_RevealedFireGrowing(EnBigpo* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f)) { this->idleTimer--; if (this->idleTimer == 0) { @@ -1008,7 +1008,7 @@ void EnBigpo_SetupRevealedFireIdle(EnBigpo* this) { this->actionFunc = EnBigpo_RevealedFireIdle; } -void EnBigpo_RevealedFireIdle(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_RevealedFireIdle(EnBigpo* this, PlayState* play) { if (this->idleTimer > 0) { if (this->idleTimer == 0) { //! @bug: unreachable code @@ -1038,14 +1038,14 @@ void EnBigpo_SetupFlameCircleCutscene(EnBigpo* this) { /* * every frame, swirl the flames toward big poe as summoned */ -void EnBigpo_FlameCircleCutscene(EnBigpo* this, GlobalContext* globalCtx) { +void EnBigpo_FlameCircleCutscene(EnBigpo* this, PlayState* play) { Vec3f posDiff; f32 magnitude; this->idleTimer--; if (this->idleTimer == 0) { EnBigpo* parentPoh = (EnBigpo*)this->actor.parent; - Flags_SetSwitch(globalCtx, this->switchFlags); + Flags_SetSwitch(play, this->switchFlags); Math_Vec3f_Copy(&parentPoh->fires[this->unk20C].pos, &this->actor.world.pos); Actor_MarkForDeath(&this->actor); if (this->unk20C == 0) { @@ -1113,7 +1113,7 @@ void EnBigpo_FlickerLanternLight(EnBigpo* this) { this->lanternColor.a = ((s32)(rand * 30.0f)) + 220; } -s32 EnBigpo_ApplyDamage(EnBigpo* this, GlobalContext* globalCtx) { +s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) { if ((this->collider.base.acFlags & AC_HIT) && !(this->collider.base.acFlags & AC_HARD)) { this->collider.base.acFlags &= ~AC_HIT; @@ -1124,7 +1124,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor) == 0) { this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type func_801A2ED8(); } @@ -1136,7 +1136,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect == 4) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 1.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } @@ -1146,7 +1146,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, GlobalContext* globalCtx) { return false; } -void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_Update(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; s32 pad; ColliderCylinder* thisCollider; @@ -1156,7 +1156,7 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { this->savedHeight = this->actor.world.pos.y; } - if (EnBigpo_ApplyDamage(this, globalCtx) == 0) { + if (EnBigpo_ApplyDamage(this, play) == 0) { if ((this->actor.isTargeted) && (this->actionFunc != EnBigpo_WarpingOut) && !(this->collider.base.acFlags & AC_HARD) && (this->actor.category == ACTORCAT_ENEMY)) { this->unk20C++; @@ -1169,12 +1169,12 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != EnBigpo_SpawnCutsceneStage6) && (this->actionFunc != EnBigpo_SpawnCutsceneStage4)) { Actor_MoveWithGravity(&this->actor); } if (this->actionFunc == EnBigpo_LanternFalling) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 27.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, 4); } if (this->actor.draw == EnBigpo_DrawScoopSoul) { @@ -1190,13 +1190,13 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { thisCollider = &this->collider; Collider_UpdateCylinder(&this->actor, thisCollider); if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &thisCollider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &thisCollider->base); } if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &thisCollider->base); + CollisionCheck_SetAT(play, &play->colChkCtx, &thisCollider->base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &thisCollider->base); + CollisionCheck_SetAC(play, &play->colChkCtx, &thisCollider->base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -1214,14 +1214,14 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { /* * alt update func: the revealed fires under dampe's house */ -void EnBigpo_UpdateFire(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_UpdateFire(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); - this->actionFunc(this, globalCtx); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + this->actionFunc(this, play); } -s32 EnBigpo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnBigpo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnBigpo* this = THIS; // not fully invisible @@ -1232,7 +1232,7 @@ s32 EnBigpo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnBigpo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnBigpo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnBigpo* this = THIS; s8 limbByte; Vec3f* v1ptr; // todo: figure out better names @@ -1240,10 +1240,10 @@ void EnBigpo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f unusedVec; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer >= 2) && (limbIndex == 8)) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, &gBigpoDrawCrispyBodyDL); } @@ -1279,14 +1279,14 @@ void EnBigpo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_DrawMainBigpo(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; Gfx* dispHead; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { // fully visible OR fully transparent @@ -1294,9 +1294,9 @@ void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(dispHead, &sSetupDL[6 * 0x19]); gSPSegment(&dispHead[1], 0x0C, &D_801AEFA0); // empty display list for no transparency gSPSegment(&dispHead[2], 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b, this->mainColor.a)); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]); } else { @@ -1304,37 +1304,37 @@ void EnBigpo_DrawMainBigpo(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(dispHead, &sSetupDL[6 * 0x19]); gSPSegment(&dispHead[1], 0x0C, &D_801AEF88); // transparency display list gSPSegment(&dispHead[2], 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b, + Gfx_EnvColor(play->state.gfxCtx, this->mainColor.r, this->mainColor.g, this->mainColor.b, this->mainColor.a)); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBigpo_OverrideLimbDraw, EnBigpo_PostLimbDraw, &this->actor, &dispHead[3]); } // 71.428566f might be 500/7 context unknown - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->actor.scale.x * 71.428566f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); Matrix_Put(&this->drawMtxF); - EnBigpo_DrawLantern(&this->actor, globalCtx); + EnBigpo_DrawLantern(&this->actor, play); if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) { - EnBigpo_DrawCircleFlames(&this->actor, globalCtx); + EnBigpo_DrawCircleFlames(&this->actor, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_DrawScoopSoul(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, - (globalCtx->gameplayFrames * -15) % 512, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (play->gameplayFrames * -15) % 512, 0x20, + 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->mainColor.a); @@ -1344,23 +1344,23 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.z, this->mainColor.r, this->mainColor.g, this->mainColor.b, this->mainColor.a * 2); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gBigpoDrawSoulDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_DrawLantern(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; f32 magnitude; f32 magnitude2; Gfx* dispHead; Vec3f vec1; Vec3f vec2; - Camera* cam = GET_ACTIVE_CAM(globalCtx); + Camera* cam = GET_ACTIVE_CAM(play); if (cam != NULL) { Math_Vec3f_Diff(&cam->eye, &cam->at, &vec1); @@ -1371,20 +1371,20 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&vec1, &gZeroVec3f); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // fully visible OR fully transparent if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); dispHead = POLY_OPA_DISP; } else { - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); dispHead = POLY_XLU_DISP; } gSPDisplayList(&dispHead[0], &sSetupDL[6 * 0x19]); - gSPSegment(&dispHead[1], 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 0, 255, this->mainColor.a)); + gSPSegment(&dispHead[1], 0x0A, Gfx_EnvColor(play->state.gfxCtx, 160, 0, 255, this->mainColor.a)); Matrix_MultVecY(1400.0f, &vec2); Lights_PointGlowSetInfo(&this->fires[0].info, vec2.x + vec1.x, vec2.y + vec1.y, vec2.z + vec1.z, @@ -1392,7 +1392,7 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(&dispHead[2], this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, this->mainColor.a); - gSPMatrix(&dispHead[3], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&dispHead[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&dispHead[4], &gBigpoDrawLanternMainDL); @@ -1405,10 +1405,10 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = &dispHead[6]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; s32 pad[3]; s16 fireRadius; @@ -1416,10 +1416,10 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { s32 i; mtfxPtr = Matrix_GetCurrent(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_NEW); + func_8012C2DC(play->state.gfxCtx); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_NEW); if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); fireRadius = 500; @@ -1428,8 +1428,8 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { fireRadius = (s16)(thisx->scale.x * 500.0f * 100.0f); } 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)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, 255 - this->mainColor.a); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 255); @@ -1443,26 +1443,26 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { mtfxPtr->yw = firePtr->pos.y; mtfxPtr->zw = firePtr->pos.z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigpo_RevealedFire(Actor* thisx, GlobalContext* globalCtx) { +void EnBigpo_RevealedFire(Actor* thisx, PlayState* play) { EnBigpo* this = THIS; EnBigpo* parent = (EnBigpo*)thisx->parent; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); 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)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 255); @@ -1470,9 +1470,9 @@ void EnBigpo_RevealedFire(Actor* thisx, GlobalContext* globalCtx) { Lights_PointNoGlowSetInfo(&parent->fires[this->unk20C].info, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 170, 255, 255, (s32)(thisx->scale.x * 500.0f * 100.0f)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index c5d0bbe4cb..36762f45d5 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -5,7 +5,7 @@ struct EnBigpo; -typedef void (*EnBigPoActionFunc)(struct EnBigpo*, GlobalContext*); +typedef void (*EnBigPoActionFunc)(struct EnBigpo*, PlayState*); typedef struct EnBigpoFireEffect { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index c546ba7809..d7d7f54153 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -13,69 +13,69 @@ #define THIS ((EnBigslime*)thisx) -void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBigslime_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBigslime_UpdateGekko(Actor* thisx, GlobalContext* globalCtx); -void EnBigslime_DrawGekko(Actor* thisx, GlobalContext* globalCtx); +void EnBigslime_Init(Actor* thisx, PlayState* play); +void EnBigslime_Destroy(Actor* thisx, PlayState* play); +void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play); +void EnBigslime_DrawGekko(Actor* thisx, PlayState* play); -void EnBigslime_EndCutscene(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_CutsceneStartBattle(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play); +void EnBigslime_CutsceneStartBattle(EnBigslime* this, PlayState* play); void EnBigslime_SetupCutsceneNoticePlayer(EnBigslime* this); -void EnBigslime_CutsceneNoticePlayer(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_SetupCallMinislime(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_CallMinislime(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_MoveOnCeiling(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_CutsceneNoticePlayer(EnBigslime* this, PlayState* play); +void EnBigslime_SetupCallMinislime(EnBigslime* this, PlayState* play); +void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play); +void EnBigslime_MoveOnCeiling(EnBigslime* this, PlayState* play); void EnBigslime_SetupDrop(EnBigslime* this); -void EnBigslime_Drop(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_Drop(EnBigslime* this, PlayState* play); void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this); -void EnBigslime_SquishFlat(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_SquishFlat(EnBigslime* this, PlayState* play); void EnBigslime_SetupSquishFlat(EnBigslime* this); void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this); void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this); void EnBigslime_SetTargetVtxToStaticVtx(EnBigslime* this); void EnBigslime_SetupRise(EnBigslime* this); -void EnBigslime_Rise(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_Rise(EnBigslime* this, PlayState* play); +void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, PlayState* play); void EnBigslime_SetupAttackPlayerInBigslime(EnBigslime* this); -void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play); void EnBigslime_SetupWindupThrowPlayer(EnBigslime* this); -void EnBigslime_WindupThrowPlayer(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_SetupSetDynamicVtxThrowPlayer(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_SetDynamicVtxThrowPlayer(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play); +void EnBigslime_SetupSetDynamicVtxThrowPlayer(EnBigslime* this, PlayState* play); +void EnBigslime_SetDynamicVtxThrowPlayer(EnBigslime* this, PlayState* play); void EnBigslime_SetupFrozenGround(EnBigslime* this); -void EnBigslime_FrozenGround(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_Freeze(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_Melt(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_FrozenGround(EnBigslime* this, PlayState* play); +void EnBigslime_Freeze(EnBigslime* this, PlayState* play); +void EnBigslime_Melt(EnBigslime* this, PlayState* play); void EnBigslime_SetupFrozenFall(EnBigslime* this); -void EnBigslime_FrozenFall(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_FrozenFall(EnBigslime* this, PlayState* play); void EnBigslime_SetupJumpGekko(EnBigslime* this); -void EnBigslime_JumpGekko(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play); void EnBigslime_SetupIdleLookAround(EnBigslime* this); -void EnBigslime_IdleLookAround(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_IdleLookAround(EnBigslime* this, PlayState* play); void EnBigslime_SetupIdleNoticePlayer(EnBigslime* this); -void EnBigslime_IdleNoticePlayer(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_IdleNoticePlayer(EnBigslime* this, PlayState* play); void EnBigslime_SetupThrowMinislime(EnBigslime* this); -void EnBigslime_DamageGekko(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_StunGekko(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_CutsceneFormBigslime(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_DamageGekko(EnBigslime* this, PlayState* play); +void EnBigslime_StunGekko(EnBigslime* this, PlayState* play); +void EnBigslime_CutsceneFormBigslime(EnBigslime* this, PlayState* play); void EnBigslime_SetupFormBigslime(EnBigslime* this); -void EnBigslime_FormBigslime(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_CutsceneDefeat(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_SetupGekkoDespawn(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_GekkoDespawn(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_FrogSpawn(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play); +void EnBigslime_CutsceneDefeat(EnBigslime* this, PlayState* play); +void EnBigslime_SetupGekkoDespawn(EnBigslime* this, PlayState* play); +void EnBigslime_GekkoDespawn(EnBigslime* this, PlayState* play); +void EnBigslime_SetupFrogSpawn(EnBigslime* this, PlayState* play); +void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play); void EnBigslime_SetupDespawn(EnBigslime* this); -void EnBigslime_Despawn(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_Despawn(EnBigslime* this, PlayState* play); void EnBigslime_SetupInitEntrance(EnBigslime* this); -void EnBigslime_InitEntrance(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_ThrowMinislime(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_InitEntrance(EnBigslime* this, PlayState* play); +void EnBigslime_ThrowMinislime(EnBigslime* this, PlayState* play); void EnBigslime_SetupCutscene(EnBigslime* this); -void EnBigslime_PlayCutscene(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_AddIceShardEffect(EnBigslime* this, GlobalContext* globalCtx); -void EnBigslime_UpdateBigslime(Actor* thisx, GlobalContext* globalCtx); -void EnBigslime_DrawBigslime(Actor* thisx, GlobalContext* globalCtx); -void EnBigslime_DrawShatteringEffects(EnBigslime* this, GlobalContext* globalCtx); +void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play); +void EnBigslime_AddIceShardEffect(EnBigslime* this, PlayState* play); +void EnBigslime_UpdateBigslime(Actor* thisx, PlayState* play); +void EnBigslime_DrawBigslime(Actor* thisx, PlayState* play); +void EnBigslime_DrawShatteringEffects(EnBigslime* this, PlayState* play); /* * Bigslime Spherical Vtx Data: @@ -308,7 +308,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 5, ICHAIN_STOP), }; -void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnBigslime_Init(Actor* thisx, PlayState* play2) { // gSaveContext.save.weekEventReg[KEY] = VALUE // KEY | VALUE static s32 isFrogReturnedFlags[] = { @@ -317,34 +317,33 @@ void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { (33 << 8) | 0x01, // Southern Swamp Frog Returned (33 << 8) | 0x02, // Laundry Pool Frog Returned }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBigslime* this = THIS; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGekkoSkel, &gGekkoLookAroundAnim, this->jointTable, - this->morphTable, GEKKO_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gGekkoSkel, &gGekkoLookAroundAnim, this->jointTable, this->morphTable, + GEKKO_LIMB_MAX); for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { - Collider_InitAndSetCylinder(globalCtx, &this->bigslimeCollider[i], &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->bigslimeCollider[i], &this->actor, &sCylinderInit); } this->bigslimeCollider[0].base.atFlags &= ~AT_ON; - Collider_InitAndSetCylinder(globalCtx, &this->gekkoCollider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->gekkoCollider, &this->actor, &sCylinderInit); this->gekkoCollider.base.colType = COLTYPE_HIT6; this->gekkoCollider.info.elemType = ELEMTYPE_UNK1; this->gekkoCollider.base.atFlags &= ~AT_ON; this->gekkoCollider.base.ocFlags1 &= ~OC1_NO_PUSH; this->actor.params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, 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); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, 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); } } else { this->cutscene = this->actor.cutscene; @@ -355,7 +354,7 @@ void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.home.pos.y = GBT_ROOM_5_MAX_Y - 75.0f; this->actor.home.pos.z = GBT_ROOM_5_CENTER_Z; for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { - this->minislime[i] = (EnMinislime*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, + this->minislime[i] = (EnMinislime*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MINISLIME, 0.0f, 0.0f, 0.0f, 0, 0, 0, i); if (this->minislime[i] == NULL) { for (i = i - 1; i >= 0; i--) { @@ -380,15 +379,15 @@ void EnBigslime_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnBigslime_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBigslime_Destroy(Actor* thisx, PlayState* play) { EnBigslime* this = THIS; s32 i; for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { - Collider_DestroyCylinder(globalCtx, &this->bigslimeCollider[i]); + Collider_DestroyCylinder(play, &this->bigslimeCollider[i]); } - Collider_DestroyCylinder(globalCtx, &this->gekkoCollider); + Collider_DestroyCylinder(play, &this->gekkoCollider); Audio_StopSfxByPos(&this->gekkoProjectedPos); } @@ -583,7 +582,7 @@ void EnBigslime_CheckRoomBoundaries(EnBigslime* this, Vec3f* vtxMax, Vec3f* vtxM } } -void EnBigslime_UpdateBigslimeCollider(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_UpdateBigslimeCollider(EnBigslime* this, PlayState* play) { Vtx* dynamicVtx; f32 xzDist; s16 vtxRingMaxY[BIGSLIME_NUM_RING_VTX]; @@ -629,18 +628,18 @@ void EnBigslime_UpdateBigslimeCollider(EnBigslime* this, GlobalContext* globalCt if (this->bigslimeCollider[0].base.atFlags & AT_ON) { for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->bigslimeCollider[i].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bigslimeCollider[i].base); } } if (this->bigslimeCollider[0].base.acFlags & AC_ON) { for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bigslimeCollider[i].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bigslimeCollider[i].base); } } for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bigslimeCollider[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bigslimeCollider[i].base); } } @@ -724,13 +723,13 @@ void EnBigslime_SetMinislimeBreakLocation(EnBigslime* this) { } } -void EnBigslime_SetPlayerParams(EnBigslime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigslime_SetPlayerParams(EnBigslime* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags2 & 0x80) { player->actor.parent = NULL; player->unk_AE8 = 100; - func_800B8D98(globalCtx, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f); + func_800B8D98(play, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f); } } @@ -741,9 +740,9 @@ void EnBigslime_EndThrowMinislime(EnBigslime* this) { } } -void EnBigslime_BreakIntoMinislime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) { s32 i; - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 20000); Quake_SetQuakeValues(quake, 15, 0, 0, 0); @@ -760,8 +759,8 @@ void EnBigslime_BreakIntoMinislime(EnBigslime* this, GlobalContext* globalCtx) { this->actor.update = EnBigslime_UpdateGekko; this->actor.draw = EnBigslime_DrawGekko; this->actor.gravity = -2.0f; - EnBigslime_SetPlayerParams(this, globalCtx); - EnBigslime_EndCutscene(this, globalCtx); + EnBigslime_SetPlayerParams(this, play); + EnBigslime_EndCutscene(this, play); this->actor.colChkInfo.mass = 50; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_400); this->actor.flags |= ACTOR_FLAG_200; @@ -770,7 +769,7 @@ void EnBigslime_BreakIntoMinislime(EnBigslime* this, GlobalContext* globalCtx) { this->gekkoRot.y = 0; this->actor.bgCheckFlags &= ~1; this->formBigslimeTimer = 2; - EnBigslime_AddIceShardEffect(this, globalCtx); + EnBigslime_AddIceShardEffect(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_BREAK); EnBigslime_SetupJumpGekko(this); } @@ -779,8 +778,8 @@ void EnBigslime_BreakIntoMinislime(EnBigslime* this, GlobalContext* globalCtx) { * Smoothly moves the camera to a side view and keeps it there * as bigslime grabs player and the Gekko melee-attacks player */ -void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamEye; Vec3f subCamAt; @@ -795,7 +794,7 @@ void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, GlobalContext* globalCt Math_StepToF(&subCamAt.y, GBT_ROOM_5_MIN_Y + 87.5f, 10.0f); Math_StepToF(&subCamAt.z, this->actor.world.pos.z, 10.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } /** @@ -803,14 +802,14 @@ void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, GlobalContext* globalCt * This gives the camera a "jerk" feeling * Used everytime player is hit inside of bigslime while being grabbed */ -void EnBigslime_JerkCameraPlayerHit(EnBigslime* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_JerkCameraPlayerHit(EnBigslime* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamEye; Math_Vec3f_Diff(&subCam->eye, &subCam->at, &subCamEye); Math_Vec3f_Scale(&subCamEye, 0.9f); Math_Vec3f_Sum(&subCamEye, &subCam->at, &subCamEye); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** @@ -818,8 +817,8 @@ void EnBigslime_JerkCameraPlayerHit(EnBigslime* this, GlobalContext* globalCtx) * and the battle starts. Positions the camera slightly offset from player, * then zooms into the Gekko until the Gekko calls the minislimes down from the ceiling */ -void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, GlobalContext* globalCtx, s32 noticeTimer) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, PlayState* play, s32 noticeTimer) { + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamEye; f32 zoom = (noticeTimer * 19.0f) + 67.0f; s16 yawOffset = this->actor.yawTowardsPlayer + (noticeTimer * 0x31); @@ -828,28 +827,27 @@ void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, GlobalContext* globalCtx, subCamEye.z = Math_CosS(yawOffset) * zoom + subCam->at.z; subCamEye.y = subCam->at.y + -4.0f + (noticeTimer * 2.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** * Takes the camera and makes the focus point (at) point at bigslime, who is on the * center of the roof. This is used when the minislimes merges into bigslime. */ -void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, GlobalContext* globalCtx) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, - &Play_GetCamera(globalCtx, this->subCamId)->eye); +void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, PlayState* play) { + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); } -void EnBigslime_EndCutscene(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { Camera* subCam; if (this->subCamId != CAM_ID_MAIN) { - subCam = Play_GetCamera(globalCtx, this->subCamId); - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + subCam = Play_GetCamera(play, this->subCamId); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - func_800B724C(globalCtx, &this->actor, 6); + func_800B724C(play, &this->actor, 6); } } @@ -862,8 +860,8 @@ void EnBigslime_Scale(EnBigslime* this, s16 pitch, f32 xzScale, f32 yScale) { /** * Set the params used by the floor shockwave when bigslime shatters into minislime */ -void EnBigslime_InitShockwave(EnBigslime* this, GlobalContext* globalCtx) { - globalCtx->envCtx.lightSettingOverride = 3; +void EnBigslime_InitShockwave(EnBigslime* this, PlayState* play) { + play->envCtx.lightSettingOverride = 3; Math_Vec3f_Copy(&this->frozenPos, &this->actor.world.pos); this->frozenPos.y = GBT_ROOM_5_MIN_Y; this->shockwaveAlpha = 235; @@ -916,42 +914,42 @@ void EnBigslime_GekkoFreeze(EnBigslime* this) { this->actor.flags &= ~ACTOR_FLAG_200; } -void EnBigslime_GekkoThaw(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_GekkoThaw(EnBigslime* this, PlayState* play) { if (this->gekkoDrawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->gekkoCollider.base.colType = COLTYPE_HIT6; this->gekkoCollider.info.elemType = ELEMTYPE_UNK1; this->gekkoDrawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } -void EnBigslime_SetupCutsceneStartBattle(EnBigslime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_SetupCutsceneStartBattle(EnBigslime* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Camera* subCam = Play_GetCamera(play, this->subCamId); - globalCtx->envCtx.lightSettingOverride = 4; + play->envCtx.lightSettingOverride = 4; Animation_PlayLoop(&this->skelAnime, &gGekkoLookAroundAnim); this->bigslimeCollider[0].base.atFlags &= ~AT_ON; this->bigslimeCollider[0].base.acFlags &= ~AC_ON; Math_Vec3f_Copy(&subCam->at, &this->actor.focus.pos); - func_800B7298(globalCtx, &this->actor, 4); + func_800B7298(play, &this->actor, 4); player->actor.shape.rot.y = this->actor.yawTowardsPlayer + 0x8000; player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 347.0f + this->actor.world.pos.x; player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 347.0f + this->actor.world.pos.z; - EnBigslime_UpdateCameraIntroCs(this, globalCtx, 25); + EnBigslime_UpdateCameraIntroCs(this, play, 25); this->gekkoRot.y = this->actor.yawTowardsPlayer + 0x8000; this->isInitJump = false; this->actionFunc = EnBigslime_CutsceneStartBattle; } -void EnBigslime_CutsceneStartBattle(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_CutsceneStartBattle(EnBigslime* this, PlayState* play) { if (this->isAnimUpdate) { EnBigslime_SetupCutsceneNoticePlayer(this); } else if (!this->isInitJump && Math_ScaledStepToS(&this->gekkoRot.y, this->actor.yawTowardsPlayer, 0x200)) { @@ -967,30 +965,30 @@ void EnBigslime_SetupCutsceneNoticePlayer(EnBigslime* this) { this->actionFunc = EnBigslime_CutsceneNoticePlayer; } -void EnBigslime_CutsceneNoticePlayer(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_CutsceneNoticePlayer(EnBigslime* this, PlayState* play) { if (this->noticeTimer != 0) { this->noticeTimer--; } - EnBigslime_UpdateCameraIntroCs(this, globalCtx, this->noticeTimer); + EnBigslime_UpdateCameraIntroCs(this, play, this->noticeTimer); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EV_WALK_WATER); } if (this->noticeTimer == 0) { - EnBigslime_SetupCallMinislime(this, globalCtx); + EnBigslime_SetupCallMinislime(this, play); } } -void EnBigslime_SetupCallMinislime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SetupCallMinislime(EnBigslime* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 5.0f); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_GREET); this->callTimer = 0; - func_800B7298(globalCtx, &this->actor, 7); + func_800B7298(play, &this->actor, 7); this->actionFunc = EnBigslime_CallMinislime; } -void EnBigslime_CallMinislime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) { if (this->callTimer > 0) { this->callTimer--; if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { @@ -998,19 +996,19 @@ void EnBigslime_CallMinislime(EnBigslime* this, GlobalContext* globalCtx) { } if (this->callTimer == 0) { - EnBigslime_EndCutscene(this, globalCtx); + EnBigslime_EndCutscene(this, play); this->formBigslimeTimer = 2; this->actor.flags |= ACTOR_FLAG_1; EnBigslime_SetupIdleNoticePlayer(this); } } else if (this->isAnimUpdate) { Animation_PlayLoop(&this->skelAnime, &gGekkoNervousIdleAnim); - EnBigslime_UpdateCameraIntroCs(this, globalCtx, 25); + EnBigslime_UpdateCameraIntroCs(this, play, 25); func_801A2E54(0x38); EnBigslime_InitFallMinislime(this); - globalCtx->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = 0xFF; this->callTimer = 35; - func_800B7298(globalCtx, &this->actor, 4); + func_800B7298(play, &this->actor, 4); } } @@ -1034,7 +1032,7 @@ void EnBigslime_SetupMoveOnCeiling(EnBigslime* this) { this->actionFunc = EnBigslime_MoveOnCeiling; } -void EnBigslime_MoveOnCeiling(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_MoveOnCeiling(EnBigslime* this, PlayState* play) { s16 pitch; // polar (zenith) angle Math_ScaledStepToS(&this->gekkoRot.x, 0, 0x400); @@ -1045,7 +1043,7 @@ void EnBigslime_MoveOnCeiling(EnBigslime* this, GlobalContext* globalCtx) { if (this->subCamId != CAM_ID_MAIN) { if (this->ceilingMoveTimer == 0) { - EnBigslime_EndCutscene(this, globalCtx); + EnBigslime_EndCutscene(this, play); this->ceilingMoveTimer = 320; } } else if ((this->actor.xzDistToPlayer < 250.0f) || (this->ceilingMoveTimer == 0)) { @@ -1064,7 +1062,7 @@ void EnBigslime_SetupDrop(EnBigslime* this) { this->actionFunc = EnBigslime_Drop; } -void EnBigslime_Drop(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_Drop(EnBigslime* this, PlayState* play) { Vtx* staticVtx; Vtx* dynamicVtx; s32 i; @@ -1232,7 +1230,7 @@ void EnBigslime_SetupSquishFlat(EnBigslime* this) { * - The vtx shape of Fused Jelly starts from a wide cone shape * - The squishing occurs throught the large changes in &this->actor.scale */ -void EnBigslime_SquishFlat(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SquishFlat(EnBigslime* this, PlayState* play) { Player* player; Vtx* dynamicVtx; Vtx* targetVtx; @@ -1262,8 +1260,8 @@ void EnBigslime_SquishFlat(EnBigslime* this, GlobalContext* globalCtx) { } if (i != BIGSLIME_NUM_RING_FACES) { - player = GET_PLAYER(globalCtx); - if (globalCtx->grabPlayer(globalCtx, player)) { + player = GET_PLAYER(play); + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; EnBigslime_SetupCutscene(this); return; @@ -1431,7 +1429,7 @@ void EnBigslime_SetupRise(EnBigslime* this) { * - When riseCounter == 2 to 9, Fused Jelly is returning to its default spherical shape * - When riseCounter == 10, Fused Jelly starts moving on the ceiling */ -void EnBigslime_Rise(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_Rise(EnBigslime* this, PlayState* play) { Vtx* dynamicVtx; Vtx* targetVtx; s32 i; @@ -1492,16 +1490,16 @@ void EnBigslime_Rise(EnBigslime* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 10, 0x800, 0x80); } -void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalCtx) { - Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); +void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, PlayState* play) { + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s16 yaw; - Play_CameraSetAtEye(globalCtx, this->subCamId, &mainCam->at, &mainCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &mainCam->at, &mainCam->eye); this->grabPlayerTimer = 15; this->wavySurfaceTimer = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); - yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.world.rot.y; + yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.world.rot.y; if (yaw > 0x4000) { this->subCamYawGrabPlayer = -0x2000; @@ -1519,8 +1517,8 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalC this->actionFunc = EnBigslime_CutsceneGrabPlayer; } -void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 invgrabPlayerTimer; f32 magPosXZOffset; Vtx* dynamicVtx; @@ -1529,7 +1527,7 @@ void EnBigslime_CutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalCtx) { player->unk_AE8 = 0; Math_ScaledStepToS(&this->gekkoRot.x, 0, 0x400); - EnBigslime_UpdateCameraGrabPlayer(this, globalCtx); + EnBigslime_UpdateCameraGrabPlayer(this, play); if (this->grabPlayerTimer > 0) { invgrabPlayerTimer = 1.0f / this->grabPlayerTimer; @@ -1572,13 +1570,13 @@ void EnBigslime_SetupAttackPlayerInBigslime(EnBigslime* this) { this->actionFunc = EnBigslime_AttackPlayerInBigslime; } -void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pitch = this->scaleFactor * 0x3333; // polar (zenith) angle player->unk_AE8 = 0; Math_ScaledStepToS(&this->gekkoRot.x, 0, 0x400); - EnBigslime_UpdateCameraGrabPlayer(this, globalCtx); + EnBigslime_UpdateCameraGrabPlayer(this, play); EnBigslime_UpdateWavySurface(this); if (this->scaleFactor != 0) { @@ -1595,7 +1593,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, GlobalContext* globalCt this->scaleFactor = 10; player->actor.world.pos.x += 20.0f * Math_SinS(this->gekkoRot.y); player->actor.world.pos.z += 20.0f * Math_CosS(this->gekkoRot.y); - EnBigslime_JerkCameraPlayerHit(this, globalCtx); + EnBigslime_JerkCameraPlayerHit(this, play); if (this->skelAnime.animation == &gGekkoKickAnim) { EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_KICK); } else { @@ -1623,7 +1621,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, GlobalContext* globalCt return; } - globalCtx->damagePlayer(globalCtx, -4); + play->damagePlayer(play, -4); func_800B8E58(player, player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S); this->gekkoRot.y += (s16)(Rand_S16Offset(0x4000, 0x4000) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); this->gekkoPosOffset.x = Math_SinS(this->gekkoRot.y) * -50.0f; @@ -1679,8 +1677,8 @@ void EnBigslime_SetupWindupThrowPlayer(EnBigslime* this) { this->actionFunc = EnBigslime_WindupThrowPlayer; } -void EnBigslime_WindupThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 scale; f32 invWindupPunchTimer; Vtx* dynamicVtx; @@ -1689,7 +1687,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { s32 j; this->windupPunchTimer--; - EnBigslime_UpdateCameraGrabPlayer(this, globalCtx); + EnBigslime_UpdateCameraGrabPlayer(this, play); if (this->windupPunchTimer > 0) { invWindupPunchTimer = 1.0f / this->windupPunchTimer; scale = cos_rad(this->windupPunchTimer * (M_PI / 27)) + 1.0f; @@ -1713,8 +1711,8 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { } player->actor.velocity.y = 0.0f; - func_800B8D50(globalCtx, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f, 4); - EnBigslime_SetupSetDynamicVtxThrowPlayer(this, globalCtx); + func_800B8D50(play, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f, 4); + EnBigslime_SetupSetDynamicVtxThrowPlayer(this, play); } player->actor.world.pos.x = @@ -1765,18 +1763,18 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { } } -void EnBigslime_SetupSetDynamicVtxThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SetupSetDynamicVtxThrowPlayer(EnBigslime* this, PlayState* play) { this->grabPlayerTimer = 10; EnBigslime_SetTargetVtxToWideCone(this); EnBigslime_CheckVtxWallBoundaries(this); - EnBigslime_EndCutscene(this, globalCtx); + EnBigslime_EndCutscene(this, play); this->actionFunc = EnBigslime_SetDynamicVtxThrowPlayer; } /** * Restores bigslime to wide cone after player is thrown */ -void EnBigslime_SetDynamicVtxThrowPlayer(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SetDynamicVtxThrowPlayer(EnBigslime* this, PlayState* play) { f32 invThrowPlayerTimer; Vtx* targetVtx; Vtx* dynamicVtx; @@ -1861,7 +1859,7 @@ void EnBigslime_SetupFreeze(EnBigslime* this) { /** * Propogates the frozen effect from the seed at the bottom out through all vertices */ -void EnBigslime_Freeze(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_Freeze(EnBigslime* this, PlayState* play) { f32 randFloat; Vtx* targetVtx; Vtx* dynamicVtx; @@ -1900,10 +1898,10 @@ void EnBigslime_Freeze(EnBigslime* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (this->actor.bgCheckFlags & 2) { if (this->freezeTimer == 0) { - EnBigslime_BreakIntoMinislime(this, globalCtx); + EnBigslime_BreakIntoMinislime(this, play); } else { this->bigslimeCollider[0].base.acFlags |= AC_ON; - EnBigslime_AddIceShardEffect(this, globalCtx); + EnBigslime_AddIceShardEffect(this, play); EnBigslime_SetupSquishFlat(this); } } else if (this->freezeTimer == 0) { @@ -1921,14 +1919,14 @@ void EnBigslime_SetupFrozenGround(EnBigslime* this) { this->actionFunc = EnBigslime_FrozenGround; } -void EnBigslime_FrozenGround(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_FrozenGround(EnBigslime* this, PlayState* play) { f32 invFreezerTimer; s32 randSign; f32 randFloat; this->freezeTimer--; if (this->freezeTimer == 0) { - EnBigslime_AddIceShardEffect(this, globalCtx); + EnBigslime_AddIceShardEffect(this, play); EnBigslime_SetTargetVtxFromPreFrozen(this); } else if (this->freezeTimer == 40) { Math_Vec3f_Copy(&this->frozenPos, &this->actor.world.pos); @@ -1963,7 +1961,7 @@ void EnBigslime_SetupMelt(EnBigslime* this) { this->actionFunc = EnBigslime_Melt; } -void EnBigslime_Melt(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_Melt(EnBigslime* this, PlayState* play) { static Vec3f iceSmokeVelocity = { 0.0f, 2.0f, 0.0f }; Vec3f iceSmokePos; Vtx* targetVtx; @@ -1977,7 +1975,7 @@ void EnBigslime_Melt(EnBigslime* this, GlobalContext* globalCtx) { iceSmokePos.x = (dynamicVtx->n.ob[0] * this->actor.scale.x) + this->actor.world.pos.x; iceSmokePos.y = (dynamicVtx->n.ob[1] * this->actor.scale.y) + this->actor.world.pos.y; iceSmokePos.z = (dynamicVtx->n.ob[2] * this->actor.scale.z) + this->actor.world.pos.z; - EffectSsIceSmoke_Spawn(globalCtx, &iceSmokePos, &iceSmokeVelocity, &gZeroVec3f, 600); + EffectSsIceSmoke_Spawn(play, &iceSmokePos, &iceSmokeVelocity, &gZeroVec3f, 600); } func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); @@ -1988,7 +1986,7 @@ void EnBigslime_Melt(EnBigslime* this, GlobalContext* globalCtx) { if (this->meltCounter == 100) { EnBigslime_SetTargetVtxFromPreFrozen(this); } else if (this->meltCounter == 50) { - globalCtx->envCtx.lightSettingOverride = 0xFF; + play->envCtx.lightSettingOverride = 0xFF; } } @@ -2006,7 +2004,7 @@ void EnBigslime_SetupFrozenFall(EnBigslime* this) { this->actionFunc = EnBigslime_FrozenFall; } -void EnBigslime_FrozenFall(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_FrozenFall(EnBigslime* this, PlayState* play) { s32 i; for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { @@ -2016,11 +2014,11 @@ void EnBigslime_FrozenFall(EnBigslime* this, GlobalContext* globalCtx) { } if (i != BIGSLIME_NUM_RING_FACES) { - func_800B8D50(globalCtx, &this->actor, 7.0f, this->actor.yawTowardsPlayer, 5.0f, 0x10); + func_800B8D50(play, &this->actor, 7.0f, this->actor.yawTowardsPlayer, 5.0f, 0x10); } if (this->actor.bgCheckFlags & 1) { - EnBigslime_BreakIntoMinislime(this, globalCtx); + EnBigslime_BreakIntoMinislime(this, play); } } @@ -2033,7 +2031,7 @@ void EnBigslime_SetupJumpGekko(EnBigslime* this) { this->actionFunc = EnBigslime_JumpGekko; } -void EnBigslime_JumpGekko(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play) { s16 yaw; s16 yawDiff; @@ -2096,7 +2094,7 @@ void EnBigslime_SetupIdleLookAround(EnBigslime* this) { this->actionFunc = EnBigslime_IdleLookAround; } -void EnBigslime_IdleLookAround(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_IdleLookAround(EnBigslime* this, PlayState* play) { s16 yawDiff; this->idleTimer--; @@ -2130,7 +2128,7 @@ void EnBigslime_SetupIdleNoticePlayer(EnBigslime* this) { this->actionFunc = EnBigslime_IdleNoticePlayer; } -void EnBigslime_IdleNoticePlayer(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_IdleNoticePlayer(EnBigslime* this, PlayState* play) { s16* yaw = &this->gekkoRot.y; if (this->skelAnime.curFrame > 10.0f) { @@ -2148,7 +2146,7 @@ void EnBigslime_SetupThrowMinislime(EnBigslime* this) { this->actionFunc = EnBigslime_ThrowMinislime; } -void EnBigslime_ThrowMinislime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_ThrowMinislime(EnBigslime* this, PlayState* play) { s16 jumpTimerStored; Math_ScaledStepToS(&this->gekkoRot.y, this->actor.yawTowardsPlayer, 0x300); @@ -2186,7 +2184,7 @@ void EnBigslime_SetupDamageGekko(EnBigslime* this, s32 isNotFrozen) { /** * Spins Gekko around as it takes damage */ -void EnBigslime_DamageGekko(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_DamageGekko(EnBigslime* this, PlayState* play) { s32 damageSpinTimer; this->damageSpinTimer--; @@ -2208,11 +2206,11 @@ void EnBigslime_SetupStunGekko(EnBigslime* this) { this->actor.speedXZ = 0.0f; } -void EnBigslime_StunGekko(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_StunGekko(EnBigslime* this, PlayState* play) { this->stunTimer--; if (this->stunTimer == 0) { if (this->gekkoDrawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - EnBigslime_GekkoThaw(this, globalCtx); + EnBigslime_GekkoThaw(this, play); EnBigslime_SetupDamageGekko(this, false); } else { this->gekkoCollider.base.acFlags &= ~AC_ON; @@ -2230,8 +2228,8 @@ void EnBigslime_SetupCutsceneFormBigslime(EnBigslime* this) { this->actor.speedXZ = 0.0f; } -void EnBigslime_CutsceneFormBigslime(EnBigslime* this, GlobalContext* globalCtx) { - EnBigslime_UpdateCameraFormingBigslime(this, globalCtx); +void EnBigslime_CutsceneFormBigslime(EnBigslime* this, PlayState* play) { + EnBigslime_UpdateCameraFormingBigslime(this, play); Math_ScaledStepToS(&this->gekkoRot.y, this->actor.world.rot.y, 0x800); if (Animation_OnFrame(&this->skelAnime, 18.0f)) { EnBigslime_SetupFormBigslime(this); @@ -2267,13 +2265,13 @@ void EnBigslime_SetupFormBigslime(EnBigslime* this) { this->actionFunc = EnBigslime_FormBigslime; } -void EnBigslime_FormBigslime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play) { f32 xzScale; f32 yScaleFactor; s32 i; EnBigslime_UpdateWavySurface(this); - EnBigslime_UpdateCameraFormingBigslime(this, globalCtx); + EnBigslime_UpdateCameraFormingBigslime(this, play); if (this->formBigslimeCutsceneTimer < 0) { Math_ScaledStepToS(&this->gekkoRot.x, 0, 0x400); } else if (this->actor.world.pos.y > (GBT_ROOM_5_MAX_Y - 100.0f)) { @@ -2314,7 +2312,7 @@ void EnBigslime_FormBigslime(EnBigslime* this, GlobalContext* globalCtx) { } } -void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; s32 i; @@ -2344,18 +2342,18 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, GlobalContext* globalCtx) subCamEye.x = (Math_SinS(yawOffset) * 250.0f) + subCamAt.x; subCamEye.y = subCamAt.y + 60.0f; subCamEye.z = (Math_CosS(yawOffset) * 250.0f) + subCamAt.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { this->minislime[i]->actor.params = MINISLIME_DEFEAT_IDLE; } this->actor.flags &= ~ACTOR_FLAG_1; - EnBigslime_GekkoThaw(this, globalCtx); + EnBigslime_GekkoThaw(this, play); this->actionFunc = EnBigslime_CutsceneDefeat; } -void EnBigslime_CutsceneDefeat(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_CutsceneDefeat(EnBigslime* this, PlayState* play) { s32 defeatTimer; Camera* subCam; Vec3f subCamAt; @@ -2364,19 +2362,19 @@ void EnBigslime_CutsceneDefeat(EnBigslime* this, GlobalContext* globalCtx) { defeatTimer = CLAMP_MAX(this->defeatTimer, 10); this->gekkoRot.y += 0x300 * defeatTimer; if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f)) { - EnBigslime_SetupGekkoDespawn(this, globalCtx); + EnBigslime_SetupGekkoDespawn(this, play); } else { // Continue for the camera to follow Gekko as it spins in defeat - subCam = Play_GetCamera(globalCtx, this->subCamId); + subCam = Play_GetCamera(play, this->subCamId); subCamAt.x = this->actor.world.pos.x; subCamAt.y = this->actor.world.pos.y + 40.0f; subCamAt.z = this->actor.world.pos.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); } } -void EnBigslime_SetupGekkoDespawn(EnBigslime* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_SetupGekkoDespawn(EnBigslime* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); f32 magnitude; f32 invMagnitude; @@ -2396,7 +2394,7 @@ void EnBigslime_SetupGekkoDespawn(EnBigslime* this, GlobalContext* globalCtx) { this->actionFunc = EnBigslime_GekkoDespawn; } -void EnBigslime_GekkoDespawn(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_GekkoDespawn(EnBigslime* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; Camera* subCam; @@ -2404,32 +2402,32 @@ void EnBigslime_GekkoDespawn(EnBigslime* this, GlobalContext* globalCtx) { this->despawnTimer--; this->gekkoScale = this->despawnTimer * 0.00035000002f; if (this->despawnTimer == 0) { - EnBigslime_SetupFrogSpawn(this, globalCtx); + EnBigslime_SetupFrogSpawn(this, play); } else { - subCam = Play_GetCamera(globalCtx, this->subCamId); + subCam = Play_GetCamera(play, this->subCamId); Math_Vec3f_Copy(&subCamAt, &subCam->at); Math_Vec3f_Diff(&subCam->eye, &this->subCamDistToFrog, &subCamEye); subCamEye.y -= 1.8f; subCamAt.y -= 1.7f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } } -void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_SetupFrogSpawn(EnBigslime* this, PlayState* play) { static Color_RGBA8 dustPrimColor = { 250, 250, 250, 255 }; static Color_RGBA8 dustEnvColor = { 180, 180, 180, 255 }; static Vec3f hahenAccel = { 0.0f, -0.5f, 0.0f }; - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f* worldPos; Vec3f dustPos; Vec3f hahenVel; - s16 yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + s16 yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); s16 yawReverse = yaw + 0x8000; s32 i; this->gekkoCollider.base.ocFlags1 &= ~OC1_ON; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, yawReverse, 0, this->actor.params); dustPos.x = (Math_SinS(yawReverse) * 20.0f) + this->actor.world.pos.x; @@ -2437,17 +2435,17 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { worldPos = &this->actor.world.pos; dustPos.z = (Math_CosS(yawReverse) * 20.0f) + this->actor.world.pos.z; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, worldPos, 40, NA_SE_EN_NPC_APPEAR); + SoundSource_PlaySfxAtFixedWorldPos(play, worldPos, 40, NA_SE_EN_NPC_APPEAR); // dust cloud where the red frog appears - func_800B0DE0(globalCtx, &dustPos, &gZeroVec3f, &gZeroVec3f, &dustPrimColor, &dustEnvColor, 500, 50); + func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &dustPrimColor, &dustEnvColor, 500, 50); for (i = 0; i < 25; i++) { hahenVel.x = randPlusMinusPoint5Scaled(5.0f); hahenVel.y = Rand_ZeroFloat(3.0f) + 4.0f; hahenVel.z = randPlusMinusPoint5Scaled(5.0f); - EffectSsHahen_Spawn(globalCtx, worldPos, &hahenVel, &hahenAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, - 10, 0); + EffectSsHahen_Spawn(play, worldPos, &hahenVel, &hahenAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, 10, + 0); } this->spawnFrogTimer = 40; @@ -2455,8 +2453,8 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { this->actionFunc = EnBigslime_FrogSpawn; } -void EnBigslime_FrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamEye; f32 subCamZoom; @@ -2467,10 +2465,10 @@ void EnBigslime_FrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom); subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom); subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); if (this->spawnFrogTimer == 0) { - EnBigslime_EndCutscene(this, globalCtx); + EnBigslime_EndCutscene(this, play); EnBigslime_SetupDespawn(this); } } @@ -2487,7 +2485,7 @@ void EnBigslime_SetupDespawn(EnBigslime* this) { this->actionFunc = EnBigslime_Despawn; } -void EnBigslime_Despawn(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_Despawn(EnBigslime* this, PlayState* play) { s32 i; s32 counter = 0; @@ -2498,7 +2496,7 @@ void EnBigslime_Despawn(EnBigslime* this, GlobalContext* globalCtx) { } if (!this->isDespawned) { - Flags_SetClearTemp(globalCtx, globalCtx->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.currRoom.num); this->isDespawned = true; } @@ -2515,8 +2513,8 @@ void EnBigslime_SetupInitEntrance(EnBigslime* this) { this->actionFunc = EnBigslime_InitEntrance; } -void EnBigslime_InitEntrance(EnBigslime* this, GlobalContext* globalCtx) { - if (globalCtx->roomCtx.prevRoom.num == -1) { +void EnBigslime_InitEntrance(EnBigslime* this, PlayState* play) { + if (play->roomCtx.prevRoom.num == -1) { EnBigslime_SetupCutscene(this); } } @@ -2536,34 +2534,34 @@ void EnBigslime_SetupCutscene(EnBigslime* this) { this->actor.speedXZ = 0.0f; } -void EnBigslime_PlayCutscene(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7D) { ActorCutscene_Stop(0x7D); ActorCutscene_SetIntentToPlay(this->cutscene); } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); if (this->actionFuncStored != EnBigslime_SquishFlat) { - func_800B724C(globalCtx, &this->actor, 7); + func_800B724C(play, &this->actor, 7); } this->subCamId = ActorCutscene_GetCurrentCamera(this->cutscene); if (this->actor.colChkInfo.health == 0) { - EnBigslime_SetupCutsceneDefeat(this, globalCtx); + EnBigslime_SetupCutsceneDefeat(this, play); } else if ((this->actionFuncStored == EnBigslime_DamageGekko) || (this->actionFuncStored == EnBigslime_JumpGekko) || (this->actionFuncStored == EnBigslime_StunGekko)) { EnBigslime_SetupCutsceneFormBigslime(this); } else if (this->actionFuncStored == EnBigslime_SquishFlat) { - EnBigslime_SetupCutsceneGrabPlayer(this, globalCtx); + EnBigslime_SetupCutsceneGrabPlayer(this, play); } else { - EnBigslime_SetupCutsceneStartBattle(this, globalCtx); + EnBigslime_SetupCutsceneStartBattle(this, play); } } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } -void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, PlayState* play) { s32 i; for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { @@ -2571,10 +2569,10 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globa this->bigslimeCollider[i].base.acFlags &= ~AC_HIT; if (this->actionFunc == EnBigslime_FrozenGround) { if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_BREAK_ICE) { - EnBigslime_BreakIntoMinislime(this, globalCtx); + EnBigslime_BreakIntoMinislime(this, play); break; } else if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_FIRE) { - EnBigslime_SetPlayerParams(this, globalCtx); + EnBigslime_SetPlayerParams(this, play); EnBigslime_SetupMelt(this); break; } @@ -2582,11 +2580,11 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globa if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_ICE) { EnMinislime* minislime; - globalCtx->envCtx.lightSettingOverride = 2; - EnBigslime_SetPlayerParams(this, globalCtx); + play->envCtx.lightSettingOverride = 2; + EnBigslime_SetPlayerParams(this, play); this->rotation = 0; EnBigslime_SetupFreeze(this); - minislime = (EnMinislime*)SubS_FindActor(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_ARROW_ICE); + minislime = (EnMinislime*)SubS_FindActor(play, NULL, ACTORCAT_ITEMACTION, ACTOR_ARROW_ICE); if (minislime != NULL) { minislime->shakeRefPos.z = -100.0f; } @@ -2597,9 +2595,9 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globa f32 randFloat = Rand_ZeroOne(); if (randFloat < 0.15f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_ARROWS_10); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); } else if (randFloat < 0.3f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_MAGIC_SMALL); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_SMALL); } this->itemDropTimer = 40; } @@ -2612,7 +2610,7 @@ void EnBigslime_ApplyDamageEffectBigslime(EnBigslime* this, GlobalContext* globa } } -void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { if (this->gekkoCollider.base.acFlags & AC_HIT) { this->gekkoCollider.base.acFlags &= ~AC_HIT; if ((this->gekkoDrawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || @@ -2622,9 +2620,9 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCt if (Actor_ApplyDamage(&this->actor) == 0) { func_800BE504(&this->actor, &this->gekkoCollider); func_801A2ED8(); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->gekkoCollider.base.acFlags &= ~AC_ON; - EnBigslime_GekkoThaw(this, globalCtx); + EnBigslime_GekkoThaw(this, play); if ((this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_FIRE) || (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_LIGHT)) { this->gekkoDrawDmgEffAlpha = 4.0f; @@ -2633,7 +2631,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCt this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } else { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->gekkoCollider.info.bumper.hitPos.x, this->gekkoCollider.info.bumper.hitPos.y, this->gekkoCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); @@ -2659,7 +2657,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCt func_800BE504(&this->actor, &this->gekkoCollider); EnBigslime_SetupStunGekko(this); } else { - EnBigslime_GekkoThaw(this, globalCtx); + EnBigslime_GekkoThaw(this, play); if ((this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_FIRE) || (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_LIGHT)) { this->gekkoDrawDmgEffAlpha = 3.0f; @@ -2668,7 +2666,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCt this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } else { this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->gekkoCollider.info.bumper.hitPos.x, this->gekkoCollider.info.bumper.hitPos.y, this->gekkoCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); @@ -2684,7 +2682,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, GlobalContext* globalCt /** * Adds ice shard effects and calls EnBigslime_InitShockwave */ -void EnBigslime_AddIceShardEffect(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_AddIceShardEffect(EnBigslime* this, PlayState* play) { Vtx* targetVtx = &sBigslimeTargetVtx[0]; EnBigslimeIceShardEffect* iceShardEffect; s32 i; @@ -2723,7 +2721,7 @@ void EnBigslime_AddIceShardEffect(EnBigslime* this, GlobalContext* globalCtx) { } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); - EnBigslime_InitShockwave(this, globalCtx); + EnBigslime_InitShockwave(this, play); } /** @@ -2767,14 +2765,14 @@ void EnBigslime_UpdateEffects(EnBigslime* this) { } } -void EnBigslime_UpdateBigslime(Actor* thisx, GlobalContext* globalCtx) { +void EnBigslime_UpdateBigslime(Actor* thisx, PlayState* play) { EnBigslime* this = THIS; s32 i; Vec3f vtxMax; Vec3f vtxMin; - if (globalCtx->envCtx.lightSettingOverride == 3) { - globalCtx->envCtx.lightSettingOverride = 0xFF; + if (play->envCtx.lightSettingOverride == 3) { + play->envCtx.lightSettingOverride = 0xFF; } func_8019F540(1); @@ -2782,14 +2780,14 @@ void EnBigslime_UpdateBigslime(Actor* thisx, GlobalContext* globalCtx) { EnBigslime_DynamicVtxCopyState(this); this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { - EnBigslime_ApplyDamageEffectBigslime(this, globalCtx); + EnBigslime_ApplyDamageEffectBigslime(this, play); } else { for (i = 0; i < BIGSLIME_NUM_RING_FACES; i++) { this->bigslimeCollider[i].base.acFlags &= ~AC_HIT; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnBigslime_FormBigslime) { Actor_MoveWithGravity(&this->actor); @@ -2802,7 +2800,7 @@ void EnBigslime_UpdateBigslime(Actor* thisx, GlobalContext* globalCtx) { EnBigslime_UpdateScale(this, &vtxMax, &vtxMin); EnBigslime_CheckRoomBoundaries(this, &vtxMax, &vtxMin); EnBigslime_UpdateSurfaceNorm(this); - EnBigslime_UpdateBigslimeCollider(this, globalCtx); + EnBigslime_UpdateBigslimeCollider(this, play); } EnBigslime_UpdateEffects(this); @@ -2812,40 +2810,40 @@ void EnBigslime_UpdateBigslime(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBigslime_UpdateGekko(Actor* thisx, GlobalContext* globalCtx) { +void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) { static s32 isGekkoOnGround = false; EnBigslime* this = THIS; Player* player; s32 pad; - if (globalCtx->envCtx.lightSettingOverride == 3) { - globalCtx->envCtx.lightSettingOverride = 0xFF; + if (play->envCtx.lightSettingOverride == 3) { + play->envCtx.lightSettingOverride = 0xFF; } func_8019F540(0); this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { - EnBigslime_ApplyDamageEffectGekko(this, globalCtx); + EnBigslime_ApplyDamageEffectGekko(this, play); } else { this->gekkoCollider.base.acFlags &= ~AC_HIT; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnBigslime_FormBigslime) { Actor_MoveWithGravity(&this->actor); } else { Actor_MoveWithoutGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 40.0f, 80.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 40.0f, 80.0f, 0x1F); this->gekkoCollider.dim.pos.x = (s16)this->actor.world.pos.x; this->gekkoCollider.dim.pos.z = (s16)this->actor.world.pos.z; if (this->gekkoCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->gekkoCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->gekkoCollider.base); } if ((this->actor.update == EnBigslime_UpdateGekko) && (this->gekkoCollider.base.ocFlags1 & OC1_ON)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->gekkoCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->gekkoCollider.base); } EnBigslime_UpdateEffects(this); @@ -2854,12 +2852,12 @@ void EnBigslime_UpdateGekko(Actor* thisx, GlobalContext* globalCtx) { (this->gekkoCollider.dim.pos.y < (s16)(3.0f + GBT_ROOM_5_MIN_Y))) { Vec3f vtxNorm; - if (((globalCtx->gameplayFrames % 4) == 0) || !isGekkoOnGround) { - player = GET_PLAYER(globalCtx); + if (((play->gameplayFrames % 4) == 0) || !isGekkoOnGround) { + player = GET_PLAYER(play); vtxNorm.x = this->actor.world.pos.x; vtxNorm.z = this->actor.world.pos.z; vtxNorm.y = player->actor.world.pos.y + player->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &vtxNorm, 150, 550, 0); + EffectSsGRipple_Spawn(play, &vtxNorm, 150, 550, 0); isGekkoOnGround = true; } } else { @@ -2870,7 +2868,7 @@ void EnBigslime_UpdateGekko(Actor* thisx, GlobalContext* globalCtx) { /** * Related to transforming and drawing shadows */ -void EnBigslime_SetSysMatrix(Vec3f* pos, GlobalContext* globalCtx, Gfx* shadowDList, f32 scaleX, f32 scalez, f32 scaleY, +void EnBigslime_SetSysMatrix(Vec3f* pos, PlayState* play, Gfx* shadowDList, f32 scaleX, f32 scalez, f32 scaleY, s16 rotation, f32 alpha) { f32 yDistMinY; f32 zx; @@ -2880,7 +2878,7 @@ void EnBigslime_SetSysMatrix(Vec3f* pos, GlobalContext* globalCtx, Gfx* shadowDL yDistMinY = CLAMP((yDistMinY), 0.0f, (GBT_ROOM_5_CENTER_Y - GBT_ROOM_5_MIN_Y) / 2); zx = 1.0f - (yDistMinY * (1.0f / 1550.0f)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); sysMatrix->xx = zx; sysMatrix->yy = 1.0f; @@ -2902,14 +2900,14 @@ void EnBigslime_SetSysMatrix(Vec3f* pos, GlobalContext* globalCtx, Gfx* shadowDL } gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(alpha * zx)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, shadowDList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigslime_DrawMinislime(EnBigslime* this, GlobalContext* globalCtx2) { +void EnBigslime_DrawMinislime(EnBigslime* this, PlayState* play2) { EnMinislime* minislime; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 pad; s32 currIndex; s32 i; @@ -2932,39 +2930,38 @@ void EnBigslime_DrawMinislime(EnBigslime* this, GlobalContext* globalCtx2) { } } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { minislime = this->minislime[indices[i]]; - lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - Lights_BindAll(lights, globalCtx->lightCtx.listHead, &minislime->actor.world.pos, globalCtx); - Lights_Draw(lights, globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&minislime->actor, globalCtx, 0); + lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); + Lights_BindAll(lights, play->lightCtx.listHead, &minislime->actor.world.pos, play); + Lights_Draw(lights, play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&minislime->actor, play, 0); Matrix_SetTranslateRotateYXZ(minislime->actor.world.pos.x, minislime->actor.world.pos.y, minislime->actor.world.pos.z, &minislime->actor.shape.rot); Matrix_Scale(minislime->actor.scale.x, minislime->actor.scale.y, minislime->actor.scale.z, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, minislime->actor.shape.shadowAlpha); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gMinislimeNormalDL); if (minislime->frozenAlpha > 0) { Matrix_Translate(0.0f, (0.1f - minislime->frozenScale) * -4000.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(0.1f, minislime->frozenScale, 0.1f, MTXMODE_APPLY); - AnimatedMat_Draw(globalCtx, this->minislimeFrozenTexAnim); + AnimatedMat_Draw(play, this->minislimeFrozenTexAnim); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, minislime->frozenAlpha); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gMinislimeFrozenDL); } - EnBigslime_SetSysMatrix(&minislime->actor.world.pos, globalCtx, gBigslimeShadowDL, + EnBigslime_SetSysMatrix(&minislime->actor.world.pos, play, gBigslimeShadowDL, (minislime->actor.scale.x * 0.4f) * 0.1f, (minislime->actor.scale.z * 0.4f) * 0.1f, minislime->actor.scale.y * 400.0f, minislime->actor.shape.rot.y, minislime->actor.shape.shadowAlpha * (175.0f / 255.0f)); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnBigslime_DrawBigslime(Actor* thisx, GlobalContext* globalCtx) { +void EnBigslime_DrawBigslime(Actor* thisx, PlayState* play) { // 28 equidistance-spaced vtx Points (uniformally over the sphere) static EnBigslimeBubbles bubblesInfo[] = { { 0, 0.3f }, { 6, 0.1f }, { 12, 0.45f }, { 18, 0.5f }, { 24, 0.6f }, { 30, 0.2f }, { 36, 0.4f }, @@ -2978,20 +2975,20 @@ void EnBigslime_DrawBigslime(Actor* thisx, GlobalContext* globalCtx) { MtxF* billboardMtxF; s32 i; - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&this->actor, globalCtx, 0); - OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); + OPEN_DISPS(play->state.gfxCtx); // Draw Bigslime gSPSegment(POLY_XLU_DISP++, 0x09, sBigslimeDynamicVtx[this->dynamicVtxState]); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeNormalDL); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeVtxDL); // Draw frozen Bigslime if ((this->actionFunc == EnBigslime_Freeze) || (this->actionFunc == EnBigslime_FrozenGround) || (this->actionFunc == EnBigslime_FrozenFall) || (this->actionFunc == EnBigslime_Melt)) { - AnimatedMat_Draw(globalCtx, this->bigslimeFrozenTexAnim); + AnimatedMat_Draw(play, this->bigslimeFrozenTexAnim); gSPSegment(POLY_XLU_DISP++, 0x09, sBigslimeTargetVtx); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeFrozenVtxDL); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeVtxDL); @@ -2999,7 +2996,7 @@ void EnBigslime_DrawBigslime(Actor* thisx, GlobalContext* globalCtx) { // Draw bubbles inside Bigslime if (this->actor.scale.x > 0.0f) { - Matrix_Put(&globalCtx->billboardMtxF); + Matrix_Put(&play->billboardMtxF); Matrix_Scale(0.0050000003f, 0.0050000003f, 0.0050000003f, MTXMODE_APPLY); billboardMtxF = Matrix_GetCurrent(); @@ -3012,19 +3009,18 @@ void EnBigslime_DrawBigslime(Actor* thisx, GlobalContext* globalCtx) { dynamicVtx->n.ob[1] * this->actor.scale.y * bubblesInfoPtr->scaleVtx + this->actor.world.pos.y; billboardMtxF->zw = dynamicVtx->n.ob[2] * this->actor.scale.z * bubblesInfoPtr->scaleVtx + this->actor.world.pos.z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeBubbleDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - EnBigslime_SetSysMatrix(&this->actor.world.pos, globalCtx, gBigslimeShadowDL, this->vtxScaleX, this->vtxScaleZ, + EnBigslime_SetSysMatrix(&this->actor.world.pos, play, gBigslimeShadowDL, this->vtxScaleX, this->vtxScaleZ, this->actor.scale.y * BIGSLIME_RADIUS_F, this->rotation, 175.0f); - EnBigslime_DrawGekko(&this->actor, globalCtx); + EnBigslime_DrawGekko(&this->actor, play); } -void EnBigslime_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBigslime_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { /* value -1: Limb Not used * value 0: GEKKO_LIMB_WAIST * value 1: GEKKO_LIMB_L_SHIN @@ -3062,83 +3058,82 @@ void EnBigslime_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnBigslime_DrawGekko(Actor* thisx, GlobalContext* globalCtx) { +void EnBigslime_DrawGekko(Actor* thisx, PlayState* play) { static Color_RGBA8 gekkoDamageColor = { 255, 0, 0, 0 }; static Color_RGBA8 gekkoStunColor = { 0, 0, 255, 0 }; Vec3f gekkoPos; EnBigslime* this = THIS; s32 pad; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->actionFunc == EnBigslime_DamageGekko) { - func_800AE434(globalCtx, &gekkoDamageColor, this->damageSpinTimer, 20); + func_800AE434(play, &gekkoDamageColor, this->damageSpinTimer, 20); } else if ((this->actionFunc == EnBigslime_CutsceneDefeat) || (this->actionFunc == EnBigslime_GekkoDespawn)) { - func_800AE434(globalCtx, &gekkoDamageColor, 20, 20); + func_800AE434(play, &gekkoDamageColor, 20, 20); } else if (this->actionFunc == EnBigslime_StunGekko) { if (this->gekkoDrawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - func_800AE434(globalCtx, &gekkoDamageColor, this->stunTimer, 80); + func_800AE434(play, &gekkoDamageColor, this->stunTimer, 80); } else if (this->gekkoDrawDmgEffType == ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL) { - func_800AE434(globalCtx, &gekkoStunColor, this->stunTimer, 40); + func_800AE434(play, &gekkoStunColor, this->stunTimer, 40); } else { - func_800AE434(globalCtx, &gekkoStunColor, this->stunTimer, 40); + func_800AE434(play, &gekkoStunColor, this->stunTimer, 40); } } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Math_Vec3f_Sum(&this->actor.world.pos, &this->gekkoPosOffset, &gekkoPos); Matrix_SetTranslateRotateYXZ(gekkoPos.x, gekkoPos.y, gekkoPos.z, &this->gekkoRot); Matrix_Scale(this->gekkoScale, this->gekkoScale, this->gekkoScale, MTXMODE_APPLY); - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &gekkoPos, &this->gekkoProjectedPos); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnBigslime_PostLimbDraw, &this->actor); + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &gekkoPos, &this->gekkoProjectedPos); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnBigslime_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if ((this->actionFunc == EnBigslime_DamageGekko) || (this->actionFunc == EnBigslime_CutsceneDefeat) || (this->actionFunc == EnBigslime_GekkoDespawn) || (this->actionFunc == EnBigslime_StunGekko)) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - EnBigslime_SetSysMatrix(&gekkoPos, globalCtx, gCircleShadowDL, this->gekkoScale * (550.0f / 7.0f), + EnBigslime_SetSysMatrix(&gekkoPos, play, gCircleShadowDL, this->gekkoScale * (550.0f / 7.0f), this->gekkoScale * (550.0f / 7.0f), 0.0f, 0, 255.0f); if (this->minislimeState != MINISLIME_INACTIVE_STATE) { - EnBigslime_DrawMinislime(this, globalCtx); + EnBigslime_DrawMinislime(this, play); } - EnBigslime_DrawShatteringEffects(this, globalCtx); + EnBigslime_DrawShatteringEffects(this, play); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->gekkoScale * (999.99991f / 7.0f) * this->gekkoDrawDmgEffScale, this->gekkoDrawDmgEffFrozenSteamScale, this->gekkoDrawDmgEffAlpha, this->gekkoDrawDmgEffType); } -void EnBigslime_DrawShatteringEffects(EnBigslime* this, GlobalContext* globalCtx) { +void EnBigslime_DrawShatteringEffects(EnBigslime* this, PlayState* play) { EnBigslimeIceShardEffect* iceShardEffect; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); // Draw Shockwave if (this->shockwaveAlpha > 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, this->shockwaveAlpha); gSPSegment(POLY_XLU_DISP++, 0x0D, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames % 128, - (u8)(globalCtx->gameplayFrames * 8), 32, 64, 1, - (-globalCtx->gameplayFrames * 2) % 64, 0, 16, 16)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->gameplayFrames % 128, (u8)(play->gameplayFrames * 8), + 32, 64, 1, (-play->gameplayFrames * 2) % 64, 0, 16, 16)); Matrix_Translate(this->frozenPos.x, this->frozenPos.y, this->frozenPos.z, MTXMODE_NEW); Matrix_Scale(this->shockwaveScale, this->shockwaveScale, this->shockwaveScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeShockwaveDL); } // Draw Ice Shards - AnimatedMat_Draw(globalCtx, this->iceShardTexAnim); + AnimatedMat_Draw(play, this->iceShardTexAnim); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeIceShardDL); for (i = 0; i < BIGSLIME_NUM_ICE_SHARD; i++) { @@ -3147,11 +3142,10 @@ void EnBigslime_DrawShatteringEffects(EnBigslime* this, GlobalContext* globalCtx Matrix_SetTranslateRotateYXZ(iceShardEffect->pos.x, iceShardEffect->pos.y, iceShardEffect->pos.z, &iceShardEffect->rot); Matrix_Scale(iceShardEffect->scale, iceShardEffect->scale, iceShardEffect->scale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gBigslimeIceShardVtxDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 1005ccff5f..c66dd78507 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -7,7 +7,7 @@ struct EnBigslime; -typedef void (*EnBigslimeActionFunc)(struct EnBigslime*, GlobalContext*); +typedef void (*EnBigslimeActionFunc)(struct EnBigslime*, PlayState*); #define BIGSLIME_NUM_VTX 162 // Number of vertices #define BIGSLIME_NUM_FACES 320 // Number of triangles diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 3524343d8b..985089dbce 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -11,25 +11,24 @@ #define THIS ((EnBji01*)thisx) -void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBji01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBji01_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBji01_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBji01_Init(Actor* thisx, PlayState* play); +void EnBji01_Destroy(Actor* thisx, PlayState* play); +void EnBji01_Update(Actor* thisx, PlayState* play); +void EnBji01_Draw(Actor* thisx, PlayState* play); -void func_809CCE98(EnBji01* this, GlobalContext* globalCtx); -void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx); -void func_809CD028(EnBji01* this, GlobalContext* globalCtx); -void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx); -void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx); -void func_809CD634(EnBji01* this, GlobalContext* globalCtx); -void EnBji01_DoNothing(EnBji01* this, GlobalContext* globalCtx); -void func_809CD6C0(EnBji01* this, GlobalContext* globalCtx); -void func_809CD70C(EnBji01* this, GlobalContext* globalCtx); -void func_809CD77C(EnBji01* this, GlobalContext* globalCtx); +void func_809CCE98(EnBji01* this, PlayState* play); +void func_809CCEE8(EnBji01* this, PlayState* play); +void func_809CD028(EnBji01* this, PlayState* play); +void EnBji01_DialogueHandler(EnBji01* this, PlayState* play); +void func_809CCDE0(EnBji01* this, PlayState* play); +void func_809CD634(EnBji01* this, PlayState* play); +void EnBji01_DoNothing(EnBji01* this, PlayState* play); +void func_809CD6C0(EnBji01* this, PlayState* play); +void func_809CD70C(EnBji01* this, PlayState* play); +void func_809CD77C(EnBji01* this, PlayState* play); -s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx); -void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); +s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnBji01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); const ActorInit En_Bji_01_InitVars = { ACTOR_EN_BJI_01, @@ -71,8 +70,8 @@ static AnimationSpeedInfo D_809CDC7C[] = { { &object_bji_Anim_00066C, 1.0f, ANIMMODE_ONCE, -5.0f }, /* Scratching chin? */ }; -void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809CCDE0(EnBji01* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f pitchTarget; s32 pad[2]; @@ -83,13 +82,13 @@ void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx) { &this->torsoZRotStep, &this->torsoXRotStep, 0x1554, 0x1FFE, 0xE38, 0x1C70); } -void func_809CCE98(EnBji01* this, GlobalContext* globalCtx) { +void func_809CCE98(EnBji01* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 0, &this->animationIndex); this->actor.textId = 0; this->actionFunc = func_809CCEE8; } -void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx) { +void func_809CCEE8(EnBji01* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x444); if (this->actor.params == ENBJI01_PARAMS_DEFAULT) { if ((this->actor.xzDistToPlayer <= 60.0f) && (this->actor.playerHeightRel <= 10.0f)) { @@ -98,24 +97,24 @@ void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10000; } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_809CD028(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + func_809CD028(this, play); } else { if (this->moonsTear != NULL) { if (this->moonsTear->actor.colChkInfo.health == 1) { - func_809CD6C0(this, globalCtx); + func_809CD6C0(this, play); return; } } else { - this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); + this->moonsTear = (ObjMoonStone*)SubS_FindActor(play, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); } - func_800B8500(&this->actor, globalCtx, 60.0f, 10.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 60.0f, 10.0f, EXCH_ITEM_NONE); } } -void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { +void func_809CD028(EnBji01* this, PlayState* play) { f32 timeBeforeMoonCrash; switch (this->actor.params) { @@ -135,7 +134,7 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { } break; case PLAYER_FORM_HUMAN: - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->textId = 0x236A; } else if (gSaveContext.save.weekEventReg[74] & 0x10) { this->textId = 0x5F6; @@ -163,7 +162,7 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { } else { this->textId = 0x5F1; } - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, EXCH_ITEM_NONE); break; case PLAYER_FORM_HUMAN: @@ -197,37 +196,37 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { this->actionFunc = EnBji01_DialogueHandler; } -void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x444); - func_809CCDE0(this, globalCtx); + func_809CCDE0(this, play); if (this->actor.shape.rot.y == this->actor.yawTowardsPlayer) { - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } break; case 4: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_801477B4(globalCtx); - func_809CD634(this, globalCtx); + func_801477B4(play); + func_809CD634(this, play); break; case 1: func_8019F230(); switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - func_80151938(globalCtx, 0x5F0); + func_80151938(play, 0x5F0); break; case PLAYER_FORM_HUMAN: - func_80151938(globalCtx, 0x5F8); + func_80151938(play, 0x5F8); break; case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: - func_80151938(globalCtx, 0x5E1); + func_80151938(play, 0x5E1); break; } break; @@ -235,21 +234,21 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0x5DE: SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 3, &this->animationIndex); - func_80151938(globalCtx, 0x5DF); + func_80151938(play, 0x5DF); break; case 0x5E4: - func_80151938(globalCtx, 0x5E7); + func_80151938(play, 0x5E7); break; case 0x5E5: - func_80151938(globalCtx, 0x5E0); + func_80151938(play, 0x5E0); break; case 0x5E7: - func_80151938(globalCtx, 0x5E5); + func_80151938(play, 0x5E5); break; case 0x5DC: case 0x5DD: @@ -259,11 +258,11 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { case 0x5EE: case 0x5F2: case 0x5F5: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x5F0: case 0x5F6: - func_80151938(globalCtx, 0x5EF); + func_80151938(play, 0x5EF); break; case 0x5E1: case 0x5E8: @@ -275,10 +274,10 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { case 0x5F4: case 0x5F7: case 0x5F8: - func_801477B4(globalCtx); + func_801477B4(play); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; - func_809CCE98(this, globalCtx); + func_809CCE98(this, play); break; } } @@ -286,7 +285,7 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { case 6: this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; this->actor.flags &= ~ACTOR_FLAG_10000; - func_809CCE98(this, globalCtx); + func_809CCE98(this, play); break; } if ((this->animationIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { @@ -294,46 +293,46 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) { } } -void func_809CD634(EnBji01* this, GlobalContext* globalCtx) { +void func_809CD634(EnBji01* this, PlayState* play) { func_801A5BD0(0x6F); Audio_QueueSeqCmd(0xE0000101); - globalCtx->nextEntranceIndex = 0x54A0; /* Termina Field from telescope */ - gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; - func_80169EFC(&globalCtx->state); /* Load new entrance? */ + play->nextEntranceIndex = 0x54A0; /* Termina Field from telescope */ + gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + func_80169EFC(&play->state); /* Load new entrance? */ gSaveContext.respawnFlag = -2; this->actionFunc = EnBji01_DoNothing; } -void EnBji01_DoNothing(EnBji01* this, GlobalContext* globalCtx) { +void EnBji01_DoNothing(EnBji01* this, PlayState* play) { } -void func_809CD6C0(EnBji01* this, GlobalContext* globalCtx) { +void func_809CD6C0(EnBji01* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 2, &this->animationIndex); this->actionFunc = func_809CD70C; } -void func_809CD70C(EnBji01* this, GlobalContext* globalCtx) { +void func_809CD70C(EnBji01* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x444); - func_809CCDE0(this, globalCtx); + func_809CCDE0(this, play); if (this->actor.shape.rot.y == this->actor.yawTowardsPlayer) { - Actor_ChangeFocus(&this->moonsTear->actor, globalCtx, &this->actor); /* Z-Target the Moon's Tear? */ + Actor_ChangeFocus(&this->moonsTear->actor, play, &this->actor); /* Z-Target the Moon's Tear? */ this->actionFunc = func_809CD77C; } } -void func_809CD77C(EnBji01* this, GlobalContext* globalCtx) { +void func_809CD77C(EnBji01* this, PlayState* play) { if (this->moonsTear->actor.colChkInfo.health == 0) { - func_809CCE98(this, globalCtx); + func_809CCE98(this, play); } } -void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBji01_Init(Actor* thisx, PlayState* play) { EnBji01* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bji_Skel_00578C, &object_bji_Anim_000FDC, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bji_Skel_00578C, &object_bji_Anim_000FDC, this->jointTable, this->morphTable, BJI_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 0; @@ -342,20 +341,20 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); - this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); + this->moonsTear = (ObjMoonStone*)SubS_FindActor(play, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); switch (gSaveContext.save.entranceIndex) { case 0x4C00: /* Observatory from ECT */ case 0x4C10: /* Observatory from Termina Field door */ this->actor.params = ENBJI01_PARAMS_DEFAULT; - func_809CCE98(this, globalCtx); + func_809CCE98(this, play); break; case 0x4C20: /* Observatory from Termina Field telescope */ this->actor.flags |= ACTOR_FLAG_10000; func_801A5BD0(0); Audio_QueueSeqCmd(0xE0000100); this->actor.params = ENBJI01_PARAMS_LOOKED_THROUGH_TELESCOPE; - func_809CCE98(this, globalCtx); + func_809CCE98(this, play); break; default: Actor_MarkForDeath(&this->actor); @@ -363,19 +362,19 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBji01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBji01_Destroy(Actor* thisx, PlayState* play) { EnBji01* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnBji01_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBji01_Update(Actor* thisx, PlayState* play) { static s16 sBlinkSequence[] = { 0, 1, 2, 1, 0, 0 }; EnBji01* this = THIS; s32 pad; - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, (Actor*)this, 0.0f, 0.0f, 0.0f, 4U); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, (Actor*)this, 0.0f, 0.0f, 0.0f, 4U); SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { @@ -389,14 +388,13 @@ void EnBji01_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 40.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBji01* this = THIS; - if ((limbIndex == BJI_LIMB_NONE) && ((globalCtx->gameplayFrames % 2) != 0)) { + if ((limbIndex == BJI_LIMB_NONE) && ((play->gameplayFrames % 2) != 0)) { *dList = NULL; } if (limbIndex == BJI_LIMB_NONE) { @@ -417,7 +415,7 @@ s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnBji01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_809CDCC8 = { 1088.0f, 1200.0f, 0.0f }; EnBji01* this = THIS; Vec3f sp20; @@ -432,14 +430,14 @@ void EnBji01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnBji01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBji01_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { object_bji_Tex_0049F0, object_bji_Tex_004E70, object_bji_Tex_005270 }; EnBji01* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(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, EnBji01_OverrideLimbDraw, EnBji01_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h index c49da8bd2a..113db6a388 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h @@ -6,7 +6,7 @@ struct EnBji01; -typedef void (*EnBji01ActionFunc)(struct EnBji01*, GlobalContext*); +typedef void (*EnBji01ActionFunc)(struct EnBji01*, PlayState*); typedef enum { /* 00 */ BJI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index dedb09d4ce..3400e5f52e 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -10,13 +10,13 @@ #define THIS ((EnBjt*)thisx) -void EnBjt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBjt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBjt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBjt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBjt_Init(Actor* thisx, PlayState* play); +void EnBjt_Destroy(Actor* thisx, PlayState* play); +void EnBjt_Update(Actor* thisx, PlayState* play); +void EnBjt_Draw(Actor* thisx, PlayState* play); -void func_80BFDA48(EnBjt* this, GlobalContext* globalCtx); -void func_80BFDAE8(EnBjt* this, GlobalContext* globalCtx); +void func_80BFDA48(EnBjt* this, PlayState* play); +void func_80BFDAE8(EnBjt* this, PlayState* play); #if 0 const ActorInit En_Bjt_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h index 72802294c4..54ed04c40c 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h @@ -5,7 +5,7 @@ struct EnBjt; -typedef void (*EnBjtActionFunc)(struct EnBjt*, GlobalContext*); +typedef void (*EnBjtActionFunc)(struct EnBjt*, PlayState*); typedef struct EnBjt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c index 5d827f4dad..29510c9d79 100644 --- a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c +++ b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c @@ -10,10 +10,10 @@ #define THIS ((EnBoj01*)thisx) -void EnBoj01_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoj01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoj01_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoj01_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoj01_Init(Actor* thisx, PlayState* play); +void EnBoj01_Destroy(Actor* thisx, PlayState* play); +void EnBoj01_Update(Actor* thisx, PlayState* play); +void EnBoj01_Draw(Actor* thisx, PlayState* play); const ActorInit En_Boj_01_InitVars = { ACTOR_EN_BOJ_01, @@ -27,11 +27,11 @@ const ActorInit En_Boj_01_InitVars = { (ActorFunc)EnBoj01_Draw, }; -void EnBoj01_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj01_Init(Actor* thisx, PlayState* play) { } -void EnBoj01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj01_Destroy(Actor* thisx, PlayState* play) { } -void EnBoj01_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj01_Update(Actor* thisx, PlayState* play) { } -void EnBoj01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj01_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c index 8e26fa09c2..d68f44bd52 100644 --- a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c +++ b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c @@ -10,10 +10,10 @@ #define THIS ((EnBoj02*)thisx) -void EnBoj02_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoj02_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoj02_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoj02_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoj02_Init(Actor* thisx, PlayState* play); +void EnBoj02_Destroy(Actor* thisx, PlayState* play); +void EnBoj02_Update(Actor* thisx, PlayState* play); +void EnBoj02_Draw(Actor* thisx, PlayState* play); const ActorInit En_Boj_02_InitVars = { ACTOR_EN_BOJ_02, @@ -27,11 +27,11 @@ const ActorInit En_Boj_02_InitVars = { (ActorFunc)EnBoj02_Draw, }; -void EnBoj02_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj02_Init(Actor* thisx, PlayState* play) { } -void EnBoj02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj02_Destroy(Actor* thisx, PlayState* play) { } -void EnBoj02_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj02_Update(Actor* thisx, PlayState* play) { } -void EnBoj02_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj02_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c index 4f9325e9d4..46477ec337 100644 --- a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c +++ b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c @@ -10,10 +10,10 @@ #define THIS ((EnBoj03*)thisx) -void EnBoj03_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoj03_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoj03_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoj03_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoj03_Init(Actor* thisx, PlayState* play); +void EnBoj03_Destroy(Actor* thisx, PlayState* play); +void EnBoj03_Update(Actor* thisx, PlayState* play); +void EnBoj03_Draw(Actor* thisx, PlayState* play); const ActorInit En_Boj_03_InitVars = { ACTOR_EN_BOJ_03, @@ -27,11 +27,11 @@ const ActorInit En_Boj_03_InitVars = { (ActorFunc)EnBoj03_Draw, }; -void EnBoj03_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj03_Init(Actor* thisx, PlayState* play) { } -void EnBoj03_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj03_Destroy(Actor* thisx, PlayState* play) { } -void EnBoj03_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj03_Update(Actor* thisx, PlayState* play) { } -void EnBoj03_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj03_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c index 09eed96c75..2e080483d0 100644 --- a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c +++ b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c @@ -10,10 +10,10 @@ #define THIS ((EnBoj04*)thisx) -void EnBoj04_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoj04_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoj04_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoj04_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoj04_Init(Actor* thisx, PlayState* play); +void EnBoj04_Destroy(Actor* thisx, PlayState* play); +void EnBoj04_Update(Actor* thisx, PlayState* play); +void EnBoj04_Draw(Actor* thisx, PlayState* play); const ActorInit En_Boj_04_InitVars = { ACTOR_EN_BOJ_04, @@ -27,11 +27,11 @@ const ActorInit En_Boj_04_InitVars = { (ActorFunc)EnBoj04_Draw, }; -void EnBoj04_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj04_Init(Actor* thisx, PlayState* play) { } -void EnBoj04_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj04_Destroy(Actor* thisx, PlayState* play) { } -void EnBoj04_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj04_Update(Actor* thisx, PlayState* play) { } -void EnBoj04_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj04_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c index d6ccba7349..3b1508b7b1 100644 --- a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c +++ b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c @@ -10,10 +10,10 @@ #define THIS ((EnBoj05*)thisx) -void EnBoj05_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBoj05_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBoj05_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBoj05_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBoj05_Init(Actor* thisx, PlayState* play); +void EnBoj05_Destroy(Actor* thisx, PlayState* play); +void EnBoj05_Update(Actor* thisx, PlayState* play); +void EnBoj05_Draw(Actor* thisx, PlayState* play); const ActorInit En_Boj_05_InitVars = { ACTOR_EN_BOJ_05, @@ -27,11 +27,11 @@ const ActorInit En_Boj_05_InitVars = { (ActorFunc)EnBoj05_Draw, }; -void EnBoj05_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj05_Init(Actor* thisx, PlayState* play) { } -void EnBoj05_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj05_Destroy(Actor* thisx, PlayState* play) { } -void EnBoj05_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj05_Update(Actor* thisx, PlayState* play) { } -void EnBoj05_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoj05_Draw(Actor* thisx, PlayState* play) { } 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 48550b6568..575f31cad0 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -11,16 +11,16 @@ #define THIS ((EnBom*)thisx) -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 func_80871058(EnBom* this, GlobalContext* globalCtx); -void func_808714D4(EnBom* this, GlobalContext* globalCtx); -void func_80872648(GlobalContext* globalCtx, Vec3f* arg1); -void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4); -void func_80872BC0(GlobalContext* globalCtx, s32 arg1); +void func_80871058(EnBom* this, PlayState* play); +void func_808714D4(EnBom* this, PlayState* play); +void func_80872648(PlayState* play, Vec3f* arg1); +void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4); +void func_80872BC0(PlayState* play, s32 arg1); typedef struct { /* 0x00 */ Vec3f unk_00; @@ -125,7 +125,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -4000, ICHAIN_STOP), }; -void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Init(Actor* thisx, PlayState* play) { EnBom* this = THIS; s32 params; @@ -138,25 +138,25 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { this->flashSpeedScale = 7; this->isPowderKeg = ENBOM_GETX_1(&this->actor); if (this->isPowderKeg) { - globalCtx->actorCtx.unk5 |= 1; + play->actorCtx.unk5 |= 1; this->timer = gSaveContext.powderKegTimer; } else { this->timer = 70; } - Collider_InitCylinder(globalCtx, &this->collider1); - Collider_InitJntSph(globalCtx, &this->collider2); - Collider_SetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider1); + Collider_InitJntSph(play, &this->collider2); + Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); if (!this->isPowderKeg) { - Collider_SetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit1, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit1, &this->collider3); this->collider1.dim.radius = 6; this->collider1.dim.height = 11; } else { - Collider_SetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit2, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, &this->collider3); this->collider1.dim.radius = 20; this->collider1.dim.height = 36; - func_80872648(globalCtx, &this->actor.world.pos); + func_80872648(play, &this->actor.world.pos); } this->collider3.info.toucher.damage += ENBOM_GETZ_FF00(thisx); @@ -171,7 +171,7 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_100000; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_808714D4; this->actor.room = -1; Actor_SetScale(&this->actor, enBomScales[this->isPowderKeg]); @@ -181,24 +181,24 @@ void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Destroy(Actor* thisx, PlayState* play) { EnBom* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider1); + Collider_DestroyJntSph(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); if (this->isPowderKeg) { - globalCtx->actorCtx.unk5 &= ~1; + play->actorCtx.unk5 &= ~1; } } -void func_80871058(EnBom* this, GlobalContext* globalCtx) { +void func_80871058(EnBom* this, PlayState* play) { static Vec3f D_80872E68[] = { { 2.0f, -6.0f, -0.3f }, { 1.5f, -5.0f, -0.6f }, { 0.2f, -6.0f, -0.1f }, }; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_808714D4; this->actor.room = -1; return; @@ -226,7 +226,7 @@ void func_80871058(EnBom* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.08f); } else { Vec3f* sp58; - u32 sp54 = func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + u32 sp54 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); Vec3f sp48; s16 sp46; f32 sp40; @@ -259,7 +259,7 @@ void func_80871058(EnBom* this, GlobalContext* globalCtx) { sp38 = sqrtf(SQ(sp40) + SQ(sp3C)); if ((sp38 < this->actor.speedXZ) || - (SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { + (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { if (sp38 > 16.0f) { this->actor.speedXZ = 16.0f; } else { @@ -290,24 +290,24 @@ void func_80871058(EnBom* this, GlobalContext* globalCtx) { this->actor.bgCheckFlags &= ~1; } } else if (this->timer >= 4) { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); } -void func_808714D4(EnBom* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { +void func_808714D4(EnBom* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { this->actionFunc = func_80871058; - this->actor.room = globalCtx->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.currRoom.num; this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; } - func_80871058(this, globalCtx); + func_80871058(this, play); } else { Math_Vec3f_ToVec3s(&this->actor.home.rot, &this->actor.parent->world.pos); if (this->isPowderKeg) { @@ -317,7 +317,7 @@ void func_808714D4(EnBom* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_1FA, 0, 2000); } -void func_808715B8(EnBom* this, GlobalContext* globalCtx) { +void func_808715B8(EnBom* this, PlayState* play) { static s16 D_80872E8C[] = { 100, 200 }; static Color_RGBA8 D_80872E90 = { 185, 140, 70, 255 }; static Color_RGBA8 D_80872E94 = { 255, 255, 255, 255 }; @@ -347,35 +347,35 @@ void func_808715B8(EnBom* this, GlobalContext* globalCtx) { } if (this->actor.params == ENBOM_1) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } - if (globalCtx->envCtx.lightSettings.diffuseColor1[0] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[0] != 0) { + play->envCtx.lightSettings.diffuseColor1[0] -= 25; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[1] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[1] != 0) { + play->envCtx.lightSettings.diffuseColor1[1] -= 25; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[2] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[2] != 0) { + play->envCtx.lightSettings.diffuseColor1[2] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[0] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.lightSettings.ambientColor[0] != 0) { + play->envCtx.lightSettings.ambientColor[0] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[1] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.lightSettings.ambientColor[1] != 0) { + play->envCtx.lightSettings.ambientColor[1] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[2] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.lightSettings.ambientColor[2] != 0) { + play->envCtx.lightSettings.ambientColor[2] -= 25; } if (this->timer == 0) { - func_80123590(globalCtx, &this->actor); + func_80123590(play, &this->actor); Actor_MarkForDeath(&this->actor); } @@ -388,9 +388,9 @@ void func_808715B8(EnBom* this, GlobalContext* globalCtx) { spB4.x = this->actor.world.pos.x + spC0.x; spB4.y = this->actor.world.pos.y + 500.0f; spB4.z = this->actor.world.pos.z + spC0.z; - if (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &spB0, &spAC, &spB4) != BGCHECK_Y_MIN) { - temp_s0 = func_800C99D4(&globalCtx->colCtx, spB0, spAC); - temp_f20 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &spB0, &spB4); + if (BgCheck_EntityRaycastFloor3(&play->colCtx, &spB0, &spAC, &spB4) != BGCHECK_Y_MIN) { + temp_s0 = func_800C99D4(&play->colCtx, spB0, spAC); + temp_f20 = BgCheck_EntityRaycastFloor1(&play->colCtx, &spB0, &spB4); if ((temp_s0 == 4) || (temp_s0 == 15) || (temp_s0 == 14)) { if (temp_s0 == 4) { @@ -410,7 +410,7 @@ void func_808715B8(EnBom* this, GlobalContext* globalCtx) { spA0.z = spB4.z; temp_f20 = Rand_ZeroFloat(250.0f); - func_800B0F18(globalCtx, &spA0, &sp94, &sp88, &sp84, &sp80, temp_f20 + 950.0f, 10, + func_800B0F18(play, &spA0, &sp94, &sp88, &sp84, &sp80, temp_f20 + 950.0f, 10, Rand_ZeroFloat(5.0f) + 14.0f); } } @@ -421,7 +421,7 @@ void func_808715B8(EnBom* this, GlobalContext* globalCtx) { static s16 D_80872E98[] = { 3, 5 }; static s16 D_80872E9C[] = { 10, 15 }; -void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Update(Actor* thisx, PlayState* play) { Vec3f spA4 = { 0.0f, 0.0f, 0.0f }; Vec3f sp98 = { 0.0f, 0.1f, 0.0f }; Vec3f sp8C = { 0.0f, 0.0f, 0.0f }; @@ -430,13 +430,13 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { Color_RGBA8 sp70 = { 255, 255, 255, 255 }; EnBom* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 2) { return; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIANT) { + if (Player_GetMask(play) == PLAYER_MASK_GIANT) { Actor_MarkForDeath(thisx); return; } @@ -445,7 +445,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_1FC--; Math_ApproachZeroF(&thisx->speedXZ, 1.0f, 1.0f); Actor_MoveWithGravity(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 35.0f, 10.0f, 36.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 4); if (this->unk_1FC == 0) { if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; @@ -455,7 +455,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { } else { thisx->gravity = -1.2f; if (this->timer != 0) { - if (!this->isPowderKeg || (func_808715B8 == this->actionFunc) || !Play_InCsMode(globalCtx)) { + if (!this->isPowderKeg || (func_808715B8 == this->actionFunc) || !Play_InCsMode(play)) { this->timer--; } } @@ -469,9 +469,9 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_1F8 = 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 35.0f, 10.0f, 36.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 0x1F); if (thisx->params == ENBOM_0) { static Vec3us D_80872ED4[] = { { 40, 20, 100 }, @@ -481,8 +481,8 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { sp74.y = 0.2f; Math_Vec3f_Copy(&sp80, &thisx->home.pos); - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, thisx, &sp80, &spA4, &sp8C); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, thisx, &sp80, &spA4, &sp8C); } if (this->isPowderKeg) { func_801A0810(&thisx->projectedPos, NA_SE_IT_BIG_BOMB_IGNIT - SFX_FLAG, @@ -494,14 +494,14 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { } sp80.y += 3.0f; - func_800B0DE0(globalCtx, &sp80, &spA4, &sp74, &sp70, &sp70, 50, 5); + func_800B0DE0(play, &sp80, &spA4, &sp74, &sp70, &sp70, 50, 5); if ((this->collider1.base.acFlags & AC_HIT) || ((this->collider1.base.ocFlags1 & OC1_HIT) && ((this->collider1.base.oc->category == ACTORCAT_ENEMY) || (this->collider1.base.oc->category == ACTORCAT_BOSS)))) { this->timer = 0; thisx->shape.rot.z = 0; - } else if ((this->timer > 100) && (func_80123F48(globalCtx, &thisx->world.pos, 30.0f, 50.0f))) { + } else if ((this->timer > 100) && (func_80123F48(play, &thisx->world.pos, 30.0f, 50.0f))) { this->timer = 100; } @@ -527,17 +527,17 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->timer == 0) { sp80 = thisx->world.pos; sp80.y += 10.0f; - if (Actor_HasParent(thisx, globalCtx)) { + if (Actor_HasParent(thisx, play)) { sp80.y += 30.0f; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, sp80.x, sp80.y - 10.0f, sp80.z, 0, 0, - 0, this->isPowderKeg); - func_800BC848(thisx, globalCtx, D_80872E98[this->isPowderKeg], D_80872E9C[this->isPowderKeg]); - globalCtx->envCtx.lightSettings.diffuseColor1[0] = globalCtx->envCtx.lightSettings.diffuseColor1[1] = - globalCtx->envCtx.lightSettings.diffuseColor1[2] = 250; - globalCtx->envCtx.lightSettings.ambientColor[0] = globalCtx->envCtx.lightSettings.ambientColor[1] = - globalCtx->envCtx.lightSettings.ambientColor[2] = 250; - func_800DFD04(&globalCtx->mainCamera, 2, 11, 8); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp80.x, sp80.y - 10.0f, sp80.z, 0, 0, 0, + this->isPowderKeg); + func_800BC848(thisx, play, D_80872E98[this->isPowderKeg], D_80872E9C[this->isPowderKeg]); + play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = + play->envCtx.lightSettings.diffuseColor1[2] = 250; + play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = + play->envCtx.lightSettings.ambientColor[2] = 250; + func_800DFD04(&play->mainCamera, 2, 11, 8); thisx->params = ENBOM_1; this->timer = 10; thisx->flags |= (0x100000 | 0x20); @@ -555,10 +555,10 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params <= ENBOM_0) { Collider_UpdateCylinder(thisx, &this->collider1); - if (!Actor_HasParent(thisx, globalCtx) && (this->unk_1F8 != 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + if (!Actor_HasParent(thisx, play) && (this->unk_1F8 != 0)) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != ENBOM_1)) { @@ -568,12 +568,12 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { sp54.x = thisx->world.pos.x; sp54.y = thisx->world.pos.y + thisx->depthInWater; sp54.z = thisx->world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp54, 70, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &sp54, 70, 500, 10); + EffectSsGRipple_Spawn(play, &sp54, 70, 500, 0); + EffectSsGRipple_Spawn(play, &sp54, 70, 500, 10); sp54.y += 10.0f; - EffectSsGSplash_Spawn(globalCtx, &sp54, NULL, NULL, 1, 500); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, sp54.x, sp54.y, sp54.z, 0, 0, 1, 200); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &thisx->world.pos, 30, NA_SE_IT_BOMB_UNEXPLOSION); + EffectSsGSplash_Spawn(play, &sp54, NULL, NULL, 1, 500); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp54.x, sp54.y, sp54.z, 0, 0, 1, 200); + SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 30, NA_SE_IT_BOMB_UNEXPLOSION); this->unk_1F4 = 0.0f; thisx->velocity.y = (KREG(83) * 0.1f) + -2.0f; thisx->gravity = (KREG(84) * 0.1f) + -0.5f; @@ -593,30 +593,28 @@ static Vec3f D_80872F04 = { 0.0f, 0.0f, 0.0f }; #include "overlays/ovl_En_Bom/ovl_En_Bom.c" -void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBom_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBom* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actor.params == ENBOM_0) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider2); if (!this->isPowderKeg) { - func_800B8050(&this->actor, globalCtx, 0); + func_800B8050(&this->actor, play, 0); Matrix_MultVec3f(&D_80872EE0, &this->actor.home.pos); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_015FA0); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateXS(0x4000, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s8)this->unk_1F4, 0, 40, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, (s8)this->unk_1F4, 0, 40, 255); @@ -640,20 +638,19 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80872F04, &sp4C); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873CA0); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_808742F8); - func_808726DC(globalCtx, &this->actor.home.pos, &sp58, &sp4C, this->timer); - func_80872BC0(globalCtx, this->timer); + func_808726DC(play, &this->actor.home.pos, &sp58, &sp4C, this->timer); + func_80872BC0(play, this->timer); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80872648(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80872648(PlayState* play, Vec3f* arg1) { EnBomStruct* ptr = &D_80874650[0]; s32 i; @@ -665,7 +662,7 @@ void func_80872648(GlobalContext* globalCtx, Vec3f* arg1) { } } -void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4) { +void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4) { s32 i; f32 temp_f20; Vec3f spCC; @@ -737,7 +734,7 @@ void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar sp90.y += 50.0f; - temp_f2 = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &spA0, &sp9C, &sp90) - ptr2->unk_00.y; + temp_f2 = BgCheck_EntityRaycastFloor3(&play->colCtx, &spA0, &sp9C, &sp90) - ptr2->unk_00.y; if (temp_f2 >= 0.0f) { spC0.y += temp_f2; if (phi_f22 < spC0.y) { @@ -768,19 +765,19 @@ void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar Math_Vec3f_Copy(arg1, &ptr->unk_00); } -void func_80872BC0(GlobalContext* globalCtx, s32 arg1) { +void func_80872BC0(PlayState* play, s32 arg1) { s32 temp_s5; s32 i; EnBomStruct* ptr = &D_80874650[0]; EnBomStruct* ptr2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); Matrix_RotateZYX(ptr->unk_1A, ptr->unk_18, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80872F98); temp_s5 = (arg1 / 240) + 1; @@ -791,7 +788,7 @@ void func_80872BC0(GlobalContext* globalCtx, s32 arg1) { Matrix_RotateZYX(ptr2->unk_1A, ptr2->unk_18, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((i % 2) == 0) { gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873020); @@ -800,5 +797,5 @@ void func_80872BC0(GlobalContext* globalCtx, s32 arg1) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 a0555ab248..fe8eaadf1d 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -5,7 +5,7 @@ struct EnBom; -typedef void (*EnBomActionFunc)(struct EnBom*, GlobalContext*); +typedef void (*EnBomActionFunc)(struct EnBom*, PlayState*); #define ENBOM_GETX_1(thisx) ((thisx)->shape.rot.x & 1) #define ENBOM_GETZ_80(thisx) ((thisx)->shape.rot.z & 0x80) 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 321468424f..51d077cd90 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 @@ -11,27 +11,27 @@ #define THIS ((EnBomBowlMan*)thisx) -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 func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C51B4(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C4BC4(EnBomBowlMan* this, PlayState* play); +void func_809C4DA4(EnBomBowlMan* this, PlayState* play); +void func_809C51B4(EnBomBowlMan* this, PlayState* play); void func_809C52B4(EnBomBowlMan* this); -void func_809C5310(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C5310(EnBomBowlMan* this, PlayState* play); void func_809C53A4(EnBomBowlMan* this); -void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C5524(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C5598(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C59A4(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C59F0(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C5AA4(EnBomBowlMan* this, GlobalContext* globalCtx); -void func_809C5B1C(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C5408(EnBomBowlMan* this, PlayState* play); +void func_809C5524(EnBomBowlMan* this, PlayState* play); +void func_809C5598(EnBomBowlMan* this, PlayState* play); +void func_809C5738(EnBomBowlMan* this, PlayState* play); +void func_809C59A4(EnBomBowlMan* this, PlayState* play); +void func_809C59F0(EnBomBowlMan* this, PlayState* play); +void func_809C5AA4(EnBomBowlMan* this, PlayState* play); +void func_809C5B1C(EnBomBowlMan* this, PlayState* play); void func_809C5BA0(EnBomBowlMan* this); -void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C5BF4(EnBomBowlMan* this, PlayState* play); s32 D_809C6100 = 0; @@ -70,13 +70,13 @@ Vec3f D_809C61A0[] = { { -610.0f, 200.0f, -2350.0f }, { -570.0f, 200.0f, -2350.0f }, }; -void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { EnBomBowlMan* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, 21); this->unk_2F6 = ENBOMBOWLMAN_GET_F0(&this->actor); this->unk_2F4 = ENBOMBOWLMAN_GET_F(&this->actor); @@ -85,7 +85,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { if (this->unk_2F4 == 0) { - func_809C4BC4(this, globalCtx); + func_809C4BC4(this, play); } else { this->unk_2F4--; func_809C5BA0(this); @@ -94,7 +94,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { } this->unk_29A = ENBOMBOWLMAN_GET_FF00(&this->actor); - this->path = SubS_GetPathByIndex(globalCtx, this->unk_29A, 0x3F); + this->path = SubS_GetPathByIndex(play, this->unk_29A, 0x3F); this->unk_2C8 = 80.0f; if ((gSaveContext.save.entranceIndex == 0xD220) && (gSaveContext.save.weekEventReg[73] & 0x80) && @@ -109,7 +109,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } void func_809C493C(EnBomBowlMan* this, s32 arg1, f32 arg2) { @@ -163,7 +163,7 @@ void func_809C4B6C(EnBomBowlMan* this) { } } -void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { s32 pad; s32 i; Vec3f sp7C; @@ -181,9 +181,8 @@ void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { this->unk_2D8[code] = this; } else { Math_Vec3f_Copy(&sp7C, &D_809C61A0[i]); - bomBowlMan = - (EnBomBowlMan*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOM_BOWL_MAN, - sp7C.x, sp7C.y, sp7C.z, 0, this->actor.world.rot.y, 0, code); + bomBowlMan = (EnBomBowlMan*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_MAN, + sp7C.x, sp7C.y, sp7C.z, 0, this->actor.world.rot.y, 0, code); if (bomBowlMan != NULL) { if (i == 2) { this->unk_2D8[0] = bomBowlMan; @@ -209,11 +208,11 @@ void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actionFunc = func_809C4DA4; } -void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { Math_SmoothStepToS(&this->unk_290, this->unk_2D4, 1, 5000, 0); if (this->unk_2B8 == 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -232,24 +231,24 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_290 = this->actor.yawTowardsPlayer; if (player->transformation == PLAYER_FORM_HUMAN) { - Message_StartTextbox(globalCtx, D_809C618C[0], &this->actor); + Message_StartTextbox(play, D_809C618C[0], &this->actor); } else { - Message_StartTextbox(globalCtx, D_809C6198[0], &this->actor); + Message_StartTextbox(play, D_809C6198[0], &this->actor); } } - if ((this->unk_2BC == 0) && (Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + if ((this->unk_2BC == 0) && (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + Player* player = GET_PLAYER(play); s32 pad; s32 sp28 = false; - func_801477B4(globalCtx); + func_801477B4(play); switch (this->unk_2C0) { case 0: this->unk_2C0 = 1; D_809C6104 = 1; - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D0)), + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->unk_2D0)), &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; @@ -270,11 +269,11 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2B8 = 2; ActorCutscene_Stop(this->unk_2D0); - func_809C59A4(this, globalCtx); + func_809C59A4(this, play); sp28 = true; } else { this->unk_2C0 = 3; - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; func_809C493C(this, 1, 1.0f); D_809C6100 = 1; if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -302,7 +301,7 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { if (this->unk_2B8 != 2) { ActorCutscene_Stop(this->unk_2D0); } - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; func_809C493C(this, 1, 1.0f); D_809C6100 = 1; this->actionFunc = func_809C5B1C; @@ -310,9 +309,9 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { break; case 5: - func_80151BB4(globalCtx, 0x24); - func_80151BB4(globalCtx, 0x25); - func_80151BB4(globalCtx, 0); + func_80151BB4(play, 0x24); + func_80151BB4(play, 0x25); + func_80151BB4(play, 0); this->actionFunc = func_809C51B4; sp28 = true; break; @@ -320,23 +319,22 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { if (!sp28) { if (player->transformation == PLAYER_FORM_HUMAN) { - func_80151938(globalCtx, D_809C618C[this->unk_2C0]); + func_80151938(play, D_809C618C[this->unk_2C0]); } else { - func_80151938(globalCtx, D_809C6198[this->unk_2C0]); + func_80151938(play, D_809C6198[this->unk_2C0]); } } } } -void func_809C51B4(EnBomBowlMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C51B4(EnBomBowlMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->msgCtx.unk120B1 == 0) && - ((globalCtx->msgCtx.msgMode == 0) || (Message_GetState(&globalCtx->msgCtx) == 6))) { - globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + if ((play->msgCtx.unk120B1 == 0) && ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == 6))) { + play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x56; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x56; gSaveContext.nextTransition = 3; gSaveContext.save.weekEventReg[75] &= (u8)~0x40; if (player->transformation == PLAYER_FORM_HUMAN) { @@ -360,13 +358,13 @@ void func_809C52B4(EnBomBowlMan* this) { this->actionFunc = func_809C5310; } -void func_809C5310(EnBomBowlMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C5310(EnBomBowlMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->actor.world.pos.x < 1510.0f) { if (player->transformation != PLAYER_FORM_DEKU) { if (this->actor.xzDistToPlayer < this->unk_2C8) { - func_800B7298(globalCtx, &this->actor, 7); + func_800B7298(play, &this->actor, 7); func_809C53A4(this); } } else { @@ -384,9 +382,9 @@ void func_809C53A4(EnBomBowlMan* this) { this->actionFunc = func_809C5408; } -void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C5408(EnBomBowlMan* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos), 1, 0x1388, 0); @@ -396,23 +394,23 @@ void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.world.pos.x, 1350.0f, 0.3f, 2.0f); Math_ApproachF(&this->actor.world.pos.z, -1800.0f, 0.3f, 2.0f); if (sqrtf(SQ(this->actor.world.pos.x - 1350.0f) + SQ(this->actor.world.pos.z + 1800.0f)) < 4.0f) { - func_809C5524(this, globalCtx); + func_809C5524(this, play); } } -void func_809C5524(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C5524(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x730; if (!(gSaveContext.save.weekEventReg[85] & 2)) { this->actor.textId = 0x72F; } func_809C493C(this, 3, 1.0f); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_809C5598; } -void func_809C5598(EnBomBowlMan* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_809C5598(EnBomBowlMan* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); if ((this->actor.textId == 0x72F) || (this->actor.textId == 0x730)) { this->actor.textId = 0x731; } else if (this->actor.textId == 0x731) { @@ -424,33 +422,32 @@ void func_809C5598(EnBomBowlMan* this, GlobalContext* globalCtx) { } else if (this->actor.textId == 0x734) { this->actor.textId = 0x715; } else if (this->actor.textId == 0x715) { - func_800B7298(globalCtx, &this->actor, 6); + func_800B7298(play, &this->actor, 6); func_809C493C(this, 17, 1.0f); - func_809C59A4(this, globalCtx); + func_809C59A4(this, play); return; } else if (this->actor.textId == 0x716) { this->actor.textId = 0x735; } else if (this->actor.textId == 0x735) { this->unk_2C2 = 0; func_809C493C(this, 17, 1.0f); - func_80151BB4(globalCtx, 0x24); - func_80151BB4(globalCtx, 0x25); - func_80151BB4(globalCtx, 0); - func_800B7298(globalCtx, &this->actor, 7); + func_80151BB4(play, 0x24); + func_80151BB4(play, 0x25); + func_80151BB4(play, 0); + func_800B7298(play, &this->actor, 7); this->actionFunc = func_809C5738; return; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } -void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C5738(EnBomBowlMan* this, PlayState* play) { s32 pad[3]; s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A0); if (this->unk_2C2 == 0) { - if ((globalCtx->msgCtx.unk120B1 == 0) && - ((globalCtx->msgCtx.msgMode == 0) || (Message_GetState(&globalCtx->msgCtx) == 6))) { + if ((play->msgCtx.unk120B1 == 0) && ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == 6))) { this->unk_2C2 = 1; func_809C4B6C(this); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -495,14 +492,14 @@ void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void func_809C59A4(EnBomBowlMan* this, GlobalContext* globalCtx) { - Actor_PickUp(&this->actor, globalCtx, GI_50, 300.0f, 300.0f); +void func_809C59A4(EnBomBowlMan* this, PlayState* play) { + Actor_PickUp(&this->actor, play, GI_50, 300.0f, 300.0f); this->unk_29C = 1; this->actionFunc = func_809C59F0; } -void func_809C59F0(EnBomBowlMan* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809C59F0(EnBomBowlMan* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { this->unk_2C0 = 3; @@ -510,26 +507,26 @@ void func_809C59F0(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x716; } - func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, -1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, -1); this->actionFunc = func_809C5AA4; } else { - Actor_PickUp(&this->actor, globalCtx, GI_50, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_50, 300.0f, 300.0f); } } -void func_809C5AA4(EnBomBowlMan* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_809C5AA4(EnBomBowlMan* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { this->actionFunc = func_809C4DA4; } else { this->actionFunc = func_809C5598; } } else { - func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, -1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, -1); } } -void func_809C5B1C(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C5B1C(EnBomBowlMan* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->unk_2D2); @@ -551,7 +548,7 @@ void func_809C5BA0(EnBomBowlMan* this) { this->actionFunc = func_809C5BF4; } -void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { +void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { f32 sp2C = this->skelAnime.curFrame; s32 sp28; @@ -574,21 +571,21 @@ void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { } if (this->unk_2F4 == 0) { - sp28 = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D2)); + sp28 = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->unk_2D2)); if (D_809C6100 > 5) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_801477B4(globalCtx); + func_801477B4(play); Camera_SetTargetActor(sp28, &this->unk_2D8[0]->actor); func_809C493C(this, 13, 1.0f); D_809C6100 = 0; if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2C0 = 5; - Message_StartTextbox(globalCtx, D_809C618C[this->unk_2C0], &this->actor); + Message_StartTextbox(play, D_809C618C[this->unk_2C0], &this->actor); } else { this->unk_2C0 = 3; - Message_StartTextbox(globalCtx, D_809C6198[this->unk_2C0], &this->actor); + Message_StartTextbox(play, D_809C6198[this->unk_2C0], &this->actor); } this->unk_29C = 0; this->actionFunc = func_809C4DA4; @@ -601,7 +598,7 @@ void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { } } -void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { EnBomBowlMan* this = THIS; if (this->unk_2BA != 0) { @@ -617,7 +614,7 @@ void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { func_809C49CC(this); Actor_SetFocus(&this->actor, 20.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 0x1388, 0); @@ -630,11 +627,10 @@ void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2F2 = (s32)Rand_ZeroFloat(60.0f) + 20; } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomBowlMan* this = THIS; if (limbIndex == 15) { @@ -672,21 +668,21 @@ TexturePtr D_809C6220[] = { object_cs_Tex_00E620, object_cs_Tex_00EA20, object_cs_Tex_00EE20, object_cs_Tex_00DD20, object_cs_Tex_00F220, }; -void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { EnBomBowlMan* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_809C6214[this->unk_2F0])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_809C6220[this->unk_2F4])); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_809C6200[this->unk_2F4])); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 6246a67564..5f630e4e6e 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 @@ -5,7 +5,7 @@ struct EnBomBowlMan; -typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, GlobalContext*); +typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); #define ENBOMBOWLMAN_GET_F(thisx) ((thisx)->params & 0xF) #define ENBOMBOWLMAN_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) 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 541fc071cc..b2b4ec362a 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 @@ -14,16 +14,16 @@ #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_WaitForRelease(EnBomChu* this, PlayState* play); void EnBomChu_SetupMove(EnBomChu* this); -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx); -void EnBomChu_WaitForDeath(EnBomChu* this, GlobalContext* globalCtx); +void EnBomChu_Move(EnBomChu* this, PlayState* play); +void EnBomChu_Explode(EnBomChu* this, PlayState* play); +void EnBomChu_WaitForDeath(EnBomChu* this, PlayState* play); const ActorInit En_Bom_Chu_InitVars = { ACTOR_EN_BOM_CHU, @@ -67,15 +67,15 @@ static EffectBlureInit2 sBlureInit = { 0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }; -void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Init(Actor* thisx, PlayState* play) { EnBomChu* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; - Effect_Add(globalCtx, &this->blure1Index, EFFECT_BLURE2, 0, 0, &sBlureInit); - Effect_Add(globalCtx, &this->blure2Index, EFFECT_BLURE2, 0, 0, &sBlureInit); + Effect_Add(play, &this->blure1Index, EFFECT_BLURE2, 0, 0, &sBlureInit); + Effect_Add(play, &this->blure2Index, EFFECT_BLURE2, 0, 0, &sBlureInit); this->timer = 120; this->actor.room = -1; @@ -84,18 +84,18 @@ void EnBomChu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnBomChu_WaitForRelease; } -void EnBomChu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Destroy(Actor* thisx, PlayState* play) { EnBomChu* this = THIS; - Effect_Destroy(globalCtx, this->blure1Index); - Effect_Destroy(globalCtx, this->blure2Index); - Collider_DestroySphere(globalCtx, &this->collider); + Effect_Destroy(play, this->blure1Index); + Effect_Destroy(play, this->blure2Index); + Collider_DestroySphere(play, &this->collider); } /** * Returns true if floorPoly is valid for the Bombchu to move on, false otherwise. */ -s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* globalCtx) { +s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState* play) { Vec3f normal; Vec3f vec; f32 angle; @@ -111,7 +111,7 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCon normal.y = COLPOLY_GET_NORMAL(floorPoly->normal.y); normal.z = COLPOLY_GET_NORMAL(floorPoly->normal.z); } else { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return false; } @@ -131,7 +131,7 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCon magnitude = Math3D_Vec3fMagnitude(&vec); if (magnitude < 0.001f) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return false; } @@ -143,7 +143,7 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, GlobalCon magnitude = Math3D_Vec3fMagnitude(&this->axisForwards); if (magnitude < 0.001f) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return false; } @@ -171,19 +171,19 @@ void EnBomChu_UpdateRotation(EnBomChu* this) { this->actor.world.rot.x = -this->actor.world.rot.x; } -void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { Player* player; if (this->timer == 0) { - EnBomChu_Explode(this, globalCtx); - } else if (Actor_HasNoParent(&this->actor, globalCtx)) { - player = GET_PLAYER(globalCtx); + EnBomChu_Explode(this, play); + } else if (Actor_HasNoParent(&this->actor, play)) { + player = GET_PLAYER(play); Math_Vec3f_Copy(&this->actor.world.pos, &player->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.shape.rot.y = player->actor.shape.rot.y; this->actor.flags |= ACTOR_FLAG_1; - func_800B8EF4(globalCtx, &this->actor); + func_800B8EF4(play, &this->actor); this->isMoving = true; this->actor.speedXZ = 8.0f; @@ -192,10 +192,10 @@ void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { } } -s32 EnBomChu_IsOnCollisionPoly(GlobalContext* globalCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, - CollisionPoly** poly, s32* bgId) { - if ((BgCheck_EntityLineTest1(&globalCtx->colCtx, posA, posB, posResult, poly, true, true, true, true, bgId)) && - (!(func_800C9A4C(&globalCtx->colCtx, *poly, *bgId) & 0x30))) { +s32 EnBomChu_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** poly, + s32* bgId) { + if ((BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, true, true, true, true, bgId)) && + (!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30))) { return true; } @@ -219,7 +219,7 @@ void EnBomChu_SetupMove(EnBomChu* this) { this->actionFunc = EnBomChu_Move; } -void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_Move(EnBomChu* this, PlayState* play) { CollisionPoly* polySide = NULL; CollisionPoly* polyUpDown = NULL; s32 bgIdSide; @@ -239,7 +239,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { lineLength = 2.0f * this->movingSpeed; if ((this->timer == 0) || (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); return; } @@ -251,20 +251,20 @@ 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 (EnBomChu_IsOnCollisionPoly(globalCtx, &posA, &posB, &posUpDown, &polyUpDown, &bgIdUpDown)) { + if (EnBomChu_IsOnCollisionPoly(play, &posA, &posB, &posUpDown, &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 (EnBomChu_IsOnCollisionPoly(globalCtx, &posA, &posB, &posSide, &polySide, &bgIdSide)) { - isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + if (EnBomChu_IsOnCollisionPoly(play, &posA, &posB, &posSide, &polySide, &bgIdSide)) { + isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polySide, play); Math_Vec3f_Copy(&this->actor.world.pos, &posSide); this->actor.floorBgId = bgIdSide; this->actor.speedXZ = 0.0f; } else { if (this->actor.floorPoly != polyUpDown) { - isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polyUpDown, globalCtx); + isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polyUpDown, play); } Math_Vec3f_Copy(&this->actor.world.pos, &posUpDown); @@ -293,8 +293,8 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { posB.z = posA.z - (this->axisLeft.z * lineLength); } - if (EnBomChu_IsOnCollisionPoly(globalCtx, &posA, &posB, &posSide, &polySide, &bgIdSide)) { - isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polySide, globalCtx); + if (EnBomChu_IsOnCollisionPoly(play, &posA, &posB, &posSide, &polySide, &bgIdSide)) { + isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polySide, play); Math_Vec3f_Copy(&this->actor.world.pos, &posSide); this->actor.floorBgId = bgIdSide; break; @@ -303,7 +303,7 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { if (i == 3) { // no collision nearby - EnBomChu_Explode(this, globalCtx); + EnBomChu_Explode(this, play); } } @@ -323,12 +323,12 @@ void EnBomChu_Move(EnBomChu* this, GlobalContext* globalCtx) { } } -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, 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); this->shouldTimerCountDown = true; this->isMoving = false; @@ -342,7 +342,7 @@ void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { if (this->actor.depthInWater > 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); } } @@ -350,7 +350,7 @@ void EnBomChu_Explode(EnBomChu* this, GlobalContext* globalCtx) { this->actionFunc = EnBomChu_WaitForDeath; } -void EnBomChu_WaitForDeath(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_WaitForDeath(EnBomChu* this, PlayState* play) { if (this->timer == 0) { Actor_MarkForDeath(&this->actor); } @@ -371,7 +371,7 @@ void EnBomChu_ActorCoordsToWorld(EnBomChu* this, Vec3f* offset, Vec3f* pos) { (this->axisForwards.z * offset->z); } -void EnBomChu_SpawnRipplesAndSplashes(EnBomChu* this, GlobalContext* globalCtx, f32 y, s32 spawnExtraRipples) { +void EnBomChu_SpawnRipplesAndSplashes(EnBomChu* this, PlayState* play, f32 y, s32 spawnExtraRipples) { s32 pad; Vec3f pos; @@ -379,21 +379,21 @@ void EnBomChu_SpawnRipplesAndSplashes(EnBomChu* this, GlobalContext* globalCtx, pos.y = y; pos.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 0); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 0); if (spawnExtraRipples) { - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &pos, 70, 500, 8); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 4); + EffectSsGRipple_Spawn(play, &pos, 70, 500, 8); } else { pos.x -= this->axisForwards.x * 10.0f; pos.z -= this->axisForwards.z * 10.0f; } pos.y += 5.0f; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 1, 450); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 1, 450); } -void EnBomChu_HandleNonSceneCollision(EnBomChu* this, GlobalContext* globalCtx) { +void EnBomChu_HandleNonSceneCollision(EnBomChu* this, PlayState* play) { Vec3f originalWorldPos; Vec3f posA; Vec3f posB; @@ -409,7 +409,7 @@ void EnBomChu_HandleNonSceneCollision(EnBomChu* this, GlobalContext* globalCtx) Math_Vec3f_Copy(&originalWorldPos, &this->actor.world.pos); Math_Vec3f_Copy(&originalAxisUp, &this->axisUp); yaw = this->actor.shape.rot.y; - BgCheck2_UpdateActorAttachedToMesh(&globalCtx->colCtx, this->actor.floorBgId, &this->actor); + BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; @@ -438,8 +438,8 @@ void EnBomChu_HandleNonSceneCollision(EnBomChu* this, GlobalContext* globalCtx) posB.y = this->actor.world.pos.y + (2.0f * this->axisUp.y); posB.z = this->actor.world.pos.z + (2.0f * this->axisUp.z); - if (EnBomChu_IsOnCollisionPoly(globalCtx, &posA, &posB, &originalWorldPos, &poly, &bgId)) { - isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, poly, globalCtx); + if (EnBomChu_IsOnCollisionPoly(play, &posA, &posB, &originalWorldPos, &poly, &bgId)) { + isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, poly, play); Math_Vec3f_Copy(&this->actor.world.pos, &originalWorldPos); this->actor.floorBgId = bgId; this->actor.speedXZ = 0.0f; @@ -453,7 +453,7 @@ void EnBomChu_HandleNonSceneCollision(EnBomChu* this, GlobalContext* globalCtx) } } -void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Update(Actor* thisx, PlayState* play) { static Vec3f sBlureP1Offset = { 0.0f, 7.0f, -6.0f }; static Vec3f sBlureP2LeftOffset = { 12.0f, 0.0f, -5.0f }; static Vec3f sBlureP2RightOffset = { -12.0f, 0.0f, -5.0f }; @@ -465,18 +465,18 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { f32 waterY; if (this->actor.floorBgId != BGCHECK_SCENE) { - EnBomChu_HandleNonSceneCollision(this, globalCtx); + EnBomChu_HandleNonSceneCollision(this, play); } if (this->shouldTimerCountDown) { this->timer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != EnBomChu_WaitForDeath) && - (SurfaceType_IsWallDamage(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { - EnBomChu_Explode(this, globalCtx); + (SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { + EnBomChu_Explode(this, play); return; } @@ -486,9 +486,9 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.worldSphere.center.y = this->actor.world.pos.y; this->collider.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); } this->actor.focus.pos.x = this->actor.world.pos.x + (20.0f * this->axisUp.x); @@ -508,13 +508,13 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { 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.depthInWater = waterY - this->actor.world.pos.y; if (this->actor.depthInWater < 0.0f) { if (this->actor.bgCheckFlags & 0x20) { - EnBomChu_SpawnRipplesAndSplashes(this, globalCtx, waterY, true); + EnBomChu_SpawnRipplesAndSplashes(this, play, waterY, true); } this->actor.bgCheckFlags &= ~0x20; @@ -522,9 +522,9 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { } if (!(this->actor.bgCheckFlags & 0x20) && (this->timer != 120)) { - EnBomChu_SpawnRipplesAndSplashes(this, globalCtx, waterY, true); + EnBomChu_SpawnRipplesAndSplashes(this, play, waterY, true); } 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 |= 0x20; @@ -535,16 +535,16 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomChu_Draw(Actor* thisx, PlayState* play) { EnBomChu* this = THIS; f32 colorIntensity; s32 blinkHalfPeriod; s32 blinkTime; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, 0); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); if (this->timer >= 40) { blinkTime = this->timer % 20; @@ -565,8 +565,8 @@ void EnBomChu_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, (s32)(colorIntensity * 209.0f) + 9, (s32)(colorIntensity * 34.0f) + 9, (s32)(colorIntensity * -35.0f) + 35, 255); Matrix_Translate(this->visualJitter * (1.0f / BOMBCHU_SCALE), 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombchuDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 30a3dab9ae..35998aeac4 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 @@ -5,7 +5,7 @@ struct EnBomChu; -typedef void (*EnBomChuActionFunc)(struct EnBomChu*, GlobalContext*); +typedef void (*EnBomChuActionFunc)(struct EnBomChu*, PlayState*); typedef struct EnBomChu { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index 479df5cd7d..b4ebb73e6d 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -10,14 +10,14 @@ #define THIS ((EnBombal*)thisx) -void EnBombal_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBombal_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBombal_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBombal_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBombal_Init(Actor* thisx, PlayState* play); +void EnBombal_Destroy(Actor* thisx, PlayState* play); +void EnBombal_Update(Actor* thisx, PlayState* play); +void EnBombal_Draw(Actor* thisx, PlayState* play); -void func_80C05B3C(EnBombal* this, GlobalContext* globalCtx); -void func_80C05C44(EnBombal* this, GlobalContext* globalCtx); -void func_80C05DE8(EnBombal* this, GlobalContext* globalCtx); +void func_80C05B3C(EnBombal* this, PlayState* play); +void func_80C05C44(EnBombal* this, PlayState* play); +void func_80C05DE8(EnBombal* this, PlayState* play); #if 0 const ActorInit En_Bombal_InitVars = { diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h index 9ac9fafa08..5731208a40 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -5,7 +5,7 @@ struct EnBombal; -typedef void (*EnBombalActionFunc)(struct EnBombal*, GlobalContext*); +typedef void (*EnBombalActionFunc)(struct EnBombal*, PlayState*); typedef struct EnBombal { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index a76c901eb0..10b952244b 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -12,18 +12,18 @@ #define THIS ((EnBombers*)thisx) -void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBombers_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBombers_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBombers_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBombers_Init(Actor* thisx, PlayState* play); +void EnBombers_Destroy(Actor* thisx, PlayState* play); +void EnBombers_Update(Actor* thisx, PlayState* play); +void EnBombers_Draw(Actor* thisx, PlayState* play); void func_80C03ACC(EnBombers* this); -void func_80C03AF4(EnBombers* this, GlobalContext* globalCtx); +void func_80C03AF4(EnBombers* this, PlayState* play); void func_80C03F64(EnBombers* this); -void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx); +void func_80C03FAC(EnBombers* this, PlayState* play); void func_80C042F8(EnBombers* this); -void func_80C04354(EnBombers* this, GlobalContext* globalCtx); -void func_80C043C8(EnBombers* this, GlobalContext* globalCtx); +void func_80C04354(EnBombers* this, PlayState* play); +void func_80C043C8(EnBombers* this, PlayState* play); const ActorInit En_Bombers_InitVars = { ACTOR_EN_BOMBERS, @@ -88,15 +88,15 @@ TexturePtr D_80C04838[] = { object_cs_Tex_00E620, object_cs_Tex_00EA20, object_cs_Tex_00EE20, object_cs_Tex_00DD20, object_cs_Tex_00F220, }; -void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers_Init(Actor* thisx, PlayState* play) { EnBombers* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -1.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphtable, 21); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.01f); @@ -119,8 +119,8 @@ void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.save.weekEventReg[75] & 0x40) { if (this->unk_2BE == ENBOMBERS_F_0) { EnBomBowlMan* bomBowlMan = (EnBomBowlMan*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM_BOWL_MAN, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); + &play->actorCtx, play, ACTOR_EN_BOM_BOWL_MAN, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); if (bomBowlMan != NULL) { s32 cs = this->actor.cutscene; @@ -146,10 +146,10 @@ void EnBombers_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBombers_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers_Destroy(Actor* thisx, PlayState* play) { EnBombers* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80C03824(EnBombers* this, s32 arg1, f32 arg2) { @@ -173,8 +173,8 @@ void func_80C038B4(EnBombers* this) { } } -void func_80C039A8(EnBombers* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C039A8(EnBombers* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_2A6 = 5; switch (player->transformation) { @@ -218,7 +218,7 @@ void func_80C03ACC(EnBombers* this) { this->actionFunc = func_80C03AF4; } -void func_80C03AF4(EnBombers* this, GlobalContext* globalCtx) { +void func_80C03AF4(EnBombers* this, PlayState* play) { CollisionPoly* colPoly; f32 curFrame = this->skelAnime.curFrame; Vec3f sp6C; @@ -238,7 +238,7 @@ void func_80C03AF4(EnBombers* this, GlobalContext* globalCtx) { sp60.z += randPlusMinusPoint5Scaled(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp60))); - if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp60, &sp6C, + if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C, &colPoly, true, false, false, true, &sp48)) { func_80C03824(this, 2, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp60); @@ -259,8 +259,8 @@ void func_80C03AF4(EnBombers* this, GlobalContext* globalCtx) { sp54.x += Math_SinS(this->actor.world.rot.y) * 60.0f; sp54.z += Math_CosS(this->actor.world.rot.y) * 60.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp6C, &colPoly, true, - false, false, true, &sp48)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C, &colPoly, true, false, + false, true, &sp48)) { this->unk_2A8 = 0; if (Rand_ZeroOne() < 0.5f) { func_80C03824(this, 16, 1.0f); @@ -293,20 +293,20 @@ void func_80C03AF4(EnBombers* this, GlobalContext* globalCtx) { break; } - if (!Text_GetFaceReaction(globalCtx, 0x12)) { - func_80C039A8(this, globalCtx); + if (!Text_GetFaceReaction(play, 0x12)) { + func_80C039A8(this, play); } else { this->unk_2A6 = 5; - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x12); + this->actor.textId = Text_GetFaceReaction(play, 0x12); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2A4 = this->actor.yawTowardsPlayer; this->collider.dim.radius = 20; this->collider.dim.height = 60; func_80C03F64(this); } else { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } @@ -317,8 +317,8 @@ void func_80C03F64(EnBombers* this) { this->actionFunc = func_80C03FAC; } -void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C03FAC(EnBombers* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp2A; Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2A4, 1, 0x1388, 0); @@ -334,9 +334,9 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { break; } - if ((this->unk_2A6 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->unk_2A6 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { sp2A = 0; - func_801477B4(globalCtx); + func_801477B4(play); this->unk_2A6 = 5; if ((this->actor.textId == 0x73D) || (this->actor.textId == 0x73E) || (this->actor.textId == 0x73F)) { @@ -344,7 +344,7 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { this->unk_2A6 = 4; sp2A = 1; } else if (this->actor.textId == 0x740) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); this->actor.textId = 0x742; sp2A = 1; @@ -364,7 +364,7 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { this->unk_2A6 = 4; sp2A = 1; } else if (this->actor.textId == 0x74C) { - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { func_8019F230(); this->actor.textId = 0x737; sp2A = 1; @@ -418,7 +418,7 @@ void func_80C03FAC(EnBombers* this, GlobalContext* globalCtx) { break; case 1: - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); break; } } @@ -434,25 +434,25 @@ void func_80C042F8(EnBombers* this) { this->actionFunc = func_80C04354; } -void func_80C04354(EnBombers* this, GlobalContext* globalCtx) { +void func_80C04354(EnBombers* this, PlayState* play) { Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x3E8, 0); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_28E = 0; this->actionFunc = func_80C043C8; } else { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } -void func_80C043C8(EnBombers* this, GlobalContext* globalCtx) { +void func_80C043C8(EnBombers* this, PlayState* play) { Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x3E8, 0); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80C042F8(this); } } -void EnBombers_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers_Update(Actor* thisx, PlayState* play) { s32 pad; EnBombers* this = THIS; @@ -472,7 +472,7 @@ void EnBombers_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80C038B4(this); Actor_SetFocus(&this->actor, 20.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 0x1388, 0); Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x1388, 0); @@ -485,14 +485,13 @@ void EnBombers_Update(Actor* thisx, GlobalContext* globalCtx) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); this->actor.uncullZoneForward = 500.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnBombers_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBombers_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBombers* this = THIS; if (limbIndex == OBJECT_CS_LIMB_0F) { @@ -511,21 +510,21 @@ s32 EnBombers_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnBombers_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers_Draw(Actor* thisx, PlayState* play) { EnBombers* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C0482C[this->unk_2B8])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C04838[this->unk_2BE])); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_80C04818[this->unk_2BE])); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBombers_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h index c51150df85..4365c1f66d 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h @@ -5,7 +5,7 @@ struct EnBombers; -typedef void (*EnBombersActionFunc)(struct EnBombers*, GlobalContext*); +typedef void (*EnBombersActionFunc)(struct EnBombers*, PlayState*); #define ENBOMBERS_GET_F(thisx) ((thisx)->params & 0xF) #define ENBOMBERS_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 8b2fa6d906..95c413bafb 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -10,18 +10,18 @@ #define THIS ((EnBombers2*)thisx) -void EnBombers2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBombers2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBombers2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBombers2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBombers2_Init(Actor* thisx, PlayState* play); +void EnBombers2_Destroy(Actor* thisx, PlayState* play); +void EnBombers2_Update(Actor* thisx, PlayState* play); +void EnBombers2_Draw(Actor* thisx, PlayState* play); -void func_80C04BA0(EnBombers2* this, GlobalContext* globalCtx); -void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx); -void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx); +void func_80C04BA0(EnBombers2* this, PlayState* play); +void func_80C04D8C(EnBombers2* this, PlayState* play); +void func_80C0520C(EnBombers2* this, PlayState* play); void func_80C04B40(EnBombers2* this); void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed); void func_80C04D00(EnBombers2* this); -void func_80C050B8(EnBombers2* this, GlobalContext* globalCtx); +void func_80C050B8(EnBombers2* this, PlayState* play); const ActorInit En_Bombers2_InitVars = { ACTOR_EN_BOMBERS2, @@ -84,16 +84,16 @@ static TexturePtr sEyeTextures[] = { static TexturePtr D_80C05920 = object_cs_Tex_00E220; -void EnBombers2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers2_Init(Actor* thisx, PlayState* play) { f32 cos; EnBombers2* this = (EnBombers2*)thisx; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->morphTable, this->jointTable, OBJECT_CS_LIMB_MAX); this->actor.targetMode = 6; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if ((gSaveContext.save.weekEventReg[73] & 0x80) || (gSaveContext.save.entranceIndex == 0xD220)) { this->actor.world.pos.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; cos = Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; @@ -107,10 +107,10 @@ void EnBombers2_Init(Actor* thisx, GlobalContext* globalCtx) { func_80C04B40(this); } -void EnBombers2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers2_Destroy(Actor* thisx, PlayState* play) { EnBombers2* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed) { @@ -133,14 +133,14 @@ void func_80C04B40(EnBombers2* this) { this->actionFunc = func_80C04BA0; } -void func_80C04BA0(EnBombers2* this, GlobalContext* globalCtx) { +void func_80C04BA0(EnBombers2* this, PlayState* play) { s32 yawDiffAbs; s16 yawDiff; Player* player; yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; yawDiffAbs = ABS_ALT(yawDiff); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); switch (player->transformation) { case PLAYER_FORM_GORON: @@ -159,18 +159,18 @@ void func_80C04BA0(EnBombers2* this, GlobalContext* globalCtx) { } this->actor.textId = sTextIds[this->textIdIndex]; - if (Text_GetFaceReaction(globalCtx, 0x15) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x15); + if (Text_GetFaceReaction(play, 0x15) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x15); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2B6 = this->actor.world.rot.y; gSaveContext.save.weekEventReg[86] |= 2; func_80C04D00(this); return; } if (yawDiffAbs < 0x3BB5) { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } @@ -189,8 +189,8 @@ void func_80C04D00(EnBombers2* this) { this->actionFunc = func_80C04D8C; } -void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C04D8C(EnBombers2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp = this->skelAnime.curFrame; if ((this->unk_2AC == 0) && (this->lastAnimFrame <= temp)) { @@ -213,14 +213,13 @@ void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { default: break; } - if ((this->unk_2CE == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { + if ((this->unk_2CE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { if (this->unk_2CE == 0xF) { s32 i; s32 correctDigits; for (i = 0; i < ARRAY_COUNT(this->correctDigitSlots); i++) { - if (!(this->correctDigitSlots[i]) && - (globalCtx->msgCtx.unk12054[i] == gSaveContext.save.bomberCode[i])) { + if (!(this->correctDigitSlots[i]) && (play->msgCtx.unk12054[i] == gSaveContext.save.bomberCode[i])) { this->correctDigitSlots[i] = true; } } @@ -233,15 +232,15 @@ void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { if (correctDigits >= 5) { this->textIdIndex = 6; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); this->unk_2CE = 5; return; } } - if (Text_GetFaceReaction(globalCtx, 0x15) != 0) { + if (Text_GetFaceReaction(play, 0x15) != 0) { this->unk_28E = 0; - func_801477B4(globalCtx); + func_801477B4(play); func_80C04B40(this); } else { s32 j; @@ -252,13 +251,13 @@ void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { case 5: case 7: this->unk_28E = 0; - func_801477B4(globalCtx); + func_801477B4(play); func_80C04B40(this); break; case 2: this->textIdIndex = 3; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->unk_2CE = 0xF; break; case 3: @@ -268,26 +267,26 @@ void func_80C04D8C(EnBombers2* this, GlobalContext* globalCtx) { this->textIdIndex = 4; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->unk_2CE = 5; break; case 4: this->textIdIndex = 5; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->unk_2CE = 5; break; case 6: - globalCtx->msgCtx.unk11F10 = 0; - func_80C050B8(this, globalCtx); + play->msgCtx.unk11F10 = 0; + func_80C050B8(this, play); break; } } } } -void func_80C050B8(EnBombers2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C050B8(EnBombers2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 homeYawToPlayer; EnBombers2_ChangeAnim(this, 2, 1.0f); @@ -306,7 +305,7 @@ void func_80C050B8(EnBombers2* this, GlobalContext* globalCtx) { this->actionFunc = func_80C0520C; } -void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx) { +void func_80C0520C(EnBombers2* this, PlayState* play) { if (this->unk_2A8 == 0) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -324,7 +323,7 @@ void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx) { this->unk_2B6 = this->actor.yawTowardsPlayer; this->actor.speedXZ = 0.0f; if (fabsf(this->actor.world.rot.y - this->actor.yawTowardsPlayer) < 100.0f) { - func_801477B4(globalCtx); + func_801477B4(play); this->unk_2CE = 5; this->textIdIndex = 7; EnBombers2_ChangeAnim(this, 6, 1.0f); @@ -334,7 +333,7 @@ void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->cutscene); this->unk_2AC = 1; this->actor.textId = sTextIds[this->textIdIndex]; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_80C04D8C; } } else { @@ -344,7 +343,7 @@ void func_80C0520C(EnBombers2* this, GlobalContext* globalCtx) { } } -void EnBombers2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers2_Update(Actor* thisx, PlayState* play) { EnBombers2* this = (EnBombers2*)thisx; f32 temp_f4; Vec3f sp34; @@ -375,7 +374,7 @@ void EnBombers2_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 20.0f); Actor_SetScale(&this->actor, 0.008f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 0xBB8, 0); Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0xBB8, 0); @@ -398,14 +397,14 @@ void EnBombers2_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.height = 0x19; } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->unk_2AC == 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } Math_Vec3f_Copy(&this->actor.world.pos, &sp34); } -s32 func_80C056D4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80C056D4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBombers2* this = THIS; if (limbIndex == OBJECT_CS_LIMB_08) { @@ -421,18 +420,18 @@ s32 func_80C056D4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnBombers2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBombers2_Draw(Actor* thisx, PlayState* play) { EnBombers2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C05920)); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(sSetPrimColorDlPtr)); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C056D4, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index ed10a84db9..a5120ffcf0 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -7,7 +7,7 @@ struct EnBombers2; -typedef void (*EnBombers2ActionFunc)(struct EnBombers2*, GlobalContext*); +typedef void (*EnBombers2ActionFunc)(struct EnBombers2*, PlayState*); typedef struct EnBombers2 { /* 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 d4633c02d1..0889c54c1f 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -11,17 +11,17 @@ #define THIS ((EnBombf*)thisx) -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_SetupAction(EnBombf* this, EnBombfActionFunc actionFunc); void func_808AEAB8(EnBombf* this, s16 arg1); -void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx); -void func_808AEE3C(EnBombf* this, GlobalContext* globalCtx); -void func_808AEF68(EnBombf* this, GlobalContext* globalCtx); -void func_808AEFD4(EnBombf* this, GlobalContext* globalCtx); +void func_808AEAE0(EnBombf* this, PlayState* play); +void func_808AEE3C(EnBombf* this, PlayState* play); +void func_808AEF68(EnBombf* this, PlayState* play); +void func_808AEFD4(EnBombf* this, PlayState* play); const ActorInit En_Bombf_InitVars = { ACTOR_EN_BOMBF, @@ -86,18 +86,18 @@ void EnBombf_SetupAction(EnBombf* this, EnBombfActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnBombf_Init(Actor* thisx, PlayState* play2) { f32 yOffset = 0.0f; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnBombf* this = THIS; Actor_SetScale(thisx, 0.01f); this->unk_1F8 = 1; - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, thisx, &sCylinderInit); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, thisx, &sJntSphInit, this->colliderJntSphElements); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); + Collider_SetJntSph(play, &this->colliderJntSph, thisx, &sJntSphInit, this->colliderJntSphElements); if (ENBOMBF_GET(thisx) == ENBOMBF_0) { yOffset = 1000.0f; @@ -114,7 +114,7 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx2) { this->timer = 140; this->unk_1FE = 15; thisx->gravity = -1.5f; - func_800BC154(globalCtx, &globalCtx->actorCtx, thisx, 3); + func_800BC154(play, &play->actorCtx, thisx, 3); thisx->colChkInfo.mass = 200; thisx->flags &= ~ACTOR_FLAG_1; EnBombf_SetupAction(this, func_808AEE3C); @@ -129,30 +129,30 @@ void EnBombf_Init(Actor* thisx, GlobalContext* globalCtx2) { thisx->uncullZoneForward += 31000.0f; } -void EnBombf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Destroy(Actor* thisx, PlayState* play) { EnBombf* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void func_808AEAB8(EnBombf* this, s16 arg1) { EnBombf_SetupAction(this, func_808AEAE0); } -void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx) { +void func_808AEAE0(EnBombf* this, PlayState* play) { s32 pad; s32 pad2; EnBombf* bombf; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad3; if (this->unk_204 >= 1.0f) { - if (Actor_HasParent(&this->actor, globalCtx)) { - bombf = (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + if (Actor_HasParent(&this->actor, play)) { + bombf = (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, ENBOMBF_0); if (bombf != NULL) { - func_800B8C20(&this->actor, &bombf->actor, globalCtx); + func_800B8C20(&this->actor, &bombf->actor, play); this->timer = 180; this->unk_204 = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PULL_UP_ROCK); @@ -170,7 +170,7 @@ void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx) { (player->transformation == PLAYER_FORM_GORON) && (player->actor.speedXZ > 15.0f)))) { this->colliderCylinder.base.acFlags &= ~AC_HIT; if (this->colliderCylinder.base.ac->category != ACTORCAT_BOSS) { - bombf = (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + bombf = (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, ENBOMBF_0); if (bombf != NULL) { bombf->unk_1F8 = 1; @@ -181,8 +181,8 @@ void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx) { } } } else { - if (func_80123F48(globalCtx, &this->actor.world.pos, 30.0f, 50.0f)) { - bombf = (EnBombf*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBF, this->actor.world.pos.x, + if (func_80123F48(play, &this->actor.world.pos, 30.0f, 50.0f)) { + bombf = (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, ENBOMBF_0); if (bombf != NULL) { bombf->timer = 100; @@ -191,8 +191,8 @@ void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx) { this->unk_204 = 0.0f; } } else { - if (!Actor_HasParent(&this->actor, globalCtx)) { - Actor_LiftActor(&this->actor, globalCtx); + if (!Actor_HasParent(&this->actor, play)) { + Actor_LiftActor(&this->actor, play); return; } player->actor.child = NULL; @@ -211,7 +211,7 @@ void func_808AEAE0(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; @@ -222,8 +222,8 @@ void func_808AEAE0(EnBombf* this, GlobalContext* globalCtx) { } } -void func_808AEE3C(EnBombf* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_808AEE3C(EnBombf* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->unk_204 = 0.0f; EnBombf_SetupAction(this, func_808AEF68); this->actor.room = -1; @@ -238,27 +238,27 @@ void func_808AEE3C(EnBombf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if (this->actor.bgCheckFlags & 2) { - func_800B8EF4(globalCtx, &this->actor); + func_800B8EF4(play, &this->actor); if (this->actor.velocity.y < -6.0f) { this->actor.velocity.y *= -0.3f; this->actor.bgCheckFlags &= ~1; } } else if (this->timer >= 4) { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } -void func_808AEF68(EnBombf* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { +void func_808AEF68(EnBombf* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { EnBombf_SetupAction(this, func_808AEE3C); this->actor.bgCheckFlags &= ~1; - func_808AEE3C(this, globalCtx); + func_808AEE3C(this, play); } else { this->actor.velocity.y = 0.0f; } } -void func_808AEFD4(EnBombf* this, GlobalContext* globalCtx) { +void func_808AEFD4(EnBombf* this, PlayState* play) { if (this->colliderJntSph.elements->dim.modelSphere.radius == 0) { this->actor.flags |= ACTOR_FLAG_20; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); @@ -268,35 +268,35 @@ void func_808AEFD4(EnBombf* this, GlobalContext* globalCtx) { this->colliderJntSph.elements->dim.worldSphere.radius = 100; if (ENBOMBF_GET(&this->actor) == ENBOMBF_1) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } - if (globalCtx->envCtx.lightSettings.diffuseColor1[0] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[0] != 0) { + play->envCtx.lightSettings.diffuseColor1[0] -= 25; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[1] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[1] != 0) { + play->envCtx.lightSettings.diffuseColor1[1] -= 25; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[2] != 0) { - globalCtx->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[2] != 0) { + play->envCtx.lightSettings.diffuseColor1[2] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[0] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.lightSettings.ambientColor[0] != 0) { + play->envCtx.lightSettings.ambientColor[0] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[1] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.lightSettings.ambientColor[1] != 0) { + play->envCtx.lightSettings.ambientColor[1] -= 25; } - if (globalCtx->envCtx.lightSettings.ambientColor[2] != 0) { - globalCtx->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.lightSettings.ambientColor[2] != 0) { + play->envCtx.lightSettings.ambientColor[2] -= 25; } if (this->timer == 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & 0x800) && (&this->actor == player->heldActor)) { player->actor.child = NULL; @@ -308,7 +308,7 @@ void func_808AEFD4(EnBombf* this, GlobalContext* globalCtx) { } } -void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Update(Actor* thisx, PlayState* play) { Vec3f sp8C = { 0.0f, 0.0f, 0.0f }; Vec3f sp80 = { 0.0f, 0.1f, 0.0f }; Vec3f sp74 = { 0.0f, 0.0f, 0.0f }; @@ -322,12 +322,12 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { this->timer--; } - if ((this->unk_1FC == 0) && !Actor_HasParent(&this->actor, globalCtx) && + if ((this->unk_1FC == 0) && !Actor_HasParent(&this->actor, play) && ((this->actor.xzDistToPlayer >= 20.0f) || (fabsf(this->actor.playerHeightRel) >= 80.0f))) { this->unk_1FC = 1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (ENBOMBF_GET(&this->actor) == ENBOMBF_0) { Actor_MoveWithGravity(&this->actor); @@ -335,7 +335,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.gravity != 0.0f) { DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; } @@ -354,7 +354,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_BOUND); Actor_MoveWithGravity(&this->actor); DREG(6) = 1; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; this->actor.speedXZ *= 0.7f; this->actor.bgCheckFlags &= ~8; @@ -364,7 +364,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { ((this->colliderCylinder.base.ocFlags1 & OC1_HIT) && (this->colliderCylinder.base.oc->category == 5))) { this->unk_1F8 = 1; this->timer = 0; - } else if ((this->timer > 100) && func_80123F48(globalCtx, &this->actor.world.pos, 30.0f, 50.0f)) { + } else if ((this->timer > 100) && func_80123F48(play, &this->actor.world.pos, 30.0f, 50.0f)) { this->timer = 100; } @@ -374,12 +374,12 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { sp68.y += 25.0f; if (this->timer < 127) { - if ((globalCtx->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(globalCtx, &this->actor, &sp68, &sp8C, &sp74); + if ((play->gameplayFrames % 2) == 0) { + EffectSsGSpk_SpawnFuse(play, &this->actor, &sp68, &sp8C, &sp74); } Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); sp68.y += 3.0f; - func_800B0DE0(globalCtx, &sp68, &sp8C, &sp5C, &sp58, &sp58, 0x32, 5); + func_800B0DE0(play, &sp68, &sp8C, &sp5C, &sp58, &sp58, 0x32, 5); } if ((this->timer == 3) || (this->timer == 30) || (this->timer == 50) || (this->timer == 70)) { @@ -400,20 +400,20 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { sp68 = this->actor.world.pos; sp68.y += 10.0f; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { sp68.y += 30.0f; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, sp68.x, sp68.y, sp68.z, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp68.x, sp68.y, sp68.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - globalCtx->envCtx.lightSettings.diffuseColor1[0] = globalCtx->envCtx.lightSettings.diffuseColor1[1] = - globalCtx->envCtx.lightSettings.diffuseColor1[2] = 250; - globalCtx->envCtx.lightSettings.ambientColor[0] = globalCtx->envCtx.lightSettings.ambientColor[1] = - globalCtx->envCtx.lightSettings.ambientColor[2] = 250; + play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = + play->envCtx.lightSettings.diffuseColor1[2] = 250; + play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = + play->envCtx.lightSettings.ambientColor[2] = 250; - func_800DFD04(&globalCtx->mainCamera, 2, 11, 8); + func_800DFD04(&play->mainCamera, 2, 11, 8); this->actor.params = ENBOMBF_1; this->timer = 10; @@ -430,14 +430,14 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { if (ENBOMBF_GET(&this->actor) <= ENBOMBF_0) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); if ((this->unk_204 >= 1.0f) && (this->unk_1FC != 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } if ((this->actor.scale.x >= 0.01f) && (ENBOMBF_GET(&this->actor) != ENBOMBF_1)) { if (this->actor.depthInWater >= 20.0f) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_IT_BOMB_UNEXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_IT_BOMB_UNEXPLOSION); Actor_MarkForDeath(&this->actor); } else if (this->actor.bgCheckFlags & 0x40) { this->actor.bgCheckFlags &= ~0x40; @@ -446,11 +446,11 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -Gfx* func_808AF86C(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { +Gfx* func_808AF86C(GraphicsContext* gfxCtx, PlayState* play) { Gfx* head = GRAPH_ALLOC(gfxCtx, sizeof(Gfx) * 6); Gfx* gfx = head; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(gfx++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPEndDisplayList(gfx++); @@ -458,18 +458,17 @@ Gfx* func_808AF86C(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { return head; } -void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBombf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBombf* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (ENBOMBF_GET(&this->actor) <= ENBOMBF_0) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (ENBOMBF_GET(&this->actor) != ENBOMBF_0) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bombf_DL_000340); gSPDisplayList(POLY_OPA_DISP++, object_bombf_DL_000530); @@ -480,10 +479,10 @@ 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++, (s8)this->unk_200, 20, 10, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); { - Gfx* gfx = func_808AF86C(globalCtx->state.gfxCtx, globalCtx); + Gfx* gfx = func_808AF86C(play->state.gfxCtx, play); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gfx)); } @@ -493,5 +492,5 @@ void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateSpheres(0, &this->colliderJntSph); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 b72edce8c5..209f5c91a6 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -5,7 +5,7 @@ struct EnBombf; -typedef void (*EnBombfActionFunc)(struct EnBombf*, GlobalContext*); +typedef void (*EnBombfActionFunc)(struct EnBombf*, PlayState*); #define ENBOMBF_GET(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 300679a4e5..7b6909b214 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -12,32 +12,32 @@ #define THIS ((EnBomjima*)thisx) -void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomjima_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomjima_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomjima_Init(Actor* thisx, PlayState* play); +void EnBomjima_Destroy(Actor* thisx, PlayState* play); +void EnBomjima_Update(Actor* thisx, PlayState* play); +void EnBomjima_Draw(Actor* thisx, PlayState* play); -void func_80BFEA94(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFEA94(EnBomjima* this, PlayState* play); void func_80BFEB1C(EnBomjima* this); -void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFEB64(EnBomjima* this, PlayState* play); void func_80BFEFF0(EnBomjima* this); -void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFF03C(EnBomjima* this, PlayState* play); void func_80BFF120(EnBomjima* this); -void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFF430(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFF6CC(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFFB40(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFFBC4(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFF174(EnBomjima* this, PlayState* play); +void func_80BFF430(EnBomjima* this, PlayState* play); +void func_80BFF52C(EnBomjima* this, PlayState* play); +void func_80BFF6CC(EnBomjima* this, PlayState* play); +void func_80BFF754(EnBomjima* this, PlayState* play); +void func_80BFF9B0(EnBomjima* this, PlayState* play); +void func_80BFFB40(EnBomjima* this, PlayState* play); +void func_80BFFBC4(EnBomjima* this, PlayState* play); void func_80BFFCFC(EnBomjima* this); -void func_80BFFD48(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFFE48(EnBomjima* this, GlobalContext* globalCtx); -void func_80BFFF54(EnBomjima* this, GlobalContext* globalCtx); -void func_80C00168(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFFD48(EnBomjima* this, PlayState* play); +void func_80BFFE48(EnBomjima* this, PlayState* play); +void func_80BFFF54(EnBomjima* this, PlayState* play); +void func_80C00168(EnBomjima* this, PlayState* play); void func_80C00234(EnBomjima* this); -void func_80C00284(EnBomjima* this, GlobalContext* globalCtx); +void func_80C00284(EnBomjima* this, PlayState* play); static s32 D_80C009F0 = 0; static s32 D_80C009F4 = 0; @@ -106,7 +106,7 @@ s16 D_80C00AF8[] = { 0x4000, 60, 0x4000, 30, 0xC000, 30, 0xC000, 60, }; -void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjima_Init(Actor* thisx, PlayState* play) { EnBomjima* this = THIS; s32 cs; s32 i; @@ -114,9 +114,9 @@ void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, OBJECT_CS_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); gSaveContext.save.weekEventReg[83] &= (u8)~4; this->actor.targetMode = 0; this->unk_2E6 = ENBOMJIMA_GET_F0(&this->actor); @@ -145,14 +145,14 @@ void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnBomjima_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjima_Destroy(Actor* thisx, PlayState* play) { EnBomjima* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80BFE32C(EnBomjima* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { + Player* player = GET_PLAYER(play); this->unk_2CA = arg2; if (player->transformation == PLAYER_FORM_GORON) { @@ -235,7 +235,7 @@ void func_80BFE65C(EnBomjima* this) { this->unk_29A = 0; } -void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFE67C(EnBomjima* this, PlayState* play) { f32 sp84 = this->skelAnime.curFrame; f32 x; f32 z; @@ -259,7 +259,7 @@ void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { sp54.z += randPlusMinusPoint5Scaled(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); - if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp6C, + if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C, &sp50, true, false, false, true, &sp4C)) { func_80BFE494(this, 5, 1.0f); Math_Vec3f_Copy(&this->unk_2A4, &sp54); @@ -282,8 +282,8 @@ void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { sp60.x += Math_SinS(this->actor.world.rot.y) * 60.0f; sp60.z += Math_CosS(this->actor.world.rot.y) * 60.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp60, &sp6C, &sp50, true, - false, false, true, &sp4C)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C, &sp50, true, false, + false, true, &sp4C)) { this->unk_2C0 = 0; if (Rand_ZeroOne() < 0.5f) { func_80BFE494(this, 19, 1.0f); @@ -317,8 +317,8 @@ void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { } } -void func_80BFEA94(EnBomjima* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void func_80BFEA94(EnBomjima* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (actor != NULL) { if (actor->id != ACTOR_EN_BOMBAL) { @@ -343,42 +343,42 @@ void func_80BFEB1C(EnBomjima* this) { this->actionFunc = func_80BFEB64; } -void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BFEB64(EnBomjima* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad[2]; Vec3f sp40; - func_80BFE32C(this, globalCtx, 0); + func_80BFE32C(this, play, 0); if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.weekEventReg[73] & 0x20) { this->unk_2C8 = 3; - func_80BFE32C(this, globalCtx, 3); + func_80BFE32C(this, play, 3); } else if (gSaveContext.save.weekEventReg[77] & 2) { this->unk_2C8 = 11; - func_80BFE32C(this, globalCtx, 2); + func_80BFE32C(this, play, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { if (gSaveContext.save.weekEventReg[84] & 0x80) { this->unk_2C8 = 0; - func_80BFE32C(this, globalCtx, 3); + func_80BFE32C(this, play, 3); } else if (gSaveContext.save.weekEventReg[85] & 1) { this->unk_2C8 = 11; - func_80BFE32C(this, globalCtx, 2); + func_80BFE32C(this, play, 2); } } - if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + if (Text_GetFaceReaction(play, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x11); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2DC = this->actor.yawTowardsPlayer; func_80C00234(this); return; } if (ActorCutscene_GetCurrentIndex() == -1) { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } if ((this->unk_2F0->actor.update == NULL) || (this->unk_2F0->actor.colChkInfo.health == 0)) { @@ -413,8 +413,8 @@ void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx) { sp40.y = this->unk_2F0->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.z; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); - EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &sp40); + SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); + EffectSsHitMark_SpawnFixedScale(play, 0, &sp40); this->unk_2BC++; if (((s16)Rand_ZeroFloat(2.0f) + 3) < this->unk_2BC) { @@ -450,8 +450,8 @@ void func_80BFEFF0(EnBomjima* this) { this->actionFunc = func_80BFF03C; } -void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BFF03C(EnBomjima* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -461,8 +461,8 @@ void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx) { } else { player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[83] &= (u8)~4; - this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); - this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); func_80BFF120(this); } @@ -477,20 +477,20 @@ void func_80BFF120(EnBomjima* this) { this->actionFunc = func_80BFF174; } -void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFF174(EnBomjima* this, PlayState* play) { f32 sp2C = this->skelAnime.curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->unk_2C4 == 1) { ActorCutscene_Stop(this->unk_2D4[0]); this->unk_2DE = 1; } - if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + if (Text_GetFaceReaction(play, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x11); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2DC = this->actor.yawTowardsPlayer; func_80C00234(this); return; @@ -508,7 +508,7 @@ void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.weekEventReg[73] & 0x20) { this->unk_2C8 = 3; - func_80BFE32C(this, globalCtx, 3); + func_80BFE32C(this, play, 3); } else { if (!(gSaveContext.save.weekEventReg[77] & 2)) { if (this->unk_2E8 == 0) { @@ -519,12 +519,12 @@ void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { } else { this->unk_2C8 = 11; } - func_80BFE32C(this, globalCtx, 2); + func_80BFE32C(this, play, 2); } } else if (player->transformation == PLAYER_FORM_HUMAN) { if (gSaveContext.save.weekEventReg[84] & 0x80) { this->unk_2C8 = 0; - func_80BFE32C(this, globalCtx, 3); + func_80BFE32C(this, play, 3); } else { if (!(gSaveContext.save.weekEventReg[85] & 1)) { if (this->unk_2EA == 0) { @@ -535,17 +535,17 @@ void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { } else { this->unk_2C8 = 11; } - func_80BFE32C(this, globalCtx, 2); + func_80BFE32C(this, play, 2); } } else if (this->unk_2CA != 1) { - func_80BFE32C(this, globalCtx, 1); + func_80BFE32C(this, play, 1); } if (this->unk_2DE != 0) { if (this->unk_2BC >= 5) { - func_80BFE67C(this, globalCtx); + func_80BFE67C(this, play); } - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } @@ -555,20 +555,20 @@ void func_80BFF3F0(EnBomjima* this) { this->actionFunc = func_80BFF430; } -void func_80BFF430(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFF430(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->unk_2CC <= curFrame) { - EnBombal* bombal = (EnBombal*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBAL, this->unk_2B0.x, + EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBAL, this->unk_2B0.x, this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0); if (bombal != NULL) { bombal->unk_150 = 0.0f; bombal->unk_14C = this->unk_2F4; - Actor_ChangeFocus(&this->actor, globalCtx, &bombal->actor); + Actor_ChangeFocus(&this->actor, play, &bombal->actor); gSaveContext.save.weekEventReg[83] &= (u8)~4; func_80BFE65C(this); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BFEA94; } } @@ -580,11 +580,11 @@ void func_80BFF4F4(EnBomjima* this) { this->actionFunc = func_80BFF52C; } -void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { - Player* player = GET_PLAYER(globalCtx); +void func_80BFF52C(EnBomjima* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); + if (play->msgCtx.choiceIndex == 0) { + Player* player = GET_PLAYER(play); func_8019F208(); func_80BFE65C(this); @@ -596,13 +596,13 @@ void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx) { } else { this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); play_sound(NA_SE_SY_FOUND); func_80BFE494(this, 15, 1.0f); this->unk_2A0 = 5; this->actionFunc = func_80BFF6CC; } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_8019F230(); func_80BFE65C(this); @@ -614,26 +614,26 @@ void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx) { this->actor.textId = D_80C00A70[this->unk_2C8]; this->unk_2EA = 1; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); func_80C00234(this); } } } -void func_80BFF6CC(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->unk_2CC <= curFrame) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80BFE494(this, 1, 1.0f); this->actionFunc = func_80BFF754; } } } -void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BFF754(EnBomjima* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f spA0; EnBombal* temp_s3; s32 i; @@ -663,8 +663,8 @@ void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx) { spA0.y += y * (2.0f + (i * 0.2f)); spA0.z += z * (2.0f + (i * 0.2f)); - temp_s3 = (EnBombal*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOMJIMA, spA0.x, - spA0.y, spA0.z, 0, 0, 0, i + 32); + temp_s3 = (EnBombal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y, + spA0.z, 0, 0, 0, i + 32); if (temp_s3 != NULL) { s32 index = (i * 2) - 2; @@ -682,9 +682,9 @@ void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx) { this->actionFunc = func_80BFF9B0; } -void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFF9B0(EnBomjima* this, PlayState* play) { if (D_80C009F0 >= 4) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); D_80C009F0 = 0; this->unk_2C8 = 9; @@ -723,14 +723,14 @@ void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx) { } else { this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->actionFunc = func_80BFFB40; } } -void func_80BFFB40(EnBomjima* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_80BFFB40(EnBomjima* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80BFE494(this, 15, 1.0f); D_80C009F0 = 100; this->unk_2DC = 0; @@ -738,7 +738,7 @@ void func_80BFFB40(EnBomjima* this, GlobalContext* globalCtx) { } } -void func_80BFFBC4(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFFBC4(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if ((this->unk_2EC != 1) && (this->unk_2CC <= curFrame)) { @@ -756,11 +756,11 @@ void func_80BFFBC4(EnBomjima* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_290, this->unk_2DC, 1, 5000, 0); if (D_80C009F0 >= 104) { D_80C009F0 = 0; - func_801477B4(globalCtx); - globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + func_801477B4(play); + play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 20; - globalCtx->unk_1887F = 0x56; + play->sceneLoadFlag = 20; + play->unk_1887F = 0x56; gSaveContext.nextTransition = 3; ActorCutscene_Stop(this->unk_2D4[1]); } @@ -773,7 +773,7 @@ void func_80BFFCFC(EnBomjima* this) { this->actionFunc = func_80BFFD48; } -void func_80BFFD48(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFFD48(EnBomjima* this, PlayState* play) { s32 pad[2]; this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); @@ -788,7 +788,7 @@ void func_80BFFD48(EnBomjima* this, GlobalContext* globalCtx) { } } -void func_80BFFE48(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFFE48(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, 4.0f); Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, 4.0f); @@ -811,7 +811,7 @@ void func_80BFFE48(EnBomjima* this, GlobalContext* globalCtx) { } } -void func_80BFFF54(EnBomjima* this, GlobalContext* globalCtx) { +void func_80BFFF54(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->unk_290, this->unk_2DC, 1, 5000, 0); @@ -857,8 +857,8 @@ void func_80C0011C(EnBomjima* this) { this->actionFunc = func_80C00168; } -void func_80C00168(EnBomjima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C00168(EnBomjima* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2C8 = 4; @@ -866,18 +866,18 @@ void func_80C00168(EnBomjima* this, GlobalContext* globalCtx) { this->unk_2C8 = 7; } - func_80BFE32C(this, globalCtx, 0); - func_80BFE67C(this, globalCtx); + func_80BFE32C(this, play, 0); + func_80BFE67C(this, play); - if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { - this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + if (Text_GetFaceReaction(play, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(play, 0x11); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2DC = this->actor.yawTowardsPlayer; func_80C00234(this); } else { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } @@ -889,8 +889,8 @@ void func_80C00234(EnBomjima* this) { this->actionFunc = func_80C00284; } -void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C00284(EnBomjima* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sp28 = this->skelAnime.curFrame; Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); @@ -916,7 +916,7 @@ void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { break; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->collider.dim.radius = 10; this->collider.dim.height = 30; if ((this->unk_2A0 == 4) || (this->unk_2CA == 1) || ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) { @@ -930,13 +930,13 @@ void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { func_80BFF3F0(this); } else { func_80BFE65C(this); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BFEA94; } return; } - func_801477B4(globalCtx); + func_801477B4(play); switch (this->unk_2CA) { case 0: @@ -970,7 +970,7 @@ void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { } this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); if ((this->unk_2C8 == 7) || (this->unk_2C8 == 12)) { func_80BFF4F4(this); } @@ -979,7 +979,7 @@ void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { case 3: this->unk_2C8++; this->actor.textId = D_80C00A8C[this->unk_2C8]; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); if (this->unk_2C8 >= 2) { func_80BFE494(this, 17, 1.0f); } @@ -988,7 +988,7 @@ void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { } } -void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjima_Update(Actor* thisx, PlayState* play) { s32 pad; EnBomjima* this = THIS; @@ -1016,7 +1016,7 @@ void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80BFE524(this); Actor_SetFocus(&this->actor, 20.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 5000, 0); Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 1000, 0); @@ -1030,14 +1030,13 @@ void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); this->actor.uncullZoneForward = 500.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnBomjima_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBomjima_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjima* this = THIS; if (limbIndex == 8) { @@ -1066,7 +1065,7 @@ s32 EnBomjima_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL #include "overlays/ovl_En_Bomjima/ovl_En_Bomjima.c" -void EnBomjima_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjima_Draw(Actor* thisx, PlayState* play) { static Gfx* D_80C00B28[] = { gEnBomjima_D_80C00B08, gEnBomjima_D_80C00B18, gEnBomjima_D_80C00B18, gEnBomjima_D_80C00B18, gEnBomjima_D_80C00B18, @@ -1081,18 +1080,18 @@ void EnBomjima_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnBomjima* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C00B3C[this->unk_2E0])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C00B48[this->unk_2E4])); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_80C00B28[this->unk_2E4])); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomjima_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index c01e70bd51..6e4682eb30 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -5,7 +5,7 @@ struct EnBomjima; -typedef void (*EnBomjimaActionFunc)(struct EnBomjima*, GlobalContext*); +typedef void (*EnBomjimaActionFunc)(struct EnBomjima*, PlayState*); #define ENBOMJIMA_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) #define ENBOMJIMA_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 1657e031c1..da81a580c7 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -12,31 +12,31 @@ #define THIS ((EnBomjimb*)thisx) -void EnBomjimb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBomjimb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBomjimb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBomjimb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBomjimb_Init(Actor* thisx, PlayState* play); +void EnBomjimb_Destroy(Actor* thisx, PlayState* play); +void EnBomjimb_Update(Actor* thisx, PlayState* play); +void EnBomjimb_Draw(Actor* thisx, PlayState* play); void func_80C01494(EnBomjimb* this); -void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C01984(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C01A24(EnBomjimb* this, GlobalContext* globalCtx); +void func_80C014E4(EnBomjimb* this, PlayState* play); +void func_80C01984(EnBomjimb* this, PlayState* play); +void func_80C01A24(EnBomjimb* this, PlayState* play); void func_80C01B40(EnBomjimb* this); -void func_80C01B74(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C01C18(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C01CD0(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C0201C(EnBomjimb* this, GlobalContext* globalCtx); +void func_80C01B74(EnBomjimb* this, PlayState* play); +void func_80C01C18(EnBomjimb* this, PlayState* play); +void func_80C01CD0(EnBomjimb* this, PlayState* play); +void func_80C0201C(EnBomjimb* this, PlayState* play); void func_80C02108(EnBomjimb* this); -void func_80C0217C(EnBomjimb* this, GlobalContext* globalCtx); +void func_80C0217C(EnBomjimb* this, PlayState* play); void func_80C0250C(EnBomjimb* this); -void func_80C02570(EnBomjimb* this, GlobalContext* globalCtx); +void func_80C02570(EnBomjimb* this, PlayState* play); void func_80C0267C(EnBomjimb* this); -void func_80C02704(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C02A14(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C02BCC(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C02CA4(EnBomjimb* this, GlobalContext* globalCtx); -void func_80C02DAC(EnBomjimb* this, GlobalContext* globalCtx); +void func_80C02704(EnBomjimb* this, PlayState* play); +void func_80C02740(EnBomjimb* this, PlayState* play); +void func_80C02A14(EnBomjimb* this, PlayState* play); +void func_80C02BCC(EnBomjimb* this, PlayState* play); +void func_80C02CA4(EnBomjimb* this, PlayState* play); +void func_80C02DAC(EnBomjimb* this, PlayState* play); static Actor* D_80C03170 = NULL; @@ -72,15 +72,15 @@ static ColliderCylinderInit sCylinderInit = { { 20, 30, 0, { 0, 0, 0 } }, }; -void EnBomjimb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjimb_Init(Actor* thisx, PlayState* play) { EnBomjimb* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -2.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, this->morphTable, OBJECT_CS_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); @@ -148,14 +148,14 @@ void EnBomjimb_Init(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_2C6 == ENBOMJIMB_F0_0) || (this->unk_2C6 == ENBOMJIMB_F0_1) || (this->unk_2C6 != ENBOMJIMB_F0_2)) { func_80C01494(this); } else { - func_80C01984(this, globalCtx); + func_80C01984(this, play); } } -void EnBomjimb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjimb_Destroy(Actor* thisx, PlayState* play) { EnBomjimb* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80C0113C(EnBomjimb* this, s32 arg1, f32 arg2) { @@ -206,13 +206,13 @@ void func_80C012E0(EnBomjimb* this) { this->unk_290 = 0; } -s32 func_80C012FC(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80C012FC(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Play_InCsMode(globalCtx) && (this->actor.xzDistToPlayer < 40.0f) && - (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 50.0f) && (globalCtx->msgCtx.unk11F10 == 0)) { + if (!Play_InCsMode(play) && (this->actor.xzDistToPlayer < 40.0f) && + (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 50.0f) && (play->msgCtx.unk11F10 == 0)) { this->actor.speedXZ = 0.0f; - func_80C02740(this, globalCtx); + func_80C02740(this, play); return true; } return false; @@ -226,17 +226,17 @@ s32 func_80C013B4(EnBomjimb* this) { return false; } -s32 func_80C013F0(EnBomjimb* this, GlobalContext* globalCtx) { +s32 func_80C013F0(EnBomjimb* this, PlayState* play) { Actor* sp1C; if (this->collider.base.ocFlags1 & OC1_HIT) { sp1C = this->collider.base.oc; if ((sp1C->id == ACTOR_OBJ_KIBAKO) && (D_80C03170 == NULL) && (sp1C->update != NULL) && - !Actor_HasParent(sp1C, globalCtx)) { + !Actor_HasParent(sp1C, play)) { D_80C03170 = sp1C; this->unk_2E4 = sp1C; - func_80C01C18(this, globalCtx); + func_80C01C18(this, play); return true; } } @@ -250,8 +250,8 @@ void func_80C01494(EnBomjimb* this) { this->actionFunc = func_80C014E4; } -void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C014E4(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; CollisionPoly* colPoly; s16 abs; @@ -263,7 +263,7 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { Vec3f sp48; s32 sp44; - if (func_80C012FC(this, globalCtx) || func_80C013B4(this) || func_80C013F0(this, globalCtx)) { + if (func_80C012FC(this, play) || func_80C013B4(this) || func_80C013F0(this, play)) { return; } @@ -275,7 +275,7 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { sp48.z += randPlusMinusPoint5Scaled(150.0f); abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48))); - if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp48, &sp60, + if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp48, &sp60, &colPoly, true, false, false, true, &sp44)) { func_80C0113C(this, 5, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp48); @@ -295,8 +295,8 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); sp54.x += Math_SinS(this->actor.world.rot.y) * 60.0f; sp54.z += Math_CosS(this->actor.world.rot.y) * 60.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp60, &colPoly, true, - false, false, true, &sp44)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp60, &colPoly, true, false, + false, true, &sp44)) { this->unk_2AE = 0; if (Rand_ZeroOne() < 0.5f) { func_80C0113C(this, 20, 1.0f); @@ -343,11 +343,11 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { } } -void func_80C01984(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C01984(EnBomjimb* this, PlayState* play) { func_80C012E0(this); this->unk_2E4 = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x, - this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 2); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, + this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 2); if (this->unk_2E4 != NULL) { func_80C0113C(this, 11, 1.0f); } @@ -355,8 +355,8 @@ void func_80C01984(EnBomjimb* this, GlobalContext* globalCtx) { this->actionFunc = func_80C01A24; } -void func_80C01A24(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C01A24(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.gravity = -0.1f; if (this->collider.base.acFlags & AC_HIT) { @@ -390,7 +390,7 @@ void func_80C01B40(EnBomjimb* this) { this->actionFunc = func_80C01B74; } -void func_80C01B74(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C01B74(EnBomjimb* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.5f, 2.0f); if ((this->collider.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { this->collider.base.acFlags &= ~AC_HIT; @@ -404,12 +404,12 @@ void func_80C01B74(EnBomjimb* this, GlobalContext* globalCtx) { } } -void func_80C01C18(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C01C18(EnBomjimb* this, PlayState* play) { func_80C012E0(this); if (this->unk_2E4 != NULL) { if (this->unk_2E4->update != NULL) { this->unk_2E4->velocity.y = 8.0f; - this->unk_2E4->shape.rot.z = BINANG_SUB(4000, ((s16)(globalCtx->gameplayFrames & 2) * 4000)); + this->unk_2E4->shape.rot.z = BINANG_SUB(4000, ((s16)(play->gameplayFrames & 2) * 4000)); this->unk_294.x = this->unk_2E4->world.pos.x; this->unk_294.y = this->actor.world.pos.y; this->unk_294.z = this->unk_2E4->world.pos.z; @@ -420,11 +420,11 @@ void func_80C01C18(EnBomjimb* this, GlobalContext* globalCtx) { this->actionFunc = func_80C01CD0; } -void func_80C01CD0(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C01CD0(EnBomjimb* this, PlayState* play) { f32 sp3C = this->skelAnime.curFrame; s32 pad[2]; - if ((this->unk_2E4 != NULL) && ((this->unk_2E4->update == NULL) || Actor_HasParent(this->unk_2E4, globalCtx))) { + if ((this->unk_2E4 != NULL) && ((this->unk_2E4->update == NULL) || Actor_HasParent(this->unk_2E4, play))) { this->actor.draw = EnBomjimb_Draw; D_80C03170 = NULL; this->unk_2E4 = NULL; @@ -460,7 +460,7 @@ void func_80C01CD0(EnBomjimb* this, GlobalContext* globalCtx) { this->unk_2AE = 10; if ((this->unk_2E4 != NULL) && (this->unk_2E4->update != NULL)) { - if ((globalCtx->gameplayFrames % 16) == 0) { + if ((play->gameplayFrames % 16) == 0) { this->unk_2E4->shape.rot.z = -this->unk_2E4->shape.rot.z; this->unk_2E4->shape.rot.z *= 0.1f; } @@ -488,7 +488,7 @@ void func_80C01FD4(EnBomjimb* this) { this->actionFunc = func_80C0201C; } -void func_80C0201C(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C0201C(EnBomjimb* this, PlayState* play) { s16 abs = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); this->unk_290 = 0; @@ -501,11 +501,11 @@ void func_80C0201C(EnBomjimb* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2CA = 10; this->actionFunc = func_80C02A14; } else { - func_800B8614(&this->actor, globalCtx, 40.0f); + func_800B8614(&this->actor, play, 40.0f); } } @@ -520,17 +520,17 @@ void func_80C02108(EnBomjimb* this) { this->actionFunc = func_80C0217C; } -void func_80C0217C(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C0217C(EnBomjimb* this, PlayState* play) { Vec3f sp74; CollisionPoly* sp70; Vec3f sp64; s32 sp60; s32 sp5C = this->actor.floorBgId; CollisionPoly* sp58 = this->actor.floorPoly; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp50 = false; - if (func_80C012FC(this, globalCtx) || func_80C013B4(this) || func_80C013F0(this, globalCtx)) { + if (func_80C012FC(this, play) || func_80C013B4(this) || func_80C013F0(this, play)) { return; } @@ -556,8 +556,8 @@ void func_80C0217C(EnBomjimb* this, GlobalContext* globalCtx) { sp74.y += 20.0f; sp74.z += Math_CosS(this->actor.world.rot.y) * 50.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp64, &sp70, true, false, false, - true, &sp60)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp74, &sp64, &sp70, true, false, false, true, + &sp60)) { s16 temp = BINANG_SUB((this->actor.world.rot.y - this->actor.yawTowardsPlayer), 0x8000); this->unk_2D6 = temp; @@ -586,7 +586,7 @@ void func_80C0217C(EnBomjimb* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->unk_2D6 + this->unk_2D4; - if (SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, sp58, sp5C)) { + if (SurfaceType_GetSceneExitIndex(&play->colCtx, sp58, sp5C)) { s16 temp = BINANG_SUB(this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x8000); if (temp < 0) { @@ -614,10 +614,10 @@ void func_80C0250C(EnBomjimb* this) { this->actionFunc = func_80C02570; } -void func_80C02570(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C02570(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80C012FC(this, globalCtx) || func_80C013B4(this) || func_80C013F0(this, globalCtx)) { + if (func_80C012FC(this, play) || func_80C013B4(this) || func_80C013F0(this, play)) { return; } @@ -645,23 +645,23 @@ void func_80C0267C(EnBomjimb* this) { this->actionFunc = func_80C02704; } -void func_80C02704(EnBomjimb* this, GlobalContext* globalCtx) { - if (!func_80C012FC(this, globalCtx) && (this->unk_2AE == 0)) { +void func_80C02704(EnBomjimb* this, PlayState* play) { + if (!func_80C012FC(this, play) && (this->unk_2AE == 0)) { func_80C0250C(this); } } -void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C02740(EnBomjimb* this, PlayState* play) { static u16 D_80C03230[] = { 0x0721, 0x0722, 0x0723, 0x0724, 0x072C, }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); func_80C012E0(this); func_80C0113C(this, 21, 1.0f); if ((player->transformation != PLAYER_FORM_DEKU) && (player->transformation != PLAYER_FORM_HUMAN)) { func_80C0113C(this, 17, 1.0f); - Message_StartTextbox(globalCtx, 0x72E, &this->actor); + Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= 0x10000000; player->actor.freezeTimer = 3; func_80C012E0(this); @@ -673,7 +673,7 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { if (((player->transformation == PLAYER_FORM_DEKU) && !(gSaveContext.save.weekEventReg[73] & 0x10)) || ((player->transformation == PLAYER_FORM_HUMAN) && !(gSaveContext.save.weekEventReg[85] & 2))) { func_80C0113C(this, 17, 1.0f); - Message_StartTextbox(globalCtx, 0x72E, &this->actor); + Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= 0x10000000; player->actor.freezeTimer = 3; func_80C012E0(this); @@ -682,7 +682,7 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { return; } - Message_StartTextbox(globalCtx, D_80C03230[((void)0, gSaveContext.save.bombersCaughtNum)], &this->actor); + Message_StartTextbox(play, D_80C03230[((void)0, gSaveContext.save.bombersCaughtNum)], &this->actor); gSaveContext.save.bombersCaughtOrder[((void)0, gSaveContext.save.bombersCaughtNum)] = this->unk_2C8 + 1; gSaveContext.save.bombersCaughtNum++; @@ -719,8 +719,8 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { break; } - if (!Play_InCsMode(globalCtx)) { - Player* player = GET_PLAYER(globalCtx); + if (!Play_InCsMode(play)) { + Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x10000000; player->actor.freezeTimer = 3; @@ -729,8 +729,8 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) { this->actionFunc = func_80C02A14; } -void func_80C02A14(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C02A14(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; if (this->unk_2DC == 21) { @@ -755,10 +755,10 @@ void func_80C02A14(EnBomjimb* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 3; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); if ((this->unk_2CA == 8) && (gSaveContext.save.bombersCaughtNum >= 5)) { - func_80C02CA4(this, globalCtx); + func_80C02CA4(this, play); } else { if (this->unk_2CA == 8) { player->stateFlags1 &= ~0x10000000; @@ -768,14 +768,14 @@ void func_80C02A14(EnBomjimb* this, GlobalContext* globalCtx) { } } -void func_80C02BCC(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C02BCC(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 5000, 0); if (this->unk_2C0 == 0) { player->actor.freezeTimer = 3; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->unk_2C0 = 1; player->stateFlags1 &= ~0x10000000; } @@ -784,17 +784,17 @@ void func_80C02BCC(EnBomjimb* this, GlobalContext* globalCtx) { } } -void func_80C02CA4(EnBomjimb* this, GlobalContext* globalCtx) { +void func_80C02CA4(EnBomjimb* this, PlayState* play) { if (BREG(13) == 0) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[this->unk_2B2]; + play->nextEntranceIndex = play->setupExitList[this->unk_2B2]; gSaveContext.nextCutsceneIndex = 0; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; } else { - globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(5); + play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(5); gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x56; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x56; gSaveContext.nextTransition = 3; } gSaveContext.save.weekEventReg[75] |= 0x40; @@ -802,14 +802,14 @@ void func_80C02CA4(EnBomjimb* this, GlobalContext* globalCtx) { this->actionFunc = func_80C02DAC; } -void func_80C02DAC(EnBomjimb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C02DAC(EnBomjimb* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 3; } -void EnBomjimb_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnBomjimb_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnBomjimb* this = THIS; if (this->unk_2B0 != 0) { @@ -829,7 +829,7 @@ void EnBomjimb_Update(Actor* thisx, GlobalContext* globalCtx2) { func_80C011CC(this); Actor_SetFocus(&this->actor, 20.0f); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); @@ -854,17 +854,16 @@ void EnBomjimb_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->unk_2CA != 2) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnBomjimb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnBomjimb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjimb* this = THIS; if (limbIndex == 15) { @@ -889,7 +888,7 @@ s32 EnBomjimb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL #include "overlays/ovl_En_Bomjimb/ovl_En_Bomjimb.c" -void EnBomjimb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBomjimb_Draw(Actor* thisx, PlayState* play) { static Gfx* D_80C03260[] = { gEnBomjimb_D_80C03240, gEnBomjimb_D_80C03250, gEnBomjimb_D_80C03250, gEnBomjimb_D_80C03250, gEnBomjimb_D_80C03250, @@ -904,18 +903,18 @@ void EnBomjimb_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnBomjimb* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C03274[this->unk_2C2])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C03280[this->unk_2C8])); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_80C03260[this->unk_2C8])); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomjimb_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h index 7a961461c8..8b73ef9727 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h @@ -5,7 +5,7 @@ struct EnBomjimb; -typedef void (*EnBomjimbActionFunc)(struct EnBomjimb*, GlobalContext*); +typedef void (*EnBomjimbActionFunc)(struct EnBomjimb*, PlayState*); #define ENBOMJIMB_GET_F(thisx) ((thisx)->params & 0xF) #define ENBOMJIMB_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) 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 4c3f6b2411..df4adfc20f 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -11,13 +11,13 @@ #define THIS ((EnBoom*)thisx) -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_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc); -void func_808A2918(EnBoom* this, GlobalContext* globalCtx); +void func_808A2918(EnBoom* this, PlayState* play); const ActorInit En_Boom_InitVars = { ACTOR_EN_BOOM, @@ -60,13 +60,12 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_808A24DC(EnBoom* this, GlobalContext* globalCtx) { +void func_808A24DC(EnBoom* this, PlayState* play) { WaterBox* sp54; f32 sp50 = this->actor.world.pos.y; u16 sp4E = this->actor.bgCheckFlags & 0x20; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, - &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && (this->actor.world.pos.y < sp50)) { Vec3f sp40; @@ -74,7 +73,7 @@ void func_808A24DC(EnBoom* this, GlobalContext* globalCtx) { sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y - 20.0f; sp40.z = this->actor.world.pos.z; - EffectSsBubble_Spawn(globalCtx, &sp40, 20.0f, 10.0f, 20.0f, 0.13f); + EffectSsBubble_Spawn(play, &sp40, 20.0f, 10.0f, 20.0f, 0.13f); } else { this->actor.bgCheckFlags &= ~0x20; } @@ -93,20 +92,20 @@ void func_808A24DC(EnBoom* this, GlobalContext* globalCtx) { sp34.x = this->actor.prevPos.x + (sp34.x * temp_fv0); sp34.y = sp50; sp34.z = this->actor.prevPos.z + (sp34.z * temp_fv0); - EffectSsGSplash_Spawn(globalCtx, &sp34, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 300); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); - EffectSsGRipple_Spawn(globalCtx, &sp34, 100, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &sp34, 100, 500, 4); - EffectSsGRipple_Spawn(globalCtx, &sp34, 100, 500, 8); + EffectSsGRipple_Spawn(play, &sp34, 100, 500, 0); + EffectSsGRipple_Spawn(play, &sp34, 100, 500, 4); + EffectSsGRipple_Spawn(play, &sp34, 100, 500, 8); } this->actor.bgCheckFlags |= 0x40; } -void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Init(Actor* thisx, PlayState* play) { static u8 D_808A3068[4] = { 255, 255, 100, 255 }; static u8 D_808A306C[4] = { 255, 255, 100, 64 }; static u8 D_808A3070[4] = { 255, 255, 100, 0 }; @@ -130,21 +129,21 @@ void EnBoom_Init(Actor* thisx, GlobalContext* globalCtx) { sp30.unkFlag = 0; sp30.calcMode = 0; - Effect_Add(globalCtx, &this->effectIndex, 1, 0, 0, &sp30); + Effect_Add(play, &this->effectIndex, 1, 0, 0, &sp30); - 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, func_808A2918); } -void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Destroy(Actor* thisx, PlayState* play) { EnBoom* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* temp; if (player != NULL) { - Effect_Destroy(globalCtx, this->effectIndex); - Collider_DestroyQuad(globalCtx, &this->collider); + Effect_Destroy(play, this->effectIndex); + Collider_DestroyQuad(play, &this->collider); temp = this->actor.child; if (temp != NULL) { @@ -163,9 +162,9 @@ void EnBoom_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_808A2918(EnBoom* this, GlobalContext* globalCtx) { +void func_808A2918(EnBoom* this, PlayState* play) { Actor* sp7C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp74; s16 sp72; s16 sp70; @@ -211,7 +210,7 @@ void func_808A2918(EnBoom* this, GlobalContext* globalCtx) { Actor_SetSpeeds(&this->actor, 12.0f); Actor_MoveWithGravity(&this->actor); - func_808A24DC(this, globalCtx); + func_808A24DC(this, play); func_800B9010(&this->actor, NA_SE_IT_BOOMERANG_FLY - SFX_FLAG); if ((this->collider.base.atFlags & AT_HIT) && (((this->collider.base.at->id == ACTOR_EN_ITEM00) && @@ -229,13 +228,13 @@ void func_808A2918(EnBoom* this, GlobalContext* globalCtx) { Vec3f sp50; s32 pad; - sp74 = BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp50, + sp74 = BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp50, &this->actor.wallPoly, true, true, true, true, &sp5C); if (sp74 != 0) { - if (func_800B90AC(globalCtx, &this->actor, this->actor.wallPoly, sp5C, &sp50)) { + if (func_800B90AC(play, &this->actor, this->actor.wallPoly, sp5C, &sp50)) { sp74 = 0; } else { - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp50); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp50); } } @@ -282,13 +281,13 @@ void func_808A2918(EnBoom* this, GlobalContext* globalCtx) { } } -void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Update(Actor* thisx, PlayState* play) { EnBoom* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor; if (!(player->stateFlags1 & 0x20000000)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (((actor = this->actor.child) != NULL) || ((actor = this->actor.parent) != NULL)) { this->actor.focus.pos.x = (this->actor.world.pos.x + actor->world.pos.x) * 0.5f; @@ -317,13 +316,13 @@ EnBoomStruct D_808A3078[] = { { gameplay_keep_DL_06FF68, { -960.0f, 0.0f, 0.0f }, { 960.0f, 0.0f, 0.0f } }, }; -void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBoom_Draw(Actor* thisx, PlayState* play) { EnBoom* this = THIS; EnBoomStruct* sp58 = &D_808A3078[this->actor.params]; Vec3f sp4C; Vec3f sp40; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_APPLY); Matrix_RotateZS((this->actor.params != 0) ? 0x1F40 : -0x1F40, MTXMODE_APPLY); @@ -331,15 +330,15 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&sp58->unk_04, &sp4C); Matrix_MultVec3f(&sp58->unk_10, &sp40); - if (func_80126440(globalCtx, &this->collider, &this->weaponInfo, &sp4C, &sp40)) { + if (func_80126440(play, &this->collider, &this->weaponInfo, &sp4C, &sp40)) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp4C, &sp40); } - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_RotateYS(this->unk_1CD * 0x2EE0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sp58->unk_00); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 0aa09f15b0..bbc8e68e1e 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -5,7 +5,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 2b01b6e052..81ddc423ae 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -40,21 +40,21 @@ when set, gets cleared next EnBox_Update call and clip to the floor #define THIS ((EnBox*)thisx) -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 EnBox_AppearSwitchFlag(EnBox* this, GlobalContext* globalCtx); -void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx); -void func_80868AFC(EnBox* this, GlobalContext* globalCtx); -void func_80868B74(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 EnBox_AppearSwitchFlag(EnBox* this, PlayState* play); +void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play); +void func_80868AFC(EnBox* this, PlayState* play); +void func_80868B74(EnBox* this, PlayState* play); +void EnBox_WaitOpen(EnBox* this, PlayState* play); +void EnBox_Open(EnBox* this, PlayState* play); -void func_80867FBC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, s32 arg2); -void func_80867FE4(func_80867BDC_a0* arg0, GlobalContext* globalCtx); +void func_80867FBC(func_80867BDC_a0* arg0, PlayState* play, s32 arg2); +void func_80867FE4(func_80867BDC_a0* arg0, PlayState* play); const ActorInit En_Box_InitVars = { ACTOR_EN_BOX, @@ -87,7 +87,7 @@ void EnBox_SetupAction(EnBox* this, EnBoxActionFunc func) { this->actionFunc = func; } -void func_80867BDC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, Vec3f* pos) { +void func_80867BDC(func_80867BDC_a0* arg0, PlayState* play, Vec3f* pos) { arg0->pos = *pos; arg0->unk_0C = NULL; arg0->unk_10 = NULL; @@ -96,7 +96,7 @@ void func_80867BDC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, Vec3f* pos) arg0->unk_1C = 0; } -void func_80867C14(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { +void func_80867C14(func_80867BDC_a0* arg0, PlayState* play) { arg0->unk_18++; if (arg0->unk_18 > 85) { arg0->unk_18 = 85; @@ -109,19 +109,19 @@ void func_80867C14(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { } else { arg0->unk_1C++; if (arg0->unk_1C > 85) { - func_80867FE4(arg0, globalCtx); + func_80867FE4(arg0, play); } } arg0->unk_14++; } -void func_80867C8C(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { +void func_80867C8C(func_80867BDC_a0* arg0, PlayState* play) { s32 temp_s6 = arg0->unk_18 - arg0->unk_1C; s32 i; f32 pad; if (temp_s6 > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); for (i = 0; i < temp_s6; i++) { f32 temp_f0 = (f32)i / temp_s6; @@ -143,31 +143,30 @@ void func_80867C8C(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { Matrix_Scale(temp_f26, temp_f26, temp_f26, MTXMODE_APPLY); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 150, 0, 255); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); } Matrix_Pop(); gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80867FBC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, s32 arg2) { +void func_80867FBC(func_80867BDC_a0* arg0, PlayState* play, s32 arg2) { arg0->unk_0C = func_80867C14; arg0->unk_10 = func_80867C8C; arg0->unk_20 = arg2; } -void func_80867FE4(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { +void func_80867FE4(func_80867BDC_a0* arg0, PlayState* play) { arg0->unk_0C = NULL; arg0->unk_10 = NULL; - func_80867BDC(arg0, globalCtx, &arg0->pos); + func_80867BDC(arg0, play, &arg0->pos); } -void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { +void EnBox_ClipToGround(EnBox* this, PlayState* play) { s32 pad; CollisionPoly* poly; s32 bgId; @@ -177,7 +176,7 @@ void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { if (!(this->movementFlags & ENBOX_MOVE_0x80)) { pos = this->dyna.actor.world.pos; pos.y += 1.0f; - floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &poly, &bgId, &this->dyna.actor, &pos); + floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &poly, &bgId, &this->dyna.actor, &pos); if (floorHeight != BGCHECK_Y_MIN) { this->dyna.actor.world.pos.y = floorHeight; this->dyna.actor.floorHeight = floorHeight; @@ -185,7 +184,7 @@ void EnBox_ClipToGround(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Init(Actor* thisx, PlayState* play) { s32 pad; EnBox* this = THIS; s16 cutsceneIdx; @@ -200,7 +199,7 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gBoxChestCol, &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->movementFlags = 0; this->type = ENBOX_GET_TYPE(&this->dyna.actor); this->iceSmokeTimer = 0; @@ -214,22 +213,22 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.x = 0x7FFF; this->collectableFlag = 0; } else { - func_800C636C(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C636C(play, &play->colCtx.dyna, this->dyna.bgId); this->collectableFlag = (this->dyna.actor.world.rot.x & 0x7F); this->dyna.actor.world.rot.x = 0; } thisx->shape.rot.x = this->dyna.actor.world.rot.x; this->getItem = ENBOX_GET_ITEM(thisx); - if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItem == GI_NONE) { + if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItem == GI_NONE) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; animFrame = animFrameEnd; } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL)) && - !Flags_GetSwitch(globalCtx, this->switchFlag)) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + !Flags_GetSwitch(play, this->switchFlag)) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); if (Rand_ZeroOne() < 0.5f) { this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE; } @@ -239,9 +238,9 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.flags |= ACTOR_FLAG_10; } else if (((this->type == ENBOX_TYPE_BIG_ROOM_CLEAR) || (this->type == ENBOX_TYPE_SMALL_ROOM_CLEAR)) && - !Flags_GetClear(globalCtx, this->dyna.actor.room)) { + !Flags_GetClear(play, this->dyna.actor.room)) { EnBox_SetupAction(this, EnBox_AppearOnRoomClear); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); if (this->movementFlags & ENBOX_MOVE_0x80) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f; } else { @@ -253,9 +252,9 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { } else if ((this->type == ENBOX_TYPE_BIG_SONG_ZELDAS_LULLABY) || (this->type == ENBOX_TYPE_BIG_SONG_SUNS)) { } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG)) && - !Flags_GetSwitch(globalCtx, this->switchFlag)) { + !Flags_GetSwitch(play, this->switchFlag)) { EnBox_SetupAction(this, EnBox_AppearSwitchFlag); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); if (this->movementFlags & ENBOX_MOVE_0x80) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f; } else { @@ -273,14 +272,14 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; } - if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { this->dyna.actor.flags |= ACTOR_FLAG_10; } this->dyna.actor.shape.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, &gBoxChestSkel, &gBoxChestOpenAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBoxChestSkel, &gBoxChestOpenAnim, this->jointTable, this->morphTable, OBJECT_BOX_CHEST_LIMB_MAX); Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, animFrame, animFrameEnd, ANIMMODE_ONCE, 0.0f); if (Actor_IsSmallChest(this)) { @@ -303,13 +302,13 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { } cutsceneIdx = ActorCutscene_GetAdditionalCutscene(cutsceneIdx); } - func_80867BDC(&this->unk_1F4, globalCtx, &this->dyna.actor.home.pos); + func_80867BDC(&this->unk_1F4, play, &this->dyna.actor.home.pos); } -void EnBox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Destroy(Actor* thisx, PlayState* play) { EnBox* this = THIS; - 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) { @@ -329,7 +328,7 @@ void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel->z = 0.0f; } -void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnDust(EnBox* this, PlayState* play) { s32 i; Vec3f pos; Vec3f velocity; @@ -337,11 +336,11 @@ void EnBox_SpawnDust(EnBox* this, GlobalContext* globalCtx) { for (i = 0; i < 20; i++) { EnBox_RandomDustKinematic(this, &pos, &velocity, &accel); - func_800B1280(globalCtx, &pos, &velocity, &accel, 100, 30, 15); + func_800B1280(play, &pos, &velocity, &accel, 100, 30, 15); } } -void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Fall(EnBox* this, PlayState* play) { f32 yDiff; this->alpha = 255; @@ -364,7 +363,7 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { EnBox_SetupAction(this, EnBox_WaitOpen); } Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_BOUND); - 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) { @@ -374,21 +373,21 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { - func_800B8C50(&this->dyna.actor, globalCtx); +void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { + func_800B8C50(&this->dyna.actor, play); if (this->unk_1A0 >= 0) { EnBox_SetupAction(this, EnBox_Fall); - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } else if (this->unk_1A0 >= -11) { this->unk_1A0++; - } else if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + } else if (Flags_GetSwitch(play, this->switchFlag)) { this->unk_1A0++; } } -void EnBox_AppearSwitchFlag(EnBox* this, GlobalContext* globalCtx) { - func_800B8C50(&this->dyna.actor, globalCtx); - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void EnBox_AppearSwitchFlag(EnBox* this, PlayState* play) { + func_800B8C50(&this->dyna.actor, play); + if (Flags_GetSwitch(play, this->switchFlag)) { if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); EnBox_SetupAction(this, func_80868AFC); @@ -399,12 +398,12 @@ void EnBox_AppearSwitchFlag(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { - func_800B8C50(&this->dyna.actor, globalCtx); - if (Flags_GetClearTemp(globalCtx, this->dyna.actor.room)) { +void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { + func_800B8C50(&this->dyna.actor, play); + if (Flags_GetClearTemp(play, this->dyna.actor.room)) { if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); - Flags_SetClear(globalCtx, this->dyna.actor.room); + Flags_SetClear(play, this->dyna.actor.room); EnBox_SetupAction(this, func_80868AFC); this->unk_1A0 = -30; } else { @@ -413,17 +412,17 @@ void EnBox_AppearOnRoomClear(EnBox* this, GlobalContext* globalCtx) { } } -void func_80868AFC(EnBox* this, GlobalContext* globalCtx) { +void func_80868AFC(EnBox* this, PlayState* play) { if ((func_800F22C4(this->cutsceneIdxA, &this->dyna.actor) != 0) || (this->unk_1A0 != 0)) { EnBox_SetupAction(this, func_80868B74); this->unk_1A0 = 0; - func_80867FBC(&this->unk_1F4, globalCtx, (this->movementFlags & ENBOX_MOVE_0x80) != 0); + func_80867FBC(&this->unk_1F4, play, (this->movementFlags & ENBOX_MOVE_0x80) != 0); Audio_PlaySfxAtPos(&this->dyna.actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } } -void func_80868B74(EnBox* this, GlobalContext* globalCtx) { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void func_80868B74(EnBox* this, PlayState* play) { + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); if (this->unk_1A0 < 0) { this->unk_1A0++; } else if (this->unk_1A0 < 40) { @@ -435,9 +434,9 @@ void func_80868B74(EnBox* this, GlobalContext* globalCtx) { this->unk_1A0++; if ((this->cutsceneIdxA != -1) && ActorCutscene_GetCurrentIndex() == this->cutsceneIdxA) { if (this->unk_1A0 == 2) { - func_800B724C(globalCtx, &this->dyna.actor, 4); + func_800B724C(play, &this->dyna.actor, 4); } else if (this->unk_1A0 == 22) { - func_800B724C(globalCtx, &this->dyna.actor, 1); + func_800B724C(play, &this->dyna.actor, 1); } } } else if (this->unk_1A0 < 60) { @@ -450,7 +449,7 @@ void func_80868B74(EnBox* this, GlobalContext* globalCtx) { } } -void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { +void EnBox_WaitOpen(EnBox* this, PlayState* play) { s32 pad; AnimationHeader* animHeader; f32 frameCount; @@ -479,7 +478,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, animHeader, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); EnBox_SetupAction(this, EnBox_Open); if (this->unk_1EC > 0) { - 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, -1); @@ -490,17 +489,17 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { this->movementFlags |= ENBOX_MOVE_0x20; } else { if ((this->getItem == GI_HEART_PIECE) || (this->getItem == GI_BOTTLE)) { - Flags_SetCollectible(globalCtx, this->collectableFlag); + Flags_SetCollectible(play, this->collectableFlag); } - Flags_SetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)); + Flags_SetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)); } } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > -50.0f && offset.z < 0.0f && fabsf(offset.y) < 10.0f && fabsf(offset.x) < 20.0f && - Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { + Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { if (((this->getItem == GI_HEART_PIECE) || (this->getItem == GI_BOTTLE)) && - Flags_GetCollectible(globalCtx, this->collectableFlag)) { + Flags_GetCollectible(play, this->collectableFlag)) { this->getItem = GI_RECOVERY_HEART; } if ((this->getItem == GI_MASK_CAPTAIN) && (INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN)) { @@ -509,15 +508,15 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { if ((this->getItem == GI_MASK_GIANT) && (INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT)) { this->getItem = GI_RECOVERY_HEART; } - Actor_PickUpNearby(&this->dyna.actor, globalCtx, -this->getItem); + Actor_PickUpNearby(&this->dyna.actor, play, -this->getItem); } - if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { EnBox_SetupAction(this, EnBox_Open); } } } -void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { +void EnBox_Open(EnBox* this, PlayState* play) { s32 pad; this->dyna.actor.flags &= ~ACTOR_FLAG_80; @@ -536,9 +535,9 @@ void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { } if (this->movementFlags & ENBOX_MOVE_0x20) { this->movementFlags &= ~ENBOX_MOVE_0x20; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_ELFORG, - 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, + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_ELFORG, 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, ((ENBOX_GET_CHEST_FLAG(&this->dyna.actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_CHEST); } else if (this->movementFlags & ENBOX_MOVE_0x40) { this->movementFlags &= ~ENBOX_MOVE_0x40; @@ -566,15 +565,15 @@ void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { this->unk_1A8 = 1.0f; } } - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.z, &waterSurface, &waterBox, &bgId) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, + &waterSurface, &waterBox, &bgId) && (this->dyna.actor.floorHeight < waterSurface)) { - EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 5.0f, 2.0f, 20.0f, 0.3f); + EffectSsBubble_Spawn(play, &this->dyna.actor.world.pos, 5.0f, 2.0f, 20.0f, 0.3f); } } } -void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { +void EnBox_SpawnIceSmoke(EnBox* this, PlayState* play) { Vec3f pos; Vec3f velocity = { 0, 1.0f, 0 }; Vec3f accel = { 0, 0, 0 }; @@ -593,44 +592,44 @@ void EnBox_SpawnIceSmoke(EnBox* this, GlobalContext* globalCtx) { velocity.x = randomf * 1.6f * Math_SinS(this->dyna.actor.world.rot.y); velocity.y = 1.8f; velocity.z = randomf * 1.6f * Math_CosS(this->dyna.actor.world.rot.y); - EffectSsIceSmoke_Spawn(globalCtx, &pos, &velocity, &accel, 150); + EffectSsIceSmoke_Spawn(play, &pos, &velocity, &accel, 150); } } -void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Update(Actor* thisx, PlayState* play) { EnBox* this = THIS; if (this->movementFlags & ENBOX_MOVE_STICK_TO_GROUND) { this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND; - EnBox_ClipToGround(this, globalCtx); + EnBox_ClipToGround(this, play); } - if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { - globalCtx->actorCtx.unk5 |= 8; + if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + play->actorCtx.unk5 |= 8; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->movementFlags & ENBOX_MOVE_0x80) { this->movementFlags |= ENBOX_MOVE_IMMOBILE; } if (!(this->movementFlags & ENBOX_MOVE_IMMOBILE)) { Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); } Actor_SetFocus(&this->dyna.actor, 40.0f); if ((this->getItem == GI_ICE_TRAP) && (this->actionFunc == EnBox_Open) && (this->skelAnime.curFrame > 45.0f) && (this->iceSmokeTimer < 100)) { - EnBox_SpawnIceSmoke(this, globalCtx); + EnBox_SpawnIceSmoke(this, play); } if (this->unk_1F4.unk_0C != NULL) { - this->unk_1F4.unk_0C(&this->unk_1F4, globalCtx); + this->unk_1F4.unk_0C(&this->unk_1F4, play); } } -void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { s32 pad; EnBox* this = THIS; if (limbIndex == OBJECT_BOX_CHEST_LIMB_01) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestBaseOrnateDL); } else if (Actor_IsSmallChest(this)) { @@ -643,7 +642,7 @@ void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL); } } else if (limbIndex == OBJECT_BOX_CHEST_LIMB_03) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestLidOrnateDL); } else if (Actor_IsSmallChest(this)) { @@ -687,13 +686,13 @@ Gfx* EnBox_SetRenderMode3(GraphicsContext* gfxCtx) { return dl; } -void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBox_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBox* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_1F4.unk_10 != NULL) { - this->unk_1F4.unk_10(&this->unk_1F4, globalCtx); + this->unk_1F4.unk_10(&this->unk_1F4, play); } if (((this->alpha == 255) && (this->type != ENBOX_TYPE_BIG_INVISIBLE) && (this->type != ENBOX_TYPE_SMALL_INVISIBLE)) || @@ -701,21 +700,21 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { ((this->type == ENBOX_TYPE_BIG_INVISIBLE) || (this->type == ENBOX_TYPE_SMALL_INVISIBLE)))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_SetRenderMode1(globalCtx->state.gfxCtx)); - func_8012C28C(globalCtx->state.gfxCtx); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, + gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_SetRenderMode1(play->state.gfxCtx)); + func_8012C28C(play->state.gfxCtx); + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBox_PostLimbDraw, &this->dyna.actor, POLY_OPA_DISP); } else if (this->alpha != 0) { gDPPipeSync(POLY_XLU_DISP++); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); if ((this->type == ENBOX_TYPE_BIG_INVISIBLE) || (this->type == ENBOX_TYPE_SMALL_INVISIBLE)) { - gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode3(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode3(play->state.gfxCtx)); } else { - gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode2(globalCtx->state.gfxCtx)); + gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode2(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->dyna.actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 6d7da31a54..a7017a7163 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -7,8 +7,8 @@ struct EnBox; struct func_80867BDC_a0; -typedef void (*EnBoxActionFunc)(struct EnBox*, GlobalContext*); -typedef void (*EnBoxUnkFunc)(struct func_80867BDC_a0* arg0, GlobalContext* globalCtx); +typedef void (*EnBoxActionFunc)(struct EnBox*, PlayState*); +typedef void (*EnBoxUnkFunc)(struct func_80867BDC_a0* arg0, PlayState* play); typedef struct func_80867BDC_a0 { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c index e80004a92a..5e0e0a7764 100644 --- a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c +++ b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c @@ -10,30 +10,30 @@ #define THIS ((EnBsb*)thisx) -void EnBsb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBsb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBsb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBsb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBsb_Init(Actor* thisx, PlayState* play); +void EnBsb_Destroy(Actor* thisx, PlayState* play); +void EnBsb_Update(Actor* thisx, PlayState* play); +void EnBsb_Draw(Actor* thisx, PlayState* play); -void func_80C0BFE8(EnBsb* this, GlobalContext* globalCtx); -void func_80C0C238(EnBsb* this, GlobalContext* globalCtx); -void func_80C0C364(EnBsb* this, GlobalContext* globalCtx); -void func_80C0C484(EnBsb* this, GlobalContext* globalCtx); -void func_80C0C6A8(EnBsb* this, GlobalContext* globalCtx); -void func_80C0C8EC(EnBsb* this, GlobalContext* globalCtx); -void func_80C0CB3C(EnBsb* this, GlobalContext* globalCtx); -void func_80C0CD04(EnBsb* this, GlobalContext* globalCtx); -void func_80C0CDE4(EnBsb* this, GlobalContext* globalCtx); -void func_80C0CFDC(EnBsb* this, GlobalContext* globalCtx); -void func_80C0D10C(EnBsb* this, GlobalContext* globalCtx); -void func_80C0D27C(EnBsb* this, GlobalContext* globalCtx); -void func_80C0D384(EnBsb* this, GlobalContext* globalCtx); -void func_80C0D51C(EnBsb* this, GlobalContext* globalCtx); -void func_80C0D9B4(EnBsb* this, GlobalContext* globalCtx); -void func_80C0DB18(EnBsb* this, GlobalContext* globalCtx); -void func_80C0E1C0(EnBsb* this, GlobalContext* globalCtx); -void func_80C0E480(EnBsb* this, GlobalContext* globalCtx); -void func_80C0E4FC(EnBsb* this, GlobalContext* globalCtx); +void func_80C0BFE8(EnBsb* this, PlayState* play); +void func_80C0C238(EnBsb* this, PlayState* play); +void func_80C0C364(EnBsb* this, PlayState* play); +void func_80C0C484(EnBsb* this, PlayState* play); +void func_80C0C6A8(EnBsb* this, PlayState* play); +void func_80C0C8EC(EnBsb* this, PlayState* play); +void func_80C0CB3C(EnBsb* this, PlayState* play); +void func_80C0CD04(EnBsb* this, PlayState* play); +void func_80C0CDE4(EnBsb* this, PlayState* play); +void func_80C0CFDC(EnBsb* this, PlayState* play); +void func_80C0D10C(EnBsb* this, PlayState* play); +void func_80C0D27C(EnBsb* this, PlayState* play); +void func_80C0D384(EnBsb* this, PlayState* play); +void func_80C0D51C(EnBsb* this, PlayState* play); +void func_80C0D9B4(EnBsb* this, PlayState* play); +void func_80C0DB18(EnBsb* this, PlayState* play); +void func_80C0E1C0(EnBsb* this, PlayState* play); +void func_80C0E480(EnBsb* this, PlayState* play); +void func_80C0E4FC(EnBsb* this, PlayState* play); #if 0 // static ColliderJntSphElementInit sJntSphElementsInit[7] = { diff --git a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.h b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.h index c05fbedc84..38ec4078fe 100644 --- a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.h +++ b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.h @@ -5,7 +5,7 @@ struct EnBsb; -typedef void (*EnBsbActionFunc)(struct EnBsb*, GlobalContext*); +typedef void (*EnBsbActionFunc)(struct EnBsb*, PlayState*); typedef struct EnBsb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.c b/src/overlays/actors/ovl_En_Bu/z_en_bu.c index ec0a0a6c27..fb8c119da7 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.c +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.c @@ -10,12 +10,12 @@ #define THIS ((EnBu*)thisx) -void EnBu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnBu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnBu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnBu_Init(Actor* thisx, PlayState* play); +void EnBu_Destroy(Actor* thisx, PlayState* play); +void EnBu_Update(Actor* thisx, PlayState* play); +void EnBu_Draw(Actor* thisx, PlayState* play); -void EnBu_DoNothing(EnBu* this, GlobalContext* globalCtx); +void EnBu_DoNothing(EnBu* this, PlayState* play); const ActorInit En_Bu_InitVars = { ACTOR_EN_BU, @@ -29,37 +29,37 @@ const ActorInit En_Bu_InitVars = { (ActorFunc)EnBu_Draw, }; -void EnBu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnBu_Init(Actor* thisx, PlayState* play) { EnBu* this = THIS; this->actionFunc = EnBu_DoNothing; } -void EnBu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnBu_Destroy(Actor* thisx, PlayState* play) { } -void EnBu_DoNothing(EnBu* this, GlobalContext* globalCtx) { +void EnBu_DoNothing(EnBu* this, PlayState* play) { } -void EnBu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnBu_Update(Actor* thisx, PlayState* play) { EnBu* this = THIS; Actor_MoveWithGravity(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnBu_Draw(Actor* thisx, PlayState* play) { EnBu* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->displayListPtr); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.h b/src/overlays/actors/ovl_En_Bu/z_en_bu.h index 6200ca5a74..0f828477ca 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.h +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.h @@ -5,7 +5,7 @@ struct EnBu; -typedef void (*EnBuActionFunc)(struct EnBu*, GlobalContext*); +typedef void (*EnBuActionFunc)(struct EnBu*, PlayState*); typedef struct EnBu { /* 0x000 */ Actor actor; 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 0f54995be1..82fb047f33 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -10,14 +10,14 @@ #define THIS ((EnBubble*)thisx) -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 func_808A029C(EnBubble* this, GlobalContext* globalCtx); -void func_808A0350(EnBubble* this, GlobalContext* globalCtx); -void func_808A03E8(EnBubble* this, GlobalContext* globalCtx); +void func_808A029C(EnBubble* this, PlayState* play); +void func_808A0350(EnBubble* this, PlayState* play); +void func_808A03E8(EnBubble* this, PlayState* play); #if 0 const ActorInit En_Bubble_InitVars = { 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 f2901b3249..4a67a94c64 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -5,7 +5,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 0042442ff1..d1ec4df11d 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -12,19 +12,19 @@ #define THIS ((EnButte*)thisx) -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 func_8091C748(EnButte* this); -void func_8091C794(EnButte* this, GlobalContext* globalCtx); +void func_8091C794(EnButte* this, PlayState* play); void func_8091CB68(EnButte* this); -void func_8091CBB4(EnButte* this, GlobalContext* globalCtx); +void func_8091CBB4(EnButte* this, PlayState* play); void func_8091CF64(EnButte* this); -void func_8091CFB4(EnButte* this, GlobalContext* globalCtx); +void func_8091CFB4(EnButte* this, PlayState* play); void func_8091D070(EnButte* this); -void func_8091D090(EnButte* this, GlobalContext* globalCtx); +void func_8091D090(EnButte* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[1] = { { @@ -132,18 +132,18 @@ void func_8091C140(void) { D_8091D3A0 += 0xFA0; } -void func_8091C178(EnButte* this, GlobalContext* globalCtx) { +void func_8091C178(EnButte* this, PlayState* play) { Vec3f sp4C; s32 sp48; Vec3s sp40; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C240(globalCtx->state.gfxCtx); + func_8012C240(play->state.gfxCtx); sp48 = Math_SinS(D_8091D3A0) * 250.0f; sp48 = CLAMP(sp48, 0, 255); - func_800DFC90(&sp40, GET_ACTIVE_CAM(globalCtx)); + func_800DFC90(&sp40, GET_ACTIVE_CAM(play)); Matrix_RotateYS(sp40.y, MTXMODE_NEW); Matrix_RotateXS(sp40.x, MTXMODE_APPLY); Matrix_RotateZS(sp40.z, MTXMODE_APPLY); @@ -152,15 +152,15 @@ void func_8091C178(EnButte* this, GlobalContext* globalCtx) { this->actor.focus.pos.z + sp4C.z, &sp40); Matrix_Scale(D_8091D39C, D_8091D39C, D_8091D39C, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 180, sp48); gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 210, 255); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Init(Actor* thisx, PlayState* play) { s32 pad; EnButte* this = THIS; @@ -177,10 +177,10 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneScale = 200.0f; } - SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_field_keep_Skel_002FA0, &gameplay_field_keep_Anim_001D20, + SkelAnime_Init(play, &this->skelAnime, &gameplay_field_keep_Skel_002FA0, &gameplay_field_keep_Anim_001D20, this->jointTable, this->morphTable, 8); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colldierElements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colldierElements); this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.scale * this->collider.elements[0].dim.modelSphere.radius; @@ -196,8 +196,8 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_250 = 1; } -void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx) { - Collider_DestroyJntSph(globalCtx, &THIS->collider); +void EnButte_Destroy(Actor* thisx, PlayState* play) { + Collider_DestroyJntSph(play, &THIS->collider); } void func_8091C524(EnButte* this) { @@ -225,10 +225,10 @@ void func_8091C748(EnButte* this) { this->actionFunc = func_8091C794; } -void func_8091C794(EnButte* this, GlobalContext* globalCtx) { +void func_8091C794(EnButte* this, PlayState* play) { EnButteStruct* sp4C = &D_8091D324[this->unk_24E]; f32 distSq; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 distFromHomeSq = Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z); f32 playSpeed; @@ -302,9 +302,9 @@ void func_8091CB68(EnButte* this) { this->actionFunc = func_8091CBB4; } -void func_8091CBB4(EnButte* this, GlobalContext* globalCtx) { +void func_8091CBB4(EnButte* this, PlayState* play) { EnButteStruct* sp5C = &D_8091D360[this->unk_24E]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 playSpeed; Vec3f sp48; f32 distSq; @@ -324,7 +324,7 @@ void func_8091CBB4(EnButte* this, GlobalContext* globalCtx) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &sp48); if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw + (s32)(Rand_ZeroOne() * D_8091D3F0), 0x7D0)) { - if ((globalCtx->gameplayFrames & 0x30) == 0x30) { + if ((play->gameplayFrames & 0x30) == 0x30) { this->actor.world.rot.y += (s16)(Math_SinS(this->unk_254) * 60.0f); } } else { @@ -370,14 +370,14 @@ void func_8091CF64(EnButte* this) { this->actionFunc = func_8091CFB4; } -void func_8091CFB4(EnButte* this, GlobalContext* globalCtx) { +void func_8091CFB4(EnButte* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); func_8091C140(); if (this->unk_24C == 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->unk_24C == 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, 2); this->unk_250 = 0; } else if (this->unk_24C <= 0) { @@ -391,13 +391,13 @@ void func_8091D070(EnButte* this) { this->actor.draw = NULL; } -void func_8091D090(EnButte* this, GlobalContext* globalCtx) { +void func_8091D090(EnButte* this, PlayState* play) { if (this->unk_24C <= 0) { Actor_MarkForDeath(&this->actor); } } -void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnButte_Update(Actor* thisx, PlayState* play) { EnButte* this = THIS; if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (&this->actor != this->actor.child)) { @@ -413,7 +413,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_258 += 0x600; if (ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) { - if (GET_PLAYER(globalCtx)->swordState == 0) { + if (GET_PLAYER(play)->swordState == 0) { if (this->unk_252 > 0) { this->unk_252--; } @@ -422,7 +422,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveWithGravity(&this->actor); @@ -433,21 +433,21 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { element->dim.worldSphere.center.x = this->actor.world.pos.x; element->dim.worldSphere.center.y = this->actor.world.pos.y; element->dim.worldSphere.center.z = this->actor.world.pos.z; - 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 = THIS; if (this->unk_250 != 0) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (this->actionFunc == func_8091CFB4)) { - func_8091C178(this, globalCtx); + func_8091C178(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 361096961e..a93c0eea8e 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -5,7 +5,7 @@ struct EnButte; -typedef void (*EnButteActionFunc)(struct EnButte*, GlobalContext*); +typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); #define ENBUTTE_GET(thisx) ((thisx)->params) #define ENBUTTE_GET_1(thisx) ((thisx)->params & 1) diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index ae704672d0..b53f5f6208 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -11,12 +11,12 @@ #define THIS ((EnCha*)thisx) -void EnCha_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCha_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCha_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCha_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCha_Init(Actor* thisx, PlayState* play); +void EnCha_Destroy(Actor* thisx, PlayState* play); +void EnCha_Update(Actor* thisx, PlayState* play); +void EnCha_Draw(Actor* thisx, PlayState* play); -void EnCha_Idle(EnCha* this, GlobalContext* globalCtx); +void EnCha_Idle(EnCha* this, PlayState* play); const ActorInit En_Cha_InitVars = { ACTOR_EN_CHA, @@ -50,11 +50,11 @@ static ColliderCylinderInit sCylinderInit = { { 10, 40, 0, { 0, 0, 0 } }, }; -void EnCha_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCha_Init(Actor* thisx, PlayState* play) { EnCha* this = THIS; s32 pad; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Collider_UpdateCylinder(&this->actor, &this->collider); Actor_SetScale(&this->actor, 0.01f); @@ -64,14 +64,14 @@ void EnCha_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[60] &= (u8)~4; } -void EnCha_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCha_Destroy(Actor* thisx, PlayState* play) { EnCha* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnCha_Ring(EnCha* this, GlobalContext* globalCtx) { - EnCha_Idle(this, globalCtx); +void EnCha_Ring(EnCha* this, PlayState* play) { + EnCha_Idle(this, play); if (this->actor.cutscene == -1) { this->actionFunc = EnCha_Idle; } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { @@ -82,7 +82,7 @@ void EnCha_Ring(EnCha* this, GlobalContext* globalCtx) { } } -void EnCha_Idle(EnCha* this, GlobalContext* globalCtx) { +void EnCha_Idle(EnCha* this, PlayState* play) { if (gSaveContext.save.weekEventReg[60] & 4) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); gSaveContext.save.weekEventReg[60] &= (u8)~4; @@ -101,22 +101,22 @@ void EnCha_Idle(EnCha* this, GlobalContext* globalCtx) { this->actor.home.rot.z *= 0.96f; } -void EnCha_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnCha_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnCha* this = THIS; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - this->actionFunc(this, globalCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + this->actionFunc(this, play); if ((this->actor.shape.rot.z > -0x1F40) && (this->actor.shape.rot.z < 0x1F40)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnCha_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCha_Draw(Actor* thisx, PlayState* play) { EnCha* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_cha_DL_000710); + Gfx_DrawDListOpa(play, object_cha_DL_000710); Matrix_Translate(-1094.0f, 4950.0f, 9.0f, MTXMODE_APPLY); Matrix_RotateXS(this->actor.home.rot.x, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, object_cha_DL_000958); + Gfx_DrawDListOpa(play, object_cha_DL_000958); } diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.h b/src/overlays/actors/ovl_En_Cha/z_en_cha.h index c9a292b2bd..b3cfe7312b 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.h +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.h @@ -5,7 +5,7 @@ struct EnCha; -typedef void (*EnChaActionFunc)(struct EnCha*, struct GlobalContext*); +typedef void (*EnChaActionFunc)(struct EnCha*, struct PlayState*); typedef struct EnCha { /* 0x000 */ 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 dd20b9a250..65a1da5f01 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 @@ -23,13 +23,13 @@ typedef enum { /* 0x08 */ CLEAR_TAG_EFFECT_ISOLATED_SMOKE, } ClearTagEffectType; -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(EnClearTag* this, GlobalContext* globalCtx); -void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx); +void EnClearTag_UpdateEffects(EnClearTag* this, PlayState* play); +void EnClearTag_DrawEffects(Actor* thisx, PlayState* play); const ActorInit En_Clear_Tag_InitVars = { ACTOR_EN_CLEAR_TAG, @@ -406,14 +406,14 @@ void EnClearTag_CreateSplashEffect(EnClearTag* this, Vec3f* pos, s16 effectsTime * EnClearTag destructor. * No Operation takes place. */ -void EnClearTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Destroy(Actor* thisx, PlayState* play) { } /** * EnClearTag constructor. * This initializes effects, and sets up ClearTag instance data. */ -void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Init(Actor* thisx, PlayState* play) { s32 pad[3]; EnClearTag* this = THIS; f32 lightRayMaxScale; @@ -463,7 +463,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { } // Initialize flash effect - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 30.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 30.0f, 100.0f, 4); pos = this->actor.world.pos; EnClearTag_CreateFlashEffect(this, &pos, sFlashMaxScale[thisx->params], this->actor.floorHeight); @@ -531,8 +531,8 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); Camera* mainCam; s32 pad; @@ -556,19 +556,19 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { } break; case 1: - Cutscene_Start(globalCtx, &globalCtx->csCtx); - this->subCamId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, this->subCamId, 7); - func_800B7298(globalCtx, &this->actor, 4); - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Cutscene_Start(play, &play->csCtx); + this->subCamId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, this->subCamId, 7); + func_800B7298(play, &this->actor, 4); + 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; this->subCamAt.x = mainCam->at.x; this->subCamAt.y = mainCam->at.y; this->subCamAt.z = mainCam->at.z; - Message_StartTextbox(globalCtx, 0xF, NULL); + Message_StartTextbox(play, 0xF, NULL); this->cameraState = 2; func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_LISTEN, 0x20); case 2: @@ -579,14 +579,14 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { } player->actor.speedXZ = 0.0f; - if (Message_GetState(&globalCtx->msgCtx) == 0) { - mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if (Message_GetState(&play->msgCtx) == 0) { + mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; - func_80169AFC(globalCtx, this->subCamId, 0); - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + func_80169AFC(play, this->subCamId, 0); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); this->cameraState = 0; this->subCamId = CAM_ID_MAIN; this->activeTimer = 20; @@ -595,7 +595,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { } if (this->subCamId != CAM_ID_MAIN) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -603,7 +603,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { * EnClear_Tag update function. * Decides whether to update or to mark for death */ -void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_Update(Actor* thisx, PlayState* play) { EnClearTag* this = THIS; if (this->activeTimer != 0) { @@ -611,9 +611,9 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params < 0) { - EnClearTag_UpdateCamera(this, globalCtx); + EnClearTag_UpdateCamera(this, play); } else if (this->activeTimer != 0) { - EnClearTag_UpdateEffects(this, globalCtx); + EnClearTag_UpdateEffects(this, play); } else { Actor_MarkForDeath(&this->actor); } @@ -623,8 +623,8 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx) { * EnClearTag draw function. * Setups DrawEffects */ -void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { - EnClearTag_DrawEffects(thisx, globalCtx); +void EnClearTag_Draw(Actor* thisx, PlayState* play) { + EnClearTag_DrawEffects(thisx, play); } /** @@ -633,7 +633,7 @@ 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(EnClearTag* this, GlobalContext* globalCtx) { +void EnClearTag_UpdateEffects(EnClearTag* this, PlayState* play) { EnClearTagEffect* effect = this->effect; s16 i; f32 originalYPosition; @@ -665,7 +665,7 @@ void EnClearTag_UpdateEffects(EnClearTag* this, 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->pos.y = originalYPosition; // Bounce the debris effect. @@ -793,7 +793,7 @@ void EnClearTag_UpdateEffects(EnClearTag* this, 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(Actor* thisx, GlobalContext* globalCtx) { +void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) { u8 isMaterialApplied = false; s16 i; s16 j; @@ -801,14 +801,14 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { WaterBox* waterBox; f32 ySurface; MtxF mtxF; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnClearTag* this = THIS; EnClearTagEffect* effect = this->effect; EnClearTagEffect* firstEffect = this->effect; OPEN_DISPS(gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); // Draw all Debris effects. for (i = 0; i < ARRAY_COUNT(this->effect); i++, effect++) { @@ -888,11 +888,10 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { 128); 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++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 5, 32, 64, 1, 0, 0, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -effect->actionTimer * 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->smokeScaleX * effect->scale, effect->smokeScaleY * effect->scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -914,11 +913,10 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the fire effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)effect->primColor.a); - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 15, 32, 64, 1, 0, 0, 32, 32)); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -effect->actionTimer * 15, 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->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClearTagFireEffectDL); @@ -940,7 +938,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(2.0f * effect->scale, 2.0f * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClearTagFlashEffectDL); @@ -997,8 +995,8 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ ySurface = effect->pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, effect->pos.x + vec.x, effect->pos.z + vec.z, - &ySurface, &waterBox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, effect->pos.x + vec.x, effect->pos.z + vec.z, &ySurface, + &waterBox)) { if ((effect->pos.y - ySurface) < 200.0f) { // Draw the splash effect. Matrix_Translate(effect->pos.x + vec.x, ySurface, effect->pos.z + vec.z, MTXMODE_NEW); @@ -1013,5 +1011,5 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 3d96cd4940..df5bab1683 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -11,14 +11,14 @@ #define THIS ((EnCne01*)thisx) -void EnCne01_Init(Actor* thisx, GlobalContext* globalCtx); -void EnCne01_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnCne01_Update(Actor* thisx, GlobalContext* globalCtx); -void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnCne01_Init(Actor* thisx, PlayState* play); +void EnCne01_Destroy(Actor* thisx, PlayState* play); +void EnCne01_Update(Actor* thisx, PlayState* play); +void EnCne01_Draw(Actor* thisx, PlayState* play); -void EnCne01_Walk(EnHy* this, GlobalContext* globalCtx); -void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx); -void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx); +void EnCne01_Walk(EnHy* this, PlayState* play); +void EnCne01_FaceForward(EnHy* this, PlayState* play); +void EnCne01_Talk(EnHy* this, PlayState* play); const ActorInit En_Cne_01_InitVars = { ACTOR_EN_CNE_01, @@ -96,11 +96,11 @@ static TrackOptionsSet sTrackOptions = { { 0x1770, 4, 1, 6 }, }; -void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCne01_UpdateModel(EnCne01* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f point; - EnHy_UpdateSkelAnime(&this->enHy, globalCtx); + EnHy_UpdateSkelAnime(&this->enHy, play); if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { point.x = player->actor.world.pos.x; point.y = player->bodyPartsPos[7].y + 3.0f; @@ -115,15 +115,15 @@ void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1); Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1); } - SubS_FillLimbRotTables(globalCtx, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, + SubS_FillLimbRotTables(play, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, ARRAY_COUNT(this->enHy.limbRotTableY)); - EnHy_UpdateCollider(&this->enHy, globalCtx); + EnHy_UpdateCollider(&this->enHy, play); } -s32 EnCne01_TestIsTalking(EnCne01* this, GlobalContext* globalCtx) { +s32 EnCne01_TestIsTalking(EnCne01* this, PlayState* play) { s32 isTalking = false; - if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->enHy.actor, &play->state)) { isTalking = true; this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox this->enHy.tmptrackTarget = this->enHy.trackTarget; @@ -135,20 +135,20 @@ s32 EnCne01_TestIsTalking(EnCne01* this, GlobalContext* globalCtx) { return isTalking; } -s32 func_809CB4A0(EnCne01* this, GlobalContext* globalCtx) { +s32 func_809CB4A0(EnCne01* this, PlayState* play) { s16 x; s16 y; - Actor_GetScreenPos(globalCtx, &this->enHy.actor, &x, &y); + Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); //! @bug: Both x and y conditionals are always true, || should be an && if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { - func_800B85E0(&this->enHy.actor, globalCtx, 30.0f, EXCH_ITEM_2E); + func_800B85E0(&this->enHy.actor, play, 30.0f, EXCH_ITEM_2E); } return true; } -void EnCne01_FinishInit(EnHy* this, GlobalContext* globalCtx) { - if (EnHy_Init(this, globalCtx, &gCneSkel, ENHY_ANIMATION_OS_ANIME_11)) { +void EnCne01_FinishInit(EnHy* this, PlayState* play) { + if (EnHy_Init(this, play, &gCneSkel, ENHY_ANIMATION_OS_ANIME_11)) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnCne01_Draw; this->waitingOnInit = false; @@ -160,29 +160,29 @@ void EnCne01_FinishInit(EnHy* this, GlobalContext* globalCtx) { } } -void EnCne01_Walk(EnHy* this, GlobalContext* globalCtx) { +void EnCne01_Walk(EnHy* this, PlayState* play) { if (EnHy_MoveForwards(this, 1.0f)) { this->curPoint = 0; } } -void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx) { +void EnCne01_FaceForward(EnHy* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; } -void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx) { +void EnCne01_Talk(EnHy* this, PlayState* play) { s16 yaw; u8 talkState; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); - talkState = Message_GetState(&globalCtx->msgCtx); + talkState = Message_GetState(&play->msgCtx); this->inMsgState3 = (talkState == 3) ? true : false; switch (talkState) { case 0: yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); if (yaw < 0x64) { - Message_StartTextbox(globalCtx, this->textId, NULL); + Message_StartTextbox(play, this->textId, NULL); } break; case 2: @@ -197,48 +197,47 @@ void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx) { } } -void EnCne01_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCne01_Init(Actor* thisx, PlayState* play) { s32 pad; EnCne01* this = THIS; - this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_OS_ANIME, globalCtx); - this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); - this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); - this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); + this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_OS_ANIME, play); + this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); + this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); + this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_CNE, play); if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || (this->enHy.skelLowerObjIndex < 0)) { Actor_MarkForDeath(&this->enHy.actor); } this->enHy.actor.draw = NULL; - Collider_InitCylinder(globalCtx, &this->enHy.collider); - Collider_SetCylinder(globalCtx, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->enHy.collider); + Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->enHy.actor.flags &= ~ACTOR_FLAG_1; - this->enHy.path = SubS_GetPathByIndex(globalCtx, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH); + this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH); this->enHy.waitingOnInit = true; Actor_SetScale(&this->enHy.actor, 0.01f); this->enHy.actionFunc = EnCne01_FinishInit; } -void EnCne01_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCne01_Destroy(Actor* thisx, PlayState* play) { EnCne01* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->enHy.collider); + Collider_DestroyCylinder(play, &this->enHy.collider); } -void EnCne01_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnCne01_Update(Actor* thisx, PlayState* play) { EnCne01* this = THIS; - EnCne01_TestIsTalking(this, globalCtx); - this->enHy.actionFunc(&this->enHy, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); - EnCne01_UpdateModel(this, globalCtx); - func_809CB4A0(this, globalCtx); + EnCne01_TestIsTalking(this, play); + this->enHy.actionFunc(&this->enHy, play); + Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); + EnCne01_UpdateModel(this, play); + func_809CB4A0(this, play); } -s32 EnCne01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnCne01* this = THIS; s8 bodyPart; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -249,12 +248,12 @@ s32 EnCne01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } if (limbIndex == CNE_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); + OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.headObjIndex].segment); *dList = gCneHeadBrownHairDL; - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelLowerObjIndex].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == CNE_LIMB_HEAD) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -268,7 +267,7 @@ s32 EnCne01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_RotateZS(-this->enHy.torsoRot.x, MTXMODE_APPLY); } - if ((limbIndex == CNE_LIMB_HEAD) && this->enHy.inMsgState3 && ((globalCtx->state.frames % 2) == 0)) { + if ((limbIndex == CNE_LIMB_HEAD) && this->enHy.inMsgState3 && ((play->state.frames % 2) == 0)) { Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); } @@ -281,16 +280,16 @@ s32 EnCne01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnCne01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnCne01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnCne01* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (limbIndex == CNE_LIMB_RIGHT_FOOT) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == CNE_LIMB_HEAD) { @@ -298,23 +297,23 @@ void EnCne01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnCne01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnCne01_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnCne01_Draw(Actor* thisx, PlayState* play) { EnCne01* this = THIS; s32 i; - u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); u8* shadowTexIter; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0)); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 160, 180, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 160, 180, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_EnvColor(play->state.gfxCtx, 160, 180, 255, 0)); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable, this->enHy.skelAnime.dListCount, EnCne01_OverrideLimbDraw, EnCne01_PostLimbDraw, EnCne01_TransformLimbDraw, &this->enHy.actor); Matrix_RotateXS(0, MTXMODE_NEW); @@ -326,7 +325,7 @@ void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx) { SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts); } - SubS_DrawShadowTex(&this->enHy.actor, &globalCtx->state, shadowTex); + SubS_DrawShadowTex(&this->enHy.actor, &play->state, shadowTex); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h index 840d1cf60e..c2ce1c8612 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h @@ -5,7 +5,7 @@ struct EnCne01; -typedef void (*EnCne01ActionFunc)(struct EnCne01*, GlobalContext*); +typedef void (*EnCne01ActionFunc)(struct EnCne01*, PlayState*); #define ENCNE01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) #define ENCNE01_NO_PATH 0x3F diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index 6817c1830f..9857d9403c 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -12,20 +12,20 @@ #define THIS ((EnColMan*)thisx) -void EnColMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnColMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnColMan_Update(Actor* thisx, GlobalContext* globalCtx); +void EnColMan_Init(Actor* thisx, PlayState* play); +void EnColMan_Destroy(Actor* thisx, PlayState* play); +void EnColMan_Update(Actor* thisx, PlayState* play); void func_80AFDD60(EnColMan* this); -void func_80AFDE00(EnColMan* this, GlobalContext* globalCtx); -void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, GlobalContext* globalCtx); +void func_80AFDE00(EnColMan* this, PlayState* play); +void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, PlayState* play); void func_80AFDF60(EnColMan* this); -void func_80AFDFB4(EnColMan* this, GlobalContext* globalCtx); +void func_80AFDFB4(EnColMan* this, PlayState* play); void func_80AFE234(EnColMan* this); -void func_80AFE25C(EnColMan* this, GlobalContext* globalCtx); -void func_80AFE414(Actor* thisx, GlobalContext* globalCtx); -void func_80AFE4AC(Actor* thisx, GlobalContext* globalCtx); -void func_80AFE584(Actor* thisx, GlobalContext* globalCtx); -void func_80AFE650(Actor* thisx, GlobalContext* globalCtx); +void func_80AFE25C(EnColMan* this, PlayState* play); +void func_80AFE414(Actor* thisx, PlayState* play); +void func_80AFE4AC(Actor* thisx, PlayState* play); +void func_80AFE584(Actor* thisx, PlayState* play); +void func_80AFE650(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -62,10 +62,10 @@ const ActorInit En_Col_Man_InitVars = { static Color_RGBA8 primColor = { 60, 50, 20, 255 }; static Color_RGBA8 envColor = { 40, 30, 30, 255 }; -void EnColMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnColMan_Init(Actor* thisx, PlayState* play) { EnColMan* this = THIS; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 1; this->scale = (BREG(55) / 1000.0f) + 0.01f; @@ -87,10 +87,10 @@ void EnColMan_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnColMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnColMan_Destroy(Actor* thisx, PlayState* play) { EnColMan* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AFDD60(EnColMan* this) { @@ -113,7 +113,7 @@ void func_80AFDD60(EnColMan* this) { this->actionFunc = func_80AFDE00; } -void func_80AFDE00(EnColMan* this, GlobalContext* globalCtx) { +void func_80AFDE00(EnColMan* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { if (this->actor.params == EN_COL_MAN_HEART_PIECE) { this->actor.params = EN_COL_MAN_RECOVERY_HEART; @@ -126,19 +126,19 @@ void func_80AFDE00(EnColMan* this, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[56] & 2)) { this->actor.shape.rot.y += 0x3E8; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actor.draw = NULL; this->actionFunc = EnColMan_SetHeartPieceCollectedAndKill; } else if (!(gSaveContext.save.weekEventReg[56] & 2)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 40.0f, 40.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 40.0f, 40.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RECOVERY_HEART, 40.0f, 40.0f); + Actor_PickUp(&this->actor, play, GI_RECOVERY_HEART, 40.0f, 40.0f); } } -void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { +void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[56] |= 2; Actor_MarkForDeath(&this->actor); } @@ -154,7 +154,7 @@ void func_80AFDF60(EnColMan* this) { this->actor.gravity = -3.0f; } -void func_80AFDFB4(EnColMan* this, GlobalContext* globalCtx) { +void func_80AFDFB4(EnColMan* this, PlayState* play) { s32 i; Vec3f velocity; Vec3f accel; @@ -179,7 +179,7 @@ void func_80AFDFB4(EnColMan* this, GlobalContext* globalCtx) { accel.z = 0.0f; accel.x = 0.0f; - func_800B0EB0(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, + func_800B0EB0(play, &this->actor.world.pos, &velocity, &accel, &primColor, &envColor, Rand_ZeroFloat(50.0f) + 60.0f, 30, Rand_ZeroFloat(5.0f) + 20.0f); } @@ -193,16 +193,16 @@ void func_80AFE234(EnColMan* this) { this->actionFunc = func_80AFE25C; } -void func_80AFE25C(EnColMan* this, GlobalContext* globalCtx) { +void func_80AFE25C(EnColMan* this, PlayState* play) { this->scale = BREG(55) * 0.01f + 0.05f; if (BREG(60) || (this->actor.world.rot.z != 0)) { if (this->actor.params == EN_COL_MAN_CUTSCENE_BOMB) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.parent->world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.parent->world.pos.x, this->actor.parent->world.pos.y, this->actor.parent->world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); } else { - EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + EnBom* 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) { @@ -215,61 +215,61 @@ void func_80AFE25C(EnColMan* this, GlobalContext* globalCtx) { } } -void EnColMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnColMan_Update(Actor* thisx, PlayState* play) { s32 pad; EnColMan* this = THIS; Actor_SetScale(&this->actor, this->scale); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 30.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 30.0f, 0x1F); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80AFE414(Actor* thisx, GlobalContext* globalCtx) { +void func_80AFE414(Actor* thisx, PlayState* play) { EnColMan* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&this->actor, globalCtx, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80AFE4AC(Actor* thisx, GlobalContext* globalCtx) { +void func_80AFE4AC(Actor* thisx, PlayState* play) { EnColMan* this = THIS; - func_8012C2DC(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + func_8012C2DC(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80AFE584(Actor* thisx, GlobalContext* globalCtx) { - func_8012C2DC(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +void func_80AFE584(Actor* thisx, PlayState* play) { + func_8012C2DC(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80AFE650(Actor* thisx, GlobalContext* globalCtx) { - func_8012C28C(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); +void func_80AFE650(Actor* thisx, PlayState* play) { + func_8012C28C(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05CEF0)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h index ab1ac285dd..1e8f540dc7 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.h @@ -5,7 +5,7 @@ struct EnColMan; -typedef void (*EnColManActionFunc)(struct EnColMan*, GlobalContext*); +typedef void (*EnColManActionFunc)(struct EnColMan*, PlayState*); typedef struct EnColMan { /* 0x000 */ Actor actor; 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 c3396fe298..342e613853 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -10,22 +10,22 @@ #define THIS ((EnCow*)thisx) -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 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 EnCow_TalkEnd(EnCow* this, GlobalContext* globalCtx); -void EnCow_GiveMilkEnd(EnCow* this, GlobalContext* globalCtx); -void EnCow_GiveMilkWait(EnCow* this, GlobalContext* globalCtx); -void EnCow_GiveMilk(EnCow* this, GlobalContext* globalCtx); -void EnCow_CheckForEmptyBottle(EnCow* this, GlobalContext* globalCtx); -void EnCow_Talk(EnCow* this, GlobalContext* globalCtx); -void EnCow_Idle(EnCow* this, GlobalContext* globalCtx); +void EnCow_TalkEnd(EnCow* this, PlayState* play); +void EnCow_GiveMilkEnd(EnCow* this, PlayState* play); +void EnCow_GiveMilkWait(EnCow* this, PlayState* play); +void EnCow_GiveMilk(EnCow* this, PlayState* play); +void EnCow_CheckForEmptyBottle(EnCow* this, PlayState* play); +void EnCow_Talk(EnCow* this, PlayState* play); +void EnCow_Idle(EnCow* this, PlayState* play); -void EnCow_DoTail(EnCow* this, GlobalContext* globalCtx); -void EnCow_UpdateTail(Actor* this, GlobalContext* globalCtx); -void EnCow_DrawTail(Actor* this, GlobalContext* globalCtx); +void EnCow_DoTail(EnCow* this, PlayState* play); +void EnCow_UpdateTail(Actor* this, PlayState* play); +void EnCow_DrawTail(Actor* this, PlayState* play); const ActorInit En_Cow_InitVars = { ACTOR_EN_COW, @@ -97,7 +97,7 @@ void EnCow_SetTailPos(EnCow* this) { this->actor.world.pos.z += vec.z; } -void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Init(Actor* thisx, PlayState* play) { s32 pad; EnCow* this = THIS; @@ -106,12 +106,12 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { switch (EN_COW_TYPE(thisx)) { case EN_COW_TYPE_DEFAULT: case EN_COW_TYPE_ABDUCTED: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowChewAnim); - Collider_InitAndSetCylinder(globalCtx, &this->colliders[0], &this->actor, &sCylinderInit); - Collider_InitAndSetCylinder(globalCtx, &this->colliders[1], &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliders[0], &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliders[1], &this->actor, &sCylinderInit); EnCow_SetColliderPos(this); this->actionFunc = EnCow_Idle; @@ -122,7 +122,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, EN_COW_TYPE_TAIL); @@ -134,7 +134,7 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { func_801A5080(4); break; case EN_COW_TYPE_TAIL: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, COW_TAIL_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowTailIdleAnim); @@ -156,16 +156,16 @@ void EnCow_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[87] &= (u8)~1; } -void EnCow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_Destroy(Actor* thisx, PlayState* play) { EnCow* this = THIS; if (this->actor.params == EN_COW_TYPE_DEFAULT) { //! @bug EN_COW_TYPE_ABDUCTED do not destroy their cylinders - 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 EnCow_UpdateAnimation(EnCow* this, GlobalContext* globalCtx) { +void EnCow_UpdateAnimation(EnCow* this, PlayState* play) { if (this->animationTimer > 0) { this->animationTimer--; } else { @@ -199,53 +199,53 @@ void EnCow_UpdateAnimation(EnCow* this, GlobalContext* globalCtx) { } } -void EnCow_TalkEnd(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void EnCow_TalkEnd(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnCow_Idle; } } -void EnCow_GiveMilkEnd(EnCow* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnCow_GiveMilkEnd(EnCow* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnCow_Idle; } } -void EnCow_GiveMilkWait(EnCow* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnCow_GiveMilkWait(EnCow* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnCow_GiveMilkEnd; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void EnCow_GiveMilk(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void EnCow_GiveMilk(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnCow_GiveMilkWait; - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } -void EnCow_CheckForEmptyBottle(EnCow* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void EnCow_CheckForEmptyBottle(EnCow* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (Interface_HasEmptyBottle()) { - func_80151938(globalCtx, 0x32C9); // Text to give milk. + func_80151938(play, 0x32C9); // Text to give milk. this->actionFunc = EnCow_GiveMilk; } else { - func_80151938(globalCtx, 0x32CA); // Text if you don't have an empty bottle. + func_80151938(play, 0x32CA); // Text if you don't have an empty bottle. this->actionFunc = EnCow_TalkEnd; } } } -void EnCow_Talk(EnCow* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnCow_Talk(EnCow* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.textId == 0x32C8) { // Text to give milk after playing Epona's Song. this->actionFunc = EnCow_CheckForEmptyBottle; } else if (this->actor.textId == 0x32C9) { // Text to give milk. @@ -255,15 +255,15 @@ void EnCow_Talk(EnCow* this, GlobalContext* globalCtx) { } } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 170.0f); + func_800B8614(&this->actor, play, 170.0f); this->actor.textId = 0x32C8; //! @bug textId is reset to this no matter the intial value } - EnCow_UpdateAnimation(this, globalCtx); + EnCow_UpdateAnimation(this, play); } -void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { - if ((globalCtx->msgCtx.ocarinaMode == 0) || (globalCtx->msgCtx.ocarinaMode == 4)) { +void EnCow_Idle(EnCow* this, PlayState* play) { + if ((play->msgCtx.ocarinaMode == 0) || (play->msgCtx.ocarinaMode == 4)) { if (D_801BDAA4 != 0) { if (this->flags & EN_COW_FLAG_WONT_GIVE_MILK) { this->flags &= ~EN_COW_FLAG_WONT_GIVE_MILK; @@ -273,10 +273,10 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { D_801BDAA4 = 0; this->actionFunc = EnCow_Talk; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 170.0f); + func_800B8614(&this->actor, play, 170.0f); this->actor.textId = 0x32C8; // Text to give milk after playing Epona's Song. - EnCow_UpdateAnimation(this, globalCtx); + EnCow_UpdateAnimation(this, play); return; } else { this->flags |= EN_COW_FLAG_WONT_GIVE_MILK; @@ -297,7 +297,7 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { this->actor.textId = 0x32CA; // Text if you don't have an empty bottle. } this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 170.0f); + func_800B8614(&this->actor, play, 170.0f); this->actionFunc = EnCow_Talk; } } else { @@ -305,10 +305,10 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { } } - EnCow_UpdateAnimation(this, globalCtx); + EnCow_UpdateAnimation(this, play); } -void EnCow_DoTail(EnCow* this, GlobalContext* globalCtx) { +void EnCow_DoTail(EnCow* this, PlayState* play) { if (this->animationTimer > 0) { this->animationTimer--; } else { @@ -328,19 +328,19 @@ void EnCow_DoTail(EnCow* this, GlobalContext* globalCtx) { } } -void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnCow_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnCow* this = THIS; 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_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (SkelAnime_Update(&this->skelAnime)) { if (this->skelAnime.animation == &gCowChewAnim) { @@ -353,7 +353,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.xzDistToPlayer < 150.0f && ABS_ALT(Math_Vec3f_Yaw(&thisx->world.pos, &player->actor.world.pos)) < 0xC000) { @@ -379,7 +379,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToS(&this->headTilt.y, targetY, 10, 200, 10); } -void EnCow_UpdateTail(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_UpdateTail(Actor* thisx, PlayState* play) { s32 pad; EnCow* this = THIS; @@ -393,10 +393,10 @@ void EnCow_UpdateTail(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnCow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnCow* this = THIS; if (limbIndex == COW_LIMB_HEAD) { @@ -410,7 +410,7 @@ s32 EnCow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnCow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnCow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnCow* this = THIS; if (limbIndex == COW_LIMB_HEAD) { @@ -418,18 +418,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 = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCow_OverrideLimbDraw, EnCow_PostLimbDraw, &this->actor); } -void EnCow_DrawTail(Actor* thisx, GlobalContext* globalCtx) { +void EnCow_DrawTail(Actor* thisx, PlayState* play) { EnCow* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C5B0(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_Cow/z_en_cow.h b/src/overlays/actors/ovl_En_Cow/z_en_cow.h index bb9319ad97..1fd6a36a9a 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -17,7 +17,7 @@ typedef enum { 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 3ab93e1be1..46becf0850 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -10,22 +10,22 @@ #define THIS ((EnCrow*)thisx) -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_FlyIdle(EnCrow* this, PlayState* play); void EnCrow_SetupDiveAttack(EnCrow* this); -void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_CheckIfFrozen(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_DiveAttack(EnCrow* this, PlayState* play); +void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play); +void EnCrow_Damaged(EnCrow* this, PlayState* play); void EnCrow_SetupDie(EnCrow* this); -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_Die(EnCrow* this, PlayState* play); void EnCrow_SetupRespawn(EnCrow* this); -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx); -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx); +void EnCrow_TurnAway(EnCrow* this, PlayState* play); +void EnCrow_Respawn(EnCrow* this, PlayState* play); const ActorInit En_Crow_InitVars = { ACTOR_EN_CROW, @@ -112,13 +112,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -void EnCrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnCrow_Init(Actor* thisx, PlayState* play) { EnCrow* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); this->collider.elements->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); @@ -129,10 +129,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 = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void EnCrow_SetupFlyIdle(EnCrow* this) { @@ -142,8 +142,8 @@ void EnCrow_SetupFlyIdle(EnCrow* this) { this->skelAnime.playSpeed = 1.0f; } -void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 dist; s32 onInitialAnimFrame; s16 yaw; @@ -207,7 +207,7 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { } if ((this->timer == 0) && (((this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x800000)) || (dist < 300.0f)) && - (this->actor.depthInWater < -40.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + (this->actor.depthInWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { if (dist < this->actor.xzDistToPlayer) { this->actor.child = this->actor.parent; } else { @@ -224,8 +224,8 @@ void EnCrow_SetupDiveAttack(EnCrow* this) { this->skelAnime.playSpeed = 2.0f; } -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 isFacingActor; Vec3f pos; s16 pitch; @@ -258,7 +258,7 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { } if (((this->timer == 0) || ((&player->actor != this->actor.child) && (this->actor.child->home.rot.z != 0)) || ((&player->actor == this->actor.child) && - ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (player->stateFlags1 & 0x800000))) || + ((Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags1 & 0x800000))) || ((this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9))) || (this->actor.depthInWater > -40.0f)) { @@ -270,15 +270,15 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { } } -void EnCrow_CheckIfFrozen(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play) { if (this->deathMode == 10) { this->deathMode = 0; this->effectAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->bodyPartsPos, 4, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 4, 2, 0.2f, 0.2f); } } -void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { f32 scale; this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); @@ -300,7 +300,7 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { this->deathMode = 20; // Light Arrows this->effectAlpha = 4.0f; this->steamScale = 0.5f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider.elements->info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements->info.bumper.hitPos.x, this->collider.elements->info.bumper.hitPos.y, this->collider.elements->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == 2) { @@ -320,7 +320,7 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { this->actionFunc = EnCrow_Damaged; } -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; @@ -330,10 +330,9 @@ void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { this->actor.shape.rot.z += 0x1780; } if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - EnCrow_CheckIfFrozen(this, globalCtx); - func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, this->actor.scale.x * 10000.0f, - 0, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + EnCrow_CheckIfFrozen(this, play); + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, this->actor.scale.x * 10000.0f, 0, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); if (this->actor.parent != NULL) { Actor_MarkForDeath(&this->actor); @@ -349,7 +348,7 @@ void EnCrow_SetupDie(EnCrow* this) { this->actionFunc = EnCrow_Die; } -void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Die(EnCrow* this, PlayState* play) { f32 stepScale; if (this->actor.params != 0) { @@ -360,9 +359,9 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->actor.scale.x, 0.0f, stepScale) != 0) { if (this->actor.params == 0) { D_8099C0CC++; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } EnCrow_SetupRespawn(this); } @@ -384,7 +383,7 @@ void EnCrow_SetupTurnAway(EnCrow* this) { this->actionFunc = EnCrow_TurnAway; } -void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_TurnAway(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 8) { @@ -426,7 +425,7 @@ void EnCrow_SetupRespawn(EnCrow* this) { this->actionFunc = EnCrow_Respawn; } -void EnCrow_Respawn(EnCrow* this, GlobalContext* globalCtx) { +void EnCrow_Respawn(EnCrow* this, PlayState* play) { f32 target; if (this->timer != 0) { @@ -450,7 +449,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 & AT_HIT) { this->collider.base.acFlags &= ~AT_HIT; @@ -468,20 +467,20 @@ void EnCrow_UpdateDamage(EnCrow* this, GlobalContext* globalCtx) { } else { this->actor.colChkInfo.health = 0; this->actor.flags &= ~ACTOR_FLAG_1; - 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) { f32 pad; EnCrow* this = (EnCrow*)thisx; 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; @@ -494,7 +493,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { height = 0.0f; Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7); } else { height = 0.0f; } @@ -504,13 +503,13 @@ 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); @@ -533,8 +532,7 @@ void EnCrow_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnCrow* this = (EnCrow*)thisx; if (this->actor.colChkInfo.health != 0) { @@ -547,7 +545,7 @@ s32 EnCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnCrow* this = (EnCrow*)thisx; if (limbIndex == OBJECT_CROW_LIMB_BODY) { @@ -560,13 +558,13 @@ 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_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->actor.scale.x * 100.0f * this->steamScale, this->effectScale, this->effectAlpha, this->deathMode); } 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 9076a198ca..79bfdeb6c1 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_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 9d7304ec4b..729b96a83f 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -11,13 +11,13 @@ #define THIS ((EnDai*)thisx) -void EnDai_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDai_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDai_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDai_Init(Actor* thisx, PlayState* play); +void EnDai_Destroy(Actor* thisx, PlayState* play); +void EnDai_Update(Actor* thisx, PlayState* play); +void EnDai_Draw(Actor* thisx, PlayState* play); -void func_80B3F00C(EnDai* this, GlobalContext* globalCtx); -void func_80B3EF90(EnDai* this, GlobalContext* globalCtx); +void func_80B3F00C(EnDai* this, PlayState* play); +void func_80B3EF90(EnDai* this, PlayState* play); const ActorInit En_Dai_InitVars = { ACTOR_EN_DAI, @@ -53,16 +53,16 @@ EnDaiEffect* func_80B3DFF0(EnDaiEffect* effect, Vec3f arg1, Vec3f arg2, Vec3f ar return NULL; } -void func_80B3E168(EnDaiEffect* effect, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80B3E168(EnDaiEffect* effect, PlayState* play2) { + PlayState* play = play2; s32 pad; s32 isDisplayListSet = false; s32 i; f32 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < EN_DAI_EFFECT_COUNT; i++, effect++) { if (effect->isEnabled == true) { @@ -81,22 +81,21 @@ void func_80B3E168(EnDaiEffect* effect, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (u8)alpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (effect->unk_02 + (i * 3)) * 3, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (effect->unk_02 + (i * 3)) * 3, (effect->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(effect->unk_10.x, effect->unk_10.y, effect->unk_10.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(effect->unk_34, effect->unk_34, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dai_DL_0002E8); Matrix_Pop(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 func_80B3E460(EnDai* this) { @@ -123,8 +122,8 @@ s32 func_80B3E460(EnDai* this) { return count; } -s32 func_80B3E5B4(EnDai* this, GlobalContext* globalCtx) { - func_80B3E168(this->effects, globalCtx); +s32 func_80B3E5B4(EnDai* this, PlayState* play) { + func_80B3E168(this->effects, play); return 0; } @@ -174,13 +173,13 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { return ret; } -s32 func_80B3E69C(EnDai* this, GlobalContext* globalCtx) { +s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 ret = false; - if ((globalCtx->csCtx.state != 0) && (globalCtx->sceneNum == SCENE_12HAKUGINMAE) && - (globalCtx->csCtx.currentCsIndex == 0) && !(gSaveContext.save.weekEventReg[30] & 1)) { + if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && + !(gSaveContext.save.weekEventReg[30] & 1)) { if (!(this->unk_1CE & 0x10)) { - Flags_SetSwitch(globalCtx, 20); + Flags_SetSwitch(play, 20); this->unk_1CE |= (0x80 | 0x10); this->unk_1CE &= ~(0x100 | 0x20); this->unk_1CC = 0xFF; @@ -200,11 +199,11 @@ s32 func_80B3E69C(EnDai* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B3E7C8(EnDai* this, GlobalContext* globalCtx) { +s32 func_80B3E7C8(EnDai* this, PlayState* play) { s32 ret = false; if (this->unk_1CE & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_1CE, 0, 7); this->actionFunc = func_80B3EF90; ret = true; @@ -277,7 +276,7 @@ s16 func_80B3E8BC(EnDai* this, s32 arg1) { return this->unk_1D6; } -s32 func_80B3E96C(EnDai* this, GlobalContext* globalCtx) { +s32 func_80B3E96C(EnDai* this, PlayState* play) { Vec3f sp74; Vec3f sp68; Vec3f sp5C; @@ -293,7 +292,7 @@ s32 func_80B3E96C(EnDai* this, GlobalContext* globalCtx) { case 1: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SNOWSTORM_HARD); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WEATHER_TAG, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WEATHER_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0x1388, 0x708, 0x3E8, 0); func_80B3E5DC(this, 3); this->unk_1DC++; @@ -399,7 +398,7 @@ s32 func_80B3ED88(EnDai* this) { return ret; } -void func_80B3EE8C(EnDai* this, GlobalContext* globalCtx) { +void func_80B3EE8C(EnDai* this, PlayState* play) { s16 cutscene = this->actor.cutscene; if (ActorCutscene_GetCanPlayNext(cutscene)) { @@ -409,15 +408,15 @@ void func_80B3EE8C(EnDai* this, GlobalContext* globalCtx) { } } -void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3EEDC(EnDai* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 1)) { + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 1)) { func_80B3E5DC(this, 1); this->actionFunc = func_80B3EE8C; } else if (!(player->stateFlags2 & 0x08000000)) { - func_80B3E96C(this, globalCtx); + func_80B3E96C(this, play); this->unk_A6C = 0; } else if (this->unk_A6C == 0) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); @@ -425,8 +424,8 @@ void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx) { } } -void func_80B3EF90(EnDai* this, GlobalContext* globalCtx) { - if (func_8010BF58(&this->actor, globalCtx, D_80B3FC8C, NULL, &this->unk_1D0)) { +void func_80B3EF90(EnDai* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, D_80B3FC8C, NULL, &this->unk_1D0)) { SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1D0 = 0; this->actionFunc = func_80B3F00C; @@ -435,20 +434,20 @@ void func_80B3EF90(EnDai* this, GlobalContext* globalCtx) { } } -void func_80B3F00C(EnDai* this, GlobalContext* globalCtx) { +void func_80B3F00C(EnDai* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80B3F044(EnDai* this, GlobalContext* globalCtx) { +void func_80B3F044(EnDai* this, PlayState* play) { static s32 D_80B3FE38[] = { 0, 0, 6, 7, 8, }; s32 sp2C = 0; s32 sp28; - if (Cutscene_CheckActorAction(globalCtx, 472)) { - sp2C = Cutscene_GetActorActionIndex(globalCtx, 472); - sp28 = globalCtx->csCtx.actorActions[sp2C]->action; + if (Cutscene_CheckActorAction(play, 472)) { + sp2C = Cutscene_GetActorActionIndex(play, 472); + sp28 = play->csCtx.actorActions[sp2C]->action; if (this->unk_1CC != (u8)sp28) { func_80B3E5DC(this, D_80B3FE38[sp28]); switch (sp28) { @@ -479,7 +478,7 @@ void func_80B3F044(EnDai* this, GlobalContext* globalCtx) { break; case 2: - if (globalCtx->csCtx.frames == 360) { + if (play->csCtx.frames == 360) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIGOLON_SLEEP3 - SFX_FLAG); } if (Animation_OnFrame(&this->skelAnime, 43.0f)) { @@ -506,15 +505,14 @@ void func_80B3F044(EnDai* this, GlobalContext* globalCtx) { break; } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, sp2C); + Cutscene_ActorTranslateAndYaw(&this->actor, play, sp2C); } -void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDai_Init(Actor* thisx, PlayState* play) { EnDai* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, - 19); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19); this->unk_A70 = -1; func_80B3E5DC(this, 0); Actor_SetScale(&this->actor, 0.2f); @@ -544,33 +542,33 @@ void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80B3EEDC; } -void EnDai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDai_Destroy(Actor* thisx, PlayState* play) { } -void EnDai_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDai_Update(Actor* thisx, PlayState* play) { EnDai* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!func_80B3E7C8(this, globalCtx) && func_80B3E69C(this, globalCtx)) { - func_80B3F044(this, globalCtx); + if (!func_80B3E7C8(this, play) && func_80B3E69C(this, play)) { + func_80B3F044(this, play); SkelAnime_Update(&this->skelAnime); func_80B3E834(this); func_80B3E460(this); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(player->stateFlags2 & 0x8000000)) { SkelAnime_Update(&this->skelAnime); func_80B3E834(this); if (!(this->unk_1CE & 0x200)) { - func_8013C964(&this->actor, globalCtx, 0.0f, 0.0f, EXCH_ITEM_NONE, this->unk_1CE & 7); + func_8013C964(&this->actor, play, 0.0f, 0.0f, EXCH_ITEM_NONE, this->unk_1CE & 7); } func_80B3E460(this); } } } -s32 EnDai_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnDai_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnDai* this = THIS; @@ -589,7 +587,7 @@ s32 EnDai_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDai_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnDai_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B3FE4C = { 0.0f, 0.0f, 0.0f }; EnDai* this = THIS; @@ -614,7 +612,7 @@ void EnDai_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnDai_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx, Gfx** gfx) { +void EnDai_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** gfx) { EnDai* this = THIS; switch (limbIndex) { @@ -634,45 +632,45 @@ void EnDai_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void func_80B3F78C(EnDai* this, GlobalContext* globalCtx) { +void func_80B3F78C(EnDai* this, PlayState* play) { static TexturePtr D_80B3FE58[] = { object_dai_Tex_0107B0, object_dai_Tex_010FB0, object_dai_Tex_0117B0, object_dai_Tex_010FB0, object_dai_Tex_011FB0, object_dai_Tex_0127B0, }; s32 pad; - if (globalCtx->actorCtx.unkB != 0) { + if (play->actorCtx.unkB != 0) { this->unk_1CE |= 0x40; } else { - Actor_RecordUndrawnActor(globalCtx, &this->actor); + Actor_RecordUndrawnActor(play, &this->actor); this->unk_1CE &= ~0x40; } - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 2, 2); + Scene_SetRenderModeXlu(play, 2, 2); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE58[this->unk_1D6])); - POLY_XLU_DISP = SubS_DrawTransformFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SubS_DrawTransformFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDai_OverrideLimbDraw, EnDai_PostLimbDraw, EnDai_TransformLimbDraw, &this->actor, POLY_XLU_DISP); if (this->unk_1CE & 0x40) { Matrix_Put(&this->unk_18C); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dai_DL_00C538); } - func_80B3E5B4(this, globalCtx); + func_80B3E5B4(this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B3F920(EnDai* this, GlobalContext* globalCtx) { +void func_80B3F920(EnDai* this, PlayState* play) { static TexturePtr D_80B3FE70[] = { object_dai_Tex_0107B0, object_dai_Tex_010FB0, object_dai_Tex_0117B0, object_dai_Tex_010FB0, object_dai_Tex_011FB0, object_dai_Tex_0127B0, @@ -682,55 +680,55 @@ void func_80B3F920(EnDai* this, GlobalContext* globalCtx) { this->unk_1CE |= 0x40; if (this->unk_1CD == 0xFF) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE70[this->unk_1D6])); - POLY_OPA_DISP = SubS_DrawTransformFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SubS_DrawTransformFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDai_OverrideLimbDraw, EnDai_PostLimbDraw, EnDai_TransformLimbDraw, &this->actor, POLY_OPA_DISP); Matrix_Put(&this->unk_18C); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dai_DL_00C538); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 2, 2); + Scene_SetRenderModeXlu(play, 2, 2); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_1CD); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3FE70[this->unk_1D6])); - POLY_XLU_DISP = SubS_DrawTransformFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_XLU_DISP = SubS_DrawTransformFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDai_OverrideLimbDraw, EnDai_PostLimbDraw, EnDai_TransformLimbDraw, &this->actor, POLY_XLU_DISP); Matrix_Put(&this->unk_18C); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_dai_DL_00C538); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } - func_80B3E5B4(this, globalCtx); + func_80B3E5B4(this, play); } -void EnDai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDai_Draw(Actor* thisx, PlayState* play) { EnDai* this = THIS; if (!(this->unk_1CE & 0x200)) { if (this->unk_1CE & 0x20) { - func_80B3F78C(this, globalCtx); + func_80B3F78C(this, play); } else { - func_80B3F920(this, globalCtx); + func_80B3F920(this, play); } } } diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.h b/src/overlays/actors/ovl_En_Dai/z_en_dai.h index 4c7e167b9d..0b0316d05f 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.h +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.h @@ -5,7 +5,7 @@ struct EnDai; -typedef void (*EnDaiActionFunc)(struct EnDai*, GlobalContext*); +typedef void (*EnDaiActionFunc)(struct EnDai*, PlayState*); typedef struct EnDaiEffect { /* 0x00 */ u8 isEnabled; 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 3d76b73919..216b2d2f12 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -11,15 +11,15 @@ #define THIS ((EnDaiku*)thisx) -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 func_80943820(EnDaiku* this); void func_80943BC0(EnDaiku* this); -void func_80943BDC(EnDaiku* this, GlobalContext* globalCtx); -void func_809438F8(EnDaiku* this, GlobalContext* globalCtx); +void func_80943BDC(EnDaiku* this, PlayState* play); +void func_809438F8(EnDaiku* this, PlayState* play); const ActorInit En_Daiku_InitVars = { ACTOR_EN_DAIKU, @@ -57,17 +57,17 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Init(Actor* thisx, PlayState* play) { EnDaiku* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); this->actor.targetMode = 0; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_278 = ENDAIKU_GET_FF(&this->actor); if (this->unk_278 == ENDAIKU_PARAMS_FF_3) { this->unk_288 = ENDAIKU_GET_FF00(&this->actor); - this->unk_258 = SubS_GetPathByIndex(globalCtx, this->unk_288, 0x3F); + this->unk_258 = SubS_GetPathByIndex(play, this->unk_288, 0x3F); } else if (this->unk_278 == ENDAIKU_PARAMS_FF_2) { this->unk_264 = -2000; } @@ -94,17 +94,17 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_27E = this->unk_278 * 4 + 4; case ENDAIKU_PARAMS_FF_1: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, this->jointTable, this->morphTable, 17); break; case ENDAIKU_PARAMS_FF_2: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_00B690, + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_00B690, this->jointTable, this->morphTable, 17); break; case ENDAIKU_PARAMS_FF_3: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_001114, + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_001114, this->jointTable, this->morphTable, 17); break; } @@ -112,10 +112,10 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) { func_80943820(this); } -void EnDaiku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Destroy(Actor* thisx, PlayState* play) { EnDaiku* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_8094373C(EnDaiku* this, s32 arg1) { @@ -165,13 +165,13 @@ void func_80943820(EnDaiku* this) { this->actionFunc = func_809438F8; } -void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) { +void func_809438F8(EnDaiku* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; s32 pad; s32 day = gSaveContext.save.day - 1; s32 pad2; - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { if (this->unk_278 == ENDAIKU_PARAMS_FF_1) { this->actor.textId = 0x2365; } else { @@ -182,7 +182,7 @@ void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) { this->actor.textId = sTextIds[this->unk_28C]; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80943BC0(this); return; } @@ -221,7 +221,7 @@ void func_809438F8(EnDaiku* this, GlobalContext* globalCtx) { s16 angle = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); this->unk_280 = this->actor.yawTowardsPlayer; if ((this->unk_278 == ENDAIKU_PARAMS_FF_1) || (this->unk_278 == ENDAIKU_PARAMS_FF_2) || (angle <= 0x2890)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } } @@ -231,7 +231,7 @@ void func_80943BC0(EnDaiku* this) { this->actionFunc = func_80943BDC; } -void func_80943BDC(EnDaiku* this, GlobalContext* globalCtx) { +void func_80943BDC(EnDaiku* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; if ((this->unk_278 == ENDAIKU_PARAMS_FF_2) && (this->unk_284 <= currentFrame)) { @@ -242,13 +242,13 @@ void func_80943BDC(EnDaiku* this, GlobalContext* globalCtx) { } } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80943820(this); } } -void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Update(Actor* thisx, PlayState* play) { EnDaiku* this = THIS; s32 pad; @@ -261,7 +261,7 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_27C != 0) { this->unk_27C--; @@ -277,14 +277,13 @@ void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_260, this->unk_266, 1, 0xBB8, 0); Math_SmoothStepToS(&this->unk_25E, this->unk_264, 1, 0xBB8, 0); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); this->actor.uncullZoneForward = 650.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDaiku_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDaiku* this = THIS; if (limbIndex == 15) { @@ -295,7 +294,7 @@ s32 EnDaiku_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDaiku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Gfx* D_809440D4[] = { object_daiku_DL_0070C0, object_daiku_DL_006FB0, @@ -304,7 +303,7 @@ void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, }; EnDaiku* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { gSPDisplayList(POLY_OPA_DISP++, D_809440D4[this->unk_278]); @@ -314,15 +313,15 @@ void EnDaiku_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_008EC8); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku_Draw(Actor* thisx, PlayState* play) { EnDaiku* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); switch (this->unk_278) { case 0: @@ -346,8 +345,8 @@ void EnDaiku_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - 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->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 01395648d9..4f93b3ea15 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -5,7 +5,7 @@ struct EnDaiku; -typedef void (*EnDaikuActionFunc)(struct EnDaiku*, GlobalContext*); +typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); #define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF); #define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index a8d4df8e6c..a573a4dcbe 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -13,24 +13,24 @@ #define THIS ((EnDaiku2*)thisx) -void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDaiku2_Init(Actor* thisx, PlayState* play); +void EnDaiku2_Destroy(Actor* thisx, PlayState* play); +void EnDaiku2_Update(Actor* thisx, PlayState* play); +void EnDaiku2_Draw(Actor* thisx, PlayState* play); -void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx); -void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx); -void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx); -void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE65B4(EnDaiku2* this, PlayState* play); +void func_80BE66E4(EnDaiku2* this, PlayState* play); +void func_80BE6B40(EnDaiku2* this, PlayState* play); +void func_80BE6BC0(EnDaiku2* this, PlayState* play); void func_80BE6CFC(EnDaiku2* this); -void func_80BE6D40(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE6D40(EnDaiku2* this, PlayState* play); void func_80BE6EB0(EnDaiku2* this); -void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx); -void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE6EF0(EnDaiku2* this, PlayState* play); +void func_80BE7600(EnDaiku2* this, PlayState* play); void func_80BE71A0(EnDaiku2* this); -void func_80BE71D8(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE71D8(EnDaiku2* this, PlayState* play); void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5); -void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE7718(EnDaiku2* this, PlayState* play); const ActorInit En_Daiku2_InitVars = { ACTOR_EN_DAIKU2, @@ -76,19 +76,19 @@ void func_80BE61D0(EnDaiku2* this) { } } -void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku2_Init(Actor* thisx, PlayState* play) { EnDaiku2* this = THIS; s32 day = gSaveContext.save.day; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, - this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, this->jointTable, + this->morphTable, 17); this->actor.targetMode = 0; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_278 = ENDAIKU2_GET_7F(&this->actor); this->unk_27A = ENDAIKU2_GET_1F80(&this->actor); - this->unk_258 = SubS_GetPathByIndex(globalCtx, this->unk_27A, 0x3F); + this->unk_258 = SubS_GetPathByIndex(play, this->unk_27A, 0x3F); this->unk_280 = ENDAIKU2_GET_8000(&this->actor); Actor_SetScale(&this->actor, 0.01f); if (!this->unk_280) { @@ -99,7 +99,7 @@ void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_278 == ENDAIKU2_GET_7F_127) { this->unk_278 = ENDAIKU2_GET_7F_MINUS1; - } else if (Flags_GetSwitch(globalCtx, this->unk_278)) { + } else if (Flags_GetSwitch(play, this->unk_278)) { this->unk_25C = this->unk_258->count - 1; func_80BE61D0(this); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_268); @@ -111,13 +111,13 @@ void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -3.0f; Math_Vec3f_Copy(&this->unk_268, &this->actor.world.pos); - func_80BE65B4(this, globalCtx); + func_80BE65B4(this, play); } -void EnDaiku2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku2_Destroy(Actor* thisx, PlayState* play) { EnDaiku2* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BE6408(EnDaiku2* this, s32 arg1) { @@ -140,15 +140,15 @@ void func_80BE6408(EnDaiku2* this, s32 arg1) { -4.0f); } -s32 func_80BE64C0(EnDaiku2* this, GlobalContext* globalCtx) { +s32 func_80BE64C0(EnDaiku2* this, PlayState* play) { EnBom* bomb; Vec3f sp30; Math_Vec3f_Copy(&sp30, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); - bomb = (EnBom*)Actor_FindNearby(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVES, BREG(7) + 240.0f); + bomb = (EnBom*)Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVES, BREG(7) + 240.0f); Math_Vec3f_Copy(&this->actor.world.pos, &sp30); - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && !Flags_GetSwitch(globalCtx, this->unk_278) && (bomb != NULL) && + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && !Flags_GetSwitch(play, this->unk_278) && (bomb != NULL) && (bomb->actor.id == ACTOR_EN_BOM)) { if (!bomb->isPowderKeg) { this->actor.textId = 0x32D3; @@ -162,7 +162,7 @@ s32 func_80BE64C0(EnDaiku2* this, GlobalContext* globalCtx) { return false; } -void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE65B4(EnDaiku2* this, PlayState* play) { switch (gSaveContext.save.day - 1) { case 0: this->unk_28A = 0; @@ -188,7 +188,7 @@ void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { } this->unk_264 = 1.0f; - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { this->unk_28A = 5; if (this->unk_276 != 10) { func_80BE6408(this, 10); @@ -199,7 +199,7 @@ void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { this->actionFunc = func_80BE66E4; } -void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE66E4(EnDaiku2* this, PlayState* play) { f32 sp9C = this->skelAnime.curFrame; s32 sp98 = gSaveContext.save.day - 1; s32 i; @@ -211,7 +211,7 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.home.rot.y, 1, 0xBB8, 0x0); if (sp98 != 2) { - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { this->unk_28A = 5; if (this->unk_276 != 10) { func_80BE6408(this, 10); @@ -221,17 +221,17 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { this->actor.textId = sTextIds[this->unk_28A]; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BE6B40(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BE6B40(this, play); return; } - if ((this->unk_28A != 5) && (sp98 != 2) && func_80BE64C0(this, globalCtx)) { + if ((this->unk_28A != 5) && (sp98 != 2) && func_80BE64C0(this, play)) { func_80BE6CFC(this); return; } - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); if ((this->unk_276 == 8) && Animation_OnFrame(&this->skelAnime, 6.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROCK_BROKEN); @@ -278,11 +278,11 @@ void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { } } -void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE6B40(EnDaiku2* this, PlayState* play) { s32 day = gSaveContext.save.day; this->unk_288 = 1; - if ((day != 3) && Flags_GetSwitch(globalCtx, this->unk_278)) { + if ((day != 3) && Flags_GetSwitch(play, this->unk_278)) { this->actionFunc = func_80BE6BC0; } else { func_80BE6408(this, 5); @@ -290,12 +290,12 @@ void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx) { } } -void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE6BC0(EnDaiku2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0x0); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { s32 day = gSaveContext.save.day - 1; - func_801477B4(globalCtx); + func_801477B4(play); if (this->unk_288 == 2) { this->actionFunc = func_80BE6D40; @@ -303,7 +303,7 @@ void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { this->actionFunc = func_80BE6EF0; } else if ((this->unk_28A == 0) || (this->unk_28A == 2)) { this->unk_28A++; - func_80151938(globalCtx, sTextIds[this->unk_28A]); + func_80151938(play, sTextIds[this->unk_28A]); } else { switch (day) { case 0: @@ -314,7 +314,7 @@ void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[64] |= 4; break; } - func_80BE65B4(this, globalCtx); + func_80BE65B4(this, play); } } } @@ -326,11 +326,11 @@ void func_80BE6CFC(EnDaiku2* this) { this->unk_264 = 0.0f; } -void func_80BE6D40(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE6D40(EnDaiku2* this, PlayState* play) { s32 pad[3]; s16 sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_268); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BE6BC0; return; } @@ -348,7 +348,7 @@ void func_80BE6D40(EnDaiku2* this, GlobalContext* globalCtx) { } func_80BE61D0(this); } - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } void func_80BE6EB0(EnDaiku2* this) { @@ -358,13 +358,13 @@ void func_80BE6EB0(EnDaiku2* this) { this->actionFunc = func_80BE6EF0; } -void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE6EF0(EnDaiku2* this, PlayState* play) { f32 sp5C = this->skelAnime.curFrame; s32 pad[4]; Vec3f sp40; s16 var; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BE6BC0; return; } @@ -384,17 +384,17 @@ void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) { if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_268.x) + SQ(this->actor.world.pos.z - this->unk_268.z)) < 4.0f) && (this->unk_258 != 0)) { - if (!func_80BE64C0(this, globalCtx)) { + if (!func_80BE64C0(this, play)) { if (this->unk_276 != 3) { func_80BE6408(this, 3); } - if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(play, this->unk_278)) { this->unk_28A = 5; if (this->unk_276 != 10) { func_80BE6408(this, 10); } - func_80BE65B4(this, globalCtx); + func_80BE65B4(this, play); return; } @@ -406,7 +406,7 @@ void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) { } func_80BE61D0(this); } - } else if (func_80BE64C0(this, globalCtx)) { + } else if (func_80BE64C0(this, play)) { Math_Vec3f_Copy(&sp40, &this->unk_268); var = this->unk_25C; this->unk_25C++; @@ -419,7 +419,7 @@ void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_268, &sp40); } } - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } void func_80BE71A0(EnDaiku2* this) { @@ -427,46 +427,46 @@ void func_80BE71A0(EnDaiku2* this) { this->actionFunc = func_80BE71D8; } -void func_80BE71D8(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE71D8(EnDaiku2* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; - if (func_80BE64C0(this, globalCtx)) { + if (func_80BE64C0(this, play)) { func_80BE6CFC(this); } else if ((this->unk_276 == 9) && (this->unk_284 <= currentFrame)) { func_80BE6408(this, 0); } else if ((this->unk_276 == 0) && (this->unk_284 <= currentFrame)) { func_80BE6408(this, 5); } else if ((this->unk_276 == 5) && (this->unk_284 <= currentFrame)) { - func_80BE65B4(this, globalCtx); + func_80BE65B4(this, play); } } -void EnDaiku2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku2_Update(Actor* thisx, PlayState* play) { EnDaiku2* this = THIS; s32 pad; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; Actor_SetFocus(&this->actor, 65.0f); Actor_MoveWithGravity(&this->actor); Math_ApproachF(&this->unk_260, this->unk_264, 0.3f, 2.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_80BE7600(this, globalCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_80BE7600(this, play); } -void EnDaiku2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDaiku2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDaiku2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (limbIndex == 14) { Matrix_Scale(this->unk_260, this->unk_260, this->unk_260, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_009638); } @@ -474,21 +474,21 @@ void EnDaiku2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, gSPDisplayList(POLY_OPA_DISP++, object_daiku_DL_00A390); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDaiku2_Draw(Actor* thisx, PlayState* play) { EnDaiku2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnDaiku2_PostLimbDraw, &this->actor); - func_80BE7718(this, globalCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnDaiku2_PostLimbDraw, &this->actor); + func_80BE7718(this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) { @@ -511,7 +511,7 @@ void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 ar } } -void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE7600(EnDaiku2* this, PlayState* play) { s32 i; EnDaiku2Effect* effect = this->effects; @@ -532,20 +532,20 @@ void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx) { } } -void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) { +void func_80BE7718(EnDaiku2* this, PlayState* play) { s32 i; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnDaiku2Effect* effect = this->effects; s32 objectIdx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOMBIWA); - if ((objectIdx >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { + objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA); + if ((objectIdx >= 0) && Object_IsLoaded(&play->objectCtx, objectIdx)) { gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment); for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { @@ -564,5 +564,5 @@ void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index 3a0cc5ca3c..dab4096c04 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -5,7 +5,7 @@ struct EnDaiku2; -typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, GlobalContext*); +typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); #define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F); #define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F); diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c index 6292103eee..aa9caa02a1 100644 --- a/src/overlays/actors/ovl_En_Death/z_en_death.c +++ b/src/overlays/actors/ovl_En_Death/z_en_death.c @@ -10,31 +10,31 @@ #define THIS ((EnDeath*)thisx) -void EnDeath_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDeath_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDeath_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDeath_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDeath_Init(Actor* thisx, PlayState* play); +void EnDeath_Destroy(Actor* thisx, PlayState* play); +void EnDeath_Update(Actor* thisx, PlayState* play); +void EnDeath_Draw(Actor* thisx, PlayState* play); -void func_808C589C(EnDeath* this, GlobalContext* globalCtx); -void func_808C5AB8(EnDeath* this, GlobalContext* globalCtx); -void func_808C5CB4(EnDeath* this, GlobalContext* globalCtx); -void func_808C5E90(EnDeath* this, GlobalContext* globalCtx); -void func_808C6070(EnDeath* this, GlobalContext* globalCtx); -void func_808C64DC(EnDeath* this, GlobalContext* globalCtx); -void func_808C66A8(EnDeath* this, GlobalContext* globalCtx); -void func_808C682C(EnDeath* this, GlobalContext* globalCtx); -void func_808C692C(EnDeath* this, GlobalContext* globalCtx); -void func_808C6AB0(EnDeath* this, GlobalContext* globalCtx); -void func_808C6CDC(EnDeath* this, GlobalContext* globalCtx); -void func_808C6F6C(EnDeath* this, GlobalContext* globalCtx); -void func_808C72AC(EnDeath* this, GlobalContext* globalCtx); -void func_808C74F8(EnDeath* this, GlobalContext* globalCtx); -void func_808C7888(EnDeath* this, GlobalContext* globalCtx); -void func_808C7AAC(EnDeath* this, GlobalContext* globalCtx); -void func_808C7B88(EnDeath* this, GlobalContext* globalCtx); -void func_808C7C88(EnDeath* this, GlobalContext* globalCtx); -void func_808C7D34(EnDeath* this, GlobalContext* globalCtx); -void func_808C7DCC(EnDeath* this, GlobalContext* globalCtx); +void func_808C589C(EnDeath* this, PlayState* play); +void func_808C5AB8(EnDeath* this, PlayState* play); +void func_808C5CB4(EnDeath* this, PlayState* play); +void func_808C5E90(EnDeath* this, PlayState* play); +void func_808C6070(EnDeath* this, PlayState* play); +void func_808C64DC(EnDeath* this, PlayState* play); +void func_808C66A8(EnDeath* this, PlayState* play); +void func_808C682C(EnDeath* this, PlayState* play); +void func_808C692C(EnDeath* this, PlayState* play); +void func_808C6AB0(EnDeath* this, PlayState* play); +void func_808C6CDC(EnDeath* this, PlayState* play); +void func_808C6F6C(EnDeath* this, PlayState* play); +void func_808C72AC(EnDeath* this, PlayState* play); +void func_808C74F8(EnDeath* this, PlayState* play); +void func_808C7888(EnDeath* this, PlayState* play); +void func_808C7AAC(EnDeath* this, PlayState* play); +void func_808C7B88(EnDeath* this, PlayState* play); +void func_808C7C88(EnDeath* this, PlayState* play); +void func_808C7D34(EnDeath* this, PlayState* play); +void func_808C7DCC(EnDeath* this, PlayState* play); #if 0 const ActorInit En_Death_InitVars = { diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.h b/src/overlays/actors/ovl_En_Death/z_en_death.h index e806608361..2441e00b5b 100644 --- a/src/overlays/actors/ovl_En_Death/z_en_death.h +++ b/src/overlays/actors/ovl_En_Death/z_en_death.h @@ -5,7 +5,7 @@ struct EnDeath; -typedef void (*EnDeathActionFunc)(struct EnDeath*, GlobalContext*); +typedef void (*EnDeathActionFunc)(struct EnDeath*, PlayState*); typedef struct EnDeath { /* 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 1939a5bcca..250f4c7ee9 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -10,26 +10,26 @@ #define THIS ((EnDekubaba*)thisx) -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 func_808B1B14(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B1CF0(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B2240(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B2660(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B28B4(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B29C4(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B2CB8(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3078(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3280(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3404(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B37E8(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3B48(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3C50(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3DA8(EnDekubaba* this, GlobalContext* globalCtx); -void func_808B3EE8(EnDekubaba* this, GlobalContext* globalCtx); +void func_808B1B14(EnDekubaba* this, PlayState* play); +void func_808B1CF0(EnDekubaba* this, PlayState* play); +void func_808B2240(EnDekubaba* this, PlayState* play); +void func_808B2660(EnDekubaba* this, PlayState* play); +void func_808B28B4(EnDekubaba* this, PlayState* play); +void func_808B29C4(EnDekubaba* this, PlayState* play); +void func_808B2CB8(EnDekubaba* this, PlayState* play); +void func_808B3078(EnDekubaba* this, PlayState* play); +void func_808B3280(EnDekubaba* this, PlayState* play); +void func_808B3404(EnDekubaba* this, PlayState* play); +void func_808B37E8(EnDekubaba* this, PlayState* play); +void func_808B3B48(EnDekubaba* this, PlayState* play); +void func_808B3C50(EnDekubaba* this, PlayState* play); +void func_808B3DA8(EnDekubaba* this, PlayState* play); +void func_808B3EE8(EnDekubaba* this, PlayState* play); #if 0 const ActorInit En_Dekubaba_InitVars = { 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 8bfdedb03b..19b977e092 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -5,7 +5,7 @@ struct EnDekubaba; -typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, GlobalContext*); +typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); typedef struct EnDekubaba { /* 0x0000 */ Actor actor; 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 9486507bc9..868c3c0d55 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -11,32 +11,32 @@ #define THIS ((EnDekunuts*)thisx) -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 func_808BD428(EnDekunuts* this); -void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BD49C(EnDekunuts* this, PlayState* play); void func_808BD78C(EnDekunuts* this); -void func_808BD7D4(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BD7D4(EnDekunuts* this, PlayState* play); void func_808BD870(EnDekunuts* this); -void func_808BD8D8(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BD8D8(EnDekunuts* this, PlayState* play); void func_808BDA08(EnDekunuts* this); -void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BDA4C(EnDekunuts* this, PlayState* play); void func_808BDC9C(EnDekunuts* this); -void func_808BDD54(EnDekunuts* this, GlobalContext* globalCtx); -void func_808BDEF8(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BDD54(EnDekunuts* this, PlayState* play); +void func_808BDEF8(EnDekunuts* this, PlayState* play); void func_808BDF60(EnDekunuts* this); -void func_808BDFB8(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BDFB8(EnDekunuts* this, PlayState* play); void func_808BE1CC(EnDekunuts* this); -void func_808BE22C(EnDekunuts* this, GlobalContext* globalCtx); -void func_808BE358(EnDekunuts* this, GlobalContext* globalCtx); -void func_808BE3FC(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BE22C(EnDekunuts* this, PlayState* play); +void func_808BE358(EnDekunuts* this, PlayState* play); +void func_808BE3FC(EnDekunuts* this, PlayState* play); void func_808BE484(EnDekunuts* this); -void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BE4D4(EnDekunuts* this, PlayState* play); void func_808BE680(EnDekunuts* this); -void func_808BE6C4(EnDekunuts* this, GlobalContext* globalCtx); +void func_808BE6C4(EnDekunuts* this, PlayState* play); const ActorInit En_Dekunuts_InitVars = { ACTOR_EN_DEKUNUTS, @@ -113,14 +113,14 @@ 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 = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuScrubSkel, &gDekuScrubIdleAnim, this->jointTable, - this->morphTable, DEKU_SCRUB_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gDekuScrubSkel, &gDekuScrubIdleAnim, this->jointTable, this->morphTable, + DEKU_SCRUB_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = ENDEKUNUTS_GET_FF00(&this->actor); thisx->params &= 0xFF; @@ -139,10 +139,10 @@ void EnDekunuts_Init(Actor* thisx, GlobalContext* globalCtx) { func_808BD428(this); } -void EnDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Destroy(Actor* thisx, PlayState* play) { EnDekunuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_808BD348(EnDekunuts* this) { @@ -155,12 +155,12 @@ void func_808BD348(EnDekunuts* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_808BD3B4(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BD3B4(EnDekunuts* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 8, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 8, 2, 0.2f, 0.2f); } } @@ -173,7 +173,7 @@ void func_808BD428(EnDekunuts* this) { this->actionFunc = func_808BD49C; } -void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BD49C(EnDekunuts* this, PlayState* play) { s32 phi_v1 = false; if (this->skelAnime.playSpeed < 0.5f) { @@ -192,12 +192,12 @@ void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) { this->collider.dim.height = (s32)((CLAMP(this->skelAnime.curFrame, 9.0f, 12.0f) - 9.0f) * 9.0f) + 5; - if (!phi_v1 && (this->actor.params == ENDEKUNUTS_GET_FF00_0) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && + if (!phi_v1 && (this->actor.params == ENDEKUNUTS_GET_FF00_0) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 120.0f)) { func_808BDC9C(this); } else if (SkelAnime_Update(&this->skelAnime)) { if (((this->unk_190 == 0) && (this->actor.xzDistToPlayer > 320.0f)) || - (Player_GetMask(globalCtx) == PLAYER_MASK_STONE)) { + (Player_GetMask(play) == PLAYER_MASK_STONE)) { func_808BD78C(this); } else { if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { @@ -225,7 +225,7 @@ void func_808BD78C(EnDekunuts* this) { this->actionFunc = func_808BD7D4; } -void func_808BD7D4(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BD7D4(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->unk_190 != 0) { @@ -233,8 +233,7 @@ void func_808BD7D4(EnDekunuts* this, GlobalContext* globalCtx) { } } - if ((this->unk_190 == 0) || - ((this->actor.xzDistToPlayer < 120.0f) && Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + if ((this->unk_190 == 0) || ((this->actor.xzDistToPlayer < 120.0f) && Player_GetMask(play) != PLAYER_MASK_STONE)) { func_808BDC9C(this); } } @@ -249,7 +248,7 @@ void func_808BD870(EnDekunuts* this) { this->actionFunc = func_808BD8D8; } -void func_808BD8D8(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BD8D8(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->unk_190 != 0) { @@ -264,13 +263,13 @@ void func_808BD8D8(EnDekunuts* this, GlobalContext* globalCtx) { if (this->unk_190 == 0x1000) { if ((this->actor.xzDistToPlayer > 480.0f) || ((this->actor.params == ENDEKUNUTS_GET_FF00_0) && (this->actor.xzDistToPlayer < 120.0f)) || - (Player_GetMask(globalCtx) == PLAYER_MASK_STONE)) { + (Player_GetMask(play) == PLAYER_MASK_STONE)) { func_808BDC9C(this); } else { func_808BDA08(this); } } else if (this->unk_190 == 0) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) { + if (Player_GetMask(play) == PLAYER_MASK_STONE) { func_808BDC9C(this); } else { func_808BDA08(this); @@ -284,7 +283,7 @@ void func_808BDA08(EnDekunuts* this) { this->actionFunc = func_808BDA4C; } -void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BDA4C(EnDekunuts* this, PlayState* play) { Player* player; Vec3f sp58; s16 pitch; @@ -294,7 +293,7 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); if (this->actor.params == ENDEKUNUTS_GET_FF00_2) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); sp58.x = player->actor.world.pos.x; sp58.z = player->actor.world.pos.z; @@ -318,8 +317,8 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) { pos.z = (Math_CosS(this->actor.shape.rot.y) * val) + this->actor.world.pos.z; params = (this->actor.params == ENDEKUNUTS_GET_FF00_2) ? ENDEKUNUTS_GET_FF00_2 : ENDEKUNUTS_GET_FF00_0; - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, pos.x, pos.y, pos.z, - this->actor.world.rot.x, this->actor.shape.rot.y, 0, params) != NULL) { + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, pos.x, pos.y, pos.z, this->actor.world.rot.x, + this->actor.shape.rot.y, 0, params) != NULL) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_THROW); } } else if ((this->unk_190 >= 2) && Animation_OnFrame(&this->skelAnime, 12.0f)) { @@ -345,7 +344,7 @@ void func_808BDCF0(EnDekunuts* this) { this->actionFunc = func_808BDD54; } -void func_808BDD54(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BDD54(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_190 != 0) { this->unk_190--; @@ -376,7 +375,7 @@ void func_808BDE7C(EnDekunuts* this) { this->actionFunc = func_808BDEF8; } -void func_808BDEF8(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BDEF8(EnDekunuts* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer); this->unk_18D = 3; @@ -393,7 +392,7 @@ void func_808BDF60(EnDekunuts* this) { this->actionFunc = func_808BDFB8; } -void func_808BDFB8(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BDFB8(EnDekunuts* this, PlayState* play) { s16 yaw; s16 yaw2; @@ -452,7 +451,7 @@ void func_808BE1CC(EnDekunuts* this) { this->actionFunc = func_808BE22C; } -void func_808BE22C(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE22C(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->unk_190 != 0) { @@ -482,7 +481,7 @@ void func_808BE294(EnDekunuts* this, s32 arg1) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&gDekuScrubDamageAnim)); } -void func_808BE358(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE358(EnDekunuts* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); if (SkelAnime_Update(&this->skelAnime)) { func_808BE484(this); @@ -499,13 +498,13 @@ void func_808BE3A8(EnDekunuts* this) { this->actionFunc = func_808BE3FC; } -void func_808BE3FC(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE3FC(EnDekunuts* this, PlayState* play) { if (this->unk_190 != 0) { this->unk_190--; } if (this->unk_190 == 0) { - func_808BD3B4(this, globalCtx); + func_808BD3B4(this, play); if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { func_808BDCF0(this); } else if (this->actor.colChkInfo.health == 0) { @@ -524,7 +523,7 @@ void func_808BE484(EnDekunuts* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); } -void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE4D4(EnDekunuts* this, PlayState* play) { static Color_RGBA8 D_808BEF90 = { 255, 255, 255, 255 }; static Color_RGBA8 D_808BEF94 = { 150, 150, 150, 0 }; s32 pad; @@ -534,15 +533,14 @@ void func_808BE4D4(EnDekunuts* this, GlobalContext* globalCtx) { sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y + 18.0f; sp40.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &sp40, &gZeroVec3f, &gZeroVec3f, &D_808BEF90, &D_808BEF94, 200, 0, 13); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + EffectSsDeadDb_Spawn(play, &sp40, &gZeroVec3f, &gZeroVec3f, &D_808BEF90, &D_808BEF94, 200, 0, 13); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); sp40.y = this->actor.world.pos.y + 10.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ETCETERA, this->actor.home.pos.x, this->actor.home.pos.y, + EffectSsHahen_SpawnBurst(play, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ETCETERA, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.home.rot.y, 0, 0x80); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 6.0f, 0, 6, 2, 15, 64, 10, - gDekuScrubFlowerFragmentDL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 6.0f, 0, 6, 2, 15, 64, 10, gDekuScrubFlowerFragmentDL); Actor_MarkForDeath(&this->actor); } } @@ -552,9 +550,9 @@ void func_808BE680(EnDekunuts* this) { this->actionFunc = func_808BE6C4; } -void func_808BE6C4(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE6C4(EnDekunuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { + if (Player_GetMask(play) != PLAYER_MASK_STONE) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } @@ -563,16 +561,16 @@ void func_808BE6C4(EnDekunuts* this, GlobalContext* globalCtx) { } } -void func_808BE73C(EnDekunuts* this, GlobalContext* globalCtx) { +void func_808BE73C(EnDekunuts* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { - func_808BD3B4(this, globalCtx); + func_808BD3B4(this, play); if ((this->actor.colChkInfo.mass == 50) || (this->actor.params != ENDEKUNUTS_GET_FF00_0)) { if ((this->actor.params != ENDEKUNUTS_GET_FF00_1) && !Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { @@ -606,9 +604,9 @@ void func_808BE73C(EnDekunuts* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_SMALL_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == 5) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffAlpha = 4.0f; @@ -620,7 +618,7 @@ void func_808BE73C(EnDekunuts* this, GlobalContext* globalCtx) { func_808BDE7C(this); } } - } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (globalCtx->actorCtx.unk2 != 0) && + } else if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f))) { if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { func_808BDCF0(this); @@ -628,27 +626,27 @@ void func_808BE73C(EnDekunuts* this, GlobalContext* globalCtx) { func_808BDE7C(this); } else if (this->actor.colChkInfo.health != 0) { this->actor.colChkInfo.health = 0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); func_808BE294(this, 0); } } } -void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Update(Actor* thisx, PlayState* play) { EnDekunuts* this = THIS; s32 pad; - func_808BE73C(this, globalCtx); - this->actionFunc(this, globalCtx); + func_808BE73C(this, play); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 0x1D); 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->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); @@ -661,8 +659,7 @@ void EnDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDekunuts* this = THIS; f32 arg1, arg2, arg3; f32 currentFrame; @@ -694,7 +691,7 @@ s32 EnDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnDekunuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDekunuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 D_808BEF98[] = { -1, -1, -1, 3, -1, 0, -1, 1, -1, 2, 0, 0, }; @@ -727,18 +724,18 @@ void EnDekunuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDekunuts_Draw(Actor* thisx, PlayState* play) { EnDekunuts* this = THIS; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDekunuts_OverrideLimbDraw, EnDekunuts_PostLimbDraw, &this->actor); Matrix_SetTranslateRotateYXZ(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &this->actor.home.rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->actor.colorFilterTimer != 0) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - Gfx_DrawDListOpa(globalCtx, gDekuScrubFlowerDL); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Gfx_DrawDListOpa(play, gDekuScrubFlowerDL); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } 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 39d0dd9544..596369c62a 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*); #define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c index 76934448ad..5507dff341 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c @@ -11,18 +11,17 @@ #define THIS ((EnDemoheishi*)thisx) -void EnDemoheishi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDemoheishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDemoheishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDemoheishi_Init(Actor* thisx, PlayState* play); +void EnDemoheishi_Destroy(Actor* thisx, PlayState* play); +void EnDemoheishi_Update(Actor* thisx, PlayState* play); +void EnDemoheishi_Draw(Actor* thisx, PlayState* play); void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex); void EnDemoheishi_SetupIdle(EnDemoheishi* this); -void EnDemoheishi_Idle(EnDemoheishi* this, GlobalContext* globalCtx); +void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play); void EnDemoheishi_SetupTalk(EnDemoheishi* this); -void EnDemoheishi_Talk(EnDemoheishi* this, GlobalContext* globalCtx); -s32 EnDemoheishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx); +void EnDemoheishi_Talk(EnDemoheishi* this, PlayState* play); +s32 EnDemoheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); typedef enum { /* 0 */ DEMOHEISHI_ANIMATION_STAND_HAND_ON_HIP, @@ -66,23 +65,23 @@ static ColliderCylinderInit sCylinderInit = { static u16 sTextIds[] = { 0x1473 }; // Shiro initial intro text -void EnDemoheishi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDemoheishi_Init(Actor* thisx, PlayState* play) { EnDemoheishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, - this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, this->morphTable, + 17); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 6; this->actor.gravity = -3.0f; - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); EnDemoheishi_SetupIdle(this); } -void EnDemoheishi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDemoheishi_Destroy(Actor* thisx, PlayState* play) { EnDemoheishi* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex) { @@ -123,7 +122,7 @@ void EnDemoheishi_SetupIdle(EnDemoheishi* this) { this->actionFunc = EnDemoheishi_Idle; } -void EnDemoheishi_Idle(EnDemoheishi* this, GlobalContext* globalCtx) { +void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play) { s32 absYawDiff; s16 yawDiff; @@ -131,10 +130,10 @@ void EnDemoheishi_Idle(EnDemoheishi* this, GlobalContext* globalCtx) { yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; absYawDiff = ABS_ALT(yawDiff); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnDemoheishi_SetupTalk(this); } else if (absYawDiff <= 0x4BB8) { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } @@ -143,14 +142,14 @@ void EnDemoheishi_SetupTalk(EnDemoheishi* this) { this->actionFunc = EnDemoheishi_Talk; } -void EnDemoheishi_Talk(EnDemoheishi* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void EnDemoheishi_Talk(EnDemoheishi* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); EnDemoheishi_SetupIdle(this); } } -void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDemoheishi_Update(Actor* thisx, PlayState* play) { s32 pad; EnDemoheishi* this = THIS; @@ -160,9 +159,9 @@ void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Actor_SetScale(&this->actor, 0.01f); EnDemoheishi_SetHeadRotation(this); @@ -170,11 +169,10 @@ void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 0xBB8, 0); Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 0x3E8, 0); Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } -s32 EnDemoheishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDemoheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDemoheishi* this = THIS; if (limbIndex == DEMOHEISHI_LIMB_HEAD) { @@ -186,10 +184,10 @@ s32 EnDemoheishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** return false; } -void EnDemoheishi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDemoheishi_Draw(Actor* thisx, PlayState* play) { EnDemoheishi* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDemoheishi_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h index e6a2f9a914..f67cbe0743 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h @@ -5,7 +5,7 @@ struct EnDemoheishi; -typedef void (*EnDemoheishiActionFunc)(struct EnDemoheishi*, GlobalContext*); +typedef void (*EnDemoheishiActionFunc)(struct EnDemoheishi*, PlayState*); typedef enum { /* 0 */ DEMOHEISHI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index b560638803..716d822fb2 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -10,31 +10,31 @@ #define THIS ((EnDg*)thisx) -void EnDg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDg_Init(Actor* thisx, PlayState* play); +void EnDg_Destroy(Actor* thisx, PlayState* play); +void EnDg_Update(Actor* thisx, PlayState* play); +void EnDg_Draw(Actor* thisx, PlayState* play); -void func_8098A468(EnDg* this, GlobalContext* globalCtx); -void func_8098A55C(EnDg* this, GlobalContext* globalCtx); -void func_8098A618(EnDg* this, GlobalContext* globalCtx); -void func_8098A70C(EnDg* this, GlobalContext* globalCtx); -void func_8098A89C(EnDg* this, GlobalContext* globalCtx); -void func_8098A938(EnDg* this, GlobalContext* globalCtx); -void func_8098AB48(EnDg* this, GlobalContext* globalCtx); -void func_8098AC34(EnDg* this, GlobalContext* globalCtx); -void func_8098AF44(EnDg* this, GlobalContext* globalCtx); -void func_8098AF98(EnDg* this, GlobalContext* globalCtx); -void func_8098B004(EnDg* this, GlobalContext* globalCtx); -void func_8098B198(EnDg* this, GlobalContext* globalCtx); -void func_8098B28C(EnDg* this, GlobalContext* globalCtx); -void func_8098B390(EnDg* this, GlobalContext* globalCtx); -void func_8098B560(EnDg* this, GlobalContext* globalCtx); -void func_8098B88C(EnDg* this, GlobalContext* globalCtx); -void func_8098BA64(EnDg* this, GlobalContext* globalCtx); -void func_8098BB10(EnDg* this, GlobalContext* globalCtx); -void func_8098BBEC(EnDg* this, GlobalContext* globalCtx); -void func_8098BC54(EnDg* this, GlobalContext* globalCtx); +void func_8098A468(EnDg* this, PlayState* play); +void func_8098A55C(EnDg* this, PlayState* play); +void func_8098A618(EnDg* this, PlayState* play); +void func_8098A70C(EnDg* this, PlayState* play); +void func_8098A89C(EnDg* this, PlayState* play); +void func_8098A938(EnDg* this, PlayState* play); +void func_8098AB48(EnDg* this, PlayState* play); +void func_8098AC34(EnDg* this, PlayState* play); +void func_8098AF44(EnDg* this, PlayState* play); +void func_8098AF98(EnDg* this, PlayState* play); +void func_8098B004(EnDg* this, PlayState* play); +void func_8098B198(EnDg* this, PlayState* play); +void func_8098B28C(EnDg* this, PlayState* play); +void func_8098B390(EnDg* this, PlayState* play); +void func_8098B560(EnDg* this, PlayState* play); +void func_8098B88C(EnDg* this, PlayState* play); +void func_8098BA64(EnDg* this, PlayState* play); +void func_8098BB10(EnDg* this, PlayState* play); +void func_8098BBEC(EnDg* this, PlayState* play); +void func_8098BC54(EnDg* this, PlayState* play); const ActorInit En_Dg_InitVars = { ACTOR_EN_DG, @@ -170,26 +170,26 @@ void func_80989140(SkelAnime* skelAnime, AnimationInfoS arg1[], s32 arg2) { arg1->mode, arg1->morphFrames); } -void func_80989204(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80989204(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); 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; Collider_UpdateCylinder(&this->actor, &this->collider); if ((player->transformation == PLAYER_FORM_DEKU) && (this->actionFunc == func_8098AC34)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { - Collider_ResetCylinderAT(globalCtx, &this->collider.base); + Collider_ResetCylinderAT(play, &this->collider.base); } if ((this->unk_290 != 1) && !(this->unk_280 & 2)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { - Collider_ResetCylinderOC(globalCtx, &this->collider.base); + Collider_ResetCylinderOC(play, &this->collider.base); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } void func_8098933C(EnDg* this, Vec3f* arg1) { @@ -261,7 +261,7 @@ s16 func_809895B4(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX)); } -void func_80989674(EnDg* this, GlobalContext* globalCtx) { +void func_80989674(EnDg* this, PlayState* play) { s16 phi_a1; f32 sp30; @@ -281,11 +281,11 @@ void func_80989674(EnDg* this, GlobalContext* globalCtx) { } } - if ((this->index == 21) || ((this->index == 20) && (globalCtx->sceneNum == SCENE_OMOYA))) { + if ((this->index == 21) || ((this->index == 20) && (play->sceneNum == SCENE_OMOYA))) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); } else if (this->index == 20) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); - } else if (globalCtx->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneNum == SCENE_CLOCKTOWER) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); @@ -297,7 +297,7 @@ void func_80989674(EnDg* this, GlobalContext* globalCtx) { } } -void func_80989864(EnDg* this, GlobalContext* globalCtx) { +void func_80989864(EnDg* this, PlayState* play) { s16 frame = this->skelAnime.curFrame; s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; Vec3f sp38; @@ -306,7 +306,7 @@ void func_80989864(EnDg* this, GlobalContext* globalCtx) { sp38.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; sp38.y = this->actor.world.pos.y; sp38.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp38, 10.0f, 0, 2.0f, 300, 0, 1); + Actor_SpawnFloorDustRing(play, &this->actor, &sp38, 10.0f, 0, 2.0f, 300, 0, 1); } } @@ -340,13 +340,13 @@ void func_80989A9C(EnDg* this, f32 arg1) { } } -void func_80989ADC(EnDg* this, GlobalContext* globalCtx) { +void func_80989ADC(EnDg* this, PlayState* play) { if (!(this->actor.bgCheckFlags & 0x20)) { - if ((this->index == 21) || ((this->index == 20) && (globalCtx->sceneNum == SCENE_OMOYA))) { + if ((this->index == 21) || ((this->index == 20) && (play->sceneNum == SCENE_OMOYA))) { func_80989140(&this->skelAnime, sAnimations, 1); } else if (this->index == 20) { func_80989140(&this->skelAnime, sAnimations, 2); - } else if (globalCtx->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneNum == SCENE_CLOCKTOWER) { func_80989140(&this->skelAnime, sAnimations, 2); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { func_80989140(&this->skelAnime, sAnimations, 1); @@ -379,23 +379,23 @@ void func_80989BF8(EnDg* this) { } } -void func_80989D38(EnDg* this, GlobalContext* globalCtx) { +void func_80989D38(EnDg* this, PlayState* play) { if (this->index == 21) { if (CURRENT_DAY == 1) { - Message_StartTextbox(globalCtx, 0x91C, NULL); + Message_StartTextbox(play, 0x91C, NULL); } else { - Message_StartTextbox(globalCtx, 0x91E, NULL); + Message_StartTextbox(play, 0x91E, NULL); } } else if ((this->index >= 0) && (this->index < 14)) { - Message_StartTextbox(globalCtx, sRacetrackDogInfo[this->index].textId, NULL); + Message_StartTextbox(play, sRacetrackDogInfo[this->index].textId, NULL); } else if (this->index == 20) { - Message_StartTextbox(globalCtx, 0x353D, NULL); + Message_StartTextbox(play, 0x353D, NULL); } else { - Message_StartTextbox(globalCtx, 0x627, NULL); + Message_StartTextbox(play, 0x627, NULL); } } -void func_80989E18(EnDg* this, GlobalContext* globalCtx) { +void func_80989E18(EnDg* this, PlayState* play) { RacetrackDogInfo* temp; if ((D_8098C2A0 != 0) && !(this->unk_280 & 1)) { @@ -406,7 +406,7 @@ void func_80989E18(EnDg* this, GlobalContext* globalCtx) { this->unk_280 &= ~1; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); this->unk_290 = 1; sSelectedRacetrackDogInfo = sRacetrackDogInfo[this->index]; @@ -419,20 +419,20 @@ void func_80989E18(EnDg* this, GlobalContext* globalCtx) { func_80989140(&this->skelAnime, sAnimations, 5); this->actor.flags &= ~ACTOR_FLAG_1; this->actor.speedXZ = 0.0f; - if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) { + if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); this->actionFunc = func_8098BBEC; } else { this->actionFunc = func_8098BA64; } } else { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } -s32 func_80989FC8(GlobalContext* globalCtx) { - EnDg* enemy = (EnDg*)globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; +s32 func_80989FC8(PlayState* play) { + EnDg* enemy = (EnDg*)play->actorCtx.actorLists[ACTORCAT_ENEMY].first; f32 minDist = 9999.0f; f32 dist; @@ -459,12 +459,12 @@ s32 func_80989FC8(GlobalContext* globalCtx) { return false; } -void func_8098A064(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A064(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags3 & 0x20000000) { if (D_8098C2A4.unk_00 == 99) { - func_80989FC8(globalCtx); + func_80989FC8(play); } if (this->index == D_8098C2A4.unk_00) { @@ -482,13 +482,13 @@ void func_8098A064(EnDg* this, GlobalContext* globalCtx) { } else if (this->index == D_8098C2A4.unk_00) { this->unk_280 &= ~0x20; D_8098C2A4.unk_00 = 99; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); this->actionFunc = func_8098A468; } } -s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8098A1B4(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (player->transformation) { case PLAYER_FORM_GORON: @@ -507,8 +507,8 @@ s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) { return false; } -void func_8098A234(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A234(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(this->actor.bgCheckFlags & 0x20)) { switch (player->transformation) { @@ -516,7 +516,7 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) { if (this->unk_28C != 1) { this->unk_28C = 1; this->unk_280 &= ~2; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } break; @@ -530,7 +530,7 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) { if ((this->unk_28C != 5) && (this->unk_28C != 4)) { this->unk_28C = 5; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } break; @@ -545,7 +545,7 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) { if ((this->unk_28C != 3) && (this->unk_28C != 2)) { this->unk_28C = 3; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } break; @@ -559,25 +559,25 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) { if ((this->unk_28C != 7) && (this->unk_28C != 6)) { this->unk_28C = 7; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } break; } } } -void func_8098A468(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A468(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; - func_80989674(this, globalCtx); + func_80989674(this, play); Actor_MoveWithGravity(&this->actor); if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, globalCtx); + func_80989E18(this, play); } - func_8098A064(this, globalCtx); + func_8098A064(this, play); func_80989974(this); if (!(this->actor.bgCheckFlags & 1)) { this->actionFunc = func_8098AF98; @@ -590,11 +590,11 @@ void func_8098A468(EnDg* this, GlobalContext* globalCtx) { } } -void func_8098A55C(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A55C(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, globalCtx); + func_80989E18(this, play); } func_809899C8(this, 13.0f); @@ -605,11 +605,11 @@ void func_8098A55C(EnDg* this, GlobalContext* globalCtx) { if (DECR(this->unk_282) == 0) { this->unk_282 = Rand_S16Offset(60, 60); - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } } -void func_8098A618(EnDg* this, GlobalContext* globalCtx) { +void func_8098A618(EnDg* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -631,8 +631,8 @@ void func_8098A618(EnDg* this, GlobalContext* globalCtx) { func_80989A9C(this, 0); } -void func_8098A70C(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A70C(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a1; if (this->actor.xzDistToPlayer < 250.0f) { @@ -669,7 +669,7 @@ void func_8098A70C(EnDg* this, GlobalContext* globalCtx) { } } -void func_8098A89C(EnDg* this, GlobalContext* globalCtx) { +void func_8098A89C(EnDg* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 250.0f) { @@ -682,8 +682,8 @@ void func_8098A89C(EnDg* this, GlobalContext* globalCtx) { func_80989A08(this, 19.0f); } -void func_8098A938(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098A938(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -717,7 +717,7 @@ void func_8098A938(EnDg* this, GlobalContext* globalCtx) { func_80989A08(this, 5.0f); } -void func_8098AAAC(EnDg* this, GlobalContext* globalCtx) { +void func_8098AAAC(EnDg* this, PlayState* play) { this->unk_280 &= ~8; Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.1f, 0.5f); Actor_MoveWithGravity(&this->actor); @@ -730,8 +730,8 @@ void func_8098AAAC(EnDg* this, GlobalContext* globalCtx) { func_80989A08(this, 3.0f); } -void func_8098AB48(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098AB48(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(this->actor.bgCheckFlags & 1)) { this->actionFunc = func_8098AF98; @@ -749,13 +749,13 @@ void func_8098AB48(EnDg* this, GlobalContext* globalCtx) { this->actionFunc = func_8098B004; } - func_8098A064(this, globalCtx); + func_8098A064(this, play); if (!(this->unk_280 & 0x20)) { func_80989A48(this); } } -void func_8098AC34(EnDg* this, GlobalContext* globalCtx) { +void func_8098AC34(EnDg* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; if ((this->actor.xyzDistToPlayerSq < 800.0f) && (this->collider.base.atFlags & AT_BOUNCED)) { @@ -780,7 +780,7 @@ void func_8098AC34(EnDg* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { sAnimations[14].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; } - func_80989864(this, globalCtx); + func_80989864(this, play); } else { this->unk_280 |= 2; if (Animation_OnFrame(&this->skelAnime, 9.0f)) { @@ -793,7 +793,7 @@ void func_8098AC34(EnDg* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 2.5f, 0.2f, 1.0f); } if (sp26 >= 0x18) { - func_80989864(this, globalCtx); + func_80989864(this, play); } Actor_MoveWithGravity(&this->actor); } @@ -802,7 +802,7 @@ void func_8098AC34(EnDg* this, GlobalContext* globalCtx) { } // Unused? -void func_8098AE58(EnDg* this, GlobalContext* globalCtx) { +void func_8098AE58(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { func_80989140(&this->skelAnime, sAnimations, 11); this->actionFunc = func_8098B28C; @@ -820,7 +820,7 @@ void func_8098AE58(EnDg* this, GlobalContext* globalCtx) { func_809899C8(this, 5.0f); } -void func_8098AF44(EnDg* this, GlobalContext* globalCtx) { +void func_8098AF44(EnDg* this, PlayState* play) { if (func_801A46F8() == 1) { this->unk_292 = 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); @@ -828,7 +828,7 @@ void func_8098AF44(EnDg* this, GlobalContext* globalCtx) { } } -void func_8098AF98(EnDg* this, GlobalContext* globalCtx) { +void func_8098AF98(EnDg* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { func_80989140(&this->skelAnime, sAnimations, 2); this->actionFunc = func_8098A468; @@ -838,8 +838,8 @@ void func_8098AF98(EnDg* this, GlobalContext* globalCtx) { func_809899C8(this, 3.0f); } -void func_8098B004(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098B004(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -863,7 +863,7 @@ void func_8098B004(EnDg* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } - func_8098A064(this, globalCtx); + func_8098A064(this, play); Actor_MoveWithGravity(&this->actor); func_80989974(this); if (!(this->unk_280 & 0x20)) { @@ -871,7 +871,7 @@ void func_8098B004(EnDg* this, GlobalContext* globalCtx) { } } -void func_8098B198(EnDg* this, GlobalContext* globalCtx) { +void func_8098B198(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 72.0f) { func_80989140(&this->skelAnime, sAnimations, 14); this->actionFunc = func_8098AC34; @@ -891,7 +891,7 @@ void func_8098B198(EnDg* this, GlobalContext* globalCtx) { func_80989A9C(this, 4.0f); } -void func_8098B28C(EnDg* this, GlobalContext* globalCtx) { +void func_8098B28C(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 200.0f) { func_80989140(&this->skelAnime, sAnimations, 1); this->actionFunc = func_8098AE58; @@ -913,7 +913,7 @@ void func_8098B28C(EnDg* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } -void func_8098B390(EnDg* this, GlobalContext* globalCtx) { +void func_8098B390(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { func_80989140(&this->skelAnime, sAnimations, 11); this->actionFunc = func_8098B28C; @@ -929,14 +929,14 @@ void func_8098B390(EnDg* this, GlobalContext* globalCtx) { func_809899C8(this, 5.0f); } -void func_8098B464(EnDg* this, GlobalContext* globalCtx) { +void func_8098B464(EnDg* this, PlayState* play) { Vec3f sp2C; sp2C.x = this->actor.world.pos.x; sp2C.y = this->actor.world.pos.y + this->actor.depthInWater; sp2C.z = this->actor.world.pos.z + 20.0f; - EffectSsGSplash_Spawn(globalCtx, &sp2C, NULL, NULL, 0, 800); - EffectSsGRipple_Spawn(globalCtx, &sp2C, 100, 500, 30); + EffectSsGSplash_Spawn(play, &sp2C, NULL, NULL, 0, 800); + EffectSsGRipple_Spawn(play, &sp2C, 100, 500, 30); if (this->actor.depthInWater > 0.0f) { this->actor.gravity = 0.0f; this->actor.velocity.y = -3.0f; @@ -949,7 +949,7 @@ void func_8098B464(EnDg* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_8098B560(EnDg* this, GlobalContext* globalCtx) { +void func_8098B560(EnDg* this, PlayState* play) { Vec3f sp54; Vec3f pos; s16 sp46 = 0; @@ -971,7 +971,7 @@ void func_8098B560(EnDg* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); } this->unk_284 = 5; - EffectSsGRipple_Spawn(globalCtx, &sp54, 100, 500, 30); + EffectSsGRipple_Spawn(play, &sp54, 100, 500, 30); } if (this->actor.depthInWater > 15.0f) { @@ -980,9 +980,9 @@ void func_8098B560(EnDg* this, GlobalContext* globalCtx) { this->actor.velocity.y = -0.5f; } - sp34 = BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos); + sp34 = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos); if (this->actor.bgCheckFlags & 8) { - if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, pos.x, pos.z, &waterSurface, &waterBox)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, pos.x, pos.z, &waterSurface, &waterBox)) { if (sp34 > -100.0f) { this->unk_280 &= ~4; this->actionFunc = func_8098B88C; @@ -1016,7 +1016,7 @@ void func_8098B560(EnDg* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { +void func_8098B88C(EnDg* this, PlayState* play) { Vec3f sp34; sp34.x = this->actor.world.pos.x; @@ -1025,7 +1025,7 @@ void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { if (DECR(this->unk_284) == 0) { this->unk_284 = 5; - EffectSsGRipple_Spawn(globalCtx, &sp34, 100, 500, 30); + EffectSsGRipple_Spawn(play, &sp34, 100, 500, 30); } if (this->actor.depthInWater > 15.0f) { @@ -1037,7 +1037,7 @@ void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { this->actor.world.pos.y = sp34.y; this->actor.velocity.y = 10.0f; - EffectSsGSplash_Spawn(globalCtx, &sp34, NULL, NULL, 0, 800); + EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 800); } if (!(this->actor.bgCheckFlags & 0x20)) { @@ -1056,8 +1056,8 @@ void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_8098BA64(EnDg* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { +void func_8098BA64(EnDg* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { this->unk_290 = 2; this->actor.flags |= ACTOR_FLAG_1; if (D_8098C2A0 != 0) { @@ -1074,8 +1074,8 @@ void func_8098BA64(EnDg* this, GlobalContext* globalCtx) { } } -void func_8098BB10(EnDg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8098BB10(EnDg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.bgCheckFlags & 1) { if (this->unk_280 & 0x10) { @@ -1086,47 +1086,47 @@ void func_8098BB10(EnDg* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.gravity = -3.0f; if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, globalCtx); + func_80989E18(this, play); } } if (DECR(this->unk_28A) == 0) { this->unk_290 = 0; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); this->actionFunc = func_8098A468; } Actor_MoveWithGravity(&this->actor); } -void func_8098BBEC(EnDg* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_8098BBEC(EnDg* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80989D38(this, globalCtx); + func_80989D38(this, play); this->actionFunc = func_8098BC54; } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void func_8098BC54(EnDg* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 2) { +void func_8098BC54(EnDg* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 2) { func_80989140(&this->skelAnime, sAnimations, 0); this->actionFunc = func_8098BA64; } } -void EnDg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDg_Init(Actor* thisx, PlayState* play) { EnDg* this = THIS; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, DOG_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, DOG_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); - this->path = SubS_GetPathByIndex(globalCtx, ENDG_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENDG_GET_PATH(&this->actor), 0x3F); Actor_SetScale(&this->actor, 0.0075f); this->actor.targetMode = 1; this->actor.gravity = -3.0f; @@ -1137,41 +1137,41 @@ void EnDg_Init(Actor* thisx, GlobalContext* globalCtx) { this->index = ENDG_GET_INDEX(&this->actor); this->unk_28C = 0; this->unk_290 = 0; - if (globalCtx->sceneNum == SCENE_F01_B) { + if (play->sceneNum == SCENE_F01_B) { this->unk_28A = 100; func_80989BF8(this); } - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } -void EnDg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDg_Destroy(Actor* thisx, PlayState* play) { EnDg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDg_Update(Actor* thisx, PlayState* play) { EnDg* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp28 = { 0.0f, 0.0f, 0.0f }; this->selectedDogIndex = sSelectedRacetrackDogInfo.index; - if (!(player->stateFlags1 & 0x20) || (globalCtx->sceneNum != SCENE_CLOCKTOWER)) { - if (func_8098A1B4(this, globalCtx)) { - func_8098A234(this, globalCtx); + if (!(player->stateFlags1 & 0x20) || (play->sceneNum != SCENE_CLOCKTOWER)) { + if (func_8098A1B4(this, play)) { + func_8098A234(this, play); } else if (this->unk_28C != 8) { this->unk_28C = 8; - func_80989ADC(this, globalCtx); + func_80989ADC(this, play); } - if ((this->actor.bgCheckFlags & 0x40) && Actor_HasNoParent(&this->actor, globalCtx)) { + if ((this->actor.bgCheckFlags & 0x40) && Actor_HasNoParent(&this->actor, play)) { func_80989140(&this->skelAnime, sAnimations, 15); this->actionFunc = func_8098B464; } - this->actionFunc(this, globalCtx); - func_80989204(this, globalCtx); + this->actionFunc(this, play); + func_80989204(this, play); func_8098933C(this, &sp28); Math_ApproachF(&this->unk_294.x, sp28.x, 0.2f, 0.1f); Math_ApproachF(&this->unk_294.z, sp28.z, 0.2f, 0.1f); @@ -1179,11 +1179,11 @@ void EnDg_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnDg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnDg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnDg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDg* this = THIS; Vec3f sp20 = { 0.0f, 20.0f, 0.0f }; @@ -1197,12 +1197,12 @@ void EnDg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnDg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDg_Draw(Actor* thisx, PlayState* play) { EnDg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); @@ -1241,8 +1241,8 @@ void EnDg_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZF(this->unk_294.z, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDg_OverrideLimbDraw, EnDg_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.h b/src/overlays/actors/ovl_En_Dg/z_en_dg.h index ca85d4a4da..43e65b5f87 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.h +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.h @@ -16,7 +16,7 @@ typedef enum { struct EnDg; -typedef void (*EnDgActionFunc)(struct EnDg*, GlobalContext*); +typedef void (*EnDgActionFunc)(struct EnDg*, PlayState*); #define ENDG_GET_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5) #define ENDG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index d093f29ffa..a3c995d187 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -11,37 +11,37 @@ #define THIS ((EnDinofos*)thisx) -void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDinofos_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDinofos_Init(Actor* thisx, PlayState* play); +void EnDinofos_Destroy(Actor* thisx, PlayState* play); +void EnDinofos_Update(Actor* thisx, PlayState* play); +void EnDinofos_Draw(Actor* thisx, PlayState* play); -void func_8089B834(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D318(EnDinofos* this, GlobalContext* globalCtx); -void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D018(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B288(EnDinofos* this, GlobalContext* globalCtx); -void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B580(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C724(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C938(EnDinofos* this, GlobalContext* globalCtx); +void func_8089B834(EnDinofos* this, PlayState* play); +void func_8089D318(EnDinofos* this, PlayState* play); +void func_8089BBB4(EnDinofos* this, PlayState* play); +void func_8089B8B0(EnDinofos* this, PlayState* play); +void func_8089C56C(EnDinofos* this, PlayState* play); +void func_8089C44C(EnDinofos* this, PlayState* play); +void func_8089BB60(EnDinofos* this, PlayState* play); +void func_8089C0DC(EnDinofos* this, PlayState* play); +void func_8089D018(EnDinofos* this, PlayState* play); +void func_8089B288(EnDinofos* this, PlayState* play); +void func_8089BD28(EnDinofos* this, PlayState* play); +void func_8089D1E0(EnDinofos* this, PlayState* play); +void func_8089B98C(EnDinofos* this, PlayState* play); +void func_8089CA74(EnDinofos* this, PlayState* play); +void func_8089B3D4(EnDinofos* this, PlayState* play); +void func_8089CB10(EnDinofos* this, PlayState* play); +void func_8089CBEC(EnDinofos* this, PlayState* play); +void func_8089CF00(EnDinofos* this, PlayState* play); +void func_8089CF70(EnDinofos* this, PlayState* play); +void func_8089B580(EnDinofos* this, PlayState* play); +void func_8089B72C(EnDinofos* this, PlayState* play); +void func_8089C2A8(EnDinofos* this, PlayState* play); +void func_8089C1F8(EnDinofos* this, PlayState* play); +void func_8089C724(EnDinofos* this, PlayState* play); +void func_8089C7B8(EnDinofos* this, PlayState* play); +void func_8089C938(EnDinofos* this, PlayState* play); void func_8089C4F8(EnDinofos* this); void func_8089BAC0(EnDinofos* this); void func_8089C024(EnDinofos* this, s32 arg1); @@ -258,7 +258,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_STOP), }; -void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDinofos_Init(Actor* thisx, PlayState* play) { static s32 D_8089E364 = 0; static EffectBlureInit2 D_8089E368 = { 0, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8, @@ -270,12 +270,11 @@ void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); - Effect_Add(globalCtx, &this->unk_2A0, EFFECT_BLURE2, 0, 0, &D_8089E368); - Collider_InitAndSetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, - this->colliderJntSphElement); - Collider_InitAndSetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); + Effect_Add(play, &this->unk_2A0, EFFECT_BLURE2, 0, 0, &D_8089E368); + Collider_InitAndSetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElement); + Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dinofos_Skel_009570, &object_dinofos_Anim_002E40, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dinofos_Skel_009570, &object_dinofos_Anim_002E40, this->jointTable, this->morphTable, 21); if (D_8089E364 == 0) { @@ -305,12 +304,12 @@ void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { D_8089E350++; } -void EnDinofos_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDinofos_Destroy(Actor* thisx, PlayState* play) { EnDinofos* this = THIS; - Effect_Destroy(globalCtx, this->unk_2A0); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); - Collider_DestroyQuad(globalCtx, &this->colliderQuad); + Effect_Destroy(play, this->unk_2A0); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyQuad(play, &this->colliderQuad); } void func_8089A900(EnDinofos* this) { @@ -333,27 +332,27 @@ s32 func_8089A968(EnDinofos* this) { return false; } -void func_8089A9B0(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089A9B0(EnDinofos* this, PlayState* play) { if (func_8089A968(this)) { if (this->actor.xzDistToPlayer < 100.0f) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && (((this->actionFunc != func_8089C56C) && (Rand_ZeroOne() > 0.35f)) || ((this->actionFunc == func_8089C56C) && (Rand_ZeroOne() > 0.8f)))) { func_8089C4F8(this); } else { - func_8089BBB4(this, globalCtx); + func_8089BBB4(this, play); } } else if ((this->actor.xzDistToPlayer < 260.0f) && (this->actor.xzDistToPlayer > 180.0f)) { if (((this->actionFunc != func_8089C44C) && (Rand_ZeroOne() < 0.1f)) || ((this->actionFunc == func_8089C44C) && (Rand_ZeroOne() < 0.05f))) { func_8089C024(this, 0); } else { - func_8089BBB4(this, globalCtx); + func_8089BBB4(this, play); } } else if (Rand_ZeroOne() < 0.8f) { - func_8089B8B0(this, globalCtx); + func_8089B8B0(this, play); } else { - func_8089BBB4(this, globalCtx); + func_8089BBB4(this, play); } } else if (Rand_ZeroOne() < 0.6f) { func_8089BAC0(this); @@ -362,15 +361,15 @@ void func_8089A9B0(EnDinofos* this, GlobalContext* globalCtx) { } } -void func_8089ABF4(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089ABF4(EnDinofos* this, PlayState* play) { if (this->subCamId != CAM_ID_MAIN) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); + Camera* subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { - func_800B724C(globalCtx, &this->actor, 6); + func_800B724C(play, &this->actor, 6); } } } @@ -386,12 +385,12 @@ void func_8089AC70(EnDinofos* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_8089ACEC(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089ACEC(EnDinofos* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderJntSph.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 12, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 12, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -407,14 +406,14 @@ void func_8089AD70(EnDinofos* this) { } } -s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8089AE00(EnDinofos* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v1; s16 temp_v1_2; Actor* temp_v0; s32 i; - temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0); + temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); if (temp_v0 != NULL) { temp_v1 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; if (ABS_ALT(temp_v1) < 0x3000) { @@ -424,7 +423,7 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { } } - temp_v0 = func_800BC444(globalCtx, &this->actor, 80.0f); + temp_v0 = func_800BC444(play, &this->actor, 80.0f); if ((temp_v0 != NULL) && (temp_v0->id == ACTOR_EN_BOM_CHU)) { temp_v1_2 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; if (ABS_ALT(temp_v1_2) < 0x3000) { @@ -434,13 +433,13 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { } } - if (globalCtx->actorCtx.unk2 != 0) { + if (play->actorCtx.unk2 != 0) { func_8089C024(this, 1); return true; } if ((this->actor.xzDistToPlayer < 100.0f) && (player->swordState != 0) && this->actor.isTargeted && - (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && Player_IsFacingActor(&this->actor, 0x2000, globalCtx)) { + (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && Player_IsFacingActor(&this->actor, 0x2000, play)) { if (Rand_ZeroOne() < 0.5f) { func_8089C024(this, 2); } else { @@ -461,9 +460,9 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { return false; } -void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); - Player* player = GET_PLAYER(globalCtx); +void func_8089B100(EnDinofos* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); + Player* player = GET_PLAYER(play); Vec3f sp3C; Animation_Change(&this->skelAnime, &object_dinofos_Anim_001CCC, 1.0f, @@ -483,13 +482,13 @@ void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { this->actionFunc = func_8089B288; } -void func_8089B288(EnDinofos* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void func_8089B288(EnDinofos* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); this->unk_290--; Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, this->unk_2AC); Math_Vec3f_StepTo(&subCam->at, &this->unk_2C8, this->unk_2A8); - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCam->eye); if (this->unk_290 == 0) { func_8089B320(this); } @@ -505,8 +504,8 @@ void func_8089B320(EnDinofos* this) { this->actionFunc = func_8089B3D4; } -void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void func_8089B3D4(EnDinofos* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamAt; Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); @@ -523,7 +522,7 @@ void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) { subCamAt.y = subCam->at.y; } - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); if (this->actor.bgCheckFlags & 1) { func_8089B4A4(this); } @@ -543,28 +542,28 @@ void func_8089B4A4(EnDinofos* this) { this->actionFunc = func_8089B580; } -void func_8089B580(EnDinofos* this, GlobalContext* globalCtx) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void func_8089B580(EnDinofos* this, PlayState* play) { + Camera* subCam = Play_GetCamera(play, this->subCamId); this->unk_290++; if (this->unk_290 < 8) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } if (this->skelAnime.curFrame > 35.0f) { - if ((globalCtx->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { - globalCtx->envCtx.lightSettingOverride = 11; + if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { + play->envCtx.lightSettingOverride = 11; } Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); if (this->skelAnime.curFrame <= 55.0f) { func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); } } - if ((globalCtx->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { - globalCtx->envCtx.lightSettingOverride = 0xFF; + if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { + play->envCtx.lightSettingOverride = 0xFF; } if (SkelAnime_Update(&this->skelAnime)) { @@ -577,13 +576,13 @@ void func_8089B6E8(EnDinofos* this) { this->actionFunc = func_8089B72C; } -void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089B72C(EnDinofos* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_ATTACK); } if (SkelAnime_Update(&this->skelAnime)) { - func_8089ABF4(this, globalCtx); + func_8089ABF4(this, play); this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.cutscene = -1; func_8089B7B0(this); @@ -600,7 +599,7 @@ void func_8089B7B0(EnDinofos* this) { this->actionFunc = func_8089B834; } -void func_8089B834(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089B834(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_292 != 0) { this->unk_292--; @@ -611,16 +610,16 @@ void func_8089B834(EnDinofos* this, GlobalContext* globalCtx) { if (this->unk_290 != 0) { this->unk_290--; } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } -void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089B8B0(EnDinofos* this, PlayState* play) { f32 phi_f0; if (this->actionFunc != func_8089B98C) { Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_000580, -4.0f); - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { phi_f0 = 170.0f; } else { phi_f0 = 70.0f; @@ -637,12 +636,12 @@ void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx) { this->actionFunc = func_8089B98C; } -void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089B98C(EnDinofos* this, PlayState* play) { f32 phi_f0; SkelAnime_Update(&this->skelAnime); - if (!func_8089AE00(this, globalCtx)) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!func_8089AE00(this, play)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { phi_f0 = 170.0f; } else { phi_f0 = 70.0f; @@ -663,7 +662,7 @@ void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) { if (this->unk_292 != 0) { this->unk_292--; } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { @@ -687,16 +686,16 @@ void func_8089BAC0(EnDinofos* this) { this->actionFunc = func_8089BB60; } -void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089BB60(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_28C, 0x400)) { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8089BBB4(EnDinofos* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actionFunc != func_8089BD28) { s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -727,13 +726,13 @@ void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) { this->actionFunc = func_8089BD28; } -void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8089BD28(EnDinofos* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_v0; f32 sp2C = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); - if (!func_8089AE00(this, globalCtx)) { + if (!func_8089AE00(this, play)) { if (this->actor.bgCheckFlags & 8) { if (this->actor.speedXZ >= 0.0f) { phi_v0 = BINANG_ADD(this->actor.shape.rot.y, 0x4000); @@ -766,7 +765,7 @@ void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) { } this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { sp2C = 100.0f; } @@ -784,7 +783,7 @@ void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) { if (this->unk_292 != 0) { this->unk_292--; } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { @@ -811,7 +810,7 @@ void func_8089C024(EnDinofos* this, s32 arg1) { this->actionFunc = func_8089C0DC; } -void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C0DC(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1000); this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); @@ -841,7 +840,7 @@ void func_8089C164(EnDinofos* this) { this->actionFunc = func_8089C1F8; } -void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C1F8(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 1) { func_8089C398(this); @@ -858,7 +857,7 @@ void func_8089C244(EnDinofos* this) { this->actionFunc = func_8089C2A8; } -void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C2A8(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_290++; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1800); @@ -893,13 +892,13 @@ void func_8089C398(EnDinofos* this) { this->actionFunc = func_8089C44C; } -void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C44C(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->unk_290 == 1) && (this->actor.xzDistToPlayer < 280.0f) && func_8089A968(this) && (Rand_ZeroOne() < 0.6f)) { func_8089CA14(this); } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } } @@ -915,14 +914,14 @@ void func_8089C4F8(EnDinofos* this) { this->actionFunc = func_8089C56C; } -void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C56C(EnDinofos* this, PlayState* play) { this->unk_290++; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { EffectBlure_AddSpace(Effect_GetByIndex(this->unk_2A0)); this->colliderQuad.base.atFlags &= ~AT_ON; - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } else if (Animation_OnFrame(&this->skelAnime, 7.0f)) { this->colliderQuad.base.atFlags |= AT_ON; func_8089AD70(this); @@ -931,7 +930,7 @@ void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx) { } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_ATTACK); } else if (this->skelAnime.curFrame < 7.0f) { - func_8089AE00(this, globalCtx); + func_8089AE00(this, play); } } @@ -946,13 +945,13 @@ void func_8089C690(EnDinofos* this) { this->actionFunc = func_8089C724; } -void func_8089C724(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C724(EnDinofos* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); } if (SkelAnime_Update(&this->skelAnime)) { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } @@ -964,13 +963,13 @@ void func_8089C784(EnDinofos* this) { this->actionFunc = func_8089C7B8; } -void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C7B8(EnDinofos* this, PlayState* play) { if (this->unk_290 != 0) { this->unk_290--; } if (this->unk_290 == 0) { - func_8089ACEC(this, globalCtx); + func_8089ACEC(this, play); if (this->actor.colChkInfo.health == 0) { if (this->actor.cutscene == -1) { func_8089CFAC(this); @@ -980,7 +979,7 @@ void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx) { } else if (func_8089A968(this) && (this->actor.xzDistToPlayer < 100.0f)) { func_8089CA14(this); } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } } @@ -1000,7 +999,7 @@ void func_8089C87C(EnDinofos* this, s32 arg1) { this->actionFunc = func_8089C938; } -void func_8089C938(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089C938(EnDinofos* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health == 0) { @@ -1013,7 +1012,7 @@ void func_8089C938(EnDinofos* this, GlobalContext* globalCtx) { func_8089CA14(this); } else { this->colliderJntSph.base.acFlags |= AC_ON; - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } } @@ -1026,17 +1025,17 @@ void func_8089CA14(EnDinofos* this) { this->actionFunc = func_8089CA74; } -void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089CA74(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { - func_8089CB10(this, globalCtx); - } else if (!func_8089AE00(this, globalCtx) && Animation_OnFrame(&this->skelAnime, 12.0f)) { + func_8089CB10(this, play); + } else if (!func_8089AE00(this, play) && Animation_OnFrame(&this->skelAnime, 12.0f)) { this->actor.speedXZ = 8.0f; } } -void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089CB10(EnDinofos* this, PlayState* play) { s32 i; Sphere16* worldSphere; @@ -1053,14 +1052,14 @@ void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx) { worldSphere->center.z = this->limbPos[10].z; } - if (globalCtx->sceneNum == SCENE_MITURIN) { - globalCtx->envCtx.lightSettingOverride = 11; + if (play->sceneNum == SCENE_MITURIN) { + play->envCtx.lightSettingOverride = 11; } this->actionFunc = func_8089CBEC; } -void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089CBEC(EnDinofos* this, PlayState* play) { s16 temp_s3 = ((s32)randPlusMinusPoint5Scaled(0x1000) + this->actor.shape.rot.y) + this->unk_28E; Vec3f sp88; Vec3f sp7C; @@ -1086,7 +1085,7 @@ void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) { sp7C.y = randPlusMinusPoint5Scaled(0.6f) + 1.4f; sp7C.z = 0.9f * temp_f22; func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); - EffectSsDFire_Spawn(globalCtx, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); + EffectSsDFire_Spawn(play, &this->limbPos[10], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); for (end = 6, i = 3; i > 0; i--) { if (this->unk_290 < (20 + -(i * 2))) { @@ -1107,22 +1106,22 @@ void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) { if (this->unk_290 != 0) { this->unk_290--; } else { - func_8089CF00(this, globalCtx); + func_8089CF00(this, play); } } -void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089CF00(EnDinofos* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0017B8); this->colliderJntSph.base.atFlags &= ~AT_ON; - if (globalCtx->sceneNum == SCENE_MITURIN) { - globalCtx->envCtx.lightSettingOverride = 255; + if (play->sceneNum == SCENE_MITURIN) { + play->envCtx.lightSettingOverride = 255; } this->actionFunc = func_8089CF70; } -void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089CF70(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } } @@ -1135,13 +1134,13 @@ void func_8089CFAC(EnDinofos* this) { this->actionFunc = func_8089D018; } -void func_8089D018(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089D018(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { s32 temp_v0 = this->unk_288 - 10; if (this->actor.category == ACTORCAT_ENEMY) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); - func_8089ABF4(this, globalCtx); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); + func_8089ABF4(this, play); } if (temp_v0 <= 0) { @@ -1176,7 +1175,7 @@ void func_8089D11C(EnDinofos* this, s16 arg1) { this->actionFunc = func_8089D1E0; } -void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089D1E0(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f); @@ -1187,7 +1186,7 @@ void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx) { if (this->unk_292 != 0) { this->unk_292--; } else { - func_8089A9B0(this, globalCtx); + func_8089A9B0(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { @@ -1200,13 +1199,13 @@ void func_8089D2E0(EnDinofos* this) { this->actionFunc = func_8089D318; } -void func_8089D318(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089D318(EnDinofos* this, PlayState* play) { Vec3f subCamEye; if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { if (this->actor.colChkInfo.health == 0) { ActorCutscene_Start(this->actor.cutscene, &this->actor); - func_800B724C(globalCtx, &this->actor, 7); + func_800B724C(play, &this->actor, 7); } else { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } @@ -1215,17 +1214,17 @@ void func_8089D318(EnDinofos* this, GlobalContext* globalCtx) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y; subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); func_8089CFAC(this); } else { - func_8089B100(this, globalCtx); + func_8089B100(this, play); } } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void func_8089D42C(EnDinofos* this, GlobalContext* globalCtx) { +void func_8089D42C(EnDinofos* this, PlayState* play) { s16 temp_v0_2; if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) { @@ -1234,7 +1233,7 @@ void func_8089D42C(EnDinofos* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_28E, cos_rad(M_PI) * 0x2C00, 0x233); } else if (this->actionFunc == func_8089CBEC) { this->unk_28E = cos_rad(this->unk_290 * (M_PI / 20)) * 0x2C00; - } else if (!Play_InCsMode(globalCtx)) { + } else if (!Play_InCsMode(play)) { temp_v0_2 = this->unk_28E + this->actor.shape.rot.y; temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2); temp_v0_2 = CLAMP(temp_v0_2, -0x300, 0x300); @@ -1243,7 +1242,7 @@ void func_8089D42C(EnDinofos* this, GlobalContext* globalCtx) { } } -s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { +s32 func_8089D60C(EnDinofos* this, PlayState* play) { s32 i; if (this->colliderJntSph.base.acFlags & AC_HIT) { @@ -1270,7 +1269,7 @@ s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { } if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); D_8089E350--; if (D_8089E350 == 0) { if (D_8089E34C != -1) { @@ -1283,10 +1282,10 @@ s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { } } - func_8089ACEC(this, globalCtx); + func_8089ACEC(this, play); func_8089AD70(this); - if (globalCtx->sceneNum == SCENE_MITURIN) { - globalCtx->envCtx.lightSettingOverride = 255; + if (play->sceneNum == SCENE_MITURIN) { + play->envCtx.lightSettingOverride = 255; } this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); @@ -1328,7 +1327,7 @@ s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderJntSph.elements[i].info.bumper.hitPos.x, this->colliderJntSph.elements[i].info.bumper.hitPos.y, this->colliderJntSph.elements[i].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); @@ -1340,8 +1339,8 @@ s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { return false; } -void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDinofos_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDinofos* this = THIS; s32 pad; Vec3f sp30; @@ -1350,23 +1349,23 @@ void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { func_8089A900(this); } - if (!func_8089D60C(this, globalCtx) && (this->colliderQuad.base.atFlags & AT_BOUNCED)) { + if (!func_8089D60C(this, play) && (this->colliderQuad.base.atFlags & AT_BOUNCED)) { func_8089C690(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, 0x5D); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, 0x5D); if (this->actionFunc != func_8089C7B8) { if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { - if (!((globalCtx->gameplayFrames % 4) & 1)) { - Math_Vec3f_Copy(&sp30, &this->limbPos[1 + (globalCtx->gameplayFrames % 4)]); + if (!((play->gameplayFrames % 4) & 1)) { + Math_Vec3f_Copy(&sp30, &this->limbPos[1 + (play->gameplayFrames % 4)]); sp30.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &sp30, 100, 320, 0); + EffectSsGRipple_Spawn(play, &sp30, 100, 320, 0); } } if (this->actionFunc != func_8089D018) { - func_8089D42C(this, globalCtx); + func_8089D42C(this, play); } } @@ -1377,16 +1376,16 @@ void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_Vec3f_Copy(&this->actor.focus.pos, &this->limbPos[4]); this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_28E; if (this->colliderJntSph.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); 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->colliderQuad.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -1400,8 +1399,7 @@ void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 func_8089DC4C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +s32 func_8089DC4C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnDinofos* this = THIS; if (limbIndex == 16) { @@ -1411,7 +1409,7 @@ s32 func_8089DC4C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void func_8089DC84(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; @@ -1461,43 +1459,43 @@ void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* sp4C.x -= sp48->mf[3][0]; sp4C.y -= sp48->mf[3][1]; sp4C.z -= sp48->mf[3][2]; - EffectSsDFire_Spawn(globalCtx, &this->limbPos[10], &sp4C, &gZeroVec3f, 30, 22, 255 - (sp58 * 20), 20, 3, 8); + EffectSsDFire_Spawn(play, &this->limbPos[10], &sp4C, &gZeroVec3f, 30, 22, 255 - (sp58 * 20), 20, 3, 8); this->unk_292 = this->unk_290; } } } -void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDinofos_Draw(Actor* thisx, PlayState* play) { EnDinofos* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_288 == 255) { - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, 0); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); gSPSegment(POLY_OPA_DISP++, 0x08, D_8089E33C[this->unk_289]); gDPSetEnvColor(POLY_OPA_DISP++, 20, 40, 40, 255); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); POLY_OPA_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_OPA_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8089DC4C, func_8089DC84, &this->actor, POLY_OPA_DISP); } else { - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&this->actor, globalCtx, 0); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); gSPSegment(POLY_XLU_DISP++, 0x08, D_8089E33C[this->unk_289]); gDPSetEnvColor(POLY_XLU_DISP++, 20, 40, 40, this->unk_288); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP); } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index f5c7431f0a..fcdf48c320 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -5,7 +5,7 @@ struct EnDinofos; -typedef void (*EnDinofosActionFunc)(struct EnDinofos*, GlobalContext*); +typedef void (*EnDinofosActionFunc)(struct EnDinofos*, PlayState*); typedef struct EnDinofos { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 50970a4be1..0d28281ef5 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -12,14 +12,14 @@ #define THIS ((EnDnb*)thisx) -void EnDnb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDnb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDnb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDnb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDnb_Init(Actor* thisx, PlayState* play); +void EnDnb_Destroy(Actor* thisx, PlayState* play); +void EnDnb_Update(Actor* thisx, PlayState* play); +void EnDnb_Draw(Actor* thisx, PlayState* play); s32 func_80A507C0(EnDnbUnkStruct* arg0, Vec3f arg1, Vec3f arg2, u8 arg3, f32 arg4, f32 arg5); s32 func_80A5086C(EnDnbUnkStruct* arg0); -s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx); +s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play); const ActorInit En_Dnb_InitVars = { ACTOR_EN_DNB, @@ -99,13 +99,13 @@ s32 func_80A500F8(EnDnb* this) { return i; } -void EnDnb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDnb_Init(Actor* thisx, PlayState* play) { EnDnb* this = THIS; s32 i; s16* alloc; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hanareyama_obj_Colheader_004D8C); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_hanareyama_obj_Colheader_004D8C); alloc = Lib_SegmentedToVirtual(object_hanareyama_obj_Vec_004710); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { @@ -115,13 +115,13 @@ void EnDnb_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 1.0f); } -void EnDnb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDnb_Destroy(Actor* thisx, PlayState* play) { EnDnb* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnDnb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDnb_Update(Actor* thisx, PlayState* play) { EnDnb* this = THIS; s32 i; @@ -150,13 +150,13 @@ void EnDnb_Update(Actor* thisx, GlobalContext* globalCtx) { func_80A5086C(this->unk_0D38); } -void func_80A50510(EnDnb* this, GlobalContext* globalCtx) { +void func_80A50510(EnDnb* this, PlayState* play) { s32 i; Gfx** gfx = Lib_SegmentedToVirtual(object_hanareyama_obj_DLArray_004638); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { Matrix_Push(); @@ -165,22 +165,22 @@ void func_80A50510(EnDnb* this, GlobalContext* globalCtx) { Matrix_RotateYS(this->effects[i].unk_18.y, MTXMODE_APPLY); Matrix_RotateZS(this->effects[i].unk_18.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gfx[i]); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A5063C(EnDnb* this, GlobalContext* globalCtx) { +void func_80A5063C(EnDnb* this, PlayState* play) { s32 i; Gfx** gfx = Lib_SegmentedToVirtual(object_hanareyama_obj_DLArray_004638); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++) { Matrix_Push(); @@ -189,24 +189,24 @@ void func_80A5063C(EnDnb* this, GlobalContext* globalCtx) { Matrix_RotateYS(this->effects[i].unk_18.y, MTXMODE_APPLY); Matrix_RotateZS(this->effects[i].unk_18.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gfx[i]); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDnb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDnb_Draw(Actor* thisx, PlayState* play) { EnDnb* this = THIS; - if (globalCtx->actorCtx.unk4 != 0) { - func_80A50510(this, globalCtx); + if (play->actorCtx.unk4 != 0) { + func_80A50510(this, play); } else { - func_80A5063C(this, globalCtx); + func_80A5063C(this, play); } - func_80A50950(this->unk_0D38, globalCtx); + func_80A50950(this->unk_0D38, play); } s32 func_80A507C0(EnDnbUnkStruct* arg0, Vec3f arg1, Vec3f arg2, u8 arg3, f32 arg4, f32 arg5) { @@ -251,19 +251,19 @@ s32 func_80A5086C(EnDnbUnkStruct* arg0) { return count; } -s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) { +s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { static TexturePtr D_80A50CBC[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 isGfxSetup = false; s32 sp5C = 0; s32 idx; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 256; i++, arg0++) { if (arg0->isEnabled == 1) { @@ -282,10 +282,9 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) { Matrix_Translate(arg0->unk_0C.x, arg0->unk_0C.y, arg0->unk_0C.z, MTXMODE_NEW); Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = (arg0->unk_01 / (f32)arg0->unk_02) * 8.0f; gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A50CBC[idx])); gSPDisplayList(POLY_XLU_DISP++, object_hanareyama_obj_DL_000020); @@ -295,7 +294,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return sp5C; } diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c index 25fbaefaca..f1b78f25da 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c @@ -10,13 +10,13 @@ #define THIS ((EnDnh*)thisx) -void EnDnh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDnh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDnh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDnh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDnh_Init(Actor* thisx, PlayState* play); +void EnDnh_Destroy(Actor* thisx, PlayState* play); +void EnDnh_Update(Actor* thisx, PlayState* play); +void EnDnh_Draw(Actor* thisx, PlayState* play); -void func_80A50F38(EnDnh* this, GlobalContext* globalCtx); -void func_80A50F9C(EnDnh* this, GlobalContext* globalCtx); +void func_80A50F38(EnDnh* this, PlayState* play); +void func_80A50F9C(EnDnh* this, PlayState* play); #if 0 const ActorInit En_Dnh_InitVars = { diff --git a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h index 21336aa912..f0fb5ed765 100644 --- a/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h +++ b/src/overlays/actors/ovl_En_Dnh/z_en_dnh.h @@ -5,7 +5,7 @@ struct EnDnh; -typedef void (*EnDnhActionFunc)(struct EnDnh*, GlobalContext*); +typedef void (*EnDnhActionFunc)(struct EnDnh*, PlayState*); typedef struct EnDnh { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 62b040c9e9..7a2f1cf80f 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -13,14 +13,14 @@ #define THIS ((EnDnk*)thisx) -void EnDnk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDnk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDnk_Update(Actor* thisx, GlobalContext* globalCtx); +void EnDnk_Init(Actor* thisx, PlayState* play); +void EnDnk_Destroy(Actor* thisx, PlayState* play); +void EnDnk_Update(Actor* thisx, PlayState* play); -void func_80A51890(EnDnk* this, GlobalContext* globalCtx); -void EnDnk_DoNothing(EnDnk* this, GlobalContext* globalCtx); -void func_80A52018(Actor* thisx, GlobalContext* globalCtx); -void func_80A52134(EnDnk* this, GlobalContext* globalCtx); +void func_80A51890(EnDnk* this, PlayState* play); +void EnDnk_DoNothing(EnDnk* this, PlayState* play); +void func_80A52018(Actor* thisx, PlayState* play); +void func_80A52134(EnDnk* this, PlayState* play); static s16 D_80A521A0 = 0; @@ -169,35 +169,35 @@ s32 func_80A515C4(EnDnk* this) { return ret; } -void func_80A51648(EnDnk* this, GlobalContext* globalCtx) { - if (SubS_IsObjectLoaded(this->unk_28E, globalCtx) == true) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->unk_28E].segment); +void func_80A51648(EnDnk* this, PlayState* play) { + if (SubS_IsObjectLoaded(this->unk_28E, play) == true) { + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->unk_28E].segment); this->actor.draw = func_80A52018; this->actor.objBankIndex = this->unk_28E; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); switch (ENDNK_GET_3(&this->actor)) { case ENDNK_GET_3_0: - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuPalaceGuardSkel, NULL, this->jointTable, - this->morphTable, DEKU_PALACE_GUARD_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gDekuPalaceGuardSkel, NULL, this->jointTable, this->morphTable, + DEKU_PALACE_GUARD_LIMB_MAX); func_80A514F0(&this->skelAnime, 7); break; case ENDNK_GET_3_1: - SkelAnime_Init(globalCtx, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, NULL, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, NULL, this->jointTable, this->morphTable, 10); func_80A514F0(&this->skelAnime, 18); break; case ENDNK_GET_3_2: - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuScrubSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuScrubSkel, NULL, this->jointTable, this->morphTable, DEKU_SCRUB_LIMB_MAX); func_80A514F0(&this->skelAnime, 35); break; } - 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); if (ENDNK_GET_3C(&this->actor) == 4) { this->actor.flags &= ~ACTOR_FLAG_1; @@ -212,30 +212,30 @@ void func_80A51648(EnDnk* this, GlobalContext* globalCtx) { } } -void func_80A51890(EnDnk* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 126)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 126)); +void func_80A51890(EnDnk* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 126)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 126)); } } -void EnDnk_DoNothing(EnDnk* this, GlobalContext* globalCtx) { +void EnDnk_DoNothing(EnDnk* this, PlayState* play) { } -void EnDnk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDnk_Init(Actor* thisx, PlayState* play) { EnDnk* this = THIS; this->unk_28E = -1; switch (ENDNK_GET_3(&this->actor)) { case ENDNK_GET_3_1: - this->unk_28E = SubS_GetObjectIndex(OBJECT_HINTNUTS, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_HINTNUTS, play); break; case ENDNK_GET_3_0: - this->unk_28E = SubS_GetObjectIndex(OBJECT_DNK, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_DNK, play); break; case ENDNK_GET_3_2: - this->unk_28E = SubS_GetObjectIndex(OBJECT_DEKUNUTS, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_DEKUNUTS, play); break; } @@ -249,27 +249,27 @@ void EnDnk_Init(Actor* thisx, GlobalContext* globalCtx) { D_80A521A0++; } -void EnDnk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDnk_Destroy(Actor* thisx, PlayState* play) { EnDnk* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDnk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDnk_Update(Actor* thisx, PlayState* play) { EnDnk* this = THIS; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); func_80A515C4(this); Actor_SetFocus(&this->actor, 34.0f); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_80A52134(this, globalCtx); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_80A52134(this, play); } -s32 func_80A51A78(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80A51A78(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDnk* this = THIS; this->unk_260[limbIndex] = *dList; @@ -277,7 +277,7 @@ s32 func_80A51A78(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80A51AA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80A51AA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDnk* this = THIS; MtxF sp5C; Vec3f sp50 = gZeroVec3f; @@ -316,15 +316,15 @@ void func_80A51AA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_RotateZS(this->unk_294, MTXMODE_APPLY); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_260[limbIndex]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A51CB8(EnDnk* this, GlobalContext* globalCtx) { +void func_80A51CB8(EnDnk* this, PlayState* play) { static TexturePtr D_80A5245C[] = { gDekuPalaceGuardEyeOpenTex, gDekuPalaceGuardEyeHalfTex, @@ -332,20 +332,20 @@ void func_80A51CB8(EnDnk* this, GlobalContext* globalCtx) { }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A5245C[this->unk_2A0])); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51A78, func_80A51AA4, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51A78, func_80A51AA4, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 func_80A51D78(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80A51D78(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDnk* this = THIS; this->unk_260[limbIndex] = *dList; @@ -353,7 +353,7 @@ s32 func_80A51D78(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80A51DA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80A51DA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDnk* this = THIS; MtxF sp5C; Vec3f sp50 = gZeroVec3f; @@ -393,37 +393,37 @@ void func_80A51DA4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_RotateZS(this->unk_294, MTXMODE_APPLY); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_260[limbIndex]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A51FC0(EnDnk* this, GlobalContext* globalCtx) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51D78, func_80A51DA4, +void func_80A51FC0(EnDnk* this, PlayState* play) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80A51D78, func_80A51DA4, &this->actor); } -void func_80A52018(Actor* thisx, GlobalContext* globalCtx) { +void func_80A52018(Actor* thisx, PlayState* play) { EnDnk* this = THIS; switch (ENDNK_GET_3(thisx)) { case ENDNK_GET_3_0: - func_80A51CB8(this, globalCtx); + func_80A51CB8(this, play); break; case ENDNK_GET_3_1: case ENDNK_GET_3_2: - func_80A51FC0(this, globalCtx); + func_80A51FC0(this, play); break; } } -void func_80A52074(EnDnk* this, GlobalContext* globalCtx) { - switch (globalCtx->csCtx.frames) { +void func_80A52074(EnDnk* this, PlayState* play) { + switch (play->csCtx.frames) { case 80: func_8019F128(NA_SE_EN_DEKNUTS_DANCE1); break; @@ -441,14 +441,14 @@ void func_80A52074(EnDnk* this, GlobalContext* globalCtx) { break; } - if ((globalCtx->csCtx.frames >= 198) && (globalCtx->csCtx.frames < 438)) { + if ((play->csCtx.frames >= 198) && (play->csCtx.frames < 438)) { func_8019F128(NA_SE_EN_DEKNUTS_DANCE - SFX_FLAG); } } -void func_80A52134(EnDnk* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (globalCtx->sceneNum == SCENE_SPOT00) && +void func_80A52134(EnDnk* this, PlayState* play) { + if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 2)) { - func_80A52074(this, globalCtx); + func_80A52074(this, play); } } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h index 70ecdedae8..9b69135489 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.h @@ -5,7 +5,7 @@ struct EnDnk; -typedef void (*EnDnkActionFunc)(struct EnDnk*, GlobalContext*); +typedef void (*EnDnkActionFunc)(struct EnDnk*, PlayState*); #define ENDNK_GET_3(thisx) ((thisx)->params & 0x3) #define ENDNK_GET_3C(thisx) ((thisx)->params & 0x3C) diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 326f3fbf2b..e2e8e41459 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -13,32 +13,32 @@ #define THIS ((EnDno*)thisx) -void EnDno_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDno_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDno_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDno_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDno_Init(Actor* thisx, PlayState* play); +void EnDno_Destroy(Actor* thisx, PlayState* play); +void EnDno_Update(Actor* thisx, PlayState* play); +void EnDno_Draw(Actor* thisx, PlayState* play); -void func_80A71B04(EnDno* this, GlobalContext* globalCtx); -void EnDno_DoNothing(EnDno* this, GlobalContext* globalCtx); -void func_80A71B68(EnDno* this, GlobalContext* globalCtx); -void func_80A71C3C(EnDno* this, GlobalContext* globalCtx); -void func_80A71E54(EnDno* this, GlobalContext* globalCtx); -void func_80A71F18(EnDno* this, GlobalContext* globalCtx); -void func_80A72438(EnDno* this, GlobalContext* globalCtx); -void func_80A724B8(EnDno* this, GlobalContext* globalCtx); -void func_80A725E0(EnDno* this, GlobalContext* globalCtx); -void func_80A725F8(EnDno* this, GlobalContext* globalCtx); -void func_80A72AE4(EnDno* this, GlobalContext* globalCtx); -void func_80A72B3C(EnDno* this, GlobalContext* globalCtx); -void func_80A72B84(EnDno* this, GlobalContext* globalCtx); -void func_80A72BA4(EnDno* this, GlobalContext* globalCtx); -void func_80A72C04(EnDno* this, GlobalContext* globalCtx); -void func_80A72CF8(EnDno* this, GlobalContext* globalCtx); -void func_80A730A0(EnDno* this, GlobalContext* globalCtx); -void func_80A73244(EnDno* this, GlobalContext* globalCtx); -void func_80A732C8(EnDno* this, GlobalContext* globalCtx); -s32 EnDno_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); +void func_80A71B04(EnDno* this, PlayState* play); +void EnDno_DoNothing(EnDno* this, PlayState* play); +void func_80A71B68(EnDno* this, PlayState* play); +void func_80A71C3C(EnDno* this, PlayState* play); +void func_80A71E54(EnDno* this, PlayState* play); +void func_80A71F18(EnDno* this, PlayState* play); +void func_80A72438(EnDno* this, PlayState* play); +void func_80A724B8(EnDno* this, PlayState* play); +void func_80A725E0(EnDno* this, PlayState* play); +void func_80A725F8(EnDno* this, PlayState* play); +void func_80A72AE4(EnDno* this, PlayState* play); +void func_80A72B3C(EnDno* this, PlayState* play); +void func_80A72B84(EnDno* this, PlayState* play); +void func_80A72BA4(EnDno* this, PlayState* play); +void func_80A72C04(EnDno* this, PlayState* play); +void func_80A72CF8(EnDno* this, PlayState* play); +void func_80A730A0(EnDno* this, PlayState* play); +void func_80A73244(EnDno* this, PlayState* play); +void func_80A732C8(EnDno* this, PlayState* play); +s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); static AnimationSpeedInfo sAnimations[] = { { &object_dno_Anim_000470, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_0008F0, 1.0f, ANIMMODE_ONCE, 0.0f }, @@ -92,7 +92,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void func_80A711D0(EnDno* this, GlobalContext* globalCtx, Vec3f* vec) { +void func_80A711D0(EnDno* this, PlayState* play, Vec3f* vec) { f32 rand = Rand_ZeroOne() * 0.5f; Lights_PointGlowSetInfo(&this->lightInfo, vec->x, vec->y, vec->z, (127.5f * rand) + 127.5f, @@ -112,14 +112,14 @@ s32 func_80A71424(s16* arg0, s16 arg1, s16 yawToPlayer, s16 rotY, s16 arg4, s16 return ret; } -void func_80A714B4(EnDno* this, GlobalContext* globalCtx) { +void func_80A714B4(EnDno* this, PlayState* play) { Actor* actor = NULL; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); + actor = SubS_FindActor(play, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (actor != NULL) { if (ENDNO_GET_F(actor) == ENDNO_GET_F_1) { - Flags_SetSwitch(globalCtx, ENDNO_GET_7F0(actor)); + Flags_SetSwitch(play, ENDNO_GET_7F0(actor)); } actor = actor->next; } @@ -138,7 +138,7 @@ void func_80A7153C(EnDno* this, Vec3f* arg1, Vec3f* arg2) { arg1->y = arg2->y - this->actor.home.pos.y; } -void func_80A715DC(EnDno* this, GlobalContext* globalCtx) { +void func_80A715DC(EnDno* this, PlayState* play) { BgCraceMovebg* crace = NULL; s32 pad[2]; Vec3f sp88; @@ -146,7 +146,7 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) { Vec3f sp70; do { - crace = (BgCraceMovebg*)SubS_FindActor(globalCtx, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); + crace = (BgCraceMovebg*)SubS_FindActor(play, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (crace != NULL) { if (ENDNO_GET_F(&crace->actor) == ENDNO_GET_F_0 && !(crace->unk_170 & 1)) { if (SubS_LineSegVsPlane(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C, @@ -164,25 +164,25 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) { } while (crace != NULL); } -void func_80A71788(EnDno* this, GlobalContext* globalCtx) { +void func_80A71788(EnDno* this, PlayState* play) { Actor* actor = NULL; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); + actor = SubS_FindActor(play, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (actor != NULL) { - Flags_UnsetSwitch(globalCtx, ENDNO_GET_7F0(actor)); + Flags_UnsetSwitch(play, ENDNO_GET_7F0(actor)); actor = actor->next; } } while (actor != NULL); } -void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDno_Init(Actor* thisx, PlayState* play) { EnDno* this = THIS; s32 pad; Actor* actor = NULL; while (true) { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_DNO); + actor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_DNO); if (actor != NULL) { if (actor != thisx) { Actor_MarkForDeath(thisx); @@ -194,11 +194,11 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { if (actor == NULL) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dno_Skel_00E1F8, &object_dno_Anim_007CA4, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dno_Skel_00E1F8, &object_dno_Anim_007CA4, this->jointTable, this->morphTable, 28); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 0.0f, 0.0f, 0.0f, 4); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); Animation_Change(&this->skelAnime, sAnimations[14].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[14].animation), sAnimations[14].mode, sAnimations[14].morphFrames); @@ -210,14 +210,14 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENDNO_GET_C000(thisx)) { case ENDNO_GET_C000_0: - func_80A71788(this, globalCtx); + func_80A71788(this, play); if (!(gSaveContext.save.weekEventReg[23] & 0x20) || (gSaveContext.save.weekEventReg[93] & 2)) { Actor_MarkForDeath(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); thisx->room = -1; gSaveContext.unk_3DD0[1] = 5; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_3B0 |= 1; this->actionFunc = func_80A72438; this->unk_454 = 0.0f; @@ -229,7 +229,7 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(thisx); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); - this->unk_460 = SubS_FindActor(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ); + this->unk_460 = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ); if (this->unk_460 == NULL) { Actor_MarkForDeath(thisx); } else { @@ -247,23 +247,23 @@ void EnDno_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDno_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDno_Destroy(Actor* thisx, PlayState* play) { EnDno* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80A71B04(EnDno* this, GlobalContext* globalCtx) { +void func_80A71B04(EnDno* this, PlayState* play) { this->unk_452 = 0; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 19, &this->unk_32C); this->actionFunc = EnDno_DoNothing; } -void EnDno_DoNothing(EnDno* this, GlobalContext* globalCtx) { +void EnDno_DoNothing(EnDno* this, PlayState* play) { } -void func_80A71B68(EnDno* this, GlobalContext* globalCtx) { +void func_80A71B68(EnDno* this, PlayState* play) { this->unk_452 = 0; this->actor.textId = 0; if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { @@ -281,7 +281,7 @@ void func_80A71B68(EnDno* this, GlobalContext* globalCtx) { this->actionFunc = func_80A71C3C; } -void func_80A71C3C(EnDno* this, GlobalContext* globalCtx) { +void func_80A71C3C(EnDno* this, PlayState* play) { switch (this->unk_32C) { case 9: case 16: @@ -320,16 +320,16 @@ void func_80A71C3C(EnDno* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x222); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_80A71E54(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + func_80A71E54(this, play); } else if (this->actor.xzDistToPlayer < 60.0f) { - func_800B8614(&this->actor, globalCtx, 60.0f); + func_800B8614(&this->actor, play, 60.0f); } } -void func_80A71E54(EnDno* this, GlobalContext* globalCtx) { +void func_80A71E54(EnDno* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { if (gSaveContext.save.weekEventReg[27] & 1) { this->textId = 0x811; @@ -353,9 +353,9 @@ void func_80A71E54(EnDno* this, GlobalContext* globalCtx) { this->actionFunc = func_80A71F18; } -void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { +void func_80A71F18(EnDno* this, PlayState* play) { Math_ScaledStepToS(&this->unk_466, 0, 0x16C); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: if (!(this->unk_3B0 & 0x10) || Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xE38)) { @@ -364,7 +364,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 16, &this->unk_32C); case 0x811: - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); break; case 0x80C: @@ -373,7 +373,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 4, &this->unk_32C); } else if ((this->unk_32C == 4) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 11, &this->unk_32C); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } break; } @@ -381,7 +381,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { break; case 3: - if (globalCtx->msgCtx.currentTextId == 0x80B) { + if (play->msgCtx.currentTextId == 0x80B) { switch (this->unk_32C) { case 16: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { @@ -393,9 +393,9 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { case 10: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - func_801477B4(globalCtx); + func_801477B4(play); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); - func_80A71B68(this, globalCtx); + func_80A71B68(this, play); } break; } @@ -405,7 +405,7 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0x80B: switch (this->unk_32C) { case 16: @@ -415,31 +415,31 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { break; case 9: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 10, &this->unk_32C); - globalCtx->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = 0x44; } break; case 10: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - func_801477B4(globalCtx); + func_801477B4(play); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); - func_80A71B68(this, globalCtx); + func_80A71B68(this, play); } break; } break; case 0x80C: - if (Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x80D); + if (Message_ShouldAdvance(play)) { + func_80151938(play, 0x80D); } break; case 0x80D: - if (Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x80E); + if (Message_ShouldAdvance(play)) { + func_80151938(play, 0x80E); } break; @@ -450,23 +450,23 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); } - } else if ((this->unk_32C == 13) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - func_80A71B68(this, globalCtx); + } else if ((this->unk_32C == 13) && Message_ShouldAdvance(play)) { + func_801477B4(play); + func_80A71B68(this, play); } break; case 0x80F: - if (Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x810); + if (Message_ShouldAdvance(play)) { + func_80151938(play, 0x810); } break; case 0x810: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk_3B0 |= 0x20; - func_801477B4(globalCtx); - func_80A71B68(this, globalCtx); + func_801477B4(play); + func_80A71B68(this, play); break; } @@ -484,9 +484,9 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { break; case 0x811: - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - func_80A71B68(this, globalCtx); + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + func_80A71B68(this, play); } break; } @@ -494,49 +494,49 @@ void func_80A71F18(EnDno* this, GlobalContext* globalCtx) { } } -void func_80A72438(EnDno* this, GlobalContext* globalCtx) { +void func_80A72438(EnDno* this, PlayState* play) { this->unk_452 = 1; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); this->actor.textId = 0; - if (Flags_GetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor))) { + if (Flags_GetSwitch(play, ENDNO_GET_3F80(&this->actor))) { this->unk_454 = 1.0f; } this->actionFunc = func_80A724B8; } -void func_80A724B8(EnDno* this, GlobalContext* globalCtx) { +void func_80A724B8(EnDno* this, PlayState* play) { if (this->actor.xzDistToPlayer < 120.0f) { func_80A71424(&this->unk_466, 0, this->actor.yawTowardsPlayer, this->actor.home.rot.y, 0x2000, 0x2D8); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80A725E0(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80A725E0(this, play); } else if (this->actor.xzDistToPlayer < 60.0f) { - func_800B8614(&this->actor, globalCtx, 60.0f); + func_800B8614(&this->actor, play, 60.0f); } } -void func_80A7256C(EnDno* this, GlobalContext* globalCtx) { - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, EXCH_ITEM_MINUS1); +void func_80A7256C(EnDno* this, PlayState* play) { + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, EXCH_ITEM_MINUS1); } -void func_80A72598(EnDno* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80A725E0(this, globalCtx); +void func_80A72598(EnDno* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80A725E0(this, play); } else { - func_80A7256C(this, globalCtx); + func_80A7256C(this, play); } } -void func_80A725E0(EnDno* this, GlobalContext* globalCtx) { +void func_80A725E0(EnDno* this, PlayState* play) { this->actionFunc = func_80A725F8; } -void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { +void func_80A725F8(EnDno* this, PlayState* play) { s32 pad[2]; func_80A71424(&this->unk_466, 0, 0, 0, 0x2000, 0x16C); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: switch (this->unk_328) { case 0: @@ -545,12 +545,12 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 5, &this->unk_32C); } } else if ((this->unk_32C == 5) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (Flags_GetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor))) { - Message_StartTextbox(globalCtx, 0x801, &this->actor); - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_SCENTS) { - Message_StartTextbox(globalCtx, 0x806, &this->actor); + if (Flags_GetSwitch(play, ENDNO_GET_3F80(&this->actor))) { + Message_StartTextbox(play, 0x801, &this->actor); + } else if (Player_GetMask(play) == PLAYER_MASK_SCENTS) { + Message_StartTextbox(play, 0x806, &this->actor); } else { - Message_StartTextbox(globalCtx, 0x800, &this->actor); + Message_StartTextbox(play, 0x800, &this->actor); } SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); } @@ -559,12 +559,12 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { case 2: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) { gSaveContext.save.weekEventReg[93] |= 2; - Message_StartTextbox(globalCtx, 0x802, &this->actor); + Message_StartTextbox(play, 0x802, &this->actor); } break; case 3: - Message_StartTextbox(globalCtx, 0x804, &this->actor); + Message_StartTextbox(play, 0x804, &this->actor); break; } break; @@ -572,7 +572,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { case 1: case 2: case 3: - if (((globalCtx->msgCtx.currentTextId == 0x800) || (globalCtx->msgCtx.currentTextId == 0x801)) && + if (((play->msgCtx.currentTextId == 0x800) || (play->msgCtx.currentTextId == 0x801)) && (this->unk_32C == 8)) { Math_SmoothStepToF(&this->unk_454, 1.0f, 1.0f, 0.1f, 0.01f); if (this->skelAnime.curFrame <= 23.0f) { @@ -588,7 +588,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 12, &this->unk_32C); - Message_StartTextbox(globalCtx, 0x803, &this->actor); + Message_StartTextbox(play, 0x803, &this->actor); } } break; @@ -596,11 +596,11 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0x800: case 0x801: - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x44; + if (Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x44; this->unk_452 = 1; this->unk_454 = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 8, &this->unk_32C); @@ -608,103 +608,103 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { break; case 0x802: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (INV_CONTENT(ITEM_MASK_SCENTS) == ITEM_MASK_SCENTS) { this->unk_458 = GI_RUPEE_RED; } else { this->unk_458 = GI_MASK_SCENTS; } - Actor_PickUp(&this->actor, globalCtx, this->unk_458, 60.0f, 60.0f); - func_801477B4(globalCtx); - func_80A72B84(this, globalCtx); + Actor_PickUp(&this->actor, play, this->unk_458, 60.0f, 60.0f); + func_801477B4(play); + func_80A72B84(this, play); } break; case 0x803: - if (Message_ShouldAdvance(globalCtx)) { - func_80A72AE4(this, globalCtx); + if (Message_ShouldAdvance(play)) { + func_80A72AE4(this, play); } break; case 0x804: if (this->unk_32C == 14) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 5, &this->unk_32C); if (!(this->unk_3B0 & 0x40)) { - func_80A72CF8(this, globalCtx); + func_80A72CF8(this, play); this->unk_3B0 |= 0x40; } } } else if ((this->unk_32C == 5) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - func_801477B4(globalCtx); - func_80A72438(this, globalCtx); + func_801477B4(play); + func_80A72438(this, play); } break; case 0x806: - if (Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x800); + if (Message_ShouldAdvance(play)) { + func_80151938(play, 0x800); } break; default: - func_80A72438(this, globalCtx); + func_80A72438(this, play); break; } break; } } -void func_80A72AE4(EnDno* this, GlobalContext* globalCtx) { +void func_80A72AE4(EnDno* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->unk_32C); - func_80A714B4(this, globalCtx); + func_80A714B4(this, play); this->actionFunc = func_80A72B3C; } -void func_80A72B3C(EnDno* this, GlobalContext* globalCtx) { +void func_80A72B3C(EnDno* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_44E = 0; - func_80A72C04(this, globalCtx); + func_80A72C04(this, play); } } -void func_80A72B84(EnDno* this, GlobalContext* globalCtx) { +void func_80A72B84(EnDno* this, PlayState* play) { this->unk_328 = 3; this->actionFunc = func_80A72BA4; } -void func_80A72BA4(EnDno* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A72BA4(EnDno* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80A72598; } else { - Actor_PickUp(&this->actor, globalCtx, this->unk_458, 60.0f, 60.0f); + Actor_PickUp(&this->actor, play, this->unk_458, 60.0f, 60.0f); } } -void func_80A72C04(EnDno* this, GlobalContext* globalCtx) { +void func_80A72C04(EnDno* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->unk_32C); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Math_Vec3f_Copy(&this->unk_334, &this->actor.world.pos); - SubS_ActorPathing_Init(globalCtx, &this->unk_334, &this->actor, &this->actorPath, globalCtx->setupPathList, + SubS_ActorPathing_Init(play, &this->unk_334, &this->actor, &this->actorPath, play->setupPathList, ENDNO_GET_7F(&this->actor), 1, 0, 1, 0); - SubS_ActorPathing_ComputePointInfo(globalCtx, &this->actorPath); + SubS_ActorPathing_ComputePointInfo(play, &this->actorPath); this->actor.world.rot.y = this->actorPath.rotToCurPoint.y; this->actor.world.rot.x = this->actorPath.rotToCurPoint.x; - Flags_SetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor)); + Flags_SetSwitch(play, ENDNO_GET_3F80(&this->actor)); this->actionFunc = func_80A730A0; } -void func_80A72CF8(EnDno* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, this->actor.world.pos.x + 80.0f, +void func_80A72CF8(EnDno* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, this->actor.world.pos.x + 80.0f, this->actor.floorHeight, this->actor.world.pos.z, 0, 0, 0, 0x201); } -s32 EnDno_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 EnDno_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; s32 pad; s32 ret = false; @@ -744,7 +744,7 @@ s32 EnDno_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* a return ret; } -s32 EnDno_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 EnDno_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; EnDno* this = (EnDno*)thisx; f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ; @@ -761,7 +761,7 @@ s32 EnDno_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) { return false; } -void func_80A730A0(EnDno* this, GlobalContext* globalCtx) { +void func_80A730A0(EnDno* this, PlayState* play) { f32 temp_f10; s32 phi_a2; @@ -786,7 +786,7 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) { } } - SubS_ActorPathing_Update(globalCtx, &this->actorPath, SubS_ActorPathing_ComputePointInfo, + SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, EnDno_ActorPathing_UpdateActorInfo, EnDno_ActorPathing_Move, SubS_ActorPathing_SetNextPoint); this->unk_45C += 6553; @@ -799,7 +799,7 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) { this->unk_3AC += 4500; this->unk_3AE += 1000; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - func_80A715DC(this, globalCtx); + func_80A715DC(this, play); func_800B9010(&this->actor, NA_SE_EV_BUTLER_FRY - SFX_FLAG); if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_PERMANENT) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actorPath.curPoint); @@ -807,22 +807,22 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) { this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.z = 0.0f; - func_80A73244(this, globalCtx); + func_80A73244(this, play); } } -void func_80A73244(EnDno* this, GlobalContext* globalCtx) { +void func_80A73244(EnDno* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_8000000; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->unk_328 = 2; this->actor.speedXZ = 0.0f; - Flags_UnsetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor)); + Flags_UnsetSwitch(play, ENDNO_GET_3F80(&this->actor)); gSaveContext.unk_3DD0[1] = 5; this->unk_44E = 0; this->actionFunc = func_80A732C8; } -void func_80A732C8(EnDno* this, GlobalContext* globalCtx) { +void func_80A732C8(EnDno* this, PlayState* play) { s32 pad; if (this->unk_44E == 0) { @@ -834,7 +834,7 @@ void func_80A732C8(EnDno* this, GlobalContext* globalCtx) { } else if (this->unk_44E == 3) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); - func_80A72438(this, globalCtx); + func_80A72438(this, play); } else { if (this->skelAnime.curFrame >= 20.0f) { Math_SmoothStepToF(&this->unk_454, 0.0f, 1.0f, 0.125f, 0.01f); @@ -851,15 +851,15 @@ void func_80A732C8(EnDno* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80A73408(EnDno* this, GlobalContext* globalCtx) { +void func_80A73408(EnDno* this, PlayState* play) { s32 phi_a2; u8 sp33 = true; s32 temp_v0; - if (Cutscene_CheckActorAction(globalCtx, 475)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, 475); - if (this->unk_468 != globalCtx->csCtx.actorActions[temp_v0]->action) { - switch (globalCtx->csCtx.actorActions[temp_v0]->action) { + if (Cutscene_CheckActorAction(play, 475)) { + temp_v0 = Cutscene_GetActorActionIndex(play, 475); + if (this->unk_468 != play->csCtx.actorActions[temp_v0]->action) { + switch (play->csCtx.actorActions[temp_v0]->action) { case 1: phi_a2 = 13; break; @@ -878,7 +878,7 @@ void func_80A73408(EnDno* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->unk_32C); } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->unk_32C == 17)) { @@ -887,29 +887,29 @@ void func_80A73408(EnDno* this, GlobalContext* globalCtx) { } } -void EnDno_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDno_Update(Actor* thisx, PlayState* play) { EnDno* this = THIS; s32 pad; SkelAnime_Update(&this->skelAnime); - func_80A73408(this, globalCtx); - this->actionFunc(this, globalCtx); + func_80A73408(this, play); + this->actionFunc(this, play); if (this->unk_3B0 & 4) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } 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, 51.0f); } -void EnDno_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDno_Draw(Actor* thisx, PlayState* play) { EnDno* this = THIS; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDno_OverrideLimbDraw, EnDno_PostLimbDraw, &this->actor); } -s32 EnDno_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDno* this = THIS; *dList = NULL; @@ -919,7 +919,7 @@ s32 EnDno_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80A73B40 = { 0.0f, 0.0f, 0.0f }; Gfx* gfxOpa; Gfx* gfxXlu; @@ -965,39 +965,39 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } if (phi_v0 == true) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (limbIndex == 13) { Matrix_Scale(this->unk_454, this->unk_454, this->unk_454, MTXMODE_APPLY); Matrix_RotateXS(this->unk_45C, MTXMODE_APPLY); } gfxOpa = POLY_OPA_DISP; - gSPMatrix(gfxOpa, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfxOpa, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfxOpa[1], *dList); POLY_OPA_DISP = gfxOpa + 2; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if ((this->unk_3B0 & 1) && (limbIndex == 26)) { u32 frames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - frames = globalCtx->gameplayFrames; + frames = play->gameplayFrames; Matrix_MultVec3f(&D_80A73B40, &sp84); - func_80A711D0(this, globalCtx, &sp84); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_80A711D0(this, play, &sp84); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(0.15f, 0.15f, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, -3200.0f, 0.0f, MTXMODE_APPLY); gfxXlu = func_8012C2B4(POLY_XLU_DISP); - gSPMatrix(gfxXlu, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfxXlu, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(&gfxXlu[1], 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(&gfxXlu[2], 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(&gfxXlu[3], 255, 0, 0, 0); gSPDisplayList(&gfxXlu[4], gGameplayKeepDrawFlameDL); @@ -1006,6 +1006,6 @@ void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.h b/src/overlays/actors/ovl_En_Dno/z_en_dno.h index dcffee6c9d..9c78619749 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.h +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.h @@ -5,7 +5,7 @@ struct EnDno; -typedef void (*EnDnoActionFunc)(struct EnDno*, GlobalContext*); +typedef void (*EnDnoActionFunc)(struct EnDno*, PlayState*); #define ENDNO_GET_F(thisx) ((thisx)->params & 0xF) #define ENDNO_GET_7F(thisx) ((thisx)->params & 0x7F) diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index a4ea26f379..37736acbe2 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -11,16 +11,16 @@ #define THIS ((EnDnp*)thisx) -void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDnp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDnp_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDnp_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDnp_Init(Actor* thisx, PlayState* play); +void EnDnp_Destroy(Actor* thisx, PlayState* play); +void EnDnp_Update(Actor* thisx, PlayState* play); +void EnDnp_Draw(Actor* thisx, PlayState* play); -void func_80B3D11C(EnDnp* this, GlobalContext* globalCtx); -void func_80B3D2D4(EnDnp* this, GlobalContext* globalCtx); -void func_80B3D338(EnDnp* this, GlobalContext* globalCtx); -void func_80B3D3F8(EnDnp* this, GlobalContext* globalCtx); -void func_80B3D558(EnDnp* this, GlobalContext* globalCtx); +void func_80B3D11C(EnDnp* this, PlayState* play); +void func_80B3D2D4(EnDnp* this, PlayState* play); +void func_80B3D338(EnDnp* this, PlayState* play); +void func_80B3D3F8(EnDnp* this, PlayState* play); +void func_80B3D558(EnDnp* this, PlayState* play); const ActorInit En_Dnp_InitVars = { ACTOR_EN_DNP, @@ -141,13 +141,13 @@ s32 func_80B3CC38(EnDnp* this, s32 arg1) { return ret; } -void func_80B3CC80(EnDnp* this, GlobalContext* globalCtx) { +void func_80B3CC80(EnDnp* this, PlayState* play) { f32 temp_f0 = this->actor.scale.x / 0.0085f; Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = 14.0f * temp_f0; this->collider.dim.height = 38.0f * temp_f0; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80B3CD1C(EnDnp* this) { @@ -160,8 +160,8 @@ void func_80B3CD1C(EnDnp* this) { } } -s32 func_80B3CDA4(EnDnp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B3CDA4(EnDnp* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_s0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Vec3f sp3C; Vec3f sp30; @@ -181,9 +181,9 @@ s32 func_80B3CDA4(EnDnp* this, GlobalContext* globalCtx) { return 1; } -s32 func_80B3CEC0(EnDnp* this, GlobalContext* globalCtx) { +s32 func_80B3CEC0(EnDnp* this, PlayState* play) { if (this->unk_322 & 8) { - func_80B3CDA4(this, globalCtx); + func_80B3CDA4(this, play); this->unk_322 &= ~0x10; this->unk_322 |= 64; } else if (this->unk_322 & 0x40) { @@ -198,15 +198,15 @@ s32 func_80B3CEC0(EnDnp* this, GlobalContext* globalCtx) { return 1; } -s32 func_80B3CF60(EnDnp* this, GlobalContext* globalCtx) { +s32 func_80B3CF60(EnDnp* this, PlayState* play) { s32 ret = false; - if ((this->unk_322 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if ((this->unk_322 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 |= 8; this->actionFunc = func_80B3D3F8; ret = true; - } else if (!(gSaveContext.save.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, globalCtx)) { + } else if (!(gSaveContext.save.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, play)) { SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 &= ~0x500; this->actor.parent = NULL; @@ -218,10 +218,10 @@ s32 func_80B3CF60(EnDnp* this, GlobalContext* globalCtx) { return ret; } -s32 func_80B3D044(EnDnp* this, GlobalContext* globalCtx) { +s32 func_80B3D044(EnDnp* this, PlayState* play) { s32 ret = false; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (!(this->unk_322 & 0x200)) { this->unk_322 |= (0x200 | 0x10); this->actor.flags &= ~ACTOR_FLAG_1; @@ -240,22 +240,22 @@ s32 func_80B3D044(EnDnp* this, GlobalContext* globalCtx) { return ret; } -void func_80B3D11C(EnDnp* this, GlobalContext* globalCtx) { +void func_80B3D11C(EnDnp* this, PlayState* play) { static s32 D_80B3DE74[] = { 0, 16, 14, 10, 18, 12, 5, 7, 2, 19, 21, 22, 24, 8, }; s32 temp_v0; s32 val; - if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (globalCtx->sceneNum == SCENE_MITURIN) && - (globalCtx->csCtx.currentCsIndex == 0)) { + if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneNum == SCENE_MITURIN) && + (play->csCtx.currentCsIndex == 0)) { this->unk_322 |= 0x20; gSaveContext.save.weekEventReg[29] |= 0x40; } - if (Cutscene_CheckActorAction(globalCtx, 101)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, 101); - val = globalCtx->csCtx.actorActions[temp_v0]->action; + if (Cutscene_CheckActorAction(play, 101)) { + temp_v0 = Cutscene_GetActorActionIndex(play, 101); + val = play->csCtx.actorActions[temp_v0]->action; if (this->unk_324 != (u8)val) { func_80B3CC38(this, D_80B3DE74[val]); if (this->unk_340 == 16) { @@ -281,11 +281,11 @@ void func_80B3D11C(EnDnp* this, GlobalContext* globalCtx) { Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80B3CC38(this, this->unk_340 + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } } -void func_80B3D2D4(EnDnp* this, GlobalContext* globalCtx) { +void func_80B3D2D4(EnDnp* this, PlayState* play) { if (this->unk_322 & 0x20) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x3, 0x2AA8); } else { @@ -293,24 +293,24 @@ void func_80B3D2D4(EnDnp* this, GlobalContext* globalCtx) { } } -void func_80B3D338(EnDnp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3D338(EnDnp* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((this->unk_32E != 0) && (Message_GetState(&globalCtx->msgCtx) == 2)) { + if ((this->unk_32E != 0) && (Message_GetState(&play->msgCtx) == 2)) { Actor_MarkForDeath(&this->actor); } else if (this->unk_32E == 0) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_32E = 1; } else { this->actor.textId = 0x971; player->actor.textId = this->actor.textId; - func_800B8500(&this->actor, globalCtx, 9999.9f, 9999.9f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 9999.9f, 9999.9f, EXCH_ITEM_MINUS1); } } } -void func_80B3D3F8(EnDnp* this, GlobalContext* globalCtx) { - if (func_8010BF58(&this->actor, globalCtx, D_80B3DE58, NULL, &this->unk_328)) { +void func_80B3D3F8(EnDnp* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, D_80B3DE58, NULL, &this->unk_328)) { SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 &= ~8; this->actionFunc = func_80B3D2D4; @@ -319,7 +319,7 @@ void func_80B3D3F8(EnDnp* this, GlobalContext* globalCtx) { } } -void func_80B3D47C(EnDnp* this, GlobalContext* globalCtx) { +void func_80B3D47C(EnDnp* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { Math_SmoothStepToF(&this->actor.scale.x, 0.0085f, 0.1f, 0.01f, 0.001f); if ((s32)(this->actor.scale.x * 10000.0f) >= 85) { @@ -334,7 +334,7 @@ void func_80B3D47C(EnDnp* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); } -void func_80B3D558(EnDnp* this, GlobalContext* globalCtx) { +void func_80B3D558(EnDnp* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); gSaveContext.save.weekEventReg[23] |= 0x20; @@ -343,15 +343,14 @@ void func_80B3D558(EnDnp* this, GlobalContext* globalCtx) { } } -void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDnp_Init(Actor* thisx, PlayState* play) { EnDnp* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 16.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dnp_Skel_010D60, NULL, this->jointTable, this->morphTable, - 26); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnp_Skel_010D60, NULL, this->jointTable, this->morphTable, 26); this->unk_340 = -1; func_80B3CC38(this, 15); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->unk_322 = 0; this->actor.targetMode = 0; @@ -371,7 +370,7 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0085f); SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; - if ((globalCtx->sceneNum == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { + if ((play->sceneNum == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { this->unk_322 |= 0x20; func_80B3CC38(this, 1); } @@ -381,38 +380,38 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnDnp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDnp_Destroy(Actor* thisx, PlayState* play) { EnDnp* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDnp_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDnp_Update(Actor* thisx, PlayState* play) { EnDnp* this = THIS; s32 pad; f32 sp2C; f32 sp28; - if (!func_80B3CF60(this, globalCtx) && func_80B3D044(this, globalCtx)) { - func_80B3D11C(this, globalCtx); + if (!func_80B3CF60(this, play) && func_80B3D044(this, play)) { + func_80B3D11C(this, play); SkelAnime_Update(&this->skelAnime); func_80B3CD1C(this); - func_80B3CEC0(this, globalCtx); + func_80B3CEC0(this, play); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); func_80B3CD1C(this); - func_80B3CEC0(this, globalCtx); + func_80B3CEC0(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); sp2C = this->collider.dim.radius + 50; sp28 = this->collider.dim.height + 30; if ((this->unk_322 & 0x400) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, sp2C, sp28); + Actor_PickUp(&this->actor, play, GI_MAX, sp2C, sp28); } - func_8013C964(&this->actor, globalCtx, sp2C, sp28, EXCH_ITEM_NONE, this->unk_322 & 7); + func_8013C964(&this->actor, play, sp2C, sp28, EXCH_ITEM_NONE, this->unk_322 & 7); Actor_SetFocus(&this->actor, 30.0f); - func_80B3CC80(this, globalCtx); + func_80B3CC80(this, play); } if (this->unk_322 & 0x100) { @@ -446,10 +445,10 @@ s32 func_80B3D974(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar return 1; } -void EnDnp_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDnp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnDnp_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnDnp_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnDnp* this = THIS; s32 phi_v1 = 1; s32 phi_v0; @@ -478,7 +477,7 @@ void EnDnp_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void EnDnp_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDnp_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80B3DEAC[] = { object_dnp_Tex_0103D0, object_dnp_Tex_0105D0, @@ -488,16 +487,16 @@ void EnDnp_Draw(Actor* thisx, GlobalContext* globalCtx) { EnDnp* this = THIS; if (this->unk_322 & 0x100) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3DEAC[this->unk_336])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnDnp_PostLimbDraw, EnDnp_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h index 7253f2f3d6..e76180afe5 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h @@ -5,7 +5,7 @@ struct EnDnp; -typedef void (*EnDnpActionFunc)(struct EnDnp*, GlobalContext*); +typedef void (*EnDnpActionFunc)(struct EnDnp*, PlayState*); #define ENDNP_GET_7(thisx) ((thisx)->params & 7) diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index ae7f918f13..f2a6a46dc8 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -11,12 +11,12 @@ #define THIS ((EnDnq*)thisx) -void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDnq_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDnq_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDnq_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDnq_Init(Actor* thisx, PlayState* play); +void EnDnq_Destroy(Actor* thisx, PlayState* play); +void EnDnq_Update(Actor* thisx, PlayState* play); +void EnDnq_Draw(Actor* thisx, PlayState* play); -void func_80A52FB8(EnDnq* this, GlobalContext* globalCtx); +void func_80A52FB8(EnDnq* this, PlayState* play); static s32 D_80A53400[] = { 0x00120100, 0x150E0899, 0x0C120F08, 0x9A0C0F08, 0x9B0C0F08, 0x9C0C1112, 0x01100E08, 0x980C1000, 0x00120200, @@ -80,8 +80,8 @@ static AnimationInfoS D_80A5349C[] = { { &object_dnq_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -void func_80A52530(GlobalContext* globalCtx, EnDnq* this) { - func_8013A530(globalCtx, &this->actor, 10, &this->actor.focus.pos, &this->actor.world.rot, 120.0f, 480.0f, 0x38E3); +void func_80A52530(PlayState* play, EnDnq* this) { + func_8013A530(play, &this->actor, 10, &this->actor.focus.pos, &this->actor.world.rot, 120.0f, 480.0f, 0x38E3); } s32 func_80A5257C(EnDnq* this, s32 arg1) { @@ -110,15 +110,15 @@ s32 func_80A5257C(EnDnq* this, s32 arg1) { return ret; } -void func_80A52604(EnDnq* this, GlobalContext* globalCtx) { +void func_80A52604(EnDnq* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80A52648(EnDnq* this, GlobalContext* globalCtx) { +s32 func_80A52648(EnDnq* this, PlayState* play) { s32 ret = false; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (!(this->unk_37C & 0x20)) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_1DC = 0xFF; @@ -222,7 +222,7 @@ s32 func_80A52944(EnDnq* this) { return 0; } -s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) { +s32 func_80A52A78(EnDnq* this, PlayState* play) { static s32 D_80A535DC[] = { 17, 12, 14, 13, 16, }; @@ -230,7 +230,7 @@ s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) { if (this->unk_38A == 0) { this->unk_38C = 0; this->unk_38A = 1; - this->unk_388 = globalCtx->state.frames % 5; + this->unk_388 = play->state.frames % 5; } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -252,9 +252,9 @@ s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) { return 0; } -s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp = globalCtx->msgCtx.currentTextId; +s32 func_80A52B68(EnDnq* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp = play->msgCtx.currentTextId; if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->actor)) { switch (temp) { @@ -292,8 +292,8 @@ s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) { return 0; } -void func_80A52C6C(EnDnq* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A52C6C(EnDnq* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp34 = { 0.0f, 0.0f, 110.0f }; Vec3f sp28; @@ -305,7 +305,7 @@ void func_80A52C6C(EnDnq* this, GlobalContext* globalCtx) { this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&sp28, &sp1C); } -s32* func_80A52CF8(EnDnq* this, GlobalContext* globalCtx) { +s32* func_80A52CF8(EnDnq* this, PlayState* play) { if (gSaveContext.save.weekEventReg[23] & 0x20) { return &D_80A53400[14]; } @@ -317,12 +317,12 @@ s32* func_80A52CF8(EnDnq* this, GlobalContext* globalCtx) { return &D_80A53400[0]; } -s32 func_80A52D44(EnDnq* this, GlobalContext* globalCtx) { +s32 func_80A52D44(EnDnq* this, PlayState* play) { s32 ret = false; - if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_37C, 0, 7); - this->unk_380 = func_80A52CF8(this, globalCtx); + this->unk_380 = func_80A52CF8(this, play); this->actionFunc = func_80A52FB8; ret = true; } @@ -330,8 +330,8 @@ s32 func_80A52D44(EnDnq* this, GlobalContext* globalCtx) { return ret; } -void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A52DC8(EnDnq* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yaw <= 0x3800) { @@ -342,16 +342,16 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { this->unk_390 = 70.0f; - if (Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(globalCtx) && - (Message_GetState(&globalCtx->msgCtx) == 0) && (ActorCutscene_GetCurrentIndex() == -1)) { + if (Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && + (Message_GetState(&play->msgCtx) == 0) && (ActorCutscene_GetCurrentIndex() == -1)) { if ((DECR(this->unk_384) == 0) && (gSaveContext.save.weekEventReg[29] & 0x40)) { - Message_StartTextbox(globalCtx, 0x969, NULL); + Message_StartTextbox(play, 0x969, NULL); this->unk_384 = 200; } } this->unk_394 = this->actor.xzDistToPlayer; - func_80A52C6C(this, globalCtx); + func_80A52C6C(this, play); if (this->actor.xzDistToPlayer < this->unk_390) { player->unk_B2B = 0x1A; } @@ -359,7 +359,7 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { this->actor.xzDistToPlayer = this->unk_394; if (gSaveContext.save.weekEventReg[83] & 8) { - func_80A52A78(this, globalCtx); + func_80A52A78(this, play); } else if (this->unk_3A4 == 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); func_80A526F8(this); @@ -372,10 +372,10 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { } } -void func_80A52FB8(EnDnq* this, GlobalContext* globalCtx) { +void func_80A52FB8(EnDnq* this, PlayState* play) { s16 sp2E = this->actor.yawTowardsPlayer; - if (func_8010BF58(&this->actor, globalCtx, this->unk_380, NULL, &this->unk_1E0)) { + if (func_8010BF58(&this->actor, play, this->unk_380, NULL, &this->unk_1E0)) { SubS_UpdateFlags(&this->unk_37C, 3, 7); this->unk_386 = 0; this->actionFunc = func_80A52DC8; @@ -384,16 +384,16 @@ void func_80A52FB8(EnDnq* this, GlobalContext* globalCtx) { } } -void func_80A53038(EnDnq* this, GlobalContext* globalCtx) { +void func_80A53038(EnDnq* this, PlayState* play) { static s32 D_80A535FC[] = { 0, 1, 2, 3, 5, 6, }; s32 temp_v0; u32 temp_v1; - if (Cutscene_CheckActorAction(globalCtx, 105)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, 105); - temp_v1 = globalCtx->csCtx.actorActions[temp_v0]->action; + if (Cutscene_CheckActorAction(play, 105)) { + temp_v0 = Cutscene_GetActorActionIndex(play, 105); + temp_v1 = play->csCtx.actorActions[temp_v0]->action; if (this->unk_1DC != (u8)temp_v1) { func_80A5257C(this, D_80A535FC[temp_v1]); this->unk_1DC = temp_v1; @@ -408,19 +408,18 @@ void func_80A53038(EnDnq* this, GlobalContext* globalCtx) { func_80A5257C(this, this->unk_398 + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } } -void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDnq_Init(Actor* thisx, PlayState* play) { EnDnq* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 14.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dnq_Skel_00EB48, NULL, this->jointTable, this->morphTable, - 33); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnq_Skel_00EB48, NULL, this->jointTable, this->morphTable, 33); this->unk_398 = -1; func_80A5257C(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.02f); this->actor.targetMode = 1; @@ -436,37 +435,37 @@ void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A52DC8; } -void EnDnq_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDnq_Destroy(Actor* thisx, PlayState* play) { EnDnq* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDnq_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDnq_Update(Actor* thisx, PlayState* play) { EnDnq* this = THIS; - if (!func_80A52D44(this, globalCtx) && func_80A52648(this, globalCtx)) { - func_80A53038(this, globalCtx); + if (!func_80A52D44(this, play) && func_80A52648(this, play)) { + func_80A53038(this, play); SkelAnime_Update(&this->skelAnime); } else { - this->actionFunc(this, globalCtx); - func_80A52B68(this, globalCtx); + this->actionFunc(this, play); + func_80A52B68(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); this->unk_394 = this->actor.xzDistToPlayer; - func_80A52C6C(this, globalCtx); - func_8013C964(&this->actor, globalCtx, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, EXCH_ITEM_NONE, + func_80A52C6C(this, play); + func_8013C964(&this->actor, play, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, EXCH_ITEM_NONE, this->unk_37C & 7); this->actor.xzDistToPlayer = this->unk_394; Actor_SetFocus(&this->actor, 46.0f); - func_80A52604(this, globalCtx); + func_80A52604(this, play); } } -void EnDnq_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDnq_Draw(Actor* thisx, PlayState* play) { EnDnq* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(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_Dnq/z_en_dnq.h b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h index 4cc82d131d..6c3027c8b9 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h @@ -5,8 +5,8 @@ struct EnDnq; -typedef void (*EnDnqActionFunc)(struct EnDnq*, GlobalContext*); -typedef void (*EnDnqFunc)(GlobalContext*, struct EnDnq*); +typedef void (*EnDnqActionFunc)(struct EnDnq*, PlayState*); +typedef void (*EnDnqFunc)(PlayState*, struct EnDnq*); typedef struct EnDnq { /* 0x000 */ 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 1cad6dd8fb..1284a9523e 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -10,14 +10,14 @@ #define THIS ((EnDns*)thisx) -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); -void func_8092D330(EnDns* this, GlobalContext* globalCtx); -void EnDns_DoNothing(EnDns* this, GlobalContext* globalCtx); -void func_8092D4D8(EnDns* this, GlobalContext* globalCtx); +void func_8092D330(EnDns* this, PlayState* play); +void EnDns_DoNothing(EnDns* this, PlayState* play); +void func_8092D4D8(EnDns* this, PlayState* play); typedef enum { /* 0 */ EN_DNS_ANIMATION_IDLE_1, @@ -131,13 +131,13 @@ s32 func_8092C63C(EnDns* this, s32 arg1) { return ret; } -void func_8092C6FC(EnDns* this, GlobalContext* globalCtx) { +void func_8092C6FC(EnDns* this, PlayState* 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_8092C740(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8092C740(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Vec3f sp34; Vec3f sp28; @@ -154,9 +154,9 @@ void func_8092C740(EnDns* this, GlobalContext* globalCtx) { this->unk_2CC = CLAMP(this->unk_2CC, -0x16C0, 0xE38); } -void func_8092C86C(EnDns* this, GlobalContext* globalCtx) { +void func_8092C86C(EnDns* this, PlayState* play) { if ((this->unk_2C6 & 8) && (DECR(this->unk_2DC) == 0)) { - func_8092C740(this, globalCtx); + func_8092C740(this, play); this->unk_2C6 &= ~0x10; this->unk_2C6 |= 0x20; } else if (this->unk_2C6 & 0x20) { @@ -179,8 +179,8 @@ void func_8092C934(EnDns* this) { } } -s32* func_8092C9BC(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32* func_8092C9BC(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { if (player->transformation != PLAYER_FORM_DEKU) { @@ -225,11 +225,11 @@ s32 func_8092CA74(EnDns* this) { return 0; } -s32 func_8092CAD0(EnDns* this, GlobalContext* globalCtx) { +s32 func_8092CAD0(EnDns* this, PlayState* play) { s32 ret = false; if (this->unk_2C6 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_2C6, 0, 7); this->unk_2C6 &= ~0x10; if (ENDNS_GET_4000(&this->actor)) { @@ -240,7 +240,7 @@ s32 func_8092CAD0(EnDns* this, GlobalContext* globalCtx) { } this->unk_2DA = this->actor.world.rot.y; } - this->unk_1E0 = func_8092C9BC(this, globalCtx); + this->unk_1E0 = func_8092C9BC(this, play); this->actionFunc = func_8092D4D8; ret = true; } @@ -248,10 +248,10 @@ s32 func_8092CAD0(EnDns* this, GlobalContext* globalCtx) { return ret; } -s32 func_8092CB98(EnDns* this, GlobalContext* globalCtx) { +s32 func_8092CB98(EnDns* this, PlayState* play) { s32 phi_v1 = 0; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (!(this->unk_2C6 & 0x80)) { this->unk_2C8 = func_8092CA74(this); this->actor.flags &= ~ACTOR_FLAG_1; @@ -268,15 +268,15 @@ s32 func_8092CB98(EnDns* this, GlobalContext* globalCtx) { return phi_v1; } -s32 func_8092CC68(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8092CC68(PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad[2]; s32 ret = false; s16 bgId; - if (!Play_InCsMode(globalCtx) && (player->actor.bgCheckFlags & 1) && (player->transformation != PLAYER_FORM_DEKU)) { + if (!Play_InCsMode(play) && (player->actor.bgCheckFlags & 1) && (player->transformation != PLAYER_FORM_DEKU)) { bgId = player->actor.floorBgId; - if (SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, player->actor.floorPoly, bgId) != 4) { + if (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, bgId) != 4) { ret = true; } } @@ -284,8 +284,8 @@ s32 func_8092CC68(GlobalContext* globalCtx) { return ret; } -s32 func_8092CCEC(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_8092CCEC(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp3C = player->actor.world.pos; Vec3f sp30 = this->actor.world.pos; @@ -375,23 +375,23 @@ s32 func_8092D068(EnDns* this) { return ret; } -void func_8092D108(EnDns* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_8092D108(EnDns* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_SetTranslateRotateYXZ(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &this->actor.home.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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gKingsChamberDekuGuardDekuFlower); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8092D1B8(EnDns* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp22 = this->actor.world.rot.y; if (ENDNS_GET_4000(&this->actor)) { @@ -399,8 +399,7 @@ void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { } if (!ENDNS_GET_4000(&this->actor) || (this->unk_2D2 != 0)) { - if (!(gSaveContext.save.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && - func_8092CC68(globalCtx)) { + if (!(gSaveContext.save.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && func_8092CC68(play)) { player->stateFlags1 |= 0x20; this->unk_2C6 |= 0x100; SubS_UpdateFlags(&this->unk_2C6, 4, 7); @@ -410,7 +409,7 @@ void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); this->actionFunc = EnDns_DoNothing; } else if (gSaveContext.eventInf[1] & 0x40) { - func_8092CCEC(this, globalCtx); + func_8092CCEC(this, play); func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); this->actionFunc = func_8092D330; } @@ -418,10 +417,10 @@ void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { } } -void EnDns_DoNothing(EnDns* this, GlobalContext* globalCtx) { +void EnDns_DoNothing(EnDns* this, PlayState* play) { } -void func_8092D330(EnDns* this, GlobalContext* globalCtx) { +void func_8092D330(EnDns* this, PlayState* play) { s32 pad; Vec3f sp30 = gZeroVec3f; s16 temp = this->unk_2D6 - this->unk_2D4; @@ -440,22 +439,22 @@ void func_8092D330(EnDns* this, GlobalContext* globalCtx) { } if ((this->unk_2C6 & 0x100) && (DECR(this->unk_2D0) == 0)) { this->unk_2C6 &= ~0x100; - globalCtx->nextEntranceIndex = 0x5010; + play->nextEntranceIndex = 0x5010; gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; } } -void func_8092D4D8(EnDns* this, GlobalContext* globalCtx) { +void func_8092D4D8(EnDns* this, PlayState* play) { s16 sp2E = this->actor.yawTowardsPlayer; if (ENDNS_GET_4000(&this->actor) && (this->unk_2D2 == 0)) { if (func_8092CE38(this)) { func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); } - } else if (func_8010BF58(&this->actor, globalCtx, this->unk_1E0, this->unk_2F4, &this->unk_1DC)) { + } else if (func_8010BF58(&this->actor, play, this->unk_1E0, this->unk_2F4, &this->unk_1DC)) { SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2F4 = NULL; if (ENDNS_GET_4000(&this->actor)) { @@ -474,7 +473,7 @@ void func_8092D4D8(EnDns* this, GlobalContext* globalCtx) { } } -void func_8092D5E8(EnDns* this, GlobalContext* globalCtx) { +void func_8092D5E8(EnDns* this, PlayState* play) { static s32 D_8092DE0C[] = { EN_DNS_ANIMATION_IDLE_1, EN_DNS_ANIMATION_IDLE_1, @@ -484,9 +483,9 @@ void func_8092D5E8(EnDns* this, GlobalContext* globalCtx) { s32 temp_v0; u32 temp_v1; - if (Cutscene_CheckActorAction(globalCtx, this->unk_2C8)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, this->unk_2C8); - temp_v1 = globalCtx->csCtx.actorActions[temp_v0]->action; + if (Cutscene_CheckActorAction(play, this->unk_2C8)) { + temp_v0 = Cutscene_GetActorActionIndex(play, this->unk_2C8); + temp_v1 = play->csCtx.actorActions[temp_v0]->action; if (this->unk_1D8 != (u8)temp_v1) { func_8092C63C(this, D_8092DE0C[temp_v1]); this->unk_1D8 = temp_v1; @@ -498,11 +497,11 @@ void func_8092D5E8(EnDns* this, GlobalContext* globalCtx) { func_8092C63C(this, this->animationIndex + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } } -void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = THIS; if (!func_8092D068(this)) { @@ -511,11 +510,11 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gKingsChamberDekuGuardSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gKingsChamberDekuGuardSkel, NULL, this->jointTable, this->morphTable, KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX); this->animationIndex = -1; func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; @@ -535,28 +534,28 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.eventInf[1] &= (u8)~0x40; } -void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Destroy(Actor* thisx, PlayState* play) { EnDns* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = THIS; - if (!func_8092CAD0(this, globalCtx) && func_8092CB98(this, globalCtx)) { - func_8092D5E8(this, globalCtx); + if (!func_8092CAD0(this, play) && func_8092CB98(this, play)) { + func_8092D5E8(this, play); SkelAnime_Update(&this->skelAnime); func_8092C5C0(this); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); func_8092C934(this); - func_8092C86C(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); - func_8013C964(&this->actor, globalCtx, 80.0f, 40.0f, EXCH_ITEM_NONE, this->unk_2C6 & 7); + func_8092C86C(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + func_8013C964(&this->actor, play, 80.0f, 40.0f, EXCH_ITEM_NONE, this->unk_2C6 & 7); Actor_SetFocus(&this->actor, 34.0f); - func_8092C6FC(this, globalCtx); + func_8092C6FC(this, play); func_8092C5C0(this); } } @@ -588,7 +587,7 @@ s32 func_8092D954(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar return 1; } -s32 EnDns_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnDns_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDns* this = THIS; this->unk_1E4[limbIndex] = *dList; @@ -596,7 +595,7 @@ s32 EnDns_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnDns_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDns_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDns* this = THIS; s32 pad; s32 phi_v1; @@ -624,15 +623,15 @@ void EnDns_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Matrix_RotateZS(this->unk_224.x, MTXMODE_APPLY); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_1E4[limbIndex]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDns_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { gKingsChamberDekuGuardEyeOpenTex, gKingsChamberDekuGuardEyeHalfTex, @@ -641,16 +640,16 @@ void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnDns* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDns_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDns_OverrideLimbDraw, EnDns_PostLimbDraw, &this->actor); - func_8092D108(this, globalCtx); + func_8092D108(this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 2577175026..3a252b1ec7 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -6,8 +6,8 @@ struct EnDns; -typedef void (*EnDnsActionFunc)(struct EnDns*, GlobalContext*); -typedef s32 (*EnDnsFunc)(struct EnDns*, GlobalContext*); +typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); +typedef s32 (*EnDnsFunc)(struct EnDns*, PlayState*); #define ENDNS_GET_7(thisx) ((thisx)->params & 7) #define ENDNS_GET_4000(thisx) ((thisx)->params & 0x4000) 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 c31b534a19..b0d11ee9cc 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -13,27 +13,27 @@ #define THIS ((EnDodongo*)thisx) -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 func_808773C4(EnDodongo* this); -void func_80877424(EnDodongo* this, GlobalContext* globalCtx); +void func_80877424(EnDodongo* this, PlayState* play); void func_80877494(EnDodongo* this); -void func_80877500(EnDodongo* this, GlobalContext* globalCtx); +void func_80877500(EnDodongo* this, PlayState* play); void func_808777A8(EnDodongo* this); -void func_8087784C(EnDodongo* this, GlobalContext* globalCtx); +void func_8087784C(EnDodongo* this, PlayState* play); void func_80877D50(EnDodongo* this); -void func_80877D90(EnDodongo* this, GlobalContext* globalCtx); -void func_80877E60(EnDodongo* this, GlobalContext* globalCtx); +void func_80877D90(EnDodongo* this, PlayState* play); +void func_80877E60(EnDodongo* this, PlayState* play); void func_80878354(EnDodongo* this); -void func_80878424(EnDodongo* this, GlobalContext* globalCtx); -void func_808785B0(EnDodongo* this, GlobalContext* globalCtx); +void func_80878424(EnDodongo* this, PlayState* play); +void func_808785B0(EnDodongo* this, PlayState* play); void func_8087864C(EnDodongo* this); -void func_808786C8(EnDodongo* this, GlobalContext* globalCtx); +void func_808786C8(EnDodongo* this, PlayState* play); void func_80878724(EnDodongo* this); -void func_808787B0(EnDodongo* this, GlobalContext* globalCtx); +void func_808787B0(EnDodongo* this, PlayState* play); const ActorInit En_Dodongo_InitVars = { ACTOR_EN_DODONGO, @@ -278,7 +278,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 1400, ICHAIN_STOP), }; -void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Init(Actor* thisx, PlayState* play) { static EffectBlureInit2 D_80879308 = { 2, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8, 0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, @@ -295,19 +295,19 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_330.a = 200; Math_Vec3f_Copy(&this->unk_314, &gOneVec3f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dodongo_Skel_008318, &object_dodongo_Anim_004C20, - this->jointTable, this->morphTable, 31); + SkelAnime_Init(play, &this->skelAnime, &object_dodongo_Skel_008318, &object_dodongo_Anim_004C20, this->jointTable, + this->morphTable, 31); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Collider_InitAndSetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); - Collider_InitAndSetJntSph(globalCtx, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); - Collider_InitAndSetJntSph(globalCtx, &this->collider3, &this->actor, &sJntSphInit3, this->collider3Elements); + Collider_InitAndSetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); + Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit1, this->collider1Elements); + Collider_InitAndSetJntSph(play, &this->collider3, &this->actor, &sJntSphInit3, this->collider3Elements); for (i = 0; i < ARRAY_COUNT(this->collider2Elements); i++) { this->collider2.elements[i].info.elemType = ELEMTYPE_UNK2; this->collider2.elements[i].info.bumper.dmgFlags = 0x77C34FE6; } - Effect_Add(globalCtx, &this->unk_338, EFFECT_BLURE2, 0, 0, &D_80879308); + Effect_Add(play, &this->unk_338, EFFECT_BLURE2, 0, 0, &D_80879308); if (this->actor.params == 0) { Actor_SetScale(&this->actor, 3.0f / 160.0f); this->unk_334 = 1.0f; @@ -333,16 +333,16 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) { func_808773C4(this); } -void EnDodongo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Destroy(Actor* thisx, PlayState* play) { EnDodongo* this = THIS; - Effect_Destroy(globalCtx, this->unk_338); - Collider_DestroyJntSph(globalCtx, &this->collider2); - Collider_DestroyJntSph(globalCtx, &this->collider3); - Collider_DestroyJntSph(globalCtx, &this->collider1); + Effect_Destroy(play, this->unk_338); + Collider_DestroyJntSph(play, &this->collider2); + Collider_DestroyJntSph(play, &this->collider3); + Collider_DestroyJntSph(play, &this->collider1); } -void func_80876930(EnDodongo* this, GlobalContext* globalCtx, Vec3f* arg2) { +void func_80876930(EnDodongo* this, PlayState* play, Vec3f* arg2) { static Color_RGBA8 D_8087932C = { 250, 250, 250, 255 }; static Color_RGBA8 D_80879330 = { 180, 180, 180, 255 }; static Color_RGBA8 D_80879334 = { 170, 130, 90, 255 }; @@ -358,7 +358,7 @@ void func_80876930(EnDodongo* this, GlobalContext* globalCtx, Vec3f* arg2) { s16 temp2; f32 temp3; - if (func_800C9BB8(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == COLPOLY_SURFACE_SNOW) { + if (func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == COLPOLY_SURFACE_SNOW) { sp80 = &D_8087932C; sp7C = &D_80879330; } else { @@ -376,28 +376,28 @@ void func_80876930(EnDodongo* this, GlobalContext* globalCtx, Vec3f* arg2) { sp88.z = randPlusMinusPoint5Scaled(temp3) + arg2->z; D_8087933C.x = randPlusMinusPoint5Scaled(2.0f); D_8087933C.z = randPlusMinusPoint5Scaled(2.0f); - func_800B0DE0(globalCtx, &sp88, &gZeroVec3f, &D_8087933C, sp80, sp7C, temp1, temp2); + func_800B0DE0(play, &sp88, &gZeroVec3f, &D_8087933C, sp80, sp7C, temp1, temp2); } } -void func_80876B08(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80876B08(EnDodongo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS_ALT(yDiff) < 0x4000) { - if (!(player->stateFlags1 & 0x00800000) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + if (!(player->stateFlags1 & 0x00800000) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { func_808777A8(this); } else { func_80877494(this); } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { + } else if (Player_GetMask(play) != PLAYER_MASK_STONE) { func_80878354(this); } else { func_80877494(this); } } -void func_80876BD0(EnDodongo* this, GlobalContext* globalCtx, s32 arg2) { +void func_80876BD0(EnDodongo* this, PlayState* play, s32 arg2) { if (this->actor.colChkInfo.damageEffect == 2) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffScale = 0.75f; @@ -406,8 +406,7 @@ void func_80876BD0(EnDodongo* this, GlobalContext* globalCtx, s32 arg2) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider1.elements[arg2].info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider1.elements[arg2].info.bumper.hitPos.x, this->collider1.elements[arg2].info.bumper.hitPos.y, this->collider1.elements[arg2].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } @@ -424,20 +423,19 @@ void func_80876CAC(EnDodongo* this) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 80); } -void func_80876D28(EnDodongo* this, GlobalContext* globalCtx) { +void func_80876D28(EnDodongo* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->timer = 0; this->actor.colorFilterTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider1.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, &this->limbPos[0], 9, 2, this->unk_334 * 0.3f, - this->unk_334 * 0.2f); + Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 9, 2, this->unk_334 * 0.3f, this->unk_334 * 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } -void func_80876DC4(EnDodongo* this, GlobalContext* globalCtx) { +void func_80876DC4(EnDodongo* this, PlayState* play) { s32 pad; Vec3f sp80; Vec3f sp74; @@ -480,7 +478,7 @@ void func_80876DC4(EnDodongo* this, GlobalContext* globalCtx) { sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334; sp64 = this->unk_334 * 100.0f; sp62 = this->unk_334 * 25.0f; - func_800B0EB0(globalCtx, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); + func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); sp66 = (Rand_Next() >> 0x13) + this->actor.shape.rot.y; temp_f20 = Math_CosS(sp66); @@ -494,7 +492,7 @@ void func_80876DC4(EnDodongo* this, GlobalContext* globalCtx) { sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * temp_f20 * this->unk_334; sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f22 * this->unk_334; - func_800B0EB0(globalCtx, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); + func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); sp68.x = this->limbPos[0].x + (temp_f20 * 6.0f * this->unk_334); sp68.z = this->limbPos[0].z - (temp_f22 * 6.0f * this->unk_334); @@ -502,7 +500,7 @@ void func_80876DC4(EnDodongo* this, GlobalContext* globalCtx) { sp80.z = sp80.z * -1.0f; sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334; sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * temp_f22 * this->unk_334; - func_800B0EB0(globalCtx, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); + func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); } s32 func_8087721C(EnDodongo* this) { @@ -513,9 +511,9 @@ s32 func_8087721C(EnDodongo* this) { return false; } -s32 func_80877278(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; +s32 func_80877278(EnDodongo* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; Vec3f sp44; // Bugfix from OoT @@ -543,7 +541,7 @@ void func_808773C4(EnDodongo* this) { this->actionFunc = func_80877424; } -void func_80877424(EnDodongo* this, GlobalContext* globalCtx) { +void func_80877424(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { this->timer--; @@ -563,8 +561,8 @@ void func_80877494(EnDodongo* this) { this->actionFunc = func_80877500; } -void func_80877500(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80877500(EnDodongo* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp30; s16 temp_v1; @@ -574,17 +572,17 @@ void func_80877500(EnDodongo* this, GlobalContext* globalCtx) { sp30.x = this->collider1Elements[2].dim.worldSphere.center.x; sp30.y = this->collider1Elements[2].dim.worldSphere.center.y; sp30.z = this->collider1Elements[2].dim.worldSphere.center.z; - func_80876930(this, globalCtx, &sp30); + func_80876930(this, play, &sp30); } else if (Animation_OnFrame(&this->skelAnime, 39.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_WALK); sp30.x = this->collider1Elements[1].dim.worldSphere.center.x; sp30.y = this->collider1Elements[1].dim.worldSphere.center.y; sp30.z = this->collider1Elements[1].dim.worldSphere.center.z; - func_80876930(this, globalCtx, &sp30); + func_80876930(this, play, &sp30); } if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 400.0f) && - (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + (Player_GetMask(play) != PLAYER_MASK_STONE)) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x1F4); if (this->actor.xzDistToPlayer < (100.0f * this->unk_334)) { @@ -595,7 +593,7 @@ void func_80877500(EnDodongo* this, GlobalContext* globalCtx) { } } else { if ((Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 150.0f) || - (Player_GetMask(globalCtx) == PLAYER_MASK_STONE)) { + (Player_GetMask(play) == PLAYER_MASK_STONE)) { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x1F4); } @@ -631,7 +629,7 @@ void func_808777A8(EnDodongo* this) { this->actionFunc = func_8087784C; } -void func_8087784C(EnDodongo* this, GlobalContext* globalCtx) { +void func_8087784C(EnDodongo* this, PlayState* play) { static Vec3f D_80879348 = { 0.0f, 0.9f, 0.0f }; static Vec3f D_80879354 = { 0.0f, 0.0f, 0.0f }; s16 frame; @@ -669,7 +667,7 @@ void func_8087784C(EnDodongo* this, GlobalContext* globalCtx) { D_80879348.x = 2.5f * temp_f2; D_80879348.y = this->unk_334 * 1.4f; D_80879348.z = 2.5f * temp_f12; - EffectSsDFire_Spawn(globalCtx, &this->limbPos[0], &D_80879354, &D_80879348, this->unk_334 * 100.0f, + EffectSsDFire_Spawn(play, &this->limbPos[0], &D_80879354, &D_80879348, this->unk_334 * 100.0f, this->unk_334 * 35.0f, 0xFF - (frame * 10), 5, 0, 8); } else if ((this->skelAnime.curFrame >= 2.0f) && (this->skelAnime.curFrame <= 20.0f)) { func_800B9010(&this->actor, NA_SE_EN_DODO_J_BREATH - SFX_FLAG); @@ -685,7 +683,7 @@ void func_80877D50(EnDodongo* this) { this->actionFunc = func_80877D90; } -void func_80877D90(EnDodongo* this, GlobalContext* globalCtx) { +void func_80877D90(EnDodongo* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_808773C4(this); this->timer = Rand_S16Offset(10, 20); @@ -700,13 +698,13 @@ void func_80877DE0(EnDodongo* this) { this->actor.speedXZ = 0.0f; } -void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) { +void func_80877E60(EnDodongo* this, PlayState* play) { static Vec3f D_80879360 = { 0.0f, 0.6f, 0.0f }; static Color_RGBA8 D_8087936C = { 255, 255, 255, 255 }; Vec3f sp84; Vec3f sp78; s16 i; - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; Vec3f sp64; s32 pad; s16 sp5E; @@ -748,14 +746,14 @@ void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) { sp64.x = this->collider1Elements[0].dim.worldSphere.center.x + sp84.x; sp64.y = this->collider1Elements[0].dim.worldSphere.center.y + sp84.y; sp64.z = this->collider1Elements[0].dim.worldSphere.center.z + sp84.z; - func_800B0EB0(globalCtx, &sp64, &sp84, &sp78, &this->unk_32C, &this->unk_330, this->unk_334 * 400.0f, + func_800B0EB0(play, &sp64, &sp84, &sp78, &this->unk_32C, &this->unk_330, this->unk_334 * 400.0f, this->unk_334 * 10.0f, 10); } Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); if (this->actor.colChkInfo.health <= 4) { this->actor.colChkInfo.health = 0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else { this->actor.colChkInfo.health -= 4; } @@ -768,18 +766,18 @@ void func_80877E60(EnDodongo* this, GlobalContext* globalCtx) { if (this->skelAnime.curFrame <= 27.0f) { if ((this->skelAnime.curFrame <= 25.0f) && (this->timer < 11)) { - func_80876DC4(this, globalCtx); + func_80876DC4(this, play); } else { sp5E = this->unk_334 * 50.0f; sp5C = this->unk_334 * 5.0f; Math_Vec3f_Copy(&sp64, &this->limbPos[0]); - func_800B0DE0(globalCtx, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); + func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); sp64.x -= Math_CosS(this->actor.shape.rot.y) * 6.0f * this->unk_334; sp64.z += Math_SinS(this->actor.shape.rot.y) * 6.0f * this->unk_334; - func_800B0DE0(globalCtx, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); + func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); sp64.x = (2.0f * this->limbPos[0].x) - sp64.x; sp64.z = (2.0f * this->limbPos[0].z) - sp64.z; - func_800B0DE0(globalCtx, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); + func_800B0DE0(play, &sp64, &gZeroVec3f, &D_80879360, &D_8087936C, &D_8087936C, sp5E, sp5C); } } @@ -819,13 +817,13 @@ void func_80878354(EnDodongo* this) { this->actionFunc = func_80878424; } -void func_80878424(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80878424(EnDodongo* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp20; this->timer++; if (SkelAnime_Update(&this->skelAnime)) { - if (!(player->stateFlags1 & 0x800000) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + if (!(player->stateFlags1 & 0x800000) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { this->collider1.base.atFlags &= ~AT_ON; func_808777A8(this); } else { @@ -839,12 +837,12 @@ void func_80878424(EnDodongo* this, GlobalContext* globalCtx) { sp20.x = this->collider1Elements[1].dim.worldSphere.center.x; sp20.y = this->collider1Elements[1].dim.worldSphere.center.y; sp20.z = this->collider1Elements[1].dim.worldSphere.center.z; - func_80876930(this, globalCtx, &sp20); + func_80876930(this, play, &sp20); sp20.x = this->collider1Elements[2].dim.worldSphere.center.x; sp20.y = this->collider1Elements[2].dim.worldSphere.center.y; sp20.z = this->collider1Elements[2].dim.worldSphere.center.z; - func_80876930(this, globalCtx, &sp20); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + func_80876930(this, play, &sp20); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); this->actor.flags |= ACTOR_FLAG_1000000; } @@ -853,19 +851,19 @@ void func_80878594(EnDodongo* this) { this->actor.speedXZ = 0.0f; } -void func_808785B0(EnDodongo* this, GlobalContext* globalCtx) { +void func_808785B0(EnDodongo* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - func_80876D28(this, globalCtx); + func_80876D28(this, play); if (this->actor.colChkInfo.health == 0) { func_80878724(this); } else if (this->actor.xzDistToPlayer > 100.0f * this->unk_334) { func_80877494(this); } else { - func_80876B08(this, globalCtx); + func_80876B08(this, play); } } } @@ -880,13 +878,13 @@ void func_8087864C(EnDodongo* this) { this->actionFunc = func_808786C8; } -void func_808786C8(EnDodongo* this, GlobalContext* globalCtx) { +void func_808786C8(EnDodongo* this, PlayState* play) { if (this->unk_304 == 1) { - func_80876DC4(this, globalCtx); + func_80876DC4(this, play); } if (SkelAnime_Update(&this->skelAnime)) { - func_80876B08(this, globalCtx); + func_80876B08(this, play); } } @@ -901,12 +899,12 @@ void func_80878724(EnDodongo* this) { this->actionFunc = func_808787B0; } -void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) { +void func_808787B0(EnDodongo* this, PlayState* play) { s32 pad; if (this->skelAnime.curFrame < 35.0f) { if (this->unk_304 != 0) { - func_80876DC4(this, globalCtx); + func_80876DC4(this, play); } } else if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 4); @@ -914,7 +912,7 @@ void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { - EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + EnBom* 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; @@ -929,16 +927,16 @@ void func_808787B0(EnDodongo* this, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { if (this->actor.params == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_PURPLE); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_PURPLE); } Actor_MarkForDeath(&this->actor); } } } -void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { +void EnDodongo_UpdateDamage(EnDodongo* this, PlayState* play) { Vec3f sp3C; s32 i; @@ -955,14 +953,14 @@ void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { if ((i != ARRAY_COUNT(this->collider2Elements)) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->collider2.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { - func_80876D28(this, globalCtx); + func_80876D28(this, play); Math_Vec3s_ToVec3f(&sp3C, &this->collider2.elements[i].info.bumper.hitPos); if (this->actor.colChkInfo.damageEffect == 0xF) { - CollisionCheck_BlueBlood(globalCtx, NULL, &sp3C); - EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &sp3C); + CollisionCheck_BlueBlood(play, NULL, &sp3C); + EffectSsHitMark_SpawnFixedScale(play, 0, &sp3C); } else if (this->actor.colChkInfo.damageEffect != 14) { - EffectSsHitMark_SpawnFixedScale(globalCtx, 3, &sp3C); - CollisionCheck_SpawnShieldParticlesMetalSound(globalCtx, &sp3C, &this->actor.projectedPos); + EffectSsHitMark_SpawnFixedScale(play, 3, &sp3C); + CollisionCheck_SpawnShieldParticlesMetalSound(play, &sp3C, &this->actor.projectedPos); } } } else if (this->collider1.base.acFlags & AC_HIT) { @@ -979,10 +977,10 @@ void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { if ((i != ARRAY_COUNT(this->collider1Elements)) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->collider1.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { - func_80876D28(this, globalCtx); + func_80876D28(this, play); if (this->actor.colChkInfo.damageEffect != 0xF) { if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.colChkInfo.damageEffect == 3) { func_80876CAC(this); this->timer = 3; @@ -990,7 +988,7 @@ void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { this->collider2.base.acFlags &= ~AC_ON; func_80878594(this); } else { - func_80876BD0(this, globalCtx, i); + func_80876BD0(this, play, i); func_80878724(this); } } else if (this->actor.colChkInfo.damageEffect == 1) { @@ -1010,7 +1008,7 @@ void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { func_80876CAC(this); func_80878594(this); } else { - func_80876BD0(this, globalCtx, i); + func_80876BD0(this, play, i); func_8087864C(this); } } @@ -1018,31 +1016,31 @@ void EnDodongo_UpdateDamage(EnDodongo* this, GlobalContext* globalCtx) { } } -void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDodongo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnDodongo* this = THIS; - EnDodongo_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnDodongo_UpdateDamage(this, play); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); if (this->actor.bgCheckFlags & 2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->actionFunc != func_808787B0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); if ((this->actionFunc != func_808786C8) && (this->actionFunc != func_80877E60)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - if ((this->actionFunc != func_8087784C) && func_80877278(this, globalCtx)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + if ((this->actionFunc != func_8087784C) && func_80877278(this, play)) { func_80877DE0(this); } } } if (func_8087721C(this)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider3.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -1056,8 +1054,7 @@ void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDodongo* this = THIS; if (limbIndex == 1) { @@ -1069,7 +1066,7 @@ s32 EnDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80879370 = { 1800.0f, 1200.0f, 0.0f }; static Vec3f D_8087937C = { 1500.0f, 300.0f, 0.0f }; static s8 D_80879388[] = { @@ -1099,13 +1096,13 @@ void EnDodongo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnDodongo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDodongo_Draw(Actor* thisx, PlayState* play) { EnDodongo* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDodongo_OverrideLimbDraw, EnDodongo_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale * this->unk_334, this->drawDmgEffFrozenSteamScale * this->unk_334, this->drawDmgEffAlpha, this->drawDmgEffType); } 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 30562404f2..a196b1f8c0 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -5,7 +5,7 @@ struct EnDodongo; -typedef void (*EnDodongoActionFunc)(struct EnDodongo*, GlobalContext*); +typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); typedef struct EnDodongo { /* 0x000 */ 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 fe65bb30d8..e938706f00 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -24,18 +24,18 @@ #define THIS ((EnDoor*)thisx) -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 func_80866B20(EnDoor*, GlobalContext*); -void func_8086704C(EnDoor*, GlobalContext*); -void func_80866F94(EnDoor*, GlobalContext*); -void func_80867080(EnDoor*, GlobalContext*); -void func_80867144(EnDoor*, GlobalContext*); -void func_808670F0(EnDoor*, GlobalContext*); -void func_80866A5C(EnDoor*, GlobalContext*); +void func_80866B20(EnDoor*, PlayState*); +void func_8086704C(EnDoor*, PlayState*); +void func_80866F94(EnDoor*, PlayState*); +void func_80867080(EnDoor*, PlayState*); +void func_80867144(EnDoor*, PlayState*); +void func_808670F0(EnDoor*, PlayState*); +void func_80866A5C(EnDoor*, PlayState*); u8 D_808675D0[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(3, 0x12 - 0x04), @@ -384,8 +384,8 @@ static Gfx* D_808679A4[14][2] = { { gFieldWoodDoorLeftDL, gFieldWoodDoorRightDL }, }; -void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnDoor_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; s32 objectBankIndex; EnDoorInfo* objectInfo = sObjInfo; EnDoor* this = THIS; @@ -398,28 +398,27 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { this->switchFlag = ENDOOR_GET_PARAMS_7F(thisx); if ((this->unk_1A4 == 7) && (this->switchFlag == 0)) { DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gDoorCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gDoorCol); } - SkelAnime_Init(globalCtx, &this->skelAnime, &gDoorSkel, &gameplay_keep_Anim_020658, this->limbTable, - this->limbTable, 5); + SkelAnime_Init(play, &this->skelAnime, &gDoorSkel, &gameplay_keep_Anim_020658, this->limbTable, this->limbTable, 5); if (this->unk_1A4 == 5) { objectInfo = &sObjInfo[17 + this->switchFlag]; } else { for (i = 0; i < ARRAY_COUNT(sObjInfo) - 34; i++, objectInfo++) { - if (globalCtx->sceneNum == objectInfo->sceneNum) { + if (play->sceneNum == objectInfo->sceneNum) { break; } } - if ((i >= ARRAY_COUNT(sObjInfo) - 34) && (Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_FIELD_KEEP) >= 0)) { + if ((i >= ARRAY_COUNT(sObjInfo) - 34) && (Object_GetIndex(&play->objectCtx, GAMEPLAY_FIELD_KEEP) >= 0)) { objectInfo++; } } this->dlIndex = objectInfo->dListIndex; - objectBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId); + objectBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); if (objectBankIndex < 0) { objectInfo = &sObjInfo[15]; - objectBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId); + objectBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId); if (objectBankIndex != 0) { Actor_MarkForDeath(&this->dyna.actor); return; @@ -428,47 +427,46 @@ void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) { this->requiredObjBankIndex = objectBankIndex; this->dlIndex = objectInfo->dListIndex; // Set twice? if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex) { - func_80866A5C(this, globalCtx); + func_80866A5C(this, play); } else { this->actionFunc = func_80866A5C; } Actor_SetFocus(&this->dyna.actor, 35.0f); } -void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Destroy(Actor* thisx, PlayState* play) { EnDoor* this = (EnDoor*)thisx; if (this->unk_1A4 != 7) { - TransitionActorEntry* transitionEntry = - &globalCtx->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA]; + TransitionActorEntry* transitionEntry = &play->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA]; if (transitionEntry->id < 0) { transitionEntry->id = -transitionEntry->id; } } else if (this->switchFlag == 0) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_80866A5C(EnDoor* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) { +void func_80866A5C(EnDoor* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) { this->dyna.actor.objBankIndex = this->requiredObjBankIndex; this->actionFunc = func_80866B20; this->dyna.actor.world.rot.y = 0; if (this->unk_1A4 == 1) { - if (!Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (!Flags_GetSwitch(play, this->switchFlag)) { this->unk_1A6 = 10; } } else if ((this->unk_1A4 == 4) && - (Actor_XZDistanceBetweenActors(&this->dyna.actor, &GET_PLAYER(globalCtx)->actor) > 120.0f)) { + (Actor_XZDistanceBetweenActors(&this->dyna.actor, &GET_PLAYER(play)->actor) > 120.0f)) { this->actionFunc = func_8086704C; this->dyna.actor.world.rot.y = -0x1800; } } } -void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { +void func_80866B20(EnDoor* this, PlayState* play) { static s32 D_80867BC0[4]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f playerPosRelToDoor; s16 temp_a2; s16 yawDiff; @@ -476,7 +474,7 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { s32 temp_t0; u8 temp_a1; - if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state) && (this->dyna.actor.textId == 0x1821)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state) && (this->dyna.actor.textId == 0x1821)) { D_80867BC0[0] = 1; } if (this->unk_1A1 != 0) { @@ -485,13 +483,13 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { (player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f); if (this->unk_1A6 != 0) { gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } } else if (this->unk_1A7 != 0) { this->actionFunc = func_80866F94; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_OPEN); - } else if (!Player_InCsMode(&globalCtx->state)) { + } else if (!Player_InCsMode(&play->state)) { Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &playerPosRelToDoor, &player->actor.world.pos); if ((D_80867BC0[0] != 0) || ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (fabsf(playerPosRelToDoor.z) < 50.0f))) { @@ -516,9 +514,9 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { } else if ((this->unk_1A4 == 0) || (this->unk_1A4 == 2) || (this->unk_1A4 == 3)) { s32 textIdOffset; - temp_t0 = (globalCtx->actorCtx.unkC & 0x2AA) >> 1; + temp_t0 = (play->actorCtx.unkC & 0x2AA) >> 1; temp_a2 = D_801AED48[this->switchFlag & 7]; - temp_a1_2 = globalCtx->actorCtx.unkC & 0x155; + temp_a1_2 = play->actorCtx.unkC & 0x155; textIdOffset = (this->switchFlag >> 3) & 0xF; if (((this->unk_1A4 == 0) && (((temp_t0 | temp_a1_2) & temp_a2) == 0)) || ((this->unk_1A4 == 2) && ((temp_a2 & temp_a1_2) == 0)) || @@ -536,7 +534,7 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { } else if ((this->unk_1A4 == 5) && (playerPosRelToDoor.z > 0.0f)) { ScheduleResult sp30; - if (Schedule_RunScript(globalCtx, D_8086778C[this->switchFlag], &sp30) != 0) { + if (Schedule_RunScript(play, D_8086778C[this->switchFlag], &sp30) != 0) { this->dyna.actor.textId = sp30.result + 0x1800; player->doorType = ((this->dyna.actor.textId == 0x1821) && (D_80867BC0[0] != 0)) ? 5 : -1; @@ -551,7 +549,7 @@ void func_80866B20(EnDoor* this, GlobalContext* globalCtx) { } } -void func_80866F94(EnDoor* this, GlobalContext* globalCtx) { +void func_80866F94(EnDoor* this, PlayState* play) { s32 direction; if (this->unk_1A7 != 0) { @@ -571,13 +569,13 @@ void func_80866F94(EnDoor* this, GlobalContext* globalCtx) { } } -void func_8086704C(EnDoor* this, GlobalContext* globalCtx) { +void func_8086704C(EnDoor* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { this->actionFunc = func_808670F0; } } -void func_80867080(EnDoor* this, GlobalContext* globalCtx) { +void func_80867080(EnDoor* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { this->actionFunc = func_808670F0; } else if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, -0x1800, 0x100)) { @@ -585,14 +583,14 @@ void func_80867080(EnDoor* this, GlobalContext* globalCtx) { } } -void func_808670F0(EnDoor* this, GlobalContext* globalCtx) { +void func_808670F0(EnDoor* this, PlayState* play) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, 0, 0x700)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE); this->actionFunc = func_80866B20; } } -void func_80867144(EnDoor* this, GlobalContext* globalCtx) { +void func_80867144(EnDoor* this, PlayState* play) { s32 numEffects; s32 i; @@ -605,7 +603,7 @@ void func_80867144(EnDoor* this, GlobalContext* globalCtx) { if (this->skelAnime.playSpeed < 1.5f) { numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; for (i = 0; i < numEffects; i++) { - EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 60.0, 100.0f, 50.0f, 0.15f); + EffectSsBubble_Spawn(play, &this->dyna.actor.world.pos, 60.0, 100.0f, 50.0f, 0.15f); } } } else if (Animation_OnFrame(&this->skelAnime, sAnimCloseFrames[this->animIndex])) { @@ -614,14 +612,13 @@ void func_80867144(EnDoor* this, GlobalContext* globalCtx) { } } -void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDoor_Update(Actor* thisx, PlayState* play) { EnDoor* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { TransitionActorEntry* transitionEntry; EnDoor* this = THIS; @@ -633,15 +630,15 @@ s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList transitionEntry = NULL; if (this->unk_1A4 != 7) { - transitionEntry = &globalCtx->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA]; + transitionEntry = &play->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA]; } rot->z += this->dyna.actor.world.rot.y; - if ((this->unk_1A4 == 7) || (globalCtx->roomCtx.prevRoom.num >= 0) || + if ((this->unk_1A4 == 7) || (play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { s32 pad; temp = (this->dyna.actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z) - - Math_Vec3f_Yaw(&globalCtx->view.eye, &this->dyna.actor.world.pos); + Math_Vec3f_Yaw(&play->view.eye, &this->dyna.actor.world.pos); *dList = (ABS_ALT(temp) < 0x4000) ? dl[0] : dl[1]; } else { @@ -655,18 +652,18 @@ 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 = THIS; if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->unk_1A4 == 7) && (this->switchFlag == 0)) { - Gfx_DrawDListOpa(globalCtx, gameplay_keep_DL_0221B8); + Gfx_DrawDListOpa(play, gameplay_keep_DL_0221B8); } else { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, - NULL, &this->dyna.actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw, NULL, + &this->dyna.actor); if (this->dyna.actor.world.rot.y != 0) { if (this->dyna.actor.world.rot.y > 0) { gSPDisplayList(POLY_OPA_DISP++, gDoorRightDL); @@ -675,8 +672,8 @@ void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) { } } if (this->unk_1A6) { - Actor_DrawDoorLock(globalCtx, this->unk_1A6, 0); + Actor_DrawDoorLock(play, this->unk_1A6, 0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 bc94e150ee..359f34cd2c 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -5,7 +5,7 @@ struct EnDoor; -typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*); +typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*); #define ENDOOR_GET_PARAMS_7(thisx) (((thisx)->params >> 7) & 7) #define ENDOOR_GET_PARAMS_7F(thisx) (((thisx)->params) & 0x7F) diff --git a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c index 9b53c36d2a..0d3612145f 100644 --- a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c +++ b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.c @@ -10,9 +10,9 @@ #define THIS ((EnDoorEtc*)thisx) -void EnDoorEtc_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDoorEtc_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDoorEtc_Update(Actor* thisx, GlobalContext* globalCtx); +void EnDoorEtc_Init(Actor* thisx, PlayState* play); +void EnDoorEtc_Destroy(Actor* thisx, PlayState* play); +void EnDoorEtc_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Door_Etc_InitVars = { diff --git a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h index 0add11416a..cfbbbbd58d 100644 --- a/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h +++ b/src/overlays/actors/ovl_En_Door_Etc/z_en_door_etc.h @@ -5,7 +5,7 @@ struct EnDoorEtc; -typedef void (*EnDoorEtcActionFunc)(struct EnDoorEtc*, GlobalContext*); +typedef void (*EnDoorEtcActionFunc)(struct EnDoorEtc*, PlayState*); typedef struct EnDoorEtc { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index a37d8f828a..7b703c0f50 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -10,19 +10,19 @@ #define THIS ((EnDragon*)thisx) -void EnDragon_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDragon_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDragon_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDragon_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDragon_Init(Actor* thisx, PlayState* play); +void EnDragon_Destroy(Actor* thisx, PlayState* play); +void EnDragon_Update(Actor* thisx, PlayState* play); +void EnDragon_Draw(Actor* thisx, PlayState* play); void EnDragon_SetupRetreatOrIdle(EnDragon* this); -void EnDragon_RetreatOrIdle(EnDragon* this, GlobalContext* globalCtx); +void EnDragon_RetreatOrIdle(EnDragon* this, PlayState* play); void EnDragon_SetupExtend(EnDragon* this); -void EnDragon_Extend(EnDragon* this, GlobalContext* globalCtx); -void EnDragon_Grab(EnDragon* this, GlobalContext* globalCtx); +void EnDragon_Extend(EnDragon* this, PlayState* play); +void EnDragon_Grab(EnDragon* this, PlayState* play); void EnDragon_SetupAttack(EnDragon* this); -void EnDragon_Attack(EnDragon* this, GlobalContext* globalCtx); -void EnDragon_Dead(EnDragon* this, GlobalContext* globalCtx); +void EnDragon_Attack(EnDragon* this, PlayState* play); +void EnDragon_Dead(EnDragon* this, PlayState* play); typedef enum { /* 0 */ DEEP_PYTHON_ANIMATION_SMALL_SIDE_SWAY, @@ -206,16 +206,16 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -void EnDragon_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDragon_Init(Actor* thisx, PlayState* play) { EnDragon* this = THIS; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDeepPythonSkel, &gDeepPythonSmallSideSwayAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gDeepPythonSkel, &gDeepPythonSmallSideSwayAnim, this->jointTable, this->morphTable, DEEP_PYTHON_LIMB_MAX); this->actor.colChkInfo.health = 4; this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.targetMode = 0xA; - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.scale = this->collider.elements[1].dim.scale = this->collider.elements[2].dim.scale = this->collider.elements[3].dim.scale = this->collider.elements[4].dim.scale = @@ -249,10 +249,10 @@ void EnDragon_Init(Actor* thisx, GlobalContext* globalCtx) { EnDragon_SetupRetreatOrIdle(this); } -void EnDragon_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDragon_Destroy(Actor* thisx, PlayState* play) { EnDragon* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } static AnimationHeader* sAnimations[] = { @@ -290,7 +290,7 @@ static Color_RGBA8 sBubbleEnvColors[] = { { 0, 0, 255, 255 }, }; -void EnDragon_SpawnBubbles(EnDragon* this, GlobalContext* globalCtx, Vec3f basePos) { +void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) { static Vec3f sBubbleVelocity = { 0.0f, 0.0f, 0.0f }; static Vec3f sBubbleAccel = { 0.0f, 0.1f, 0.0f }; s32 bubbleCount; @@ -316,14 +316,14 @@ void EnDragon_SpawnBubbles(EnDragon* this, GlobalContext* globalCtx, Vec3f baseP bubblePos.z += randPlusMinusPoint5Scaled(i * 30.0f); sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f; scale = Rand_S16Offset(380, 240); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &bubblePos, &sBubbleVelocity, &sBubbleAccel, + EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel, &sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30, 0); } } -void EnDragon_RetreatOnceTimerEnds(EnDragon* this, GlobalContext* globalCtx) { +void EnDragon_RetreatOnceTimerEnds(EnDragon* this, PlayState* play) { if (this->timer == 0) { - func_800B8D50(globalCtx, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f, 8); + func_800B8D50(play, &this->actor, 10.0f, this->actor.world.rot.y, 10.0f, 8); EnDragon_SetupRetreatOrIdle(this); } } @@ -338,7 +338,7 @@ void EnDragon_SetupRetreatOrIdle(EnDragon* this) { this->actionFunc = EnDragon_RetreatOrIdle; } -void EnDragon_RetreatOrIdle(EnDragon* this, GlobalContext* globalCtx) { +void EnDragon_RetreatOrIdle(EnDragon* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->action == DEEP_PYTHON_ACTION_EXTEND) { EnDragon_SetupExtend(this); @@ -366,12 +366,12 @@ void EnDragon_SetupExtend(EnDragon* this) { this->actionFunc = EnDragon_Extend; } -void EnDragon_Extend(EnDragon* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDragon_Extend(EnDragon* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 currentFrame = this->skelAnime.curFrame; s16 yaw; - EnDragon_SpawnBubbles(this, globalCtx, this->jawPos); + EnDragon_SpawnBubbles(this, play, this->jawPos); if (this->action >= DEEP_PYTHON_ACTION_DAMAGE) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BACK); @@ -445,15 +445,15 @@ void EnDragon_Extend(EnDragon* this, GlobalContext* globalCtx) { } } -void EnDragon_CameraSetAtEye(EnDragon* this, GlobalContext* globalCtx, Vec3f eye, Vec3f at) { +void EnDragon_CameraSetAtEye(EnDragon* this, PlayState* play, Vec3f eye, Vec3f at) { this->cameraId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); Math_Vec3f_Copy(&this->cameraEye, &eye); Math_Vec3f_Copy(&this->cameraAt, &at); - Play_CameraSetAtEye(globalCtx, this->cameraId, &this->cameraAt, &this->cameraEye); + Play_CameraSetAtEye(play, this->cameraId, &this->cameraAt, &this->cameraEye); } -void EnDragon_SetupGrab(EnDragon* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f extendedPos; s16 yaw; @@ -490,8 +490,8 @@ static s16 sZRotPerPython[] = { 0x07D0, 0x07D0, 0x07D0, 0x07D0, 0x07D0, 0x0BB8, static s32 sMaxGrabTimerPerPython[] = { 5, 5, 5, 4, 5, 8, 5, 5 }; -void EnDragon_Grab(EnDragon* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDragon_Grab(EnDragon* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp50; // used as both the extended position and the camera eye Vec3f at; @@ -517,7 +517,7 @@ void EnDragon_Grab(EnDragon* this, GlobalContext* globalCtx) { this->grabTimer++; Math_SmoothStepToS(&this->actor.shape.rot.z, sZRotPerPython[this->pythonIndex], 0xA, 0x1F4, 0x14); - EnDragon_SpawnBubbles(this, globalCtx, this->jawPos); + EnDragon_SpawnBubbles(this, play, this->jawPos); Math_Vec3f_Copy(&sp50, &this->burrowEntrancePos); sp50.x += Math_SinS(this->actor.world.rot.y) * sCameraEyePerPython[this->pythonIndex].x; @@ -529,15 +529,15 @@ void EnDragon_Grab(EnDragon* this, GlobalContext* globalCtx) { at.y += sCameraAtPerPython[this->pythonIndex].y; at.z += Math_CosS(this->actor.world.rot.y) * sCameraAtPerPython[this->pythonIndex].z; - EnDragon_CameraSetAtEye(this, globalCtx, sp50, at); + EnDragon_CameraSetAtEye(this, play, sp50, at); if (this->grabTimer > sMaxGrabTimerPerPython[this->pythonIndex]) { if (this->state == DEEP_PYTHON_GRAB_STATE_START) { - func_800B7298(globalCtx, &this->actor, 6); + func_800B7298(play, &this->actor, 6); this->state = DEEP_PYTHON_GRAB_STATE_GRABBED; } - globalCtx->unk_18770(globalCtx, player); + play->unk_18770(play, player); player->actor.parent = &this->actor; player->unk_AE8 = 50; this->action = DEEP_PYTHON_ACTION_GRAB; @@ -557,22 +557,22 @@ void EnDragon_SetupAttack(EnDragon* this) { this->actionFunc = EnDragon_Attack; } -void EnDragon_Attack(EnDragon* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDragon_Attack(EnDragon* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 currentFrame = this->skelAnime.curFrame; Vec3f sp4C; // used as both the extended position and the camera eye Vec3f at; SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 0xA, 0x1388, 0); - if ((globalCtx->gameplayFrames % 16) == 0) { - globalCtx->damagePlayer(globalCtx, -2); + if ((play->gameplayFrames % 16) == 0) { + play->damagePlayer(play, -2); //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the skelAnime func_800B8E58((Player*)this, player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BITE); - CollisionCheck_GreenBlood(globalCtx, NULL, &player->actor.world.pos); + CollisionCheck_GreenBlood(play, NULL, &player->actor.world.pos); } Math_Vec3f_Copy(&sp4C, &this->actor.world.pos); @@ -585,7 +585,7 @@ void EnDragon_Attack(EnDragon* this, GlobalContext* globalCtx) { at.y += -100.0f; at.z += Math_CosS(this->actor.world.rot.y) * 1200.0f; - EnDragon_CameraSetAtEye(this, globalCtx, sp4C, at); + EnDragon_CameraSetAtEye(this, play, sp4C, at); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; player->actor.world.rot.x = player->actor.shape.rot.x = this->actor.world.rot.x; @@ -631,7 +631,7 @@ void EnDragon_Attack(EnDragon* this, GlobalContext* globalCtx) { } } -void EnDragon_SetupDead(EnDragon* this, GlobalContext* globalCtx) { +void EnDragon_SetupDead(EnDragon* this, PlayState* play) { if (!ActorCutscene_GetCanPlayNext(this->deathCutsceneIndex)) { ActorCutscene_SetIntentToPlay(this->deathCutsceneIndex); } else { @@ -643,21 +643,21 @@ void EnDragon_SetupDead(EnDragon* this, GlobalContext* globalCtx) { } } -void EnDragon_Dead(EnDragon* this, GlobalContext* globalCtx) { +void EnDragon_Dead(EnDragon* this, PlayState* play) { Vec3f seahorsePos; SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.z += 0x1000; this->jawZRotation = 0xFA0; - EnDragon_SpawnBubbles(this, globalCtx, this->jawPos); + EnDragon_SpawnBubbles(this, play, this->jawPos); if ((this->timer != 0) && (fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 121.0f) && (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 121.0f)) { this->actor.speedXZ = -120.0f; if (((this->pythonIndex & 1) == 0) && (Rand_ZeroOne() < 0.5f)) { - //! @bug: !globalCtx->gameplayFrames is 0 essentially all the time, so this code never runs. - if (((!globalCtx->gameplayFrames) & 0x1F)) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->jawPos, 0x90); + //! @bug: !play->gameplayFrames is 0 essentially all the time, so this code never runs. + if (((!play->gameplayFrames) & 0x1F)) { + Item_DropCollectibleRandom(play, NULL, &this->jawPos, 0x90); } } @@ -679,7 +679,7 @@ void EnDragon_Dead(EnDragon* this, GlobalContext* globalCtx) { seahorsePos.x += (Math_SinS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); seahorsePos.y += -100.0f + BREG(33); seahorsePos.z += (Math_CosS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); - if (Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, + if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.cutscene, this->actor.unk20, NULL)) { gSaveContext.save.weekEventReg[13] |= 1; @@ -721,8 +721,8 @@ void EnDragon_Dead(EnDragon* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } -void EnDragon_UpdateDamage(EnDragon* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnDragon_UpdateDamage(EnDragon* this, PlayState* play) { + Player* player = GET_PLAYER(play); u32 sp30; if (this->action == DEEP_PYTHON_ACTION_EXTEND) { @@ -738,7 +738,7 @@ void EnDragon_UpdateDamage(EnDragon* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_DAMAGE); this->action = DEEP_PYTHON_ACTION_DAMAGE; } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_DEAD); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~ACTOR_FLAG_1; @@ -751,7 +751,7 @@ void EnDragon_UpdateDamage(EnDragon* this, GlobalContext* globalCtx) { if ((this->action == DEEP_PYTHON_ACTION_EXTEND) && (this->grabWaitTimer == 0) && (player->invincibilityTimer == 0) && (this->collider.elements[0].info.ocElemFlags & OCELEM_HIT) && - (!(func_800B64FC(globalCtx, 1000.0f, &this->actor.world.pos, &sp30) >= 0.0f) || (sp30 != 1))) { + (!(func_800B64FC(play, 1000.0f, &this->actor.world.pos, &sp30) >= 0.0f) || (sp30 != 1))) { this->actor.speedXZ = 0.0f; this->action = DEEP_PYTHON_ACTION_GRAB; this->actor.flags |= ACTOR_FLAG_100000; @@ -759,7 +759,7 @@ void EnDragon_UpdateDamage(EnDragon* this, GlobalContext* globalCtx) { } } -void EnDragon_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDragon_Update(Actor* thisx, PlayState* play) { s32 pad; EnDragon* this = THIS; @@ -779,27 +779,26 @@ void EnDragon_Update(Actor* thisx, GlobalContext* globalCtx) { this->grabWaitTimer--; } - EnDragon_UpdateDamage(this, globalCtx); + EnDragon_UpdateDamage(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; Math_Vec3f_Copy(&this->actor.focus.pos, &this->focusPos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); Actor_SetScale(&this->actor, this->scale); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); if (this->action != DEEP_PYTHON_ACTION_GRAB) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->action < DEEP_PYTHON_ACTION_DAMAGE) { - 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); } } -s32 EnDragon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnDragon_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDragon* this = THIS; if (limbIndex == DEEP_PYTHON_LIMB_JAW) { @@ -811,7 +810,7 @@ s32 EnDragon_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnDragon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDragon_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDragon* this = THIS; Vec3f playerGrabOffsetFromJawPos = { 350.0f, -120.0f, -60.0f }; @@ -830,11 +829,11 @@ void EnDragon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnDragon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDragon_Draw(Actor* thisx, PlayState* play) { EnDragon* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDragon_OverrideLimbDraw, EnDragon_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h index 5fe44083b4..1e6a0aa3cd 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h @@ -18,7 +18,7 @@ typedef enum { struct EnDragon; -typedef void (*EnDragonActionFunc)(struct EnDragon*, GlobalContext*); +typedef void (*EnDragonActionFunc)(struct EnDragon*, PlayState*); typedef struct EnDragon { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index 74f4f19cc9..eecd6be2d4 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -10,12 +10,12 @@ #define THIS ((EnDrs*)thisx) -void EnDrs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDrs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDrs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDrs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDrs_Init(Actor* thisx, PlayState* play); +void EnDrs_Destroy(Actor* thisx, PlayState* play); +void EnDrs_Update(Actor* thisx, PlayState* play); +void EnDrs_Draw(Actor* thisx, PlayState* play); -void EnDrs_Idle(EnDrs* this, GlobalContext* globalCtx); +void EnDrs_Idle(EnDrs* this, PlayState* play); const ActorInit En_Drs_InitVars = { ACTOR_EN_DRS, @@ -53,20 +53,20 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static AnimationInfoS sAnimations = { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; -void EnDrs_CollisionUpdate(EnDrs* this, GlobalContext* globalCtx) { +void EnDrs_CollisionUpdate(EnDrs* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnDrs_Setup(EnDrs* this, GlobalContext* globalCtx) { +void EnDrs_Setup(EnDrs* this, PlayState* play) { s32 pad[2]; - if ((this->moonMaskObjBankIndex >= 0) && SubS_IsObjectLoaded(this->moonMaskObjBankIndex, globalCtx)) { + if ((this->moonMaskObjBankIndex >= 0) && SubS_IsObjectLoaded(this->moonMaskObjBankIndex, play)) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWeddingDressMannequinSkel, NULL, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWeddingDressMannequinSkel, NULL, this->jointTable, this->morphTable, WEDDING_DRESS_MANNEQUIN_LIMB_MAX); SubS_ChangeAnimationByInfoS(&this->skelAnime, &sAnimations, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.draw = EnDrs_Draw; @@ -74,53 +74,53 @@ void EnDrs_Setup(EnDrs* this, GlobalContext* globalCtx) { } } -void EnDrs_Idle(EnDrs* this, GlobalContext* globalCtx) { +void EnDrs_Idle(EnDrs* this, PlayState* play) { } -void EnDrs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnDrs_Init(Actor* thisx, PlayState* play) { EnDrs* this = THIS; - this->moonMaskObjBankIndex = SubS_GetObjectIndex(OBJECT_MSMO, globalCtx); + this->moonMaskObjBankIndex = SubS_GetObjectIndex(OBJECT_MSMO, play); this->actionFunc = EnDrs_Setup; } -void EnDrs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnDrs_Destroy(Actor* thisx, PlayState* play) { EnDrs* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnDrs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDrs_Update(Actor* thisx, PlayState* play) { EnDrs* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.draw != NULL) { SkelAnime_Update(&this->skelAnime); - EnDrs_CollisionUpdate(this, globalCtx); + EnDrs_CollisionUpdate(this, play); } } -void EnDrs_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnDrs_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDrs* this = THIS; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s8 temp = this->moonMaskObjBankIndex; s8 temp2 = this->actor.objBankIndex; // Anju removes the Moon Mask at the start of the Couple's Mask cutscene // after that it will no longer be rendered. if (!(gSaveContext.save.weekEventReg[87] & 2) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { - OPEN_DISPS(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[temp].segment); + OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp].segment); gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[temp2].segment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp2].segment); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnDrs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDrs_Draw(Actor* thisx, PlayState* play) { EnDrs* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnDrs_PostLimbDraw, &this->actor); + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnDrs_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.h b/src/overlays/actors/ovl_En_Drs/z_en_drs.h index 1f59d601bf..d86121efb1 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.h +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.h @@ -7,7 +7,7 @@ struct EnDrs; -typedef void (*EnDrsActionFunc)(struct EnDrs*, GlobalContext*); +typedef void (*EnDrsActionFunc)(struct EnDrs*, PlayState*); typedef struct EnDrs { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c index c47961a6d2..7f05e9e505 100644 --- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c +++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c @@ -10,10 +10,10 @@ #define THIS ((EnDs2n*)thisx) -void EnDs2n_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDs2n_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDs2n_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDs2n_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDs2n_Init(Actor* thisx, PlayState* play); +void EnDs2n_Destroy(Actor* thisx, PlayState* play); +void EnDs2n_Update(Actor* thisx, PlayState* play); +void EnDs2n_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Ds2n_InitVars = { diff --git a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h index 83a7ac8ec4..e182edfd19 100644 --- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h +++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.h @@ -5,7 +5,7 @@ struct EnDs2n; -typedef void (*EnDs2nActionFunc)(struct EnDs2n*, GlobalContext*); +typedef void (*EnDs2nActionFunc)(struct EnDs2n*, PlayState*); typedef struct EnDs2n { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dt/z_en_dt.c b/src/overlays/actors/ovl_En_Dt/z_en_dt.c index 0501b728c6..d4b809027e 100644 --- a/src/overlays/actors/ovl_En_Dt/z_en_dt.c +++ b/src/overlays/actors/ovl_En_Dt/z_en_dt.c @@ -10,10 +10,10 @@ #define THIS ((EnDt*)thisx) -void EnDt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnDt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnDt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnDt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnDt_Init(Actor* thisx, PlayState* play); +void EnDt_Destroy(Actor* thisx, PlayState* play); +void EnDt_Update(Actor* thisx, PlayState* play); +void EnDt_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Dt_InitVars = { diff --git a/src/overlays/actors/ovl_En_Dt/z_en_dt.h b/src/overlays/actors/ovl_En_Dt/z_en_dt.h index 0292a8f52c..2fbd228e61 100644 --- a/src/overlays/actors/ovl_En_Dt/z_en_dt.h +++ b/src/overlays/actors/ovl_En_Dt/z_en_dt.h @@ -5,7 +5,7 @@ struct EnDt; -typedef void (*EnDtActionFunc)(struct EnDt*, GlobalContext*); +typedef void (*EnDtActionFunc)(struct EnDt*, PlayState*); typedef struct EnDt { /* 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 40e06787ce..7770cc3ec0 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 @@ -11,13 +11,13 @@ #define THIS ((EnDyExtra*)thisx) -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 func_80A61334(EnDyExtra* this, GlobalContext* globalCtx); -void func_80A613C8(EnDyExtra* this, GlobalContext* globalCtx); +void func_80A61334(EnDyExtra* this, PlayState* play); +void func_80A613C8(EnDyExtra* this, PlayState* play); const ActorInit En_Dy_Extra_InitVars = { ACTOR_EN_DY_EXTRA, @@ -31,10 +31,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 = THIS; this->type = this->actor.params; @@ -48,7 +48,7 @@ void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80A61334; } -void func_80A61334(EnDyExtra* this, GlobalContext* globalCtx) { +void func_80A61334(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->actor.world.pos.y < -85.0f) { @@ -61,7 +61,7 @@ void func_80A61334(EnDyExtra* this, GlobalContext* globalCtx) { } } -void func_80A613C8(EnDyExtra* this, GlobalContext* globalCtx) { +void func_80A613C8(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->unk14C == 0 || this->unk150 < 0.02f) { @@ -76,16 +76,16 @@ void func_80A613C8(EnDyExtra* this, GlobalContext* globalCtx) { } } -void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = THIS; DECR(this->unk14C); Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); } -void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnDyExtra_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 D_80A61740[] = { { 255, 255, 170, 255 }, { 255, 170, 255, 255 }, { 255, 255, 170, 255 }, { 170, 255, 255, 255 }, { 255, 255, 170, 255 }, @@ -97,7 +97,7 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00 }; EnDyExtra* this = THIS; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; Vtx* vertices = Lib_SegmentedToVirtual(object_dy_obj_Vtx_00DD40); s32 i; u8 unk[3]; @@ -114,12 +114,12 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].r, D_80A61740[this->type].g, D_80A61740[this->type].b, 255); gDPSetEnvColor(POLY_XLU_DISP++, D_80A61754[this->type].r, D_80A61754[this->type].g, D_80A61754[this->type].b, 128); 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 752612c97d..9a0b53223f 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 @@ -5,7 +5,7 @@ struct EnDyExtra; -typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, GlobalContext*); +typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, PlayState*); typedef struct EnDyExtra { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c index bea655d9a1..4607e29091 100644 --- a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c +++ b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c @@ -10,10 +10,10 @@ #define THIS ((EnEgblock*)thisx) -void EnEgblock_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEgblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEgblock_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEgblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEgblock_Init(Actor* thisx, PlayState* play); +void EnEgblock_Destroy(Actor* thisx, PlayState* play); +void EnEgblock_Update(Actor* thisx, PlayState* play); +void EnEgblock_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Egblock_InitVars = { diff --git a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.h b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.h index 7719d3706f..8127749381 100644 --- a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.h +++ b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.h @@ -5,7 +5,7 @@ struct EnEgblock; -typedef void (*EnEgblockActionFunc)(struct EnEgblock*, GlobalContext*); +typedef void (*EnEgblockActionFunc)(struct EnEgblock*, PlayState*); typedef struct EnEgblock { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 0111c6cd7b..8952e118bb 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -10,10 +10,10 @@ #define THIS ((EnEgol*)thisx) -void EnEgol_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEgol_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEgol_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEgol_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEgol_Init(Actor* thisx, PlayState* play); +void EnEgol_Destroy(Actor* thisx, PlayState* play); +void EnEgol_Update(Actor* thisx, PlayState* play); +void EnEgol_Draw(Actor* thisx, PlayState* play); #if 0 // static ColliderJntSphElementInit sJntSphElementsInit[6] = { diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.h b/src/overlays/actors/ovl_En_Egol/z_en_egol.h index 29401bc2c2..9e00971529 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.h +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.h @@ -5,7 +5,7 @@ struct EnEgol; -typedef void (*EnEgolActionFunc)(struct EnEgol*, GlobalContext*); +typedef void (*EnEgolActionFunc)(struct EnEgol*, PlayState*); typedef struct EnEgol { /* 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 f71c0b30d9..7d53c4fc28 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -11,27 +11,27 @@ #define THIS ((EnElf*)thisx) -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 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 EnElf_SetupAction(EnElf* this, EnElfActionFunc actionFunc); -void func_8088C9CC(EnElf* this, GlobalContext* globalCtx); -void func_8088D3EC(EnElf* this, GlobalContext* globalCtx); -void func_8088D470(EnElf* this, GlobalContext* globalCtx); -void func_8088D504(EnElf* this, GlobalContext* globalCtx); -void func_8088DD34(EnElf* this, GlobalContext* globalCtx); -void func_8088E018(EnElf* this, GlobalContext* globalCtx); -void func_8088E0E0(EnElf* this, GlobalContext* globalCtx); -void func_8088E0F0(EnElf* this, GlobalContext* globalCtx); -void func_8088E484(EnElf* this, GlobalContext* globalCtx); -void func_8088E850(EnElf* this, GlobalContext* globalCtx); -void func_8088EFA4(EnElf* this, GlobalContext* globalCtx); -void func_8088F214(EnElf* this, GlobalContext* globalCtx); -void func_8088F5F4(EnElf* this, GlobalContext* globalCtx, s32 arg2); -void func_8089010C(Actor* thisx, GlobalContext* globalCtx); -void func_808908D0(Vec3f* arg0, GlobalContext* globalCtx, u32 arg2); +void func_8088C9CC(EnElf* this, PlayState* play); +void func_8088D3EC(EnElf* this, PlayState* play); +void func_8088D470(EnElf* this, PlayState* play); +void func_8088D504(EnElf* this, PlayState* play); +void func_8088DD34(EnElf* this, PlayState* play); +void func_8088E018(EnElf* this, PlayState* play); +void func_8088E0E0(EnElf* this, PlayState* play); +void func_8088E0F0(EnElf* this, PlayState* play); +void func_8088E484(EnElf* this, PlayState* play); +void func_8088E850(EnElf* this, PlayState* play); +void func_8088EFA4(EnElf* this, PlayState* play); +void func_8088F214(EnElf* this, PlayState* play); +void func_8088F5F4(EnElf* this, PlayState* play, s32 arg2); +void func_8089010C(Actor* thisx, PlayState* play); +void func_808908D0(Vec3f* arg0, PlayState* play, u32 arg2); const ActorInit En_Elf_InitVars = { ACTOR_EN_ELF, @@ -185,8 +185,8 @@ s32 func_8088C804(Vec3f* arg0, Vec3f* arg1, f32 arg2) { return SQ(arg2) < SQ(arg1->x - arg0->x) + SQ(arg1->z - arg0->z); } -void func_8088C858(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088C858(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!func_8088C804(&this->actor.world.pos, &player->actor.world.pos, 30.0f)) { this->unk_254 = 0.5f; @@ -204,8 +204,8 @@ void func_8088C858(EnElf* this, GlobalContext* globalCtx) { } } -void func_8088C920(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088C920(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (func_8088C804(&this->actor.world.pos, &player->actor.world.pos, 50.0f)) { if (this->unk_25C > 0) { @@ -220,7 +220,7 @@ void func_8088C920(EnElf* this, GlobalContext* globalCtx) { } } -void func_8088C9CC(EnElf* this, GlobalContext* globalCtx) { +void func_8088C9CC(EnElf* this, PlayState* play) { f32 xzDistToPlayer; if (this->unk_25C > 0) { @@ -266,7 +266,7 @@ void func_8088C9CC(EnElf* this, GlobalContext* globalCtx) { } } -void func_8088CBAC(EnElf* this, GlobalContext* globalCtx) { +void func_8088CBAC(EnElf* this, PlayState* play) { f32 phi_f0; if (this->fairyFlags & 0x4000) { @@ -281,11 +281,11 @@ void func_8088CBAC(EnElf* this, GlobalContext* globalCtx) { this->unk_254 = 1.5f; this->unk_26C = func_8088C9CC; } else { - this->unk_26C(this, globalCtx); + this->unk_26C(this, play); } } -void func_8088CC48(EnElf* this, GlobalContext* globalCtx) { +void func_8088CC48(EnElf* this, PlayState* play) { EnElf_SetupAction(this, func_8088DD34); this->unk_250 = Rand_ZeroFloat(10.0f) + 10.0f; this->unk_246 = 0; @@ -293,10 +293,10 @@ void func_8088CC48(EnElf* this, GlobalContext* globalCtx) { this->unk_224 = this->actor.world.pos; this->unk_258 = randPlusMinusPoint5Scaled(0x7FFF); this->unk_26C = func_8088C9CC; - func_8088CBAC(this, globalCtx); + func_8088CBAC(this, play); this->unk_25C = 0; this->disappearTimer = 240; - if ((this->fairyFlags & 0x400) && Flags_GetCollectible(globalCtx, this->unk_260)) { + if ((this->fairyFlags & 0x400) && Flags_GetCollectible(play, this->unk_260)) { Actor_MarkForDeath(&this->actor); } } @@ -313,25 +313,25 @@ f32 func_8088CD3C(s32 colorFlag) { return 0.0f; } -void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnElf_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnElf* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 colorConfig; s32 params; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, - this->jointTable, this->morphTable, 7); + SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, + this->morphTable, 7); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); thisx->shape.shadowAlpha = 255; 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; @@ -358,7 +358,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { if ((gSaveContext.save.playerData.tatlTimer >= 25800) || (gSaveContext.save.playerData.tatlTimer < 3000)) { gSaveContext.save.playerData.tatlTimer = 0; } - this->unk_266 = ElfMessage_GetFirstCycleHint(globalCtx); + this->unk_266 = ElfMessage_GetFirstCycleHint(play); break; case 1: @@ -391,7 +391,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { colorConfig = -1; this->fairyFlags |= 0x800; this->fairyFlags |= 0x1000; - func_8088CC48(this, globalCtx); + func_8088CC48(this, play); break; case 2: @@ -400,7 +400,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { this->fairyFlags |= 0x800; this->fairyFlags |= 0x2000; this->fairyFlags |= 0x1000; - func_8088CC48(this, globalCtx); + func_8088CC48(this, play); break; case 6: @@ -408,7 +408,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { this->fairyFlags |= 0x800; this->fairyFlags |= 0x2000; this->fairyFlags |= 0x1000; - func_8088CC48(this, globalCtx); + func_8088CC48(this, play); break; case 9: @@ -416,7 +416,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { case 10: colorConfig = -2; - func_8088CC48(this, globalCtx); + func_8088CC48(this, play); break; case 8: @@ -437,8 +437,8 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { s32 i; 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, 6); + 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, 6); } } break; @@ -457,15 +457,15 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnElf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Destroy(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = THIS; - 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_8088D3EC(EnElf* this, GlobalContext* globalCtx) { +void func_8088D3EC(EnElf* this, PlayState* play) { this->unk_224.x = Math_SinS(this->unk_248) * this->unk_254; this->unk_224.y = Math_SinS(this->unk_246) * this->unk_250; this->unk_224.z = Math_CosS(this->unk_248) * this->unk_254; @@ -473,7 +473,7 @@ void func_8088D3EC(EnElf* this, GlobalContext* globalCtx) { this->unk_246 += this->unk_24A; } -void func_8088D470(EnElf* this, GlobalContext* globalCtx) { +void func_8088D470(EnElf* this, PlayState* play) { f32 xzScale = (Math_CosS(this->unk_246) * this->unk_250) + this->unk_254; this->unk_224.x = Math_SinS(this->unk_248) * xzScale; @@ -484,8 +484,8 @@ void func_8088D470(EnElf* this, GlobalContext* globalCtx) { this->unk_246 += this->unk_24A; } -void func_8088D504(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088D504(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_246 = (this->unk_248 * 2) & 0xFFFF; this->unk_224.x = Math_SinS(this->unk_248) * this->unk_254; @@ -551,9 +551,9 @@ void func_8088D8D0(EnElf* this, Vec3f* arg1) { Math_StepToF(&this->actor.velocity.y, yVelAbs * yVelDirection, 1.5f); } -void func_8088D9BC(EnElf* this, GlobalContext* globalCtx) { +void func_8088D9BC(EnElf* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 targetYaw; Vec3f* vec = &this->unk_224; @@ -634,10 +634,10 @@ s32 func_8088DCA4(EnElf* this) { return false; } -void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { - Player* refActor = GET_PLAYER(globalCtx); +void func_8088DD34(EnElf* this, PlayState* play) { + Player* refActor = GET_PLAYER(play); s32 pad; - Player* player2 = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(play); f32 heightDiff; SkelAnime_Update(&this->skelAnime); @@ -647,22 +647,22 @@ void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { this->unk_24A = (s32)Rand_ZeroFloat(0x400) + 0x200; } - func_8088CBAC(this, globalCtx); + func_8088CBAC(this, play); if (this->fairyFlags & 0x800) { this->unk_224.y = player2->bodyPartsPos[0].y; } func_8088D8D0(this, &this->unk_224); - func_8088D9BC(this, globalCtx); - if (Actor_HasParent(&this->actor, globalCtx)) { + func_8088D9BC(this, play); + if (Actor_HasParent(&this->actor, play)) { if (this->fairyFlags & 0x400) { - Flags_SetCollectible(globalCtx, this->unk_260); + Flags_SetCollectible(play, this->unk_260); } Actor_MarkForDeath(&this->actor); return; } - if (Player_InCsMode(&globalCtx->state)) { + if (Player_InCsMode(&play->state)) { if ((this->fairyFlags & 0x4000) && (this->fairyFlags & 0x100) && func_8088DCA4(this)) { return; } @@ -673,10 +673,10 @@ void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { if ((this->fairyFlags & 0x1000) && (heightDiff > 0.0f) && (heightDiff < 60.0f) && !func_8088C804(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { - func_80115908(globalCtx, 0x80); + func_80115908(play, 0x80); if (this->fairyFlags & 0x200) { - Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + - (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); + Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); } gSaveContext.jinxTimer = 0; this->unk_254 = 50.0f; @@ -687,7 +687,7 @@ void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { this->unk_246 = 0; EnElf_SetupAction(this, func_8088E0F0); if (this->fairyFlags & 0x400) { - Flags_SetCollectible(globalCtx, this->unk_260); + Flags_SetCollectible(play, this->unk_260); } return; } @@ -701,16 +701,16 @@ void func_8088DD34(EnElf* this, GlobalContext* globalCtx) { } if (this->fairyFlags & 0x2000) { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 80.0f, 60.0f); + Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 60.0f); } } -void func_8088E018(EnElf* this, GlobalContext* globalCtx) { +void func_8088E018(EnElf* this, PlayState* play) { Vec3f parentPos; Actor* parent; SkelAnime_Update(&this->skelAnime); - func_8088D3EC(this, globalCtx); + func_8088D3EC(this, play); parent = this->actor.parent; if ((parent != NULL) && (parent->update != NULL)) { @@ -723,11 +723,11 @@ void func_8088E018(EnElf* this, GlobalContext* globalCtx) { this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x); } -void func_8088E0E0(EnElf* this, GlobalContext* globalCtx) { +void func_8088E0E0(EnElf* this, PlayState* play) { } -void func_8088E0F0(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088E0F0(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_254, 30.0f, 0.1f, 4.0f, 1.0f); @@ -768,12 +768,12 @@ void func_8088E0F0(EnElf* this, GlobalContext* globalCtx) { } this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x); - func_8088F5F4(this, globalCtx, 32); + func_8088F5F4(this, play, 32); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_8088E304(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088E304(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->unk_224.y > 200.0f) { @@ -802,12 +802,12 @@ void func_8088E304(EnElf* this, GlobalContext* globalCtx) { func_8088D7F8(this, &player->bodyPartsPos[0]); this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x); - func_8088F5F4(this, globalCtx, 0x20); + func_8088F5F4(this, play, 0x20); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_8088E484(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088E484(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -827,23 +827,23 @@ void func_8088E484(EnElf* this, GlobalContext* globalCtx) { func_8088D7F8(this, &player->bodyPartsPos[0]); Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_250) * SQ(1.0f / 9.0f))) * 0.008f); this->unk_258 = Math_FAtan2F(this->actor.velocity.z, this->actor.velocity.x); - func_8088F5F4(this, globalCtx, 32); + func_8088F5F4(this, play, 32); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } -void func_8088E5A8(EnElf* this, GlobalContext* globalCtx) { +void func_8088E5A8(EnElf* this, PlayState* play) { if (this->fairyFlags & 4) { - func_8088EFA4(this, globalCtx); + func_8088EFA4(this, play); } SkelAnime_Update(&this->skelAnime); - this->unk_26C(this, globalCtx); + this->unk_26C(this, play); } -void func_8088E60C(EnElf* this, GlobalContext* globalCtx) { +void func_8088E60C(EnElf* this, PlayState* play) { s16 glowLightRadius; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x400) { glowLightRadius = 200; @@ -855,14 +855,14 @@ void func_8088E60C(EnElf* this, GlobalContext* globalCtx) { glowLightRadius = 0; } - if (Cutscene_CheckActorAction(globalCtx, 201)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 201)]->action == 6) { + if (Cutscene_CheckActorAction(play, 201)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action == 6) { glowLightRadius = 0; } } if (this->fairyFlags & 0x20) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, player->actor.world.pos.y + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -877,25 +877,25 @@ void func_8088E60C(EnElf* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); } -void func_8088E850(EnElf* this, GlobalContext* globalCtx) { +void func_8088E850(EnElf* this, PlayState* play) { Vec3f nextPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* arrowPointedActor; f32 xScale; f32 distFromLinksHead; u32 sp38; - func_8088F214(this, globalCtx); - func_8088E5A8(this, globalCtx); + func_8088F214(this, play); + func_8088E5A8(this, play); xScale = 0.0f; - if (Cutscene_CheckActorAction(globalCtx, 201)) { - sp38 = Cutscene_GetActorActionIndex(globalCtx, 201); - func_808908D0(&nextPos, globalCtx, sp38); - this->actor.shape.rot.y = globalCtx->csCtx.actorActions[sp38]->urot.y; - this->actor.shape.rot.x = globalCtx->csCtx.actorActions[sp38]->urot.x; - if (globalCtx->csCtx.actorActions[sp38]->action == 5) { - func_8088F5F4(this, globalCtx, 16); + if (Cutscene_CheckActorAction(play, 201)) { + sp38 = Cutscene_GetActorActionIndex(play, 201); + func_808908D0(&nextPos, play, sp38); + this->actor.shape.rot.y = play->csCtx.actorActions[sp38]->urot.y; + this->actor.shape.rot.x = play->csCtx.actorActions[sp38]->urot.x; + if (play->csCtx.actorActions[sp38]->action == 5) { + func_8088F5F4(this, play, 16); } if (this->unk_244 == 8) { @@ -904,15 +904,14 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { func_8088D660(this, &nextPos, 0.2f); } - if ((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 0) && - (globalCtx->csCtx.currentCsIndex == 0) && - ((globalCtx->csCtx.frames == 149) || (globalCtx->csCtx.frames == 381) || - (globalCtx->csCtx.frames == 591))) { + if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 0) && + (play->csCtx.currentCsIndex == 0) && + ((play->csCtx.frames == 149) || (play->csCtx.frames == 381) || (play->csCtx.frames == 591))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } - if ((globalCtx->sceneNum == SCENE_SECOM) && (gSaveContext.sceneSetupIndex == 0) && - (globalCtx->csCtx.currentCsIndex == 4) && (globalCtx->csCtx.frames == 95)) { + if ((play->sceneNum == SCENE_SECOM) && (gSaveContext.sceneSetupIndex == 0) && + (play->csCtx.currentCsIndex == 4) && (play->csCtx.frames == 95)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } else { @@ -933,7 +932,7 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { } else { xScale = 0.008f; } - func_8088F5F4(this, globalCtx, 16); + func_8088F5F4(this, play, 16); break; case 6: @@ -946,7 +945,7 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { nextPos.y += 1500.0f * this->actor.scale.y; func_8088D7F8(this, &nextPos); - func_8088F5F4(this, globalCtx, 16); + func_8088F5F4(this, play, 16); if (this->unk_254 <= 19.0f) { this->unk_254 += 1.0f; @@ -962,24 +961,24 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { break; case 10: - nextPos = GET_ACTIVE_CAM(globalCtx)->eye; + nextPos = GET_ACTIVE_CAM(play)->eye; nextPos.y += -2000.0f * this->actor.scale.y; func_8088DB4C(this, &nextPos, 0.0f, 30.0f, 0.2f); break; default: - arrowPointedActor = globalCtx->actorCtx.targetContext.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetContext.arrowPointedActor; if ((player->stateFlags1 & 0x40) && (player->targetActor != NULL)) { Math_Vec3f_Copy(&nextPos, &player->targetActor->focus.pos); } else { - Math_Vec3f_Copy(&nextPos, &globalCtx->actorCtx.targetContext.unk0); + Math_Vec3f_Copy(&nextPos, &play->actorCtx.targetContext.unk0); } nextPos.y += 1500.0f * this->actor.scale.y; if (arrowPointedActor != NULL) { func_8088DB4C(this, &nextPos, 0.0f, 30.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - func_8088F5F4(this, globalCtx, 0x10); + func_8088F5F4(this, play, 0x10); } } else { if ((this->timer % 32) == 0) { @@ -991,7 +990,7 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { this->fairyFlags ^= 2; } func_8088DB4C(this, &nextPos, 0.0f, 30.0f, 0.2f); - func_8088F5F4(this, globalCtx, 0x10); + func_8088F5F4(this, play, 0x10); } else { if (distFromLinksHead > 100.0f) { this->fairyFlags |= 2; @@ -1015,9 +1014,9 @@ void func_8088E850(EnElf* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); } - func_8088E60C(this, globalCtx); + func_8088E60C(this, play); - if (!Cutscene_CheckActorAction(globalCtx, 0xC9)) { + if (!Cutscene_CheckActorAction(play, 0xC9)) { this->actor.shape.rot.y = this->unk_258; } } @@ -1036,9 +1035,9 @@ void func_8088EF18(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* curCol dest->a += rgbaDiff.a * rate; } -void func_8088EFA4(EnElf* this, GlobalContext* globalCtx) { - Actor* arrayPointerActor = globalCtx->actorCtx.targetContext.arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); +void func_8088EFA4(EnElf* this, PlayState* play) { + Actor* arrayPointerActor = play->actorCtx.targetContext.arrowPointedActor; + Player* player = GET_PLAYER(play); f32 transitionRate; if (!(this->unk_264 & 8)) { @@ -1062,7 +1061,7 @@ void func_8088EFA4(EnElf* this, GlobalContext* globalCtx) { this->outerColor.b = 80.0f; this->outerColor.a = 0.0f; } - } else if (globalCtx->actorCtx.targetContext.unk40 != 0.0f) { + } else if (play->actorCtx.targetContext.unk40 != 0.0f) { this->unk_268 = 0; this->unk_238 = 1.0f; if (!this->unk_269) { @@ -1070,18 +1069,18 @@ void func_8088EFA4(EnElf* this, GlobalContext* globalCtx) { } } else if (this->unk_268 == 0) { if ((arrayPointerActor == NULL) || - (Math_Vec3f_DistXYZ(&this->actor.world.pos, &globalCtx->actorCtx.targetContext.unk0) < 50.0f)) { + (Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->actorCtx.targetContext.unk0) < 50.0f)) { this->unk_268 = 1; } } else if (this->unk_238 != 0.0f) { if (Math_StepToF(&this->unk_238, 0.0f, 0.25f)) { - this->innerColor = globalCtx->actorCtx.targetContext.fairyInner; - this->outerColor = globalCtx->actorCtx.targetContext.fairyOuter; + this->innerColor = play->actorCtx.targetContext.fairyInner; + this->outerColor = play->actorCtx.targetContext.fairyOuter; } else { transitionRate = 0.25f / this->unk_238; - func_8088EF18(&this->innerColor, &globalCtx->actorCtx.targetContext.fairyInner, &this->innerColor, + func_8088EF18(&this->innerColor, &play->actorCtx.targetContext.fairyInner, &this->innerColor, transitionRate); - func_8088EF18(&this->outerColor, &globalCtx->actorCtx.targetContext.fairyOuter, &this->outerColor, + func_8088EF18(&this->outerColor, &play->actorCtx.targetContext.fairyOuter, &this->outerColor, transitionRate); } } @@ -1101,15 +1100,15 @@ void func_8088EFA4(EnElf* this, GlobalContext* globalCtx) { } } -void func_8088F214(EnElf* this, GlobalContext* globalCtx) { +void func_8088F214(EnElf* this, PlayState* play) { s32 sp34; Actor* arrowPointedActor; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; - if (globalCtx->csCtx.state != 0) { - if (Cutscene_CheckActorAction(globalCtx, 201)) { - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 201)]->action) { + if (play->csCtx.state != 0) { + if (Cutscene_CheckActorAction(play, 201)) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action) { case 4: sp34 = 7; break; @@ -1134,7 +1133,7 @@ void func_8088F214(EnElf* this, GlobalContext* globalCtx) { sp34 = 1; func_800B9010(&this->actor, NA_SE_EV_BELL_ANGER - SFX_FLAG); } else { - arrowPointedActor = globalCtx->actorCtx.targetContext.arrowPointedActor; + arrowPointedActor = play->actorCtx.targetContext.arrowPointedActor; if (player->stateFlags1 & 0x400) { sp34 = 10; this->unk_25C = 100; @@ -1238,7 +1237,7 @@ void func_8088F214(EnElf* this, GlobalContext* globalCtx) { } } -void func_8088F5F4(EnElf* this, GlobalContext* globalCtx, s32 sparkleLife) { +void func_8088F5F4(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; @@ -1259,26 +1258,26 @@ void func_8088F5F4(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_8088F9E4(Actor* thisx, GlobalContext* globalCtx) { +void func_8088F9E4(Actor* thisx, PlayState* play) { EnElf* this = THIS; s32 bgId; - thisx->floorHeight = BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &thisx->floorPoly, &bgId, - &this->actor, &thisx->world.pos); + thisx->floorHeight = + BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &thisx->floorPoly, &bgId, &this->actor, &thisx->world.pos); thisx->shape.shadowAlpha = 50; } -void func_8088FA38(EnElf* this, GlobalContext* globalCtx) { +void func_8088FA38(EnElf* this, PlayState* play) { Vec3f refPos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->fairyFlags & 0x10) { - refPos = globalCtx->actorCtx.targetContext.unk0; + refPos = play->actorCtx.targetContext.unk0; if (this->unk_234 != NULL) { refPos = this->unk_234->world.pos; @@ -1295,20 +1294,20 @@ void func_8088FA38(EnElf* this, GlobalContext* globalCtx) { this->fairyFlags &= ~0x10; } - func_8088E5A8(this, globalCtx); + func_8088E5A8(this, play); refPos = this->actor.focus.pos; func_8088DB4C(this, &refPos, 0, 30.0f, 0.2f); if (this->actor.speedXZ >= 5.0f) { - func_8088F5F4(this, globalCtx, 0x10); + func_8088F5F4(this, play, 0x10); } Math_SmoothStepToF(&this->actor.scale.x, 0.008f, 0.3f, 0.00080000004f, 0.000080000005f); - func_8088E60C(this, globalCtx); + func_8088E60C(this, play); } -void func_8088FC34(EnElf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8088FC34(EnElf* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_258, 5, 0x1000, 0x400); this->timer++; @@ -1319,7 +1318,7 @@ void func_8088FC34(EnElf* this, GlobalContext* globalCtx) { } else { Math_StepToF(&this->unk_240, 1.0f, 0.05f); } - func_800FD2B4(globalCtx, SQ(this->unk_240), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); + func_800FD2B4(play, SQ(this->unk_240), player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f); } } @@ -1353,17 +1352,17 @@ void func_8088FDCC(EnElf* this) { this->unk_264 &= ~0x20; } -void func_8088FE64(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_8088FE64(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnElf* this = THIS; - func_8088FA38(this, globalCtx); + func_8088FA38(this, play); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.currentTextId == 0x202) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.currentTextId == 0x202) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F230(); break; @@ -1374,23 +1373,23 @@ void func_8088FE64(Actor* thisx, GlobalContext* globalCtx2) { } } - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId - 1); + func_80151938(play, play->msgCtx.currentTextId - 1); break; case 1: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 576: - func_80151938(globalCtx, 0x245); + func_80151938(play, 0x245); break; case 0x21D: @@ -1407,28 +1406,28 @@ void func_8088FE64(Actor* thisx, GlobalContext* globalCtx2) { case 0x244: switch (CURRENT_DAY) { case 1: - func_80151938(globalCtx, 0x246); + func_80151938(play, 0x246); break; case 2: - func_80151938(globalCtx, 0x247); + func_80151938(play, 0x247); break; case 3: if (!gSaveContext.save.isNight) { - func_80151938(globalCtx, 0x248); + func_80151938(play, 0x248); } else if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.weekEventReg[74] & 0x20)) { - func_80151938(globalCtx, 0x225); + func_80151938(play, 0x225); } else { - func_80151938(globalCtx, 0x249); + func_80151938(play, 0x249); } break; } break; default: - func_801477B4(globalCtx); + func_801477B4(play); func_8088FDCC(this); break; } @@ -1440,18 +1439,18 @@ void func_8088FE64(Actor* thisx, GlobalContext* globalCtx2) { break; } - func_8088FC34(this, globalCtx); + func_8088FC34(this, play); if (this->unk_264 & 1) { func_8088FD04(this); } } -void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { +void func_8089010C(Actor* thisx, PlayState* play) { s32 pad; EnElf* this = THIS; - Player* player = GET_PLAYER(globalCtx); - u16 temp_v0 = ElfMessage_GetFirstCycleHint(globalCtx); + Player* player = GET_PLAYER(play); + u16 temp_v0 = ElfMessage_GetFirstCycleHint(play); if (temp_v0 != this->unk_266) { this->unk_266 = temp_v0; @@ -1460,7 +1459,7 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { if ((player->tatlTextId == 0) && (player->unk_730 == NULL)) { if ((gSaveContext.save.playerData.tatlTimer >= 600) && (gSaveContext.save.playerData.tatlTimer <= 3000)) { - player->tatlTextId = ElfMessage_GetFirstCycleHint(globalCtx); + player->tatlTextId = ElfMessage_GetFirstCycleHint(play); } } @@ -1468,11 +1467,11 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { thisx->flags |= 0x10000; } - if (Actor_ProcessTalkRequest(thisx, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(thisx, &play->state)) { func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_LISTEN, 0x20); thisx->focus.pos = thisx->world.pos; - if (thisx->textId == ElfMessage_GetFirstCycleHint(globalCtx)) { + if (thisx->textId == ElfMessage_GetFirstCycleHint(play)) { this->fairyFlags |= 0x80; gSaveContext.save.playerData.tatlTimer = 3001; } @@ -1489,7 +1488,7 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { } if (this->elfMsg->home.rot.x == -0x961) { this->unk_234 = this->elfMsg; - Actor_ChangeFocus(thisx, globalCtx, this->elfMsg); + Actor_ChangeFocus(thisx, play, this->elfMsg); } } else { thisx->cutscene = -1; @@ -1502,9 +1501,9 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { thisx->update = func_8088FE64; func_8088C51C(this, 3); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { if (gSaveContext.save.playerData.tatlTimer < 25800) { gSaveContext.save.playerData.tatlTimer++; } else if (!(this->fairyFlags & 0x80)) { @@ -1516,8 +1515,8 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { this->elfMsg = NULL; this->timer++; - if ((this->unk_240 >= 0.0f) && func_800FD2B4(globalCtx, SQ(this->unk_240) * this->unk_240, - player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f)) { + if ((this->unk_240 >= 0.0f) && + func_800FD2B4(play, SQ(this->unk_240) * this->unk_240, player->actor.projectedPos.z + 780.0f, 0.2f, 0.5f)) { Math_StepToF(&this->unk_240, -0.05f, 0.05f); } @@ -1525,25 +1524,25 @@ void func_8089010C(Actor* thisx, GlobalContext* globalCtx) { this->unk_269--; } - if (!this->unk_269 && (globalCtx->csCtx.state != 0)) { + if (!this->unk_269 && (play->csCtx.state != 0)) { this->unk_269 = 1; } } -void EnElf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElf_Update(Actor* thisx, PlayState* play) { EnElf* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->shape.rot.y = this->unk_258; this->timer++; if (this->fairyFlags & 0x200) { - func_8088F9E4(thisx, globalCtx); + func_8088F9E4(thisx, play); } } -s32 EnElf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -1570,24 +1569,24 @@ 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) { EnElf* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; s32 pad2; if (player->currentMask != PLAYER_MASK_GIANT) { if (!(this->fairyFlags & 8) && - (!Cutscene_CheckActorAction(globalCtx, 201) || - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 201)]->action != 6)) && + (!Cutscene_CheckActorAction(play, 201) || + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action != 6)) && (!(player->stateFlags1 & 0x100000) || (kREG(90) < this->actor.projectedPos.z))) { - Gfx* dListHead = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); + Gfx* dListHead = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); f32 alphaScale; s32 envAlpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C94C(globalCtx->state.gfxCtx); + func_8012C94C(play->state.gfxCtx); envAlpha = (this->timer * 50) & 0x1FF; envAlpha = (envAlpha >= 0x100) ? 511 - envAlpha : envAlpha; @@ -1611,18 +1610,18 @@ void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->outerColor.r, (u8)(s8)this->outerColor.g, (u8)(s8)this->outerColor.b, (u8)(s8)(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->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void func_808908D0(Vec3f* vec, GlobalContext* globalCtx, u32 action) { +void func_808908D0(Vec3f* vec, PlayState* play, u32 action) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* npcAction = globalCtx->csCtx.actorActions[action]; + CsCmdActorAction* npcAction = play->csCtx.actorActions[action]; f32 lerp; startPos.x = npcAction->startPos.x; @@ -1633,6 +1632,6 @@ void func_808908D0(Vec3f* vec, GlobalContext* globalCtx, u32 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); VEC3F_LERPIMPDST(vec, &startPos, &endPos, lerp); } 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 52c5e2af17..0f8646dc63 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -5,8 +5,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*); #define ENELF_GET_F(thisx) ((thisx)->params & 0xF) #define ENELF_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index ec64038ce6..e02ac11182 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -12,13 +12,13 @@ #define THIS ((EnElfbub*)thisx) -void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx); -void EnElfbub_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnElfbub_Update(Actor* thisx, GlobalContext* globalCtx); -void EnElfbub_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnElfbub_Init(Actor* thisx, PlayState* play); +void EnElfbub_Destroy(Actor* thisx, PlayState* play); +void EnElfbub_Update(Actor* thisx, PlayState* play); +void EnElfbub_Draw(Actor* thisx, PlayState* play); -void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx); -void EnElfbub_Idle(EnElfbub* this, GlobalContext* globalCtx); +void EnElfbub_Pop(EnElfbub* this, PlayState* play); +void EnElfbub_Idle(EnElfbub* this, PlayState* play); const ActorInit En_Elfbub_InitVars = { ACTOR_EN_ELFBUB, @@ -52,11 +52,11 @@ static ColliderCylinderInit sCylinderInit = { { 16, 32, 0, { 0, 0, 0 } }, }; -void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnElfbub_Init(Actor* thisx, PlayState* play) { EnElfbub* this = THIS; Actor* childActor; - if (Flags_GetSwitch(globalCtx, ENELFBUB_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENELFBUB_GET_SWITCHFLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } @@ -70,12 +70,12 @@ void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx) { this->zRotDelta = 1000; this->xScale = 0.08f; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - childActor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELFORG, - this->actor.world.pos.x, this->actor.world.pos.y + 12.0f, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, + childActor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELFORG, this->actor.world.pos.x, + this->actor.world.pos.y + 12.0f, this->actor.world.pos.z, this->actor.world.rot.x, + this->actor.world.rot.y, this->actor.world.rot.z, ((ENELFBUB_GET_SWITCHFLAG(&this->actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_BUBBLE); if (childActor != NULL) { childActor->parent = &this->actor; @@ -85,12 +85,12 @@ void EnElfbub_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void EnElfbub_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElfbub_Destroy(Actor* thisx, PlayState* play) { EnElfbub* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx) { +void EnElfbub_Pop(EnElfbub* this, PlayState* play) { static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sEnvColor = { 150, 150, 150, 0 }; static Vec3f sAccel = { 0.0f, -0.5f, 0.0f }; @@ -112,16 +112,16 @@ void EnElfbub_Pop(EnElfbub* this, GlobalContext* globalCtx) { 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, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor, + EffectSsDtBubble_SpawnCustomColor(play, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor, Rand_S16Offset(100, 50), 25, 0); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK); Actor_MarkForDeath(&this->actor); } } -void EnElfbub_Idle(EnElfbub* this, GlobalContext* globalCtx) { +void EnElfbub_Idle(EnElfbub* this, PlayState* play) { s32 pad; this->zRot += this->zRotDelta; @@ -134,34 +134,34 @@ void EnElfbub_Idle(EnElfbub* this, GlobalContext* globalCtx) { return; } - 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 EnElfbub_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElfbub_Update(Actor* thisx, PlayState* play) { EnElfbub* this = THIS; Collider_UpdateCylinder(&this->actor, &this->collider); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->actor.shape.yOffset); } -void EnElfbub_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnElfbub_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnElfbub* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(0.0f, 0.0f, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->xyScale + 1.0f, this->xyScale + 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateZS(this->zRot, MTXMODE_APPLY); Matrix_Scale(this->xScale + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateZS(this->zRot * -1, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_bubble_DL_001000); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h index 62a4b69a6c..46862f2c6c 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.h @@ -7,7 +7,7 @@ struct EnElfbub; -typedef void (*EnElfbubActionFunc)(struct EnElfbub*, GlobalContext*); +typedef void (*EnElfbubActionFunc)(struct EnElfbub*, PlayState*); typedef struct EnElfbub { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index de1959ab46..db131058c1 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -11,27 +11,27 @@ #define THIS ((EnElfgrp*)thisx) -void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx); -void EnElfgrp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnElfgrp_Update(Actor* thisx, GlobalContext* globalCtx); +void EnElfgrp_Init(Actor* thisx, PlayState* play); +void EnElfgrp_Destroy(Actor* thisx, PlayState* play); +void EnElfgrp_Update(Actor* thisx, PlayState* play); -s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2); -s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1); -void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3); -void func_80A3A0AC(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A0F4(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A210(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A274(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A484(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A4AC(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A520(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A600(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A6F4(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A77C(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A7FC(EnElfgrp* this, GlobalContext* globalCtx); -void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx); +s32 func_80A39BD0(PlayState* play, s32 arg2); +s32 func_80A39C1C(PlayState* play, s32 arg1); +void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3); +void func_80A3A0AC(EnElfgrp* this, PlayState* play); +void func_80A3A0F4(EnElfgrp* this, PlayState* play); +void func_80A3A210(EnElfgrp* this, PlayState* play); +void func_80A3A274(EnElfgrp* this, PlayState* play); +void func_80A3A398(EnElfgrp* this, PlayState* play); +void func_80A3A484(EnElfgrp* this, PlayState* play); +void func_80A3A4AC(EnElfgrp* this, PlayState* play); +void func_80A3A520(EnElfgrp* this, PlayState* play); +void func_80A3A600(EnElfgrp* this, PlayState* play); +void func_80A3A610(EnElfgrp* this, PlayState* play); +void func_80A3A6F4(EnElfgrp* this, PlayState* play); +void func_80A3A77C(EnElfgrp* this, PlayState* play); +void func_80A3A7FC(EnElfgrp* this, PlayState* play); +void func_80A3A8F8(EnElfgrp* this, PlayState* play); const ActorInit En_Elfgrp_InitVars = { ACTOR_EN_ELFGRP, @@ -56,7 +56,7 @@ void func_80A396B0(EnElfgrp* this, s32 arg1) { } } -void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnElfgrp_Init(Actor* thisx, PlayState* play) { s32 pad; EnElfgrp* this = THIS; s32 sp24; @@ -73,11 +73,11 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { case ENELFGRP_3: case ENELFGRP_4: this->unk_148 = this->unk_147 - 1; - sp24 = func_80A39C1C(globalCtx, this->unk_147); + sp24 = func_80A39C1C(play, this->unk_147); this->unk_146 = 1 << this->unk_147; if (sp24 < 25) { - func_80A39DC8(this, globalCtx, sp24, 0); + func_80A39DC8(this, play, sp24, 0); } if (sp24 >= 25) { @@ -86,7 +86,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if ((func_80A39BD0(globalCtx, this->unk_147) + sp24) >= 25) { + if ((func_80A39BD0(play, this->unk_147) + sp24) >= 25) { this->actionFunc = func_80A3A398; switch (this->unk_147) { @@ -118,7 +118,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { } break; } - } else if (func_80A39BD0(globalCtx, this->unk_147)) { + } else if (func_80A39BD0(play, this->unk_147)) { this->actionFunc = func_80A3A7FC; this->actor.textId = (this->unk_147 * 3) + 0x581; } else { @@ -132,11 +132,11 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: - sp24 = func_80A39C1C(globalCtx, 0); + sp24 = func_80A39C1C(play, 0); this->unk_146 = ENELFGRP_1; if (sp24 >= 25) { this->actionFunc = func_80A3A520; - if ((this->actor.home.rot.z != 0) && Flags_GetSwitch(globalCtx, this->actor.home.rot.z)) { + if ((this->actor.home.rot.z != 0) && Flags_GetSwitch(play, this->actor.home.rot.z)) { this->actionFunc = func_80A3A600; } else if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { func_80A396B0(this, 4); @@ -147,7 +147,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A396B0(this, 6); } } else if ((gSaveContext.save.weekEventReg[8] & 0x80)) { - func_80A39DC8(this, globalCtx, 24, 0); + func_80A39DC8(this, play, 24, 0); this->actionFunc = func_80A3A398; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { @@ -160,7 +160,7 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A396B0(this, 1); } } else { - func_80A39DC8(this, globalCtx, 24, 0); + func_80A39DC8(this, play, 24, 0); this->actionFunc = func_80A3A8F8; if ((gSaveContext.save.weekEventReg[9] & this->unk_146)) { this->actor.textId = 0x580; @@ -173,18 +173,18 @@ void EnElfgrp_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnElfgrp_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElfgrp_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2) { +s32 func_80A39BD0(PlayState* play, s32 arg2) { if ((arg2 < 1) || (arg2 >= 5)) { return 0; } - return (((void)0, gSaveContext.save.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(globalCtx, arg2)) + 10; + return (((void)0, gSaveContext.save.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(play, arg2)) + 10; } -s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) { +s32 func_80A39C1C(PlayState* play, s32 arg1) { // the permanentSceneFlags access here is in the form // struct { // u32 clockTown : 1; @@ -205,13 +205,13 @@ s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) { } if (arg1 == 0) { - if (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1) { + if (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1) { return 25; } return 24; } - temp_v1 = (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; + temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; if (temp_v1 < 10) { temp_v1 = 10; } else if (temp_v1 > 25) { @@ -220,30 +220,30 @@ s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) { return temp_v1; } -void func_80A39CD4(GlobalContext* globalCtx, s32 arg1, s32 arg2) { +void func_80A39CD4(PlayState* play, s32 arg1, s32 arg2) { if ((arg1 < 0) || (arg1 > 4) || (arg2 < 10) || (arg2 > 25)) { return; } if (arg1 == 0) { if (arg2 == 25) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; } else { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~1; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~1; } } else { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); } } -void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3) { +void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) { s32 pad; s32 i; Actor* elforg; s32 temp; Vec3f sp6C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (arg3 == 0) { this->unk_14A |= 8; @@ -260,9 +260,8 @@ void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3) } for (i = 0; i < arg2; i++) { - elforg = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x, - sp6C.y, randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, temp); + elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x, sp6C.y, + randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, temp); if (elforg == NULL) { continue; } @@ -272,8 +271,8 @@ void func_80A39DC8(EnElfgrp* this, GlobalContext* globalCtx, s32 arg2, s32 arg3) } } -s32 func_80A39F50(GlobalContext* globalCtx) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +s32 func_80A39F50(PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; EnElforg* elfOrg; while (itemAction != NULL) { @@ -294,8 +293,8 @@ s32 func_80A39F50(GlobalContext* globalCtx) { return 0; } -s32 func_80A39FBC(GlobalContext* globalCtx) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +s32 func_80A39FBC(PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; EnElforg* elfOrg; s32 phi_v1 = 30; @@ -323,8 +322,8 @@ s32 func_80A39FBC(GlobalContext* globalCtx) { return phi_v1; } -void func_80A3A044(GlobalContext* globalCtx) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +void func_80A3A044(PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; EnElforg* elfOrg; while (itemAction != NULL) { @@ -343,22 +342,22 @@ void func_80A3A044(GlobalContext* globalCtx) { } } -void func_80A3A0AC(EnElfgrp* this, GlobalContext* globalCtx) { - if (!Cutscene_CheckActorAction(globalCtx, 0x64)) { +void func_80A3A0AC(EnElfgrp* this, PlayState* play) { + if (!Cutscene_CheckActorAction(play, 0x64)) { this->actionFunc = func_80A3A600; ActorCutscene_Stop(this->actor.cutscene); } } -void func_80A3A0F4(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A0F4(EnElfgrp* this, PlayState* play) { if (this->unk_144 == 10) { play_sound(NA_SE_SY_WHITE_OUT_T); if (ENELFGRP_GET(&this->actor) < ENELFGRP_4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, ENELFGRP_GET(&this->actor) + ENELFGRP_4); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, 4); } } @@ -372,10 +371,10 @@ void func_80A3A0F4(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A210(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A210(EnElfgrp* this, PlayState* play) { if (this->unk_144 == 0) { this->actionFunc = func_80A3A0F4; - func_80A3A044(globalCtx); + func_80A3A044(play); this->unk_144 = 30; } @@ -384,27 +383,27 @@ void func_80A3A210(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A274(EnElfgrp* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 0x64)) { +void func_80A3A274(EnElfgrp* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x64)) { if (this->unk_14A & 1) { func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x64)]->action) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x64)]->action) { case 2: if (!(this->unk_14A & 1)) { if (this->unk_147 == ENELFGRP_0) { - func_80A39DC8(this, globalCtx, 1, 1); + func_80A39DC8(this, play, 1, 1); } else { - func_80A39DC8(this, globalCtx, func_80A39BD0(globalCtx, this->unk_147), 1); + func_80A39DC8(this, play, func_80A39BD0(play, this->unk_147), 1); } this->unk_14A |= 1; - func_80A39CD4(globalCtx, this->unk_147, 25); + func_80A39CD4(play, this->unk_147, 25); } break; case 3: - func_80A39F50(globalCtx); + func_80A39F50(play); this->actionFunc = func_80A3A210; this->unk_144 = 90; break; @@ -412,13 +411,13 @@ void func_80A3A274(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A398(EnElfgrp* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = func_80A3A274; - Flags_UnsetSwitch(globalCtx, ENELFGRP_GET_FE00(&this->actor)); + Flags_UnsetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); if (this->unk_14A & 2) { - Item_Give(globalCtx, ITEM_MASK_GREAT_FAIRY); + Item_Give(play, ITEM_MASK_GREAT_FAIRY); } if ((this->unk_14A & 4) != 0) { @@ -426,7 +425,7 @@ void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx) { } if (this->unk_14A & 0x10) { - Item_Give(globalCtx, ITEM_SWORD_GREAT_FAIRY); + Item_Give(play, ITEM_SWORD_GREAT_FAIRY); } this->unk_14A &= ~8; } else if (this->actor.xzDistToPlayer < 350.0f) { @@ -434,16 +433,16 @@ void func_80A3A398(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A484(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A484(EnElfgrp* this, PlayState* play) { if (this->unk_144 == 0) { this->actionFunc = func_80A3A0F4; this->unk_144 = 30; } } -void func_80A3A4AC(EnElfgrp* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 0x64)) { - s32 temp = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x64)]->action; +void func_80A3A4AC(EnElfgrp* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x64)) { + s32 temp = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x64)]->action; if (temp == 3) { this->actionFunc = func_80A3A484; this->unk_144 = 90; @@ -451,34 +450,34 @@ void func_80A3A4AC(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A520(EnElfgrp* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 0x67)) { +void func_80A3A520(EnElfgrp* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x67)) { this->actionFunc = func_80A3A600; } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = func_80A3A4AC; - Flags_SetSwitch(globalCtx, ENELFGRP_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); if (this->unk_14A & 2) { - Item_Give(globalCtx, ITEM_MASK_GREAT_FAIRY); + Item_Give(play, ITEM_MASK_GREAT_FAIRY); } if (this->actor.home.rot.z != 0) { - Flags_SetSwitch(globalCtx, this->actor.home.rot.z); + Flags_SetSwitch(play, this->actor.home.rot.z); } } else if (this->actor.xzDistToPlayer < 350.0f) { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void func_80A3A600(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A600(EnElfgrp* this, PlayState* play) { } -void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3A610(EnElfgrp* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_144 == 60) { - Parameter_AddMagic(globalCtx, + Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); gSaveContext.healthAccumulator = 320; } @@ -495,62 +494,62 @@ void func_80A3A610(EnElfgrp* this, GlobalContext* globalCtx) { } } -void func_80A3A6F4(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A6F4(EnElfgrp* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; - this->unk_144 = func_80A39FBC(globalCtx); + this->unk_144 = func_80A39FBC(play); this->actionFunc = func_80A3A610; this->unk_14A &= ~8; } } -void func_80A3A77C(EnElfgrp* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A3A77C(EnElfgrp* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - this->unk_144 = func_80A39FBC(globalCtx); + if (Actor_TextboxIsClosing(&this->actor, play)) { + this->unk_144 = func_80A39FBC(play); this->actionFunc = func_80A3A610; this->unk_14A &= ~8; } } -void func_80A3A7FC(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A7FC(EnElfgrp* this, PlayState* play) { s32 temp_s0; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { gSaveContext.save.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; - temp_s0 = func_80A39BD0(globalCtx, this->unk_147); - func_80A39DC8(this, globalCtx, temp_s0, 1); - temp_s0 += func_80A39C1C(globalCtx, this->unk_147); + temp_s0 = func_80A39BD0(play, this->unk_147); + func_80A39DC8(this, play, temp_s0, 1); + temp_s0 += func_80A39C1C(play, this->unk_147); if (temp_s0 > 25) { temp_s0 = 25; } - func_80A39CD4(globalCtx, this->unk_147, temp_s0); + func_80A39CD4(play, this->unk_147, temp_s0); } else if (this->actor.xzDistToPlayer < 280.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } -void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx) { +void func_80A3A8F8(EnElfgrp* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { gSaveContext.save.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; return; } if (this->unk_147 != ENELFGRP_0) { - if (func_80A39BD0(globalCtx, this->unk_147) > 0) { + if (func_80A39BD0(play, this->unk_147) > 0) { this->actionFunc = func_80A3A7FC; return; } @@ -561,22 +560,22 @@ void func_80A3A8F8(EnElfgrp* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10000; player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_80A3A77C; gSaveContext.save.weekEventReg[9] |= this->unk_146; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } else { this->actor.flags &= ~ACTOR_FLAG_10000; } } -void EnElfgrp_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElfgrp_Update(Actor* thisx, PlayState* play) { EnElfgrp* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_14A & 8) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h index 375dad55bb..bb3a86a403 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.h @@ -5,7 +5,7 @@ struct EnElfgrp; -typedef void (*EnElfgrpActionFunc)(struct EnElfgrp*, GlobalContext*); +typedef void (*EnElfgrpActionFunc)(struct EnElfgrp*, PlayState*); #define ENELFGRP_GET(thisx) ((thisx)->params & 0xF) #define ENELFGRP_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 16139fa083..005a53975a 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -11,17 +11,17 @@ #define THIS ((EnElforg*)thisx) -void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnElforg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnElforg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnElforg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnElforg_Init(Actor* thisx, PlayState* play); +void EnElforg_Destroy(Actor* thisx, PlayState* play); +void EnElforg_Update(Actor* thisx, PlayState* play); +void EnElforg_Draw(Actor* thisx, PlayState* play); -void EnElforg_TrappedByBubble(EnElforg* this, GlobalContext* globalCtx); -void EnElforg_TurnInFairy(EnElforg* this, GlobalContext* globalCtx); -void EnElforg_FreeFloatingFairyFountain(EnElforg* this, GlobalContext* globalCtx); -void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx); -void EnElforg_SetupTrappedByEnemy(EnElforg* this, GlobalContext* globalCtx); -void EnElforg_HiddenByCollider(EnElforg* this, GlobalContext* globalCtx); +void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play); +void EnElforg_TurnInFairy(EnElforg* this, PlayState* play); +void EnElforg_FreeFloatingFairyFountain(EnElforg* this, PlayState* play); +void EnElforg_FreeFloating(EnElforg* this, PlayState* play); +void EnElforg_SetupTrappedByEnemy(EnElforg* this, PlayState* play); +void EnElforg_HiddenByCollider(EnElforg* this, PlayState* play); const ActorInit En_Elforg_InitVars = { ACTOR_EN_ELFORG, @@ -66,14 +66,14 @@ void EnElforg_InitializeParams(EnElforg* this) { this->skelAnime.curFrame = (s32)Rand_ZeroFloat(5.0f); } -void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnElforg_Init(Actor* thisx, PlayState* play) { s32 pad; EnElforg* this = THIS; Actor_SetScale(&this->actor, 0.01f); this->flags = 0; this->direction = 0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gStrayFairySkel, &gStrayFairyFlyingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gStrayFairySkel, &gStrayFairyFlyingAnim, this->jointTable, this->jointTable, STRAY_FAIRY_LIMB_MAX); this->skelAnime.playSpeed = 1.0f; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); @@ -87,13 +87,13 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { } break; case STRAY_FAIRY_TYPE_COLLECTIBLE: - if (Flags_GetCollectible(globalCtx, STRAY_FAIRY_FLAG(&this->actor))) { + if (Flags_GetCollectible(play, STRAY_FAIRY_FLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } break; default: - if (Flags_GetSwitch(globalCtx, STRAY_FAIRY_FLAG(&this->actor))) { + if (Flags_GetSwitch(play, STRAY_FAIRY_FLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } @@ -105,7 +105,7 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { break; } - if (func_8010A074(globalCtx)) { + if (func_8010A074(play)) { this->area = gSaveContext.unk_48C8 + 1; } else { // Needs to be thisx in order to match @@ -130,13 +130,13 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { break; case STRAY_FAIRY_TYPE_ENEMY: this->actionFunc = EnElforg_SetupTrappedByEnemy; - EnElforg_SetupTrappedByEnemy(this, globalCtx); + EnElforg_SetupTrappedByEnemy(this, play); this->actor.draw = NULL; break; case STRAY_FAIRY_TYPE_COLLIDER: this->actionFunc = EnElforg_HiddenByCollider; this->actor.draw = NULL; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); break; default: @@ -148,15 +148,15 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = 0; } -void EnElforg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnElforg_Destroy(Actor* thisx, PlayState* play) { EnElforg* this = THIS; if (STRAY_FAIRY_TYPE(&this->actor) == STRAY_FAIRY_TYPE_COLLIDER) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void EnElforg_SpawnSparkles(EnElforg* this, GlobalContext* globalCtx, s32 life) { +void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) { static Vec3f sVelocity = { 0.0f, -0.05f, 0.0f }; static Vec3f sAcceleration = { 0.0f, -0.025f, 0.0f }; static Color_RGBA8 sPrimColors[] = { @@ -176,8 +176,8 @@ void EnElforg_SpawnSparkles(EnElforg* this, GlobalContext* globalCtx, s32 life) index = (this->area < STRAY_FAIRY_AREA_CLOCK_TOWN || this->area >= STRAY_FAIRY_AREA_MAX) ? STRAY_FAIRY_AREA_CLOCK_TOWN : this->area; - EffectSsKirakira_SpawnDispersed(globalCtx, &pos, &sVelocity, &sAcceleration, &sPrimColors[index], - &sEnvColors[index], 1000, life); + EffectSsKirakira_SpawnDispersed(play, &pos, &sVelocity, &sAcceleration, &sPrimColors[index], &sEnvColors[index], + 1000, life); } void EnElforg_ApproachTargetYPosition(EnElforg* this, Vec3f* targetPos) { @@ -252,11 +252,11 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) { Actor_MoveWithGravity(&this->actor); } -void func_80ACCBB8(EnElforg* this, GlobalContext* globalCtx) { - globalCtx->actorCtx.unk5 |= 8; +void func_80ACCBB8(EnElforg* this, PlayState* play) { + play->actorCtx.unk5 |= 8; } -void EnElforg_TrappedByBubble(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->actor.parent == NULL) || (this->actor.parent->update == NULL)) { EnElforg_InitializeParams(this); @@ -266,11 +266,11 @@ void EnElforg_TrappedByBubble(EnElforg* this, GlobalContext* globalCtx) { this->actor.world.pos = this->actor.parent->world.pos; this->actor.world.pos.y += 12.0f; } - func_80ACCBB8(this, globalCtx); + func_80ACCBB8(this, play); } -void EnElforg_TurnInFairy(EnElforg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnElforg_TurnInFairy(EnElforg* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xzDistToPlayer; s16 rotationTemp; s16 newAngle; @@ -291,7 +291,7 @@ void EnElforg_TurnInFairy(EnElforg* this, GlobalContext* globalCtx) { rotationTemp = this->actor.yawTowardsPlayer - newAngle; this->actor.world.pos.x = player->actor.world.pos.x - (Math_SinS(rotationTemp) * xzDistToPlayer); this->actor.world.pos.z = player->actor.world.pos.z - (Math_CosS(rotationTemp) * xzDistToPlayer); - EnElforg_SpawnSparkles(this, globalCtx, 16); + EnElforg_SpawnSparkles(this, play, 16); if (this->secondaryTimer > 0) { this->secondaryTimer--; @@ -307,7 +307,7 @@ void EnElforg_TurnInFairy(EnElforg* this, GlobalContext* globalCtx) { } } -void EnElforg_QuicklyCircleFairyFountain(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_QuicklyCircleFairyFountain(EnElforg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnElforg_MoveToTargetFairyFountain(this, &this->actor.home.pos); if (this->secondaryTimer <= 30) { @@ -316,7 +316,7 @@ void EnElforg_QuicklyCircleFairyFountain(EnElforg* this, GlobalContext* globalCt this->secondaryTimer--; } -void EnElforg_FreeFloatingFairyFountain(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_FreeFloatingFairyFountain(EnElforg* this, PlayState* play) { s32 pad; if (this->flags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME) { @@ -348,7 +348,7 @@ void EnElforg_FreeFloatingFairyFountain(EnElforg* this, GlobalContext* globalCtx // This happens right before the Great Fairy appears once all // Stray Fairies are saved. if (this->actor.home.rot.x > 0) { - EnElforg_SpawnSparkles(this, globalCtx, 10); + EnElforg_SpawnSparkles(this, play, 10); this->actor.home.rot.x--; } Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); @@ -358,10 +358,10 @@ void EnElforg_FreeFloatingFairyFountain(EnElforg* this, GlobalContext* globalCtx } } -void EnElforg_CirclePlayer(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_CirclePlayer(EnElforg* this, PlayState* play) { s32 pad; - Actor* playerActor = &GET_PLAYER(globalCtx)->actor; - Player* player = GET_PLAYER(globalCtx); + Actor* playerActor = &GET_PLAYER(play)->actor; + Player* player = GET_PLAYER(play); f32 distanceFromPlayer; if (gSaveContext.save.playerForm == PLAYER_FORM_GORON) { @@ -372,11 +372,11 @@ void EnElforg_CirclePlayer(EnElforg* this, GlobalContext* globalCtx) { this->actor.world.pos.x = (Math_SinS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.x; this->actor.world.pos.z = (Math_CosS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.z; this->actor.world.pos.y = player->bodyPartsPos[0].y; - EnElforg_SpawnSparkles(this, globalCtx, 16); + EnElforg_SpawnSparkles(this, play, 16); } -void EnElforg_FairyCollected(EnElforg* this, GlobalContext* globalCtx) { - EnElforg_CirclePlayer(this, globalCtx); +void EnElforg_FairyCollected(EnElforg* this, PlayState* play) { + EnElforg_CirclePlayer(this, play); if (this->timer > 80) { Actor_MarkForDeath(&this->actor); return; @@ -384,9 +384,9 @@ void EnElforg_FairyCollected(EnElforg* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } -void EnElforg_SetupFairyCollected(EnElforg* this, GlobalContext* globalCtx) { - Actor* playerActor = &GET_PLAYER(globalCtx)->actor; - Player* player = GET_PLAYER(globalCtx); +void EnElforg_SetupFairyCollected(EnElforg* this, PlayState* play) { + Actor* playerActor = &GET_PLAYER(play)->actor; + Player* player = GET_PLAYER(play); this->actor.world.pos.x = playerActor->world.pos.x; this->actor.world.pos.y = player->bodyPartsPos[0].y; @@ -397,13 +397,13 @@ void EnElforg_SetupFairyCollected(EnElforg* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = 0.0f; } -void EnElforg_ClockTownFairyCollected(EnElforg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnElforg_ClockTownFairyCollected(EnElforg* this, PlayState* play) { + Player* player = GET_PLAYER(play); - EnElforg_CirclePlayer(this, globalCtx); + EnElforg_CirclePlayer(this, play); player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~0x20000000; Actor_MarkForDeath(&this->actor); @@ -421,13 +421,13 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, GlobalContext* globalCtx) } } -void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { Vec3f pos; f32 scaledYDistance; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (Player_GetMask(globalCtx) == PLAYER_MASK_GREAT_FAIRY) { + if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { pos = player->bodyPartsPos[0]; this->targetSpeedXZ = 5.0f; EnElforg_MoveToTarget(this, &pos); @@ -437,43 +437,43 @@ void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) { } scaledYDistance = this->actor.playerHeightRel - (this->actor.shape.yOffset * this->actor.scale.y); - if (!Player_InCsMode(&globalCtx->state)) { + if (!Player_InCsMode(&play->state)) { if ((this->actor.xzDistToPlayer < 30.0f) && (scaledYDistance < 12.0f) && (scaledYDistance > -68.0f)) { - EnElforg_SetupFairyCollected(this, globalCtx); - func_80115908(globalCtx, 48); + EnElforg_SetupFairyCollected(this, play); + func_80115908(play, 48); switch (STRAY_FAIRY_TYPE(&this->actor)) { case STRAY_FAIRY_TYPE_COLLECTIBLE: - Flags_SetCollectible(globalCtx, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetCollectible(play, STRAY_FAIRY_FLAG(&this->actor)); break; case STRAY_FAIRY_TYPE_CHEST: - Flags_SetTreasure(globalCtx, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetTreasure(play, STRAY_FAIRY_FLAG(&this->actor)); break; default: - Flags_SetSwitch(globalCtx, STRAY_FAIRY_FLAG(&this->actor)); + Flags_SetSwitch(play, STRAY_FAIRY_FLAG(&this->actor)); break; } if (STRAY_FAIRY_TYPE(&this->actor) == STRAY_FAIRY_TYPE_CLOCK_TOWN) { player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; - Message_StartTextbox(globalCtx, 0x579, NULL); + Message_StartTextbox(play, 0x579, NULL); this->actionFunc = EnElforg_ClockTownFairyCollected; ActorCutscene_SetIntentToPlay(0x7C); return; } - if (func_8010A074(globalCtx)) { + if (func_8010A074(play)) { gSaveContext.save.inventory.strayFairies[gSaveContext.unk_48C8]++; - Message_StartTextbox(globalCtx, 0x11, NULL); + Message_StartTextbox(play, 0x11, NULL); if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.unk_48C8] >= 15) { func_801A3098(NA_BGM_GET_ITEM | 0x900); } } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 7); - func_80ACCBB8(this, globalCtx); - if (Player_GetMask(globalCtx) == PLAYER_MASK_GREAT_FAIRY) { + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 7); + func_80ACCBB8(this, play); + if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { if (!(this->flags & STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED)) { play_sound(NA_SE_SY_FAIRY_MASK_SUCCESS); } @@ -490,10 +490,10 @@ void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) { * works if the enemy and the Stray Fairy have the exact same home * coordinates when the Stray Fairy first spawns. */ -Actor* EnElforg_GetHoldingEnemy(EnElforg* this, GlobalContext* globalCtx) { +Actor* EnElforg_GetHoldingEnemy(EnElforg* this, PlayState* play) { Actor* enemy; - for (enemy = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; enemy != NULL; enemy = enemy->next) { + for (enemy = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; enemy != NULL; enemy = enemy->next) { if ((enemy->home.pos.x == this->actor.home.pos.x) && (enemy->home.pos.y == this->actor.home.pos.y) && (enemy->home.pos.z == this->actor.home.pos.z)) { return enemy; @@ -502,7 +502,7 @@ Actor* EnElforg_GetHoldingEnemy(EnElforg* this, GlobalContext* globalCtx) { return NULL; } -void EnElforg_TrappedByEnemy(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_TrappedByEnemy(EnElforg* this, PlayState* play) { f32 posTemp; if (this->enemy->update == NULL) { @@ -523,11 +523,11 @@ void EnElforg_TrappedByEnemy(EnElforg* this, GlobalContext* globalCtx) { this->actor.world.pos.z = posTemp; this->actor.home.pos.z = posTemp; } - func_80ACCBB8(this, globalCtx); + func_80ACCBB8(this, play); } -void EnElforg_SetupTrappedByEnemy(EnElforg* this, GlobalContext* globalCtx) { - Actor* enemy = EnElforg_GetHoldingEnemy(this, globalCtx); +void EnElforg_SetupTrappedByEnemy(EnElforg* this, PlayState* play) { + Actor* enemy = EnElforg_GetHoldingEnemy(this, play); if (enemy != NULL && enemy->update != NULL) { this->actionFunc = EnElforg_TrappedByEnemy; @@ -535,7 +535,7 @@ void EnElforg_SetupTrappedByEnemy(EnElforg* this, GlobalContext* globalCtx) { } } -void EnElforg_HiddenByCollider(EnElforg* this, GlobalContext* globalCtx) { +void EnElforg_HiddenByCollider(EnElforg* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloating; @@ -544,15 +544,15 @@ void EnElforg_HiddenByCollider(EnElforg* this, GlobalContext* globalCtx) { this->actor.home.pos.y += 40.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHIBI_FAIRY_SAVED); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - func_80ACCBB8(this, globalCtx); + func_80ACCBB8(this, play); } -void EnElforg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnElforg_Update(Actor* thisx, PlayState* play) { EnElforg* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->timer == 0 && this->secondaryTimer > 0) { this->secondaryTimer--; @@ -572,8 +572,8 @@ void EnElforg_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnElforg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnElforg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { EnElforg* this = THIS; if (this->direction < 0) { @@ -587,35 +587,35 @@ s32 EnElforg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnElforg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnElforg_Draw(Actor* thisx, PlayState* play) { s32 pad; EnElforg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); switch (this->area) { case STRAY_FAIRY_AREA_WOODFALL: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyWoodfallTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyWoodfallTexAnim)); break; case STRAY_FAIRY_AREA_SNOWHEAD: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairySnowheadTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairySnowheadTexAnim)); break; case STRAY_FAIRY_AREA_GREAT_BAY: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyGreatBayTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyGreatBayTexAnim)); break; case STRAY_FAIRY_AREA_STONE_TOWER: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyStoneTowerTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyStoneTowerTexAnim)); break; default: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyClockTownTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyClockTownTexAnim)); break; } - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); 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, EnElforg_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h index fbf982beb4..5e46e75818 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h @@ -49,7 +49,7 @@ typedef enum { struct EnElforg; -typedef void (*EnElforgActionFunc)(struct EnElforg*, GlobalContext*); +typedef void (*EnElforgActionFunc)(struct EnElforg*, PlayState*); typedef struct EnElforg { /* 0x000 */ 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 b9a1860571..8e68f92058 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -10,10 +10,10 @@ #define THIS ((EnEncount1*)thisx) -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 func_808E0954(EnEncount1* this, GlobalContext* globalCtx); +void func_808E0954(EnEncount1* this, PlayState* play); #if 0 const ActorInit En_Encount1_InitVars = { 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 3cf01bd8a8..f9e1e9647e 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -5,7 +5,7 @@ struct EnEncount1; -typedef void (*EnEncount1ActionFunc)(struct EnEncount1*, GlobalContext*); +typedef void (*EnEncount1ActionFunc)(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 62d33b0eaf..7887c43784 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -12,18 +12,18 @@ #define THIS ((EnEncount2*)thisx) -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount2_Destroy(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_Destroy(Actor* thisx, PlayState* play); +void EnEncount2_Update(Actor* thisx, PlayState* play); +void EnEncount2_Draw(Actor* thisx, PlayState* play); -void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_Die(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_Idle(EnEncount2* this, PlayState* play); +void EnEncount2_Popped(EnEncount2* this, PlayState* play); +void EnEncount2_Die(EnEncount2* this, PlayState* play); void EnEncount2_SetIdle(EnEncount2* this); void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay); -void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_DrawEffects(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play); +void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play); const ActorInit En_Encount2_InitVars = { ACTOR_EN_ENCOUNT2, @@ -99,17 +99,17 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0xF), }; -void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Init(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; s32 pad; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_fusen_Colheader_002420, &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, ActorShadow_DrawCircle, 25.0f); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colElement); + Collider_InitAndSetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colElement); this->dyna.actor.targetMode = 6; this->dyna.actor.colChkInfo.health = 1; @@ -120,7 +120,7 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -135,10 +135,10 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { EnEncount2_SetIdle(this); } -void EnEncount2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Destroy(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; - 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 EnEncount2_SetIdle(EnEncount2* this) { @@ -146,7 +146,7 @@ void EnEncount2_SetIdle(EnEncount2* this) { this->actionFunc = EnEncount2_Idle; } -void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_Idle(EnEncount2* this, PlayState* play) { this->oscillationAngle += 1500.0f; this->dyna.actor.velocity.y = Math_SinS(this->oscillationAngle); Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f); @@ -157,13 +157,13 @@ void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_Popped(EnEncount2* this, PlayState* play) { s32 i; Vec3f curPos; Math_Vec3f_Copy(&curPos, &this->dyna.actor.world.pos); curPos.y += 60.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, curPos.x, curPos.y, curPos.z, 255, 255, 200, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, curPos.x, curPos.y, curPos.z, 255, 255, 200, CLEAR_TAG_LARGE_EXPLOSION); for (i = 0; i < ARRAY_COUNT(this->effects) / 2; ++i) { @@ -175,16 +175,16 @@ void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx) { this->actionFunc = EnEncount2_Die; } -void EnEncount2_Die(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_Die(EnEncount2* this, PlayState* play) { if (this->deathTimer == 0) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } Actor_MarkForDeath(&this->dyna.actor); } } -void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Update(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; s32 pad; @@ -193,24 +193,24 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; Actor_SetFocus(&this->dyna.actor, 30.0f); Actor_SetScale(&this->dyna.actor, this->scale); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->dyna.actor); - EnEncount2_UpdateEffects(this, globalCtx); + EnEncount2_UpdateEffects(this, play); if (!this->isPopped) { Collider_UpdateSpheresElement(&this->collider, 0, &this->dyna.actor); - 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 EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEncount2_Draw(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; if (this->isPopped != true) { - Gfx_DrawDListOpa(globalCtx, object_fusen_DL_000A00); - Gfx_DrawDListOpa(globalCtx, object_fusen_DL_000D78); + Gfx_DrawDListOpa(play, object_fusen_DL_000A00); + Gfx_DrawDListOpa(play, object_fusen_DL_000D78); } - EnEncount2_DrawEffects(this, globalCtx); + EnEncount2_DrawEffects(this, play); } void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { @@ -238,7 +238,7 @@ void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { } } -void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { s32 i; EnEncount2Effect* sPtr = this->effects; @@ -263,15 +263,15 @@ void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { } } -void EnEncount2_DrawEffects(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play) { s16 i; EnEncount2Effect* sPtr; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); sPtr = this->effects; func_8012C28C(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { if (sPtr->isEnabled) { Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); @@ -282,10 +282,9 @@ void EnEncount2_DrawEffects(EnEncount2* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGTORAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZF(DEGTORAD(play->state.frames * 20.0f), MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07AB58); } } 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 a95c1e014c..8f2a6c66a0 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -5,7 +5,7 @@ struct EnEncount2; -typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*); +typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, PlayState*); typedef struct EnEncount2Effect{ /* 0x00 */ u8 isEnabled; diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c index b9681b5e18..ead07b294c 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c @@ -10,14 +10,14 @@ #define THIS ((EnEncount3*)thisx) -void EnEncount3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEncount3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEncount3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEncount3_Init(Actor* thisx, PlayState* play); +void EnEncount3_Destroy(Actor* thisx, PlayState* play); +void EnEncount3_Update(Actor* thisx, PlayState* play); +void EnEncount3_Draw(Actor* thisx, PlayState* play); -void func_809AD084(EnEncount3* this, GlobalContext* globalCtx); -void func_809AD194(EnEncount3* this, GlobalContext* globalCtx); -void func_809AD1EC(EnEncount3* this, GlobalContext* globalCtx); +void func_809AD084(EnEncount3* this, PlayState* play); +void func_809AD194(EnEncount3* this, PlayState* play); +void func_809AD1EC(EnEncount3* this, PlayState* play); #if 0 const ActorInit En_Encount3_InitVars = { diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h index dbfe780527..81391df304 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.h @@ -5,7 +5,7 @@ struct EnEncount3; -typedef void (*EnEncount3ActionFunc)(struct EnEncount3*, GlobalContext*); +typedef void (*EnEncount3ActionFunc)(struct EnEncount3*, PlayState*); typedef struct EnEncount3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c index eaadd81333..a244d6d0af 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c @@ -10,15 +10,15 @@ #define THIS ((EnEncount4*)thisx) -void EnEncount4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEncount4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEncount4_Update(Actor* thisx, GlobalContext* globalCtx); +void EnEncount4_Init(Actor* thisx, PlayState* play); +void EnEncount4_Destroy(Actor* thisx, PlayState* play); +void EnEncount4_Update(Actor* thisx, PlayState* play); -void func_809C3FD8(EnEncount4* this, GlobalContext* globalCtx); -void func_809C4078(EnEncount4* this, GlobalContext* globalCtx); -void func_809C42A8(EnEncount4* this, GlobalContext* globalCtx); -void func_809C4598(EnEncount4* this, GlobalContext* globalCtx); -void func_809C464C(EnEncount4* this, GlobalContext* globalCtx); +void func_809C3FD8(EnEncount4* this, PlayState* play); +void func_809C4078(EnEncount4* this, PlayState* play); +void func_809C42A8(EnEncount4* this, PlayState* play); +void func_809C4598(EnEncount4* this, PlayState* play); +void func_809C464C(EnEncount4* this, PlayState* play); #if 0 const ActorInit En_Encount4_InitVars = { diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h index 891d580a81..a2b50e085c 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h @@ -5,7 +5,7 @@ struct EnEncount4; -typedef void (*EnEncount4ActionFunc)(struct EnEncount4*, GlobalContext*); +typedef void (*EnEncount4ActionFunc)(struct EnEncount4*, PlayState*); typedef struct EnEncount4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index b366a4dec4..946c19c99a 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -11,13 +11,13 @@ #define THIS ((EnEndingHero*)thisx) -void EnEndingHero_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero_Init(Actor* thisx, PlayState* play); +void EnEndingHero_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero_Update(Actor* thisx, PlayState* play); +void EnEndingHero_Draw(Actor* thisx, PlayState* play); void func_80C1E748(EnEndingHero* this); -void func_80C1E764(EnEndingHero* this, GlobalContext* globalCtx); +void func_80C1E764(EnEndingHero* this, PlayState* play); const ActorInit En_Ending_Hero_InitVars = { ACTOR_EN_ENDING_HERO, @@ -31,20 +31,20 @@ const ActorInit En_Ending_Hero_InitVars = { (ActorFunc)EnEndingHero_Draw, }; -void EnEndingHero_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero_Init(Actor* thisx, PlayState* play) { EnEndingHero* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dt_Skel_00B0CC, &object_dt_Anim_000BE0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dt_Skel_00B0CC, &object_dt_Anim_000BE0, this->jointTable, this->morphTable, 15); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); func_80C1E748(this); } -void EnEndingHero_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero_Destroy(Actor* thisx, PlayState* play) { } void func_80C1E748(EnEndingHero* this) { @@ -52,11 +52,11 @@ void func_80C1E748(EnEndingHero* this) { this->actionFunc = func_80C1E764; } -void func_80C1E764(EnEndingHero* this, GlobalContext* globalCtx) { +void func_80C1E764(EnEndingHero* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero_Update(Actor* thisx, PlayState* play) { EnEndingHero* this = THIS; if (this->unk240 == 0) { @@ -66,9 +66,9 @@ void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk240 = (s16)Rand_ZeroFloat(60.0f) + 0x14; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } static TexturePtr D_80C1E970[] = { @@ -80,13 +80,13 @@ static TexturePtr D_80C1E984[] = { object_dt_Tex_00A490, }; -void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero_Draw(Actor* thisx, PlayState* play) { EnEndingHero* this = THIS; s32 index = 0; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1E970[this->unk242])); @@ -95,8 +95,8 @@ void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx) { } gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1E984[index])); - 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); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h index 95991fee80..098f2ffe06 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h @@ -5,7 +5,7 @@ struct EnEndingHero; -typedef void (*EnEndingHeroActionFunc)(struct EnEndingHero*, GlobalContext*); +typedef void (*EnEndingHeroActionFunc)(struct EnEndingHero*, PlayState*); typedef struct EnEndingHero { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c index f3515787c9..f33c9d6826 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c +++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c @@ -11,13 +11,13 @@ #define THIS ((EnEndingHero2*)thisx) -void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero2_Init(Actor* thisx, PlayState* play); +void EnEndingHero2_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero2_Update(Actor* thisx, PlayState* play); +void EnEndingHero2_Draw(Actor* thisx, PlayState* play); void func_80C232E8(EnEndingHero2* this); -void func_80C23304(EnEndingHero2* this, GlobalContext* globalCtx); +void func_80C23304(EnEndingHero2* this, PlayState* play); const ActorInit En_Ending_Hero2_InitVars = { ACTOR_EN_ENDING_HERO2, @@ -31,20 +31,20 @@ const ActorInit En_Ending_Hero2_InitVars = { (ActorFunc)EnEndingHero2_Draw, }; -void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero2_Init(Actor* thisx, PlayState* play) { EnEndingHero2* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, this->morphTable, 20); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); func_80C232E8(this); } -void EnEndingHero2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero2_Destroy(Actor* thisx, PlayState* play) { } void func_80C232E8(EnEndingHero2* this) { @@ -52,23 +52,23 @@ void func_80C232E8(EnEndingHero2* this) { this->actionFunc = func_80C23304; } -void func_80C23304(EnEndingHero2* this, GlobalContext* globalCtx) { +void func_80C23304(EnEndingHero2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero2_Update(Actor* thisx, PlayState* play) { EnEndingHero2* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -void EnEndingHero2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero2_Draw(Actor* thisx, PlayState* play) { EnEndingHero2* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(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_Ending_Hero2/z_en_ending_hero2.h b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h index fe7e6bf2e4..80ee813fa0 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h +++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.h @@ -5,7 +5,7 @@ struct EnEndingHero2; -typedef void (*EnEndingHero2ActionFunc)(struct EnEndingHero2*, GlobalContext*); +typedef void (*EnEndingHero2ActionFunc)(struct EnEndingHero2*, PlayState*); typedef struct EnEndingHero2 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c index 91c44e7415..6cd6de0f9a 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c @@ -11,13 +11,13 @@ #define THIS ((EnEndingHero3*)thisx) -void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero3_Init(Actor* thisx, PlayState* play); +void EnEndingHero3_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero3_Update(Actor* thisx, PlayState* play); +void EnEndingHero3_Draw(Actor* thisx, PlayState* play); void func_80C23518(EnEndingHero3* this); -void func_80C23534(EnEndingHero3* this, GlobalContext* globalCtx); +void func_80C23534(EnEndingHero3* this, PlayState* play); const ActorInit En_Ending_Hero3_InitVars = { ACTOR_EN_ENDING_HERO3, @@ -31,20 +31,20 @@ const ActorInit En_Ending_Hero3_InitVars = { (ActorFunc)EnEndingHero3_Draw, }; -void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero3_Init(Actor* thisx, PlayState* play) { EnEndingHero3* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, - this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable, + this->morphTable, 17); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); func_80C23518(this); } -void EnEndingHero3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero3_Destroy(Actor* thisx, PlayState* play) { } void func_80C23518(EnEndingHero3* this) { @@ -52,23 +52,23 @@ void func_80C23518(EnEndingHero3* this) { this->actionFunc = func_80C23534; } -void func_80C23534(EnEndingHero3* this, GlobalContext* globalCtx) { +void func_80C23534(EnEndingHero3* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero3_Update(Actor* thisx, PlayState* play) { EnEndingHero3* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -void EnEndingHero3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero3_Draw(Actor* thisx, PlayState* play) { EnEndingHero3* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(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_Ending_Hero3/z_en_ending_hero3.h b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h index b61452d773..2a30f1d9c3 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.h @@ -5,7 +5,7 @@ struct EnEndingHero3; -typedef void (*EnEndingHero3ActionFunc)(struct EnEndingHero3*, GlobalContext*); +typedef void (*EnEndingHero3ActionFunc)(struct EnEndingHero3*, PlayState*); typedef struct EnEndingHero3 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c index 1e54ee8b92..9a58673d05 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c @@ -11,13 +11,13 @@ #define THIS ((EnEndingHero4*)thisx) -void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero4_Init(Actor* thisx, PlayState* play); +void EnEndingHero4_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero4_Update(Actor* thisx, PlayState* play); +void EnEndingHero4_Draw(Actor* thisx, PlayState* play); void func_80C23748(EnEndingHero4* this); -void func_80C23764(EnEndingHero4* this, GlobalContext* globalCtx); +void func_80C23764(EnEndingHero4* this, PlayState* play); const ActorInit En_Ending_Hero4_InitVars = { ACTOR_EN_ENDING_HERO4, @@ -31,20 +31,20 @@ const ActorInit En_Ending_Hero4_InitVars = { (ActorFunc)EnEndingHero4_Draw, }; -void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero4_Init(Actor* thisx, PlayState* play) { EnEndingHero4* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierCheerWithSpear, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierCheerWithSpear, this->jointTable, this->morphTable, 17); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); func_80C23748(this); } -void EnEndingHero4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero4_Destroy(Actor* thisx, PlayState* play) { } void func_80C23748(EnEndingHero4* this) { @@ -52,23 +52,23 @@ void func_80C23748(EnEndingHero4* this) { this->actionFunc = func_80C23764; } -void func_80C23764(EnEndingHero4* this, GlobalContext* globalCtx) { +void func_80C23764(EnEndingHero4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero4_Update(Actor* thisx, PlayState* play) { EnEndingHero4* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -void EnEndingHero4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero4_Draw(Actor* thisx, PlayState* play) { EnEndingHero4* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(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_Ending_Hero4/z_en_ending_hero4.h b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h index 09e3a72ee0..2f050f2df4 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.h @@ -5,7 +5,7 @@ struct EnEndingHero4; -typedef void (*EnEndingHero4ActionFunc)(struct EnEndingHero4*, GlobalContext*); +typedef void (*EnEndingHero4ActionFunc)(struct EnEndingHero4*, PlayState*); typedef struct EnEndingHero4 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c index 23ac531f3f..4d87fe0ede 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c @@ -11,13 +11,13 @@ #define THIS ((EnEndingHero5*)thisx) -void EnEndingHero5_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero5_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero5_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero5_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero5_Init(Actor* thisx, PlayState* play); +void EnEndingHero5_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero5_Update(Actor* thisx, PlayState* play); +void EnEndingHero5_Draw(Actor* thisx, PlayState* play); void func_80C23980(EnEndingHero5* this); -void func_80C2399C(EnEndingHero5* this, GlobalContext* globalCtx); +void func_80C2399C(EnEndingHero5* this, PlayState* play); const ActorInit En_Ending_Hero5_InitVars = { ACTOR_EN_ENDING_HERO5, @@ -31,21 +31,21 @@ const ActorInit En_Ending_Hero5_InitVars = { (ActorFunc)EnEndingHero5_Draw, }; -void EnEndingHero5_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero5_Init(Actor* thisx, PlayState* play) { EnEndingHero5* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, - this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_daiku_Skel_00A850, &object_daiku_Anim_002FA0, this->jointTable, + this->morphTable, 17); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); this->unk25C = this->actor.params; func_80C23980(this); } -void EnEndingHero5_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero5_Destroy(Actor* thisx, PlayState* play) { } void func_80C23980(EnEndingHero5* this) { @@ -53,39 +53,39 @@ void func_80C23980(EnEndingHero5* this) { this->actionFunc = func_80C2399C; } -void func_80C2399C(EnEndingHero5* this, GlobalContext* globalCtx) { +void func_80C2399C(EnEndingHero5* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero5_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero5_Update(Actor* thisx, PlayState* play) { EnEndingHero5* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } Gfx* D_80C23BF0[] = { object_daiku_DL_0070C0, object_daiku_DL_006FB0, object_daiku_DL_006E80, object_daiku_DL_006D70, object_daiku_DL_00A390 }; -void EnEndingHero5_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnEndingHero5_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnEndingHero5* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 15) { gSPDisplayList(POLY_OPA_DISP++, D_80C23BF0[this->unk25C]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnEndingHero5_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero5_Draw(Actor* thisx, PlayState* play) { EnEndingHero5* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (this->unk25C) { case 0: @@ -105,8 +105,8 @@ void EnEndingHero5_Draw(Actor* thisx, GlobalContext* globalCtx) { break; } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnEndingHero5_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnEndingHero5_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h index e9f3ecf186..4b26b03dbf 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.h @@ -5,7 +5,7 @@ struct EnEndingHero5; -typedef void (*EnEndingHero5ActionFunc)(struct EnEndingHero5*, GlobalContext*); +typedef void (*EnEndingHero5ActionFunc)(struct EnEndingHero5*, PlayState*); typedef struct EnEndingHero5 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index 82df507c2a..95e9c362be 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -15,14 +15,14 @@ #define THIS ((EnEndingHero6*)thisx) -void EnEndingHero6_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero6_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero6_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEndingHero6_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEndingHero6_Init(Actor* thisx, PlayState* play); +void EnEndingHero6_Destroy(Actor* thisx, PlayState* play); +void EnEndingHero6_Update(Actor* thisx, PlayState* play); +void EnEndingHero6_Draw(Actor* thisx, PlayState* play); void EnEndingHero6_InitSkelAnime(EnEndingHero6* this, s32 npcIndex); void EnEndingHero6_SetupIdle(EnEndingHero6* this); -void EnEndingHero6_Idle(EnEndingHero6* this, GlobalContext* globalCtx); +void EnEndingHero6_Idle(EnEndingHero6* this, PlayState* play); const ActorInit En_Ending_Hero6_InitVars = { ACTOR_EN_ENDING_HERO6, @@ -50,20 +50,20 @@ static AnimationHeader* sAnimations[] = { static s32 sLimbCounts[] = { 15, 20, 17, 17, 17, 17, 17, 17, 17 }; -void EnEndingHero6_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero6_Init(Actor* thisx, PlayState* play) { EnEndingHero6* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, sSkeletons[this->npcIndex], sAnimations[this->npcIndex], + SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->npcIndex], sAnimations[this->npcIndex], this->jointTable, this->morphTable, sLimbCounts[this->npcIndex]); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); EnEndingHero6_SetupIdle(this); } -void EnEndingHero6_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero6_Destroy(Actor* thisx, PlayState* play) { } void EnEndingHero6_InitSkelAnime(EnEndingHero6* this, s32 npcIndex) { @@ -78,11 +78,11 @@ void EnEndingHero6_SetupIdle(EnEndingHero6* this) { this->actionFunc = EnEndingHero6_Idle; } -void EnEndingHero6_Idle(EnEndingHero6* this, GlobalContext* globalCtx) { +void EnEndingHero6_Idle(EnEndingHero6* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnEndingHero6_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero6_Update(Actor* thisx, PlayState* play) { EnEndingHero6* this = THIS; if (this->timer != 0) { @@ -99,28 +99,28 @@ void EnEndingHero6_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -void EnEndingHero6_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnEndingHero6_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Gfx* D_80C2426C[] = { object_daiku_DL_0070C0, object_daiku_DL_006FB0, object_daiku_DL_006E80, object_daiku_DL_006D70, object_daiku_DL_00A390 }; EnEndingHero6* this = THIS; s32 index; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->npcIndex >= 4 && limbIndex == 15) { index = this->npcIndex - 4; gSPDisplayList(POLY_OPA_DISP++, D_80C2426C[index]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnEndingHero6_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80C24280[] = { object_dt_Tex_007350, object_dt_Tex_009590, object_dt_Tex_009F90, object_dt_Tex_00A790, object_dt_Tex_00AB90 }; static TexturePtr D_80C24294[] = { object_dt_Tex_007750, object_dt_Tex_00A390, object_dt_Tex_00A490 }; @@ -129,13 +129,13 @@ void EnEndingHero6_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 index = 0; if (this->isIdle == 1) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - if (this->objectIndex >= 0 && Object_IsLoaded(&globalCtx->objectCtx, this->objectIndex)) { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->objectIndex].segment); + if (this->objectIndex >= 0 && Object_IsLoaded(&play->objectCtx, this->objectIndex)) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectIndex].segment); switch (this->npcIndex) { case 4: @@ -165,10 +165,10 @@ void EnEndingHero6_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C24294[index])); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnEndingHero6_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h index 4f8989634f..6f00783d5d 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.h @@ -5,7 +5,7 @@ struct EnEndingHero6; -typedef void (*EnEndingHero6ActionFunc)(struct EnEndingHero6*, GlobalContext*); +typedef void (*EnEndingHero6ActionFunc)(struct EnEndingHero6*, PlayState*); typedef struct EnEndingHero6 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c index b1ac6673aa..006166e4bc 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -10,13 +10,13 @@ #define THIS ((EnEstone*)thisx) -void EnEstone_Init(Actor* thisx, GlobalContext* globalCtx); -void EnEstone_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnEstone_Update(Actor* thisx, GlobalContext* globalCtx); -void EnEstone_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnEstone_Init(Actor* thisx, PlayState* play); +void EnEstone_Destroy(Actor* thisx, PlayState* play); +void EnEstone_Update(Actor* thisx, PlayState* play); +void EnEstone_Draw(Actor* thisx, PlayState* play); -void func_80A9A1DC(EnEstone* this, GlobalContext* globalCtx); -void func_80A9A4B0(EnEstone* this, GlobalContext* globalCtx); +void func_80A9A1DC(EnEstone* this, PlayState* play); +void func_80A9A4B0(EnEstone* this, PlayState* play); #if 0 const ActorInit En_Estone_InitVars = { diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.h b/src/overlays/actors/ovl_En_Estone/z_en_estone.h index 848d41f8b7..b265bf4de8 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.h +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.h @@ -5,7 +5,7 @@ struct EnEstone; -typedef void (*EnEstoneActionFunc)(struct EnEstone*, GlobalContext*); +typedef void (*EnEstoneActionFunc)(struct EnEstone*, PlayState*); typedef struct EnEstone { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index d426b7c595..9f07dc3394 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -28,28 +28,28 @@ #define FLAG_FIRE_BALL_INTENSIFIES (1 << 0) #define FLAG_FIRE_RING_APPEARS (1 << 1) -void EnFall_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFall_Update(Actor* thisx, GlobalContext* globalCtx); +void EnFall_Init(Actor* thisx, PlayState* play); +void EnFall_Destroy(Actor* thisx, PlayState* play); +void EnFall_Update(Actor* thisx, PlayState* play); -void EnFall_Setup(EnFall* this, GlobalContext* globalCtx); -void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx); -void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx); -void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx); -void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx); -void EnFall_Moon_PerformDefaultActions(EnFall* this, GlobalContext* globalCtx); -void EnFall_MoonsTear_Fall(EnFall* this, GlobalContext* globalCtx); -void EnFall_Fireball_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFall_RisingDebris_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFall_FireRing_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFall_Moon_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFall_OpenMouthMoon_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFall_LodMoon_DrawWithoutLerp(Actor* thisx, GlobalContext* globalCtx); -void EnFall_LodMoon_DrawWithLerp(Actor* thisx, GlobalContext* globalCtx); -void EnFall_Fireball_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFall_RisingDebris_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFall_FireRing_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnFall_MoonsTear_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFall_Setup(EnFall* this, PlayState* play); +void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, PlayState* play); +void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play); +void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play); +void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play); +void EnFall_Moon_PerformDefaultActions(EnFall* this, PlayState* play); +void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play); +void EnFall_Fireball_Update(Actor* thisx, PlayState* play); +void EnFall_RisingDebris_Update(Actor* thisx, PlayState* play); +void EnFall_FireRing_Update(Actor* thisx, PlayState* play); +void EnFall_Moon_Draw(Actor* thisx, PlayState* play); +void EnFall_OpenMouthMoon_Draw(Actor* thisx, PlayState* play); +void EnFall_LodMoon_DrawWithoutLerp(Actor* thisx, PlayState* play); +void EnFall_LodMoon_DrawWithLerp(Actor* thisx, PlayState* play); +void EnFall_Fireball_Draw(Actor* thisx, PlayState* play); +void EnFall_RisingDebris_Draw(Actor* thisx, PlayState* play); +void EnFall_FireRing_Draw(Actor* thisx, PlayState* play); +void EnFall_MoonsTear_Draw(Actor* thisx, PlayState* play); typedef struct { u8 modelIndex; @@ -78,7 +78,7 @@ const ActorInit En_Fall_InitVars = { * Sets the scale of the moon depending on the current day. On the Final Day, * it also moves the moon closer to the ground depending on the current time. */ -void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, GlobalContext* globalCtx) { +void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, PlayState* play) { u16 currentTime = gSaveContext.save.time; u16 dayStartTime = this->dayStartTime; f32 finalDayRelativeHeight; @@ -126,7 +126,7 @@ void EnFall_RisingDebris_ResetEffects(EnFall* this) { this->activeDebrisEffectCount = 0; } -void EnFall_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Init(Actor* thisx, PlayState* play) { EnFall* this = THIS; s32 objectIndex; @@ -161,19 +161,19 @@ void EnFall_Init(Actor* thisx, GlobalContext* globalCtx) { case EN_FALL_TYPE_LODMOON_NO_LERP: case EN_FALL_TYPE_LODMOON: case EN_FALL_TYPE_LODMOON_INVERTED_STONE_TOWER: - objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_LODMOON); + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LODMOON); break; case EN_FALL_TYPE_MOONS_TEAR: - objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MOONSTON); + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_MOONSTON); break; case EN_FALL_TYPE_STOPPED_MOON_OPEN_MOUTH: - objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FALL2); + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_FALL2); break; default: - objectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_FALL); + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_FALL); break; } @@ -185,14 +185,14 @@ void EnFall_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnFall_Setup; } -void EnFall_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Destroy(Actor* thisx, PlayState* play) { } /** * Finds the Termina Field moon so the Moon's Tear can spawn in the correct place. */ -Actor* EnFall_MoonsTear_GetTerminaFieldMoon(GlobalContext* globalCtx) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +Actor* EnFall_MoonsTear_GetTerminaFieldMoon(PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (itemAction != NULL) { if (itemAction->id == ACTOR_EN_FALL && EN_FALL_TYPE(itemAction) == EN_FALL_TYPE_TERMINA_FIELD_MOON) { @@ -203,10 +203,10 @@ Actor* EnFall_MoonsTear_GetTerminaFieldMoon(GlobalContext* globalCtx) { return NULL; } -void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { +void EnFall_Setup(EnFall* this, PlayState* play) { Actor* moon; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->actor.objBankIndex = this->objIndex; this->actionFunc = EnFall_Moon_PerformDefaultActions; switch (EN_FALL_TYPE(&this->actor)) { @@ -263,7 +263,7 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.draw = EnFall_LodMoon_DrawWithoutLerp; this->dayStartTime = CLOCK_TIME(6, 0); this->currentDay = CURRENT_DAY; - EnFall_Moon_AdjustScaleAndPosition(this, globalCtx); + EnFall_Moon_AdjustScaleAndPosition(this, play); break; case EN_FALL_TYPE_LODMOON: @@ -271,7 +271,7 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.draw = EnFall_LodMoon_DrawWithLerp; this->dayStartTime = CLOCK_TIME(6, 0); this->currentDay = CURRENT_DAY; - EnFall_Moon_AdjustScaleAndPosition(this, globalCtx); + EnFall_Moon_AdjustScaleAndPosition(this, play); break; case EN_FALL_TYPE_MOONS_TEAR: @@ -279,10 +279,10 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.draw = NULL; this->actionFunc = EnFall_MoonsTear_Fall; Actor_SetScale(&this->actor, 0.02f); - if (!(globalCtx->actorCtx.unk5 & 2)) { + if (!(play->actorCtx.unk5 & 2)) { Actor_MarkForDeath(&this->actor); } - moon = EnFall_MoonsTear_GetTerminaFieldMoon(globalCtx); + moon = EnFall_MoonsTear_GetTerminaFieldMoon(play); this->actor.child = moon; if (moon == NULL) { Actor_MarkForDeath(&this->actor); @@ -306,20 +306,19 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.draw = EnFall_Moon_Draw; this->dayStartTime = CLOCK_TIME(6, 0); this->currentDay = CURRENT_DAY; - EnFall_Moon_AdjustScaleAndPosition(this, globalCtx); + EnFall_Moon_AdjustScaleAndPosition(this, play); break; } } } -void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, GlobalContext* globalCtx) { +void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { static s32 sGiantsCutsceneState = 0; - if (globalCtx->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 1 && - globalCtx->csCtx.currentCsIndex == 0) { + if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 1 && play->csCtx.currentCsIndex == 0) { switch (sGiantsCutsceneState) { case 0: - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { sGiantsCutsceneState += 2; } break; @@ -341,34 +340,34 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, GlobalContext* globa } else { ActorCutscene_SetIntentToPlay(0xB); } - } else if (globalCtx->csCtx.frames > 1600) { - globalCtx->nextEntranceIndex = 0x2C00; + } else if (play->csCtx.frames > 1600) { + play->nextEntranceIndex = 0x2C00; gSaveContext.nextCutsceneIndex = 0xFFF2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 2; gSaveContext.nextTransition = 2; sGiantsCutsceneState = 9; } break; case 9: - globalCtx->csCtx.frames--; + play->csCtx.frames--; break; } } } -void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx) { - EnFall_CrashingMoon_HandleGiantsCutscene(this, globalCtx); - if (Cutscene_CheckActorAction(globalCtx, 0x85)) { - if (Cutscene_CheckActorAction(globalCtx, 133) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action == 1) { +void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { + EnFall_CrashingMoon_HandleGiantsCutscene(this, play); + if (Cutscene_CheckActorAction(play, 0x85)) { + if (Cutscene_CheckActorAction(play, 133) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 1) { this->actor.draw = NULL; } else { this->actor.draw = EnFall_Moon_Draw; - if (Cutscene_CheckActorAction(globalCtx, 133) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action == 2) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 133)); + if (Cutscene_CheckActorAction(play, 133) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 2) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); } } } else { @@ -376,9 +375,9 @@ void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, GlobalContext* glo } } -void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 133)) { - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action) { +void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 133)) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action) { case 3: if (this->eyeGlowIntensity == 0.0f) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MOON_EYE_FLASH); @@ -396,11 +395,11 @@ void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, GlobalCont } } -void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 133)) { - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action) { +void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 133)) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action) { case 2: - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 133)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); break; case 4: @@ -409,10 +408,10 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalCo } } - if (globalCtx->sceneNum == SCENE_OKUJOU && gSaveContext.sceneSetupIndex == 2) { - switch (globalCtx->csCtx.currentCsIndex) { + if (play->sceneNum == SCENE_OKUJOU && gSaveContext.sceneSetupIndex == 2) { + switch (play->csCtx.currentCsIndex) { case 0: - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 1060: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MOON_SCREAM1); break; @@ -425,13 +424,13 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalCo Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIP_MOON); break; } - if (globalCtx->csCtx.frames >= 1145) { + if (play->csCtx.frames >= 1145) { func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; case 1: - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 561: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MOON_SCREAM1); break; @@ -444,7 +443,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalCo Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIP_MOON); break; } - if (globalCtx->csCtx.frames >= 650) { + if (play->csCtx.frames >= 650) { func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; @@ -452,8 +451,8 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, GlobalCo } } -void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state != 0 && globalCtx->sceneNum == SCENE_OKUJOU) { +void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { + if (play->csCtx.state != 0 && play->sceneNum == SCENE_OKUJOU) { func_800B9010(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); } } @@ -461,19 +460,19 @@ void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, Glo /** * Used by the Moon in Termina Field, as well as all LodMoons. */ -void EnFall_Moon_PerformDefaultActions(EnFall* this, GlobalContext* globalCtx) { +void EnFall_Moon_PerformDefaultActions(EnFall* this, PlayState* play) { u16 currentDay; - if (Cutscene_CheckActorAction(globalCtx, 133)) { - if (Cutscene_CheckActorAction(globalCtx, 133) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action == 1) { + if (Cutscene_CheckActorAction(play, 133)) { + if (Cutscene_CheckActorAction(play, 133) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 1) { this->actor.draw = NULL; } else { Actor_SetScale(&this->actor, this->scale * 3.6f); this->actor.draw = EnFall_Moon_Draw; - if (Cutscene_CheckActorAction(globalCtx, 133) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 133)]->action == 2) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 133)); + if (Cutscene_CheckActorAction(play, 133) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 2) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); } } } else { @@ -485,7 +484,7 @@ void EnFall_Moon_PerformDefaultActions(EnFall* this, GlobalContext* globalCtx) { this->currentDay = currentDay; this->dayStartTime = gSaveContext.save.time; } - EnFall_Moon_AdjustScaleAndPosition(this, globalCtx); + EnFall_Moon_AdjustScaleAndPosition(this, play); } } @@ -505,15 +504,14 @@ void EnFall_MoonsTear_Initialize(EnFall* this) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnFall_MoonsTear_DoNothing(EnFall* this, GlobalContext* globalCtx) { +void EnFall_MoonsTear_DoNothing(EnFall* this, PlayState* play) { } -void EnFall_MoonsTear_Fall(EnFall* this, GlobalContext* globalCtx) { +void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play) { s32 pad; - if (Cutscene_CheckActorAction(globalCtx, 517) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 517)]->action == 2 && - this->actor.draw == NULL) { + if (Cutscene_CheckActorAction(play, 517) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 517)]->action == 2 && this->actor.draw == NULL) { EnFall_MoonsTear_Initialize(this); } @@ -522,10 +520,10 @@ void EnFall_MoonsTear_Fall(EnFall* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_1); gSaveContext.save.weekEventReg[74] |= 0x80; gSaveContext.save.weekEventReg[74] |= 0x20; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TEST, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -2); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_EXPLOSION); this->actor.draw = NULL; this->actionFunc = EnFall_MoonsTear_DoNothing; } else { @@ -534,9 +532,10 @@ void EnFall_MoonsTear_Fall(EnFall* this, GlobalContext* globalCtx) { } } -void EnFall_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - this->actionFunc(this, globalCtx); + + this->actionFunc(this, play); } /** @@ -572,15 +571,14 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { } } -void EnFall_Fireball_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (globalCtx->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 0 && - globalCtx->csCtx.currentCsIndex == 2) { - globalCtx->skyboxCtx.rotY -= 0.05f; + if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 2) { + play->skyboxCtx.rotY -= 0.05f; } - if (Cutscene_CheckActorAction(globalCtx, 450)) { + if (Cutscene_CheckActorAction(play, 450)) { this->actor.draw = EnFall_Fireball_Draw; if (this->flags & FLAG_FIRE_BALL_INTENSIFIES) { this->fireballIntensity += 0.01f; @@ -588,9 +586,9 @@ void EnFall_Fireball_Update(Actor* thisx, GlobalContext* globalCtx) { this->fireballIntensity = 1.0f; } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 450)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 450)); - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 450)]->action) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 450)]->action) { default: this->actor.draw = NULL; this->fireballAlpha = 0; @@ -627,7 +625,7 @@ void EnFall_Fireball_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.draw = NULL; } - if (Cutscene_CheckActorAction(globalCtx, 0x1C2) && this->fireballAlpha > 0) { + if (Cutscene_CheckActorAction(play, 0x1C2) && this->fireballAlpha > 0) { func_8019F128(NA_SE_EV_MOON_FALL_LAST - SFX_FLAG); } Actor_SetScale(&this->actor, this->scale * 1.74f); @@ -681,12 +679,12 @@ s32 EnFall_RisingDebris_InitializeEffect(EnFall* this) { return false; } -void EnFall_RisingDebris_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_RisingDebris_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (Cutscene_CheckActorAction(globalCtx, 451)) { - if (Cutscene_CheckActorAction(globalCtx, 451) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 451)]->action == 2) { + if (Cutscene_CheckActorAction(play, 451)) { + if (Cutscene_CheckActorAction(play, 451) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 451)]->action == 2) { EnFall_RisingDebris_UpdateEffects(this); EnFall_RisingDebris_InitializeEffect(this); } else if (this->activeDebrisEffectCount != 0) { @@ -698,11 +696,11 @@ void EnFall_RisingDebris_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFall_FireRing_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_FireRing_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (Cutscene_CheckActorAction(globalCtx, 450) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 450)]->action == 5) { + if (Cutscene_CheckActorAction(play, 450) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 450)]->action == 5) { if (!(this->flags & FLAG_FIRE_RING_APPEARS)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } @@ -728,17 +726,17 @@ void EnFall_FireRing_Update(Actor* thisx, GlobalContext* globalCtx) { * Used for all closed-mouth high-detail moons, including * StoppedClosedMouthMoon and CrashingMoon. */ -void EnFall_Moon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Moon_Draw(Actor* thisx, PlayState* play) { // This offsets the moon's focus so that the Moon's Tear actually falls // out of its eye when looking at it through the telescope. static Vec3f sFocusOffset[] = { 1800.0f, 1000.0f, 4250.0f }; EnFall* this = THIS; s32 primColor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_MultVec3f(sFocusOffset, &this->actor.focus.pos); primColor = (this->eyeGlowIntensity * 200.0f) + 40.0f; @@ -746,35 +744,35 @@ void EnFall_Moon_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gMoonDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFall_OpenMouthMoon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_OpenMouthMoon_Draw(Actor* thisx, PlayState* play) { EnFall* this = THIS; s32 primColor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); primColor = (this->eyeGlowIntensity * 200.0f) + 40.0f; gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, primColor, primColor, primColor, 255); gSPDisplayList(POLY_OPA_DISP++, gOpenMouthMoonDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFall_LodMoon_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_LodMoon_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFall* this = THIS; s32 primColor; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 20, 25, 30, 0, 0x3E7, 0x3200); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_AA_ZB_OPA_SURF2); @@ -786,29 +784,29 @@ void EnFall_LodMoon_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gLodmoonEyesDL); gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH); gSPDisplayList(POLY_OPA_DISP++, gLodmoonMoonDL); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFall_LodMoon_DrawWithoutLerp(Actor* thisx, GlobalContext* globalCtx) { - EnFall_LodMoon_Draw(thisx, globalCtx); +void EnFall_LodMoon_DrawWithoutLerp(Actor* thisx, PlayState* play) { + EnFall_LodMoon_Draw(thisx, play); } /** * If the moon is more than 9000 units away from the eye, this will lerp it * to be 9000 units away before drawing it. */ -void EnFall_LodMoon_DrawWithLerp(Actor* thisx, GlobalContext* globalCtx) { - f32 distanceToEye = Actor_DistanceToPoint(thisx, &globalCtx->view.eye); +void EnFall_LodMoon_DrawWithLerp(Actor* thisx, PlayState* play) { + f32 distanceToEye = Actor_DistanceToPoint(thisx, &play->view.eye); f32 scale; Vec3f translation; if (distanceToEye > 9000.0f) { scale = 9000.0f / distanceToEye; - translation.x = (-(globalCtx->view.eye.x - thisx->world.pos.x) * scale) + globalCtx->view.eye.x; - translation.y = (-(globalCtx->view.eye.y - thisx->world.pos.y) * scale) + globalCtx->view.eye.y; - translation.z = (-(globalCtx->view.eye.z - thisx->world.pos.z) * scale) + globalCtx->view.eye.z; + translation.x = (-(play->view.eye.x - thisx->world.pos.x) * scale) + play->view.eye.x; + translation.y = (-(play->view.eye.y - thisx->world.pos.y) * scale) + play->view.eye.y; + translation.z = (-(play->view.eye.z - thisx->world.pos.z) * scale) + play->view.eye.z; Matrix_Translate(translation.x, translation.y, translation.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); Matrix_RotateYS(thisx->shape.rot.y, MTXMODE_APPLY); @@ -816,18 +814,18 @@ void EnFall_LodMoon_DrawWithLerp(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZS(thisx->shape.rot.z, MTXMODE_APPLY); } - EnFall_LodMoon_Draw(thisx, globalCtx); + EnFall_LodMoon_Draw(thisx, play); } -void EnFall_Fireball_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_Fireball_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFall* this = THIS; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); this->fireballYTexScroll1 += (s32)(4.0f + (this->fireballIntensity * 12.0f)); this->fireballYTexScroll2 += (s32)(2.0f + (this->fireballIntensity * 6.0f)); @@ -842,30 +840,30 @@ void EnFall_Fireball_Draw(Actor* thisx, GlobalContext* globalCtx) { // For the glowing sphere of fire gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, -this->fireballYTexScroll2, 64, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames, -this->fireballYTexScroll2, 64, 64, 1, -gameplayFrames, -this->fireballYTexScroll1, 64, 64)); // For the "flecks" of fire around the fireball gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 2, -this->fireballYTexScroll1, 64, 64, 1, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 2, -this->fireballYTexScroll1, 64, 64, 1, -gameplayFrames * 2, -this->fireballYTexScroll1, 64, 64)); gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); gSPDisplayList(POLY_XLU_DISP++, gMoonFireballDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFall_RisingDebris_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_RisingDebris_Draw(Actor* thisx, PlayState* play) { static Gfx* sDebrisModelDLists[] = { gMoonDebrisModel1DL, gMoonDebrisModel2DL, gMoonDebrisModel3DL }; EnFall* this = THIS; f32 scale = this->scale * 0.06f; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gMoonDebrisMaterialDL); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); @@ -875,16 +873,15 @@ void EnFall_RisingDebris_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(debrisEffects[i].pos.x, debrisEffects[i].pos.y, debrisEffects[i].pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateZYX(debrisEffects[i].rot.x, debrisEffects[i].rot.y, debrisEffects[i].rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDebrisModelDLists[debrisEffects[i].modelIndex]); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFall_FireRing_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_FireRing_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFall* this = THIS; @@ -892,11 +889,11 @@ void EnFall_FireRing_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->fireRingAlpha > 1.0f) { this->fireRingAlpha = 1.0f; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - AnimatedMat_DrawXlu(globalCtx, Lib_SegmentedToVirtual(gMoonFireRingTexAnim)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(gMoonFireRingTexAnim)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); @@ -905,26 +902,26 @@ void EnFall_FireRing_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gMoonFireRingDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnFall_MoonsTear_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFall_MoonsTear_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gFallingMoonsTearTexAnim)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gFallingMoonsTearTexAnim)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFallingMoonsTearDL); Matrix_Scale(3.0f, 3.0f, 6.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFallingMoonsTearFireDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.h b/src/overlays/actors/ovl_En_Fall/z_en_fall.h index 308b8ba9b9..21746b6832 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.h +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.h @@ -24,7 +24,7 @@ typedef enum { struct EnFall; -typedef void (*EnFallActionFunc)(struct EnFall*, GlobalContext*); +typedef void (*EnFallActionFunc)(struct EnFall*, PlayState*); typedef struct EnFall { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index 46c365cd30..dac233f969 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -10,10 +10,10 @@ #define THIS ((EnFall2*)thisx) -void EnFall2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFall2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFall2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFall2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFall2_Init(Actor* thisx, PlayState* play); +void EnFall2_Destroy(Actor* thisx, PlayState* play); +void EnFall2_Update(Actor* thisx, PlayState* play); +void EnFall2_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Fall2_InitVars = { diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h index 254b272bf6..5c489bd7cf 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h @@ -5,7 +5,7 @@ struct EnFall2; -typedef void (*EnFall2ActionFunc)(struct EnFall2*, GlobalContext*); +typedef void (*EnFall2ActionFunc)(struct EnFall2*, PlayState*); typedef struct EnFall2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 32ce1988f1..cfb015d5c8 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -12,43 +12,43 @@ #define THIS ((EnFamos*)thisx) -void EnFamos_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFamos_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFamos_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFamos_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFamos_Init(Actor* thisx, PlayState* play); +void EnFamos_Destroy(Actor* thisx, PlayState* play); +void EnFamos_Update(Actor* thisx, PlayState* play); +void EnFamos_Draw(Actor* thisx, PlayState* play); void EnFamos_SetupAttackDebris(EnFamos* this); void EnFamos_SetupDeathDebris(EnFamos* this); -s32 EnFamos_IsPlayerSeen(EnFamos* this, GlobalContext* globalCtx); +s32 EnFamos_IsPlayerSeen(EnFamos* this, PlayState* play); void EnFamos_SetupStillIdle(EnFamos* this); -void EnFamos_StillIdle(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_StillIdle(EnFamos* this, PlayState* play); void EnFamos_SetupPathingIdle(EnFamos* this); -void EnFamos_PathingIdle(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_PathingIdle(EnFamos* this, PlayState* play); void EnFamos_SetupTurnHome(EnFamos* this); -void EnFamos_TurnHome(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_TurnHome(EnFamos* this, PlayState* play); void EnFamos_SetupReturnHome(EnFamos* this); -void EnFamos_ReturnHome(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_ReturnHome(EnFamos* this, PlayState* play); void EnFamos_SetupAlert(EnFamos* this); -void EnFamos_Alert(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_Alert(EnFamos* this, PlayState* play); void EnFamos_SetupChase(EnFamos* this); -void EnFamos_Chase(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_Chase(EnFamos* this, PlayState* play); void EnFamos_SetupAttackAim(EnFamos* this); -void EnFamos_AttackAim(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_AttackAim(EnFamos* this, PlayState* play); void EnFamos_SetupAttack(EnFamos* this); -void EnFamos_Attack(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_Attack(EnFamos* this, PlayState* play); void EnFamos_SetupFinishAttack(EnFamos* this); -void EnFamos_FinishAttack(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_FinishAttack(EnFamos* this, PlayState* play); void EnFamos_SetupAttackRebound(EnFamos* this); -void EnFamos_AttackRebound(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_AttackRebound(EnFamos* this, PlayState* play); void EnFamos_SetupScanForPlayer(EnFamos* this); -void EnFamos_ScanForPlayer(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_ScanForPlayer(EnFamos* this, PlayState* play); void EnFamos_SetupDeathSlam(EnFamos* this); -void EnFamos_DeathSlam(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_DeathSlam(EnFamos* this, PlayState* play); void EnFamos_SetupDeathExplosion(EnFamos* this); -void EnFamos_DeathExplosion(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_DeathExplosion(EnFamos* this, PlayState* play); void EnFamos_SetupDeathFade(EnFamos* this); -void EnFamos_DeathFade(EnFamos* this, GlobalContext* globalCtx); -void EnFamos_DrawDebris(EnFamos* this, GlobalContext* globalCtx); +void EnFamos_DeathFade(EnFamos* this, PlayState* play); +void EnFamos_DrawDebris(EnFamos* this, PlayState* play); const ActorInit En_Famos_InitVars = { ACTOR_EN_FAMOS, @@ -159,14 +159,14 @@ static InitChainEntry sInitChain[] = { static s32 sAnimatedMaterialsDesgmented = false; -void EnFamos_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFamos_Init(Actor* thisx, PlayState* play) { EnFamos* this = THIS; Path* path; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); if (GET_FAMOS_PATH(thisx) != 0xFF) { - path = &globalCtx->setupPathList[this->actor.params]; + path = &play->setupPathList[this->actor.params]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathNodeCount = path->count; if (this->pathNodeCount == 1) { @@ -176,12 +176,11 @@ void EnFamos_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawSquare, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gFamosSkeleton, &gFamosIdleAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gFamosSkeleton, &gFamosIdleAnim, this->jointTable, this->morphTable, FAMOS_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); - Collider_InitAndSetJntSph(globalCtx, &this->emblemCollider, &this->actor, &sJntSphInit, - this->emblemColliderElements); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitAndSetJntSph(play, &this->emblemCollider, &this->actor, &sJntSphInit, this->emblemColliderElements); if (!sAnimatedMaterialsDesgmented) { // init animated materials for (i = 0; i < ARRAY_COUNT(sEmblemAnimatedMats); i++) { @@ -205,12 +204,12 @@ void EnFamos_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFamos_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFamos_Destroy(Actor* thisx, PlayState* play) { EnFamos* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyJntSph(globalCtx, &this->emblemCollider); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyJntSph(play, &this->emblemCollider); } /** @@ -271,9 +270,9 @@ void EnFamos_SetupDeathDebris(EnFamos* this) { } } -s32 EnFamos_IsPlayerSeen(EnFamos* this, GlobalContext* globalCtx) { - if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && - (Actor_XZDistanceToPoint(&GET_PLAYER(globalCtx)->actor, &this->calmPos) < this->aggroDistance) && +s32 EnFamos_IsPlayerSeen(EnFamos* this, PlayState* play) { + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && + (Actor_XZDistanceToPoint(&GET_PLAYER(play)->actor, &this->calmPos) < this->aggroDistance) && Actor_IsFacingPlayer(&this->actor, 0x5000)) { return true; } else { @@ -350,12 +349,12 @@ void EnFamos_SetupStillIdle(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_StillIdle(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_StillIdle(EnFamos* this, PlayState* play) { EnFamos_UpdateBobbingHeight(this); if (this->isCalm) { Math_Vec3f_Copy(&this->calmPos, &this->actor.world.pos); } - if (EnFamos_IsPlayerSeen(this, globalCtx)) { + if (EnFamos_IsPlayerSeen(this, play)) { EnFamos_SetupAlert(this); } } @@ -379,13 +378,13 @@ void EnFamos_SetupPathingIdle(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_PathingIdle(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_PathingIdle(EnFamos* this, PlayState* play) { EnFamos_UpdateBobbingHeight(this); if (this->isCalm) { Math_Vec3f_Copy(&this->calmPos, &this->actor.world.pos); } - if (EnFamos_IsPlayerSeen(this, globalCtx)) { + if (EnFamos_IsPlayerSeen(this, play)) { EnFamos_SetupAlert(this); } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x200)) { EnFamos_SetupReturnHome(this); @@ -402,9 +401,9 @@ void EnFamos_SetupTurnHome(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_TurnHome(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_TurnHome(EnFamos* this, PlayState* play) { EnFamos_UpdateBobbingHeight(this); - if (EnFamos_IsPlayerSeen(this, globalCtx)) { + if (EnFamos_IsPlayerSeen(this, play)) { EnFamos_SetupAlert(this); } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 0x200)) { EnFamos_SetupReturnHome(this); @@ -420,7 +419,7 @@ void EnFamos_SetupReturnHome(EnFamos* this) { this->actionFunc = EnFamos_ReturnHome; } -void EnFamos_ReturnHome(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_ReturnHome(EnFamos* this, PlayState* play) { f32 distanceToHome = Actor_XZDistanceToPoint(&this->actor, &this->targetDest); this->actor.shape.rot.y = Actor_YawToPoint(&this->actor, &this->targetDest); @@ -430,7 +429,7 @@ void EnFamos_ReturnHome(EnFamos* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->calmPos, &this->actor.world.pos); } - if (EnFamos_IsPlayerSeen(this, globalCtx)) { + if (EnFamos_IsPlayerSeen(this, play)) { EnFamos_SetupAlert(this); } else if (distanceToHome < 20.0f) { if (this->pathPoints != NULL) { @@ -461,7 +460,7 @@ void EnFamos_SetupAlert(EnFamos* this) { this->actionFunc = EnFamos_Alert; } -void EnFamos_Alert(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_Alert(EnFamos* this, PlayState* play) { if (ABS_ALT(this->flipRot) > 0x4000) { func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); } else { @@ -486,8 +485,8 @@ void EnFamos_SetupChase(EnFamos* this) { this->actionFunc = EnFamos_Chase; } -void EnFamos_Chase(EnFamos* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFamos_Chase(EnFamos* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f abovePlayerPos; u32 surfaceType; @@ -500,13 +499,13 @@ void EnFamos_Chase(EnFamos* this, GlobalContext* globalCtx) { this->actor.world.rot.x = -Actor_PitchToPoint(&this->actor, &abovePlayerPos); Math_StepToF(&this->actor.speedXZ, 6.0f, 0.5f); - surfaceType = func_800C9B18(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough (surfaceType != 0xC && surfaceType != 0xD)) { EnFamos_SetupAttackAim(this); - } else if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || - (this->aggroDistance < Actor_XZDistanceToPoint(&GET_PLAYER(globalCtx)->actor, &this->calmPos)) || + } else if ((Player_GetMask(play) == PLAYER_MASK_STONE) || + (this->aggroDistance < Actor_XZDistanceToPoint(&GET_PLAYER(play)->actor, &this->calmPos)) || !Actor_IsFacingPlayer(&this->actor, 0x6000)) { EnFamos_SetupScanForPlayer(this); } @@ -519,7 +518,7 @@ void EnFamos_SetupAttackAim(EnFamos* this) { this->actionFunc = EnFamos_AttackAim; } -void EnFamos_AttackAim(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_AttackAim(EnFamos* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); if (SkelAnime_Update(&this->skelAnime)) { EnFamos_SetupAttack(this); @@ -533,7 +532,7 @@ void EnFamos_SetupAttack(EnFamos* this) { this->actionFunc = EnFamos_Attack; } -void EnFamos_Attack(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_Attack(EnFamos* this, PlayState* play) { s32 hitFloor; u32 surfaceType; @@ -543,18 +542,18 @@ void EnFamos_Attack(EnFamos* this, GlobalContext* globalCtx) { this->emblemCollider.base.acFlags &= ~AC_ON; } - surfaceType = func_800C9B18(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); hitFloor = this->actor.bgCheckFlags & 1; if (hitFloor || (this->actor.floorHeight == BGCHECK_Y_MIN) || (surfaceType == 0xC) || (surfaceType == 0xD)) { this->collider1.base.atFlags &= ~AT_ON; this->collider2.base.atFlags |= AT_ON; if (hitFloor) { - func_800DFD04(globalCtx->cameraPtrs[globalCtx->activeCamera], 2, 15, 10); // camera shake? + func_800DFD04(play->cameraPtrs[play->activeCamera], 2, 15, 10); // camera shake? func_8013ECE0(this->actor.xyzDistToPlayerSq, 180, 20, 100); EnFamos_SetupAttackDebris(this); // spawn crator on floor - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TEST, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, 0, 0, 0, 0x0); if (this->actor.child != NULL) { @@ -590,7 +589,7 @@ void EnFamos_SetupFinishAttack(EnFamos* this) { this->actionFunc = EnFamos_FinishAttack; } -void EnFamos_FinishAttack(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_FinishAttack(EnFamos* this, PlayState* play) { if (this->stateTimer == 0) { this->collider2.base.atFlags &= ~AT_ON; } @@ -607,7 +606,7 @@ void EnFamos_SetupAttackRebound(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_AttackRebound(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_AttackRebound(EnFamos* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 5.0f, 0.3f); if (this->actor.speedXZ > 1.0f) { if (ABS_ALT(this->flipRot) > 0x4000) { @@ -632,11 +631,11 @@ void EnFamos_SetupScanForPlayer(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_ScanForPlayer(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_ScanForPlayer(EnFamos* this, PlayState* play) { EnFamos_UpdateBobbingHeight(this); this->stateTimer--; - if (EnFamos_IsPlayerSeen(this, globalCtx)) { + if (EnFamos_IsPlayerSeen(this, play)) { EnFamos_SetupAlert(this); } else if (this->stateTimer == 0) { EnFamos_SetupTurnHome(this); @@ -659,7 +658,7 @@ void EnFamos_SetupDeathSlam(EnFamos* this) { this->actionFunc = EnFamos_DeathSlam; } -void EnFamos_DeathSlam(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_DeathSlam(EnFamos* this, PlayState* play) { if (this->stateTimer == 17) { this->collider2.base.atFlags &= ~AT_ON; } @@ -680,7 +679,7 @@ void EnFamos_SetupDeathExplosion(EnFamos* this) { this->actionFunc = EnFamos_DeathExplosion; } -void EnFamos_DeathExplosion(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); if (this->actor.colorFilterTimer == 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, false, 4); @@ -690,7 +689,7 @@ void EnFamos_DeathExplosion(EnFamos* this, GlobalContext* globalCtx) { this->actor.world.pos.z = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.z; if (this->stateTimer == 1) { EnBom* explosion = - (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); if (explosion != NULL) { explosion->timer = 0; // instant explosion @@ -698,7 +697,7 @@ void EnFamos_DeathExplosion(EnFamos* this, GlobalContext* globalCtx) { this->stateTimer--; } else if (this->stateTimer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, (0xD << 4)); // random item from droptable 0xD EnFamos_SetupDeathFade(this); @@ -715,7 +714,7 @@ void EnFamos_SetupDeathFade(EnFamos* this) { this->actor.speedXZ = 0.0f; } -void EnFamos_DeathFade(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_DeathFade(EnFamos* this, PlayState* play) { Actor* enBom; if (this->debrisTimer == 0) { @@ -741,7 +740,7 @@ void EnFamos_UpdateDebrisPosRot(EnFamos* this) { } } -void EnFamos_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFamos_Update(Actor* thisx, PlayState* play) { s32 pad; EnFamos* this = THIS; f32 oldHeight; @@ -758,7 +757,7 @@ void EnFamos_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); oldHeight = this->actor.world.pos.y; Actor_MoveWithoutGravity(&this->actor); if (oldHoverTimer != this->hoverTimer) { // test if updated in actionFunc @@ -766,7 +765,7 @@ void EnFamos_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->flippedTimer >= 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 30.0f, 80.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 80.0f, 0x1F); if ((this->actionFunc == EnFamos_Attack) && (this->animatedMaterialIndex != FAMOS_ANIMATED_MAT_NORMAL) && (this->actor.bgCheckFlags & 1)) { // touch floor this->actor.world.pos.y -= 60.0f; @@ -776,25 +775,24 @@ void EnFamos_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.rot.y = this->actor.shape.rot.y; Collider_UpdateCylinder(&this->actor, &this->collider1); if (this->collider1.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->emblemCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->emblemCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->emblemCollider.base); } if (this->collider2.base.atFlags & AC_ON) { Collider_UpdateCylinder(&this->actor, &this->collider2); this->collider2.dim.pos.y = this->actor.floorHeight; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } } } -s32 EnFamos_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnFamos_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFamos* this = THIS; if (limbIndex == FAMOS_LIMB_BODY) { @@ -811,7 +809,7 @@ s32 EnFamos_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnFamos_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFamos_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFamos* this = THIS; if (limbIndex == FAMOS_LIMB_EMBLEM) { @@ -820,14 +818,14 @@ void EnFamos_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnFamos_DrawDebris(EnFamos* this, GlobalContext* globalCtx) { +void EnFamos_DrawDebris(EnFamos* this, PlayState* play) { s32 i; if (this->debrisTimer > 0) { Gfx* dispOpa; EnFamosRock* rock; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); dispOpa = POLY_OPA_DISP; gSPDisplayList(&dispOpa[0], &sSetupDL[6 * 0x19]); @@ -842,7 +840,7 @@ void EnFamos_DrawDebris(EnFamos* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(rock->pos.x, rock->pos.y, rock->pos.z, &rock->rotation); Matrix_Scale(rock->scale, rock->scale, rock->scale, MTXMODE_APPLY); - gSPMatrix(&dispOpa[3 + i * 2], Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(&dispOpa[3 + i * 2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&dispOpa[4 + i * 2], &gameplay_keep_DL_06AB30); // greenish brown rock DL @@ -850,21 +848,21 @@ void EnFamos_DrawDebris(EnFamos* this, GlobalContext* globalCtx) { POLY_OPA_DISP = &dispOpa[3 + (ARRAY_COUNT(this->rocks) * 2)]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnFamos_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFamos_Draw(Actor* thisx, PlayState* play) { EnFamos* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->actionFunc != EnFamos_DeathFade) { - AnimatedMat_Draw(globalCtx, sEmblemAnimatedMats[this->animatedMaterialIndex]); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFamos_OverrideLimbDraw, + AnimatedMat_Draw(play, sEmblemAnimatedMats[this->animatedMaterialIndex]); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFamos_OverrideLimbDraw, EnFamos_PostLimbDraw, &this->actor); if (this->actor.colorFilterTimer != 0) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } } - EnFamos_DrawDebris(this, globalCtx); + EnFamos_DrawDebris(this, play); } diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.h b/src/overlays/actors/ovl_En_Famos/z_en_famos.h index a3db181e6a..0478f70df6 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.h +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.h @@ -6,7 +6,7 @@ struct EnFamos; -typedef void (*EnFamosActionFunc)(struct EnFamos*, GlobalContext*); +typedef void (*EnFamosActionFunc)(struct EnFamos*, PlayState*); typedef struct EnFamosRock { /* 00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index bd3bd9e299..065f2c3707 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -12,17 +12,17 @@ #define THIS ((EnFg*)thisx) -void EnFg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFg_Init(Actor* thisx, PlayState* play); +void EnFg_Destroy(Actor* thisx, PlayState* play); +void EnFg_Update(Actor* thisx, PlayState* play); +void EnFg_Draw(Actor* thisx, PlayState* play); -void EnFg_Jump(EnFg* this, GlobalContext* globalCtx); -void EnFg_DoNothing(EnFg* this, GlobalContext* globalCtx); -void EnFg_Knockback(EnFg* this, GlobalContext* globalCtx); +void EnFg_Jump(EnFg* this, PlayState* play); +void EnFg_DoNothing(EnFg* this, PlayState* play); +void EnFg_Knockback(EnFg* this, PlayState* play); void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos); void EnFg_UpdateDust(EnFgEffectDust* dustEffect); -void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect); +void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect); const ActorInit En_Fg_InitVars = { ACTOR_EN_FG, @@ -120,17 +120,17 @@ s32 EnFg_UpdateAnimation(SkelAnime* skelAnime, s16 animIndex) { return ret; } -void func_80A2D348(EnFg* this, GlobalContext* globalCtx) { +void func_80A2D348(EnFg* this, PlayState* play) { if (this->actor.colChkInfo.health != 0) { 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; - 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_80A2D3D4(EnFg* this, GlobalContext* globalCtx) { +void func_80A2D3D4(EnFg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } @@ -170,7 +170,7 @@ s32 EnFg_GetDamageEffect(EnFg* this) { return ret; } -void EnFg_Idle(EnFg* this, GlobalContext* globalCtx) { +void EnFg_Idle(EnFg* this, PlayState* play) { Actor* ac; s16 rotY; s16 rotX; @@ -230,7 +230,7 @@ void EnFg_Idle(EnFg* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void EnFg_Jump(EnFg* this, GlobalContext* globalCtx) { +void EnFg_Jump(EnFg* this, PlayState* play) { Actor* ac; s32 pad; s16 rotY; @@ -285,10 +285,10 @@ void EnFg_Jump(EnFg* this, GlobalContext* globalCtx) { } } -void EnFg_DoNothing(EnFg* this, GlobalContext* globalCtx) { +void EnFg_DoNothing(EnFg* this, PlayState* play) { } -void EnFg_Knockback(EnFg* this, GlobalContext* globalCtx) { +void EnFg_Knockback(EnFg* this, PlayState* play) { if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & 1)) { this->bounceCounter++; if (this->bounceCounter < 4) { @@ -311,15 +311,14 @@ void EnFg_Knockback(EnFg* this, GlobalContext* globalCtx) { } } -void EnFg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFg_Init(Actor* thisx, PlayState* play) { EnFg* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fr_Skel_00B538, NULL, this->jointTable, this->morphTable, - 24); + SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, NULL, this->jointTable, this->morphTable, 24); EnFg_UpdateAnimation(&this->skelAnime, 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, &sDamageTable, &sColChkInfoInit2); this->actor.flags |= ACTOR_FLAG_4000; Actor_SetScale(&this->actor, 0.01f); @@ -327,13 +326,13 @@ void EnFg_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnFg_Idle; } -void EnFg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFg_Destroy(Actor* thisx, PlayState* play) { EnFg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnFg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFg_Update(Actor* thisx, PlayState* play) { EnFg* this = THIS; s32 flag; s32 flagSet; @@ -345,17 +344,17 @@ void EnFg_Update(Actor* thisx, GlobalContext* globalCtx) { flagSet = ((flag & 0x8000) == 0x8000); if (1) {} if (!flagSet) { - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, BASE_REG(16, 0), BASE_REG(16, 1), 0.0f, 0x5); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, BASE_REG(16, 0), BASE_REG(16, 1), 0.0f, 0x5); } } - func_80A2D3D4(this, globalCtx); + func_80A2D3D4(this, play); EnFg_UpdateDust(&this->dustEffect[0]); - func_80A2D348(this, globalCtx); + func_80A2D348(this, play); } -s32 EnFg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnFg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; if ((limbIndex == 7) || (limbIndex == 8)) { @@ -370,19 +369,19 @@ s32 EnFg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFg* this = THIS; s16 pad; Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; if ((limbIndex == 7) || (limbIndex == 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == 4) { @@ -390,7 +389,7 @@ void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnFg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFg_Draw(Actor* thisx, PlayState* play) { EnFg* this = THIS; s32 pad; Color_RGBA8 envColor[] = { @@ -399,19 +398,19 @@ void EnFg_Draw(Actor* thisx, GlobalContext* globalCtx) { }; Matrix_Push(); - EnFg_DrawDust(globalCtx, &this->dustEffect[0]); + EnFg_DrawDust(play, &this->dustEffect[0]); Matrix_Pop(); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, envColor[this->actor.params].r, envColor[this->actor.params].g, envColor[this->actor.params].b, envColor[this->actor.params].a); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(object_fr_Tex_0059A0)); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(object_fr_Tex_0059A0)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFg_OverrideLimbDraw, EnFg_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnFg_AddDust(EnFgEffectDust* dustEffect, Vec3f* worldPos) { @@ -449,14 +448,14 @@ TexturePtr sDustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; -void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect) { +void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { s16 i; s16 alpha; s16 index; s16 firstDone = false; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 10; i++, dustEffect++) { if (dustEffect->type) { @@ -472,14 +471,13 @@ void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 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->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); index = 0.5f * dustEffect->timer; gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTex[index])); gSPDisplayList(POLY_XLU_DISP++, object_fr_DL_00B338); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.h b/src/overlays/actors/ovl_En_Fg/z_en_fg.h index 45f643a1cf..1dfb30f04f 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.h +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.h @@ -5,7 +5,7 @@ struct EnFg; -typedef void (*EnFgActionFunc)(struct EnFg*, GlobalContext*); +typedef void (*EnFgActionFunc)(struct EnFg*, PlayState*); // Based on the envColor data. Related to params but mostly unused. typedef enum { 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 77909d2eeb..da1c945597 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 @@ -10,10 +10,10 @@ #define THIS ((EnFireRock*)thisx) -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); const ActorInit En_Fire_Rock_InitVars = { ACTOR_EN_FIRE_ROCK, @@ -27,11 +27,11 @@ const ActorInit En_Fire_Rock_InitVars = { (ActorFunc)EnFireRock_Draw, }; -void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Init(Actor* thisx, PlayState* play) { } -void EnFireRock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Destroy(Actor* thisx, PlayState* play) { } -void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Update(Actor* thisx, PlayState* play) { } -void EnFireRock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFireRock_Draw(Actor* thisx, PlayState* play) { } 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 677edb81a3..3e6e4f53cb 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -12,25 +12,25 @@ #define THIS ((EnFirefly*)thisx) -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_FlyIdle(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play); +void EnFirefly_Fall(EnFirefly* this, PlayState* play); void EnFirefly_SetupDie(EnFirefly* this); -void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_Die(EnFirefly* this, PlayState* play); void EnFirefly_SetupDiveAttack(EnFirefly* this); -void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Rebound(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play); +void EnFirefly_Rebound(EnFirefly* this, PlayState* play); void EnFirefly_SetupFlyAway(EnFirefly* this); -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx); -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_FlyAway(EnFirefly* this, PlayState* play); +void EnFirefly_Stunned(EnFirefly* this, PlayState* play); void EnFirefly_SetupPerch(EnFirefly* this); -void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_Perch(EnFirefly* this, PlayState* play); void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this); -void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx); +void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play); typedef enum { /* 0 */ KEESE_FIRE, @@ -120,14 +120,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 4000, ICHAIN_STOP), }; -void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Init(Actor* thisx, PlayState* play) { EnFirefly* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_firefly_Skel_0018B8, &object_firefly_Anim_00017C, - this->jointTable, this->morphTable, 28); - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + SkelAnime_Init(play, &this->skelAnime, &object_firefly_Skel_0018B8, &object_firefly_Anim_00017C, this->jointTable, + this->morphTable, 28); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.params & KEESE_INVISIBLE) { @@ -161,17 +161,17 @@ void EnFirefly_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; } -void EnFirefly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Destroy(Actor* thisx, PlayState* play) { EnFirefly* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -void EnFirefly_SpawnIceEffects(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_SpawnIceEffects(EnFirefly* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, &this->limbPos[0], 3, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, &this->limbPos[0], 3, 2, 0.2f, 0.2f); } } @@ -191,8 +191,8 @@ void EnFirefly_Ignite(EnFirefly* this) { } } -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) { @@ -220,8 +220,8 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { return false; } -s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) { - ObjSyokudai* findTorch = (ObjSyokudai*)globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { + ObjSyokudai* findTorch = (ObjSyokudai*)play->actorCtx.actorLists[ACTORCAT_PROP].first; ObjSyokudai* closestTorch = NULL; f32 currentMinDist = 35000.0f; f32 currentDist; @@ -270,7 +270,7 @@ void EnFirefly_SetupFlyIdle(EnFirefly* this) { this->actionFunc = EnFirefly_FlyIdle; } -void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { s32 isSkelAnimeUpdated; f32 rand; @@ -282,7 +282,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { isSkelAnimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; - if (!EnFirefly_ReturnToPerch(this, globalCtx) && !EnFirefly_SeekTorch(this, globalCtx)) { + if (!EnFirefly_ReturnToPerch(this, play) && !EnFirefly_SeekTorch(this, play)) { if (isSkelAnimeUpdated) { rand = Rand_ZeroOne(); @@ -320,13 +320,12 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { 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_STONE)) { + if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { EnFirefly_SetupDiveAttack(this); } } -void EnFirefly_SetupFall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { this->timer = 40; this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &object_firefly_Anim_00017C, 0.0f, 6.0f, 6.0f, 2, 0.0f); @@ -348,7 +347,7 @@ void EnFirefly_SetupFall(EnFirefly* this, GlobalContext* globalCtx) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == 2) { @@ -369,7 +368,7 @@ void EnFirefly_SetupFall(EnFirefly* this, GlobalContext* globalCtx) { } // Fall to the ground after being hit -void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.colorFilterTimer = 40; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); @@ -380,7 +379,7 @@ void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { } if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { - EnFirefly_SpawnIceEffects(this, globalCtx); + EnFirefly_SpawnIceEffects(this, play); EnFirefly_SetupDie(this); } } @@ -393,7 +392,7 @@ void EnFirefly_SetupDie(EnFirefly* this) { } // 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--; } @@ -402,7 +401,7 @@ void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) { 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, 0xA0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); Actor_MarkForDeath(&this->actor); } } @@ -414,8 +413,8 @@ void EnFirefly_SetupDiveAttack(EnFirefly* this) { this->actionFunc = EnFirefly_DiveAttack; } -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); @@ -460,7 +459,7 @@ 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_STONE) || (player->stateFlags2 & 0x80) || + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { EnFirefly_SetupFlyAway(this); } @@ -475,7 +474,7 @@ void EnFirefly_SetupRebound(EnFirefly* 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); @@ -497,7 +496,7 @@ void EnFirefly_SetupFlyAway(EnFirefly* this) { this->skelAnime.playSpeed = 1.0f; } -void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -547,7 +546,7 @@ void EnFirefly_SetupStunned(EnFirefly* this) { this->actionFunc = EnFirefly_Stunned; } -void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if (this->timer != 0) { @@ -579,7 +578,7 @@ void EnFirefly_SetupPerch(EnFirefly* this) { } // 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) { SkelAnime_Update(&this->skelAnime); @@ -604,8 +603,8 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->actionFunc = EnFirefly_DisturbDiveAttack; } -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); @@ -628,7 +627,7 @@ void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { } } -void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { +void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); @@ -643,7 +642,7 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { this->drawDmgEffScale = 0.55f; EnFirefly_SetupStunned(this); } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.colChkInfo.health = 0; this->actor.flags &= ~ACTOR_FLAG_1; @@ -653,13 +652,13 @@ void EnFirefly_UpdateDamage(EnFirefly* this, GlobalContext* globalCtx) { this->actor.colChkInfo.damageEffect = 0; } - EnFirefly_SetupFall(this, globalCtx); + EnFirefly_SetupFall(this, play); } } } -void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFirefly_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFirefly* this = THIS; if (this->collider.base.atFlags & AT_HIT) { @@ -675,8 +674,8 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - EnFirefly_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnFirefly_UpdateDamage(this, play); + this->actionFunc(this, play); if (!(this->actor.flags & ACTOR_FLAG_8000)) { if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { @@ -690,17 +689,17 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 15.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 15.0f, 7); this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.dim.worldSphere.center.y = (s32)this->actor.world.pos.y + 10; this->collider.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)) { @@ -708,7 +707,7 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -727,11 +726,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, - Actor* thisx, Gfx** gfx) { +s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { EnFirefly* this = THIS; - if (this->isInvisible && (globalCtx->actorCtx.unk4 != 0x64)) { + if (this->isInvisible && (play->actorCtx.unk4 != 0x64)) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; @@ -739,7 +738,7 @@ s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* 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 }; @@ -756,7 +755,7 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList if ((this->currentType != KEESE_FIRE) && (limbIndex == 27)) { gSPDisplayList((*gfx)++, object_firefly_DL_001678); - } else if ((this->unk_2F4 != globalCtx->gameplayFrames) && + } else if ((this->unk_2F4 != play->gameplayFrames) && ((this->auraType == KEESE_AURA_FIRE) || (this->auraType == KEESE_AURA_ICE)) && ((limbIndex == 15) || (limbIndex == 21))) { if (this->actionFunc != EnFirefly_Die) { @@ -788,7 +787,7 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList auraEnvColor = &iceAuraEnvColor; } - func_800B0F80(globalCtx, &auraPos, &auraVelocity, &auraAccel, auraPrimColor, auraEnvColor, 250, auraScaleStep, + func_800B0F80(play, &auraPos, &auraVelocity, &auraAccel, auraPrimColor, auraEnvColor, 250, auraScaleStep, auraLife); } @@ -801,12 +800,12 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFirefly* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->isInvisible) { gfx = POLY_XLU_DISP; @@ -822,7 +821,7 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(&gfx[1], 0, 0, 0, 255); } - gfx = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, + gfx = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, &this->actor, &gfx[2]); if (this->isInvisible) { POLY_XLU_DISP = gfx; @@ -830,10 +829,10 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = gfx; } - Actor_DrawDamageEffects(globalCtx, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale * this->actor.scale.y * 200.0f, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - this->unk_2F4 = globalCtx->gameplayFrames; + this->unk_2F4 = play->gameplayFrames; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 c8e24aa4f0..cb6019d5ec 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -5,7 +5,7 @@ struct EnFirefly; -typedef void (*EnFireflyActionFunc)(struct EnFirefly*, GlobalContext*); +typedef void (*EnFireflyActionFunc)(struct EnFirefly*, PlayState*); typedef enum { /* 0 */ KEESE_FIRE_FLY, diff --git a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c index b076e2885b..b3b446ef3f 100644 --- a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c +++ b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c @@ -10,10 +10,10 @@ #define THIS ((EnFirefly2*)thisx) -void EnFirefly2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFirefly2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFirefly2_Init(Actor* thisx, PlayState* play); +void EnFirefly2_Destroy(Actor* thisx, PlayState* play); +void EnFirefly2_Update(Actor* thisx, PlayState* play); +void EnFirefly2_Draw(Actor* thisx, PlayState* play); const ActorInit En_Firefly2_InitVars = { ACTOR_EN_FIREFLY2, @@ -27,11 +27,11 @@ const ActorInit En_Firefly2_InitVars = { (ActorFunc)EnFirefly2_Draw, }; -void EnFirefly2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly2_Init(Actor* thisx, PlayState* play) { } -void EnFirefly2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly2_Destroy(Actor* thisx, PlayState* play) { } -void EnFirefly2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly2_Update(Actor* thisx, PlayState* play) { } -void EnFirefly2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFirefly2_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index d456f48edb..7e927e98e9 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -11,29 +11,29 @@ #define THIS ((EnFish*)thisx) -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 func_8091DF68(Actor* thisx, GlobalContext* globalCtx); +void func_8091DF68(Actor* thisx, PlayState* play); void func_8091E070(EnFish* this); -void func_8091E128(Actor* thisx, GlobalContext* globalCtx); +void func_8091E128(Actor* thisx, PlayState* play); void func_8091E2E0(EnFish* this); -void func_8091E34C(Actor* thisx, GlobalContext* globalCtx2); +void func_8091E34C(Actor* thisx, PlayState* play2); void func_8091E5EC(EnFish* this); -void func_8091E658(Actor* thisx, GlobalContext* globalCtx); +void func_8091E658(Actor* thisx, PlayState* play); void func_8091E810(EnFish* this); -void func_8091E880(Actor* thisx, GlobalContext* globalCtx); +void func_8091E880(Actor* thisx, PlayState* play); void func_8091E9A4(EnFish* this); -void func_8091EAF0(Actor* thisx, GlobalContext* globalCtx); +void func_8091EAF0(Actor* thisx, PlayState* play); void func_8091ECF4(EnFish* this); -void func_8091ED70(Actor* thisx, GlobalContext* globalCtx); +void func_8091ED70(Actor* thisx, PlayState* play); void func_8091EF30(EnFish* this); -void func_8091EFE8(Actor* thisx, GlobalContext* globalCtx); +void func_8091EFE8(Actor* thisx, PlayState* play); void func_8091F344(EnFish* this); -void func_8091F3BC(Actor* thisx, GlobalContext* globalCtx); -void func_8091F994(Actor* thisx, GlobalContext* globalCtx); +void func_8091F3BC(Actor* thisx, PlayState* play); +void func_8091F994(Actor* thisx, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[1] = { { @@ -127,12 +127,12 @@ void func_8091D7C4(EnFish* this) { this->actor.shape.rot = this->actor.world.rot; } -void func_8091D840(Actor* thisx, GlobalContext* globalCtx, s32 arg2, f32 arg3) { +void func_8091D840(Actor* thisx, PlayState* play, s32 arg2, f32 arg3) { EnFish* this = THIS; s32 i; for (i = 0; i < arg2; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, arg3, arg3, (Rand_ZeroOne() * 0.09f) + 0.06f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, arg3, arg3, (Rand_ZeroOne() * 0.09f) + 0.06f); } } @@ -143,11 +143,11 @@ void func_8091D904(EnFish* this) { this->actor.draw = NULL; } -Actor* func_8091D944(EnFish* this, GlobalContext* globalCtx) { +Actor* func_8091D944(EnFish* this, PlayState* play) { f32 distSq; Actor* retActor = NULL; f32 minDistSq = FLT_MAX; - Actor* foundActor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + Actor* foundActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (foundActor != NULL) { if ((foundActor->id == ACTOR_EN_FISH) && (foundActor->params == ENFISH_2) && @@ -166,16 +166,16 @@ Actor* func_8091D944(EnFish* this, GlobalContext* globalCtx) { return retActor; } -s32 func_8091DA14(EnFish* this, GlobalContext* globalCtx) { - return globalCtx->sceneNum == SCENE_LABO && func_8091D944(this, globalCtx); +s32 func_8091DA14(EnFish* this, PlayState* play) { + return play->sceneNum == SCENE_LABO && func_8091D944(this, play); } -void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Init(Actor* thisx, PlayState* play) { s32 pad; EnFish* this = THIS; s16 sp36 = this->actor.params; - Collider_InitJntSph(globalCtx, &this->collider); + Collider_InitJntSph(play, &this->collider); if (sp36 == ENFISH_2) { this->actor.draw = NULL; this->actor.update = func_8091F994; @@ -205,9 +205,9 @@ void EnFish_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_278 = 0; } - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gameplay_keep_Skel_02F028, &gameplay_keep_Anim_02F0EC, - this->jointTable, this->morphTable, 7); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + SkelAnime_InitFlex(play, &this->skelAnime, &gameplay_keep_Skel_02F028, &gameplay_keep_Anim_02F0EC, this->jointTable, + this->morphTable, 7); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = this->unk_25C * 30.0f; this->unk_244 = Rand_Next() >> 0x10; @@ -224,11 +224,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 = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_8091DD48(EnFish* this) { @@ -241,9 +241,9 @@ void func_8091DD48(EnFish* this) { } } -s32 func_8091DDF4(EnFish* this, GlobalContext* globalCtx) { +s32 func_8091DDF4(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp1C; if (this->actor.xzDistToPlayer < 50.0f) { @@ -274,7 +274,7 @@ void func_8091DEE4(EnFish* this) { this->unkFunc = func_8091DF68; } -void func_8091DF68(Actor* thisx, GlobalContext* globalCtx) { +void func_8091DF68(Actor* thisx, PlayState* play) { EnFish* this = THIS; func_8091DD48(this); @@ -322,7 +322,7 @@ void func_8091E070(EnFish* this) { this->unkFunc = func_8091E128; } -void func_8091E128(Actor* thisx, GlobalContext* globalCtx) { +void func_8091E128(Actor* thisx, PlayState* play) { s32 pad; EnFish* this = THIS; @@ -370,8 +370,8 @@ void func_8091E2E0(EnFish* this) { this->unkFunc = func_8091E34C; } -void func_8091E34C(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_8091E34C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFish* this = THIS; s32 sp3C = thisx->xzDistToPlayer < 60.0f; s32 sp38 = this->unk_276 > 0; @@ -390,17 +390,17 @@ void func_8091E34C(Actor* thisx, GlobalContext* globalCtx2) { this->unk_24C = 1.0f; } else if (sp3C) { this->unk_26A = BINANG_ROT180(thisx->yawTowardsPlayer); - if ((globalCtx->state.frames & 0x10) == 0) { - if ((globalCtx->state.frames & 0x20) == 0) { + if ((play->state.frames & 0x10) == 0) { + if ((play->state.frames & 0x20) == 0) { this->unk_26A += 0x2000; } - } else if ((globalCtx->state.frames & 0x20) == 0) { + } else if ((play->state.frames & 0x20) == 0) { this->unk_26A -= 0x2000; } this->unk_270 = this->unk_266; this->unk_24C = 1.2f; } else if (sp38 != 0) { - if ((globalCtx->state.frames & 0x10) == 0) { + if ((play->state.frames & 0x10) == 0) { s16 temp = BINANG_SUB(thisx->shape.rot.y, this->unk_274); if (temp < 0) { @@ -444,9 +444,9 @@ void func_8091E5EC(EnFish* this) { this->unkFunc = func_8091E658; } -void func_8091E658(Actor* thisx, GlobalContext* globalCtx) { +void func_8091E658(Actor* thisx, PlayState* play) { EnFish* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp38; s32 pad2; @@ -460,7 +460,7 @@ void func_8091E658(Actor* thisx, GlobalContext* globalCtx) { this->unk_26A = Math_Vec3f_Yaw(&thisx->world.pos, &thisx->home.pos); this->unk_24C = 1.0f; } else { - if ((globalCtx->state.frames & 0x40) == 0) { + if ((play->state.frames & 0x40) == 0) { sp32 = BINANG_ADD(thisx->yawTowardsPlayer, 0x9000); } else { sp32 = BINANG_ADD(thisx->yawTowardsPlayer, 0x7000); @@ -499,7 +499,7 @@ void func_8091E810(EnFish* this) { this->unk_240 = 300; } -void func_8091E880(Actor* thisx, GlobalContext* globalCtx) { +void func_8091E880(Actor* thisx, PlayState* play) { EnFish* this = THIS; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.1f, 0.0f); @@ -512,8 +512,8 @@ void func_8091E880(Actor* thisx, GlobalContext* globalCtx) { func_8091E9A4(this); } else if (this->actor.bgCheckFlags & 0x20) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); - func_8091D840(thisx, globalCtx, 10, 15.0f); - if (func_8091DA14(this, globalCtx)) { + func_8091D840(thisx, play, 10, 15.0f); + if (func_8091DA14(this, play)) { func_8091EF30(this); } else { func_8091ECF4(this); @@ -558,9 +558,9 @@ void func_8091E9A4(EnFish* this) { } } -void func_8091EAF0(Actor* thisx, GlobalContext* globalCtx) { +void func_8091EAF0(Actor* thisx, PlayState* play) { EnFish* this = THIS; - s32 sp40 = globalCtx->state.frames; + s32 sp40 = play->state.frames; s16 phi_v1; Math_SmoothStepToF(&this->actor.speedXZ, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); @@ -590,7 +590,7 @@ void func_8091EAF0(Actor* thisx, GlobalContext* globalCtx) { this->actor.draw = NULL; } } else if (this->actor.bgCheckFlags & 0x20) { - if (func_8091DA14(this, globalCtx)) { + if (func_8091DA14(this, play)) { func_8091EF30(this); } else { func_8091ECF4(this); @@ -613,13 +613,13 @@ void func_8091ECF4(EnFish* this) { this->unk_24C = 0.0f; } -void func_8091ED70(Actor* thisx, GlobalContext* globalCtx) { +void func_8091ED70(Actor* thisx, PlayState* play) { EnFish* this = THIS; s32 pad; s16 sp2E; if (this->unk_240 >= 0xBF) { - func_8091D840(thisx, globalCtx, 2, 25.0f); + func_8091D840(thisx, play, 2, 25.0f); } Math_SmoothStepToF(&thisx->speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); @@ -678,10 +678,10 @@ void func_8091EF30(EnFish* this) { this->unk_24C = 0.0f; } -void func_8091EFE8(Actor* thisx, GlobalContext* globalCtx) { +void func_8091EFE8(Actor* thisx, PlayState* play) { EnFish* this = THIS; s32 temp_v0_2; - Actor* sp3C = func_8091D944(this, globalCtx); + Actor* sp3C = func_8091D944(this, play); f32 temp_f0; f32 sp34; f32 sp30; @@ -778,11 +778,11 @@ void func_8091F344(EnFish* this) { this->unk_24C = 0.0f; } -void func_8091F3BC(Actor* thisx, GlobalContext* globalCtx) { +void func_8091F3BC(Actor* thisx, PlayState* play) { static Vec3f D_8091FADC = { 0.0f, 0.04f, 0.09f }; static Vec3f D_8091FAE8 = { 0.5f, 0.1f, 0.15f }; EnFish* this = THIS; - s32 sp40 = globalCtx->gameplayFrames; + s32 sp40 = play->gameplayFrames; Vec3f* sp3C; f32 phi_f0; f32 temp_f2; @@ -825,7 +825,7 @@ void func_8091F3BC(Actor* thisx, GlobalContext* globalCtx) { } } -void func_8091F5A4(Actor* thisx, GlobalContext* globalCtx) { +void func_8091F5A4(Actor* thisx, PlayState* play) { EnFish* this = THIS; Actor* temp_v0_2; s16 temp_v0; @@ -845,7 +845,7 @@ void func_8091F5A4(Actor* thisx, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->unkFunc == NULL) || (this->unkFunc(&this->actor, globalCtx), (this->actor.update != NULL))) { + if ((this->unkFunc == NULL) || (this->unkFunc(&this->actor, play), (this->actor.update != NULL))) { if ((ABS_ALT(BINANG_SUB(this->unk_26A, this->actor.shape.rot.y)) > 0x3000) && (this->unk_270 > 1000)) { this->skelAnime.playSpeed += this->unk_24C; } @@ -853,13 +853,13 @@ void func_8091F5A4(Actor* thisx, GlobalContext* globalCtx) { func_8091D7C4(this); Actor_MoveWithGravity(&this->actor); if (this->unk_248 != 0) { - u32 temp = (globalCtx->sceneNum ^ SCENE_LABO) != 0; + u32 temp = (play->sceneNum ^ SCENE_LABO) != 0; phi_f0 = BREG(1) + 10.0f; if (temp) { phi_f0 = 6.0f; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 17.5f, phi_f0, 0.0f, this->unk_248); + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, phi_f0, 0.0f, this->unk_248); } if ((this->actor.xzDistToPlayer < 70.0f) && (this->unkFunc != func_8091EFE8)) { @@ -869,25 +869,25 @@ void func_8091F5A4(Actor* thisx, GlobalContext* globalCtx) { element->dim.worldSphere.center.y = this->actor.world.pos.y; element->dim.worldSphere.center.z = this->actor.world.pos.z; element->dim.worldSphere.radius = this->unk_25C * 500.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 == ENFISH_0) { Actor_MarkForDeath(&this->actor); } else { func_8091D904(this); } - } else if (func_8091DDF4(this, globalCtx)) { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 80.0f, 25.0f); + } else if (func_8091DDF4(this, play)) { + Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 25.0f); } } } -void func_8091F830(Actor* thisx, GlobalContext* globalCtx) { +void func_8091F830(Actor* thisx, PlayState* play) { EnFish* this = THIS; if (this->actor.params == ENFISH_1) { @@ -899,7 +899,7 @@ void func_8091F830(Actor* thisx, GlobalContext* globalCtx) { this->actor.child = NULL; } - if ((this->unkFunc == NULL) || (this->unkFunc(&this->actor, globalCtx), (this->actor.update != NULL))) { + if ((this->unkFunc == NULL) || (this->unkFunc(&this->actor, play), (this->actor.update != NULL))) { func_8091D7C4(this); Actor_MoveWithGravity(&this->actor); @@ -918,14 +918,14 @@ void func_8091F830(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFish_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = THIS; if (this->unk_242 > 0) { this->unk_242--; - func_8091F830(thisx, globalCtx); + func_8091F830(thisx, play); } else { - func_8091F5A4(thisx, globalCtx); + func_8091F5A4(thisx, play); } if (this->unk_276 > 0) { @@ -933,21 +933,21 @@ void EnFish_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_8091F994(Actor* thisx, GlobalContext* globalCtx) { +void func_8091F994(Actor* thisx, PlayState* play) { } -void EnFish_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFish_Draw(Actor* thisx, PlayState* play) { EnFish* this = THIS; Color_RGB8* colour = &D_8091FA94[this->unk_278]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, colour->r, colour->g, colour->b, 255); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, NULL); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, NULL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 fd35ef6262..4596c79b17 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -5,7 +5,7 @@ struct EnFish; -typedef void (*EnFishUnkFunc)(Actor*, GlobalContext*); +typedef void (*EnFishUnkFunc)(Actor*, PlayState*); enum { /* -1 */ ENFISH_MINUS1 = -1, diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index bceaa72258..1fe0c519f2 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -14,33 +14,33 @@ #define THIS ((EnFish2*)thisx) -void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFish2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFish2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFish2_Init(Actor* thisx, PlayState* play); +void EnFish2_Destroy(Actor* thisx, PlayState* play); +void EnFish2_Update(Actor* thisx, PlayState* play); +void EnFish2_Draw(Actor* thisx, PlayState* play); void func_80B28B5C(EnFish2* this); -void func_80B28C14(EnFish2* this, GlobalContext* globalCtx); +void func_80B28C14(EnFish2* this, PlayState* play); void func_80B29128(EnFish2* this); -void func_80B2913C(EnFish2* this, GlobalContext* globalCtx); +void func_80B2913C(EnFish2* this, PlayState* play); void func_80B29194(EnFish2* this); -void func_80B29250(EnFish2* this, GlobalContext* globalCtx); +void func_80B29250(EnFish2* this, PlayState* play); void func_80B2938C(EnFish2* this); -void func_80B293C4(EnFish2* this, GlobalContext* globalCtx); +void func_80B293C4(EnFish2* this, PlayState* play); void func_80B2951C(EnFish2* this); -void func_80B295A4(EnFish2* this, GlobalContext* globalCtx); +void func_80B295A4(EnFish2* this, PlayState* play); void func_80B29778(EnFish2* this); -void func_80B297FC(EnFish2* this, GlobalContext* globalCtx); -void func_80B29E5C(EnFish2* this, GlobalContext* globalCtx); -void func_80B29EE4(EnFish2* this, GlobalContext* globalCtx); -void func_80B2A01C(EnFish2* this, GlobalContext* globalCtx); -void func_80B2A094(EnFish2* this, GlobalContext* globalCtx); -void func_80B2A23C(EnFish2* this, GlobalContext* globalCtx); +void func_80B297FC(EnFish2* this, PlayState* play); +void func_80B29E5C(EnFish2* this, PlayState* play); +void func_80B29EE4(EnFish2* this, PlayState* play); +void func_80B2A01C(EnFish2* this, PlayState* play); +void func_80B2A094(EnFish2* this, PlayState* play); +void func_80B2A23C(EnFish2* this, PlayState* play); void func_80B2A448(EnFish2* this); -void func_80B2A498(EnFish2* this, GlobalContext* globalCtx); +void func_80B2A498(EnFish2* this, PlayState* play); void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2); -void func_80B2AF80(EnFish2* this, GlobalContext* globalCtx); -void func_80B2B180(EnFish2* this, GlobalContext* globalCtx); +void func_80B2AF80(EnFish2* this, PlayState* play); +void func_80B2B180(EnFish2* this, PlayState* play); static s32 D_80B2B2E0 = 0; static s32 D_80B2B2E4 = 0; @@ -146,7 +146,7 @@ s32 func_80B28478(EnFish2* this) { return false; } -void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFish2_Init(Actor* thisx, PlayState* play) { EnFish2* this = THIS; s32 i; s32 cs; @@ -157,8 +157,8 @@ void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 0) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fb_Skel_006190, &object_fb_Anim_0013AC, - this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &object_fb_Skel_006190, &object_fb_Anim_0013AC, this->jointTable, + this->morphTable, 24); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->unk_344 == 0) { if (gSaveContext.save.weekEventReg[81] & 0x10) { @@ -193,7 +193,7 @@ void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx) { while (cs != -1) { this->unk_2BA[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } // clang-format on - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.modelSphere.radius = 5; this->collider.elements[0].dim.scale = 1.0f; this->collider.elements[0].dim.modelSphere.center.x = 1300; @@ -214,11 +214,11 @@ void EnFish2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFish2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFish2_Destroy(Actor* thisx, PlayState* play) { EnFish2* this = THIS; if (this->actor.params != 1) { - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } } @@ -263,15 +263,15 @@ s32 func_80B288E8(EnFish2* this, Vec3f vec, s32 arg2) { return false; } -s32 func_80B2899C(EnFish2* this, GlobalContext* globalCtx) { - if (BgCheck_SphVsFirstWall(&globalCtx->colCtx, &this->unk_2F4, this->unk_33C)) { +s32 func_80B2899C(EnFish2* this, PlayState* play) { + if (BgCheck_SphVsFirstWall(&play->colCtx, &this->unk_2F4, this->unk_33C)) { return true; } return false; } -void func_80B289DC(EnFish2* this, GlobalContext* globalCtx) { +void func_80B289DC(EnFish2* this, PlayState* play) { WaterBox* sp2C; if (this->unk_2B4 != 0) { @@ -290,7 +290,7 @@ void func_80B289DC(EnFish2* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; } - } else if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + } else if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_334, &sp2C)) { if ((this->unk_334 != BGCHECK_Y_MIN) && (this->actor.world.pos.y < (this->unk_334 - this->unk_2D8))) { this->actor.velocity.y = this->actor.world.rot.x * 0.001f * -0.1f; @@ -323,17 +323,17 @@ void func_80B28B5C(EnFish2* this) { this->actionFunc = func_80B28C14; } -void func_80B28C14(EnFish2* this, GlobalContext* globalCtx) { - Actor* itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +void func_80B28C14(EnFish2* this, PlayState* play) { + Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; WaterBox* waterbox; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80B29128(this); return; } if ((this->unk_2B8 == 0) && (fabsf(this->actor.world.rot.y - this->unk_34A) < 100.0f)) { - if (func_80B2899C(this, globalCtx)) { + if (func_80B2899C(this, play)) { if (this->unk_340 == 0) { this->unk_34A += 0x4000; } else { @@ -343,7 +343,7 @@ void func_80B28C14(EnFish2* this, GlobalContext* globalCtx) { } } - func_80B289DC(this, globalCtx); + func_80B289DC(this, play); if (this->unk_2B6 == 0) { if (this->unk_2B4 == 0) { @@ -369,9 +369,8 @@ void func_80B28C14(EnFish2* this, GlobalContext* globalCtx) { } } - if ((this->unk_334 == BGCHECK_Y_MIN) && - !WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_334, &waterbox)) { + if ((this->unk_334 == BGCHECK_Y_MIN) && !WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, + this->actor.world.pos.z, &this->unk_334, &waterbox)) { this->unk_334 = this->actor.world.pos.y; } @@ -409,7 +408,7 @@ void func_80B28C14(EnFish2* this, GlobalContext* globalCtx) { EnFish2* fish; this->unk_354 = NULL; - fish = (EnFish2*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FISH2, + fish = (EnFish2*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_FISH2, this->unk_324.x, this->unk_324.y, this->unk_324.z, 0, 0, 0, 1); this->unk_354 = fish; if (this->unk_354 != NULL) { @@ -425,7 +424,7 @@ void func_80B28C14(EnFish2* this, GlobalContext* globalCtx) { itemAction = itemAction->next; } - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -433,9 +432,9 @@ void func_80B29128(EnFish2* this) { this->actionFunc = func_80B2913C; } -void func_80B2913C(EnFish2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_80B2913C(EnFish2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80B28B5C(this); } } @@ -460,7 +459,7 @@ void func_80B29194(EnFish2* this) { this->actionFunc = func_80B29250; } -void func_80B29250(EnFish2* this, GlobalContext* globalCtx) { +void func_80B29250(EnFish2* this, PlayState* play) { if (!func_80B28478(this)) { Math_ApproachF(&this->actor.speedXZ, (D_80B2B380[0] - this->unk_330) * 1000.0f, 0.3f, 0.3f); @@ -471,7 +470,7 @@ void func_80B29250(EnFish2* this, GlobalContext* globalCtx) { } func_80B287F4(this, 0); - func_80B289DC(this, globalCtx); + func_80B289DC(this, play); if (func_80B288E8(this, this->unk_300, 0) && (((this->unk_2C8 == 0) && (D_80B2B2E4 == 1)) || (this->unk_2C8 != 0))) { Math_Vec3f_Copy(&this->unk_30C, &this->unk_350->world.pos); @@ -486,7 +485,7 @@ void func_80B2938C(EnFish2* this) { this->actionFunc = func_80B293C4; } -void func_80B293C4(EnFish2* this, GlobalContext* globalCtx) { +void func_80B293C4(EnFish2* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; if (func_80B28478(this) == 0) { @@ -507,7 +506,7 @@ void func_80B293C4(EnFish2* this, GlobalContext* globalCtx) { this->actionFunc = func_80B29EE4; } } else { - func_80B289DC(this, globalCtx); + func_80B289DC(this, play); if (func_80B288E8(this, this->unk_318, 1)) { func_80B2951C(this); } @@ -533,15 +532,14 @@ void func_80B2951C(EnFish2* this) { this->actionFunc = func_80B295A4; } -void func_80B295A4(EnFish2* this, GlobalContext* globalCtx) { +void func_80B295A4(EnFish2* this, PlayState* play) { s32 i; f32 currentFrame = this->skelAnime.curFrame; s32 pad; Vec3f sp60; SkelAnime_Update(&this->skelAnime); - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &globalCtx->view.eye), 1, - 0x1388, 0); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &play->view.eye), 1, 0x1388, 0); Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 0.3f); if (this->unk_2B4 != 0) { Math_Vec3f_Copy(&sp60, &this->unk_318); @@ -549,7 +547,7 @@ void func_80B295A4(EnFish2* this, GlobalContext* globalCtx) { sp60.z += randPlusMinusPoint5Scaled(100.0f); for (i = 0; i < 2; i++) { - EffectSsBubble_Spawn(globalCtx, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); + EffectSsBubble_Spawn(play, &sp60, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); } } else if (this->unk_2CC <= currentFrame) { if (this->unk_2AC != 5) { @@ -579,7 +577,7 @@ void func_80B29778(EnFish2* this) { this->actor.speedXZ = 0.0f; } -void func_80B297FC(EnFish2* this, GlobalContext* globalCtx) { +void func_80B297FC(EnFish2* this, PlayState* play) { f32 phi_f0 = 0.0f; Vec3f sp48; @@ -598,7 +596,7 @@ void func_80B297FC(EnFish2* this, GlobalContext* globalCtx) { } this->unk_34A = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_324); - func_80B289DC(this, globalCtx); + func_80B289DC(this, play); Math_ApproachF(&this->actor.world.pos.x, this->unk_324.x, 0.3f, 3.0f); Math_ApproachF(&this->actor.world.pos.y, this->unk_2D4, 0.3f, 3.0f); Math_ApproachF(&this->actor.world.pos.z, this->unk_324.z, 0.3f, 3.0f); @@ -742,8 +740,8 @@ void func_80B297FC(EnFish2* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_34A, 1, 0xFA0, 0); } -void func_80B29E5C(EnFish2* this, GlobalContext* globalCtx) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void func_80B29E5C(EnFish2* this, PlayState* play) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (prop != NULL) { if (prop->id != ACTOR_EN_FISH2) { @@ -763,7 +761,7 @@ void func_80B29E5C(EnFish2* this, GlobalContext* globalCtx) { } } -void func_80B29EE4(EnFish2* this, GlobalContext* globalCtx) { +void func_80B29EE4(EnFish2* this, PlayState* play) { Vec3f sp2C; if (this->unk_2C4 < 400) { @@ -772,7 +770,7 @@ void func_80B29EE4(EnFish2* this, GlobalContext* globalCtx) { this->unk_338 = 410.0f - this->unk_2C4; Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.3f, 0.3f); Math_ApproachF(&this->unk_350->speedXZ, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); - func_80B289DC(this, globalCtx); + func_80B289DC(this, play); Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); this->unk_34A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp2C); this->unk_348 = Math_Vec3f_Pitch(&this->actor.world.pos, &sp2C); @@ -782,7 +780,7 @@ void func_80B29EE4(EnFish2* this, GlobalContext* globalCtx) { } } -void func_80B2A01C(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2A01C(EnFish2* this, PlayState* play) { if (this->unk_2B4 == 0) { if (!ActorCutscene_GetCanPlayNext(this->unk_2BA[0])) { ActorCutscene_SetIntentToPlay(this->unk_2BA[0]); @@ -794,7 +792,7 @@ void func_80B2A01C(EnFish2* this, GlobalContext* globalCtx) { } } -void func_80B2A094(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2A094(EnFish2* this, PlayState* play) { Vec3f sp2C; if (this->unk_2B4 == 0) { @@ -823,7 +821,7 @@ void func_80B2A094(EnFish2* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_2E8, &sp2C); } - Play_CameraSetAtEye(globalCtx, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); + Play_CameraSetAtEye(play, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); if ((this->unk_350 == NULL) || (this->unk_350->update == NULL)) { this->unk_350 = NULL; this->unk_2B0++; @@ -834,7 +832,7 @@ void func_80B2A094(EnFish2* this, GlobalContext* globalCtx) { } } -void func_80B2A23C(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2A23C(EnFish2* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); @@ -857,7 +855,7 @@ void func_80B2A23C(EnFish2* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_2E8, &sp2C); } - Play_CameraSetAtEye(globalCtx, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); + Play_CameraSetAtEye(play, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); if ((this->unk_2B4 == 0) && (D_80B2B2E4 == 3)) { D_80B2B2E0 = D_80B2B2EC = D_80B2B2E4 = 0; @@ -876,7 +874,7 @@ void func_80B2A448(EnFish2* this) { this->actionFunc = func_80B2A498; } -void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2A498(EnFish2* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; Vec3f sp80; @@ -884,7 +882,7 @@ void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { Actor* temp_v0; Math_Vec3f_Copy(&sp80, &this->unk_318); - temp_v0 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_COL_MAN, sp80.x, sp80.y, sp80.z, 0, + temp_v0 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_COL_MAN, sp80.x, sp80.y, sp80.z, 0, this->actor.world.rot.y, 0, 0); if (temp_v0 != NULL) { temp_v0->speedXZ = 4.0f; @@ -903,19 +901,19 @@ void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 31.0f))) { WaterBox* sp78; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_334, &sp78)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_334, + &sp78)) { Vec3f sp6C; s32 i; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp6C, &this->actor.world.pos); sp6C.x += randPlusMinusPoint5Scaled(70.0f); sp6C.y = this->unk_334 + 10.0f; sp6C.z += randPlusMinusPoint5Scaled(70.0f); - EffectSsGSplash_Spawn(globalCtx, &sp6C, NULL, NULL, 0, (s32)randPlusMinusPoint5Scaled(50.0f) + 350); + EffectSsGSplash_Spawn(play, &sp6C, NULL, NULL, 0, (s32)randPlusMinusPoint5Scaled(50.0f) + 350); } } } @@ -929,11 +927,11 @@ void func_80B2A498(EnFish2* this, GlobalContext* globalCtx) { } } -void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnFish2_Update(Actor* thisx, PlayState* play2) { static f32 D_80B2B3A8[] = { 0.0f, 40.0f, -40.0f, 0.0f, 0.0f, 0.0f, }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnFish2* this = THIS; if ((this->actionFunc != func_80B295A4) && (this->actor.params != 1)) { @@ -953,7 +951,7 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2B4--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 0); if (this->actor.params != 1) { @@ -968,18 +966,18 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - if ((globalCtx->gameplayFrames % 8) == 0) { + if ((play->gameplayFrames % 8) == 0) { Math_Vec3f_Copy(&sp5C, &this->unk_324); sp5C.x += randPlusMinusPoint5Scaled(100.0f); sp5C.y = this->actor.floorHeight; sp5C.z += randPlusMinusPoint5Scaled(100.0f); for (i = 0; i < (s32)randPlusMinusPoint5Scaled(5.0f) + 10; i++) { - EffectSsBubble_Spawn(globalCtx, &sp5C, 0, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); + EffectSsBubble_Spawn(play, &sp5C, 0, 5.0f, 5.0f, Rand_ZeroFloat(this->unk_330 * 4.0f) + 0.1f); } } - func_80B2AF80(this, globalCtx); + func_80B2AF80(this, play); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); Math_Vec3f_Copy(&this->unk_2F4, &this->actor.world.pos); this->unk_2F4.x += (Math_SinS(this->actor.world.rot.y) * 25.0f) - this->unk_330; @@ -987,7 +985,7 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_33C = 25.0f - ((this->unk_330 - 0.01f) * 1000.0f); Actor_SetScale(&this->actor, this->unk_330); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0, 15.0f, 10.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 0, 15.0f, 10.0f, 7); if (this->actor.params != 2) { this->unk_2D4 = this->actor.floorHeight + (this->unk_330 * 1000.0f); @@ -996,7 +994,7 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y = this->unk_2D4 + 0.1f; } - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_334, &sp6C)) { if ((this->unk_334 != BGCHECK_Y_MIN) && (this->unk_334 - this->unk_2D8 < this->actor.world.pos.y)) { this->actor.world.pos.y = this->unk_334 - this->unk_2D8; @@ -1009,8 +1007,8 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { f32 phi_f20 = 0; WaterBox* sp4C; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, - this->actor.world.pos.z, &this->unk_334, &sp4C)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &this->unk_334, &sp4C)) { phi_f20 = D_80B2B3A8[temp_s0_2] + (this->unk_334 - this->unk_2D8); phi_f2 = D_80B2B3A8[temp_s0_2 + 1] + this->unk_2D4; } @@ -1029,14 +1027,13 @@ void EnFish2_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (D_80B2B2E8 == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } } -s32 EnFish2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnFish2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFish2* this = THIS; if ((limbIndex == 20) || (limbIndex == 21)) { @@ -1046,22 +1043,22 @@ s32 EnFish2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnFish2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFish2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFish2* this = THIS; s32 pad; if ((limbIndex == 20) || (limbIndex == 21)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == 14) { @@ -1075,14 +1072,14 @@ void EnFish2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Collider_UpdateSpheres(limbIndex, &this->collider); } -void EnFish2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFish2_Draw(Actor* thisx, PlayState* play) { EnFish2* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFish2_OverrideLimbDraw, EnFish2_PostLimbDraw, &this->actor); - func_80B2B180(this, globalCtx); + func_80B2B180(this, play); } void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) { @@ -1113,7 +1110,7 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) { } } -void func_80B2AF80(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2AF80(EnFish2* this, PlayState* play) { EnFish2UnkStruct* ptr = &this->unk_3F8[0]; WaterBox* sp90; f32 sp8C; @@ -1133,7 +1130,7 @@ void func_80B2AF80(EnFish2* this, GlobalContext* globalCtx) { ptr->unk_04.y += 1.0f + ((Rand_ZeroOne() - 0.3f) * 1.2f); ptr->unk_04.z += (0.3f + (Rand_ZeroOne() * 0.5f)) - 0.55f; sp8C = ptr->unk_04.y; - if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, ptr->unk_04.x, ptr->unk_04.z, &sp8C, &sp90)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_04.x, ptr->unk_04.z, &sp8C, &sp90)) { ptr->unk_00 = 0; } else if (sp8C < ptr->unk_04.y) { Vec3f sp7C; @@ -1141,7 +1138,7 @@ void func_80B2AF80(EnFish2* this, GlobalContext* globalCtx) { sp7C.x = ptr->unk_04.x; sp7C.y = sp8C; sp7C.z = ptr->unk_04.z; - EffectSsGRipple_Spawn(globalCtx, &sp7C, 0, 80, 0); + EffectSsGRipple_Spawn(play, &sp7C, 0, 80, 0); ptr->unk_00 = 0; } } @@ -1149,10 +1146,10 @@ void func_80B2AF80(EnFish2* this, GlobalContext* globalCtx) { } } -void func_80B2B180(EnFish2* this, GlobalContext* globalCtx) { +void func_80B2B180(EnFish2* this, PlayState* play) { s16 i; EnFish2UnkStruct* ptr; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -1172,5 +1169,5 @@ void func_80B2B180(EnFish2* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h index 7216d00c8b..ca3ad2bc87 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -5,7 +5,7 @@ struct EnFish2; -typedef void (*EnFish2ActionFunc)(struct EnFish2*, GlobalContext*); +typedef void (*EnFish2ActionFunc)(struct EnFish2*, PlayState*); typedef struct { /* 0x00 */ u8 unk_00; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index dfd978d103..587e1838c8 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -13,15 +13,15 @@ #define THIS ((EnFishing*)thisx) -#define WATER_SURFACE_Y(globalCtx) globalCtx->colCtx.colHeader->waterBoxes->minPos.y +#define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->minPos.y -void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFishing_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx); -void EnFishing_DrawFish(Actor* thisx, GlobalContext* globalCtx); +void EnFishing_Init(Actor* thisx, PlayState* play); +void EnFishing_Destroy(Actor* thisx, PlayState* play); +void EnFishing_UpdateFish(Actor* thisx, PlayState* play); +void EnFishing_DrawFish(Actor* thisx, PlayState* play); -void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx); -void EnFishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx); +void EnFishing_UpdateOwner(Actor* thisx, PlayState* play); +void EnFishing_DrawOwner(Actor* thisx, PlayState* play); typedef struct { /* 0x00 */ u8 unk_00; @@ -724,7 +724,7 @@ FishingPropInit sPondPropInits[POND_PROP_COUNT + 1] = { { FS_PROP_INIT_STOP, { 0 } }, }; -void EnFishing_InitPondProps(EnFishing* this, GlobalContext* globalCtx) { +void EnFishing_InitPondProps(EnFishing* this, PlayState* play) { FishingProp* prop = &sPondProps[0]; Vec3f colliderPos; s16 i; @@ -794,8 +794,8 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), }; -void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFishing_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFishing* this = THIS; u16 fishCount; @@ -810,12 +810,12 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { D_809171C8 = 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 = EnFishing_UpdateOwner; @@ -844,7 +844,7 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } D_8090CD04 = 20; - globalCtx->specialEffects = sFishingEffects; + play->specialEffects = sFishingEffects; REG(15) = 1; // gTimeIncrement in OoT D_809171FC = 0; D_809171F6 = 10; @@ -865,10 +865,10 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { D_809171D1 = (gSaveContext.save.unk_EE4 & 0xFF0000) >> 0x10; if ((D_809171D1 & 7) == 7) { - globalCtx->roomCtx.unk7A[0] = 90; + play->roomCtx.unk7A[0] = 90; D_809171CA = 1; } else { - globalCtx->roomCtx.unk7A[0] = 40; + play->roomCtx.unk7A[0] = 40; D_809171CA = 0; } @@ -921,10 +921,10 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } - EnFishing_InitPondProps(this, globalCtx); - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_KANBAN, 53.0f, -17.0f, 982.0f, 0, 0, 0, + EnFishing_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_EN_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); if ((D_809171D1 & 3) == 3) { if (sLinkAge != 1) { @@ -937,7 +937,7 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } for (i = 0; i < fishCount; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, sFishInits[i].pos.z, 0, Rand_ZeroFloat(0x10000), 0, 100 + i); } @@ -947,10 +947,10 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { thisx->bgCheckFlags |= 0x800; // Added in MM 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); } @@ -958,10 +958,10 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->params == 200) { this->unk_150 = 100; - func_800BC154(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP); + func_800BC154(play, &play->actorCtx, thisx, ACTORCAT_PROP); thisx->targetMode = 0; thisx->flags |= 9; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } else { this->unk_150 = 10; this->unk_152 = 10; @@ -982,20 +982,20 @@ void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnFishing_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFishing_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFishing* this = THIS; - 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 EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { f32 rippleY; s16 i; @@ -1028,7 +1028,7 @@ void EnFishing_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; @@ -1039,7 +1039,7 @@ void EnFishing_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; } @@ -1050,7 +1050,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.3f) { Vec3f pos = effect->pos; pos.y = rippleY; - EnFishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 20.0f, 60.0f, 150, 90); + EnFishing_SpawnRipple(NULL, play->specialEffects, &pos, 20.0f, 60.0f, 150, 90); } } } else if (effect->type == FS_EFF_DUST_SPLASH) { @@ -1059,25 +1059,25 @@ void EnFishing_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); - EnFishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 40.0f, 110.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + EnFishing_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 = SQXZ(effect->pos); 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 = 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; @@ -1107,7 +1107,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { Math_ApproachS(&sEffOwnerHatRot.z, -0x4000, 20, 100); sqDistXZ = SQXZ(effect->pos); - 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; @@ -1115,8 +1115,8 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { if ((effect->timer % 16) == 0) { Vec3f pos = effect->pos; - pos.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(NULL, globalCtx->specialEffects, &pos, 30.0f, 300.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(NULL, play->specialEffects, &pos, 30.0f, 300.0f, 150, 90); } if (effect->unk_2C >= 0) { @@ -1124,12 +1124,12 @@ void EnFishing_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) == 5)) { - if (Message_ShouldAdvance(globalCtx) || Message_GetState(&globalCtx->msgCtx) == 0) { - func_801477B4(globalCtx); + if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == 5)) { + if (Message_ShouldAdvance(play) || Message_GetState(&play->msgCtx) == 0) { + func_801477B4(play); func_801159EC(-50); effect->unk_2C = -1; } @@ -1141,14 +1141,14 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) { } } -void EnFishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { +void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) { u8 flag = 0; f32 rotY; s16 i; s32 pad; FishingEffect* firstEffect = effect; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -1167,8 +1167,7 @@ void EnFishing_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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleVtxDL); } @@ -1188,11 +1187,10 @@ void EnFishing_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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingDustSplashVtxDL); } @@ -1212,15 +1210,14 @@ void EnFishing_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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWaterDustVtxDL); } @@ -1239,11 +1236,10 @@ void EnFishing_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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingBubbleVtxDL); } @@ -1267,15 +1263,14 @@ void EnFishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { Matrix_RotateZF(effect->unk_3C, MTXMODE_APPLY); Matrix_Scale(0.002f, 1.0f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainDropVtxDL); } effect++; } - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); effect = firstEffect + 30; flag = 0; @@ -1291,8 +1286,7 @@ void EnFishing_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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRippleVtxDL); } @@ -1316,12 +1310,11 @@ void EnFishing_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_RotateYF(rotY, MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingRainSplashVtxDL); } @@ -1337,34 +1330,34 @@ void EnFishing_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_RotateXFApply(M_PI / 2); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFishing_DrawStreamSplash(GlobalContext* globalCtx) { +void EnFishing_DrawStreamSplash(PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingStreamSplashDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } s32 func_808FEF70(Vec3f* vec) { @@ -1378,7 +1371,7 @@ s32 func_808FEF70(Vec3f* vec) { return false; } -void EnFishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { +void EnFishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, Vec3f* unk) { s32 i; s32 k; f32 dx; @@ -1441,16 +1434,16 @@ void EnFishing_UpdateLine(GlobalContext* globalCtx, Vec3f* basePos, Vec3f* pos, 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_80917206 == 2) { f32 phi_f2; 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) { u8 temp; @@ -1537,7 +1530,7 @@ void EnFishing_UpdateLinePos(Vec3f* pos) { } } -void EnFishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { +void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookIndex) { f32 dx; f32 dy; f32 dz; @@ -1547,15 +1540,15 @@ void EnFishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, 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); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); - if ((D_8090CD14 == 3) && ((pos->y > WATER_SURFACE_Y(globalCtx)) || ((D_8090CD0C != 0) && hookIndex))) { + if ((D_8090CD14 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || ((D_8090CD0C != 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; @@ -1590,12 +1583,12 @@ void EnFishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, Matrix_Scale(0.0039999997f, 0.0039999997f, 0.005f, MTXMODE_APPLY); Matrix_RotateYF(M_PI, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); if ((hookIndex == 1) && (D_8090CD0C != 0)) { @@ -1604,7 +1597,7 @@ void EnFishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, Matrix_Push(); if (D_8090CD10 != 0) { - FishingEffect* effect = globalCtx->specialEffects; + FishingEffect* effect = play->specialEffects; MtxF mf; Matrix_MultVec3f(&sZeroVec, &effect->pos); @@ -1624,16 +1617,16 @@ void EnFishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXFApply(M_PI / 2); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFishing_UpdateSinkingLure(GlobalContext* globalCtx) { +void EnFishing_UpdateSinkingLure(PlayState* play) { s32 i; f32 dx; f32 dy; @@ -1648,7 +1641,7 @@ void EnFishing_UpdateSinkingLure(GlobalContext* globalCtx) { Vec3f sp88; f32 offsetX; f32 offsetZ; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* pos; s32 pad; @@ -1658,7 +1651,7 @@ void EnFishing_UpdateSinkingLure(GlobalContext* globalCtx) { if (D_8090CD54 != 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; @@ -1705,16 +1698,16 @@ f32 sSinkingLureSizes[] = { 0.9f, 0.85f, 0.8f, 0.7f, 0.8f, 1.0f, 1.2f, 1.1f, 1.0f, 0.8f, }; -void EnFishing_DrawSinkingLure(GlobalContext* globalCtx) { +void EnFishing_DrawSinkingLure(PlayState* play) { s16 i; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - EnFishing_UpdateSinkingLure(globalCtx); + EnFishing_UpdateSinkingLure(play); - if (sLurePos.y < WATER_SURFACE_Y(globalCtx)) { - func_8012C28C(globalCtx->state.gfxCtx); + if (sLurePos.y < WATER_SURFACE_Y(play)) { + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentSetupDL); @@ -1723,15 +1716,15 @@ void EnFishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80911F20] * 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), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentVtxDL); } } } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentSetupDL); @@ -1740,37 +1733,37 @@ void EnFishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80911F20] * 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), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentVtxDL); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* lineRot) { +void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) { Vec3f posSrc; Vec3f posStep; Vec3f hookPos[2]; s32 i; s32 spB4 = D_809101C0; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Push(); if (D_8090CD54 != 0) { Vec3f posTemp = sLurePos; sLurePos = sSinkingLureBasePos; - EnFishing_DrawSinkingLure(globalCtx); + EnFishing_DrawSinkingLure(play); sLurePos = posTemp; } @@ -1806,9 +1799,9 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY); Matrix_RotateYF(M_PI / 2, MTXMODE_APPLY); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureFloatDL); posSrc.x = -850.0f; @@ -1819,12 +1812,12 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* posSrc.x = 500.0f; posSrc.z = -300.0f; Matrix_MultVec3f(&posSrc, &hookPos[0]); - EnFishing_DrawLureHook(globalCtx, &hookPos[0], &sLureHookRefPos[0], 0); + EnFishing_DrawLureHook(play, &hookPos[0], &sLureHookRefPos[0], 0); posSrc.x = 2100.0f; posSrc.z = -50.0f; Matrix_MultVec3f(&posSrc, &hookPos[1]); - EnFishing_DrawLureHook(globalCtx, &hookPos[1], &sLureHookRefPos[1], 1); + EnFishing_DrawLureHook(play, &hookPos[1], &sLureHookRefPos[1], 1); } POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); @@ -1855,7 +1848,7 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* Matrix_RotateXFApply(rx); Matrix_Scale(D_809101C8, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineVtxDL); } else { for (i = spB4; i < LINE_SEG_COUNT - 1; i++) { @@ -1882,7 +1875,7 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* Matrix_RotateXFApply(rx); Matrix_Scale(D_809101C8, 1.0f, dist, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineVtxDL); break; @@ -1893,16 +1886,15 @@ void EnFishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* Matrix_RotateXFApply((lineRot + i)->x); Matrix_Scale(D_809101C8, 1.0f, 0.005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLineVtxDL); } } Matrix_Pop(); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } f32 sRodScales[22] = { @@ -1918,16 +1910,16 @@ f32 sRodBendRatios[22] = { Vec3f sRodTipOffset = { 0.0f, 0.0f, 0.0f }; -void EnFishing_DrawRod(GlobalContext* globalCtx) { +void EnFishing_DrawRod(PlayState* play) { s16 i; f32 spC8; f32 spC4; f32 spC0; - Input* input = CONTROLLER1(&globalCtx->state); - Player* player = GET_PLAYER(globalCtx); + Input* input = CONTROLLER1(&play->state); + Player* player = GET_PLAYER(play); s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (D_80911E28 != 0) { D_80911E28--; @@ -1995,7 +1987,7 @@ void EnFishing_DrawRod(GlobalContext* globalCtx) { } } - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFishingRodSetupDL); @@ -2031,7 +2023,7 @@ void EnFishing_DrawRod(GlobalContext* globalCtx) { Matrix_Push(); Matrix_Scale(sRodScales[i], sRodScales[i], 0.52f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (i < 5) { gDPLoadTextureBlock(POLY_OPA_DISP++, &gFishingRodSegmentBlackTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 8, 0, @@ -2054,12 +2046,12 @@ void EnFishing_DrawRod(GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Vec3f D_8090D614 = { 0.0f, 0.0f, 0.0f }; -void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { +void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { f32 spE4; f32 spE0; s16 i; @@ -2070,12 +2062,12 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { f32 phi_f16; f32 spC8; f32 phi_f0; - 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 = CONTROLLER1(&globalCtx->state); + Input* input = CONTROLLER1(&play->state); D_809171FE++; @@ -2144,7 +2136,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sLurePos, &D_8090D614, &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sLurePos, &D_8090D614, &sProjectedW); if (D_8090CD14 == 0) { Math_ApproachF(&D_80917258, -800.0f, 1.0f, 20.0f); @@ -2166,7 +2158,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { if (D_80917204 == 0) { if ((D_80917200 == 0) && (player->unk_B28 == 1)) { D_80917204 = 37; - func_801477B4(globalCtx); + func_801477B4(play); } } else { sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; @@ -2237,7 +2229,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { Vec3f sp80 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); this->actor.world.pos = sp80; if (this->actor.bgCheckFlags & 0x10) { @@ -2256,7 +2248,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { } } - spE0 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(globalCtx); + spE0 = ((sqrtf(spC8) - 920.0f) * 0.11f) + WATER_SURFACE_Y(play); if (sLurePos.y <= spE0) { sLurePos.y = spE0; D_80917238.x = D_80917238.y = D_80917238.z = 0.0f; @@ -2268,7 +2260,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { NA_SE_EN_WIZ_UNARI - SFX_FLAG); // changed from NA_SE_EN_FANTOM_FLOAT in OoT } } else { - f32 sp7C = WATER_SURFACE_Y(globalCtx); + f32 sp7C = WATER_SURFACE_Y(play); f32 sp78; if (sLurePos.y <= sp7C) { @@ -2282,7 +2274,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { D_809171F2 = 10; } - if ((sLurePos.y <= sp7C) && (sp7C < spE0) && (sp7C == WATER_SURFACE_Y(globalCtx))) { + if ((sLurePos.y <= sp7C) && (sp7C < spE0) && (sp7C == WATER_SURFACE_Y(play))) { D_80917264 = 10; Audio_PlaySfxAtPos(&D_8090D614, NA_SE_EV_BOMB_DROP_WATER); D_80917248.y = 0.0f; @@ -2298,15 +2290,15 @@ void EnFishing_UpdateLure(EnFishing* 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); - EnFishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &spA8, &sp9C, + EnFishing_SpawnDustSplash(NULL, play->specialEffects, &spA8, &sp9C, Rand_ZeroFloat(0.02f) + 0.025f); } spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(NULL, play->specialEffects, &spA8, 100.0f, 800.0f, 150, 90); } } else { Math_ApproachZeroF(&D_809101C4, 1.0f, 0.05f); @@ -2324,13 +2316,13 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { break; case 2: - if (sLurePos.y <= WATER_SURFACE_Y(globalCtx)) { + if (sLurePos.y <= WATER_SURFACE_Y(play)) { sLurePos.y += D_80917238.y; Math_ApproachZeroF(&D_80917238.y, 1.0f, 1.0f); if (D_80917206 != 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); } } @@ -2367,7 +2359,7 @@ void EnFishing_UpdateLure(EnFishing* 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)) { @@ -2443,7 +2435,7 @@ void EnFishing_UpdateLure(EnFishing* 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; @@ -2495,13 +2487,13 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { } else { D_80917254 = -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_80917206 == 2) { s8 requiredScopeTemp; sp58 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x44); this->actor.world.pos = sp58; D_80917278.y += -0.5f; @@ -2516,7 +2508,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { D_80917270 = 1; } } else { - D_80917278.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(globalCtx)) * 0.2f; + D_80917278.y = fabsf(sReelLinePos[LINE_SEG_COUNT - 1].y - WATER_SURFACE_Y(play)) * 0.2f; if (D_80917278.y > 1.5f) { D_80917278.y = 1.5f; } @@ -2544,7 +2536,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { Math_ApproachF(&D_809101D0, 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_809101C4, 3.0f, 1.0f, 0.2f); } else { Math_ApproachF(&D_809101C4, 1.0f, 1.0f, 0.2f); @@ -2570,8 +2562,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { D_8090CD4C = 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))) { s8 phi_v0 = 63; if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_809101B4 > 1.0f)) { @@ -2580,8 +2571,8 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { if ((D_809171FE & phi_v0) == 0) { spA8 = sLurePos; - spA8.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(NULL, globalCtx->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); + spA8.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(NULL, play->specialEffects, &spA8, 30.0f, 300.0f, 150, 90); } } } break; // must be outside of the block @@ -2620,7 +2611,7 @@ void EnFishing_UpdateLure(EnFishing* this, GlobalContext* globalCtx) { } } -s32 func_809033F0(EnFishing* this, GlobalContext* globalCtx, u8 ignorePosCheck) { +s32 func_809033F0(EnFishing* this, PlayState* play, u8 ignorePosCheck) { s16 i; s16 count; f32 scale; @@ -2629,7 +2620,7 @@ s32 func_809033F0(EnFishing* 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; } @@ -2654,24 +2645,24 @@ s32 func_809033F0(EnFishing* 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; - EnFishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + EnFishing_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); - EnFishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 100.0f, 800.0f, 150, 90); + EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 100.0f, 800.0f, 150, 90); this->unk_149 = 30; return true; } -void func_809036BC(EnFishing* this, GlobalContext* globalCtx) { +void func_809036BC(EnFishing* this, PlayState* play) { s16 count; s16 i; f32 scale; @@ -2704,7 +2695,7 @@ void func_809036BC(EnFishing* this, GlobalContext* globalCtx) { pos.y += (vel.y * 3.0f); pos.z += (vel.z * 3.0f); - EnFishing_SpawnDustSplash(&this->actor.projectedPos, globalCtx->specialEffects, &pos, &vel, + EnFishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } } @@ -2799,7 +2790,7 @@ void func_80903C60(EnFishing* this, u8 arg1) { Actor_PlaySfxAtPos(&this->actor, sfxId); } -void EnFishing_HandleAquariumDialog(EnFishing* this, GlobalContext* globalCtx) { +void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { if (sLinkAge == 1) { if (gSaveContext.save.unk_EE4 & 0x7F) { if (gSaveContext.save.unk_EE4 & 0x80) { @@ -2824,23 +2815,23 @@ void EnFishing_HandleAquariumDialog(EnFishing* this, GlobalContext* globalCtx) { if (this->unk_1CC == 0) { this->actor.flags |= ACTOR_FLAG_1; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { D_8090CCF8 = D_809171CC; this->unk_1CB = 1; } else { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } else { this->unk_1CC--; this->actor.flags &= ~ACTOR_FLAG_1; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { this->unk_1CB = 0; this->unk_1CC = 20; } } -void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { +void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { s16 i; s16 sp134 = 10; f32 sp130; @@ -2862,9 +2853,9 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { s16 spF0; s16 spEE; EnFishing* this = THIS; - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(&globalCtx->state); + PlayState* play = play2; + Player* player = GET_PLAYER(play); + Input* input = CONTROLLER1(&play->state); f32 spD8; f32 phi_f0; f32 phi_f2; @@ -2931,7 +2922,7 @@ void EnFishing_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 = 1.5f; phi_f2 = 3.0f; } @@ -2992,7 +2983,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { switch (this->unk_150) { case 100: - EnFishing_HandleAquariumDialog(this, globalCtx); + EnFishing_HandleAquariumDialog(this, play); this->actor.uncullZoneForward = 500.0f; this->actor.uncullZoneScale = 300.0f; @@ -3001,8 +2992,8 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.z - 50.0f, 255, 255, 255, 255); this->unk_1A4 = D_809171CC; - sp100.y = Math_SinS(globalCtx->gameplayFrames * 300); - sp100.z = Math_SinS(globalCtx->gameplayFrames * 230) * 2.0f; + sp100.y = Math_SinS(play->gameplayFrames * 300); + sp100.z = Math_SinS(play->gameplayFrames * 230) * 2.0f; 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; @@ -3012,7 +3003,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { spC4.x = randPlusMinusPoint5Scaled(5.0f) + 130.0f; spC4.y = 40.0f; spC4.z = randPlusMinusPoint5Scaled(5.0f) + 1280.0f; - EnFishing_SpawnBubble(NULL, globalCtx->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); + EnFishing_SpawnBubble(NULL, play->specialEffects, &spC4, Rand_ZeroFloat(0.02f) + 0.03f, 1); } Math_ApproachS(&this->unk_16A, (Math_SinS(this->unk_154 * 0x800) * 2500.0f) + 2500.0f, 2, 0x7D0); @@ -3064,7 +3055,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_172[1] = 50; } - if (Message_GetState(&globalCtx->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == 0) { if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= 0xC01B)) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; @@ -3087,7 +3078,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_150 = 1; this->unk_172[0] = Rand_ZeroFloat(30.0f) + 10.0f; this->unk_1AC.x = randPlusMinusPoint5Scaled(300.0f); - this->unk_1AC.y = (WATER_SURFACE_Y(globalCtx) - 50.0f) - Rand_ZeroFloat(50.0f); + this->unk_1AC.y = (WATER_SURFACE_Y(play) - 50.0f) - Rand_ZeroFloat(50.0f); this->unk_1AC.z = randPlusMinusPoint5Scaled(300.0f); this->unk_188 = 1.0f; this->unk_18C = 2000.0f; @@ -3149,7 +3140,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_18C = 4000.0f; Math_ApproachF(&this->unk_1A8, 4096.0f, 1.0f, 256.0f); - if ((globalCtx->gameplayFrames % 32) == 0) { + if ((play->gameplayFrames % 32) == 0) { this->unk_1AC.x = randPlusMinusPoint5Scaled(600.0f); this->unk_1AC.z = randPlusMinusPoint5Scaled(600.0f); this->unk_1AC.y = -120.0f; @@ -3172,7 +3163,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } else if (((this->unk_19C & 0x7FF) == 0) && (this->unk_19C < 15000)) { this->unk_150 = -2; this->actor.world.rot.x = this->actor.shape.rot.x = 0; - this->unk_1AC.y = WATER_SURFACE_Y(globalCtx) + 10.0f; + this->unk_1AC.y = WATER_SURFACE_Y(play) + 10.0f; this->unk_1AC.x = Rand_ZeroFloat(50.0f); this->unk_1AC.z = Rand_ZeroFloat(50.0f); } @@ -3190,13 +3181,12 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_15E, -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_1AC.x = Rand_ZeroFloat(300.0f); this->unk_1AC.z = Rand_ZeroFloat(300.0f); this->unk_1AC.y = this->actor.floorHeight + 10.0f; @@ -3204,11 +3194,11 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A8 = 0.0f; spB8 = this->fishMouthPos; - spB8.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 10.0f, - 300.0f, 150, 90); - EnFishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &spB8, 30.0f, - 400.0f, 150, 90); + spB8.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 10.0f, 300.0f, + 150, 90); + EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 30.0f, 400.0f, + 150, 90); Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_CATCH_BOOMERANG); break; @@ -3387,7 +3377,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1A8 = 4096.0f; Math_ApproachF(&this->actor.speedXZ, this->unk_180 * 0.8f, 1.0f, 1.0f); - if ((D_8090CD14 != 3) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_8090CD14 != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_150 = this->unk_152; this->unk_172[0] = 0; @@ -3412,7 +3402,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1AC = sLurePos; Math_ApproachF(&this->actor.speedXZ, this->unk_180, 1.0f, 1.0f); - if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_172[0] = 0; @@ -3422,7 +3412,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } else if (sp124 < 10.0f) { s16 phi_v0; - if (func_809033F0(this, globalCtx, false)) { + if (func_809033F0(this, play, false)) { func_80903C60(this, 0); } @@ -3477,7 +3467,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_1AC = sLurePos; Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 1.0f); - if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(globalCtx) + 5.0f)) || + if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { this->unk_172[0] = 0; @@ -3485,12 +3475,12 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_150 = this->unk_152; this->unk_18C = 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)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_JUMP_OUT_WATER); play_sound(NA_SE_PL_CATCH_BOOMERANG); } - func_809033F0(this, globalCtx, false); + func_809033F0(this, play, false); this->unk_150 = 5; this->unk_188 = 1.2f; this->unk_18C = 5000.0f; @@ -3567,7 +3557,7 @@ void EnFishing_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)) { u8 phi_v0_2; f32 spA4; @@ -3783,7 +3773,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { player->unk_B28 = 3; func_8013EC44(0.0f, 1, 3, 1); D_809171D8++; - Cutscene_Start(globalCtx, &globalCtx->csCtx); + Cutscene_Start(play, &play->csCtx); D_8090CD4C = 100; D_80911F48 = 45.0f; D_8090CD14 = 5; @@ -3791,9 +3781,9 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_18C = 500.0f; this->unk_194 = 5000.0f; - if (this->actor.world.pos.y <= WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y <= WATER_SURFACE_Y(play)) { func_80903C60(this, 1); - func_809033F0(this, globalCtx, true); + func_809033F0(this, play, true); } goto case_6; } @@ -3865,10 +3855,10 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_172[0] <= 50) { switch (this->unk_1CD) { case 0: - if ((Message_GetState(&globalCtx->msgCtx) == 4) || Message_GetState(&globalCtx->msgCtx) == 0) { - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + if (play->msgCtx.choiceIndex == 0) { if (D_8090CCF0 == 0.0f) { D_8090CCF0 = this->unk_1A4; D_809171D0 = this->unk_148; @@ -3878,7 +3868,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { ((s16)this->unk_1A4 < (s16)D_8090CCF0)) { this->unk_1CD = 1; this->unk_172[0] = 0x3C; - Message_StartTextbox(globalCtx, 0x4098, NULL); + Message_StartTextbox(play, 0x4098, NULL); } else { f32 temp1 = D_8090CCF0; s16 temp2 = D_809171D0; @@ -3896,10 +3886,10 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == 4) || Message_GetState(&globalCtx->msgCtx) == 0) { - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - if (globalCtx->msgCtx.choiceIndex != 0) { + if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + if (play->msgCtx.choiceIndex != 0) { f32 temp1 = D_8090CCF0; s16 temp2 = D_809171D0; D_8090CCF0 = this->unk_1A4; @@ -3923,14 +3913,13 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->unk_172[0] = 0; this->unk_188 = 1.0f; this->unk_18C = 2000.0f; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); if (this->unk_148 == 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); } } @@ -3964,7 +3953,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { if (sp124 < 20.0f) { Math_ApproachS(&this->unk_168, 0x4E20, 2, 0xFA0); - if ((this->unk_172[2] == 0) && func_809033F0(this, globalCtx, false)) { + if ((this->unk_172[2] == 0) && func_809033F0(this, play, false)) { func_80903C60(this, Rand_ZeroFloat(1.99f)); this->unk_172[2] = Rand_ZeroFloat(20.0f) + 20.0f; } @@ -3988,7 +3977,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_16A, (Math_SinS(this->unk_154 * 0x1000) * 5000.0f) + 5000.0f, 2, 0x7D0); if (this->unk_150 != 6) { - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_188 = 1.5f; this->unk_18C = 5000.0f; @@ -4065,32 +4054,31 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->unk_150 != -1) && (this->unk_150 != -2) && (this->unk_150 != -25)) { - if ((this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) && - (this->actor.prevPos.y <= WATER_SURFACE_Y(globalCtx))) { - func_809033F0(this, globalCtx, true); + if ((this->actor.world.pos.y > WATER_SURFACE_Y(play)) && (this->actor.prevPos.y <= WATER_SURFACE_Y(play))) { + func_809033F0(this, play, true); func_80903C60(this, 1); this->unk_17C = this->actor.velocity.y; this->actor.velocity.y = 0.0f; this->unk_162 = randPlusMinusPoint5Scaled(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_17C < -5.0f) { this->unk_17C = -5.0f; } this->actor.world.rot.x = -0xFA0; - func_809033F0(this, globalCtx, true); + func_809033F0(this, play, true); this->unk_1CA = 20; func_80903C60(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_154 & 1) && + if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && + (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && !(this->unk_154 & 1) && (this->actor.speedXZ > 0.0f)) { Vec3f pos = this->actor.world.pos; - pos.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(&this->actor.projectedPos, globalCtx->specialEffects, &pos, 80.0f, 500.0f, 150, 90); + pos.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 80.0f, 500.0f, 150, 90); } if ((this->actor.speedXZ > 0.0f) || (this->unk_150 == 5)) { @@ -4102,7 +4090,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.prevPos.y -= spD8; this->actor.velocity.y = -1.0f; if (KREG(90) == 0) { // Check added in MM - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 30.0f, 100.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, 0x45); } this->actor.world.pos.y += spD8; this->actor.prevPos.y += spD8; @@ -4114,13 +4102,13 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { } if (this->actor.bgCheckFlags & 1) { - if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { + if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_17C = 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; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FISH_LEAP); - func_809036BC(this, globalCtx); + func_809036BC(this, play); if (Rand_ZeroOne() < 0.5f) { this->unk_162 = 0x4000; @@ -4147,7 +4135,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.x; pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z; pos.y = this->actor.floorHeight + 5.0f; - EnFishing_SpawnWaterDust(&this->actor.projectedPos, globalCtx->specialEffects, &pos, + EnFishing_SpawnWaterDust(&this->actor.projectedPos, play->specialEffects, &pos, (this->unk_1A4 * 0.005f) + 0.15f); } } @@ -4166,14 +4154,13 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { pos.x = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.x; pos.y = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.y; pos.z = randPlusMinusPoint5Scaled(range) + this->actor.world.pos.z; - EnFishing_SpawnBubble(&this->actor.projectedPos, globalCtx->specialEffects, &pos, - Rand_ZeroFloat(0.035f) + 0.04f, 0); + EnFishing_SpawnBubble(&this->actor.projectedPos, play->specialEffects, &pos, Rand_ZeroFloat(0.035f) + 0.04f, + 0); } } } -s32 EnFishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnFishing_FishOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; if (limbIndex == 13) { @@ -4195,7 +4182,7 @@ s32 EnFishing_FishOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void EnFishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFishing_FishPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; if (limbIndex == 13) { @@ -4203,8 +4190,7 @@ void EnFishing_FishPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d } } -s32 EnFishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnFishing_LoachOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; if (limbIndex == 3) { @@ -4218,7 +4204,7 @@ s32 EnFishing_LoachOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx return false; } -void EnFishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFishing_LoachPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f sLoachMouthOffset = { 500.0f, 500.0f, 0.0f }; EnFishing* this = THIS; @@ -4227,10 +4213,10 @@ void EnFishing_LoachPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** } } -void EnFishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { +void EnFishing_DrawFish(Actor* thisx, PlayState* play) { EnFishing* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYF(((this->unk_15A + this->actor.shape.rot.y) / 32768.0f) * M_PI, MTXMODE_APPLY); @@ -4242,18 +4228,16 @@ void EnFishing_DrawFish(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateYF((this->unk_164 * (M_PI / 32768)) - (M_PI / 2), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, this->unk_164 * 10.0f * 0.01f, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnFishing_FishOverrideLimbDraw, EnFishing_FishPostLimbDraw, - &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnFishing_FishOverrideLimbDraw, EnFishing_FishPostLimbDraw, &this->actor); } else { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); Matrix_RotateYF(this->unk_164 * (M_PI / 32768), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY); Matrix_RotateYF(-(M_PI / 2), MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnFishing_LoachOverrideLimbDraw, EnFishing_LoachPostLimbDraw, - &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnFishing_LoachOverrideLimbDraw, EnFishing_LoachPostLimbDraw, &this->actor); } } @@ -4289,9 +4273,9 @@ void EnFishing_HandleLilyPadContact(FishingProp* prop, Vec3f* entityPos, u8 fish } } -void EnFishing_UpdatePondProps(GlobalContext* globalCtx) { +void EnFishing_UpdatePondProps(PlayState* play) { FishingProp* prop = &sPondProps[0]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* actor; s16 i; @@ -4300,7 +4284,7 @@ void EnFishing_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))) { @@ -4311,7 +4295,7 @@ void EnFishing_UpdatePondProps(GlobalContext* globalCtx) { if (prop->type == FS_PROP_REED) { EnFishing_HandleReedContact(prop, &player->actor.world.pos); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { if (!((actor->id == ACTOR_EN_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4325,7 +4309,7 @@ void EnFishing_UpdatePondProps(GlobalContext* globalCtx) { } else if (prop->type == FS_PROP_LILY_PAD) { EnFishing_HandleLilyPadContact(prop, &player->actor.world.pos, 0); - actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { if (!((actor->id == ACTOR_EN_FISHING) && (actor->params >= 100))) { actor = actor->next; @@ -4337,7 +4321,7 @@ void EnFishing_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); } } @@ -4347,17 +4331,17 @@ void EnFishing_UpdatePondProps(GlobalContext* globalCtx) { } if (sCameraId == CAM_ID_MAIN) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &sFishingMain->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &sFishingMain->collider.base); } } -void EnFishing_DrawPondProps(GlobalContext* globalCtx) { +void EnFishing_DrawPondProps(PlayState* play) { u8 flag = 0; FishingProp* prop = &sPondProps[0]; s16 i; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -4375,7 +4359,7 @@ void EnFishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_RotateXFApply(prop->rotX); Matrix_RotateYF(prop->reedAngle, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingReedVtxDL); } @@ -4397,7 +4381,7 @@ void EnFishing_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), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingWoodPostVtxDL); } @@ -4422,7 +4406,7 @@ void EnFishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 20.0f, MTXMODE_APPLY); Matrix_RotateYF(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingLilyPadVtxDL); } @@ -4445,7 +4429,7 @@ void EnFishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateYF(prop->rotY, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingRockVtxDL); } @@ -4456,12 +4440,12 @@ void EnFishing_DrawPondProps(GlobalContext* globalCtx) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { +void EnFishing_UpdateGroupFishes(PlayState* play) { s16 groupContactFlags = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); FishingGroupFish* fish = &sGroupFishes[0]; f32 dy; f32 dx; @@ -4499,7 +4483,7 @@ void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 1; } else if (D_8090CF18 != 0) { 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); } @@ -4516,7 +4500,7 @@ void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 2; } else if (D_8090CF18 != 0) { 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); } @@ -4533,7 +4517,7 @@ void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { groupContactFlags |= 4; } else if (D_8090CF18 != 0) { 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); } @@ -4548,7 +4532,7 @@ void EnFishing_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; @@ -4586,8 +4570,8 @@ void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { } ripplePos = fish->pos; - ripplePos.y = WATER_SURFACE_Y(globalCtx); - EnFishing_SpawnRipple(&fish->projectedPos, globalCtx->specialEffects, &ripplePos, 20.0f, + ripplePos.y = WATER_SURFACE_Y(play); + EnFishing_SpawnRipple(&fish->projectedPos, play->specialEffects, &ripplePos, 20.0f, Rand_ZeroFloat(50.0f) + 100.0f, 150, 90); if (fish->unk_28 < 1.5f) { @@ -4645,7 +4629,7 @@ void EnFishing_UpdateGroupFishes(GlobalContext* globalCtx) { D_8090CF18 = 0; } -void EnFishing_DrawGroupFishes(GlobalContext* globalCtx) { +void EnFishing_DrawGroupFishes(PlayState* play) { u8 flag = 0; FishingGroupFish* fish = &sGroupFishes[0]; f32 scale; @@ -4658,7 +4642,7 @@ void EnFishing_DrawGroupFishes(GlobalContext* globalCtx) { scale = 0.00475f; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < GROUP_FISH_COUNT; i++) { if (fish->type != FS_GROUP_FISH_NONE) { @@ -4674,7 +4658,7 @@ void EnFishing_DrawGroupFishes(GlobalContext* globalCtx) { Matrix_RotateXFApply((-(f32)fish->unk_3C * M_PI) / 32768.0f); Matrix_Scale(fish->unk_2C * scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishVtxDL); } @@ -4682,12 +4666,12 @@ void EnFishing_DrawGroupFishes(GlobalContext* globalCtx) { fish++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } u16 D_8090D638[] = { 0x4096, 0x408D, 0x408E, 0x408F, 0x4094, 0x4095 }; -void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { +void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { switch (this->unk_154) { case 0: if (D_809171FC == 0) { @@ -4706,7 +4690,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x4097; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (D_809171FC == 0) { this->unk_154 = 1; if (sLinkAge != 1) { @@ -4718,15 +4702,15 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { this->unk_154 = 10; } } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } break; case 1: - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees >= 20) { func_801159EC(-20); @@ -4735,15 +4719,15 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x407D; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->unk_154 = 2; } else { - func_80151938(globalCtx, 0x407E); + func_80151938(play, 0x407E); this->unk_154 = 3; } break; case 1: - func_80151938(globalCtx, 0x2D); + func_80151938(play, 0x2D); this->unk_154 = 3; break; } @@ -4751,46 +4735,46 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { break; case 2: - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - func_80151938(globalCtx, 0x407F); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); + func_80151938(play, 0x407F); this->unk_154 = 4; } break; case 3: - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->unk_154 = 0; } - if (Message_GetState(&globalCtx->msgCtx) == 6) { + if (Message_GetState(&play->msgCtx) == 6) { this->unk_154 = 0; } break; case 4: - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: D_8090CCF8 = D_809171CC; - func_80151938(globalCtx, 0x4080); + func_80151938(play, 0x4080); this->unk_154 = 5; break; case 1: - func_80151938(globalCtx, 0x407F); + func_80151938(play, 0x407F); break; } } break; case 5: - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); - globalCtx->interfaceCtx.unk_27E = 1; - globalCtx->startPlayerFishing(globalCtx); + play->interfaceCtx.unk_27E = 1; + play->startPlayerFishing(play); D_809171FC = 1; D_8090CD04 = 20; this->unk_154 = 0; @@ -4803,12 +4787,12 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { case 10: if (D_8090CD0C != 0) { - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(globalCtx, 0x40B2); + func_80151938(play, 0x40B2); D_8090CD08 = 1; D_8090CD0C = 0; this->unk_154 = 20; @@ -4819,10 +4803,10 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } } } else { - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (D_8090CCF0 == 0.0f) { this->actor.textId = 0x408C; @@ -4844,12 +4828,12 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { this->actor.textId = 0x409B; this->unk_154 = 11; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); break; case 1: if (D_8090CD00 > 36000) { D_8090CD00 = 30000; - func_80151938(globalCtx, 0x4088); + func_80151938(play, 0x4088); } else { if (D_809171CA == 0) { if (D_809171D6 == 0) { @@ -4858,9 +4842,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } if ((D_80917206 == 2) && (D_8090D638[D_809171D6] == 0x408D)) { - func_80151938(globalCtx, 0x40AF); + func_80151938(play, 0x40AF); } else { - func_80151938(globalCtx, D_8090D638[D_809171D6]); + func_80151938(play, D_8090D638[D_809171D6]); } D_809171D6++; @@ -4879,9 +4863,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { break; case 2: if (D_809171D8 == 0) { - func_80151938(globalCtx, 0x4085); + func_80151938(play, 0x4085); } else if (sLinkAge == 1) { - func_80151938(globalCtx, 0x4092); + func_80151938(play, 0x4092); } this->unk_154 = 22; break; @@ -4891,11 +4875,11 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { break; case 11: - if (((Message_GetState(&globalCtx->msgCtx) == 5) || Message_GetState(&globalCtx->msgCtx) == 0) && - Message_ShouldAdvance(globalCtx)) { + if (((Message_GetState(&play->msgCtx) == 5) || Message_GetState(&play->msgCtx) == 0) && + Message_ShouldAdvance(play)) { s32 getItemId; - func_801477B4(globalCtx); + func_801477B4(play); if (D_809171D0 == 0) { D_809171CC = D_8090CCF0; @@ -4961,31 +4945,31 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { } this->actor.parent = NULL; - Actor_PickUp(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, getItemId, 2000.0f, 1000.0f); this->unk_154 = 23; } break; case 20: - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->unk_154 = 0; } break; case 21: - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + func_801477B4(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: this->unk_154 = 0; break; case 1: if (D_809171D8 == 0) { - func_80151938(globalCtx, 0x4085); + func_80151938(play, 0x4085); } else if (sLinkAge == 1) { - func_80151938(globalCtx, 0x4092); + func_80151938(play, 0x4092); } this->unk_154 = 22; break; @@ -4994,33 +4978,33 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, GlobalContext* globalCtx) { break; case 22: - if (Message_GetState(&globalCtx->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == 0) { this->unk_154 = 0; if (D_8090CD0C != 0) { D_8090CD08 = 1; D_8090CD0C = 0; } D_809171FC = 0; - globalCtx->interfaceCtx.unk_27E = 0; + play->interfaceCtx.unk_27E = 0; } break; case 23: D_8090CCF4 = false; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->unk_154 = 24; } else { - Actor_PickUp(&this->actor, globalCtx, GI_SCALE_GOLD, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, GI_SCALE_GOLD, 2000.0f, 1000.0f); } break; case 24: D_8090CCF4 = false; - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { if (D_809171D0 == 0) { this->unk_154 = 0; } else { - Message_StartTextbox(globalCtx, 0x409C, NULL); + Message_StartTextbox(play, 0x409C, NULL); this->unk_154 = 20; } } @@ -5039,8 +5023,8 @@ Vec3s sSinkingLureLocationPos[] = { { 553, -48, -508 }, }; -void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFishing* this = THIS; Vec3f sp114; Vec3f sp108; @@ -5051,8 +5035,8 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { f32 camAtFraction; f32 lureDistXZ; Camera* camera; - Player* player = GET_PLAYER(globalCtx); - Input* input = CONTROLLER1(&globalCtx->state); + Player* player = GET_PLAYER(play); + Input* input = CONTROLLER1(&play->state); playerShadowAlpha = player->actor.shape.shadowAlpha; @@ -5066,13 +5050,13 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { SkelAnime_Update(&this->skelAnime); - if ((D_8090CD04 != 0) || Message_GetState(&globalCtx->msgCtx)) { + if ((D_8090CD04 != 0) || Message_GetState(&play->msgCtx)) { this->actor.flags &= ~ACTOR_FLAG_1; } else { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_20); } - if ((this->actor.xzDistToPlayer < 120.0f) || Message_GetState(&globalCtx->msgCtx)) { + if ((this->actor.xzDistToPlayer < 120.0f) || Message_GetState(&play->msgCtx)) { headRotTarget = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; } else { headRotTarget = 0; @@ -5086,7 +5070,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachS(&this->unk_15C, headRotTarget, 3, 0x1388); - if (((globalCtx->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { + if (((play->gameplayFrames % 32) == 0) && (Rand_ZeroOne() < 0.3f)) { this->unk_15A = 4; } @@ -5108,7 +5092,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f)) { D_8090CD08 = 0; D_8090CD0C = 1; - Message_StartTextbox(globalCtx, 0x4087, NULL); + Message_StartTextbox(play, 0x4087, NULL); } } @@ -5121,22 +5105,22 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (D_8090CCFC != 0) { D_8090CCFC--; if (D_8090CCFC == 0) { - Message_StartTextbox(globalCtx, D_809171DA, NULL); + Message_StartTextbox(play, D_809171DA, NULL); } } - EnFishing_HandleOwnerDialog(this, globalCtx); + EnFishing_HandleOwnerDialog(this, play); D_809101C8 = 0.0015f; D_8090CD00++; if ((D_809171FC != 0) && D_8090CCF4) { - EnFishing_UpdateLure(this, globalCtx); + EnFishing_UpdateLure(this, play); } - EnFishing_UpdateEffects(globalCtx->specialEffects, globalCtx); - EnFishing_UpdatePondProps(globalCtx); - EnFishing_UpdateGroupFishes(globalCtx); + EnFishing_UpdateEffects(play->specialEffects, play); + EnFishing_UpdatePondProps(play); + EnFishing_UpdateGroupFishes(play); if ((D_809171FC != 0) && (D_8090CD4C == 0) && (player->actor.world.pos.z > 1360.0f) && (fabsf(player->actor.world.pos.x) < 25.0f)) { @@ -5168,10 +5152,10 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 1: - sCameraId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, sCameraId, 7); - camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + sCameraId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, sCameraId, 7); + camera = Play_GetCamera(play, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; @@ -5278,36 +5262,36 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 3: { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; } - func_80169AFC(globalCtx, sCameraId, 0); - Cutscene_End(globalCtx, &globalCtx->csCtx); + func_80169AFC(play, sCameraId, 0); + Cutscene_End(play, &play->csCtx); D_8090CD4C = 0; sCameraId = CAM_ID_MAIN; - func_800F6834(globalCtx, 0); - globalCtx->envCtx.lightSettings.fogNear = 0; + func_800F6834(play, 0); + play->envCtx.lightSettings.fogNear = 0; player->unk_B28 = -5; D_80917200 = 5; break; case 10: - Cutscene_Start(globalCtx, &globalCtx->csCtx); - sCameraId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, sCameraId, 7); - func_800B7298(globalCtx, &this->actor, 4); - camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Cutscene_Start(play, &play->csCtx); + sCameraId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, sCameraId, 7); + func_800B7298(play, &this->actor, 4); + camera = Play_GetCamera(play, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; sCameraAt.x = camera->at.x; sCameraAt.y = camera->at.y; sCameraAt.z = camera->at.z; - Message_StartTextbox(globalCtx, 0x409E, NULL); + Message_StartTextbox(play, 0x409E, NULL); D_8090CD4C = 11; func_8013EC44(0.0f, 150, 10, 10); // fallthrough @@ -5316,44 +5300,44 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { player->actor.world.pos.z = 1360.0f; player->actor.speedXZ = 0.0f; - if (Message_GetState(&globalCtx->msgCtx) == 0) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if (Message_GetState(&play->msgCtx) == 0) { + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; - func_80169AFC(globalCtx, sCameraId, 0); - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); + func_80169AFC(play, sCameraId, 0); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); D_8090CD4C = 0; sCameraId = CAM_ID_MAIN; D_8090CD50 = 30; - func_800F6834(globalCtx, 0); - globalCtx->envCtx.lightSettings.fogNear = 0; + func_800F6834(play, 0); + play->envCtx.lightSettings.fogNear = 0; } break; case 20: - Cutscene_Start(globalCtx, &globalCtx->csCtx); - sCameraId = Play_CreateSubCamera(globalCtx); - Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); - Play_CameraChangeStatus(globalCtx, sCameraId, 7); - func_800B7298(globalCtx, &this->actor, 4); - camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Cutscene_Start(play, &play->csCtx); + sCameraId = Play_CreateSubCamera(play); + Play_CameraChangeStatus(play, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(play, sCameraId, 7); + func_800B7298(play, &this->actor, 4); + camera = Play_GetCamera(play, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; sCameraAt.x = camera->at.x; sCameraAt.y = camera->at.y; sCameraAt.z = camera->at.z; - Message_StartTextbox(globalCtx, 0x409A, NULL); + Message_StartTextbox(play, 0x409A, NULL); D_8090CD4C = 21; D_80911F48 = 45.0f; D_8090CD50 = 10; // fallthrough case 21: - if ((D_8090CD50 == 0) && Message_ShouldAdvance(globalCtx)) { + if ((D_8090CD50 == 0) && Message_ShouldAdvance(play)) { D_8090CD4C = 22; D_8090CD50 = 40; // func_800B7298 call removed in MM @@ -5371,7 +5355,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachF(&D_80911F64, 71.0f, 0.5f, 3.0f); Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW); - sp114.x = Math_SinS(globalCtx->gameplayFrames * 0x1000); + sp114.x = Math_SinS(play->gameplayFrames * 0x1000); sp114.y = D_80911F64; sp114.z = -5.0f; if (sLinkAge == 1) { @@ -5409,12 +5393,12 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (D_8090CD50 == 0) { - if ((Message_GetState(&globalCtx->msgCtx) == 4) || Message_GetState(&globalCtx->msgCtx) == 0) { - if (Message_ShouldAdvance(globalCtx)) { - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if (Message_ShouldAdvance(play)) { + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); - func_801477B4(globalCtx); - if (globalCtx->msgCtx.choiceIndex == 0) { + func_801477B4(play); + if (play->msgCtx.choiceIndex == 0) { D_80917206 = 2; D_809171D6 = 0; } @@ -5422,17 +5406,17 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { camera->eye = sCameraEye; camera->eyeNext = sCameraEye; camera->at = sCameraAt; - func_80169AFC(globalCtx, sCameraId, 0); - Cutscene_End(globalCtx, &globalCtx->csCtx); - func_800B7298(globalCtx, &this->actor, 6); // arg2 changed from 7 to 6 in MM + func_80169AFC(play, sCameraId, 0); + Cutscene_End(play, &play->csCtx); + func_800B7298(play, &this->actor, 6); // arg2 changed from 7 to 6 in MM D_8090CD4C = 0; sCameraId = CAM_ID_MAIN; player->unk_B28 = -5; D_80917200 = 5; D_8090CD54 = 0; D_809171F6 = 20; - func_800F6834(globalCtx, 0); - globalCtx->envCtx.lightSettings.fogNear = 0; + func_800F6834(play, 0); + play->envCtx.lightSettings.fogNear = 0; } } } @@ -5443,36 +5427,36 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } if (sCameraId != CAM_ID_MAIN) { - Play_CameraSetAtEye(globalCtx, sCameraId, &sCameraAt, &sCameraEye); + Play_CameraSetAtEye(play, sCameraId, &sCameraAt, &sCameraEye); Math_ApproachF(&D_80911F4C, 1.0f, 1.0f, 0.02f); - if (sCameraEye.y <= (WATER_SURFACE_Y(globalCtx) + 1.0f)) { - func_800F6834(globalCtx, 1); + if (sCameraEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { + func_800F6834(play, 1); if (D_809171CA != 0) { - globalCtx->envCtx.lightSettings.fogNear = -0xB2; + play->envCtx.lightSettings.fogNear = -0xB2; } else { - globalCtx->envCtx.lightSettings.fogNear = -0x2E; + play->envCtx.lightSettings.fogNear = -0x2E; } } else { - func_800F6834(globalCtx, 0); - globalCtx->envCtx.lightSettings.fogNear = 0; + func_800F6834(play, 0); + play->envCtx.lightSettings.fogNear = 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 = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.x; pos.z = randPlusMinusPoint5Scaled(20.0f) + player->actor.world.pos.z; pos.y = player->actor.floorHeight + 5.0f; - EnFishing_SpawnWaterDust(NULL, globalCtx->specialEffects, &pos, 0.5f); + EnFishing_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++) { @@ -5490,10 +5474,9 @@ void EnFishing_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; - EnFishing_SpawnDustSplash(NULL, globalCtx->specialEffects, &pos, &vel, - Rand_ZeroFloat(0.01f) + 0.020000001f); + EnFishing_SpawnDustSplash(NULL, play->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); } } @@ -5501,15 +5484,15 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { D_809171CB--; } - if ((D_809171CB == 1) && Message_GetState(&globalCtx->msgCtx) == 0 && ((D_8090CD00 & 0xFFF) == 0xFFF)) { + if ((D_809171CB == 1) && Message_GetState(&play->msgCtx) == 0 && ((D_8090CD00 & 0xFFF) == 0xFFF)) { D_809171CB = 200; if (Rand_ZeroOne() < 0.5f) { D_8090CCD4 = Rand_ZeroFloat(10.0f) + 5.0f; - globalCtx->envCtx.unk_E1 = 1; + play->envCtx.unk_E1 = 1; } else { D_8090CCD4 = 0; - globalCtx->envCtx.unk_E1 = 2; + play->envCtx.unk_E1 = 2; } } @@ -5540,13 +5523,13 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Math_ApproachZeroF(&D_8090CCD8, 1.0f, 2.0f); } - globalCtx->envCtx.lightSettings.diffuseColor1[0] = globalCtx->envCtx.lightSettings.diffuseColor1[1] = - globalCtx->envCtx.lightSettings.diffuseColor1[2] = D_8090CCD8; + play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = + play->envCtx.lightSettings.diffuseColor1[2] = D_8090CCD8; if ((u8)D_8090CCD0 > 0) { s32 pad; s16 i; - Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); Vec3f pos; Vec3f rot; Vec3f projectedPos; @@ -5557,24 +5540,23 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { rot.z = (Camera_GetInputDirYaw(camera) * -(M_PI / 32768)) + rot.y; for (i = 0; i < (u8)D_8090CCD0; i++) { - pos.x = randPlusMinusPoint5Scaled(700.0f) + globalCtx->view.eye.x; + pos.x = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.x; pos.y = (Rand_ZeroFloat(100.0f) + 150.0f) - 170.0f; - pos.z = randPlusMinusPoint5Scaled(700.0f) + globalCtx->view.eye.z; + pos.z = randPlusMinusPoint5Scaled(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 { - EnFishing_SpawnRainDrop(globalCtx->specialEffects, &pos, &rot); + EnFishing_SpawnRainDrop(play->specialEffects, &pos, &rot); } } } } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, - &sProjectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSoundPos, &sStreamSoundProjectedPos, &sProjectedW); Audio_PlaySfxAtPos(&sStreamSoundProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG); @@ -5585,8 +5567,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnFishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnFishing_OwnerOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFishing* this = THIS; if (limbIndex == 8) { // Head @@ -5596,9 +5577,9 @@ s32 EnFishing_OwnerOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx return false; } -void EnFishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFishing_OwnerPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { if (limbIndex == 8) { // Head - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&sZeroVec, &sOwnerHeadPos); @@ -5608,7 +5589,7 @@ void EnFishing_OwnerPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHairDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -5618,29 +5599,28 @@ TexturePtr sFishingOwnerEyeTexs[] = { gFishingOwnerEyeClosedTex, }; -void EnFishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { +void EnFishing_DrawOwner(Actor* thisx, PlayState* play) { s32 pad; EnFishing* this = THIS; - Input* input = CONTROLLER1(&globalCtx->state); + Input* input = CONTROLLER1(&play->state); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(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, Lib_SegmentedToVirtual(sFishingOwnerEyeTexs[this->unk_158])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnFishing_OwnerOverrideLimbDraw, EnFishing_OwnerPostLimbDraw, - &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnFishing_OwnerOverrideLimbDraw, EnFishing_OwnerPostLimbDraw, &this->actor); } - EnFishing_DrawPondProps(globalCtx); - EnFishing_DrawEffects(globalCtx->specialEffects, globalCtx); - EnFishing_DrawGroupFishes(globalCtx); - EnFishing_DrawStreamSplash(globalCtx); + EnFishing_DrawPondProps(play); + EnFishing_DrawEffects(play->specialEffects, play); + EnFishing_DrawGroupFishes(play); + EnFishing_DrawStreamSplash(play); if (D_809171F6 != 0) { D_809171F6--; @@ -5661,10 +5641,10 @@ void EnFishing_DrawOwner(Actor* thisx, GlobalContext* globalCtx) { } if ((D_809171FC != 0) && D_8090CCF4) { - EnFishing_DrawRod(globalCtx); + EnFishing_DrawRod(play); EnFishing_UpdateLinePos(sReelLinePos); - EnFishing_UpdateLine(globalCtx, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); - EnFishing_DrawLureAndLine(globalCtx, sReelLinePos, sReelLineRot); + EnFishing_UpdateLine(play, &sRodTipPos, sReelLinePos, sReelLineRot, sReelLineUnk); + EnFishing_DrawLureAndLine(play, sReelLinePos, sReelLineRot); D_8090CD44 = input->rel.stick_x; D_8090CD48 = input->rel.stick_y; @@ -5675,15 +5655,15 @@ void EnFishing_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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingAquariumBottomDL); gSPDisplayList(POLY_XLU_DISP++, gFishingAquariumContainerDL); if ((D_809171FC != 0) && (D_80917206 == 2)) { - EnFishing_DrawSinkingLure(globalCtx); + EnFishing_DrawSinkingLure(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.h b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.h index 3cd594b384..beb3438b9e 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.h +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.h @@ -5,7 +5,7 @@ struct EnFishing; -typedef void (*EnFishingActionFunc)(struct EnFishing*, GlobalContext*); +typedef void (*EnFishingActionFunc)(struct EnFishing*, PlayState*); typedef struct EnFishing { /* 0x000 */ 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 e7fb183c17..c5e7b24f14 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -10,54 +10,54 @@ #define THIS ((EnFloormas*)thisx) -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 func_808D0B08(EnFloormas* this); -void func_808D0B50(EnFloormas* this, GlobalContext* globalCtx); +void func_808D0B50(EnFloormas* this, PlayState* play); void func_808D0C14(EnFloormas* this); -void func_808D0C58(EnFloormas* this, GlobalContext* globalCtx); +void func_808D0C58(EnFloormas* this, PlayState* play); void func_808D0CE4(EnFloormas* this); -void func_808D0D70(EnFloormas* this, GlobalContext* globalCtx); +void func_808D0D70(EnFloormas* this, PlayState* play); void func_808D0ECC(EnFloormas* this); -void func_808D0F14(EnFloormas* this, GlobalContext* globalCtx); +void func_808D0F14(EnFloormas* this, PlayState* play); void func_808D0F50(EnFloormas* this); -void func_808D0F80(EnFloormas* this, GlobalContext* globalCtx); +void func_808D0F80(EnFloormas* this, PlayState* play); void func_808D108C(EnFloormas* this); -void func_808D11BC(EnFloormas* this, GlobalContext* globalCtx); -void func_808D1380(EnFloormas* this, GlobalContext* globalCtx); -void func_808D1458(EnFloormas* this, GlobalContext* globalCtx); +void func_808D11BC(EnFloormas* this, PlayState* play); +void func_808D1380(EnFloormas* this, PlayState* play); +void func_808D1458(EnFloormas* this, PlayState* play); void func_808D161C(EnFloormas* this); -void func_808D1650(EnFloormas* this, GlobalContext* globalCtx); +void func_808D1650(EnFloormas* this, PlayState* play); void func_808D1740(EnFloormas* this); -void func_808D17EC(EnFloormas* this, GlobalContext* globalCtx); +void func_808D17EC(EnFloormas* this, PlayState* play); void func_808D19D4(EnFloormas* this); -void func_808D1B44(EnFloormas* this, GlobalContext* globalCtx); +void func_808D1B44(EnFloormas* this, PlayState* play); void func_808D1BCC(EnFloormas* this); -void func_808D1C1C(EnFloormas* this, GlobalContext* globalCtx); +void func_808D1C1C(EnFloormas* this, PlayState* play); void func_808D1D0C(EnFloormas* this); -void func_808D1D6C(EnFloormas* this, GlobalContext* globalCtx); -void func_808D1ED4(EnFloormas* this, GlobalContext* globalCtx); -void func_808D1F7C(EnFloormas* this, GlobalContext* globalCtx); +void func_808D1D6C(EnFloormas* this, PlayState* play); +void func_808D1ED4(EnFloormas* this, PlayState* play); +void func_808D1F7C(EnFloormas* this, PlayState* play); void func_808D1FD4(EnFloormas* this); -void func_808D2040(EnFloormas* this, GlobalContext* globalCtx); +void func_808D2040(EnFloormas* this, PlayState* play); void func_808D217C(EnFloormas* this, Player* player); -void func_808D22C8(EnFloormas* this, GlobalContext* globalCtx); +void func_808D22C8(EnFloormas* this, PlayState* play); void func_808D2484(EnFloormas* this); -void func_808D24F0(EnFloormas* this, GlobalContext* globalCtx); +void func_808D24F0(EnFloormas* this, PlayState* play); void func_808D2700(EnFloormas* this); -void func_808D2764(EnFloormas* this, GlobalContext* globalCtx); +void func_808D2764(EnFloormas* this, PlayState* play); void func_808D2A20(EnFloormas* this); -void func_808D2AA8(EnFloormas* this, GlobalContext* globalCtx); +void func_808D2AA8(EnFloormas* this, PlayState* play); void func_808D2AB8(EnFloormas* this); -void func_808D2AF4(EnFloormas* this, GlobalContext* globalCtx); -void func_808D2C08(EnFloormas* this, GlobalContext* globalCtx); +void func_808D2AF4(EnFloormas* this, PlayState* play); +void func_808D2C08(EnFloormas* this, PlayState* play); void func_808D2CDC(EnFloormas* this); -void func_808D2D30(EnFloormas* this, GlobalContext* globalCtx); -void func_808D2DC0(EnFloormas* this, GlobalContext* globalCtx); -void func_808D3754(Actor* thisx, GlobalContext* globalCtx); +void func_808D2D30(EnFloormas* this, PlayState* play); +void func_808D2DC0(EnFloormas* this, PlayState* play); +void func_808D3754(Actor* thisx, PlayState* play); const ActorInit En_Floormas_InitVars = { ACTOR_EN_FLOORMAS, @@ -145,17 +145,17 @@ static s8 D_808D393C[] = { static Color_RGBA8 D_808D3958 = { 0, 255, 0, 0 }; -void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnFloormas_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnFloormas* this = THIS; s32 pad; s32 params; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterIdleAnim, this->jointTable, this->morphTable, WALLMASTER_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_192 = -1600; @@ -175,16 +175,16 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { } this->actor.parent = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, + &play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, params + 0x10, -1, this->actor.unk20, NULL); if (this->actor.parent == NULL) { Actor_MarkForDeath(&this->actor); return; } - this->actor.child = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, params + 0x10, -1, this->actor.unk20, NULL); + this->actor.child = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + params + 0x10, -1, this->actor.unk20, NULL); if (this->actor.child == NULL) { Actor_MarkForDeath(this->actor.parent); Actor_MarkForDeath(&this->actor); @@ -198,10 +198,10 @@ void EnFloormas_Init(Actor* thisx, GlobalContext* globalCtx2) { func_808D0B08(this); } -void EnFloormas_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Destroy(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_808D08D0(EnFloormas* this) { @@ -218,7 +218,7 @@ void func_808D0908(EnFloormas* this) { this->unk_190 = 0; } -void func_808D0930(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0930(EnFloormas* this, PlayState* play) { if (this->actor.scale.x > 0.009f) { this->actor.shape.rot.y = BINANG_ROT180(this->actor.yawTowardsPlayer); func_808D19D4((EnFloormas*)this->actor.child); @@ -226,8 +226,8 @@ void func_808D0930(EnFloormas* this, GlobalContext* globalCtx) { func_808D19D4(this); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_HIDE); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); - func_808D1ED4(this, globalCtx); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); + func_808D1ED4(this, play); } } @@ -242,12 +242,12 @@ void func_808D09CC(EnFloormas* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_808D0A48(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0A48(EnFloormas* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, this->actor.scale.x * 30.000002f, this->actor.scale.x * 20.0f); if (this->actor.scale.x > 0.009f) { this->actor.flags |= ACTOR_FLAG_400; @@ -263,13 +263,13 @@ void func_808D0B08(EnFloormas* this) { this->actionFunc = func_808D0B50; } -void func_808D0B50(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0B50(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->actor.xzDistToPlayer < 400.0f) && !Actor_IsFacingPlayer(&this->actor, 0x4000)) { this->unk_190 = this->actor.yawTowardsPlayer; func_808D108C(this); } else if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_808D1380(this, globalCtx); + func_808D1380(this, play); } else { func_808D0C14(this); } @@ -281,7 +281,7 @@ void func_808D0C14(EnFloormas* this) { this->actionFunc = func_808D0C58; } -void func_808D0C58(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0C58(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.scale.x > 0.009f) { func_808D0CE4(this); @@ -305,7 +305,7 @@ void func_808D0CE4(EnFloormas* this) { this->actionFunc = func_808D0D70; } -void func_808D0D70(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0D70(EnFloormas* this, PlayState* play) { s32 temp_v0; SkelAnime_Update(&this->skelAnime); @@ -338,7 +338,7 @@ void func_808D0ECC(EnFloormas* this) { this->actionFunc = func_808D0F14; } -void func_808D0F14(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0F14(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_808D0B08(this); } @@ -351,7 +351,7 @@ void func_808D0F50(EnFloormas* this) { this->actionFunc = func_808D0F80; } -void func_808D0F80(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D0F80(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)) { @@ -361,7 +361,7 @@ void func_808D0F80(EnFloormas* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C); if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000) && !(this->actor.bgCheckFlags & 8)) { - func_808D1380(this, globalCtx); + func_808D1380(this, play); } else if (this->actor.xzDistToPlayer > 400.0f) { func_808D0CE4(this); } @@ -388,7 +388,7 @@ void func_808D108C(EnFloormas* this) { this->actionFunc = func_808D11BC; } -void func_808D11BC(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D11BC(EnFloormas* this, PlayState* play) { f32 frame; f32 sp30; f32 sp2C; @@ -416,18 +416,18 @@ void func_808D11BC(EnFloormas* this, GlobalContext* globalCtx) { } } -void func_808D1380(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1380(EnFloormas* this, PlayState* play) { Animation_Change(&this->skelAnime, &gWallmasterHoverAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gWallmasterHoverAnim), ANIMMODE_ONCE, -3.0f); this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; func_808D08D0(this); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, 1); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, 1); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); this->actionFunc = func_808D1458; } -void func_808D1458(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1458(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_808D161C(this); } @@ -438,7 +438,7 @@ void func_808D1458(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToS(&this->unk_192, 1200, 100); } -void func_808D14DC(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D14DC(EnFloormas* this, PlayState* play) { Vec3f sp34; Vec3f sp28; @@ -450,10 +450,10 @@ void func_808D14DC(EnFloormas* this, GlobalContext* globalCtx) { sp28.x = Math_SinS(this->actor.shape.rot.y + 0x6000) * 7.0f; sp28.z = Math_CosS(this->actor.shape.rot.y + 0x6000) * 7.0f; - func_800B1210(globalCtx, &sp34, &sp28, &gZeroVec3f, 0x1C2, 0x64); + func_800B1210(play, &sp34, &sp28, &gZeroVec3f, 0x1C2, 0x64); sp28.x = Math_SinS(this->actor.shape.rot.y - 0x6000) * 7.0f; sp28.z = Math_CosS(this->actor.shape.rot.y - 0x6000) * 7.0f; - func_800B1210(globalCtx, &sp34, &sp28, &gZeroVec3f, 0x1C2, 0x64); + func_800B1210(play, &sp34, &sp28, &gZeroVec3f, 0x1C2, 0x64); func_800B9010(&this->actor, NA_SE_EN_FLOORMASTER_SLIDING - SFX_FLAG); } @@ -464,7 +464,7 @@ void func_808D161C(EnFloormas* this) { this->actionFunc = func_808D1650; } -void func_808D1650(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1650(EnFloormas* this, PlayState* play) { f32 temp_f0_2; if (this->unk_18E != 0) { @@ -482,7 +482,7 @@ void func_808D1650(EnFloormas* this, GlobalContext* globalCtx) { } if (temp_f0_2 < 12.0f) { - func_808D14DC(this, globalCtx); + func_808D14DC(this, play); } if ((this->actor.bgCheckFlags & 8) || (this->unk_18E == 0)) { @@ -501,7 +501,7 @@ void func_808D1740(EnFloormas* this) { this->actionFunc = func_808D17EC; } -void func_808D17EC(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D17EC(EnFloormas* this, PlayState* play) { s32 sp24 = this->actor.bgCheckFlags & 1; if (this->actor.bgCheckFlags & 2) { @@ -527,7 +527,7 @@ void func_808D17EC(EnFloormas* this, GlobalContext* globalCtx) { } if ((this->actor.speedXZ > 0.0f) && ((this->actor.world.pos.y - this->actor.floorHeight) < 12.0f)) { - func_808D14DC(this, globalCtx); + func_808D14DC(this, play); } if (SkelAnime_Update(&this->skelAnime)) { @@ -580,7 +580,7 @@ void func_808D19D4(EnFloormas* this) { this->actionFunc = func_808D1B44; } -void func_808D1B44(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1B44(EnFloormas* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_1; @@ -600,7 +600,7 @@ void func_808D1BCC(EnFloormas* this) { this->actionFunc = func_808D1C1C; } -void func_808D1C1C(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1C1C(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_194 != 0) { this->unk_194--; @@ -628,7 +628,7 @@ void func_808D1D0C(EnFloormas* this) { this->actionFunc = func_808D1D6C; } -void func_808D1D6C(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1D6C(EnFloormas* this, PlayState* play) { Actor* sp2C; s32 flags; @@ -664,7 +664,7 @@ void func_808D1D6C(EnFloormas* this, GlobalContext* globalCtx) { } } -void func_808D1ED4(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1ED4(EnFloormas* this, PlayState* play) { Vec3f sp34; this->actor.speedXZ = 0.0f; @@ -672,12 +672,12 @@ void func_808D1ED4(EnFloormas* this, GlobalContext* globalCtx) { sp34.x = this->actor.world.pos.x; sp34.y = this->actor.world.pos.y + 15.0f; sp34.z = this->actor.world.pos.z; - func_800B3030(globalCtx, &sp34, &gZeroVec3f, &gZeroVec3f, 150, -10, 2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &sp34, &gZeroVec3f, &gZeroVec3f, 150, -10, 2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); this->actionFunc = func_808D1F7C; } -void func_808D1F7C(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D1F7C(EnFloormas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015f)) { func_808D2A20(this); } @@ -690,8 +690,8 @@ void func_808D1FD4(EnFloormas* this) { this->actionFunc = func_808D2040; } -void func_808D2040(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808D2040(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame < 20.0f) { @@ -706,7 +706,7 @@ void func_808D2040(EnFloormas* this, GlobalContext* globalCtx) { func_808D1740(this); } else if ((this->actor.playerHeightRel < -10.0f) && (this->collider.base.ocFlags1 & OC1_HIT) && (&player->actor == this->collider.base.oc)) { - globalCtx->grabPlayer(globalCtx, player); + play->grabPlayer(play, player); func_808D217C(this, player); } } @@ -728,8 +728,8 @@ void func_808D217C(EnFloormas* this, Player* player) { this->actionFunc = func_808D22C8; } -void func_808D22C8(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808D22C8(EnFloormas* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime)) { if (this->skelAnime.playSpeed > 0.0f) { @@ -763,7 +763,7 @@ void func_808D22C8(EnFloormas* this, GlobalContext* globalCtx) { func_808D1740(this); } else if ((this->unk_190 % 20) == 0) { func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); - globalCtx->damagePlayer(globalCtx, -4); + play->damagePlayer(play, -4); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK - SFX_FLAG); } @@ -774,7 +774,7 @@ void func_808D2484(EnFloormas* this) { this->actionFunc = func_808D24F0; } -void func_808D24F0(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D24F0(EnFloormas* this, PlayState* play) { Actor* phi_s1; SkelAnime_Update(&this->skelAnime); @@ -822,7 +822,7 @@ void func_808D2700(EnFloormas* this) { this->actionFunc = func_808D2764; } -void func_808D2764(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2764(EnFloormas* this, PlayState* play) { EnFloormas* parent; EnFloormas* child; s32 phi_a2 = 0; @@ -836,10 +836,10 @@ void func_808D2764(EnFloormas* this, GlobalContext* globalCtx) { child = (EnFloormas*)this->actor.child; if (this->unk_194 == 0) { if (parent->actionFunc != func_808D2AA8) { - func_808D1ED4(parent, globalCtx); + func_808D1ED4(parent, play); } if (child->actionFunc != func_808D2AA8) { - func_808D1ED4(child, globalCtx); + func_808D1ED4(child, play); } } else { if ((parent->actionFunc != func_808D2AA8) && (parent->actionFunc != func_808D1F7C)) { @@ -906,7 +906,7 @@ void func_808D2A20(EnFloormas* this) { } } -void func_808D2AA8(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2AA8(EnFloormas* this, PlayState* play) { } void func_808D2AB8(EnFloormas* this) { @@ -916,7 +916,7 @@ void func_808D2AB8(EnFloormas* this) { this->actionFunc = func_808D2AF4; } -void func_808D2AF4(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2AF4(EnFloormas* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -943,10 +943,10 @@ void func_808D2B18(EnFloormas* this) { this->actionFunc = func_808D2C08; } -void func_808D2C08(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2C08(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health == 0) { - func_808D0930(this, globalCtx); + func_808D0930(this, play); } else { func_808D2CDC(this); } @@ -971,7 +971,7 @@ void func_808D2CDC(EnFloormas* this) { this->actionFunc = func_808D2D30; } -void func_808D2D30(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2D30(EnFloormas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_808D0C14(this); } @@ -986,23 +986,23 @@ void func_808D2D6C(EnFloormas* this) { this->actionFunc = func_808D2DC0; } -void func_808D2DC0(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2DC0(EnFloormas* this, PlayState* play) { if (this->unk_18E != 0) { this->unk_18E--; } if (this->unk_18E == 0) { - func_808D0A48(this, globalCtx); + func_808D0A48(this, play); if (this->actor.colChkInfo.health == 0) { this->collider.base.acFlags |= AC_ON; - func_808D0930(this, globalCtx); + func_808D0930(this, play); } else { func_808D0C14(this); } } } -void func_808D2E34(EnFloormas* this, GlobalContext* globalCtx) { +void func_808D2E34(EnFloormas* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); @@ -1026,13 +1026,13 @@ void func_808D2E34(EnFloormas* this, GlobalContext* globalCtx) { } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_DEAD); } - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; } else if (this->actor.colChkInfo.damage != 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_DAMAGE); } - func_808D0A48(this, globalCtx); + func_808D0A48(this, play); if (this->actor.colChkInfo.damageEffect != 0xF) { if (this->actor.colChkInfo.damageEffect == 3) { @@ -1064,9 +1064,9 @@ void func_808D2E34(EnFloormas* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, + 0, (this->actor.scale.x > 0.009f) ? CLEAR_TAG_LARGE_LIGHT_RAYS : CLEAR_TAG_SMALL_LIGHT_RAYS); } @@ -1078,7 +1078,7 @@ void func_808D2E34(EnFloormas* this, GlobalContext* globalCtx) { } } -void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Update(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; s32 pad; @@ -1091,8 +1091,8 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { func_808D1740(this); } - func_808D2E34(this, globalCtx); - this->actionFunc(this, globalCtx); + func_808D2E34(this, play); + this->actionFunc(this, play); if (this->actionFunc != func_808D2AF4) { if (this->actionFunc != func_808D2C08) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1102,21 +1102,21 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->actionFunc == func_808D1650) { this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_808D22C8) { if ((this->actionFunc != func_808D1B44) && (this->actionFunc != func_808D2C08) && (this->actionFunc != func_808D1F7C)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc != func_808D24F0) || (this->skelAnime.curFrame < 20.0f)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1144,8 +1144,8 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnFloormas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { EnFloormas* this = THIS; if (limbIndex == WALLMASTER_LIMB_ROOT) { @@ -1155,8 +1155,7 @@ s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnFloormas* this = THIS; if (D_808D393C[limbIndex] != -1) { @@ -1173,58 +1172,58 @@ void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Matrix_RotateZF(M_PI / 12, MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, gWallmasterLittleFingerDL); Matrix_Pop(); } } -void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFloormas_Draw(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_800AE2A0(globalCtx, &D_808D3958, this->unk_190 % 40, 40); + func_800AE2A0(play, &D_808D3958, this->unk_190 % 40, 40); } 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->actor, POLY_OPA_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 100.0f * (this->drawDmgEffScale * this->actor.scale.x), 100.0f * (this->drawDmgEffFrozenSteamScale * this->actor.scale.x), this->drawDmgEffAlpha, this->drawDmgEffType); } -void func_808D3754(Actor* thisx, GlobalContext* globalCtx) { +void func_808D3754(Actor* thisx, PlayState* play) { EnFloormas* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (this->collider.base.colType == COLTYPE_HARD) { - func_800AE5E4(globalCtx, &D_808D3958, this->unk_190 % 40, 40); + func_800AE5E4(play, &D_808D3958, this->unk_190 % 40, 40); } 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->actor, POLY_XLU_DISP); if (this->collider.base.colType == COLTYPE_HARD) { - func_800AE8EC(globalCtx); + func_800AE8EC(play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale * this->actor.scale.x * 100.0f, this->drawDmgEffFrozenSteamScale * this->actor.scale.x * 100.0f, this->drawDmgEffAlpha, this->drawDmgEffType); 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 5c33ba8863..47b3af3d27 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 @@ struct EnFloormas; -typedef void (*EnFloormasActionFunc)(struct EnFloormas*, GlobalContext*); +typedef void (*EnFloormasActionFunc)(struct EnFloormas*, PlayState*); #define ENFLOORMAS_GET_7FFF(thisx) ((thisx)->params & 0x7FFF) #define ENFLOORMAS_GET_8000(thisx) ((thisx)->params & 0x8000) 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 34b43ef66c..a8276e6494 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -10,9 +10,9 @@ #define THIS ((EnFr*)thisx) -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFr_Update(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); const ActorInit En_Fr_InitVars = { ACTOR_EN_FR, @@ -26,23 +26,23 @@ const ActorInit En_Fr_InitVars = { (ActorFunc)NULL, }; -void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Init(Actor* thisx, PlayState* play) { EnFr* this = THIS; - if (Flags_GetSwitch(globalCtx, ENFR_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENFR_GET_SWITCHFLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); } else { this->actor.targetMode = ENFR_GET_TARGETMODE(&this->actor); } } -void EnFr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Destroy(Actor* thisx, PlayState* play) { } -void EnFr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFr_Update(Actor* thisx, PlayState* play) { EnFr* this = THIS; - if (Flags_GetSwitch(globalCtx, ENFR_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENFR_GET_SWITCHFLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); } else if (this->actor.xyzDistToPlayerSq < SQ(IREG(29))) { this->actor.flags &= ~ACTOR_FLAG_40000000; diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 8cd9d31b89..80964672cf 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -18,33 +18,33 @@ #define ENFSN_GAVE_KEATONS_MASK (1 << 2) #define ENFSN_GAVE_LETTER_TO_MAMA (1 << 3) -void EnFsn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFsn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFsn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFsn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFsn_Init(Actor* thisx, PlayState* play); +void EnFsn_Destroy(Actor* thisx, PlayState* play); +void EnFsn_Update(Actor* thisx, PlayState* play); +void EnFsn_Draw(Actor* thisx, PlayState* play); -void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_ConverseBackroom(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_Haggle(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_BeginInteraction(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_GiveItem(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_StartBuying(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_SetupEndInteractionImmediately(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_SetupResumeInteraction(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_FaceShopkeeperSelling(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_SetupDeterminePrice(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_SetupEndInteraction(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_MakeOffer(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_ResumeInteraction(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_BrowseShelf(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_ResumeShoppingInteraction(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_AskCanBuyMore(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_SelectItem(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, GlobalContext* globalCtx); -void EnFsn_PlayerCannotBuy(EnFsn* this, GlobalContext* globalCtx); +void EnFsn_Idle(EnFsn* this, PlayState* play); +void EnFsn_ConverseBackroom(EnFsn* this, PlayState* play); +void EnFsn_Haggle(EnFsn* this, PlayState* play); +void EnFsn_BeginInteraction(EnFsn* this, PlayState* play); +void EnFsn_GiveItem(EnFsn* this, PlayState* play); +void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play); +void EnFsn_StartBuying(EnFsn* this, PlayState* play); +void EnFsn_SetupEndInteractionImmediately(EnFsn* this, PlayState* play); +void EnFsn_SetupResumeInteraction(EnFsn* this, PlayState* play); +void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play); +void EnFsn_DeterminePrice(EnFsn* this, PlayState* play); +void EnFsn_SetupDeterminePrice(EnFsn* this, PlayState* play); +void EnFsn_SetupEndInteraction(EnFsn* this, PlayState* play); +void EnFsn_MakeOffer(EnFsn* this, PlayState* play); +void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play); +void EnFsn_BrowseShelf(EnFsn* this, PlayState* play); +void EnFsn_ResumeShoppingInteraction(EnFsn* this, PlayState* play); +void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play); +void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play); +void EnFsn_SelectItem(EnFsn* this, PlayState* play); +void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play); +void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play); typedef enum { /* 0 */ ENFSN_CUTSCENESTATE_STOPPED, @@ -123,19 +123,19 @@ static Vec3f sShopItemPositions[3] = { { 31.0f, 35.0f, -95.0f }, }; -s32 EnFsn_TestItemSelected(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 EnFsn_TestItemSelected(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CUP); } -u16 EnFsn_GetWelcome(GlobalContext* globalCtx) { - switch (Player_GetMask(globalCtx)) { +u16 EnFsn_GetWelcome(PlayState* play) { + switch (Player_GetMask(play)) { case PLAYER_MASK_NONE: return 0x29CC; case PLAYER_MASK_DEKU: @@ -150,7 +150,7 @@ u16 EnFsn_GetWelcome(GlobalContext* globalCtx) { } } -void EnFsn_HandleConversationBackroom(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_HandleConversationBackroom(EnFsn* this, PlayState* play) { switch (this->textId) { case 0: if (!(gSaveContext.save.weekEventReg[80] & 0x10)) { @@ -194,25 +194,25 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, GlobalContext* globalCtx) { this->flags |= ENFSN_END_CONVERSATION; break; } - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); if (this->flags & ENFSN_END_CONVERSATION) { if (this->flags & ENFSN_GAVE_LETTER_TO_MAMA) { this->flags &= ~ENFSN_GAVE_LETTER_TO_MAMA; - func_80151BB4(globalCtx, 34); + func_80151BB4(play, 34); } if (this->flags & ENFSN_GAVE_KEATONS_MASK) { this->flags &= ~ENFSN_GAVE_KEATONS_MASK; - func_80151BB4(globalCtx, 33); + func_80151BB4(play, 33); } - func_80151BB4(globalCtx, 3); + func_80151BB4(play, 3); } } -void EnFsn_HandleSetupResumeInteraction(EnFsn* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx) && +void EnFsn_HandleSetupResumeInteraction(EnFsn* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play) && this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + Actor_ProcessTalkRequest(&this->actor, &play->state); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); if (ENFSN_IS_SHOP(&this->actor)) { this->actor.textId = 0; } @@ -220,11 +220,11 @@ void EnFsn_HandleSetupResumeInteraction(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_UpdateCollider(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_UpdateCollider(EnFsn* this, PlayState* play) { 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; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void EnFsn_HandleLookToShopkeeperBuyingCutscene(EnFsn* this) { @@ -370,7 +370,7 @@ void EnFsn_GetShopItemIds(EnFsn* this) { this->numSellingItems = this->totalSellingItems; } -void EnFsn_SpawnShopItems(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_SpawnShopItems(EnFsn* this, PlayState* play) { s32 i; EnFsn_GetShopItemIds(this); @@ -379,64 +379,64 @@ void EnFsn_SpawnShopItems(EnFsn* this, GlobalContext* globalCtx) { this->items[i] = NULL; } else { this->items[i] = - (EnGirlA*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, sShopItemPositions[i].x, + (EnGirlA*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GIRLA, sShopItemPositions[i].x, sShopItemPositions[i].y, sShopItemPositions[i].z, 0, 0, 0, this->itemIds[i]); } } } -void EnFsn_EndInteraction(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_ProcessTalkRequest(&this->actor, &play->state); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; - globalCtx->interfaceCtx.unk_222 = 0; - globalCtx->interfaceCtx.unk_224 = 0; + play->interfaceCtx.unk_222 = 0; + play->interfaceCtx.unk_224 = 0; this->actor.textId = 0; this->actionFunc = EnFsn_Idle; } -s32 EnFsn_TestEndInteraction(EnFsn* this, GlobalContext* globalCtx, Input* input) { +s32 EnFsn_TestEndInteraction(EnFsn* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - func_80151BB4(globalCtx, 3); + Message_StartTextbox(play, this->actor.textId, &this->actor); + func_80151BB4(play, 3); this->actionFunc = EnFsn_SetupEndInteraction; return true; } return false; } -s32 EnFsn_TestCancelOption(EnFsn* this, GlobalContext* globalCtx, Input* input) { +s32 EnFsn_TestCancelOption(EnFsn* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); return true; } return false; } -void EnFsn_UpdateCursorPos(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_UpdateCursorPos(EnFsn* this, PlayState* play) { s16 x; s16 y; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(globalCtx, &this->items[this->cursorIdx]->actor, &x, &y); + Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y); this->cursorPos.x = x + xOffset; this->cursorPos.y = y + yOffset; this->cursorPos.z = 1.2f; } -s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.choiceIndex) { +s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, PlayState* play) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); if (CURRENT_DAY != 3) { @@ -448,27 +448,27 @@ s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x29D8; } - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); return true; case 1: func_8019F230(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - func_80151BB4(globalCtx, 3); + Message_StartTextbox(play, this->actor.textId, &this->actor); + func_80151BB4(play, 3); this->actionFunc = EnFsn_SetupEndInteraction; return true; } return false; } -s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, GlobalContext* globalCtx, Input* input) { - if (EnFsn_TestEndInteraction(this, globalCtx, input)) { +s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, PlayState* play, Input* input) { + if (EnFsn_TestEndInteraction(this, play, input)) { return true; } - if (EnFsn_TestItemSelected(globalCtx)) { + if (EnFsn_TestItemSelected(play)) { if (!this->items[this->cursorIdx]->isOutOfStock) { this->tmpActionFunc = this->actionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->choiceTextId); + func_80151938(play, this->items[this->cursorIdx]->choiceTextId); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -482,9 +482,9 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, GlobalContext* globalCtx, Input* in return false; } -void EnFsn_UpdateJoystickInputState(EnFsn* this, GlobalContext* globalCtx) { - s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; - s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; +void EnFsn_UpdateJoystickInputState(EnFsn* this, PlayState* play) { + s8 stickX = CONTROLLER1(&play->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&play->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -659,9 +659,9 @@ void EnFsn_UpdateStickDirectionPromptAnim(EnFsn* this) { this->stickLeftPrompt.stickTexY = 95.0f; } -void EnFsn_InitShop(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_InitShop(EnFsn* this, PlayState* play) { if (EnFsn_HasItemsToSell()) { - EnFsn_SpawnShopItems(this, globalCtx); + EnFsn_SpawnShopItems(this, play); this->cursorPos.y = this->cursorPos.x = 100.0f; this->stickAccumY = 0; @@ -717,8 +717,8 @@ void EnFsn_InitShop(EnFsn* this, GlobalContext* globalCtx) { this->actionFunc = EnFsn_Idle; } -void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFsn_Idle(EnFsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->animationIndex == FSN_ANIMATION_HANDS_ON_COUNTER_START) { s16 curFrame = this->skelAnime.curFrame; @@ -735,7 +735,7 @@ void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) { return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -744,19 +744,19 @@ void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENFSN_CUTSCENESTATE_WAITING; } - this->actor.textId = EnFsn_GetWelcome(globalCtx); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + this->actor.textId = EnFsn_GetWelcome(play); + Message_StartTextbox(play, this->actor.textId, &this->actor); player->actor.world.pos.x = 1.0f; player->actor.world.pos.z = -34.0f; this->actionFunc = EnFsn_BeginInteraction; } else if (((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= 15.0f)) && (player->actor.world.pos.y > 0.0f) && ((player->actor.world.pos.z >= -35.0f) && (player->actor.world.pos.z <= -20.0f))) { - func_800B8614(&this->actor, globalCtx, 400.0f); + func_800B8614(&this->actor, play, 400.0f); } } -void EnFsn_Haggle(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_Haggle(EnFsn* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -795,13 +795,13 @@ void EnFsn_Haggle(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_BeginInteraction(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_BeginInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { - func_8011552C(globalCtx, 16); + if (Player_GetMask(play) == PLAYER_MASK_NONE) { + func_8011552C(play, 16); if (EnFsn_HasItemsToSell()) { this->actionFunc = EnFsn_AskBuyOrSell; } else { @@ -817,25 +817,25 @@ void EnFsn_BeginInteraction(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_StartBuying(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnFsn_StartBuying(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); EnFsn_HandleLookToShopkeeperBuyingCutscene(this); - if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + if (talkState == 5 && Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x29CC: this->actor.textId = 0x29CD; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); break; case 0x29CD: this->actor.textId = 0x29CE; EnFsn_HandleLookToShopkeeperBuyingCutscene(this); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); break; case 0x29CE: this->actor.textId = 0xFF; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_DeterminePrice; break; case 0x29CF: @@ -846,11 +846,11 @@ void EnFsn_StartBuying(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (talkState == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x29CC: if (CURRENT_DAY != 3) { @@ -858,7 +858,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x29D2; } - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); break; case 0x29D2: if (gSaveContext.save.weekEventReg[33] & 4) { @@ -869,29 +869,28 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x29D4; } - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); break; case 0x29D3: case 0x29D4: case 0x29FA: case 0x2A01: this->actor.textId = 0x29D5; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); break; } } } else if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + func_8011552C(play, 6); + if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->isSelling = true; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actor.textId = 0x29D6; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_FaceShopkeeperSelling; break; case 1: @@ -899,7 +898,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { this->isSelling = false; this->actor.textId = 0x29CE; EnFsn_HandleLookToShopkeeperBuyingCutscene(this); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_StartBuying; break; } @@ -907,21 +906,21 @@ void EnFsn_AskBuyOrSell(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_SetupDeterminePrice(EnFsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnFsn_SetupDeterminePrice(EnFsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.textId = 0xFF; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_DeterminePrice; } } -void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 itemActionParam; u8 buttonItem; - if (Message_GetState(&globalCtx->msgCtx) == 16) { - itemActionParam = func_80123810(globalCtx); + if (Message_GetState(&play->msgCtx) == 16) { + itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { if (player->heldItemButton == 0) { buttonItem = CUR_FORM_EQUIP(player->heldItemButton); @@ -938,30 +937,30 @@ void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) { this->actionFunc = EnFsn_StartBuying; } this->actor.textId = player->actor.textId; - func_801477B4(globalCtx); + func_801477B4(play); } else if (itemActionParam < PLAYER_AP_NONE) { if (CURRENT_DAY == 3) { this->actor.textId = 0x29DF; } else { this->actor.textId = 0x29D1; } - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - func_80151BB4(globalCtx, 3); + Message_StartTextbox(play, this->actor.textId, &this->actor); + func_80151BB4(play, 3); this->actionFunc = EnFsn_SetupEndInteraction; } } } -void EnFsn_MakeOffer(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); - if (talkState == 4 && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (talkState == 4 && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; @@ -994,36 +993,36 @@ void EnFsn_MakeOffer(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_GiveItem(EnFsn* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnFsn_GiveItem(EnFsn* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if ((this->isSelling == true) && (this->items[this->cursorIdx]->getItemId == GI_MASK_ALL_NIGHT)) { - func_80151BB4(globalCtx, 45); - func_80151BB4(globalCtx, 3); + func_80151BB4(play, 45); + func_80151BB4(play, 3); } this->actor.parent = NULL; if (ENFSN_IS_SHOP(&this->actor) && !this->isSelling) { - func_80123D50(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); } this->actionFunc = EnFsn_SetupResumeInteraction; } else if (this->isSelling == true) { - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, globalCtx, this->getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, this->getItemId, 300.0f, 300.0f); } } -void EnFsn_SetupResumeInteraction(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_SetupResumeInteraction(EnFsn* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if (globalCtx->msgCtx.unk120B1 == 0) { - EnFsn_HandleSetupResumeInteraction(this, globalCtx); + if (play->msgCtx.unk120B1 == 0) { + EnFsn_HandleSetupResumeInteraction(this, play); } } else { - EnFsn_HandleSetupResumeInteraction(this, globalCtx); + EnFsn_HandleSetupResumeInteraction(this, play); } } -void EnFsn_ResumeInteraction(EnFsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (ENFSN_IS_SHOP(&this->actor)) { if (!this->isSelling) { this->cutscene = this->lookToShopkeeperBuyingCutscene; @@ -1032,22 +1031,22 @@ void EnFsn_ResumeInteraction(EnFsn* this, GlobalContext* globalCtx) { this->cutscene = this->lookToShopkeeperCutscene; this->actor.textId = (this->numSellingItems <= 0) ? 0x29DE : 0x29D6; } - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); } ActorCutscene_SetIntentToPlay(this->cutscene); this->actionFunc = EnFsn_ResumeShoppingInteraction; } else { - EnFsn_HandleConversationBackroom(this, globalCtx); + EnFsn_HandleConversationBackroom(this, play); this->actionFunc = EnFsn_ConverseBackroom; } } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnFsn_ResumeShoppingInteraction(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_ResumeShoppingInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); @@ -1057,7 +1056,7 @@ void EnFsn_ResumeShoppingInteraction(EnFsn* this, GlobalContext* globalCtx) { } else if (this->actor.textId != 0x29D6) { this->actionFunc = EnFsn_AskCanBuyAterRunningOutOfItems; } else { - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnFsn_FaceShopkeeperSelling; @@ -1072,7 +1071,7 @@ void EnFsn_ResumeShoppingInteraction(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_LookToShelf(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_LookToShelf(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1085,17 +1084,17 @@ void EnFsn_LookToShelf(EnFsn* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene) != 0) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; - EnFsn_UpdateCursorPos(this, globalCtx); + EnFsn_UpdateCursorPos(this, play); this->actionFunc = EnFsn_BrowseShelf; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnFsn_BrowseShelf(EnFsn* this, GlobalContext* globalCtx) { - u8 talkstate = Message_GetState(&globalCtx->msgCtx); +void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { + u8 talkstate = Message_GetState(&play->msgCtx); s32 pad; u8 prevCursorIdx = this->cursorIdx; @@ -1106,21 +1105,21 @@ void EnFsn_BrowseShelf(EnFsn* this, GlobalContext* globalCtx) { } else { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnFsn_UpdateCursorPos(this, globalCtx); + EnFsn_UpdateCursorPos(this, play); if (talkstate == 5) { - func_8011552C(globalCtx, 6); - if (!EnFsn_HasPlayerSelectedItem(this, globalCtx, CONTROLLER1(&globalCtx->state))) { + func_8011552C(play, 6); + if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) { EnFsn_CursorLeftRight(this); if (this->cursorIdx != prevCursorIdx) { play_sound(NA_SE_SY_CURSOR); - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } } } } } -void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1136,7 +1135,7 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, GlobalContext* globalCtx) { this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actor.textId = 0x29D6; - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->actionFunc = EnFsn_FaceShopkeeperSelling; } else { ActorCutscene_SetIntentToPlay(this->cutscene); @@ -1144,10 +1143,10 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, GlobalContext* globalCtx) { } } -void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { EnGirlA* item = this->items[this->cursorIdx]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_2: func_8019F208(); gSaveContext.save.weekEventReg[33] |= 4; @@ -1158,15 +1157,15 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, GlobalContext* globalCtx) { } func_8019F208(); item = this->items[this->cursorIdx]; - item->buyFanfareFunc(globalCtx, item); - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + item->buyFanfareFunc(play, item); + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; Interface_ChangeAlpha(50); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item = this->items[this->cursorIdx]; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); if (this->stolenItem1 == this->cursorIdx) { SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE); } else if (this->stolenItem2 == this->cursorIdx) { @@ -1178,63 +1177,62 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, GlobalContext* globalCtx) { break; case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); - func_80151938(globalCtx, 0x29F0); + func_80151938(play, 0x29F0); this->actionFunc = EnFsn_PlayerCannotBuy; break; case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); - func_80151938(globalCtx, 0x29DD); + func_80151938(play, 0x29DD); this->actionFunc = EnFsn_PlayerCannotBuy; break; } } -void EnFsn_SetupEndInteraction(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_SetupEndInteraction(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(globalCtx)) { + if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if (globalCtx->msgCtx.unk120B1 == 0) { - EnFsn_EndInteraction(this, globalCtx); + if (play->msgCtx.unk120B1 == 0) { + EnFsn_EndInteraction(this, play); } else { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; } } else { - EnFsn_EndInteraction(this, globalCtx); + EnFsn_EndInteraction(this, play); } } } -void EnFsn_SelectItem(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_SelectItem(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (EnFsn_TakeItemOffShelf(this) && talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnFsn_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + func_8011552C(play, 6); + if (!EnFsn_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnFsn_HandleCanPlayerBuyItem(this, globalCtx); + EnFsn_HandleCanPlayerBuyItem(this, play); break; case 1: func_8019F230(); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } } } } -void EnFsn_PlayerCannotBuy(EnFsn* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } } -void EnFsn_AskCanBuyMore(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -1249,38 +1247,38 @@ void EnFsn_AskCanBuyMore(EnFsn* this, GlobalContext* globalCtx) { } } if (talkState == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->actor.textId = 0xFF; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_DeterminePrice; break; case 1: func_8019F230(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - func_80151BB4(globalCtx, 3); + Message_StartTextbox(play, this->actor.textId, &this->actor); + func_80151BB4(play, 3); break; } } - } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(globalCtx)) { + } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if (globalCtx->msgCtx.unk120B1 == 0) { - EnFsn_EndInteraction(this, globalCtx); + if (play->msgCtx.unk120B1 == 0) { + EnFsn_EndInteraction(this, play); } else { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; } } else { - EnFsn_EndInteraction(this, globalCtx); + EnFsn_EndInteraction(this, play); } } } -void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -1295,92 +1293,92 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, GlobalContext* globalCtx) } } if (talkState == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->isSelling = false; this->actor.textId = 0x29CE; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = EnFsn_StartBuying; break; case 1: func_8019F230(); this->actor.textId = (CURRENT_DAY == 3) ? 0x29DF : 0x29D1; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - func_80151BB4(globalCtx, 3); + Message_StartTextbox(play, this->actor.textId, &this->actor); + func_80151BB4(play, 3); break; } } - } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(globalCtx)) { + } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - if (globalCtx->msgCtx.unk120B1 == 0) { - EnFsn_EndInteraction(this, globalCtx); + if (play->msgCtx.unk120B1 == 0) { + EnFsn_EndInteraction(this, play); } else { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; } } else { - EnFsn_EndInteraction(this, globalCtx); + EnFsn_EndInteraction(this, play); } } } -void EnFsn_FaceShopkeeperSelling(EnFsn* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); u8 cursorIdx; if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnFsn_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - (!Message_ShouldAdvance(globalCtx) || !EnFsn_FacingShopkeeperDialogResult(this, globalCtx)) && + func_8011552C(play, 6); + if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && + (!Message_ShouldAdvance(play) || !EnFsn_FacingShopkeeperDialogResult(this, play)) && this->stickAccumX > 0) { cursorIdx = EnFsn_SetCursorIndexFromNeutral(this); if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; this->actionFunc = EnFsn_LookToShelf; - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } } - } else if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == 5 && Message_ShouldAdvance(play)) { this->actor.textId = 0x29D6; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); - if (globalCtx) {} + Message_StartTextbox(play, this->actor.textId, &this->actor); + if (play) {} } } -void EnFsn_SetupEndInteractionImmediately(EnFsn* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { - EnFsn_EndInteraction(this, globalCtx); +void EnFsn_SetupEndInteractionImmediately(EnFsn* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + EnFsn_EndInteraction(this, play); } } -void EnFsn_IdleBackroom(EnFsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnFsn_IdleBackroom(EnFsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->textId = 0; - EnFsn_HandleConversationBackroom(this, globalCtx); + EnFsn_HandleConversationBackroom(this, play); this->actionFunc = EnFsn_ConverseBackroom; } else if (this->actor.xzDistToPlayer < 100.0f || this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void EnFsn_ConverseBackroom(EnFsn* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnFsn_ConverseBackroom(EnFsn* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->flags & ENFSN_END_CONVERSATION) { this->flags &= ~ENFSN_END_CONVERSATION; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnFsn_IdleBackroom; } else if (this->flags & ENFSN_GIVE_ITEM) { this->flags &= ~ENFSN_GIVE_ITEM; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnFsn_GiveItem; } else { - EnFsn_HandleConversationBackroom(this, globalCtx); + EnFsn_HandleConversationBackroom(this, play); } } } @@ -1407,27 +1405,27 @@ void EnFsn_Blink(EnFsn* this) { } } -void EnFsn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFsn_Init(Actor* thisx, PlayState* play) { s32 pad; EnFsn* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable, FSN_LIMB_MAX + 1); if (ENFSN_IS_SHOP(&this->actor)) { this->actor.shape.rot.y = BINANG_ROT180(this->actor.shape.rot.y); this->actor.flags &= ~ACTOR_FLAG_1; EnFsn_GetCutscenes(this); - EnFsn_InitShop(this, globalCtx); + EnFsn_InitShop(this, play); } else { if ((gSaveContext.save.weekEventReg[33] & 8) || (gSaveContext.save.weekEventReg[79] & 0x40)) { Actor_MarkForDeath(&this->actor); return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->blinkTimer = 20; this->eyeTextureIdx = 0; this->actor.flags |= ACTOR_FLAG_1; @@ -1438,33 +1436,33 @@ void EnFsn_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnFsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFsn_Destroy(Actor* thisx, PlayState* play) { EnFsn* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnFsn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFsn_Update(Actor* thisx, PlayState* play) { EnFsn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRot, &this->unk27A, this->actor.focus.pos); - SubS_FillLimbRotTables(globalCtx, this->limbRotYTable, this->limbRotZTable, ARRAY_COUNT(this->limbRotYTable)); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk27A, this->actor.focus.pos); + SubS_FillLimbRotTables(play, this->limbRotYTable, this->limbRotZTable, ARRAY_COUNT(this->limbRotYTable)); EnFsn_Blink(this); if (ENFSN_IS_SHOP(&this->actor) && EnFsn_HasItemsToSell()) { - EnFsn_UpdateJoystickInputState(this, globalCtx); + EnFsn_UpdateJoystickInputState(this, play); EnFsn_UpdateItemSelectedProperty(this); EnFsn_UpdateStickDirectionPromptAnim(this); EnFsn_UpdateCursorAnim(this); } SkelAnime_Update(&this->skelAnime); if (ENFSN_IS_BACKROOM(&this->actor)) { - EnFsn_UpdateCollider(this, globalCtx); + EnFsn_UpdateCollider(this, play); } } -void EnFsn_DrawCursor(EnFsn* this, GlobalContext* globalCtx, f32 x, f32 y, f32 z, u8 drawCursor) { +void EnFsn_DrawCursor(EnFsn* this, PlayState* play, f32 x, f32 y, f32 z, u8 drawCursor) { s32 ulx; s32 uly; s32 lrx; @@ -1473,9 +1471,9 @@ void EnFsn_DrawCursor(EnFsn* this, GlobalContext* globalCtx, f32 x, f32 y, f32 z s32 dsdx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawCursor != 0) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b, this->cursorColor.a); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -1488,11 +1486,10 @@ void EnFsn_DrawCursor(EnFsn* this, GlobalContext* globalCtx, f32 x, f32 y, f32 z 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); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFsn_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 EnFsn_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; s32 uly; @@ -1503,7 +1500,7 @@ void EnFsn_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 s32 dsdx; s32 dtdy; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -1520,28 +1517,28 @@ void EnFsn_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 dtdy = dy * unk; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFsn_DrawStickDirectionPrompts(EnFsn* this, GlobalContext* globalCtx) { +void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) { s32 drawStickRightPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawStickRightPrompt || drawStickLeftPrompt) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(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 (drawStickRightPrompt) { - EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, + EnFsn_DrawTextRec(play, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, + EnFsn_DrawTextRec(play, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); @@ -1550,22 +1547,22 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, GlobalContext* globalCtx) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickRightPrompt) { - EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, + EnFsn_DrawTextRec(play, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, + EnFsn_DrawTextRec(play, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnFsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFsn* this = THIS; s32 limbRotTableIdx; @@ -1598,7 +1595,7 @@ s32 EnFsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnFsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnFsn* this = THIS; if (limbIndex == FSN_LIMB_HEAD) { @@ -1606,24 +1603,24 @@ void EnFsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve this->actor.focus.pos.y = this->actor.world.pos.y + 60.0f; this->actor.focus.pos.z = this->actor.world.pos.z; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesFrameDL); gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesLensesDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnFsn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFsn_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { gFsnEyeOpenTex, gFsnEyeHalfTex, gFsnEyeClosedTex }; s32 pad; EnFsn* this = THIS; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[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, EnFsn_OverrideLimbDraw, EnFsn_PostLimbDraw, &this->actor); for (i = 0; i < this->totalSellingItems; i++) { @@ -1632,7 +1629,7 @@ void EnFsn_Draw(Actor* thisx, GlobalContext* globalCtx) { this->items[i]->actor.scale.z = 0.2f; } - EnFsn_DrawCursor(this, globalCtx, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnFsn_DrawStickDirectionPrompts(this, globalCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnFsn_DrawCursor(this, play, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnFsn_DrawStickDirectionPrompts(this, play); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h index 66cde7a2a9..4fc9372f27 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h @@ -15,7 +15,7 @@ struct EnFsn; -typedef void (*EnFsnActionFunc)(struct EnFsn*, GlobalContext*); +typedef void (*EnFsnActionFunc)(struct EnFsn*, PlayState*); typedef struct EnFsn { /* 0x000 */ Actor actor; 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 77450f9ab6..476b098566 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -16,44 +16,44 @@ #define THIS ((EnFu*)thisx) -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 func_809622FC(EnFu* this); -void func_80962340(EnFu* this, GlobalContext* globalCtx); +void func_80962340(EnFu* this, PlayState* play); void func_809628BC(EnFu* this); -void func_809628D0(EnFu* this, GlobalContext* globalCtx); +void func_809628D0(EnFu* this, PlayState* play); void func_809629F8(EnFu* this); -void func_80962A10(EnFu* this, GlobalContext* globalCtx); +void func_80962A10(EnFu* this, PlayState* play); void func_80962BA8(EnFu* this); -void func_80962BCC(EnFu* this, GlobalContext* globalCtx); +void func_80962BCC(EnFu* this, PlayState* play); void func_80962D48(EnFu* this); -void func_80962D60(EnFu* this, GlobalContext* globalCtx); +void func_80962D60(EnFu* this, PlayState* play); void func_80962F10(EnFu* this); -void func_80962F4C(EnFu* this, GlobalContext* globalCtx); -void func_8096326C(EnFu* this, GlobalContext* globalCtx); +void func_80962F4C(EnFu* this, PlayState* play); +void func_8096326C(EnFu* this, PlayState* play); void func_809632D0(EnFu* this); -void func_80963350(EnFu* this, GlobalContext* globalCtx); +void func_80963350(EnFu* this, PlayState* play); void func_80963540(EnFu* this); -void func_80963560(EnFu* this, GlobalContext* globalCtx); +void func_80963560(EnFu* this, PlayState* play); void func_80963610(EnFu* this); -void func_80963630(EnFu* this, GlobalContext* globalCtx); -s32 func_80963810(GlobalContext* globalCtx, Vec3f pos); -s32 func_809638F8(GlobalContext* globalCtx); -void func_809639D0(EnFu* this, GlobalContext* globalCtx); -void func_80963DE4(EnFu* this, GlobalContext* globalCtx); -void func_80963EAC(EnFu* this, GlobalContext* globalCtx); -void func_80963F44(EnFu* this, GlobalContext* globalCtx); -void func_80963F88(EnFu* this, GlobalContext* globalCtx); -void func_80963FF8(EnFu* this, GlobalContext* globalCtx); -void func_8096413C(EnFu* this, GlobalContext* globalCtx); -void func_80964190(EnFu* this, GlobalContext* globalCtx); -void func_8096426C(EnFu* this, GlobalContext* globalCtx); +void func_80963630(EnFu* this, PlayState* play); +s32 func_80963810(PlayState* play, Vec3f pos); +s32 func_809638F8(PlayState* play); +void func_809639D0(EnFu* this, PlayState* play); +void func_80963DE4(EnFu* this, PlayState* play); +void func_80963EAC(EnFu* this, PlayState* play); +void func_80963F44(EnFu* this, PlayState* play); +void func_80963F88(EnFu* this, PlayState* play); +void func_80963FF8(EnFu* this, PlayState* play); +void func_8096413C(EnFu* this, PlayState* play); +void func_80964190(EnFu* this, PlayState* play); +void func_8096426C(EnFu* this, PlayState* play); void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len); -void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len); -void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len); +void func_809647EC(PlayState* play, EnFuUnkStruct* ptr, s32 len); +void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len); const ActorInit En_Fu_InitVars = { ACTOR_EN_FU, @@ -103,7 +103,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -void func_809616E0(EnFu* this, GlobalContext* globalCtx) { +void func_809616E0(EnFu* this, PlayState* play) { s32 i; f32 temp_f20; f32 temp_f22; @@ -122,7 +122,7 @@ void func_809616E0(EnFu* this, GlobalContext* globalCtx) { atan = Math_FAtan2F(temp_f22, temp_f20); if (!spA0 || ((i % 2) != 0)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, this->unk_544, this->unk_538[i].x, this->unk_538[i].y, + Actor_Spawn(&play->actorCtx, play, this->unk_544, this->unk_538[i].x, this->unk_538[i].y, this->unk_538[i].z, 0, atan, 0, i); this->unk_54C++; } @@ -136,17 +136,17 @@ void func_809616E0(EnFu* this, GlobalContext* globalCtx) { sp94.x = this->unk_538[i].x; sp94.y = this->unk_538[i].y; sp94.z = this->unk_538[i].z; - func_800B0EB0(globalCtx, &sp94, &sp88, &sp7C, &sp78, &sp74, 100, 150, 10); + func_800B0EB0(play, &sp94, &sp88, &sp7C, &sp78, &sp74, 100, 150, 10); sp94.x -= 0.1f * temp_f20; sp94.z -= 0.1f * temp_f22; - func_800B3030(globalCtx, &sp94, &sp88, &sp7C, 100, 0, 3); + func_800B3030(play, &sp94, &sp88, &sp7C, 100, 0, 3); } } } -void func_809619D0(EnFu* this, GlobalContext* globalCtx) { +void func_809619D0(EnFu* this, PlayState* play) { s32 i; - Path* path = &globalCtx->setupPathList[ENFU_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENFU_GET_FF00(&this->actor)]; switch (CURRENT_DAY) { case 1: @@ -171,18 +171,18 @@ void func_809619D0(EnFu* this, GlobalContext* globalCtx) { } for (i = 0; i < this->unk_542; i++) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } this->unk_520 = path->count; this->unk_538 = Lib_SegmentedToVirtual(path->points); - func_809616E0(this, globalCtx); + func_809616E0(this, play); } -void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Init(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = THIS; - Actor* fuKaiten = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; + Actor* fuKaiten = play->actorCtx.actorLists[ACTORCAT_BG].first; while (fuKaiten != NULL) { if (fuKaiten->id == ACTOR_BG_FU_KAITEN) { @@ -194,10 +194,10 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { if (fuKaiten != NULL) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mu_Skel_00B2B0, &object_mu_Anim_001F74, - this->jointTable, this->morphTable, 21); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_00B2B0, &object_mu_Anim_001F74, this->jointTable, + this->morphTable, 21); + 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.flags &= ~ACTOR_FLAG_1; @@ -214,24 +214,24 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_550 = 0; func_809622FC(this); this->actor.targetMode = 6; - func_809619D0(this, globalCtx); + func_809619D0(this, play); if (CURRENT_DAY == 2) { Vec3f sp40 = this->actor.child->home.pos; - this->unk_2D4 = (BgFuMizu*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_FU_MIZU, sp40.x, sp40.y, - sp40.z, 0, 0, 0, 0); + this->unk_2D4 = + (BgFuMizu*)Actor_Spawn(&play->actorCtx, play, ACTOR_BG_FU_MIZU, sp40.x, sp40.y, sp40.z, 0, 0, 0, 0); } else { this->unk_2D4 = NULL; } } } -void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Destroy(Actor* thisx, PlayState* play) { EnFu* this = THIS; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[8] &= (u8)~1; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80961D10(EnFu* this) { @@ -250,15 +250,15 @@ s32 func_80961D10(EnFu* this) { return false; } -void func_80961D7C(GlobalContext* globalCtx) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; +void func_80961D7C(PlayState* play) { + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { if ((explosive->id == ACTOR_EN_BOM) && (explosive->bgCheckFlags & 1)) { EnBom* bomb = (EnBom*)explosive; if (bomb->actor.floorBgId != BGCHECK_SCENE) { - DynaPolyActor* fuKago = DynaPoly_GetActor(&globalCtx->colCtx, bomb->actor.floorBgId); + DynaPolyActor* fuKago = DynaPoly_GetActor(&play->colCtx, bomb->actor.floorBgId); if ((fuKago != NULL) && (fuKago->actor.id == ACTOR_EN_FU_KAGO)) { Math_SmoothStepToF(&bomb->actor.world.pos.x, fuKago->actor.world.pos.x, 0.1f, 1.0f, 0.5f); @@ -270,8 +270,8 @@ void func_80961D7C(GlobalContext* globalCtx) { } } -void func_80961E88(GlobalContext* globalCtx) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; +void func_80961E88(PlayState* play) { + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { Actor_MarkForDeath(explosive); @@ -279,8 +279,8 @@ void func_80961E88(GlobalContext* globalCtx) { } } -void func_80961EC8(GlobalContext* globalCtx) { - Actor* fuMato = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +void func_80961EC8(PlayState* play) { + Actor* fuMato = play->actorCtx.actorLists[ACTORCAT_BG].first; while (fuMato != NULL) { if (fuMato->id == ACTOR_EN_FU_MATO) { @@ -290,8 +290,8 @@ void func_80961EC8(GlobalContext* globalCtx) { } } -void func_80961F00(GlobalContext* globalCtx) { - Actor* fuKago = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +void func_80961F00(PlayState* play) { + Actor* fuKago = play->actorCtx.actorLists[ACTORCAT_BG].first; while (fuKago != NULL) { if (fuKago->id == ACTOR_EN_FU_KAGO) { @@ -301,8 +301,8 @@ void func_80961F00(GlobalContext* globalCtx) { } } -void func_80961F38(GlobalContext* globalCtx, Vec3f* arg1, s16* arg2, s16 arg3, s16 arg4, s16 arg5) { - Player* player = GET_PLAYER(globalCtx); +void func_80961F38(PlayState* play, Vec3f* arg1, s16* arg2, s16 arg3, s16 arg4, s16 arg5) { + Player* player = GET_PLAYER(play); s16 sp42; s16 sp40; Vec3f sp34 = player->actor.focus.pos; @@ -330,11 +330,11 @@ void func_80961F38(GlobalContext* globalCtx, Vec3f* arg1, s16* arg2, s16 arg3, s Math_SmoothStepToS(&arg2[2], 0, 6, 2000, 100); } -void func_8096209C(EnFu* this, GlobalContext* globalCtx) { +void func_8096209C(EnFu* this, PlayState* play) { Vec3f sp34; if (this->unk_53C & 1) { - func_80961F38(globalCtx, &this->unk_508, this->unk_524, this->actor.shape.rot.y, 0x38E3, 0x6AAA); + func_80961F38(play, &this->unk_508, this->unk_524, this->actor.shape.rot.y, 0x38E3, 0x6AAA); } else { Math_SmoothStepToS(&this->unk_524[0], 0, 6, 6000, 100); Math_SmoothStepToS(&this->unk_524[1], 0, 6, 6000, 100); @@ -344,7 +344,7 @@ void func_8096209C(EnFu* this, GlobalContext* globalCtx) { if (this->unk_53C & 2) { s16 rotY = BINANG_SUB(this->actor.shape.rot.y, 0x8000); - func_80961F38(globalCtx, &this->unk_514, this->unk_52A, rotY, 0x38E3, 0x5555); + func_80961F38(play, &this->unk_514, this->unk_52A, rotY, 0x38E3, 0x5555); } else { Math_SmoothStepToS(&this->unk_52A[0], 0, 6, 6000, 100); Math_SmoothStepToS(&this->unk_52A[1], 0, 6, 6000, 100); @@ -375,87 +375,87 @@ void func_809622FC(EnFu* this) { this->actionFunc = func_80962340; } -void func_80962340(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962340(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_54A == 2) { this->actor.flags |= ACTOR_FLAG_10000; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->unk_54A == 2) { if (this->unk_552 == 0x287D) { if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - Message_StartTextbox(globalCtx, 0x287E, &this->actor); + Message_StartTextbox(play, 0x287E, &this->actor); this->unk_552 = 0x287E; } else if ((CURRENT_DAY == 3) && (gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { if ((gSaveContext.save.weekEventReg[22] & 0x40)) { - Message_StartTextbox(globalCtx, 0x2883, &this->actor); + Message_StartTextbox(play, 0x2883, &this->actor); this->unk_552 = 0x2883; } else { - Message_StartTextbox(globalCtx, 0x2880, &this->actor); + Message_StartTextbox(play, 0x2880, &this->actor); this->unk_552 = 0x2880; } } else { - Message_StartTextbox(globalCtx, 0x287E, &this->actor); + Message_StartTextbox(play, 0x287E, &this->actor); this->unk_552 = 0x287E; } } else if ((gSaveContext.unk_3DE0[4] == 0) && (this->unk_552 != 0x2888)) { - Message_StartTextbox(globalCtx, 0x2886, &this->actor); + Message_StartTextbox(play, 0x2886, &this->actor); this->unk_552 = 0x2886; } else { - Message_StartTextbox(globalCtx, 0x2889, &this->actor); + Message_StartTextbox(play, 0x2889, &this->actor); this->unk_552 = 0x2889; } this->actor.flags &= ~ACTOR_FLAG_10000; player->stateFlags1 &= ~0x20; this->unk_54A = 1; } else { - Message_StartTextbox(globalCtx, 0x283C, &this->actor); + Message_StartTextbox(play, 0x283C, &this->actor); this->unk_552 = 0x283C; } func_809628BC(this); } else if (this->unk_54A == 2) { - func_800B8614(&this->actor, globalCtx, 500.0f); + func_800B8614(&this->actor, play, 500.0f); } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_SUB(this->actor.child->shape.rot.y, 0x4000), 10, 3000, 100); } -void func_80962588(EnFu* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx) && (this->unk_552 == 0x2871)) { +void func_80962588(EnFu* this, PlayState* play) { + if (Message_ShouldAdvance(play) && (this->unk_552 == 0x2871)) { if (1) {} - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.save.playerData.rupees >= 10) { func_8019F208(); func_801159EC(-10); - func_80963DE4(this, globalCtx); + func_80963DE4(this, play); } else { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x2873, &this->actor); + Message_StartTextbox(play, 0x2873, &this->actor); this->unk_552 = 0x2873; } } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x2872, &this->actor); + Message_StartTextbox(play, 0x2872, &this->actor); this->unk_552 = 0x2872; } } } -void func_80962660(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962660(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->unk_552) { case 0x283C: - func_80963F44(this, globalCtx); + func_80963F44(this, play); break; case 0x283D: - func_809639D0(this, globalCtx); + func_809639D0(this, play); break; case 0x283E: @@ -463,11 +463,11 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { case 0x2841: case 0x2843: case 0x2845: - func_80963F44(this, globalCtx); + func_80963F44(this, play); break; case 0x2846: - Message_StartTextbox(globalCtx, 0x2849, &this->actor); + Message_StartTextbox(play, 0x2849, &this->actor); this->unk_552 = 0x2849; break; @@ -497,7 +497,7 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { case 0x2877: case 0x2879: case 0x287B: - func_80963F44(this, globalCtx); + func_80963F44(this, play); break; case 0x2848: @@ -518,7 +518,7 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { case 0x286A: case 0x286C: case 0x286E: - Message_StartTextbox(globalCtx, 0x2871, &this->actor); + Message_StartTextbox(play, 0x2871, &this->actor); this->unk_552 = 0x2871; break; @@ -526,31 +526,31 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { case 0x2878: case 0x287A: case 0x287C: - Message_StartTextbox(globalCtx, 0x287D, &this->actor); + Message_StartTextbox(play, 0x287D, &this->actor); this->unk_552 = 0x287D; break; case 0x287D: gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - func_801477B4(globalCtx); + func_801477B4(play); player->stateFlags1 |= 0x20; this->unk_53C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); func_801A2BB8(NA_BGM_MINI_GAME_2); if (this->unk_542 == 0) { if (this->unk_546 == 1) { - func_80961EC8(globalCtx); + func_80961EC8(play); } func_809629F8(this); } else if (this->unk_542 == 1) { if (this->unk_546 == 1) { - func_80961F00(globalCtx); + func_80961F00(play); } func_80962BA8(this); } else if (this->unk_542 == 2) { if (this->unk_546 == 1) { - func_80961EC8(globalCtx); + func_80961EC8(play); } func_80962D48(this); } @@ -559,14 +559,14 @@ void func_80962660(EnFu* this, GlobalContext* globalCtx) { case 0x287E: case 0x2880: case 0x2883: - func_801477B4(globalCtx); + func_801477B4(play); func_80963540(this); - func_80963560(this, globalCtx); + func_80963560(this, play); break; case 0x2886: case 0x2889: - func_80963F44(this, globalCtx); + func_80963F44(this, play); break; } } @@ -576,8 +576,8 @@ void func_809628BC(EnFu* this) { this->actionFunc = func_809628D0; } -void func_809628D0(EnFu* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_809628D0(EnFu* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); switch (sp27) { case 0: @@ -587,15 +587,15 @@ void func_809628D0(EnFu* this, GlobalContext* globalCtx) { break; case 4: - func_80962588(this, globalCtx); + func_80962588(this, play); break; case 5: - func_80962660(this, globalCtx); + func_80962660(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk_54A = 1; switch (this->unk_552) { case 0x287F: @@ -618,11 +618,11 @@ void func_809628D0(EnFu* this, GlobalContext* globalCtx) { } if (sp27 != 3) { - func_80964190(this, globalCtx); - func_8096426C(this, globalCtx); + func_80964190(this, play); + func_8096426C(this, play); } - func_8096413C(this, globalCtx); + func_8096413C(this, play); } void func_809629F8(EnFu* this) { @@ -630,8 +630,8 @@ void func_809629F8(EnFu* this) { this->actionFunc = func_80962A10; } -void func_80962A10(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962A10(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; this->unk_53C = 0; @@ -646,13 +646,13 @@ void func_80962A10(EnFu* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~0x20; func_8010E9F0(4, 60); if (this->unk_546 == 1) { - func_809616E0(this, globalCtx); + func_809616E0(this, play); } else { this->unk_546 = 1; } if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && gSaveContext.save.playerData.magicAcquired) { - Parameter_AddMagic(globalCtx, + Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 48) + 48); } @@ -667,8 +667,8 @@ void func_80962BA8(EnFu* this) { this->actionFunc = func_80962BCC; } -void func_80962BCC(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962BCC(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bounceHeight < 30.0f) || (fuKaiten->bounceSpeed < 600)) { @@ -685,12 +685,12 @@ void func_80962BCC(EnFu* this, GlobalContext* globalCtx) { func_8010E9F0(4, 60); if (this->unk_546 == 1) { - func_809616E0(this, globalCtx); + func_809616E0(this, play); } else { this->unk_546 = 1; } - globalCtx->unk_1887E = 30; + play->unk_1887E = 30; func_80962F10(this); } @@ -699,8 +699,8 @@ void func_80962D48(EnFu* this) { this->actionFunc = func_80962D60; } -void func_80962D60(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962D60(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bounceHeight < 40.0f) || (fuKaiten->bounceSpeed < 600)) { @@ -716,19 +716,19 @@ void func_80962D60(EnFu* this, GlobalContext* globalCtx) { func_8010E9F0(4, 60); if (this->unk_546 == 1) { - func_809616E0(this, globalCtx); + func_809616E0(this, play); } else { this->unk_546 = 1; } - globalCtx->unk_1887D = 30; + play->unk_1887D = 30; func_80962F10(this); } -void func_80962EBC(EnFu* this, GlobalContext* globalCtx) { +void func_80962EBC(EnFu* this, PlayState* play) { if (this->unk_542 != 0) { if (this->actor.cutscene != -1) { - Camera_ChangeDataIdx(globalCtx->cameraPtrs[CAM_ID_MAIN], + Camera_ChangeDataIdx(play->cameraPtrs[CAM_ID_MAIN], ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); } } @@ -741,8 +741,8 @@ void func_80962F10(EnFu* this) { this->actionFunc = func_80962F4C; } -void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80962F4C(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; switch (this->unk_542) { @@ -753,11 +753,11 @@ void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { break; case 1: - globalCtx->unk_1887E = 30; + play->unk_1887E = 30; break; case 2: - globalCtx->unk_1887D = 30; + play->unk_1887D = 30; break; } @@ -772,21 +772,21 @@ void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { } if (func_80961D10(this)) { - Message_StartTextbox(globalCtx, 0x288B, &this->actor); + Message_StartTextbox(play, 0x288B, &this->actor); } if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) && (player->actor.bgCheckFlags & 1)) || (gSaveContext.unk_3DE0[4] < 1) || (this->unk_548 == this->unk_54C)) { player->stateFlags3 &= ~0x400000; - func_80961E88(globalCtx); + func_80961E88(play); player->stateFlags1 |= 0x20; if (this->unk_548 < this->unk_54C) { if (gSaveContext.unk_3DE0[4] == 0) { - Message_StartTextbox(globalCtx, 0x2885, &this->actor); + Message_StartTextbox(play, 0x2885, &this->actor); this->unk_552 = 0x2885; } else { - Message_StartTextbox(globalCtx, 0x2888, &this->actor); + Message_StartTextbox(play, 0x2888, &this->actor); this->unk_552 = 0x2888; } func_801A2C20(); @@ -800,21 +800,21 @@ void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { gSaveContext.unk_3DE0[4] = 0; gSaveContext.unk_3DD0[4] = 5; func_801A3098(NA_BGM_GET_ITEM | 0x900); - func_8011B4E0(globalCtx, 1); + func_8011B4E0(play, 1); this->unk_54A = 3; func_809632D0(this); } } - func_80962EBC(this, globalCtx); + func_80962EBC(this, play); } void func_80963258(EnFu* this) { this->actionFunc = func_8096326C; } -void func_8096326C(EnFu* this, GlobalContext* globalCtx) { - func_80963FF8(this, globalCtx); - if (func_80963810(globalCtx, this->actor.world.pos)) { +void func_8096326C(EnFu* this, PlayState* play) { + func_80963FF8(this, play); + if (func_80963810(play, this->actor.world.pos)) { func_809622FC(this); } } @@ -836,34 +836,34 @@ void func_809632D0(EnFu* this) { this->actionFunc = func_80963350; } -void func_80963350(EnFu* this, GlobalContext* globalCtx) { +void func_80963350(EnFu* this, PlayState* play) { static s32 D_80964C24 = 0; BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; - if ((this->unk_54A == 0) && (((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) || - ((Message_GetState(&globalCtx->msgCtx) == 2) && (globalCtx->msgCtx.unk12023 == 1)))) { - func_801477B4(globalCtx); + if ((this->unk_54A == 0) && (((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) || + ((Message_GetState(&play->msgCtx) == 2) && (play->msgCtx.unk12023 == 1)))) { + func_801477B4(play); this->unk_54A = 2; D_80964C24 = 1; } - if ((this->unk_54A == 3) && (globalCtx->interfaceCtx.unk_286 == 0)) { + if ((this->unk_54A == 3) && (play->interfaceCtx.unk_286 == 0)) { this->unk_54A = 2; D_80964C24 = 1; } if ((fuKaiten->rotationSpeed != 0) || (fuKaiten->bounceSpeed != 0) || (fuKaiten->bounceHeight > 0.0f) || - !func_809638F8(globalCtx)) { + !func_809638F8(play)) { Math_SmoothStepToS(&fuKaiten->rotationSpeed, 0, 10, 10, 5); Math_SmoothStepToS(&fuKaiten->bounceSpeed, 0, 10, 15, 5); Math_SmoothStepToF(&fuKaiten->bounceHeight, 0.0f, 0.1f, 1.0f, 1.0f); Math_SmoothStepToF(&fuKaiten->elevation, 0.0f, 0.1f, 1.0f, 1.0f); - func_80962EBC(this, globalCtx); + func_80962EBC(this, play); } else if (D_80964C24 == 1) { D_80964C24 = 0; fuKaiten->bounce = 0; - func_80963F88(this, globalCtx); - globalCtx->actorCtx.unk268 = 1; + func_80963F88(this, play); + play->actorCtx.unk268 = 1; func_80963258(this); } } @@ -873,14 +873,14 @@ void func_80963540(EnFu* this) { this->actionFunc = func_80963560; } -void func_80963560(EnFu* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80963560(EnFu* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80963610(this); } else if ((this->unk_552 == 0x2880) && !(gSaveContext.save.weekEventReg[22] & 0x80)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } this->actor.child->freezeTimer = 10; } @@ -890,25 +890,25 @@ void func_80963610(EnFu* this) { this->actionFunc = func_80963630; } -void func_80963630(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80963630(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20) && (CURRENT_DAY == 3) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { if (gSaveContext.save.weekEventReg[22] & 0x40) { - Message_StartTextbox(globalCtx, 0x2884, &this->actor); + Message_StartTextbox(play, 0x2884, &this->actor); this->unk_552 = 0x2884; } else if (!(gSaveContext.save.weekEventReg[22] & 0x80)) { gSaveContext.save.weekEventReg[22] |= 0x80; - Message_StartTextbox(globalCtx, 0x2882, &this->actor); + Message_StartTextbox(play, 0x2882, &this->actor); this->unk_552 = 0x2882; } else { - Message_StartTextbox(globalCtx, 0x2881, &this->actor); + Message_StartTextbox(play, 0x2881, &this->actor); this->unk_552 = 0x2881; } } else { - Message_StartTextbox(globalCtx, 0x287F, &this->actor); + Message_StartTextbox(play, 0x287F, &this->actor); this->unk_552 = 0x287F; } @@ -934,12 +934,12 @@ void func_80963630(EnFu* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~0x20; } else { this->actor.child->freezeTimer = 10; - func_800B85E0(&this->actor, globalCtx, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } -s32 func_80963810(GlobalContext* globalCtx, Vec3f pos) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80963810(PlayState* play, Vec3f pos) { + Player* player = GET_PLAYER(play); f32 sp28; f32 phi_f0; s16 sp22; @@ -955,8 +955,8 @@ s32 func_80963810(GlobalContext* globalCtx, Vec3f pos) { phi_f0 = 80.0f; } - globalCtx->actorCtx.unk268 = 1; - func_800B6F20(globalCtx, &globalCtx->actorCtx.unk_26C, phi_f0, sp22); + play->actorCtx.unk268 = 1; + func_800B6F20(play, &play->actorCtx.unk_26C, phi_f0, sp22); if (sp28 < 80.0f) { return true; @@ -964,102 +964,102 @@ s32 func_80963810(GlobalContext* globalCtx, Vec3f pos) { return false; } -s32 func_809638F8(GlobalContext* globalCtx) { +s32 func_809638F8(PlayState* play) { s32 ret = true; - if (globalCtx->envCtx.lightSettings.diffuseColor1[0] > 25) { - globalCtx->envCtx.lightSettings.diffuseColor1[0] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[0] > 25) { + play->envCtx.lightSettings.diffuseColor1[0] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.diffuseColor1[0] = 0; + play->envCtx.lightSettings.diffuseColor1[0] = 0; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[1] > 25) { - globalCtx->envCtx.lightSettings.diffuseColor1[1] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[1] > 25) { + play->envCtx.lightSettings.diffuseColor1[1] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.diffuseColor1[1] = 0; + play->envCtx.lightSettings.diffuseColor1[1] = 0; } - if (globalCtx->envCtx.lightSettings.diffuseColor1[2] > 25) { - globalCtx->envCtx.lightSettings.diffuseColor1[2] -= 25; + if (play->envCtx.lightSettings.diffuseColor1[2] > 25) { + play->envCtx.lightSettings.diffuseColor1[2] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.diffuseColor1[2] = 0; + play->envCtx.lightSettings.diffuseColor1[2] = 0; } - if (globalCtx->envCtx.lightSettings.ambientColor[0] > 25) { - globalCtx->envCtx.lightSettings.ambientColor[0] -= 25; + if (play->envCtx.lightSettings.ambientColor[0] > 25) { + play->envCtx.lightSettings.ambientColor[0] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.ambientColor[0] = 0; + play->envCtx.lightSettings.ambientColor[0] = 0; } - if (globalCtx->envCtx.lightSettings.ambientColor[1] > 25) { - globalCtx->envCtx.lightSettings.ambientColor[1] -= 25; + if (play->envCtx.lightSettings.ambientColor[1] > 25) { + play->envCtx.lightSettings.ambientColor[1] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.ambientColor[1] = 0; + play->envCtx.lightSettings.ambientColor[1] = 0; } - if (globalCtx->envCtx.lightSettings.ambientColor[2] > 25) { - globalCtx->envCtx.lightSettings.ambientColor[2] -= 25; + if (play->envCtx.lightSettings.ambientColor[2] > 25) { + play->envCtx.lightSettings.ambientColor[2] -= 25; ret = false; } else { - globalCtx->envCtx.lightSettings.ambientColor[2] = 0; + play->envCtx.lightSettings.ambientColor[2] = 0; } return ret; } -void func_809639D0(EnFu* this, GlobalContext* globalCtx) { +void func_809639D0(EnFu* this, PlayState* play) { switch (CURRENT_DAY) { case 1: if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { - Message_StartTextbox(globalCtx, 0x2853, &this->actor); + Message_StartTextbox(play, 0x2853, &this->actor); this->unk_552 = 0x2853; } else if (gSaveContext.save.weekEventReg[22] & 0x10) { - Message_StartTextbox(globalCtx, 0x284D, &this->actor); + Message_StartTextbox(play, 0x284D, &this->actor); this->unk_552 = 0x284D; } else if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x284F, &this->actor); + Message_StartTextbox(play, 0x284F, &this->actor); this->unk_552 = 0x284F; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x2851, &this->actor); + Message_StartTextbox(play, 0x2851, &this->actor); this->unk_552 = 0x2851; } } else { - Message_StartTextbox(globalCtx, 0x286F, &this->actor); + Message_StartTextbox(play, 0x286F, &this->actor); this->unk_552 = 0x286F; } break; case 2: if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - Message_StartTextbox(globalCtx, 0x286F, &this->actor); + Message_StartTextbox(play, 0x286F, &this->actor); this->unk_552 = 0x286F; } else if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { - Message_StartTextbox(globalCtx, 0x2853, &this->actor); + Message_StartTextbox(play, 0x2853, &this->actor); this->unk_552 = 0x2853; } else if (!(gSaveContext.save.weekEventReg[22] & 0x10)) { if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x285B, &this->actor); + Message_StartTextbox(play, 0x285B, &this->actor); this->unk_552 = 0x285B; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x285D, &this->actor); + Message_StartTextbox(play, 0x285D, &this->actor); this->unk_552 = 0x285D; } } else if (gSaveContext.save.weekEventReg[22] & 0x20) { - Message_StartTextbox(globalCtx, 0x2855, &this->actor); + Message_StartTextbox(play, 0x2855, &this->actor); this->unk_552 = 0x2855; } else if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x2857, &this->actor); + Message_StartTextbox(play, 0x2857, &this->actor); this->unk_552 = 0x2857; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x2859, &this->actor); + Message_StartTextbox(play, 0x2859, &this->actor); this->unk_552 = 0x2859; } break; @@ -1067,121 +1067,121 @@ void func_809639D0(EnFu* this, GlobalContext* globalCtx) { case 3: if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - func_80963EAC(this, globalCtx); + func_80963EAC(this, play); } else { - Message_StartTextbox(globalCtx, 0x2841, &this->actor); + Message_StartTextbox(play, 0x2841, &this->actor); this->unk_552 = 0x2841; } } else if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { - Message_StartTextbox(globalCtx, 0x284B, &this->actor); + Message_StartTextbox(play, 0x284B, &this->actor); this->unk_552 = 0x284B; } else if (gSaveContext.save.weekEventReg[22] & 0x40) { if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { - Message_StartTextbox(globalCtx, 0x285F, &this->actor); + Message_StartTextbox(play, 0x285F, &this->actor); this->unk_552 = 0x285F; } else { - Message_StartTextbox(globalCtx, 0x2861, &this->actor); + Message_StartTextbox(play, 0x2861, &this->actor); this->unk_552 = 0x2861; } } else if ((gSaveContext.save.weekEventReg[22] & 0x10) && (gSaveContext.save.weekEventReg[22] & 0x20)) { if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x2863, &this->actor); + Message_StartTextbox(play, 0x2863, &this->actor); this->unk_552 = 0x2863; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x2865, &this->actor); + Message_StartTextbox(play, 0x2865, &this->actor); this->unk_552 = 0x2865; } } else if ((gSaveContext.save.weekEventReg[22] & 0x10) || (gSaveContext.save.weekEventReg[22] & 0x20)) { if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x2867, &this->actor); + Message_StartTextbox(play, 0x2867, &this->actor); this->unk_552 = 0x2867; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x2869, &this->actor); + Message_StartTextbox(play, 0x2869, &this->actor); this->unk_552 = 0x2869; } } else if (this->unk_53E == 1) { - Message_StartTextbox(globalCtx, 0x286B, &this->actor); + Message_StartTextbox(play, 0x286B, &this->actor); this->unk_552 = 0x286B; } else { this->unk_53E = 1; - Message_StartTextbox(globalCtx, 0x286D, &this->actor); + Message_StartTextbox(play, 0x286D, &this->actor); this->unk_552 = 0x286D; } break; } } -void func_80963DE4(EnFu* this, GlobalContext* globalCtx) { +void func_80963DE4(EnFu* this, PlayState* play) { switch (this->unk_542) { case 0: if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - Message_StartTextbox(globalCtx, 0x2875, &this->actor); + Message_StartTextbox(play, 0x2875, &this->actor); this->unk_552 = 0x2875; } else { - Message_StartTextbox(globalCtx, 0x2877, &this->actor); + Message_StartTextbox(play, 0x2877, &this->actor); this->unk_552 = 0x2877; } break; case 1: - Message_StartTextbox(globalCtx, 0x2879, &this->actor); + Message_StartTextbox(play, 0x2879, &this->actor); this->unk_552 = 0x2879; break; case 2: - Message_StartTextbox(globalCtx, 0x287B, &this->actor); + Message_StartTextbox(play, 0x287B, &this->actor); this->unk_552 = 0x287B; break; } } -void func_80963EAC(EnFu* this, GlobalContext* globalCtx) { +void func_80963EAC(EnFu* this, PlayState* play) { if (gSaveContext.save.playerData.magicAcquired) { if (this->unk_540 == 1) { - Message_StartTextbox(globalCtx, 0x2847, &this->actor); + Message_StartTextbox(play, 0x2847, &this->actor); this->unk_552 = 0x2847; } else { this->unk_540 = 1; - Message_StartTextbox(globalCtx, 0x2845, &this->actor); + Message_StartTextbox(play, 0x2845, &this->actor); this->unk_552 = 0x2845; } } else { - Message_StartTextbox(globalCtx, 0x2843, &this->actor); + Message_StartTextbox(play, 0x2843, &this->actor); this->unk_552 = 0x2843; } } -void func_80963F44(EnFu* this, GlobalContext* globalCtx) { +void func_80963F44(EnFu* this, PlayState* play) { u16 sp1E = this->unk_552 + 1; - Message_StartTextbox(globalCtx, sp1E, &this->actor); + Message_StartTextbox(play, sp1E, &this->actor); this->unk_552 = sp1E; } -void func_80963F88(EnFu* this, GlobalContext* globalCtx) { +void func_80963F88(EnFu* this, PlayState* play) { if (this->unk_542 == 1) { - func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 75); - globalCtx->unk_1887E = 0; + func_800DFAC8(play->cameraPtrs[CAM_ID_MAIN], 75); + play->unk_1887E = 0; } else if (this->unk_542 == 2) { - globalCtx->unk_1887D = 0; - func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 75); + play->unk_1887D = 0; + func_800DFAC8(play->cameraPtrs[CAM_ID_MAIN], 75); } } -void func_80963FF8(EnFu* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80963FF8(EnFu* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x100000) { - globalCtx->actorCtx.unk268 = 1; - globalCtx->actorCtx.unk_26C.press.button = 0x8000; + play->actorCtx.unk268 = 1; + play->actorCtx.unk_26C.press.button = 0x8000; } else { - globalCtx->actorCtx.unk268 = 1; + play->actorCtx.unk268 = 1; } } -void func_80964034(EnFu* this, GlobalContext* globalCtx) { +void func_80964034(EnFu* this, PlayState* play) { Vec3f sp2C; if (DECR(this->unk_54E) == 0) { @@ -1190,10 +1190,10 @@ void func_80964034(EnFu* this, GlobalContext* globalCtx) { sp2C.y += 62.0f; func_80964694(this, this->unk_2D8, &sp2C, ARRAY_COUNT(this->unk_2D8)); } - func_809647EC(globalCtx, this->unk_2D8, ARRAY_COUNT(this->unk_2D8)); + func_809647EC(play, this->unk_2D8, ARRAY_COUNT(this->unk_2D8)); } -void func_809640D8(EnFu* this, GlobalContext* globalCtx) { +void func_809640D8(EnFu* this, PlayState* play) { if ((this->actionFunc == func_80962A10) || (this->actionFunc == func_80962BCC) || (this->actionFunc == func_80962D60) || (this->actionFunc == func_80962F4C) || (this->actionFunc == func_80963350)) { @@ -1202,13 +1202,13 @@ void func_809640D8(EnFu* this, GlobalContext* globalCtx) { } } -void func_8096413C(EnFu* this, GlobalContext* globalCtx) { +void func_8096413C(EnFu* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_SUB(this->actor.yawTowardsPlayer, 0x4000), 5, 1000, 100); this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80964190(EnFu* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80964190(EnFu* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_552) { case 0x2842: case 0x2844: @@ -1259,8 +1259,8 @@ void func_80964190(EnFu* this, GlobalContext* globalCtx) { } } -void func_8096426C(EnFu* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_8096426C(EnFu* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_552) { case 0x2840: case 0x2841: @@ -1320,30 +1320,30 @@ void func_8096426C(EnFu* this, GlobalContext* globalCtx) { } } -void func_809642E0(EnFu* this, GlobalContext* globalCtx) { +void func_809642E0(EnFu* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->unk_542 == 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); } -void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Update(Actor* thisx, PlayState* play) { EnFu* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_809642E0(this, globalCtx); + func_809642E0(this, play); Actor_MoveWithGravity(&this->actor); - func_8096209C(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + func_8096209C(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); SkelAnime_Update(&this->skelAnime); - func_80961D7C(globalCtx); - func_809640D8(this, globalCtx); - func_80964034(this, globalCtx); + func_80961D7C(play); + func_809640D8(this, play); + func_80964034(this, play); } -s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnFu* this = THIS; if (limbIndex == 9) { @@ -1362,7 +1362,7 @@ s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80964C28 = { -2500.0f, 0.0f, 0.0f }; static Vec3f D_80964C34 = { -3500.0f, 0.0f, 0.0f }; EnFu* this = THIS; @@ -1374,25 +1374,25 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFu_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFu* this = THIS; Matrix_Push(); - func_80964950(globalCtx, this->unk_2D8, ARRAY_COUNT(this->unk_2D8)); + func_80964950(play, this->unk_2D8, ARRAY_COUNT(this->unk_2D8)); Matrix_Pop(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 0, 50, 160, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 0, 50, 160, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len) { @@ -1418,9 +1418,9 @@ void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len) { } } -void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { +void func_809647EC(PlayState* play, EnFuUnkStruct* ptr, s32 len) { Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; - s16 yaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + s16 yaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); s32 i; for (i = 0; i < len; i++, ptr++) { @@ -1441,13 +1441,13 @@ void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { } } -void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { +void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) { s32 i; s32 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); for (i = 0; i < len; i++, ptr++) { @@ -1457,15 +1457,14 @@ void func_80964950(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { flag = true; } Matrix_Translate(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_00, ptr->unk_00, ptr->unk_00, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_mu_DL_00B0E0); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 6af75768f8..76c46181db 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*); #define ENFU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c index ef4c8b6bb0..6ee121a163 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c @@ -13,19 +13,19 @@ #define THIS ((EnFuKago*)thisx) -void EnFuKago_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFuKago_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFuKago_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFuKago_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFuKago_Init(Actor* thisx, PlayState* play); +void EnFuKago_Destroy(Actor* thisx, PlayState* play); +void EnFuKago_Update(Actor* thisx, PlayState* play); +void EnFuKago_Draw(Actor* thisx, PlayState* play); void func_80ACF994(EnFuKago* this); -void func_80ACF9A8(EnFuKago* this, GlobalContext* globalCtx); +void func_80ACF9A8(EnFuKago* this, PlayState* play); void func_80ACF9DC(EnFuKago* this); -void func_80ACF9FC(EnFuKago* this, GlobalContext* globalCtx); -void func_80ACFA78(EnFuKago* this, GlobalContext* globalCtx); -void func_80AD0028(EnFuKago* this, GlobalContext* globalCtx); +void func_80ACF9FC(EnFuKago* this, PlayState* play); +void func_80ACFA78(EnFuKago* this, PlayState* play); +void func_80AD0028(EnFuKago* this, PlayState* play); void func_80AD0274(EnFuKago* this); -void func_80AD0288(EnFuKago* this, GlobalContext* globalCtx); +void func_80AD0288(EnFuKago* this, PlayState* play); const ActorInit En_Fu_Kago_InitVars = { ACTOR_EN_FU_KAGO, @@ -79,15 +79,15 @@ Vec3f D_80AD06C4[] = { { 13.7f, 9.0f, -15.5f }, { -13.7f, 9.0f, -15.5f }, { -13.7f, 9.0f, 0.0f }, }; -void EnFuKago_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFuKago_Init(Actor* thisx, PlayState* play) { s32 pad; EnFuKago* this = THIS; CollisionHeader* sp34 = NULL; - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_fu_mato_Colheader_0015C0, &sp34); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp34); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34); Actor_SetScale(&this->dyna.actor, 0.1f); while (npc != NULL) { @@ -103,8 +103,8 @@ void EnFuKago_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - Collider_InitSphere(globalCtx, &this->collider); - Collider_SetSphere(globalCtx, &this->collider, &this->dyna.actor, &sSphereInit); + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->dyna.actor, &sSphereInit); this->collider.dim.worldSphere.radius = 10; this->unk_33A = 0; this->unk_33C = 0; @@ -112,13 +112,13 @@ void EnFuKago_Init(Actor* thisx, GlobalContext* globalCtx) { func_80ACF994(this); } -void EnFuKago_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFuKago_Destroy(Actor* thisx, PlayState* play) { EnFuKago* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -s32 func_80ACF8B8(EnFuKago* this, GlobalContext* globalCtx) { +s32 func_80ACF8B8(EnFuKago* this, PlayState* play) { this->collider.dim.worldSphere.center.x = this->dyna.actor.world.pos.x; this->collider.dim.worldSphere.center.y = this->dyna.actor.world.pos.y + 10.0f; this->collider.dim.worldSphere.center.z = this->dyna.actor.world.pos.z; @@ -129,7 +129,7 @@ s32 func_80ACF8B8(EnFuKago* this, GlobalContext* globalCtx) { if (this->collider.base.oc->id == ACTOR_EN_BOM) { this->dyna.actor.child = this->collider.base.oc; } else if (this->collider.base.oc->id == ACTOR_PLAYER) { - func_80ACFA78(this, globalCtx); + func_80ACFA78(this, play); return false; } else { return false; @@ -138,7 +138,7 @@ s32 func_80ACF8B8(EnFuKago* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); return true; } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } return false; } @@ -147,8 +147,8 @@ void func_80ACF994(EnFuKago* this) { this->actionFunc = func_80ACF9A8; } -void func_80ACF9A8(EnFuKago* this, GlobalContext* globalCtx) { - if (func_80ACF8B8(this, globalCtx)) { +void func_80ACF9A8(EnFuKago* this, PlayState* play) { + if (func_80ACF8B8(this, play)) { func_80ACF9DC(this); } } @@ -160,7 +160,7 @@ void func_80ACF9DC(EnFuKago* this) { this->actionFunc = func_80ACF9FC; } -void func_80ACF9FC(EnFuKago* this, GlobalContext* globalCtx) { +void func_80ACF9FC(EnFuKago* this, PlayState* play) { EnBom* bom = (EnBom*)this->dyna.actor.child; EnFu* fu = (EnFu*)this->dyna.actor.parent; @@ -169,14 +169,14 @@ void func_80ACF9FC(EnFuKago* this, GlobalContext* globalCtx) { func_80ACF994(this); } else if (bom->timer == 1) { fu->unk_548++; - func_80ACFA78(this, globalCtx); + func_80ACFA78(this, play); } else { this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x; this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z; } } -void func_80ACFA78(EnFuKago* this, GlobalContext* globalCtx) { +void func_80ACFA78(EnFuKago* this, PlayState* play) { s32 i; Vec3f sp98; Vec3s sp90; @@ -221,19 +221,19 @@ void func_80ACFA78(EnFuKago* this, GlobalContext* globalCtx) { } this->dyna.actor.freezeTimer = 2; - EffectSsHahen_SpawnBurst(globalCtx, &this->dyna.actor.world.pos, 17.0f, 0, 15, 13, 20, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->dyna.actor.world.pos, 17.0f, 0, 15, 13, 20, -1, 10, NULL); this->unk_338 = 60; this->unk_33A = 1; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODBOX_BREAK); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AD0028; } Vec3f D_80AD0714 = { 0.0f, 0.0f, 0.0f }; -void func_80ACFDAC(EnFuKago* this, GlobalContext* globalCtx, EnFuKagoStruct* arg2) { +void func_80ACFDAC(EnFuKago* this, PlayState* play, EnFuKagoStruct* arg2) { Vec3f sp34; f32 temp_f0; @@ -241,8 +241,8 @@ void func_80ACFDAC(EnFuKago* this, GlobalContext* globalCtx, EnFuKagoStruct* arg if (arg2->unk_00.y < 15.0f) { sp34 = arg2->unk_00; sp34.y = 30.0f; - EffectSsGSplash_Spawn(globalCtx, &sp34, NULL, NULL, 0, 800); - EffectSsGRipple_Spawn(globalCtx, &sp34, 250, 650, 0); + EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 800); + EffectSsGRipple_Spawn(play, &sp34, 250, 650, 0); arg2->unk_3C = 1; } @@ -271,19 +271,19 @@ void func_80ACFDAC(EnFuKago* this, GlobalContext* globalCtx, EnFuKagoStruct* arg Math_SmoothStepToS(&arg2->unk_36.z, 0, 0xA, 0x64, 0xA); } - if ((globalCtx->gameplayFrames % 8) == 0) { + if ((play->gameplayFrames % 8) == 0) { sp34 = arg2->unk_00; sp34.y = 30.0f; - EffectSsGRipple_Spawn(globalCtx, &sp34, 250, 650, 0); + EffectSsGRipple_Spawn(play, &sp34, 250, 650, 0); } } -void func_80AD0028(EnFuKago* this, GlobalContext* globalCtx) { +void func_80AD0028(EnFuKago* this, PlayState* play) { EnFuKagoStruct* ptr = this->unk_1B8; s32 i; for (i = 0; i < ARRAY_COUNT(this->unk_1B8); i++) { - func_80ACFDAC(this, globalCtx, ptr); + func_80ACFDAC(this, play, ptr); ptr->unk_0C.x += ptr->unk_18.x; ptr->unk_0C.y += ptr->unk_18.y; @@ -333,7 +333,7 @@ void func_80AD0274(EnFuKago* this) { this->actionFunc = func_80AD0288; } -void func_80AD0288(EnFuKago* this, GlobalContext* globalCtx) { +void func_80AD0288(EnFuKago* this, PlayState* play) { s32 pad; Vec3f* scale = &this->dyna.actor.scale; @@ -345,25 +345,25 @@ void func_80AD0288(EnFuKago* this, GlobalContext* globalCtx) { } } -void EnFuKago_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFuKago_Update(Actor* thisx, PlayState* play) { EnFuKago* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_33C == 1) { func_80AD0274(this); } } -void func_80AD0340(EnFuKago* this, GlobalContext* globalCtx) { +void func_80AD0340(EnFuKago* this, PlayState* play) { s32 pad[2]; EnFuKagoStruct* ptr = &this->unk_1B8[0]; s32 i; Vec3f* scale = &this->dyna.actor.scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(D_80AD061C); i++, ptr++) { Matrix_Push(); @@ -373,25 +373,25 @@ void func_80AD0340(EnFuKago* this, GlobalContext* globalCtx) { Matrix_Translate(-ptr->unk_24.x, -ptr->unk_24.y, -ptr->unk_24.z, MTXMODE_APPLY); Matrix_Scale(scale->x, scale->y, scale->z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80AD061C[i]); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFuKago_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFuKago_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFuKago* this = THIS; if (this->unk_33A == 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_0006A0); gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_000740); gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_0007E0); @@ -399,8 +399,8 @@ void EnFuKago_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_000920); gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_0009C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - func_80AD0340(this, globalCtx); + func_80AD0340(this, play); } } diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h index 19022093e2..fa38ef3d71 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.h @@ -5,7 +5,7 @@ struct EnFuKago; -typedef void (*EnFuKagoActionFunc)(struct EnFuKago*, GlobalContext*); +typedef void (*EnFuKagoActionFunc)(struct EnFuKago*, PlayState*); typedef struct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 7fe1d6e58c..9fa1353140 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -12,19 +12,19 @@ #define THIS ((EnFuMato*)thisx) -void EnFuMato_Init(Actor* thisx, GlobalContext* globalCtx); -void EnFuMato_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnFuMato_Update(Actor* thisx, GlobalContext* globalCtx); -void EnFuMato_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnFuMato_Init(Actor* thisx, PlayState* play); +void EnFuMato_Destroy(Actor* thisx, PlayState* play); +void EnFuMato_Update(Actor* thisx, PlayState* play); +void EnFuMato_Draw(Actor* thisx, PlayState* play); void func_80ACE4B4(EnFuMato* this); -void func_80ACE4C8(EnFuMato* this, GlobalContext* globalCtx); +void func_80ACE4C8(EnFuMato* this, PlayState* play); void func_80ACE508(EnFuMato* this); -void func_80ACE51C(EnFuMato* this, GlobalContext* globalCtx); -void func_80ACE718(EnFuMato* this, GlobalContext* globalCtx); -void func_80ACECFC(EnFuMato* this, GlobalContext* globalCtx); +void func_80ACE51C(EnFuMato* this, PlayState* play); +void func_80ACE718(EnFuMato* this, PlayState* play); +void func_80ACECFC(EnFuMato* this, PlayState* play); void func_80ACEFC4(EnFuMato* this); -void func_80ACEFD8(EnFuMato* this, GlobalContext* globalCtx); +void func_80ACEFD8(EnFuMato* this, PlayState* play); const ActorInit En_Fu_Mato_InitVars = { ACTOR_EN_FU_MATO, @@ -67,19 +67,19 @@ Vec2f D_80ACF654[] = { { -1.0f, -1.73f }, { 1.0f, -1.73f }, { 2.0f, 0.0f }, { 1.0f, 1.73f }, { -1.0f, 1.73f }, { -2.0f, 0.0f }, }; -void EnFuMato_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnFuMato_Init(Actor* thisx, PlayState* play) { s32 pad; EnFuMato* this = THIS; CollisionHeader* sp2C = NULL; - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; + Actor* actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; EnFu* fu; DynaPolyActor_Init(&this->dyna, 3); CollisionHeader_GetVirtual(&object_fu_mato_Colheader_0023D4, &sp2C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp2C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); Actor_SetScale(&this->dyna.actor, 0.1f); - Collider_InitSphere(globalCtx, &this->collider); - Collider_SetSphere(globalCtx, &this->collider, &this->dyna.actor, &sSphereInit); + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->dyna.actor, &sSphereInit); this->collider.dim.worldSphere.radius = 20; while (actor != NULL) { @@ -111,18 +111,18 @@ void EnFuMato_Init(Actor* thisx, GlobalContext* globalCtx) { func_80ACE4B4(this); } -void EnFuMato_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFuMato_Destroy(Actor* thisx, PlayState* play) { EnFuMato* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroySphere(globalCtx, &this->collider); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroySphere(play, &this->collider); } void func_80ACE4B4(EnFuMato* this) { this->actionFunc = func_80ACE4C8; } -void func_80ACE4C8(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACE4C8(EnFuMato* this, PlayState* play) { EnFu* fu = (EnFu*)this->dyna.actor.parent; if ((fu->unk_54A == 0) && (fu->unk_542 == 0)) { @@ -134,7 +134,7 @@ void func_80ACE508(EnFuMato* this) { this->actionFunc = func_80ACE51C; } -void func_80ACE51C(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACE51C(EnFuMato* this, PlayState* play) { EnFu* fu = (EnFu*)this->dyna.actor.parent; Vec3f sp30; f32 sp2C; @@ -177,25 +177,25 @@ void func_80ACE680(EnFuMato* this) { this->actionFunc = func_80ACE718; } -void func_80ACE718(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACE718(EnFuMato* this, PlayState* play) { this->dyna.actor.shape.rot.x += this->unk_2FC.x; this->dyna.actor.shape.rot.y += this->unk_2FC.y; this->dyna.actor.shape.rot.z += this->unk_2FC.z; this->dyna.actor.velocity.y += this->dyna.actor.gravity; Actor_UpdatePos(&this->dyna.actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); if ((this->dyna.actor.bgCheckFlags & 1) || (this->dyna.actor.world.pos.y < -500.0f)) { Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; Vec3f sp30 = { 0.0f, 2.0f, 0.0f }; - func_800B3030(globalCtx, &this->dyna.actor.world.pos, &sp3C, &sp30, 20, 40, 2); + func_800B3030(play, &this->dyna.actor.world.pos, &sp3C, &sp30, 20, 40, 2); Actor_MarkForDeath(&this->dyna.actor); } } -void func_80ACE850(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACE850(EnFuMato* this, PlayState* play) { EnFuMatoStruct* ptr = this->unk_1B8; s16 temp_s4 = this->dyna.actor.shape.rot.y; s32 phi_s2; @@ -239,7 +239,7 @@ void func_80ACE850(EnFuMato* this, GlobalContext* globalCtx) { } this->dyna.actor.freezeTimer = 2; - EffectSsHahen_SpawnBurst(globalCtx, &this->dyna.actor.world.pos, 13.0f, 0, 7, 8, 20, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->dyna.actor.world.pos, 13.0f, 0, 7, 8, 20, -1, 10, NULL); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); this->actionFunc = func_80ACECFC; } @@ -278,7 +278,7 @@ void func_80ACEB2C(EnFuMato* this) { this->actionFunc = func_80ACECFC; } -void func_80ACECFC(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACECFC(EnFuMato* this, PlayState* play) { EnFuMatoStruct* ptr = this->unk_1B8; s32 phi_s3; s32 i; @@ -328,7 +328,7 @@ void func_80ACECFC(EnFuMato* this, GlobalContext* globalCtx) { } if (this->unk_302 == 1) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); if (this->dyna.actor.bgCheckFlags & 1) { func_80ACEB2C(this); } @@ -345,7 +345,7 @@ void func_80ACEFC4(EnFuMato* this) { this->actionFunc = func_80ACEFD8; } -void func_80ACEFD8(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACEFD8(EnFuMato* this, PlayState* play) { Vec3f* scale = &this->dyna.actor.scale; Math_SmoothStepToF(&scale->x, 0.0f, 0.1f, 0.005f, 0.005f); @@ -355,7 +355,7 @@ void func_80ACEFD8(EnFuMato* this, GlobalContext* globalCtx) { } } -s32 func_80ACF04C(EnFuMato* this, GlobalContext* globalCtx) { +s32 func_80ACF04C(EnFuMato* this, PlayState* play) { EnFu* fu = (EnFu*)this->dyna.actor.parent; this->collider.dim.worldSphere.center.x = this->dyna.actor.world.pos.x; @@ -374,43 +374,43 @@ s32 func_80ACF04C(EnFuMato* this, GlobalContext* globalCtx) { fu->unk_546 = 1; func_80ACE680(this); } else { - func_80ACE850(this, globalCtx); + func_80ACE850(this, play); } return true; } - 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); return false; } -void EnFuMato_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFuMato_Update(Actor* thisx, PlayState* play) { EnFuMato* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80ACF04C(this, globalCtx); + func_80ACF04C(this, play); if (this->unk_30A == 1) { func_80ACEFC4(this); } } -void func_80ACF1F4(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACF1F4(EnFuMato* this, PlayState* play) { EnFuMatoStruct* ptr = this->unk_1B8; s32 temp_s4 = this->unk_308; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < 2; i++) { Matrix_Push(); Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &ptr->unk_24); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80ACF63C[temp_s4]); switch (temp_s4) { @@ -436,49 +436,49 @@ void func_80ACF1F4(EnFuMato* this, GlobalContext* globalCtx) { ptr++; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80ACF3F4(EnFuMato* this, GlobalContext* globalCtx) { +void func_80ACF3F4(EnFuMato* this, PlayState* play) { EnFuMatoStruct* ptr = this->unk_1B8; Vec3f* scale = &this->dyna.actor.scale; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(D_80ACF63C); i++, ptr++) { Matrix_Push(); Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &ptr->unk_24); Matrix_Scale(scale->x, scale->y, scale->z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80ACF63C[i]); Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnFuMato_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFuMato_Draw(Actor* thisx, PlayState* play) { s32 pad; EnFuMato* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((this->unk_302 == 0) || (this->unk_302 == 3)) { gSPDisplayList(POLY_OPA_DISP++, object_fu_mato_DL_002720); } else if (this->unk_302 == 1) { - func_80ACF1F4(this, globalCtx); + func_80ACF1F4(this, play); } else { - func_80ACF3F4(this, globalCtx); + func_80ACF3F4(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h index 5666b71fcb..cb3acd4c0f 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.h @@ -5,7 +5,7 @@ struct EnFuMato; -typedef void (*EnFuMatoActionFunc)(struct EnFuMato*, GlobalContext*); +typedef void (*EnFuMatoActionFunc)(struct EnFuMato*, PlayState*); #define ENFUMATO_GET(thisx) ((thisx)->params) 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 bd6f66e344..00c47b1119 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -13,41 +13,41 @@ #define THIS ((EnFz*)thisx) -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 func_80932784(EnFz* this, GlobalContext* globalCtx); +void func_80932784(EnFz* this, PlayState* play); void func_80932AE8(EnFz* this); void func_80932AF4(EnFz* this); void func_80932BD4(EnFz* this); void func_809330D4(EnFz* this); -void func_80933104(EnFz* this, GlobalContext* globalCtx); +void func_80933104(EnFz* this, PlayState* play); void func_80933184(EnFz* this); -void func_809331F8(EnFz* this, GlobalContext* globalCtx); +void func_809331F8(EnFz* this, PlayState* play); void func_80933248(EnFz* this); -void func_80933274(EnFz* this, GlobalContext* globalCtx); +void func_80933274(EnFz* this, PlayState* play); void func_80933324(EnFz* this); -void func_80933368(EnFz* this, GlobalContext* globalCtx); +void func_80933368(EnFz* this, PlayState* play); void func_809333A4(EnFz* this); -void func_809333D8(EnFz* this, GlobalContext* globalCtx); +void func_809333D8(EnFz* this, PlayState* play); void func_80933414(EnFz* this); -void func_80933444(EnFz* this, GlobalContext* globalCtx); -void func_80933480(EnFz* this, GlobalContext* globalCtx); -void func_809334B8(EnFz* this, GlobalContext* globalCtx); -void func_809336C0(EnFz* this, GlobalContext* globalCtx); -void func_80933760(EnFz* this, GlobalContext* globalCtx); +void func_80933444(EnFz* this, PlayState* play); +void func_80933480(EnFz* this, PlayState* play); +void func_809334B8(EnFz* this, PlayState* play); +void func_809336C0(EnFz* this, PlayState* play); +void func_80933760(EnFz* this, PlayState* play); void func_80933790(EnFz* this); -void func_809337D4(EnFz* this, GlobalContext* globalCtx); +void func_809337D4(EnFz* this, PlayState* play); void func_8093389C(EnFz* this); -void func_809338E0(EnFz* this, GlobalContext* globalCtx); +void func_809338E0(EnFz* this, PlayState* play); void func_80933AF4(EnFz* this); -void func_80933B38(EnFz* this, GlobalContext* globalCtx); +void func_80933B38(EnFz* this, PlayState* play); void func_80934018(EnFz* this, Vec3f* a, Vec3f* b, Vec3f* c, f32 arg4); void func_809340BC(EnFz* this, Vec3f* a, Vec3f* b, Vec3f* c, f32 arg4, f32 arg5, s16 arg6, u8 arg7); -void func_80934178(EnFz* this, GlobalContext* globalCtx); -void func_80934464(EnFz* this, GlobalContext* globalCtx); +void func_80934178(EnFz* this, PlayState* play); +void func_80934464(EnFz* this, PlayState* play); const ActorInit En_Fz_InitVars = { ACTOR_EN_FZ, @@ -162,19 +162,19 @@ 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 = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 3; - 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(globalCtx, &this->collider3); - Collider_SetCylinderType1(globalCtx, &this->collider3, &this->actor, &sCylinderInit3); + 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); + Collider_InitCylinder(play, &this->collider3); + Collider_SetCylinderType1(play, &this->collider3, &this->actor, &sCylinderInit3); Actor_SetScale(&this->actor, 0.008f); this->actor.gravity = 0.0f; @@ -230,15 +230,15 @@ void EnFz_Init(Actor* thisx, GlobalContext* globalCtx) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; - func_80932784(this, globalCtx); + func_80932784(this, play); } -void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Destroy(Actor* thisx, PlayState* play) { EnFz* this = THIS; - 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); if ((this->actor.parent != NULL) && (this->unk_BC4 == 0) && (this->actor.parent->id == ACTOR_EN_WIZ) && (this->actor.parent->update != NULL) && (((EnWiz*)this->actor.parent)->unk_448 != 0)) { @@ -248,7 +248,7 @@ void EnFz_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80932784(EnFz* this, GlobalContext* globalCtx) { +void func_80932784(EnFz* this, PlayState* play) { Vec3f sp5C; Vec3f sp50; Vec3f sp44; @@ -266,8 +266,7 @@ void func_80932784(EnFz* this, GlobalContext* globalCtx) { sp44.z = 440.0f; Matrix_MultVec3f(&sp44, &this->unk_22C); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp5C, &this->unk_22C, &sp50, &sp3C, true, false, false, true, - &sp40)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &sp5C, &this->unk_22C, &sp50, &sp3C, true, false, false, true, &sp40)) { Math_Vec3f_Copy(&this->unk_22C, &sp50); } @@ -286,7 +285,7 @@ s32 func_809328A4(EnFz* this, Vec3f* arg1) { return false; } -void func_809328F4(EnFz* this, GlobalContext* globalCtx, Vec3f* arg2, s32 arg3, f32 arg4) { +void func_809328F4(EnFz* this, PlayState* play, Vec3f* arg2, s32 arg3, f32 arg4) { s32 i; Vec3f spA8; Vec3f sp9C; @@ -315,10 +314,10 @@ void func_809328F4(EnFz* this, GlobalContext* globalCtx, Vec3f* arg2, s32 arg3, sp9C.x = randPlusMinusPoint5Scaled(10.0f); sp9C.y = Rand_ZeroFloat(10.0f) + 2.0f; sp9C.z = randPlusMinusPoint5Scaled(10.0f); - EffectSsEnIce_Spawn(globalCtx, &spA8, temp_f24, &sp9C, &sp90, &sp8C, &sp88, temp_s1); + EffectSsEnIce_Spawn(play, &spA8, temp_f24, &sp9C, &sp90, &sp8C, &sp88, temp_s1); } - CollisionCheck_SpawnShieldParticles(globalCtx, arg2); + CollisionCheck_SpawnShieldParticles(play, arg2); } void func_80932AE8(EnFz* this) { @@ -356,12 +355,12 @@ void func_80932BD4(EnFz* this) { } } -void func_80932C98(EnFz* this, GlobalContext* globalCtx) { +void func_80932C98(EnFz* this, PlayState* play) { Vec3f sp3C; if (this->unk_BCD != 0) { if ((this->actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->actor, globalCtx, 60.0f, this->actor.world.rot.y)) { + !Actor_TestFloorInDirection(&this->actor, play, 60.0f, this->actor.world.rot.y)) { this->actor.bgCheckFlags &= ~0x8; this->unk_BCD = 0; this->unk_BBC = 0.0f; @@ -381,8 +380,8 @@ void func_80932C98(EnFz* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; - func_809328F4(this, globalCtx, &sp3C, 30, 10.0f); - func_809336C0(this, globalCtx); + func_809328F4(this, play, &sp3C, 30, 10.0f); + func_809336C0(this, play); return; } @@ -394,8 +393,8 @@ void func_80932C98(EnFz* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; - func_809328F4(this, globalCtx, &sp3C, 30, 10.0f); - func_809336C0(this, globalCtx); + func_809328F4(this, play, &sp3C, 30, 10.0f); + func_809336C0(this, play); return; } } @@ -427,7 +426,7 @@ void func_80932C98(EnFz* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; - func_809328F4(this, globalCtx, &sp3C, 10, 0.0f); + func_809328F4(this, play, &sp3C, 10, 0.0f); this->unk_BCF++; break; } @@ -436,8 +435,8 @@ void func_80932C98(EnFz* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; - func_809328F4(this, globalCtx, &sp3C, 30, 10.0f); - func_809336C0(this, globalCtx); + func_809328F4(this, play, &sp3C, 30, 10.0f); + func_809336C0(this, play); break; case 2: @@ -477,7 +476,7 @@ void func_809330D4(EnFz* this) { this->actionFunc = func_80933104; } -void func_80933104(EnFz* this, GlobalContext* globalCtx) { +void func_80933104(EnFz* this, PlayState* play) { this->unk_BC0 -= 16; if (this->unk_BC0 > 255) { this->unk_BC0 = 0; @@ -508,7 +507,7 @@ void func_80933184(EnFz* this) { } } -void func_809331F8(EnFz* this, GlobalContext* globalCtx) { +void func_809331F8(EnFz* this, PlayState* play) { if ((this->unk_BCA == 0) && (this->actor.xzDistToPlayer < 400.0f)) { func_80933248(this); } @@ -521,7 +520,7 @@ void func_80933248(EnFz* this) { this->actionFunc = func_80933274; } -void func_80933274(EnFz* this, GlobalContext* globalCtx) { +void func_80933274(EnFz* this, PlayState* play) { if (this->unk_BCA == 0) { this->unk_BC0 += 8; @@ -549,7 +548,7 @@ void func_80933324(EnFz* this) { this->actionFunc = func_80933368; } -void func_80933368(EnFz* this, GlobalContext* globalCtx) { +void func_80933368(EnFz* this, PlayState* play) { func_80933014(this); if (this->unk_BCA == 0) { func_809333A4(this); @@ -564,7 +563,7 @@ void func_809333A4(EnFz* this) { this->actionFunc = func_809333D8; } -void func_809333D8(EnFz* this, GlobalContext* globalCtx) { +void func_809333D8(EnFz* this, PlayState* play) { if ((this->unk_BCA == 0) || (this->unk_BCD == 0)) { func_80933414(this); } @@ -578,21 +577,21 @@ void func_80933414(EnFz* this) { this->actionFunc = func_80933444; } -void func_80933444(EnFz* this, GlobalContext* globalCtx) { +void func_80933444(EnFz* this, PlayState* play) { func_80933014(this); if (this->unk_BCA == 0) { - func_80933480(this, globalCtx); + func_80933480(this, play); } } -void func_80933480(EnFz* this, GlobalContext* globalCtx) { +void func_80933480(EnFz* this, PlayState* play) { this->unk_BD6 = 1; this->unk_BCA = 80; this->actionFunc = func_809334B8; - func_80932784(this, globalCtx); + func_80932784(this, play); } -void func_809334B8(EnFz* this, GlobalContext* globalCtx) { +void func_809334B8(EnFz* this, PlayState* play) { Vec3f sp64; Vec3f sp58; Vec3f sp4C; @@ -645,7 +644,7 @@ void func_809334B8(EnFz* this, GlobalContext* globalCtx) { } } -void func_809336C0(EnFz* this, GlobalContext* globalCtx) { +void func_809336C0(EnFz* this, PlayState* play) { this->unk_BD6 = 0; this->unk_BBC = 0.0f; this->actor.gravity = 0.0f; @@ -657,12 +656,12 @@ void func_809336C0(EnFz* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_BD7 = 0; this->unk_BCA = 60; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xA0); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xA0); this->actionFunc = func_80933760; } -void func_80933760(EnFz* this, GlobalContext* globalCtx) { +void func_80933760(EnFz* this, PlayState* play) { if (this->unk_BCA == 0) { Actor_MarkForDeath(&this->actor); } @@ -678,7 +677,7 @@ void func_80933790(EnFz* this) { this->actionFunc = func_809337D4; } -void func_809337D4(EnFz* this, GlobalContext* globalCtx) { +void func_809337D4(EnFz* this, PlayState* play) { Math_StepToF(&this->actor.scale.y, 0.0006f, 0.0006f); if (this->actor.scale.y < 0.006f) { @@ -694,7 +693,7 @@ void func_809337D4(EnFz* this, GlobalContext* globalCtx) { } if (this->unk_BC0 == 0) { - func_809336C0(this, globalCtx); + func_809336C0(this, play); } } @@ -708,7 +707,7 @@ void func_8093389C(EnFz* this) { this->actionFunc = func_809338E0; } -void func_809338E0(EnFz* this, GlobalContext* globalCtx) { +void func_809338E0(EnFz* this, PlayState* play) { Vec3f sp64; Vec3f sp58; Vec3f sp4C; @@ -718,7 +717,7 @@ void func_809338E0(EnFz* this, GlobalContext* globalCtx) { if (this->unk_BC6 & (0x80 | 0x40)) { func_80933014(this); - func_80932784(this, globalCtx); + func_80932784(this, play); return; } @@ -769,10 +768,10 @@ void func_80933AF4(EnFz* this) { this->actionFunc = func_80933B38; } -void func_80933B38(EnFz* this, GlobalContext* globalCtx) { +void func_80933B38(EnFz* this, PlayState* play) { } -void func_80933B48(EnFz* this, GlobalContext* globalCtx) { +void func_80933B48(EnFz* this, PlayState* play) { if (this->drawDmgEffTimer != 0) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; @@ -787,7 +786,7 @@ void func_80933B48(EnFz* this, GlobalContext* globalCtx) { } } -void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Update(Actor* thisx, PlayState* play) { static EnFzUnkFunc D_809347AC[] = { func_80932AE8, func_80932AF4, func_80932BD4, func_80932BD4 }; s32 pad; EnFz* this = THIS; @@ -806,53 +805,53 @@ void EnFz_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 50.0f); - func_80932C98(this, globalCtx); + func_80932C98(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_BD8 == 0) { Collider_UpdateCylinder(&this->actor, &this->collider1); Collider_UpdateCylinder(&this->actor, &this->collider2); if (this->unk_BCE != 0) { 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); } } Math_StepToF(&this->actor.speedXZ, this->unk_BBC, 0.2f); Actor_MoveWithGravity(&this->actor); if (this->unk_BCC != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); } D_809347AC[this->unk_BD6](this); - func_80933B48(this, globalCtx); - func_80934178(this, globalCtx); + func_80933B48(this, play); + func_80934178(this, play); } -void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnFz_Draw(Actor* thisx, PlayState* play) { static Gfx* D_809347BC[] = { object_fz_DL_001130, object_fz_DL_0021A0, object_fz_DL_002CA0 }; s32 pad; EnFz* this = THIS; s32 sp9C = 3 - this->actor.colChkInfo.health; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actor.colChkInfo.health == 0) { sp9C = 2; } if (this->unk_BD7 != 0) { - func_800B8118(&this->actor, globalCtx, 0); - func_8012C2DC(globalCtx->state.gfxCtx); + func_800B8118(&this->actor, play, 0); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, globalCtx->state.frames % 128, 0x20, 0x20, 1, 0, - (globalCtx->state.frames * 2) % 128, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->state.frames % 128, 0x20, 0x20, 1, 0, + (play->state.frames * 2) % 128, 0x20, 0x20)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 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); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 155, 255, 255, 255); @@ -860,7 +859,7 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, D_809347BC[sp9C]); } - func_80934464(this, globalCtx); + func_80934464(this, play); if (this->drawDmgEffTimer > 0) { s32 pad2[6]; @@ -871,11 +870,11 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) { limbPos[1] = this->actor.world.pos; limbPos[0].y += 20.0f; limbPos[1].y += 40.0f; - Actor_DrawDamageEffects(globalCtx, NULL, limbPos, ARRAY_COUNT(limbPos), this->drawDmgEffScale * 4.0f, 0.5f, + Actor_DrawDamageEffects(play, NULL, limbPos, ARRAY_COUNT(limbPos), this->drawDmgEffScale * 4.0f, 0.5f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80934018(EnFz* this, Vec3f* a, Vec3f* b, Vec3f* c, f32 arg4) { @@ -918,7 +917,7 @@ void func_809340BC(EnFz* this, Vec3f* a, Vec3f* b, Vec3f* c, f32 arg4, f32 arg5, } } -void func_80934178(EnFz* this, GlobalContext* globalCtx) { +void func_80934178(EnFz* this, PlayState* play) { s16 i; EnFzStruct* ptr = this->unk_23C; Vec3f sp64; @@ -969,7 +968,7 @@ void func_80934178(EnFz* this, GlobalContext* globalCtx) { this->collider3.dim.pos.x = ptr->unk_04.x; this->collider3.dim.pos.y = ptr->unk_04.y; this->collider3.dim.pos.z = ptr->unk_04.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider3.base); } sp64.x = ptr->unk_04.x; @@ -986,15 +985,15 @@ void func_80934178(EnFz* this, GlobalContext* globalCtx) { } } -void func_80934464(EnFz* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80934464(EnFz* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; u8 flag = 0; EnFzStruct* ptr = this->unk_23C; OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetColorDither(POLY_XLU_DISP++, G_CD_BAYER); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_PATTERN); @@ -1010,11 +1009,11 @@ void func_80934464(EnFz* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, ptr->unk_2C); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (ptr->unk_01 + (i * 3)) * 3, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (ptr->unk_01 + (i * 3)) * 3, (ptr->unk_01 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_30, ptr->unk_30, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1022,5 +1021,5 @@ void func_80934464(EnFz* this, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 19f462d0ab..58d1fb6d46 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -5,7 +5,7 @@ struct EnFz; -typedef void (*EnFzActionFunc)(struct EnFz*, GlobalContext*); +typedef void (*EnFzActionFunc)(struct EnFz*, PlayState*); typedef void (*EnFzUnkFunc)(struct EnFz*); #define ENFZ_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index de6a752d81..696f7c6d97 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -11,19 +11,19 @@ #define THIS ((EnGakufu*)thisx) -void EnGakufu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGakufu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGakufu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGakufu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGakufu_Init(Actor* thisx, PlayState* play); +void EnGakufu_Destroy(Actor* thisx, PlayState* play); +void EnGakufu_Update(Actor* thisx, PlayState* play); +void EnGakufu_Draw(Actor* thisx, PlayState* play); void EnGakufu_ProcessNotes(EnGakufu* this); -s32 EnGakufu_IsPlayerInRange(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_DisplayOnTimer(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_WaitForTimer(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_DoNothing(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_PlayRewardCutscene(EnGakufu* this, GlobalContext* globalCtx); -void EnGakufu_WaitForSong(EnGakufu* this, GlobalContext* globalCtx); +s32 EnGakufu_IsPlayerInRange(EnGakufu* this, PlayState* play); +void EnGakufu_DisplayOnTimer(EnGakufu* this, PlayState* play); +void EnGakufu_WaitForTimer(EnGakufu* this, PlayState* play); +void EnGakufu_DoNothing(EnGakufu* this, PlayState* play); +void EnGakufu_GiveReward(EnGakufu* this, PlayState* play); +void EnGakufu_PlayRewardCutscene(EnGakufu* this, PlayState* play); +void EnGakufu_WaitForSong(EnGakufu* this, PlayState* play); const ActorInit En_Gakufu_InitVars = { ACTOR_EN_GAKUFU, @@ -126,7 +126,7 @@ void EnGakufu_ProcessNotes(EnGakufu* this) { } } -void EnGakufu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGakufu_Init(Actor* thisx, PlayState* play) { EnGakufu* this = THIS; this->songIndex = OCARINA_SONG_TERMINA_WALL; @@ -141,7 +141,7 @@ void EnGakufu_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_2000000; - if (EnGakufu_IsPlayerInRange(this, globalCtx)) { + if (EnGakufu_IsPlayerInRange(this, play)) { gSaveContext.eventInf[3] |= 2; } else { gSaveContext.eventInf[3] &= (u8)~2; @@ -151,7 +151,7 @@ void EnGakufu_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.eventInf[3] &= (u8)~4; } -void EnGakufu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGakufu_Destroy(Actor* thisx, PlayState* play) { EnGakufu* this = THIS; if (GAKUFU_GET_TYPE(&this->actor) != GAKUFU_MILK_BAR) { @@ -164,7 +164,7 @@ void EnGakufu_Destroy(Actor* thisx, GlobalContext* globalCtx) { * this->actor.home.rot.x acts as a timer. Draws the notes on the back of the stage * until the timer runs out */ -void EnGakufu_DisplayOnTimer(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_DisplayOnTimer(EnGakufu* this, PlayState* play) { if (this->actor.home.rot.x > 0) { this->actor.draw = EnGakufu_Draw; this->actor.home.rot.x--; @@ -180,17 +180,17 @@ void EnGakufu_DisplayOnTimer(EnGakufu* this, GlobalContext* globalCtx) { * this->actor.home.rot.x acts as a timer. Waits for this timer to be set, * then rerolls the notes and start displaying the notes */ -void EnGakufu_WaitForTimer(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_WaitForTimer(EnGakufu* this, PlayState* play) { if (this->actor.home.rot.x > 0) { EnGakufu_ProcessNotes(this); this->actionFunc = EnGakufu_DisplayOnTimer; } } -void EnGakufu_DoNothing(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_DoNothing(EnGakufu* this, PlayState* play) { } -s32 EnGakufu_IsPlayerInRange(EnGakufu* this, GlobalContext* globalCtx) { +s32 EnGakufu_IsPlayerInRange(EnGakufu* this, PlayState* play) { if (this->actor.xzDistToPlayer < 600.0f) { return true; } else { @@ -201,7 +201,7 @@ s32 EnGakufu_IsPlayerInRange(EnGakufu* this, GlobalContext* globalCtx) { /** * Reward the player with three item drops depending on the time of day */ -void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_GiveReward(EnGakufu* this, PlayState* play) { s32 hour; s32 i; @@ -209,18 +209,18 @@ void EnGakufu_GiveReward(EnGakufu* this, GlobalContext* globalCtx) { hour = gSaveContext.save.time * (24.0f / 0x10000); for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); + Item_DropCollectible(play, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); } this->actionFunc = EnGakufu_DoNothing; } -void EnGakufu_PlayRewardCutscene(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_PlayRewardCutscene(EnGakufu* this, PlayState* play) { if (this->actor.cutscene == -1) { - EnGakufu_GiveReward(this, globalCtx); + EnGakufu_GiveReward(this, play); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - EnGakufu_GiveReward(this, globalCtx); + EnGakufu_GiveReward(this, play); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -231,45 +231,45 @@ void EnGakufu_PlayRewardCutscene(EnGakufu* this, GlobalContext* globalCtx) { * (gSaveContext.eventInf[3] & 2) is checking if Player is within range of the wall * (gSaveContext.eventInf[3] & 4) is checking if Player has played the notes of the wall */ -void EnGakufu_WaitForSong(EnGakufu* this, GlobalContext* globalCtx) { +void EnGakufu_WaitForSong(EnGakufu* this, PlayState* play) { if (gSaveContext.eventInf[3] & 2) { if (gSaveContext.eventInf[3] & 4) { gSaveContext.eventInf[3] &= (u8)~2; gSaveContext.eventInf[3] &= (u8)~4; this->actionFunc = EnGakufu_PlayRewardCutscene; - EnGakufu_PlayRewardCutscene(this, globalCtx); + EnGakufu_PlayRewardCutscene(this, play); this->actor.draw = NULL; - } else if (!EnGakufu_IsPlayerInRange(this, globalCtx)) { + } else if (!EnGakufu_IsPlayerInRange(this, play)) { gSaveContext.eventInf[3] &= (u8)~2; } - } else if (EnGakufu_IsPlayerInRange(this, globalCtx)) { + } else if (EnGakufu_IsPlayerInRange(this, play)) { gSaveContext.eventInf[3] |= 2; } } -void EnGakufu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGakufu_Update(Actor* thisx, PlayState* play) { EnGakufu* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnGakufu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGakufu_Draw(Actor* thisx, PlayState* play) { s32 i; s32 pad; EnGakufu* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_XLU_DISP++, 0x02, globalCtx->interfaceCtx.parameterSegment); + gSPSegment(POLY_XLU_DISP++, 0x02, play->interfaceCtx.parameterSegment); for (i = 0; (i < ARRAY_COUNT(this->buttonIndex)) && (this->buttonIndex[i] != OCARINA_BTN_INVALID); i++) { Matrix_Push(); Matrix_Translate(30 * i - 105, sOcarinaBtnWallYOffsets[this->buttonIndex[i]] * 7.5f, 1.0f, MTXMODE_APPLY); Matrix_Scale(0.6f, 0.6f, 0.6f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); gDPLoadTextureBlock(POLY_XLU_DISP++, sOcarinaBtnWallTextures[this->buttonIndex[i]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, @@ -286,7 +286,7 @@ void EnGakufu_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); } - gSPSegment(POLY_XLU_DISP++, 0x02, globalCtx->sceneSegment); + gSPSegment(POLY_XLU_DISP++, 0x02, play->sceneSegment); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h index 9ba96a7246..1b8f943687 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.h @@ -5,7 +5,7 @@ struct EnGakufu; -typedef void (*EnGakufuActionFunc)(struct EnGakufu*, GlobalContext*); +typedef void (*EnGakufuActionFunc)(struct EnGakufu*, PlayState*); #define GAKUFU_GET_TYPE(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index 16547c1128..c559e7183e 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -10,14 +10,14 @@ #define THIS ((EnGamelupy*)thisx) -void EnGamelupy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGamelupy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGamelupy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGamelupy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGamelupy_Init(Actor* thisx, PlayState* play); +void EnGamelupy_Destroy(Actor* thisx, PlayState* play); +void EnGamelupy_Update(Actor* thisx, PlayState* play); +void EnGamelupy_Draw(Actor* thisx, PlayState* play); -void func_80AF6958(EnGamelupy* this, GlobalContext* globalCtx); -void func_80AF69A8(EnGamelupy* this, GlobalContext* globalCtx); -void func_80AF6A78(EnGamelupy* this, GlobalContext* globalCtx); +void func_80AF6958(EnGamelupy* this, PlayState* play); +void func_80AF69A8(EnGamelupy* this, PlayState* play); +void func_80AF6A78(EnGamelupy* this, PlayState* play); #if 0 const ActorInit En_Gamelupy_InitVars = { diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h index b09ac42a3b..b3737d7064 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h @@ -5,7 +5,7 @@ struct EnGamelupy; -typedef void (*EnGamelupyActionFunc)(struct EnGamelupy*, GlobalContext*); +typedef void (*EnGamelupyActionFunc)(struct EnGamelupy*, PlayState*); typedef struct EnGamelupy { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 2aadee0cae..658ee27f79 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -11,30 +11,30 @@ #define THIS ((EnGb2*)thisx) -void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGb2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGb2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGb2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGb2_Init(Actor* thisx, PlayState* play); +void EnGb2_Destroy(Actor* thisx, PlayState* play); +void EnGb2_Update(Actor* thisx, PlayState* play); +void EnGb2_Draw(Actor* thisx, PlayState* play); -void func_80B0FBF0(EnGb2* this, GlobalContext* globalCtx); -void func_80B0FEBC(EnGb2* this, GlobalContext* globalCtx); -void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx); -void func_80B10240(EnGb2* this, GlobalContext* globalCtx); -void func_80B10344(EnGb2* this, GlobalContext* globalCtx); -void func_80B10584(EnGb2* this, GlobalContext* globalCtx); -void func_80B10634(EnGb2* this, GlobalContext* globalCtx); -void func_80B10868(EnGb2* this, GlobalContext* globalCtx); -void func_80B10924(EnGb2* this, GlobalContext* globalCtx); -void func_80B109DC(EnGb2* this, GlobalContext* globalCtx); -void func_80B10A48(EnGb2* this, GlobalContext* globalCtx); -void func_80B10B5C(EnGb2* this, GlobalContext* globalCtx); -void func_80B10DAC(EnGb2* this, GlobalContext* globalCtx); -void func_80B10E98(EnGb2* this, GlobalContext* globalCtx); -void func_80B11048(EnGb2* this, GlobalContext* globalCtx); -void func_80B110F8(EnGb2* this, GlobalContext* globalCtx); -void func_80B111AC(EnGb2* this, GlobalContext* globalCtx); -void func_80B11268(EnGb2* this, GlobalContext* globalCtx); -void func_80B11344(EnGb2* this, GlobalContext* globalCtx); +void func_80B0FBF0(EnGb2* this, PlayState* play); +void func_80B0FEBC(EnGb2* this, PlayState* play); +void func_80B0FFA8(EnGb2* this, PlayState* play); +void func_80B10240(EnGb2* this, PlayState* play); +void func_80B10344(EnGb2* this, PlayState* play); +void func_80B10584(EnGb2* this, PlayState* play); +void func_80B10634(EnGb2* this, PlayState* play); +void func_80B10868(EnGb2* this, PlayState* play); +void func_80B10924(EnGb2* this, PlayState* play); +void func_80B109DC(EnGb2* this, PlayState* play); +void func_80B10A48(EnGb2* this, PlayState* play); +void func_80B10B5C(EnGb2* this, PlayState* play); +void func_80B10DAC(EnGb2* this, PlayState* play); +void func_80B10E98(EnGb2* this, PlayState* play); +void func_80B11048(EnGb2* this, PlayState* play); +void func_80B110F8(EnGb2* this, PlayState* play); +void func_80B111AC(EnGb2* this, PlayState* play); +void func_80B11268(EnGb2* this, PlayState* play); +void func_80B11344(EnGb2* this, PlayState* play); const ActorInit En_Gb2_InitVars = { ACTOR_EN_GB2, @@ -87,20 +87,20 @@ static ColliderCylinderInitType1 sCylinderInit = { { 40, 75, 0, { 0, 0, 0 } }, }; -void func_80B0F5E0(EnGb2* this, GlobalContext* globalCtx) { +void func_80B0F5E0(EnGb2* this, PlayState* play) { 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; - 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 func_80B0F660(EnGb2* this, GlobalContext* globalCtx) { +s32 func_80B0F660(EnGb2* this, PlayState* play) { Actor* temp_v0; Actor* phi_s0 = NULL; while (true) { - temp_v0 = SubS_FindActor(globalCtx, phi_s0, ACTORCAT_NPC, ACTOR_EN_GB2); + temp_v0 = SubS_FindActor(play, phi_s0, ACTORCAT_NPC, ACTOR_EN_GB2); if (temp_v0 == NULL) { break; } @@ -130,9 +130,9 @@ void func_80B0F6DC(EnGb2* this) { this->actionFunc = func_80B0FEBC; } -void func_80B0F728(EnGb2* this, GlobalContext* globalCtx) { +void func_80B0F728(EnGb2* this, PlayState* play) { if (gSaveContext.eventInf[4] & 0x10) { - func_80B0FBF0(this, globalCtx); + func_80B0FBF0(this, play); this->unk_26E = 0x14E1; if (gSaveContext.eventInf[4] & 0x80) { this->unk_288 = 10; @@ -140,7 +140,7 @@ void func_80B0F728(EnGb2* this, GlobalContext* globalCtx) { this->unk_288 = 30; } } else if (gSaveContext.eventInf[4] & 0x20) { - func_80B0FBF0(this, globalCtx); + func_80B0FBF0(this, play); this->unk_26E = 0x14E0; this->unk_26C |= 2; } else { @@ -246,8 +246,8 @@ void func_80B0FA04(EnGb2* this) { this->unk_282[2] = ActorCutscene_GetAdditionalCutscene(this->unk_282[1]); } -s32 func_80B0FA48(EnGb2* this, GlobalContext* globalCtx) { - switch (Player_GetMask(globalCtx)) { +s32 func_80B0FA48(EnGb2* this, PlayState* play) { + switch (Player_GetMask(play)) { case PLAYER_MASK_GIBDO: this->unk_26C |= 4; this->unk_26E = 0x14E6; @@ -318,7 +318,7 @@ u16 func_80B0FB24(EnGb2* this) { return 0; } -void func_80B0FBF0(EnGb2* this, GlobalContext* globalCtx) { +void func_80B0FBF0(EnGb2* this, PlayState* play) { Vec3f sp90[4] = { { 120.0f, 0.0f, 800.0f }, { -120.0f, 0.0f, 750.0f }, @@ -341,58 +341,58 @@ void func_80B0FBF0(EnGb2* this, GlobalContext* globalCtx) { s16 end = ARRAY_COUNT(sp90); for (i = 0; i < end; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, sp90[i].x, sp90[i].y, - sp90[i].z, sp78[i].x, sp78[i].y, sp78[i].z, sp68[i]); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, sp90[i].x, sp90[i].y, sp90[i].z, + sp78[i].x, sp78[i].y, sp78[i].z, sp68[i]); } } -void func_80B0FD8C(EnGb2* this, GlobalContext* globalCtx) { +void func_80B0FD8C(EnGb2* this, PlayState* play) { this->unk_280++; this->unk_268 = this->actor.child; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, - D_80B119B0[this->unk_280].unk_04.x, D_80B119B0[this->unk_280].unk_04.y, - D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, D_80B119B0[this->unk_280].unk_10); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, D_80B119B0[this->unk_280].unk_04.x, + D_80B119B0[this->unk_280].unk_04.y, D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, + D_80B119B0[this->unk_280].unk_10); } -void func_80B0FE18(GlobalContext* globalCtx) { +void func_80B0FE18(PlayState* play) { func_800FD750(0x38); - globalCtx->nextEntranceIndex = 0x9C10; - globalCtx->unk_1887F = 0x40; + play->nextEntranceIndex = 0x9C10; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } -void func_80B0FE7C(GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x9C20; - globalCtx->unk_1887F = 0x40; +void func_80B0FE7C(PlayState* play) { + play->nextEntranceIndex = 0x9C20; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } -void func_80B0FEBC(EnGb2* this, GlobalContext* globalCtx) { - if ((globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 7)) { - globalCtx->msgCtx.ocarinaMode = 4; +void func_80B0FEBC(EnGb2* this, PlayState* play) { + if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.unk1202E == 7)) { + play->msgCtx.ocarinaMode = 4; gSaveContext.eventInf[4] |= 0x80; this->unk_26E = 0x14D1; this->unk_288 = 10; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B0FFA8; } else if ((this->actor.xzDistToPlayer < 300.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } -void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80B0FFA8(EnGb2* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_26E = 0x14D1; this->unk_288 = 30; gSaveContext.eventInf[4] &= (u8)~0x80; @@ -400,22 +400,22 @@ void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx) { this->actionFunc = func_80B0FEBC; } else { this->unk_26E = func_80B0F7FC(this); - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(globalCtx)) { + } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { if (this->unk_26E == 0x14D5) { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } else { func_8019F208(); this->unk_26E = 0x14D8; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } break; @@ -423,17 +423,17 @@ void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx) { func_8019F230(); this->unk_26E = 0x14D6; this->unk_26C |= 2; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); break; } } else if (this->unk_26E == 0x14DA) { - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); func_801159EC(-this->unk_288); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; - func_800B7298(globalCtx, NULL, 7); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; + func_800B7298(play, NULL, 7); this->actionFunc = func_80B11344; break; @@ -441,23 +441,23 @@ void func_80B0FFA8(EnGb2* this, GlobalContext* globalCtx) { func_8019F230(); this->unk_26E = 0x14DB; this->unk_26C |= 2; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); break; } } } } -void func_80B10240(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10240(EnGb2* this, PlayState* play) { this->unk_27C = D_80B119B0[this->unk_280].unk_00; this->unk_27E = D_80B119B0[this->unk_280].unk_10; this->unk_282[0] = this->actor.cutscene; this->unk_268 = NULL; if (ActorCutscene_GetCanPlayNext(this->unk_282[0])) { ActorCutscene_Start(this->unk_282[0], &this->actor); - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, this->unk_27C, - D_80B119B0[this->unk_280].unk_04.x, D_80B119B0[this->unk_280].unk_04.y, - D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, this->unk_27E); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, this->unk_27C, D_80B119B0[this->unk_280].unk_04.x, + D_80B119B0[this->unk_280].unk_04.y, D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, + this->unk_27E); if (this->unk_280 == 0) { func_8010E9F0(1, 180); } @@ -467,9 +467,9 @@ void func_80B10240(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B10344(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10344(EnGb2* this, PlayState* play) { if (this->unk_280 == 1) { - func_80B0FD8C(this, globalCtx); + func_80B0FD8C(this, play); } if (this->unk_280 == 2) { @@ -490,7 +490,7 @@ void func_80B10344(EnGb2* this, GlobalContext* globalCtx) { gSaveContext.unk_3DD0[1] = 5; func_800FE498(); gSaveContext.eventInf[4] |= 0x40; - func_80B0FE7C(globalCtx); + func_80B0FE7C(play); } else if (this->unk_280 == 2) { if (this->unk_26C & 0x400) { this->unk_280++; @@ -518,7 +518,7 @@ void func_80B10344(EnGb2* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - func_80B0FE7C(globalCtx); + func_80B0FE7C(play); } else if (gSaveContext.unk_3DE0[1] == 0) { gSaveContext.unk_3DD0[1] = 5; gSaveContext.eventInf[4] |= 0x40; @@ -532,29 +532,29 @@ void func_80B10344(EnGb2* this, GlobalContext* globalCtx) { this->actor.child = NULL; } - func_80B0FE7C(globalCtx); + func_80B0FE7C(play); } } -void func_80B10584(EnGb2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); +void func_80B10584(EnGb2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->unk_26E, &this->actor); this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = func_80B10634; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } -void func_80B10634(EnGb2* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80B10634(EnGb2* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_26C &= ~2; if (this->unk_26E == 0x14DD) { this->unk_26E = 0x14DE; @@ -569,23 +569,23 @@ void func_80B10634(EnGb2* this, GlobalContext* globalCtx) { } } else { this->unk_26E = func_80B0F8F8(this); - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } else { func_8019F208(); func_801159EC(-this->unk_288); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; - func_800B7298(globalCtx, NULL, 7); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; + func_800B7298(play, NULL, 7); this->actionFunc = func_80B11344; } break; @@ -594,13 +594,13 @@ void func_80B10634(EnGb2* this, GlobalContext* globalCtx) { func_8019F230(); this->unk_26E = 0x14E3; this->unk_26C |= 2; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); break; } } } -void func_80B10868(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10868(EnGb2* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->unk_282[2]) { if (ActorCutscene_GetCanPlayNext(this->unk_282[this->unk_290])) { this->actionFunc = func_80B10A48; @@ -614,7 +614,7 @@ void func_80B10868(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B10924(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10924(EnGb2* this, PlayState* play) { s32 sp24; if (gSaveContext.save.weekEventReg[54] & 0x40) { @@ -623,7 +623,7 @@ void func_80B10924(EnGb2* this, GlobalContext* globalCtx) { sp24 = 12; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (sp24 == 12) { gSaveContext.save.weekEventReg[54] |= 0x40; @@ -632,20 +632,20 @@ void func_80B10924(EnGb2* this, GlobalContext* globalCtx) { } this->actionFunc = func_80B109DC; } else { - Actor_PickUp(&this->actor, globalCtx, sp24, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, sp24, 300.0f, 300.0f); } } -void func_80B109DC(EnGb2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); +void func_80B109DC(EnGb2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B10634; } else { - func_800B85E0(&this->actor, globalCtx, 300.0f, -1); + func_800B85E0(&this->actor, play, 300.0f, -1); } } -void func_80B10A48(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10A48(EnGb2* this, PlayState* play) { this->unk_28A -= 5; if (this->unk_28A < 5) { this->unk_28A = 0; @@ -663,7 +663,7 @@ void func_80B10A48(EnGb2* this, GlobalContext* globalCtx) { case ENGB2_7_2: ActorCutscene_Stop(this->unk_282[this->unk_290]); if (this->unk_26E == 0x14FB) { - Flags_SetSwitch(globalCtx, ENGB2_GET_7F8(&this->actor)); + Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); Actor_MarkForDeath(&this->actor); } else { this->actor.draw = NULL; @@ -676,35 +676,35 @@ void func_80B10A48(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B10B5C(EnGb2* this, GlobalContext* globalCtx) { - s32 mask = Player_GetMask(globalCtx); +void func_80B10B5C(EnGb2* this, PlayState* play) { + s32 mask = Player_GetMask(play); if (this->unk_28C != mask) { - this->unk_28C = Player_GetMask(globalCtx); + this->unk_28C = Player_GetMask(play); this->unk_26C &= ~0x80; this->unk_26C &= ~0x20; this->unk_26C &= ~0x40; } - if (func_80B0FA48(this, globalCtx)) { + if (func_80B0FA48(this, play)) { this->unk_26C &= ~0x20; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_26C & 0x40)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_26C & 0x40)) { if ((this->unk_26E == 0x14EE) || (this->unk_26E == 0x14F4)) { this->unk_26C |= 2; } - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); this->unk_290 = 1; this->unk_26C &= ~0x40; this->actionFunc = func_80B10DAC; } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isTargeted) { this->unk_26C |= 0x40; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } else { this->unk_26C &= ~0x40; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_26C & 0x20)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_26C & 0x20)) { this->actor.flags &= ~ACTOR_FLAG_10000; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); if (this->unk_26E == 0x14EB) { gSaveContext.save.weekEventReg[80] |= 0x40; } else if (this->unk_26E == 0x14EF) { @@ -718,19 +718,19 @@ void func_80B10B5C(EnGb2* this, GlobalContext* globalCtx) { if (!(this->unk_26C & 0x80)) { this->actor.flags |= ACTOR_FLAG_10000; this->unk_26C |= 0x20; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } } } -void func_80B10DAC(EnGb2* this, GlobalContext* globalCtx) { +void func_80B10DAC(EnGb2* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_282[this->unk_290])) { if (ENGB2_GET_7(&this->actor) == ENGB2_7_1) { if (this->unk_290 != 2) { this->actionFunc = func_80B10E98; } else { - Flags_SetSwitch(globalCtx, ENGB2_GET_7F8(&this->actor)); + Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); this->actionFunc = func_80B10868; } } else { @@ -745,16 +745,16 @@ void func_80B10DAC(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B10E98(EnGb2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80B10E98(EnGb2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { this->unk_26C &= ~2; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if ((this->unk_26E != 0x14E8) && (this->unk_26E != 0x14EA)) { ActorCutscene_Stop(this->unk_282[this->unk_290]); this->actionFunc = func_80B10B5C; - } else if (Flags_GetSwitch(globalCtx, ENGB2_GET_7F8(&this->actor))) { + } else if (Flags_GetSwitch(play, ENGB2_GET_7F8(&this->actor))) { this->actionFunc = func_80B10A48; } else { ActorCutscene_Stop(this->unk_282[this->unk_290]); @@ -766,7 +766,7 @@ void func_80B10E98(EnGb2* this, GlobalContext* globalCtx) { s32 temp; this->unk_26E = func_80B0FB24(this); - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); temp = this->unk_26E; if ((temp == 0x14E7) || (temp == 0x14E9) || (temp == 0x14EC) || (temp == 0x14F0)) { ActorCutscene_Stop(this->unk_282[this->unk_290]); @@ -778,39 +778,39 @@ void func_80B10E98(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B11048(EnGb2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B11048(EnGb2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B10DAC; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } } -void func_80B110F8(EnGb2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80B110F8(EnGb2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_26C &= ~2; this->actionFunc = func_80B10A48; } else { this->unk_26E = func_80B0F97C(this); - Message_StartTextbox(globalCtx, this->unk_26E, &this->actor); + Message_StartTextbox(play, this->unk_26E, &this->actor); } } } -void func_80B111AC(EnGb2* this, GlobalContext* globalCtx) { +void func_80B111AC(EnGb2* this, PlayState* play) { s32 index; - if (globalCtx->roomCtx.currRoom.num == 1) { + if (play->roomCtx.currRoom.num == 1) { return; } - switch (globalCtx->roomCtx.currRoom.num) { + switch (play->roomCtx.currRoom.num) { case 2: index = 1; break; @@ -836,12 +836,11 @@ void func_80B111AC(EnGb2* this, GlobalContext* globalCtx) { this->actionFunc = func_80B11268; } -void func_80B11268(EnGb2* this, GlobalContext* globalCtx) { - if (globalCtx->roomCtx.currRoom.num == 1) { +void func_80B11268(EnGb2* this, PlayState* play) { + if (play->roomCtx.currRoom.num == 1) { this->unk_290 = 0; this->unk_282[0] = this->actor.cutscene; - if (Flags_GetClear(globalCtx, 2) && Flags_GetClear(globalCtx, 3) && Flags_GetClear(globalCtx, 4) && - Flags_GetClear(globalCtx, 5)) { + if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && Flags_GetClear(play, 5)) { this->unk_28A = 0xFF; this->unk_26C &= ~0x100; this->actor.flags |= ACTOR_FLAG_1; @@ -854,9 +853,9 @@ void func_80B11268(EnGb2* this, GlobalContext* globalCtx) { } } -void func_80B11344(EnGb2* this, GlobalContext* globalCtx) { +void func_80B11344(EnGb2* this, PlayState* play) { if (gSaveContext.rupeeAccumulator == 0) { - func_80B0FE18(globalCtx); + func_80B0FE18(play); } } @@ -865,22 +864,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2200, ICHAIN_STOP), }; -void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGb2_Init(Actor* thisx, PlayState* play) { s32 pad; EnGb2* this = THIS; - if (func_80B0F660(this, globalCtx)) { + if (func_80B0F660(this, play)) { Actor_MarkForDeath(&this->actor); return; } this->actor.room = -1; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ps_Skel_007230, &object_ps_Anim_00049C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ps_Skel_007230, &object_ps_Anim_00049C, this->jointTable, this->morphTable, 12); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - 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_SetScale(&this->actor, 0.01f); switch (ENGB2_GET_7(&this->actor)) { @@ -902,40 +901,40 @@ void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_2000000; if (gSaveContext.eventInf[4] & 0x40) { - func_80B0F728(this, globalCtx); + func_80B0F728(this, play); } else { - func_80B0FBF0(this, globalCtx); + func_80B0FBF0(this, play); func_80B0F6DC(this); } break; case ENGB2_7_1: - if ((globalCtx->curSpawn == 1) || (gSaveContext.save.weekEventReg[80] & 0x80)) { + if ((play->curSpawn == 1) || (gSaveContext.save.weekEventReg[80] & 0x80)) { Actor_MarkForDeath(&this->actor); return; } - if (Flags_GetSwitch(globalCtx, ENGB2_GET_7F8(thisx))) { + if (Flags_GetSwitch(play, ENGB2_GET_7F8(thisx))) { Actor_MarkForDeath(&this->actor); return; } this->unk_28A = 255; func_80B0FA04(this); - this->unk_28C = Player_GetMask(globalCtx); + this->unk_28C = Player_GetMask(play); this->actionFunc = func_80B10B5C; break; case ENGB2_7_2: this->unk_290 = 0; this->unk_282[0] = this->actor.cutscene; - if (Flags_GetSwitch(globalCtx, ENGB2_GET_7F8(thisx))) { + if (Flags_GetSwitch(play, ENGB2_GET_7F8(thisx))) { Actor_MarkForDeath(&this->actor); return; } - if (Flags_GetClear(globalCtx, 2) && Flags_GetClear(globalCtx, 3) && Flags_GetClear(globalCtx, 4) && - Flags_GetClear(globalCtx, 5)) { + if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && + Flags_GetClear(play, 5)) { Actor_MarkForDeath(&this->actor); return; } @@ -958,26 +957,26 @@ void EnGb2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGb2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGb2_Destroy(Actor* thisx, PlayState* play) { EnGb2* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGb2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGb2_Update(Actor* thisx, PlayState* play) { EnGb2* this = THIS; SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->unk_26C & 0x100)) { - func_80B0F5E0(this, globalCtx); + func_80B0F5E0(this, play); } - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_270, &this->unk_276, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_270, &this->unk_276, this->actor.focus.pos); } -s32 EnGb2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnGb2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGb2* this = THIS; @@ -992,7 +991,7 @@ s32 EnGb2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnGb2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnGb2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGb2* this = THIS; Vec3f sp18 = { 2400.0f, 0.0f, 0.0f }; @@ -1001,30 +1000,30 @@ void EnGb2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGb2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGb2_Draw(Actor* thisx, PlayState* play) { EnGb2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_28A == 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGb2_OverrideLimbDraw, EnGb2_PostLimbDraw, - &this->actor, POLY_OPA_DISP); + Scene_SetRenderModeXlu(play, 0, 1); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGb2_OverrideLimbDraw, EnGb2_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, this->unk_28A); - Scene_SetRenderModeXlu(globalCtx, 1, 2); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGb2_OverrideLimbDraw, EnGb2_PostLimbDraw, - &this->actor, POLY_XLU_DISP); + Scene_SetRenderModeXlu(play, 1, 2); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGb2_OverrideLimbDraw, EnGb2_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h index c054c4ed24..cb53ada3b6 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h @@ -5,7 +5,7 @@ struct EnGb2; -typedef void (*EnGb2ActionFunc)(struct EnGb2*, GlobalContext*); +typedef void (*EnGb2ActionFunc)(struct EnGb2*, PlayState*); #define ENGB2_GET_7(thisx) ((thisx)->params & 7) #define ENGB2_GET_7F8(thisx) (((thisx)->params & 0x7F8) >> 3) 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 935eacb8c5..ae4903c022 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -10,10 +10,10 @@ #define THIS ((EnGe1*)thisx) -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); #if 0 const ActorInit En_Ge1_InitVars = { 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 83b3d2611d..23cf30641b 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -5,7 +5,7 @@ struct EnGe1; -typedef void (*EnGe1ActionFunc)(struct EnGe1*, GlobalContext*); +typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); typedef struct EnGe1 { /* 0x0000 */ Actor actor; 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 b8522c2c62..c05db47fdb 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -10,21 +10,21 @@ #define THIS ((EnGe2*)thisx) -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); -void func_80B8BCEC(EnGe2* this, GlobalContext* globalCtx); -void func_80B8BD38(EnGe2* this, GlobalContext* globalCtx); -void func_80B8BE08(EnGe2* this, GlobalContext* globalCtx); -void func_80B8BF04(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C048(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C0B0(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C45C(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C59C(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C644(EnGe2* this, GlobalContext* globalCtx); -void func_80B8C9B8(EnGe2* this, GlobalContext* globalCtx); +void func_80B8BCEC(EnGe2* this, PlayState* play); +void func_80B8BD38(EnGe2* this, PlayState* play); +void func_80B8BE08(EnGe2* this, PlayState* play); +void func_80B8BF04(EnGe2* this, PlayState* play); +void func_80B8C048(EnGe2* this, PlayState* play); +void func_80B8C0B0(EnGe2* this, PlayState* play); +void func_80B8C45C(EnGe2* this, PlayState* play); +void func_80B8C59C(EnGe2* this, PlayState* play); +void func_80B8C644(EnGe2* this, PlayState* play); +void func_80B8C9B8(EnGe2* this, PlayState* play); #if 0 const ActorInit En_Ge2_InitVars = { 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 6555dfc73e..5596f0b1e5 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -5,7 +5,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 593c57a5ab..50e4ed613f 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -10,10 +10,10 @@ #define THIS ((EnGe3*)thisx) -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); #if 0 const ActorInit En_Ge3_InitVars = { 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 9ffb271d1c..018d99a674 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -5,7 +5,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_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index a2efb787a2..8ccb969da4 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -15,26 +15,26 @@ #define THIS ((EnGeg*)thisx) -void EnGeg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGeg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGeg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGeg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGeg_Init(Actor* thisx, PlayState* play); +void EnGeg_Destroy(Actor* thisx, PlayState* play); +void EnGeg_Update(Actor* thisx, PlayState* play); +void EnGeg_Draw(Actor* thisx, PlayState* play); -void func_80BB217C(EnGeg* this, GlobalContext* globalCtx); -void func_80BB221C(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2520(EnGeg* this, GlobalContext* globalCtx); -void func_80BB26EC(EnGeg* this, GlobalContext* globalCtx); -void func_80BB27D4(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2944(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2A54(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2E00(EnGeg* this, GlobalContext* globalCtx); -void func_80BB2F7C(EnGeg* this, GlobalContext* globalCtx); -void func_80BB30B4(EnGeg* this, GlobalContext* globalCtx); -void func_80BB31B8(EnGeg* this, GlobalContext* globalCtx); -void func_80BB32AC(EnGeg* this, GlobalContext* globalCtx); -void func_80BB3318(EnGeg* this, GlobalContext* globalCtx); -void func_80BB347C(EnGeg* this, GlobalContext* globalCtx); +void func_80BB217C(EnGeg* this, PlayState* play); +void func_80BB221C(EnGeg* this, PlayState* play); +void func_80BB2520(EnGeg* this, PlayState* play); +void func_80BB26EC(EnGeg* this, PlayState* play); +void func_80BB27D4(EnGeg* this, PlayState* play); +void func_80BB2944(EnGeg* this, PlayState* play); +void func_80BB2A54(EnGeg* this, PlayState* play); +void func_80BB2B1C(EnGeg* this, PlayState* play); +void func_80BB2E00(EnGeg* this, PlayState* play); +void func_80BB2F7C(EnGeg* this, PlayState* play); +void func_80BB30B4(EnGeg* this, PlayState* play); +void func_80BB31B8(EnGeg* this, PlayState* play); +void func_80BB32AC(EnGeg* this, PlayState* play); +void func_80BB3318(EnGeg* this, PlayState* play); +void func_80BB347C(EnGeg* this, PlayState* play); const ActorInit En_Geg_InitVars = { ACTOR_EN_GEG, @@ -189,7 +189,7 @@ u16 func_80BB16D0(EnGeg* this) { return 0; } -void func_80BB178C(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB178C(EnGeg* this, PlayState* play) { Vec3f sp34 = this->actor.world.pos; Collider* collider; @@ -215,8 +215,8 @@ void func_80BB178C(EnGeg* this, GlobalContext* globalCtx) { } if (collider != NULL) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, collider); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, collider); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); } } @@ -237,8 +237,8 @@ s32 func_80BB18FC(EnGeg* this, Actor* actor) { return false; } -Vec3f* func_80BB19C0(Vec3f* arg0, EnGeg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +Vec3f* func_80BB19C0(Vec3f* arg0, EnGeg* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; s16 sp32 = player->actor.world.rot.y + 0x4000; @@ -267,9 +267,9 @@ Vec3f* func_80BB19C0(Vec3f* arg0, EnGeg* this, GlobalContext* globalCtx) { return arg0; } -u8 func_80BB1B14(EnGeg* this, GlobalContext* globalCtx) { +u8 func_80BB1B14(EnGeg* this, PlayState* play) { Actor* explosive; - Actor* mm = SubS_FindActor(globalCtx, NULL, ACTORCAT_ITEMACTION, ACTOR_EN_MM); + Actor* mm = SubS_FindActor(play, NULL, ACTORCAT_ITEMACTION, ACTOR_EN_MM); if (mm != NULL) { this->unk_4B0 = Math_Vec3f_Yaw(&this->actor.world.pos, &mm->world.pos); @@ -278,7 +278,7 @@ u8 func_80BB1B14(EnGeg* this, GlobalContext* globalCtx) { } } - explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { if ((explosive->id == ACTOR_EN_BOM) && func_80BB18FC(this, explosive)) { @@ -337,8 +337,8 @@ void func_80BB1D04(EnGeg* this) { this->actor.focus.rot.z = this->actor.world.rot.z; } -s32 func_80BB1D64(EnGeg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BB1D64(EnGeg* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; s16 yaw = (this->actor.yawTowardsPlayer - this->unk_46E) - this->actor.shape.rot.y; @@ -371,17 +371,17 @@ s32 func_80BB1D64(EnGeg* this, GlobalContext* globalCtx) { return true; } -void func_80BB1FCC(EnGeg* this, GlobalContext* globalCtx) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[this->unk_248].segment); +void func_80BB1FCC(EnGeg* this, PlayState* play) { + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[this->unk_248].segment); SkelAnime_Update(&this->skelAnime); } -void func_80BB2020(EnGeg* this, GlobalContext* globalCtx) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[this->unk_248].segment); +void func_80BB2020(EnGeg* this, PlayState* play) { + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[this->unk_248].segment); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_4AC); } -s32 func_80BB2088(EnGeg* this, GlobalContext* globalCtx) { +s32 func_80BB2088(EnGeg* this, PlayState* play) { if (DECR(this->unk_242) != 0) { this->unk_468 = 0; this->unk_46A = 0; @@ -394,7 +394,7 @@ s32 func_80BB2088(EnGeg* this, GlobalContext* globalCtx) { if (Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7FF8) && ((this->unk_4AC == 5) || ((this->unk_4AC == 13) && (this->unk_496 == 0xD69)))) { this->unk_230 |= 2; - func_80BB1D64(this, globalCtx); + func_80BB1D64(this, play); } else { if (this->unk_230 & 2) { this->unk_242 = 20; @@ -409,10 +409,10 @@ s32 func_80BB2088(EnGeg* this, GlobalContext* globalCtx) { return true; } -void func_80BB217C(EnGeg* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_248)) { +void func_80BB217C(EnGeg* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->unk_248)) { this->unk_4AC = 5; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); Actor_SetScale(&this->actor, 0.01f); this->unk_230 = 0; this->actor.shape.shadowScale = 20.0f; @@ -423,12 +423,12 @@ void func_80BB217C(EnGeg* this, GlobalContext* globalCtx) { } } -void func_80BB221C(EnGeg* this, GlobalContext* globalCtx) { - u8 sp27 = func_80BB1B14(this, globalCtx); +void func_80BB221C(EnGeg* this, PlayState* play) { + u8 sp27 = func_80BB1B14(this, play); if (sp27 != 0) { this->unk_230 &= ~8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_230 & 4)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 4)) { if (sp27 == 1) { this->unk_496 = 0xD66; this->unk_49A = this->unk_49C[3]; @@ -442,43 +442,43 @@ void func_80BB221C(EnGeg* this, GlobalContext* globalCtx) { this->unk_49A = this->unk_49C[2]; this->unk_230 &= ~4; } - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB2520; this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer < 300.0f) { this->unk_230 |= 4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } else { this->unk_230 &= ~4; if (gSaveContext.save.weekEventReg[35] & 0x40) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_230 & 8)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { this->unk_496 = 0xD62; - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); this->unk_230 &= ~8; this->actionFunc = func_80BB27D4; } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); this->unk_230 |= 8; } - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_230 & 8)) { + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { gSaveContext.save.weekEventReg[35] |= 0x40; this->unk_496 = 0xD5E; this->unk_49A = this->unk_49C[0]; - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB2520; this->unk_230 &= ~8; this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer < 300.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); this->unk_230 |= 8; } } } -void func_80BB2520(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB2520(EnGeg* this, PlayState* play) { if (this->unk_230 & 0x10) { ActorCutscene_Stop(this->unk_498); this->unk_230 &= ~0x10; @@ -506,10 +506,10 @@ void func_80BB2520(EnGeg* this, GlobalContext* globalCtx) { break; case 0xD66: - this->unk_248 = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OF1D_MAP); + this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); if (this->unk_248 >= 0) { this->unk_4AC = 19; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); } this->unk_230 |= 0x20; this->actionFunc = func_80BB2944; @@ -524,10 +524,10 @@ void func_80BB2520(EnGeg* this, GlobalContext* globalCtx) { case 0xD72: case 0xD75: case 0xD8B: - this->unk_248 = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OF1D_MAP); + this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); if (this->unk_248 >= 0) { this->unk_4AC = 4; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); } this->actionFunc = func_80BB2E00; break; @@ -541,8 +541,8 @@ void func_80BB2520(EnGeg* this, GlobalContext* globalCtx) { } } -void func_80BB26EC(EnGeg* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80BB26EC(EnGeg* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD5E: this->unk_49A = this->unk_49C[1]; @@ -551,47 +551,47 @@ void func_80BB26EC(EnGeg* this, GlobalContext* globalCtx) { case 0xD61: ActorCutscene_Stop(this->unk_498); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_230 &= ~0x10; this->actionFunc = func_80BB221C; return; } this->unk_496 = func_80BB16D0(this); - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); } } -void func_80BB27D4(EnGeg* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80BB27D4(EnGeg* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD63: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BB221C; break; case 0xD69: this->unk_49A = this->unk_49C[6]; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BB2520; break; case 0xD6D: case 0xD6F: case 0xD8A: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BB31B8; break; case 0xD72: case 0xD75: case 0xD8B: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_230 &= ~0x10; this->unk_49A = this->unk_49C[7]; this->actionFunc = func_80BB2520; @@ -599,52 +599,52 @@ void func_80BB27D4(EnGeg* this, GlobalContext* globalCtx) { default: this->unk_496 = func_80BB16D0(this); - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); break; } } } -void func_80BB2944(EnGeg* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_80BB2944(EnGeg* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_4AC].animation); if (this->unk_4AC == 19) { if (curFrame == lastFrame) { this->unk_4AC = 6; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); } - } else if ((sp27 == 5) && Message_ShouldAdvance(globalCtx)) { + } else if ((sp27 == 5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD67) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_49A = this->unk_49C[4]; this->actionFunc = func_80BB2520; } else { this->unk_496 = func_80BB16D0(this); - func_80151938(globalCtx, this->unk_496); + func_80151938(play, this->unk_496); } } } -void func_80BB2A54(EnGeg* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80BB2A54(EnGeg* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD65) { ActorCutscene_Stop(this->unk_498); this->unk_230 &= ~0x10; this->unk_244 = 65; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80BB347C; } else { this->unk_496 = func_80BB16D0(this); - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); } } } -void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB2B1C(EnGeg* this, PlayState* play) { Vec3f sp74; f32 temp_f20; s16 i; @@ -662,11 +662,11 @@ void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx) { this->unk_230 |= 0x10; ActorCutscene_StartAndSetFlag(this->unk_498, &this->actor); this->unk_496 = 0xD68; - func_80151938(globalCtx, this->unk_496); - this->unk_248 = Object_GetIndex(&globalCtx->objectCtx, OBJECT_TAISOU); + func_80151938(play, this->unk_496); + this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); if (this->unk_248 >= 0) { this->unk_4AC = 13; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); } this->actionFunc = func_80BB27D4; } else { @@ -692,7 +692,7 @@ void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx) { this->unk_4C0[i].x *= temp_f20; this->unk_4C0[i].y *= temp_f20; this->unk_4C0[i].z *= temp_f20; - EffectSsHahen_Spawn(globalCtx, &this->unk_4B4, &this->unk_4C0[i], &sp74, 1, sp68, 1, 15, + EffectSsHahen_Spawn(play, &this->unk_4B4, &this->unk_4C0[i], &sp74, 1, sp68, 1, 15, gameplay_keep_DL_06AB30); } } @@ -702,7 +702,7 @@ void func_80BB2B1C(EnGeg* this, GlobalContext* globalCtx) { func_8019F4AC(&this->actor.projectedPos, NA_SE_EN_GOLON_SIRLOIN_EAT - SFX_FLAG); } -void func_80BB2E00(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB2E00(EnGeg* this, PlayState* play) { s16 sp2E = this->skelAnime.curFrame; s16 sp2C = Animation_GetLastFrame(sAnimations[this->unk_4AC].animation); @@ -712,7 +712,7 @@ void func_80BB2E00(EnGeg* this, GlobalContext* globalCtx) { if (sp2E == sp2C) { ActorCutscene_Stop(this->unk_498); this->unk_4AC = 20; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); this->actionFunc = func_80BB30B4; } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_STAND_IMT); @@ -722,7 +722,7 @@ void func_80BB2E00(EnGeg* this, GlobalContext* globalCtx) { this->unk_230 |= 1; this->actor.shape.yOffset = 14.0f; if (this->unk_496 == 0xD69) { - func_80BB19C0(&this->unk_4E4, this, globalCtx); + func_80BB19C0(&this->unk_4E4, this, play); this->actionFunc = func_80BB2F7C; } else { this->actionFunc = func_80BB3318; @@ -733,7 +733,7 @@ void func_80BB2E00(EnGeg* this, GlobalContext* globalCtx) { } } -void func_80BB2F7C(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB2F7C(EnGeg* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_4E4), 4, 1000, 1); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -743,7 +743,7 @@ void func_80BB2F7C(EnGeg* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->unk_230 &= ~1; this->actor.shape.yOffset = 0.0f; - func_80BB2020(this, globalCtx); + func_80BB2020(this, play); this->actionFunc = func_80BB2E00; } else { this->actor.speedXZ = 5.0f; @@ -760,31 +760,31 @@ void func_80BB2F7C(EnGeg* this, GlobalContext* globalCtx) { } } -void func_80BB30B4(EnGeg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BB30B4(EnGeg* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (player->transformation == PLAYER_FORM_GORON) { this->unk_496 = 0xD6A; - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_DON_GERO) { + } else if (Player_GetMask(play) == PLAYER_MASK_DON_GERO) { this->unk_496 = 0xD89; } else { this->unk_496 = 0xD6E; } - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); + Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB27D4; this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->actor.xzDistToPlayer < 150.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 150.0f); + func_800B8614(&this->actor, play, 150.0f); } } -void func_80BB31B8(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB31B8(EnGeg* this, PlayState* play) { s32 getItemId = GI_MASK_DON_GERO; if (INV_CONTENT(ITEM_MASK_DON_GERO) == ITEM_MASK_DON_GERO) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_DON_GERO) { + if (Player_GetMask(play) == PLAYER_MASK_DON_GERO) { this->unk_496 = 0xD8B; getItemId = GI_RUPEE_PURPLE; } else { @@ -795,7 +795,7 @@ void func_80BB31B8(EnGeg* this, GlobalContext* globalCtx) { this->unk_496 = 0xD70; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; gSaveContext.save.weekEventReg[61] |= 1; if (getItemId == GI_MASK_DON_GERO) { @@ -803,20 +803,20 @@ void func_80BB31B8(EnGeg* this, GlobalContext* globalCtx) { } this->actionFunc = func_80BB32AC; } else { - Actor_PickUp(&this->actor, globalCtx, getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, getItemId, 300.0f, 300.0f); } } -void func_80BB32AC(EnGeg* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->unk_496, &this->actor); +void func_80BB32AC(EnGeg* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB27D4; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80BB3318(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB3318(EnGeg* this, PlayState* play) { static Vec3f D_80BB4044[] = { { -550.0f, 8.0f, 550.0f }, { 220.0f, 43.0f, 525.0f }, @@ -832,7 +832,7 @@ void func_80BB3318(EnGeg* this, GlobalContext* globalCtx) { this->unk_4D8++; } this->actor.shape.rot.y = this->actor.world.rot.y; - func_800AE930(&globalCtx->colCtx, Effect_GetByIndex(this->unk_4DC), &this->actor.world.pos, 18.0f, + func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_4DC), &this->actor.world.pos, 18.0f, this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } @@ -847,14 +847,14 @@ void func_80BB3318(EnGeg* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); } -void func_80BB347C(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB347C(EnGeg* this, PlayState* play) { if (DECR(this->unk_244) == 0) { this->unk_244 = 65; this->actionFunc = func_80BB221C; } } -void EnGeg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGeg_Init(Actor* thisx, PlayState* play) { s32 pad; EnGeg* this = THIS; s32 pad2; @@ -866,47 +866,47 @@ void EnGeg_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, &gGoronUnrollAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, &gGoronUnrollAnim, this->jointTable, this->morphTable, GORON_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitSphere(globalCtx, &this->colliderSphere); - Collider_SetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitSphere(play, &this->colliderSphere); + Collider_SetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.update != NULL) { - this->unk_248 = Object_GetIndex(&globalCtx->objectCtx, OBJECT_OF1D_MAP); + this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); if (this->unk_248 < 0) { Actor_MarkForDeath(&this->actor); } } - Effect_Add(globalCtx, &this->unk_4DC, 4, 0, 0, &sp34); + Effect_Add(play, &this->unk_4DC, 4, 0, 0, &sp34); thisx->draw = NULL; this->unk_4E0 = 100; this->actor.draw = EnGeg_Draw; this->actionFunc = func_80BB217C; } -void EnGeg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGeg_Destroy(Actor* thisx, PlayState* play) { EnGeg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroySphere(globalCtx, &this->colliderSphere); - Effect_Destroy(globalCtx, this->unk_4DC); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroySphere(play, &this->colliderSphere); + Effect_Destroy(play, this->unk_4DC); } -void EnGeg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGeg_Update(Actor* thisx, PlayState* play) { EnGeg* this = THIS; - this->actionFunc(this, globalCtx); - func_80BB1FCC(this, globalCtx); - func_80BB2088(this, globalCtx); + this->actionFunc(this, play); + func_80BB1FCC(this, play); + func_80BB2088(this, play); func_80BB1C8C(this); - SubS_FillLimbRotTables(globalCtx, this->unk_238, this->unk_232, ARRAY_COUNT(this->unk_238)); + SubS_FillLimbRotTables(play, this->unk_238, this->unk_232, ARRAY_COUNT(this->unk_238)); func_80BB1D04(this); - func_80BB178C(this, globalCtx); + func_80BB178C(this, play); } s32 func_80BB3728(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 arg5) { @@ -938,11 +938,11 @@ s32 func_80BB3728(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar return true; } -s32 EnGeg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnGeg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnGeg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnGeg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80BB407C = { -1500.0f, 1500.0f, 0.0f }; EnGeg* this = THIS; Vec3f sp38 = { 1.0f, 5.0f, -0.5f }; @@ -950,13 +950,13 @@ void EnGeg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve if (limbIndex == 17) { if (!(this->unk_230 & 0x40)) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gGoronDonGeroMaskDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } sp38.x += Rand_Centered(); @@ -976,7 +976,7 @@ void EnGeg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnGeg_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnGeg_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnGeg* this = THIS; s32 phi_v0; s32 phi_v1; @@ -1033,7 +1033,7 @@ void EnGeg_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void func_80BB3BE0(EnGeg* this, GlobalContext* globalCtx) { +void func_80BB3BE0(EnGeg* this, PlayState* play) { static TexturePtr D_80BB4088[] = { gGoronEyeOpenTex, gGoronEyeHalfTex, @@ -1042,26 +1042,26 @@ void func_80BB3BE0(EnGeg* this, GlobalContext* globalCtx) { }; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BB4088[this->unk_23E])); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGeg_OverrideLimbDraw, EnGeg_PostLimbDraw, EnGeg_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80BB3CB4(EnGeg* this, GlobalContext* globalCtx) { - f32 sp24 = globalCtx->state.frames * this->actor.speedXZ * 1400.0f; +void func_80BB3CB4(EnGeg* this, PlayState* play) { + f32 sp24 = play->state.frames * this->actor.speedXZ * 1400.0f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + this->actor.shape.yOffset, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); @@ -1071,18 +1071,18 @@ void func_80BB3CB4(EnGeg* this, GlobalContext* globalCtx) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_RotateXS(sp24, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronRolledUpDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnGeg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGeg_Draw(Actor* thisx, PlayState* play) { EnGeg* this = THIS; if (this->unk_230 & 1) { - func_80BB3CB4(this, globalCtx); + func_80BB3CB4(this, play); } else { - func_80BB3BE0(this, globalCtx); + func_80BB3BE0(this, play); } } diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.h b/src/overlays/actors/ovl_En_Geg/z_en_geg.h index f5e9ad34db..4a20068bd7 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.h +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.h @@ -5,7 +5,7 @@ struct EnGeg; -typedef void (*EnGegActionFunc)(struct EnGeg*, GlobalContext*); +typedef void (*EnGegActionFunc)(struct EnGeg*, PlayState*); typedef struct EnGeg { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index 8aa0666d59..031652d05e 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -12,19 +12,19 @@ #define THIS ((EnGg*)thisx) -void EnGg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGg_Init(Actor* thisx, PlayState* play); +void EnGg_Destroy(Actor* thisx, PlayState* play); +void EnGg_Update(Actor* thisx, PlayState* play); +void EnGg_Draw(Actor* thisx, PlayState* play); -void func_80B352A4(EnGg* this, GlobalContext* globalCtx); -void func_80B35450(EnGg* this, GlobalContext* globalCtx); -void func_80B3556C(EnGg* this, GlobalContext* globalCtx); +void func_80B352A4(EnGg* this, PlayState* play); +void func_80B35450(EnGg* this, PlayState* play); +void func_80B3556C(EnGg* this, PlayState* play); u16 func_80B357F0(EnGg* this); -void func_80B358D8(EnGg* this, GlobalContext* globalCtx); -void func_80B359DC(EnGg* this, GlobalContext* globalCtx); -void func_80B363E8(EnGgStruct* ptr, GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); -void func_80B364D4(EnGgStruct* ptr, GlobalContext* globalCtx); +void func_80B358D8(EnGg* this, PlayState* play); +void func_80B359DC(EnGg* this, PlayState* play); +void func_80B363E8(EnGgStruct* ptr, PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); +void func_80B364D4(EnGgStruct* ptr, PlayState* play); const ActorInit En_Gg_InitVars = { ACTOR_EN_GG, @@ -116,8 +116,8 @@ void func_80B34F70(EnGg* this) { this->actor.focus.rot.z = this->actor.world.rot.z; } -s32 func_80B34FB4(EnGg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B34FB4(EnGg* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; s16 pitch; @@ -138,13 +138,13 @@ s32 func_80B34FB4(EnGg* this, GlobalContext* globalCtx) { return true; } -void func_80B35108(EnGg* this, GlobalContext* globalCtx) { +void func_80B35108(EnGg* this, PlayState* play) { 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; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 30.0f, 30.0f, 7); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, 7); } void func_80B351A4(EnGg* this) { @@ -174,7 +174,7 @@ void func_80B35250(EnGg* this) { this->actionFunc = func_80B35450; } -void func_80B352A4(EnGg* this, GlobalContext* globalCtx) { +void func_80B352A4(EnGg* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E6].animation); @@ -224,55 +224,55 @@ void func_80B352A4(EnGg* this, GlobalContext* globalCtx) { } } -void func_80B35450(EnGg* this, GlobalContext* globalCtx) { - if ((gSaveContext.save.weekEventReg[91] & 0x10) && (globalCtx->csCtx.state == 0)) { - func_80B359DC(this, globalCtx); +void func_80B35450(EnGg* this, PlayState* play) { + if ((gSaveContext.save.weekEventReg[91] & 0x10) && (play->csCtx.state == 0)) { + func_80B359DC(this, play); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { - func_800B90F4(globalCtx); + func_800B90F4(play); } this->unk_308 = 1; this->actionFunc = func_80B352A4; } else if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 50.0f)) { if (gSaveContext.save.weekEventReg[19] & 0x80) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); this->actor.textId = 0xCEE; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); this->actor.textId = 0xCE5; } } } -void func_80B3556C(EnGg* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80B3556C(EnGg* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_2E6 == 4) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_308 = 0; this->actor.flags &= ~ACTOR_FLAG_80; func_80B35250(this); } else { this->actor.textId = func_80B357F0(this); - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_80B352A4; } } } -void func_80B35634(EnGg* this, GlobalContext* globalCtx) { +void func_80B35634(EnGg* this, PlayState* play) { s32 pad; s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 119)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 119); + if (Cutscene_CheckActorAction(play, 119)) { + actionIndex = Cutscene_GetActorActionIndex(play, 119); - if (this->unk_2DB != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->unk_2DB = globalCtx->csCtx.actorActions[actionIndex]->action; + if (this->unk_2DB != play->csCtx.actorActions[actionIndex]->action) { + this->unk_2DB = play->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_2DA = 0; this->unk_2E6 = 0; @@ -293,7 +293,7 @@ void func_80B35634(EnGg* this, GlobalContext* globalCtx) { this->unk_344.unk_30 = this->unk_2DA = 11; } while (0); this->unk_2E6 = 11; - func_80B364D4(&this->unk_344, globalCtx); + func_80B364D4(&this->unk_344, play); break; case 5: @@ -315,7 +315,7 @@ void func_80B35634(EnGg* this, GlobalContext* globalCtx) { this->unk_344.unk_30 = this->unk_2DA = 14; } while (0); this->unk_2E6 = 14; - func_80B364D4(&this->unk_344, globalCtx); + func_80B364D4(&this->unk_344, play); break; case 8: @@ -330,10 +330,10 @@ void func_80B35634(EnGg* this, GlobalContext* globalCtx) { } if (this->unk_2DA == 14) { - func_80B358D8(this, globalCtx); + func_80B358D8(this, play); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); this->actor.shape.yOffset = 0.0f; } else { this->unk_2DB = 99; @@ -364,7 +364,7 @@ void func_80B3584C(EnGg* this) { this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80B358D8(EnGg* this, GlobalContext* globalCtx) { +void func_80B358D8(EnGg* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2DA].animation); @@ -374,19 +374,19 @@ void func_80B358D8(EnGg* this, GlobalContext* globalCtx) { } } -void func_80B35968(EnGg* this, GlobalContext* globalCtx) { +void func_80B35968(EnGg* this, PlayState* play) { if (this->unk_344.unk_34 != NULL) { - this->unk_344.unk_34(&this->unk_344, globalCtx); + this->unk_344.unk_34(&this->unk_344, play); } else { if ((this->unk_2DA == 11) || (this->unk_2DA == 14)) { this->unk_344.unk_30 = this->unk_2DA; } - func_80B363E8(&this->unk_344, globalCtx, &this->unk_320, &this->unk_32C, &this->unk_338); + func_80B363E8(&this->unk_344, play, &this->unk_320, &this->unk_32C, &this->unk_338); } } -void func_80B359DC(EnGg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B359DC(EnGg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 200.0f) { if (this->unk_306 == 0) { @@ -398,8 +398,8 @@ void func_80B359DC(EnGg* this, GlobalContext* globalCtx) { this->unk_306 = 0; } - if ((player->transformation == PLAYER_FORM_HUMAN) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 7)) { + if ((player->transformation == PLAYER_FORM_HUMAN) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 7)) { if (!(gSaveContext.save.weekEventReg[19] & 0x80)) { gSaveContext.save.weekEventReg[19] |= 0x80; } @@ -423,7 +423,7 @@ void func_80B359DC(EnGg* this, GlobalContext* globalCtx) { } } -void func_80B35B24(EnGgStruct* ptr, GlobalContext* globalCtx) { +void func_80B35B24(EnGgStruct* ptr, PlayState* play) { ptr->unk_34 = NULL; ptr->unk_38 = NULL; ptr->unk_3C = 0; @@ -431,7 +431,7 @@ void func_80B35B24(EnGgStruct* ptr, GlobalContext* globalCtx) { ptr->unk_44 = 0; } -void func_80B35B44(EnGgStruct* ptr, GlobalContext* globalCtx) { +void func_80B35B44(EnGgStruct* ptr, PlayState* play) { if (ptr->unk_30 == 0xE) { ptr->unk_40++; if (ptr->unk_40 > 0x46) { @@ -475,13 +475,13 @@ void func_80B35B44(EnGgStruct* ptr, GlobalContext* globalCtx) { } else { ptr->unk_44++; if (ptr->unk_44 > 0x37) { - func_80B364D4(ptr, globalCtx); + func_80B364D4(ptr, play); } } } } -void func_80B35C84(EnGgStruct* ptr, GlobalContext* globalCtx) { +void func_80B35C84(EnGgStruct* ptr, PlayState* play) { s32 sp74; s32 phi_s7; f32 temp_f22; @@ -507,7 +507,7 @@ void func_80B35C84(EnGgStruct* ptr, GlobalContext* globalCtx) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -526,10 +526,10 @@ void func_80B35C84(EnGgStruct* ptr, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 150, 0, 255); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); } @@ -550,10 +550,10 @@ void func_80B35C84(EnGgStruct* ptr, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 150, 0, 255); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); } @@ -561,10 +561,10 @@ void func_80B35C84(EnGgStruct* ptr, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B3610C(EnGgStruct* ptr, GlobalContext* globalCtx) { +void func_80B3610C(EnGgStruct* ptr, PlayState* play) { f32 temp_f20; f32 temp_f24; f32 temp_f26; @@ -581,7 +581,7 @@ void func_80B3610C(EnGgStruct* ptr, GlobalContext* globalCtx) { } if (phi_s4 > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); @@ -603,11 +603,10 @@ void func_80B3610C(EnGgStruct* ptr, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 150, 0, 255); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); } @@ -615,11 +614,11 @@ void func_80B3610C(EnGgStruct* ptr, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80B363E8(EnGgStruct* ptr, GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { +void func_80B363E8(EnGgStruct* ptr, PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { ptr->unk_34 = func_80B35B44; ptr->unk_00 = *arg1; ptr->unk_0C = *arg1; @@ -637,13 +636,13 @@ void func_80B363E8(EnGgStruct* ptr, GlobalContext* globalCtx, Vec3f* arg1, Vec3f } } -void func_80B364D4(EnGgStruct* ptr, GlobalContext* globalCtx) { +void func_80B364D4(EnGgStruct* ptr, PlayState* play) { ptr->unk_34 = NULL; ptr->unk_38 = NULL; - func_80B35B24(ptr, globalCtx); + func_80B35B24(ptr, play); } -void EnGg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGg_Init(Actor* thisx, PlayState* play) { s32 pad; EnGg* this = THIS; @@ -654,11 +653,11 @@ void EnGg_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= 0x400; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, this->morphTable, 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); gSaveContext.save.weekEventReg[20] &= (u8)~4; @@ -673,17 +672,17 @@ void EnGg_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_304 = 0; this->unk_30A = 0; this->actor.flags |= ACTOR_FLAG_10; - func_80B35B24(&this->unk_344, globalCtx); + func_80B35B24(&this->unk_344, play); func_80B35250(this); } -void EnGg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGg_Destroy(Actor* thisx, PlayState* play) { } -void EnGg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGg_Update(Actor* thisx, PlayState* play) { EnGg* this = THIS; - if (globalCtx->actorCtx.unk4 == 100) { + if (play->actorCtx.unk4 == 100) { this->actor.flags |= ACTOR_FLAG_80; this->actor.flags |= ACTOR_FLAG_1; } else { @@ -692,21 +691,21 @@ void EnGg_Update(Actor* thisx, GlobalContext* globalCtx) { } if (gSaveContext.save.weekEventReg[19] & 0x80) { - if (globalCtx->csCtx.state == 0) { + if (play->csCtx.state == 0) { this->actor.flags |= ACTOR_FLAG_1; } else { this->actor.flags &= ~ACTOR_FLAG_1; } } - if ((globalCtx->csCtx.state == 0) && + if ((play->csCtx.state == 0) && ((this->unk_2DA != 14) && (this->unk_2DA != 11) && (this->unk_2DA != 12) && (this->unk_2DA != 13))) { - func_80B364D4(&this->unk_344, globalCtx); + func_80B364D4(&this->unk_344, play); } if (((this->unk_2DA == 14) || (this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) && (this->unk_309 == 1)) { - func_80B35968(this, globalCtx); + func_80B35968(this, play); } if (!(gSaveContext.save.weekEventReg[91] & 0x10) && @@ -715,26 +714,26 @@ void EnGg_Update(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[91] |= 0x10; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80B34F70(this); - func_80B35108(this, globalCtx); - func_80B34FB4(this, globalCtx); + func_80B35108(this, play); + func_80B34FB4(this, play); Actor_MoveWithoutGravity(&this->actor); SkelAnime_Update(&this->skelAnime); - if (globalCtx->csCtx.state == 0) { + if (play->csCtx.state == 0) { func_80B3584C(this); } else { this->unk_2E8 = 0; } - func_80B35634(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); + func_80B35634(this, play); + Actor_TrackPlayer(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); func_80B351A4(this); } -s32 EnGg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnGg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGg* this = THIS; @@ -744,7 +743,7 @@ s32 EnGg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnGg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B36DF0 = { 1800.0f, 300.0f, 200.0f }; EnGg* this = THIS; Vec3f sp30 = { 0.0f, 0.0f, 0.0f }; @@ -780,34 +779,34 @@ TexturePtr D_80B36DFC[] = { object_gg_Tex_009E60, }; -void EnGg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGg_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_344.unk_38 != 0) { - this->unk_344.unk_38(&this->unk_344, globalCtx); + this->unk_344.unk_38(&this->unk_344, play); } if (gSaveContext.save.weekEventReg[19] & 0x80) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B36DFC[this->unk_2E2])); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGg_OverrideLimbDraw, EnGg_PostLimbDraw, - &this->actor, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGg_OverrideLimbDraw, EnGg_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_308 == 1)) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B36DFC[this->unk_2E2])); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnGg_OverrideLimbDraw, EnGg_PostLimbDraw, - &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGg_OverrideLimbDraw, EnGg_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.h b/src/overlays/actors/ovl_En_Gg/z_en_gg.h index eeb83cbbd2..4a0d361c36 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.h +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.h @@ -6,8 +6,8 @@ struct EnGg; struct EnGgStruct; -typedef void (*EnGgActionFunc)(struct EnGg*, GlobalContext*); -typedef void (*EnGgUnkFunc)(struct EnGgStruct*, GlobalContext*); +typedef void (*EnGgActionFunc)(struct EnGg*, PlayState*); +typedef void (*EnGgUnkFunc)(struct EnGgStruct*, PlayState*); typedef struct EnGgStruct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 03f50e7aa3..51aea1b13b 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -11,19 +11,19 @@ #define THIS ((EnGg2*)thisx) -void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGg2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGg2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGg2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGg2_Init(Actor* thisx, PlayState* play); +void EnGg2_Destroy(Actor* thisx, PlayState* play); +void EnGg2_Update(Actor* thisx, PlayState* play); +void EnGg2_Draw(Actor* thisx, PlayState* play); -void func_80B3AE60(EnGg2* this, GlobalContext* globalCtx); -void func_80B3AFB0(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B05C(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B0A0(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B120(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B21C(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B294(EnGg2* this, GlobalContext* globalCtx); -void func_80B3B5D4(EnGg2* this, GlobalContext* globalCtx); +void func_80B3AE60(EnGg2* this, PlayState* play); +void func_80B3AFB0(EnGg2* this, PlayState* play); +void func_80B3B05C(EnGg2* this, PlayState* play); +void func_80B3B0A0(EnGg2* this, PlayState* play); +void func_80B3B120(EnGg2* this, PlayState* play); +void func_80B3B21C(EnGg2* this, PlayState* play); +void func_80B3B294(EnGg2* this, PlayState* play); +void func_80B3B5D4(EnGg2* this, PlayState* play); s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_); f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); @@ -74,8 +74,8 @@ void func_80B3AC50(EnGg2* this) { this->actor.focus.rot.z = this->actor.world.rot.z; } -s32 func_80B3AC94(EnGg2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B3AC94(EnGg2* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; s16 pitch; @@ -114,7 +114,7 @@ void func_80B3ADD8(EnGg2* this) { } } -void func_80B3AE60(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3AE60(EnGg2* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(D_80B3BF00[this->unk_2EE].animation); @@ -154,33 +154,33 @@ void func_80B3AE60(EnGg2* this, GlobalContext* globalCtx) { } } -void func_80B3AFB0(EnGg2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B3AFB0(EnGg2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2F0 = 1; this->actionFunc = func_80B3AE60; } else if ((this->actor.xzDistToPlayer < 100.0f) && (this->actor.xzDistToPlayer > 50.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); this->actor.textId = 0xCE4; } } -void func_80B3B05C(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B05C(EnGg2* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { this->actionFunc = func_80B3B5D4; } } -void func_80B3B0A0(EnGg2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void func_80B3B0A0(EnGg2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_2F0 = 0; this->actionFunc = func_80B3B5D4; } } -void func_80B3B120(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B120(EnGg2* this, PlayState* play) { Vec3s sp30; if (this->unk_1D8 != NULL) { @@ -201,7 +201,7 @@ void func_80B3B120(EnGg2* this, GlobalContext* globalCtx) { } } -void func_80B3B21C(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B21C(EnGg2* this, PlayState* play) { this->actor.speedXZ = 0.0f; if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { this->unk_2E4 = ActorCutscene_GetAdditionalCutscene(this->unk_2E4); @@ -209,19 +209,19 @@ void func_80B3B21C(EnGg2* this, GlobalContext* globalCtx) { } } -void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B294(EnGg2* this, PlayState* play) { Vec3s sp30; if (this->unk_2F1 == 0) { - if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneNum == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneNum == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -239,15 +239,15 @@ void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { this->unk_1DC++; } else { this->unk_2F1 = 1; - if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneNum == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneNum == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -259,7 +259,7 @@ void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); } -void func_80B3B4B0(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B4B0(EnGg2* this, PlayState* play) { Vec3f sp64; Color_RGBA8 sp60 = D_80B3C080; Color_RGBA8 sp5C = D_80B3C084; @@ -269,11 +269,11 @@ void func_80B3B4B0(EnGg2* this, GlobalContext* globalCtx) { sp64.x = (Rand_Centered() * 50.0f) + this->unk_304.x; sp64.y = this->unk_304.y; sp64.z = (Rand_Centered() * 50.0f) + this->unk_304.z; - EffectSsKirakira_SpawnDispersed(globalCtx, &sp64, &D_80B3C088, &D_80B3C094, &sp60, &sp5C, 3000, 40); + EffectSsKirakira_SpawnDispersed(play, &sp64, &D_80B3C088, &D_80B3C094, &sp60, &sp5C, 3000, 40); } } -void func_80B3B5D4(EnGg2* this, GlobalContext* globalCtx) { +void func_80B3B5D4(EnGg2* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_2E4)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_2E4, &this->actor); this->actionFunc = func_80B3AE60; @@ -351,8 +351,8 @@ void func_80B3B8A4(EnGg2* this) { this->unk_2F6 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; } -void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnGg2_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGg2* this = THIS; if (INV_CONTENT(ITEM_MASK_GORON) == ITEM_MASK_GORON) { @@ -367,9 +367,9 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= 0x400; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, this->morphTable, 20); - this->unk_1D8 = SubS_GetPathByIndex(globalCtx, ENGG2_GET_FC00(&this->actor), 0x3F); + this->unk_1D8 = SubS_GetPathByIndex(play, ENGG2_GET_FC00(&this->actor), 0x3F); this->actor.flags &= ~ACTOR_FLAG_80; this->unk_2F0 = 0; this->unk_2F1 = 0; @@ -380,14 +380,14 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2EC = 20; this->unk_2EA = 0; - if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneNum == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; this->unk_2EE = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3AFB0; - } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneNum == SCENE_17SETUGEN) { if ((gSaveContext.save.weekEventReg[20] & 4) && !(gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~4; @@ -397,7 +397,7 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { Actor_MarkForDeath(&this->actor); } - } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { if (!(gSaveContext.save.weekEventReg[20] & 4) && (gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~8; @@ -415,13 +415,13 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnGg2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGg2_Destroy(Actor* thisx, PlayState* play) { } -void EnGg2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGg2_Update(Actor* thisx, PlayState* play) { EnGg2* this = THIS; - if (globalCtx->actorCtx.unk4 == 100) { + if (play->actorCtx.unk4 == 100) { this->actor.flags |= ACTOR_FLAG_80; this->actor.flags |= ACTOR_FLAG_1; if ((this->unk_2EE == 5) && (this->unk_2EE == 7)) { @@ -432,27 +432,26 @@ void EnGg2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80B3AC50(this); - func_80B3AC94(this, globalCtx); + func_80B3AC94(this, play); Actor_MoveWithoutGravity(&this->actor); SkelAnime_Update(&this->skelAnime); func_80B3B8A4(this); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos); if ((this->unk_2EE == 5) || (this->unk_2EE == 7)) { func_800B9010(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG); - if ((globalCtx->actorCtx.unk4 == 100) && ((globalCtx->state.frames % 4) == 0)) { - func_80B3B4B0(this, globalCtx); + if ((play->actorCtx.unk4 == 100) && ((play->state.frames % 4) == 0)) { + func_80B3B4B0(this, play); } } func_80B3ADD8(this); } -s32 func_80B3BD44(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGg2* this = THIS; if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) { @@ -467,7 +466,7 @@ s32 func_80B3BD44(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80B3BDC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void func_80B3BDC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGg2* this = THIS; if (limbIndex == 4) { @@ -475,20 +474,20 @@ void func_80B3BDC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnGg2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGg2_Draw(Actor* thisx, PlayState* play) { EnGg2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_2F0 == 1)) { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3C0AC[this->unk_2EA])); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B3BD44, func_80B3BDC0, &this->actor, POLY_XLU_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80B3BD44, func_80B3BDC0, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h index 0fea448221..9cf825b784 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h @@ -5,7 +5,7 @@ struct EnGg2; -typedef void (*EnGg2ActionFunc)(struct EnGg2*, GlobalContext*); +typedef void (*EnGg2ActionFunc)(struct EnGg2*, PlayState*); #define ENGG2_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index 26dfcb756d..31b802531a 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -10,14 +10,14 @@ #define THIS ((EnGiant*)thisx) -void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGiant_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGiant_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGiant_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGiant_Init(Actor* thisx, PlayState* play); +void EnGiant_Destroy(Actor* thisx, PlayState* play); +void EnGiant_Update(Actor* thisx, PlayState* play); +void EnGiant_Draw(Actor* thisx, PlayState* play); -void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, GlobalContext* globalCtx); -void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, GlobalContext* globalCtx); -void EnGiant_PerformCutsceneActions(EnGiant* this, GlobalContext* globalCtx); +void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play); +void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, PlayState* play); +void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play); #define GIANT_TYPE_IS_NOT_TERMINA_FIELD(type) (type > GIANT_TYPE_OCEAN_TERMINA_FIELD) #define GIANT_TYPE_IS_TERMINA_FIELD(type) (type <= GIANT_TYPE_OCEAN_TERMINA_FIELD) @@ -143,7 +143,7 @@ s32 EnGiant_IsImprisoned(EnGiant* this) { return false; } -void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGiant_Init(Actor* thisx, PlayState* play) { EnGiant* this = THIS; s32 type = GIANT_TYPE(thisx); @@ -151,8 +151,8 @@ void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneScale = 2000.0f; this->actor.uncullZoneDownward = 2400.0f; Actor_SetScale(&this->actor, 0.32f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, - this->morphTable, GIANT_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable, + GIANT_LIMB_MAX); EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); this->csAction = GIANT_CS_ACTION_NONE; this->actionFunc = EnGiant_PerformCutsceneActions; @@ -237,7 +237,7 @@ void EnGiant_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGiant_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGiant_Destroy(Actor* thisx, PlayState* play) { } /** @@ -388,24 +388,23 @@ void EnGiant_PlaySound(EnGiant* this) { } } -void EnGiant_UpdatePosition(EnGiant* this, GlobalContext* globalCtx, u32 actionIndex) { - CsCmdActorAction* actorAction = globalCtx->csCtx.actorActions[actionIndex]; +void EnGiant_UpdatePosition(EnGiant* this, PlayState* play, u32 actionIndex) { + CsCmdActorAction* actorAction = play->csCtx.actorActions[actionIndex]; f32 startPosY = actorAction->startPos.y; s32 pad[2]; f32 endPosY = actorAction->endPos.y; - f32 scale = Environment_LerpWeight(actorAction->endFrame, actorAction->startFrame, globalCtx->csCtx.frames); + f32 scale = Environment_LerpWeight(actorAction->endFrame, actorAction->startFrame, play->csCtx.frames); this->actor.world.pos.y = ((endPosY - startPosY) * scale) + startPosY; } -void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCommand)) { - EnGiant_UpdatePosition(this, globalCtx, Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)); +void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { + EnGiant_UpdatePosition(this, play, Cutscene_GetActorActionIndex(play, this->actorActionCommand)); if (this->csAction != - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)]->action) { + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { this->csAction = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)] - ->action; + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; EnGiant_ChangeAnimationBasedOnCsAction(this); } EnGiant_UpdateAlpha(this); @@ -418,21 +417,19 @@ void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, GlobalContext* globa EnGiant_PlayAndUpdateAnimation(this); } -void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, GlobalContext* globalCtx) { +void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void EnGiant_PerformCutsceneActions(EnGiant* this, GlobalContext* globalCtx) { +void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play) { this->actor.draw = EnGiant_Draw; - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCommand)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)); + if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCommand)); if (this->csAction != - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)]->action) { + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { this->csAction = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand)] - ->action; + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; EnGiant_ChangeAnimationBasedOnCsAction(this); } EnGiant_UpdateAlpha(this); @@ -446,13 +443,13 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, GlobalContext* globalCtx) { EnGiant_PlayAndUpdateAnimation(this); } -void EnGiant_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGiant_Update(Actor* thisx, PlayState* play) { EnGiant* this = THIS; s32 blinkTimerTemp; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->blinkTimer == 0) { blinkTimerTemp = 0; @@ -470,18 +467,17 @@ void EnGiant_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGiant_PostLimbDrawOpa(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnGiant_PostLimbDrawOpa(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { if (limbIndex == GIANT_LIMB_HEAD) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gGiantBeardDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnGiant_PostLimbDrawXlu(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnGiant_PostLimbDrawXlu(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnGiant* this = THIS; if (limbIndex == GIANT_LIMB_HEAD) { @@ -489,40 +485,39 @@ void EnGiant_PostLimbDrawXlu(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis } } -void EnGiant_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGiant_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGiant* this = THIS; static TexturePtr sFaceTextures[] = { gGiantFaceEyeOpenTex, gGiantFaceEyeHalfTex, gGiantFaceEyeClosedTex }; if (this->alpha > 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha >= 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sFaceTextures[this->faceIndex])); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnGiant_PostLimbDrawOpa, thisx); } else if (this->alpha > 0) { if (this->alpha >= 129) { func_8012C2B4(POLY_XLU_DISP++); - Scene_SetRenderModeXlu(globalCtx, 2, 2); + Scene_SetRenderModeXlu(play, 2, 2); } else { func_8012C304(POLY_XLU_DISP++); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); } gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sFaceTextures[this->faceIndex])); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnGiant_PostLimbDrawXlu, thisx, POLY_XLU_DISP); Matrix_Mult(&this->headDrawMtxF, MTXMODE_NEW); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGiantBeardDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.h b/src/overlays/actors/ovl_En_Giant/z_en_giant.h index c8d45ad390..ff4a79485c 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.h +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.h @@ -40,7 +40,7 @@ typedef enum { struct EnGiant; -typedef void (*EnGiantActionFunc)(struct EnGiant*, GlobalContext*); +typedef void (*EnGiantActionFunc)(struct EnGiant*, PlayState*); typedef struct EnGiant { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index 32b063b860..b07671a184 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -11,10 +11,10 @@ #define THIS ((EnGinkoMan*)thisx) -void EnGinkoMan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGinkoMan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGinkoMan_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGinkoMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGinkoMan_Init(Actor* thisx, PlayState* play); +void EnGinkoMan_Destroy(Actor* thisx, PlayState* play); +void EnGinkoMan_Update(Actor* thisx, PlayState* play); +void EnGinkoMan_Draw(Actor* thisx, PlayState* play); void EnGinkoMan_SetupIdle(EnGinkoMan* this); void EnGinkoMan_SetupDialogue(EnGinkoMan* this); @@ -22,13 +22,13 @@ void EnGinkoMan_SetupBankAward(EnGinkoMan* this); void EnGinkoMan_SetupBankAward2(EnGinkoMan* this); void EnGinkoMan_SetupStamp(EnGinkoMan* this); -void EnGinkoMan_Idle(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_BankAward(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_BankAward2(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_Dialogue(EnGinkoMan* this, GlobalContext* globalCtx); -void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, GlobalContext* globalCtx); +void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_BankAward(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_Dialogue(EnGinkoMan* this, PlayState* play); +void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, PlayState* play); const ActorInit En_Ginko_Man_InitVars = { ACTOR_EN_GINKO_MAN, @@ -50,7 +50,7 @@ static AnimationInfo sAnimations[] = { { &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, }; -void EnGinkoMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGinkoMan_Init(Actor* thisx, PlayState* play) { EnGinkoMan* this = THIS; this->actor.targetMode = 1; @@ -62,12 +62,12 @@ void EnGinkoMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->isStampChecked = false; this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET; this->serviceFee = 0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_0043F0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_0043F0, this->jointTable, this->morphTable, 16); EnGinkoMan_SetupIdle(this); } -void EnGinkoMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGinkoMan_Destroy(Actor* thisx, PlayState* play) { } void EnGinkoMan_SetupIdle(EnGinkoMan* this) { @@ -76,34 +76,34 @@ void EnGinkoMan_SetupIdle(EnGinkoMan* this) { this->actionFunc = EnGinkoMan_Idle; } -void EnGinkoMan_Idle(EnGinkoMan* this, GlobalContext* globalCtx) { +void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play) { s32 yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - EnGinkoMan_SwitchAnimation(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + EnGinkoMan_SwitchAnimation(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - Message_StartTextbox(globalCtx, 0x44C, &this->actor); + Message_StartTextbox(play, 0x44C, &this->actor); this->curTextId = 0x44C; // would you like to make an account } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { - Message_StartTextbox(globalCtx, 0x467, &this->actor); + Message_StartTextbox(play, 0x467, &this->actor); this->curTextId = 0x467; // "What's this? You need somethin' on a day like this? } else { - Message_StartTextbox(globalCtx, 0x466, &this->actor); + Message_StartTextbox(play, 0x466, &this->actor); this->curTextId = 0x466; // What's this? You need somethin'? } } EnGinkoMan_SetupDialogue(this); } else if (ABS_ALT(yaw) < 0x1555) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } // action func: non-input dialogue -void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { - if (!Message_ShouldAdvance(globalCtx)) { +void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { + if (!Message_ShouldAdvance(play)) { return; } @@ -111,21 +111,21 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x44C: // "Hey there, little guy! Won't you deposit some Rupees? (first dialogue) Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); if (gSaveContext.save.weekEventReg[10] & 8) { - Message_StartTextbox(globalCtx, 0x44E, &this->actor); + Message_StartTextbox(play, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" } else { - Message_StartTextbox(globalCtx, 0x44D, &this->actor); + Message_StartTextbox(play, 0x44D, &this->actor); this->curTextId = 0x44D; // "For example, if you deposit 200 Rupees, you'll get an item that holds a lot of Rupees." } break; case 0x44D: // "For example, if you deposit 200 Rupees, you'll get an item that holds a lot of Rupees." - Message_StartTextbox(globalCtx, 0x44E, &this->actor); + Message_StartTextbox(play, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" break; case 0x44F: // "...So, what'll it be? Deposit Rupees Don't deposit Rupees" Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - Message_StartTextbox(globalCtx, 0x450, &this->actor); + Message_StartTextbox(play, 0x450, &this->actor); this->curTextId = 0x450; // "How much? How much? [rupee prompt] break; @@ -138,52 +138,52 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); } - Message_StartTextbox(globalCtx, 0x461, &this->actor); + Message_StartTextbox(play, 0x461, &this->actor); this->curTextId = 0x461; // So, little guy, what's your name? } else { if (this->curTextId == 0x453) { // "That's it? That ain't nothing at all, big spender! Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); } - globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; - Message_StartTextbox(globalCtx, 0x45A, &this->actor); + play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } break; case 0x456: // "Is that so? Think about it, little guy!" case 0x459: // "Heyyy! You don't have that much! - Message_StartTextbox(globalCtx, 0x44E, &this->actor); + Message_StartTextbox(play, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" break; case 0x45A: // "All right, little guy, now I've got a total of [rupees] from you!" if (((gSaveContext.save.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && !(gSaveContext.save.weekEventReg[59] & 0x40)) { gSaveContext.save.weekEventReg[59] |= 0x40; - Message_StartTextbox(globalCtx, 0x45B, &this->actor); + Message_StartTextbox(play, 0x45B, &this->actor); this->curTextId = 0x45B; // "What's this? You've already saved up 200 Rupees!?! } else if (((gSaveContext.save.bankRupees & 0xFFFF) >= 1000) && ((this->previousBankValue) < 1000) && !(gSaveContext.save.weekEventReg[59] & 0x80)) { gSaveContext.save.weekEventReg[59] |= 0x80; - Message_StartTextbox(globalCtx, 0x45C, &this->actor); + Message_StartTextbox(play, 0x45C, &this->actor); this->curTextId = 0x45C; // "What's this? You've already saved up 1000 Rupees!?! } else if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { if ((this->previousBankValue < 5000) && !(gSaveContext.save.weekEventReg[60] & 1)) { gSaveContext.save.weekEventReg[60] |= 1; - Message_StartTextbox(globalCtx, 0x45D, &this->actor); + Message_StartTextbox(play, 0x45D, &this->actor); this->curTextId = 0x45D; // "What's this? You've already saved up 5000 Rupees?! } else if (this->previousBankValue < (s16)(gSaveContext.save.bankRupees & 0xFFFF)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x45E, &this->actor); + Message_StartTextbox(play, 0x45E, &this->actor); this->curTextId = 0x45E; // "...Hang on there, little guy. I can't take any more deposits. Sorry..." } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - Message_StartTextbox(globalCtx, 0x460, &this->actor); + Message_StartTextbox(play, 0x460, &this->actor); this->curTextId = 0x460; // "Come back and deposit some after you save up a bunch!" } } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - Message_StartTextbox(globalCtx, 0x460, &this->actor); + Message_StartTextbox(play, 0x460, &this->actor); this->curTextId = 0x460; // "Come back and deposit some after you save up a bunch!" } break; @@ -191,35 +191,35 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x45C: // given 1000 reward case 0x45D: // given 5000 reward this->isStampChecked = false; - func_801477B4(globalCtx); + func_801477B4(play); EnGinkoMan_SetupBankAward(this); - EnGinkoMan_BankAward(this, globalCtx); + EnGinkoMan_BankAward(this, play); break; case 0x461: // So, little guy, what's your name? - Message_StartTextbox(globalCtx, 0x462, &this->actor); + Message_StartTextbox(play, 0x462, &this->actor); this->curTextId = 0x462; // Hmm... Link is it? break; case 0x462: // Hmm.. Link is it? - Message_StartTextbox(globalCtx, 0x463, &this->actor); + Message_StartTextbox(play, 0x463, &this->actor); this->curTextId = 0x463; // Got it... I won't forget your deposits. Let me stamp you break; case 0x463: // Got it... I won't forget your deposits. Let me stamp you - Message_StartTextbox(globalCtx, 0x464, &this->actor); + Message_StartTextbox(play, 0x464, &this->actor); this->curTextId = 0x464; // Hey, relax! It doesn't leave any marks break; case 0x464: // Hey, relax! It doesn't leave any marks - globalCtx->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = 0x44; EnGinkoMan_SetupStamp(this); // stamp player break; case 0x465: // "There! Now I'll know you when I see you!" Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; - Message_StartTextbox(globalCtx, 0x45A, &this->actor); + play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" break; case 0x466: // What's this? You need somethin'? case 0x467: // "What's this? You need somethin' on a day like this? You haven't evacuated yet? - Message_StartTextbox(globalCtx, 0x468, &this->actor); + Message_StartTextbox(play, 0x468, &this->actor); this->curTextId = 0x468; // " Deposit Rupees Withdraw Rupees Nothing really" break; case 0x469: // "Excuse me, but let me take a look at you..." @@ -230,39 +230,39 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x47E: // "Your deposits total [rupees]." if (this->choiceDepositWithdrawl == GINKOMAN_CHOICE_DEPOSIT) { if ((u32)(gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { - Message_StartTextbox(globalCtx, 0x45F, &this->actor); + Message_StartTextbox(play, 0x45F, &this->actor); this->curTextId = 0x45F; // "Excuuuse me! But I can't take anymore deposits! } else if (gSaveContext.save.playerData.rupees == 0) { - Message_StartTextbox(globalCtx, 0x458, &this->actor); + Message_StartTextbox(play, 0x458, &this->actor); this->curTextId = 0x458; // "Hmm...You play mean jokes, little guy! You haven't even got a single Rupee! } else { - Message_StartTextbox(globalCtx, 0x479, &this->actor); + Message_StartTextbox(play, 0x479, &this->actor); this->curTextId = 0x479; // "Well, are you gonna make a deposit?" } } else if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { - Message_StartTextbox(globalCtx, 0x46D, &this->actor); + Message_StartTextbox(play, 0x46D, &this->actor); // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just rumors!" this->curTextId = 0x46D; } else { // GINKOMAN_CHOICE_WITHDRAWL - Message_StartTextbox(globalCtx, 0x46B, &this->actor); + Message_StartTextbox(play, 0x46B, &this->actor); this->curTextId = 0x46B; // "So..." } this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET; break; case 0x46B: // So... - Message_StartTextbox(globalCtx, 0x46E, &this->actor); + Message_StartTextbox(play, 0x46E, &this->actor); this->curTextId = 0x46E; // "How much do you want? [rupee prompt] break; case 0x46D: // "Look, little guy, if it's 'cause of the bad rumors going around, forget it! They're just // rumors!" - Message_StartTextbox(globalCtx, 0x46B, &this->actor); + Message_StartTextbox(play, 0x46B, &this->actor); this->curTextId = 0x46B; // So... break; case 0x470: // "Is that so? Come back and deposit some after saving up a bunch!" - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if (Message_ShouldAdvance(play)) { + func_801477B4(play); this->isStampChecked = false; EnGinkoMan_SetupIdle(this); // change to waiting for approach } @@ -273,7 +273,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x475: // "What's this? Look, little guy, you can't hold this many rupees! You got that?" case 0x47C: // "Is that so? Think it over, little guy! So what are you gonna do?" case 0x47D: // duplicate of 48 - Message_StartTextbox(globalCtx, 0x468, &this->actor); + Message_StartTextbox(play, 0x468, &this->actor); this->curTextId = 0x468; // " Deposit Rupees Withdraw Rupees Nothing really" break; case 0x472: // "What's this? It's a waste to take out such a tiny bit! ...But if you say so!" @@ -281,75 +281,75 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, GlobalContext* globalCtx) { case 0x474: // "Aw, you're taking out all that? If you spend it like that, it'll all be gone before you know // it!" if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { - Message_StartTextbox(globalCtx, 0x478, &this->actor); + Message_StartTextbox(play, 0x478, &this->actor); // "Look, little guy, all the Rupees you deposited are gone, so you can't use that stamp anymore." this->curTextId = 0x478; } else { - globalCtx->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; - Message_StartTextbox(globalCtx, 0x45A, &this->actor); + play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } break; case 0x477: // "...You know, at this time of day there's a 4 Rupee service charge on withdrawals!" - Message_StartTextbox(globalCtx, 0x471, &this->actor); + Message_StartTextbox(play, 0x471, &this->actor); this->curTextId = 0x471; // "Are you really withdrawing [rupees selected]? Y/n" - this->serviceFee = globalCtx->msgCtx.unk1206C; + this->serviceFee = play->msgCtx.unk1206C; break; case 0x479: // Well, are you gonna make a deposit? - Message_StartTextbox(globalCtx, 0x44F, &this->actor); + Message_StartTextbox(play, 0x44F, &this->actor); this->curTextId = 0x44F; // "All right! So..." break; } } // actionfunc: wait for player dialogue input -void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) { - if (!Message_ShouldAdvance(globalCtx)) { +void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { + if (!Message_ShouldAdvance(play)) { return; } switch (this->curTextId) { case 0x44E: // "...So, what'll it be? - if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { + if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x45F, &this->actor); + Message_StartTextbox(play, 0x45F, &this->actor); this->curTextId = 0x45F; // bank full, cannot accept more } else { if (gSaveContext.save.playerData.rupees > 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x44F, &this->actor); + Message_StartTextbox(play, 0x44F, &this->actor); this->curTextId = 0x44F; // "All right! so..." } else { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x458, &this->actor); + Message_StartTextbox(play, 0x458, &this->actor); this->curTextId = 0x458; // you haven't even gotten a single rup } } } else { // GINKOMAN_CHOICE_NO func_8019F230(); - Message_StartTextbox(globalCtx, 0x451, &this->actor); + Message_StartTextbox(play, 0x451, &this->actor); this->curTextId = 0x451; // dont say that, come on, trust me! } break; case 0x452: // Really? are you really depositing rupees? - if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.bankRupeesSelected) { + if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.bankRupeesSelected) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x459, &this->actor); + Message_StartTextbox(play, 0x459, &this->actor); this->curTextId = 0x459; // HEY you dont have that much } else { func_8019F208(); - if (globalCtx->msgCtx.bankRupeesSelected >= 100) { - Message_StartTextbox(globalCtx, 0x455, &this->actor); + if (play->msgCtx.bankRupeesSelected >= 100) { + Message_StartTextbox(play, 0x455, &this->actor); this->curTextId = 0x455; // You're really going to be give me that much? Rich little guy! - } else if (globalCtx->msgCtx.bankRupeesSelected >= 10) { - Message_StartTextbox(globalCtx, 0x454, &this->actor); + } else if (play->msgCtx.bankRupeesSelected >= 10) { + Message_StartTextbox(play, 0x454, &this->actor); this->curTextId = 0x454; // Seriously? that's a lot. A lot! } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x453, &this->actor); + Message_StartTextbox(play, 0x453, &this->actor); this->curTextId = 0x453; // That's it? That aint nothing at all } @@ -357,107 +357,107 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, GlobalContext* globalCtx) this->isNewAccount = true; } - func_801159EC((s16)-globalCtx->msgCtx.bankRupeesSelected); + func_801159EC((s16)-play->msgCtx.bankRupeesSelected); this->previousBankValue = gSaveContext.save.bankRupees & 0xFFFF; gSaveContext.save.bankRupees = - ((gSaveContext.save.bankRupees & 0xFFFF) + globalCtx->msgCtx.bankRupeesSelected) | + ((gSaveContext.save.bankRupees & 0xFFFF) + play->msgCtx.bankRupeesSelected) | (gSaveContext.save.bankRupees & 0xFFFF0000); } } else { // GINKOMAN_CHOICE_NO func_8019F230(); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { - Message_StartTextbox(globalCtx, 0x456, &this->actor); + Message_StartTextbox(play, 0x456, &this->actor); this->curTextId = 0x456; // Is that so? think about it } else { - Message_StartTextbox(globalCtx, 0x47D, &this->actor); + Message_StartTextbox(play, 0x47D, &this->actor); this->curTextId = 0x47D; // is that so? think it over } } break; case 0x468: // Deposit OR withdrawl OR cancel screen - if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_CANCEL) { + if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_CANCEL) { func_8019F230(); - Message_StartTextbox(globalCtx, 0x470, &this->actor); + Message_StartTextbox(play, 0x470, &this->actor); this->curTextId = 0x470; // "Is that so? Come back and deposit some after saving up a bunch!" } else { func_8019F208(); - this->choiceDepositWithdrawl = globalCtx->msgCtx.choiceIndex; + this->choiceDepositWithdrawl = play->msgCtx.choiceIndex; if (!this->isStampChecked) { this->isStampChecked = true; - Message_StartTextbox(globalCtx, 0x469, &this->actor); + Message_StartTextbox(play, 0x469, &this->actor); this->curTextId = 0x469; // "Excuse me, but let me take a look at you..." } else { - Message_StartTextbox(globalCtx, 0x47E, &this->actor); + Message_StartTextbox(play, 0x47E, &this->actor); this->curTextId = 0x47E; // "Your deposits total [rupees]." } } break; case 0x471: // Are you really withdrawling [selected rupees]? - if (globalCtx->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { + if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { if ((s32)((gSaveContext.save.bankRupees & 0xFFFF)) < - ((s32)(globalCtx->msgCtx.bankRupeesSelected + this->serviceFee))) { + ((s32)(play->msgCtx.bankRupeesSelected + this->serviceFee))) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); - Message_StartTextbox(globalCtx, 0x476, &this->actor); + Message_StartTextbox(play, 0x476, &this->actor); this->curTextId = 0x476; // you dont have enough deposited to withdrawl } else if (CUR_CAPACITY(UPG_WALLET) < - (globalCtx->msgCtx.bankRupeesSelected + gSaveContext.save.playerData.rupees)) { + (play->msgCtx.bankRupeesSelected + gSaveContext.save.playerData.rupees)) { // check if wallet is big enough play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x475, &this->actor); + Message_StartTextbox(play, 0x475, &this->actor); this->curTextId = 0x475; // You can't hold that many in your wallet } else { func_8019F208(); - if (globalCtx->msgCtx.bankRupeesSelected >= 100) { - Message_StartTextbox(globalCtx, 0x474, &this->actor); + if (play->msgCtx.bankRupeesSelected >= 100) { + Message_StartTextbox(play, 0x474, &this->actor); this->curTextId = 0x474; // Aw, you're taking out all that? - } else if (globalCtx->msgCtx.bankRupeesSelected >= 10) { - Message_StartTextbox(globalCtx, 0x473, &this->actor); + } else if (play->msgCtx.bankRupeesSelected >= 10) { + Message_StartTextbox(play, 0x473, &this->actor); this->curTextId = 0x473; // use it wisely } else { - Message_StartTextbox(globalCtx, 0x472, &this->actor); + Message_StartTextbox(play, 0x472, &this->actor); this->curTextId = 0x472; // It's a waste to take out such a tiny bit } this->previousBankValue = (s16)(gSaveContext.save.bankRupees & 0xFFFF); gSaveContext.save.bankRupees = - (((gSaveContext.save.bankRupees & 0xFFFF) - globalCtx->msgCtx.bankRupeesSelected) - + (((gSaveContext.save.bankRupees & 0xFFFF) - play->msgCtx.bankRupeesSelected) - this->serviceFee) | (gSaveContext.save.bankRupees & 0xFFFF0000); - func_801159EC(globalCtx->msgCtx.bankRupeesSelected); + func_801159EC(play->msgCtx.bankRupeesSelected); } } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x47C, &this->actor); + Message_StartTextbox(play, 0x47C, &this->actor); this->curTextId = 0x47C; // "Is that so? Think it over, little guy! So what are you gonna do?" } break; } } -void EnGinkoMan_WaitForRupeeCount(EnGinkoMan* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnGinkoMan_WaitForRupeeCount(EnGinkoMan* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->curTextId) { case 0x450: // "How much? How much?" [rupee prompt] Set the amount with [Control Stick] and - if (globalCtx->msgCtx.bankRupeesSelected == 0) { + if (play->msgCtx.bankRupeesSelected == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x457, &this->actor); + Message_StartTextbox(play, 0x457, &this->actor); this->curTextId = 0x457; // Zero Rupees? Cruel joke! } else { - Message_StartTextbox(globalCtx, 0x452, &this->actor); + Message_StartTextbox(play, 0x452, &this->actor); this->curTextId = 0x452; // Really? are you really depositing [x]? Y/n } break; case 0x46E: // "How much do you want?" [rupee prompt] Set the amount with [Control Stick] - if (globalCtx->msgCtx.bankRupeesSelected == 0) { - Message_StartTextbox(globalCtx, 0x46F, &this->actor); + if (play->msgCtx.bankRupeesSelected == 0) { + Message_StartTextbox(play, 0x46F, &this->actor); this->curTextId = 0x46F; // "Zero Rupees?!? That's a cruel joke!" } else if (gSaveContext.save.isNight == true) { - Message_StartTextbox(globalCtx, 0x477, &this->actor); + Message_StartTextbox(play, 0x477, &this->actor); this->curTextId = 0x477; // "...You know, at this time of day there's a 4 Rupee service charge... } else { - Message_StartTextbox(globalCtx, 0x471, &this->actor); + Message_StartTextbox(play, 0x471, &this->actor); this->curTextId = 0x471; // "Are you really withdrawing [rupees selected]? Y/n this->serviceFee = 0; } @@ -470,25 +470,25 @@ void EnGinkoMan_SetupDialogue(EnGinkoMan* this) { this->actionFunc = EnGinkoMan_Dialogue; } -void EnGinkoMan_Dialogue(EnGinkoMan* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnGinkoMan_Dialogue(EnGinkoMan* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 2: EnGinkoMan_SetupIdle(this); break; case 4: - EnGinkoMan_WaitForDialogueInput(this, globalCtx); + EnGinkoMan_WaitForDialogueInput(this, play); break; case 5: - EnGinkoMan_DepositDialogue(this, globalCtx); + EnGinkoMan_DepositDialogue(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->isStampChecked = false; EnGinkoMan_SetupIdle(this); } break; case 14: - EnGinkoMan_WaitForRupeeCount(this, globalCtx); + EnGinkoMan_WaitForRupeeCount(this, play); break; case 0: default: @@ -505,23 +505,23 @@ void EnGinkoMan_SetupBankAward(EnGinkoMan* this) { this->actionFunc = EnGinkoMan_BankAward; } -void EnGinkoMan_BankAward(EnGinkoMan* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnGinkoMan_BankAward(EnGinkoMan* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { // Parent is the player when starting to receive the award this->actor.parent = NULL; EnGinkoMan_SetupBankAward2(this); } else if (this->curTextId == 0x45B) { // "Whats this, you already saved up 200?" if (!(gSaveContext.save.weekEventReg[10] & 8)) { - Actor_PickUp(&this->actor, globalCtx, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } } else if (this->curTextId == 0x45C) { // "Whats this, you already saved up 5000?" - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } else if (!(gSaveContext.save.weekEventReg[59] & 8)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } } @@ -531,30 +531,30 @@ void EnGinkoMan_SetupBankAward2(EnGinkoMan* this) { } // separate function to handle bank rewards... called while the player is receiving the award -void EnGinkoMan_BankAward2(EnGinkoMan* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (!(gSaveContext.save.weekEventReg[10] & 8) && (this->curTextId == 0x45B)) { // "What's this? You've already saved up 200 Rupees!?! Well, little guy, here's your special gift. Take // it!" gSaveContext.save.weekEventReg[10] |= 8; - Message_StartTextbox(globalCtx, 0x47A, &this->actor); + Message_StartTextbox(play, 0x47A, &this->actor); this->curTextId = 0x47A; // Message after receiving reward for depositing 200 rupees. } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x47B, &this->actor); + Message_StartTextbox(play, 0x47B, &this->actor); this->curTextId = 0x47B; // Message after receiving reward for depositing 1000 rupees. } EnGinkoMan_SetupDialogue(this); } else if (this->curTextId == 0x45D) { // saved up 5000 rupees for HP - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { if (!(gSaveContext.save.weekEventReg[59] & 8)) { gSaveContext.save.weekEventReg[59] |= 8; } EnGinkoMan_SetupIdle(this); } } else { - func_800B85E0(&this->actor, globalCtx, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } @@ -563,7 +563,7 @@ void EnGinkoMan_SetupStamp(EnGinkoMan* this) { this->actionFunc = EnGinkoMan_Stamp; } -void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) { +void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play) { if ((this->curTextId == 0x464) // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt." && (Animation_OnFrame(&this->skelAnime, 10.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); // "stamp" @@ -573,17 +573,17 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) { switch (this->curTextId) { case 0x464: // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt." Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - Message_StartTextbox(globalCtx, 0x465, &this->actor); + Message_StartTextbox(play, 0x465, &this->actor); this->curTextId = 0x465; // "There! Now I'll know you when I see you!" break; case 0x469: // "Excuse me, but let me take a look at you..." Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); - globalCtx->msgCtx.bankRupees = (gSaveContext.save.bankRupees & 0xFFFF); + play->msgCtx.bankRupees = (gSaveContext.save.bankRupees & 0xFFFF); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { - Message_StartTextbox(globalCtx, 0x46C, &this->actor); + Message_StartTextbox(play, 0x46C, &this->actor); this->curTextId = 0x46C; // "Ah, yes...[Link], right? } else { - Message_StartTextbox(globalCtx, 0x46A, &this->actor); + Message_StartTextbox(play, 0x46A, &this->actor); this->curTextId = 0x46A; // "Ah, yes...[Link]. } break; @@ -593,7 +593,7 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, GlobalContext* globalCtx) { } } -void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, GlobalContext* globalCtx) { +void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, PlayState* play) { if (this->actor.xzDistToPlayer > 160.0f) { if (this->animTimer == 0) { if (this->skelAnime.animation != &object_boj_Anim_004A7C) { @@ -609,26 +609,25 @@ void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, GlobalContext* globalCtx) { DECR(this->animTimer); } -void EnGinkoMan_FacePlayer(EnGinkoMan* this, GlobalContext* globalCtx) { +void EnGinkoMan_FacePlayer(EnGinkoMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->skelAnime.animation != &object_boj_Anim_004A7C) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->limb15Rot, &this->limb8Rot, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->limb15Rot, &this->limb8Rot, this->actor.focus.pos); } else { Actor_TrackNone(&this->limb15Rot, &this->limb8Rot); } } -void EnGinkoMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGinkoMan_Update(Actor* thisx, PlayState* play) { EnGinkoMan* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; - EnGinkoMan_FacePlayer(this, globalCtx); + EnGinkoMan_FacePlayer(this, play); } -s32 EnGinkoMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnGinkoMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGinkoMan* this = THIS; if (limbIndex == 15) { @@ -648,22 +647,22 @@ s32 EnGinkoMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnGinkoMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnGinkoMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnGinkoMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGinkoMan_Draw(Actor* thisx, PlayState* play) { EnGinkoMan* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 50, 80, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 50, 80, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 50, 80, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 50, 80, 0, 0)); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGinkoMan_OverrideLimbDraw, EnGinkoMan_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h index e605be1d6f..3ed6bc89be 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h @@ -5,7 +5,7 @@ struct EnGinkoMan; - typedef void (*EnGinkoManActionFunc)(struct EnGinkoMan*, GlobalContext*); + typedef void (*EnGinkoManActionFunc)(struct EnGinkoMan*, PlayState*); typedef struct EnGinkoMan { /* 0x000 */ 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 846989c0cd..9d159b4163 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -10,46 +10,46 @@ #define THIS ((EnGirlA*)thisx) -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGirlA_Draw(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_Draw(Actor* thisx, PlayState* play); -void EnGirlA_InitalUpdate(EnGirlA* this, GlobalContext* globalCtx); -void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx); +void EnGirlA_InitalUpdate(EnGirlA* this, PlayState* play); +void EnGirlA_Update2(EnGirlA* this, PlayState* play); -s32 EnGirlA_CanBuyPotionRed(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyPotionGreen(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyPotionBlue(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyArrows(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyNuts(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyShieldHero(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyStick(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyMaskAllNight(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBombBagCuriosityShop(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBombBag20BombShop(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBombBag30BombShop(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBombs(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyBottleStolen(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuySword(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this); -s32 EnGirlA_CanBuyFairy(GlobalContext* globalCtx, EnGirlA* this); +s32 EnGirlA_CanBuyPotionRed(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyArrows(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyMaskAllNight(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBombBagCuriosityShop(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBombBag20BombShop(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBombBag30BombShop(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBombchus(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBombs(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyBottleStolen(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuySword(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyShieldMirror(PlayState* play, EnGirlA* this); +s32 EnGirlA_CanBuyFairy(PlayState* play, EnGirlA* this); -void EnGirlA_BuyBottleItem(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyArrows(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyNuts(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyShieldHero(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyStick(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyMaskAllNight(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyBombBag(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyBombchus(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyBombs(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyBottle(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuySword(GlobalContext* globalCtx, EnGirlA* this); -void EnGirlA_BuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this); +void EnGirlA_BuyBottleItem(PlayState* play, EnGirlA* this); +void EnGirlA_BuyArrows(PlayState* play, EnGirlA* this); +void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this); +void EnGirlA_BuyShieldHero(PlayState* play, EnGirlA* this); +void EnGirlA_BuyStick(PlayState* play, EnGirlA* this); +void EnGirlA_BuyMaskAllNight(PlayState* play, EnGirlA* this); +void EnGirlA_BuyBombBag(PlayState* play, EnGirlA* this); +void EnGirlA_BuyBombchus(PlayState* play, EnGirlA* this); +void EnGirlA_BuyBombs(PlayState* play, EnGirlA* this); +void EnGirlA_BuyBottle(PlayState* play, EnGirlA* this); +void EnGirlA_BuySword(PlayState* play, EnGirlA* this); +void EnGirlA_BuyShieldMirror(PlayState* play, EnGirlA* this); -void EnGirlA_BuyFanfare(GlobalContext* globalCtx, EnGirlA* this); +void EnGirlA_BuyFanfare(PlayState* play, EnGirlA* this); const ActorInit En_GirlA_InitVars = { ACTOR_EN_GIRLA, @@ -156,7 +156,7 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc action) { this->actionFunc = action; } -void EnGirlA_InitObjIndex(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitObjIndex(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; //! @bug: Condition is impossible, && should be an || @@ -165,7 +165,7 @@ void EnGirlA_InitObjIndex(EnGirlA* this, GlobalContext* globalCtx) { return; } - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, sShopItemEntries[params].objectId); + this->objIndex = Object_GetIndex(&play->objectCtx, sShopItemEntries[params].objectId); if (this->objIndex < 0) { Actor_MarkForDeath(&this->actor); return; @@ -175,36 +175,36 @@ void EnGirlA_InitObjIndex(EnGirlA* this, GlobalContext* globalCtx) { this->mainActionFunc = EnGirlA_InitalUpdate; } -void EnGirlA_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Init(Actor* thisx, PlayState* play) { EnGirlA* this = THIS; - EnGirlA_InitObjIndex(this, globalCtx); + EnGirlA_InitObjIndex(this, play); } -void EnGirlA_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Destroy(Actor* thisx, PlayState* play) { } -s32 EnGirlA_CanBuyPotionRed(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyPotionRed(PlayState* play, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyPotionGreen(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyPotionBlue(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this) { if (!(gSaveContext.save.weekEventReg[53] & 8)) { return CANBUY_RESULT_CANNOT_GET_NOW; } @@ -214,30 +214,30 @@ s32 EnGirlA_CanBuyPotionBlue(GlobalContext* globalCtx, EnGirlA* this) { if (!(gSaveContext.save.weekEventReg[53] & 0x10)) { return CANBUY_RESULT_SUCCESS_2; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyArrows(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyArrows(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_QUIVER) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW_2; } if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { return CANBUY_RESULT_NO_ROOM_2; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyNuts(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this) { if (CUR_CAPACITY(UPG_NUTS) != 0 && CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_NUT) == ITEM_NONE) { @@ -246,21 +246,21 @@ s32 EnGirlA_CanBuyNuts(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyShieldHero(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this) { if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuyStick(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { if (CUR_CAPACITY(UPG_STICKS) != 0 && AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_STICK) == ITEM_NONE) { @@ -269,57 +269,57 @@ s32 EnGirlA_CanBuyStick(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyMaskAllNight(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { +s32 EnGirlA_CanBuyMaskAllNight(PlayState* play, EnGirlA* this) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyBombBagCuriosityShop(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyBombBagCuriosityShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_CANNOT_GET_NOW; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyBombBag20BombShop(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyBombBag20BombShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 1) { return CANBUY_RESULT_ALREADY_HAVE; } if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuyBombBag30BombShop(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyBombBag30BombShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 2) { return CANBUY_RESULT_ALREADY_HAVE; } if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 3) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyBombchus(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (AMMO(ITEM_BOMBCHU) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (func_80114978(ITEM_BOMBCHU) == ITEM_NONE) { @@ -328,54 +328,54 @@ s32 EnGirlA_CanBuyBombchus(GlobalContext* globalCtx, EnGirlA* this) { return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyBombs(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyBombs(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return CANBUY_RESULT_CANNOT_GET_NOW; } if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -s32 EnGirlA_CanBuyBottleStolen(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { +s32 EnGirlA_CanBuyBottleStolen(PlayState* play, EnGirlA* this) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuySword(GlobalContext* globalCtx, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { +s32 EnGirlA_CanBuySword(PlayState* play, EnGirlA* this) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyShieldMirror(PlayState* play, EnGirlA* this) { if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } -s32 EnGirlA_CanBuyFairy(GlobalContext* globalCtx, EnGirlA* this) { +s32 EnGirlA_CanBuyFairy(PlayState* play, EnGirlA* this) { if (!Interface_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } -void EnGirlA_BuyBottleItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyBottleItem(PlayState* play, EnGirlA* this) { switch (this->actor.params) { case SI_POTION_RED_1: case SI_POTION_RED_2: @@ -383,134 +383,134 @@ void EnGirlA_BuyBottleItem(GlobalContext* globalCtx, EnGirlA* this) { case SI_POTION_RED_4: case SI_POTION_RED_5: case SI_POTION_RED_6: - Item_Give(globalCtx, ITEM_POTION_RED); + Item_Give(play, ITEM_POTION_RED); break; case SI_POTION_GREEN_1: case SI_POTION_GREEN_2: case SI_POTION_GREEN_3: - Item_Give(globalCtx, ITEM_POTION_GREEN); + Item_Give(play, ITEM_POTION_GREEN); break; case SI_POTION_BLUE: - Item_Give(globalCtx, ITEM_POTION_BLUE); + Item_Give(play, ITEM_POTION_BLUE); break; case SI_FAIRY_1: case SI_FAIRY_2: - Item_Give(globalCtx, ITEM_FAIRY); + Item_Give(play, ITEM_FAIRY); break; } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyArrows(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyArrows(PlayState* play, EnGirlA* this) { func_80115A14(ITEM_BOW, this->itemParams); - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyNuts(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this) { switch (this->itemParams) { 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; } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyShieldHero(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_HERO); - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyShieldHero(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_HERO); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyStick(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_STICK); - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyStick(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_STICK); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyMaskAllNight(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_MASK_ALL_NIGHT); - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyMaskAllNight(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_MASK_ALL_NIGHT); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyBombBag(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyBombBag(PlayState* play, EnGirlA* this) { //! @bug: Bomb Bag parameters in sShopItemEntries are 1 2 3, not 20 21 22 switch (this->itemParams) { case 20: - Item_Give(globalCtx, ITEM_BOMB_BAG_20); + Item_Give(play, ITEM_BOMB_BAG_20); break; case 21: - Item_Give(globalCtx, ITEM_BOMB_BAG_30); + Item_Give(play, ITEM_BOMB_BAG_30); break; case 22: - Item_Give(globalCtx, ITEM_BOMB_BAG_40); + Item_Give(play, ITEM_BOMB_BAG_40); break; } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyBombchus(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyBombchus(PlayState* play, EnGirlA* this) { if (this->itemParams == 10) { - Item_Give(globalCtx, ITEM_BOMBCHUS_10); + Item_Give(play, ITEM_BOMBCHUS_10); } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyBombs(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuyBombs(PlayState* play, EnGirlA* this) { switch (this->itemParams) { 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; } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyBottle(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_BOTTLE); - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyBottle(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_BOTTLE); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuySword(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_BuySword(PlayState* play, EnGirlA* this) { switch (this->itemParams) { case 1: - Item_Give(globalCtx, ITEM_SWORD_KOKIRI); + Item_Give(play, ITEM_SWORD_KOKIRI); break; case 2: - Item_Give(globalCtx, ITEM_SWORD_RAZOR); + Item_Give(play, ITEM_SWORD_RAZOR); break; case 3: - Item_Give(globalCtx, ITEM_SWORD_GILDED); + Item_Give(play, ITEM_SWORD_GILDED); break; case 4: - Item_Give(globalCtx, ITEM_SWORD_GREAT_FAIRY); + Item_Give(play, ITEM_SWORD_GREAT_FAIRY); break; } - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_BuyShieldMirror(GlobalContext* globalCtx, EnGirlA* this) { - Item_Give(globalCtx, ITEM_SHIELD_MIRROR); - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyShieldMirror(PlayState* play, EnGirlA* this) { + Item_Give(play, ITEM_SHIELD_MIRROR); + func_801159EC(-play->msgCtx.unk1206C); } // Fanfare is handled by ovl_en_ossan -void EnGirlA_BuyFanfare(GlobalContext* globalCtx, EnGirlA* this) { - func_801159EC(-globalCtx->msgCtx.unk1206C); +void EnGirlA_BuyFanfare(PlayState* play, EnGirlA* this) { + func_801159EC(-play->msgCtx.unk1206C); } -void EnGirlA_DoNothing(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_DoNothing(EnGirlA* this, PlayState* play) { } -void EnGirlA_InitItem(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_InitItem(PlayState* play, EnGirlA* this) { ShopItemEntry* shopItem = &sShopItemEntries[this->actor.params]; this->actor.textId = shopItem->descriptionTextId; @@ -518,34 +518,34 @@ void EnGirlA_InitItem(GlobalContext* globalCtx, EnGirlA* this) { this->actor.draw = EnGirlA_Draw; } -void EnGirlA_Bought(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_Bought(PlayState* play, EnGirlA* this) { this->isOutOfStock = true; this->actor.draw = NULL; } -void EnGirlA_Restock(GlobalContext* globalCtx, EnGirlA* this) { +void EnGirlA_Restock(PlayState* play, EnGirlA* this) { this->isOutOfStock = false; this->actor.draw = EnGirlA_Draw; } // Left over from OOT -s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, GlobalContext* globalCtx) { +s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) { return false; } -void EnGirlA_InitalUpdate(EnGirlA* this, GlobalContext* globalCtx) { +void EnGirlA_InitalUpdate(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; ShopItemEntry* shopItem = &sShopItemEntries[params]; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.objBankIndex = this->objIndex; this->actor.textId = shopItem->descriptionTextId; this->choiceTextId = shopItem->choiceTextId; // EnGirlA_TrySetMaskItemDescription always returns false - if (!EnGirlA_TrySetMaskItemDescription(this, globalCtx)) { - EnGirlA_InitItem(globalCtx, this); + if (!EnGirlA_TrySetMaskItemDescription(this, play)) { + EnGirlA_InitItem(play, this); } this->boughtFunc = EnGirlA_Bought; @@ -573,12 +573,12 @@ void EnGirlA_InitalUpdate(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; if (this->isSelected) { @@ -588,18 +588,18 @@ void EnGirlA_Update2(EnGirlA* this, GlobalContext* globalCtx) { } } -void EnGirlA_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Update(Actor* thisx, PlayState* play) { EnGirlA* this = THIS; - this->mainActionFunc(this, globalCtx); + this->mainActionFunc(this, play); } -void EnGirlA_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGirlA_Draw(Actor* thisx, PlayState* play) { EnGirlA* this = THIS; Matrix_RotateYS(this->rotY, MTXMODE_APPLY); if (this->drawFunc != NULL) { - this->drawFunc(&this->actor, globalCtx, 0); + this->drawFunc(&this->actor, play, 0); } - GetItem_Draw(globalCtx, this->getItemDrawId); + GetItem_Draw(play, this->getItemDrawId); } 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 a3d8e02061..90cc26ffdb 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -5,10 +5,10 @@ struct EnGirlA; -typedef void (*EnGirlAActionFunc)(struct EnGirlA*, GlobalContext*); -typedef void (*EnGirlADrawFunc)(struct Actor*, GlobalContext*, s32); -typedef s32 (*EnGirlACanBuyFunc)(GlobalContext*, struct EnGirlA*); -typedef void (*EnGirlAShopActionFunc)(GlobalContext*, struct EnGirlA*); // Buying/Restocking +typedef void (*EnGirlAActionFunc)(struct EnGirlA*, PlayState*); +typedef void (*EnGirlADrawFunc)(struct Actor*, PlayState*, s32); +typedef s32 (*EnGirlACanBuyFunc)(PlayState*, struct EnGirlA*); +typedef void (*EnGirlAShopActionFunc)(PlayState*, struct EnGirlA*); // Buying/Restocking typedef struct ShopItemEntry { /* 0x00 */ s16 objectId; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index ec367af9bf..8f52748601 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -11,27 +11,27 @@ #define THIS ((EnGk*)thisx) -void EnGk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGk_Init(Actor* thisx, PlayState* play); +void EnGk_Destroy(Actor* thisx, PlayState* play); +void EnGk_Update(Actor* thisx, PlayState* play); +void EnGk_Draw(Actor* thisx, PlayState* play); -void func_80B51698(EnGk* this, GlobalContext* globalCtx); -void func_80B51760(EnGk* this, GlobalContext* globalCtx); -void func_80B51970(EnGk* this, GlobalContext* globalCtx); -void func_80B51B40(EnGk* this, GlobalContext* globalCtx); -void func_80B51D9C(EnGk* this, GlobalContext* globalCtx); -void func_80B51EA4(EnGk* this, GlobalContext* globalCtx); -void func_80B51FD0(EnGk* this, GlobalContext* globalCtx); -void func_80B5202C(EnGk* this, GlobalContext* globalCtx); -void func_80B5216C(EnGk* this, GlobalContext* globalCtx); -void func_80B521E8(EnGk* this, GlobalContext* globalCtx); -void func_80B5227C(EnGk* this, GlobalContext* globalCtx); -void func_80B52340(EnGk* this, GlobalContext* globalCtx); -void func_80B52430(EnGk* this, GlobalContext* globalCtx); -void func_80B5253C(EnGk* this, GlobalContext* globalCtx); -void func_80B525E0(EnGk* this, GlobalContext* globalCtx); -void func_80B52654(EnGk* this, GlobalContext* globalCtx); +void func_80B51698(EnGk* this, PlayState* play); +void func_80B51760(EnGk* this, PlayState* play); +void func_80B51970(EnGk* this, PlayState* play); +void func_80B51B40(EnGk* this, PlayState* play); +void func_80B51D9C(EnGk* this, PlayState* play); +void func_80B51EA4(EnGk* this, PlayState* play); +void func_80B51FD0(EnGk* this, PlayState* play); +void func_80B5202C(EnGk* this, PlayState* play); +void func_80B5216C(EnGk* this, PlayState* play); +void func_80B521E8(EnGk* this, PlayState* play); +void func_80B5227C(EnGk* this, PlayState* play); +void func_80B52340(EnGk* this, PlayState* play); +void func_80B52430(EnGk* this, PlayState* play); +void func_80B5253C(EnGk* this, PlayState* play); +void func_80B525E0(EnGk* this, PlayState* play); +void func_80B52654(EnGk* this, PlayState* play); const ActorInit En_Gk_InitVars = { ACTOR_EN_GK, @@ -115,10 +115,10 @@ static AnimationInfo sAnimations[] = { Color_RGBA8 D_80B533A0 = { 255, 255, 255, 255 }; Color_RGBA8 D_80B533A4 = { 50, 150, 150, 0 }; -u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u16 func_80B50410(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->sceneNum == SCENE_17SETUGEN2) { + if (play->sceneNum == SCENE_17SETUGEN2) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[40] & 0x80)) { switch (this->unk_31C) { @@ -164,7 +164,7 @@ u16 func_80B50410(EnGk* this, GlobalContext* globalCtx) { this->unk_1E4 |= 1; return 0xE81; } - } else if (globalCtx->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneNum == SCENE_GORONRACE) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[41] & 4)) { if (this->unk_31C == 0xE88) { @@ -233,18 +233,18 @@ u16 func_80B50710(EnGk* this) { return 0; } -void func_80B507A0(EnGk* this, GlobalContext* globalCtx) { +void func_80B507A0(EnGk* this, PlayState* play) { 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; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 30.0f, 30.0f, 7); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 30.0f, 30.0f, 7); } -s32 func_80B50854(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B50854(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(this->unk_1E4 & 0x40)) { if (player->stateFlags2 & 0x8000000) { @@ -255,9 +255,9 @@ s32 func_80B50854(EnGk* this, GlobalContext* globalCtx) { this->unk_1E4 &= ~0x40; } - if ((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 1)) { - Flags_SetSwitch(globalCtx, ENGK_GET_3F00(&this->actor)); + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 1)) { + Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); this->unk_2E4 = 3; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); this->actionFunc = func_80B521E8; @@ -272,7 +272,7 @@ void func_80B50954(EnGk* this) { } } -void func_80B509A8(EnGk* this, GlobalContext* globalCtx) { +void func_80B509A8(EnGk* this, PlayState* play) { Vec3f sp4C; s16 phi_s1 = 0; @@ -296,13 +296,13 @@ void func_80B509A8(EnGk* this, GlobalContext* globalCtx) { phi_s1 = 10; } - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->unk_2E8, &this->unk_300, &sp4C, &D_80B533A0, &D_80B533A4, + EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2E8, &this->unk_300, &sp4C, &D_80B533A0, &D_80B533A4, Rand_S16Offset(15, 15), phi_s1, 0); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->unk_2F4, &this->unk_30C, &sp4C, &D_80B533A0, &D_80B533A4, + EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2F4, &this->unk_30C, &sp4C, &D_80B533A0, &D_80B533A4, Rand_S16Offset(15, 15), phi_s1, 0); } -void func_80B50B38(EnGk* this, GlobalContext* globalCtx) { +void func_80B50B38(EnGk* this, PlayState* play) { s16 i; s16 temp; @@ -310,13 +310,13 @@ void func_80B50B38(EnGk* this, GlobalContext* globalCtx) { case 0: this->unk_2E0 = 3; for (i = 0; i < 2; i++) { - func_80B509A8(this, globalCtx); + func_80B509A8(this, play); } break; case 2: this->unk_2E0 = 3; - func_80B509A8(this, globalCtx); + func_80B509A8(this, play); break; case 1: @@ -329,7 +329,7 @@ void func_80B50B38(EnGk* this, GlobalContext* globalCtx) { case 10: case 11: this->unk_2E0 = 3; - func_80B509A8(this, globalCtx); + func_80B509A8(this, play); break; default: @@ -428,8 +428,8 @@ s32 func_80B50ED4(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar return true; } -s32 func_80B5100C(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B5100C(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; @@ -455,7 +455,7 @@ s32 func_80B5100C(EnGk* this, GlobalContext* globalCtx) { return true; } -s32 func_80B5123C(EnGk* this, GlobalContext* globalCtx) { +s32 func_80B5123C(EnGk* this, PlayState* play) { s16 temp_v0; s16 phi_v1; @@ -470,7 +470,7 @@ s32 func_80B5123C(EnGk* this, GlobalContext* globalCtx) { if (Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7FF8)) { this->unk_1E4 |= 8; - func_80B5100C(this, globalCtx); + func_80B5100C(this, play); } else { if (this->unk_1E4 & 8) { this->unk_34E = 20; @@ -484,7 +484,7 @@ s32 func_80B5123C(EnGk* this, GlobalContext* globalCtx) { return true; } -void func_80B51308(EnGk* this, GlobalContext* globalCtx) { +void func_80B51308(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_31A].animation); @@ -494,7 +494,7 @@ void func_80B51308(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51398(EnGk* this, GlobalContext* globalCtx) { +void func_80B51398(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[9].animation); @@ -504,12 +504,12 @@ void func_80B51398(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51410(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B51410(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 100.0f) { - if ((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 0xE)) { + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 0xE)) { this->unk_1E4 |= 0x20; } @@ -532,18 +532,18 @@ void func_80B51410(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51510(EnGk* this, GlobalContext* globalCtx) { +void func_80B51510(EnGk* this, PlayState* play) { s32 pad; s32 actionIndex; if (this) {} - if (Cutscene_CheckActorAction(globalCtx, 479)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 479); + if (Cutscene_CheckActorAction(play, 479)) { + actionIndex = Cutscene_GetActorActionIndex(play, 479); - if (globalCtx->csCtx.actorActions[actionIndex]->action != this->unk_31B) { - this->unk_31B = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.actorActions[actionIndex]->action != this->unk_31B) { + this->unk_31B = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_31A = 0; this->unk_2E4 = 0; @@ -577,24 +577,24 @@ void func_80B51510(EnGk* this, GlobalContext* globalCtx) { break; case 7: - Flags_SetSwitch(globalCtx, ENGK_GET_3F00(&this->actor)); + Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); break; } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_31A); } if (this->unk_31A == 7) { - func_80B51308(this, globalCtx); + func_80B51308(this, play); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); this->actor.shape.yOffset = 0.0f; } else { this->unk_31B = 0x63; } } -void func_80B51698(EnGk* this, GlobalContext* globalCtx) { +void func_80B51698(EnGk* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); @@ -615,7 +615,7 @@ void func_80B51698(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51760(EnGk* this, GlobalContext* globalCtx) { +void func_80B51760(EnGk* this, PlayState* play) { s16 sp2E = this->skelAnime.curFrame; s16 lastFrame; @@ -632,16 +632,16 @@ void func_80B51760(EnGk* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_2E4); } } else { - if (Flags_GetSwitch(globalCtx, ENGK_GET_3F00(&this->actor))) { + if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { gSaveContext.save.weekEventReg[40] |= 0x40; this->actionFunc = func_80B51D9C; return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1E4 |= 4; - this->unk_31C = func_80B50410(this, globalCtx); - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + this->unk_31C = func_80B50410(this, play); + Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B51970; if (this->unk_31C == 0xE81) { this->unk_2E4 = 0; @@ -649,7 +649,7 @@ void func_80B51760(EnGk* this, GlobalContext* globalCtx) { } } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (gSaveContext.save.entranceIndex != 0xD010)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } if (this->unk_1E4 & 4) { @@ -659,10 +659,10 @@ void func_80B51760(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51970(EnGk* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80B51970(EnGk* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); - if (((temp_v0 == 6) || (temp_v0 == 5)) && Message_ShouldAdvance(globalCtx)) { + if (((temp_v0 == 6) || (temp_v0 == 5)) && Message_ShouldAdvance(play)) { if ((this->unk_31C == 0xE84) || (this->unk_31C == 0xE99)) { ActorCutscene_Stop(this->unk_318); this->unk_318 = ActorCutscene_GetAdditionalCutscene(this->unk_318); @@ -681,8 +681,8 @@ void func_80B51970(EnGk* this, GlobalContext* globalCtx) { return; } - this->unk_31C = func_80B50410(this, globalCtx); - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + this->unk_31C = func_80B50410(this, play); + Message_StartTextbox(play, this->unk_31C, &this->actor); if (this->unk_31C == 0xE80) { this->unk_1E4 |= 2; } else if (this->unk_31C == 0xE89) { @@ -697,7 +697,7 @@ void func_80B51970(EnGk* this, GlobalContext* globalCtx) { this->unk_2E4 = 9; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); } else { - func_80B51398(this, globalCtx); + func_80B51398(this, play); } } } @@ -709,11 +709,11 @@ void func_80B51970(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80B51B40(EnGk* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 6) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_1E4 & 1) { this->unk_1E4 &= ~1; this->unk_1E4 &= ~4; @@ -723,12 +723,12 @@ void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { } if (this->unk_31C == 0xE8F) { - globalCtx->nextEntranceIndex = 0xD010; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->nextEntranceIndex = 0xD010; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; - Parameter_AddMagic(globalCtx, ((void)0, gSaveContext.unk_3F30) + - (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); + Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); } else { this->actionFunc = func_80B51760; } @@ -736,23 +736,23 @@ void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { } this->unk_31C = func_80B50710(this); - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); if (this->unk_31C == 0xE8C) { this->unk_1E4 |= 2; } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->unk_31C = 0xE8E; - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); break; case 1: func_8019F230(); this->unk_31C = 0xE8A; - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); break; } } @@ -764,7 +764,7 @@ void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { this->unk_2E4 = 9; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); } else { - func_80B51398(this, globalCtx); + func_80B51398(this, play); } } } @@ -773,8 +773,8 @@ void func_80B51B40(EnGk* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80B51D9C(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B51D9C(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCanPlayNext(this->unk_318)) { ActorCutscene_StartAndSetFlag(this->unk_318, &this->actor); @@ -790,7 +790,7 @@ void func_80B51D9C(EnGk* this, GlobalContext* globalCtx) { } else { this->unk_31C = 0xE99; } - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B51970; } } else { @@ -802,7 +802,7 @@ void func_80B51D9C(EnGk* this, GlobalContext* globalCtx) { func_80B50954(this); } -void func_80B51EA4(EnGk* this, GlobalContext* globalCtx) { +void func_80B51EA4(EnGk* this, PlayState* play) { Vec3s sp38; s16 sp36; @@ -832,7 +832,7 @@ void func_80B51EA4(EnGk* this, GlobalContext* globalCtx) { func_80B50954(this); } -void func_80B51FD0(EnGk* this, GlobalContext* globalCtx) { +void func_80B51FD0(EnGk* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[22] & 4)) { if (this->unk_1E4 & 2) { func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); @@ -842,19 +842,19 @@ void func_80B51FD0(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B5202C(EnGk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5202C(EnGk* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->csCtx.state == 0) { - func_80B51410(this, globalCtx); + if (play->csCtx.state == 0) { + func_80B51410(this, play); } - if (!func_80B50854(this, globalCtx)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (!func_80B50854(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { gSaveContext.save.weekEventReg[24] |= 0x80; this->actionFunc = func_80B51698; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); if (player->transformation == PLAYER_FORM_GORON) { this->actor.textId = 0xE74; } else { @@ -863,8 +863,7 @@ void func_80B5202C(EnGk* this, GlobalContext* globalCtx) { } if (this->unk_1E4 & 2) { - if ((globalCtx->msgCtx.ocarinaMode != 1) && (globalCtx->msgCtx.ocarinaMode != 3) && - (globalCtx->csCtx.state == 0)) { + if ((play->msgCtx.ocarinaMode != 1) && (play->msgCtx.ocarinaMode != 3) && (play->csCtx.state == 0)) { func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } } else { @@ -873,15 +872,15 @@ void func_80B5202C(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B5216C(EnGk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void func_80B5216C(EnGk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80B51698; } } -void func_80B521E8(EnGk* this, GlobalContext* globalCtx) { +void func_80B521E8(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); @@ -892,12 +891,12 @@ void func_80B521E8(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B5227C(EnGk* this, GlobalContext* globalCtx) { +void func_80B5227C(EnGk* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); if ((sp26 + 1) == lastFrame) { - func_800B14D4(globalCtx, 20.0f, &this->actor.home.pos); + func_800B14D4(play, 20.0f, &this->actor.home.pos); this->unk_350 = 60; if (!(this->unk_1E4 & 0x80)) { gSaveContext.save.weekEventReg[22] |= 4; @@ -908,8 +907,8 @@ void func_80B5227C(EnGk* this, GlobalContext* globalCtx) { } } -void func_80B52340(EnGk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B52340(EnGk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1E4 |= 4; if (gSaveContext.eventInf[1] & 2) { this->unk_31C = 0xE90; @@ -918,28 +917,28 @@ void func_80B52340(EnGk* this, GlobalContext* globalCtx) { this->unk_31C = 0xE93; this->actionFunc = func_80B52430; } - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); this->actor.flags &= ~ACTOR_FLAG_10000; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80B52430(EnGk* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { +void func_80B52430(EnGk* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { switch (this->unk_31C) { case 0xE93: this->unk_31C = 0xE89; - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B51B40; return; case 0xE90: this->unk_31C = 0xE91; - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); return; case 0xE91: @@ -957,7 +956,7 @@ void func_80B52430(EnGk* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80B5253C(EnGk* this, GlobalContext* globalCtx) { +void func_80B5253C(EnGk* this, PlayState* play) { s32 sp24; if (gSaveContext.save.weekEventReg[41] & 8) { @@ -966,30 +965,30 @@ void func_80B5253C(EnGk* this, GlobalContext* globalCtx) { sp24 = 0x6A; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (sp24 == 0x6A) { gSaveContext.save.weekEventReg[41] |= 8; } this->actionFunc = func_80B525E0; } else { - Actor_PickUp(&this->actor, globalCtx, sp24, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, sp24, 300.0f, 300.0f); } } -void func_80B525E0(EnGk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B525E0(EnGk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_31C = 0xE92; - Message_StartTextbox(globalCtx, this->unk_31C, &this->actor); + Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B52430; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80B52654(EnGk* this, GlobalContext* globalCtx) { +void func_80B52654(EnGk* this, PlayState* play) { this->unk_350 += 0x400; - if ((this->unk_1E4 & 0x80) && (globalCtx->csCtx.frames == 250)) { + if ((this->unk_1E4 & 0x80) && (play->csCtx.frames == 250)) { gSaveContext.save.weekEventReg[22] |= 4; } @@ -1002,15 +1001,15 @@ void func_80B52654(EnGk* this, GlobalContext* globalCtx) { } } -void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGk_Init(Actor* thisx, PlayState* play) { s32 pad; EnGk* this = THIS; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_gk_Skel_0079C0, &object_gk_Anim_00787C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_gk_Skel_0079C0, &object_gk_Anim_00787C, this->jointTable, this->morphTable, 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_2E2 = 20; @@ -1023,15 +1022,15 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { if (ENGK_GET_F(&this->actor) == ENGK_F_1) { this->unk_2E4 = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); - if (globalCtx->sceneNum == SCENE_17SETUGEN2) { - if (Flags_GetSwitch(globalCtx, ENGK_GET_3F00(&this->actor))) { + if (play->sceneNum == SCENE_17SETUGEN2) { + if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { Actor_MarkForDeath(&this->actor); } else { this->unk_318 = this->actor.cutscene; - this->path = SubS_GetPathByIndex(globalCtx, ENGK_GET_F0(&this->actor), 15); + this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 15); this->actionFunc = func_80B51760; } - } else if (globalCtx->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneNum == SCENE_GORONRACE) { if (gSaveContext.save.weekEventReg[33] & 0x80) { if (gSaveContext.save.entranceIndex == 0xD010) { this->actionFunc = func_80B51760; @@ -1067,38 +1066,38 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGk_Destroy(Actor* thisx, PlayState* play) { EnGk* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnGk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGk_Update(Actor* thisx, PlayState* play) { EnGk* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((ENGK_GET_F(&this->actor) == ENGK_F_1) || ((ENGK_GET_F(&this->actor) == ENGK_F_0) && !(gSaveContext.save.weekEventReg[22] & 4))) { - func_80B507A0(this, globalCtx); + func_80B507A0(this, play); SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); if (ENGK_GET_F(&this->actor) == ENGK_F_1) { - func_80B5123C(this, globalCtx); + func_80B5123C(this, play); } - func_80B50B38(this, globalCtx); + func_80B50B38(this, play); } if (ENGK_GET_F(&this->actor) == ENGK_F_0) { - func_80B51510(this, globalCtx); + func_80B51510(this, play); } } -s32 EnGk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnGk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnGk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnGk* this = THIS; Vec3f sp58 = { 0.0f, 0.0f, 0.0f }; Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; @@ -1160,7 +1159,7 @@ void EnGk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnGk_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnGk_TransformDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnGk* this = THIS; s32 phi_v0; s32 phi_v1; @@ -1228,40 +1227,40 @@ TexturePtr D_80B533E4[] = { object_gk_Tex_010F20, }; -void EnGk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGk_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGk* this = THIS; Vec3f sp5C; Vec3f sp50; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if ((ENGK_GET_F(&this->actor) == ENGK_F_0) && (gSaveContext.save.weekEventReg[22] & 4)) { Matrix_RotateXS(-0x4000, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_gk_DL_006688); gSPDisplayList(POLY_OPA_DISP++, object_gk_DL_006680); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp5C = this->actor.world.pos; sp50.x = 0.2f; sp50.y = 0.2f; sp50.z = 0.2f; - func_800BC620(&sp5C, &sp50, 255, globalCtx); + func_800BC620(&sp5C, &sp50, 255, play); } else { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B533E4[this->unk_2E0])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGk_OverrideLimbDraw, EnGk_PostLimbDraw, EnGk_TransformDraw, &this->actor); if (ENGK_GET_F(&this->actor) != ENGK_F_2) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if ((this->unk_2E4 == 0) || (this->unk_2E4 == 1) || (this->unk_2E4 == 2) || (this->unk_2E4 == 3) || (this->unk_2E4 == 4)) { sp5C.x = this->actor.world.pos.x - 15.0f; @@ -1277,9 +1276,9 @@ void EnGk_Draw(Actor* thisx, GlobalContext* globalCtx) { sp50.y = 0.2f; sp50.z = 0.2f; } - func_800BC620(&sp5C, &sp50, 255, globalCtx); + func_800BC620(&sp5C, &sp50, 255, play); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.h b/src/overlays/actors/ovl_En_Gk/z_en_gk.h index 21863c66f3..d61157cca3 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.h +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.h @@ -5,7 +5,7 @@ struct EnGk; -typedef void (*EnGkActionFunc)(struct EnGk*, GlobalContext*); +typedef void (*EnGkActionFunc)(struct EnGk*, PlayState*); #define ENGK_GET_F(thisx) ((thisx)->params & 0xF) #define ENGK_GET_F0(thisx) (((thisx)->params & 0xF0) >> 4) 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 8e43a095ae..a23e5f7846 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -12,13 +12,13 @@ #define THIS ((EnGm*)thisx) -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_80950CDC(EnGm* this, GlobalContext* globalCtx); -void func_80950DB8(EnGm* this, GlobalContext* globalCtx); +void func_80950CDC(EnGm* this, PlayState* play); +void func_80950DB8(EnGm* this, PlayState* play); static u8 D_80951820[] = { /* 0x000 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(1, 0x13B - 0x005), @@ -225,12 +225,12 @@ static AnimationInfoS D_80951CC0[] = { { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -Actor* func_8094DEE0(EnGm* this, GlobalContext* globalCtx, u8 arg2, s16 arg3) { +Actor* func_8094DEE0(EnGm* this, PlayState* play, u8 arg2, s16 arg3) { Actor* foundActor = NULL; Actor* actor; while (true) { - actor = SubS_FindActor(globalCtx, foundActor, arg2, arg3); + actor = SubS_FindActor(play, foundActor, arg2, arg3); foundActor = actor; if (actor == NULL) { break; @@ -251,7 +251,7 @@ Actor* func_8094DEE0(EnGm* this, GlobalContext* globalCtx, u8 arg2, s16 arg3) { return foundActor; } -EnDoor* func_8094DF90(GlobalContext* globalCtx, s32 arg1) { +EnDoor* func_8094DF90(PlayState* play, s32 arg1) { s32 phi_a1; switch (arg1) { @@ -283,10 +283,10 @@ EnDoor* func_8094DF90(GlobalContext* globalCtx, s32 arg1) { phi_a1 = -1; } - return SubS_FindDoor(globalCtx, phi_a1); + return SubS_FindDoor(play, phi_a1); } -s32 func_8094DFF8(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094DFF8(EnGm* this, PlayState* play) { s32 ret = false; if (this->unk_262 < 0) { @@ -301,7 +301,7 @@ s32 func_8094DFF8(EnGm* this, GlobalContext* globalCtx) { return ret; } -s32 func_8094E054(EnGm* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { s8 tmp = this->unk_262; s32 phi_v1 = false; s32 ret = false; @@ -325,12 +325,12 @@ s32 func_8094E054(EnGm* this, GlobalContext* globalCtx, s32 arg2) { return ret; } -s32 func_8094E0F8(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094E0F8(EnGm* this, PlayState* play) { s32 ret = false; - if ((this->unk_260 != globalCtx->roomCtx.currRoom.num) && (globalCtx->roomCtx.unk31 == 0)) { - this->unk_260 = globalCtx->roomCtx.currRoom.num; - this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, globalCtx); + if ((this->unk_260 != play->roomCtx.currRoom.num) && (play->roomCtx.unk31 == 0)) { + this->unk_260 = play->roomCtx.currRoom.num; + this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); this->actor.draw = NULL; this->unk_3FC = 1; } @@ -339,7 +339,7 @@ s32 func_8094E0F8(EnGm* this, GlobalContext* globalCtx) { return false; } - if ((this->unk_262 < 0) || !SubS_IsObjectLoaded(this->unk_262, globalCtx)) { + if ((this->unk_262 < 0) || !SubS_IsObjectLoaded(this->unk_262, play)) { ret = true; } else { this->actor.draw = EnGm_Draw; @@ -353,22 +353,22 @@ s32 func_8094E0F8(EnGm* this, GlobalContext* globalCtx) { return ret; } -void func_8094E1DC(EnGm* this, GlobalContext* globalCtx) { +void func_8094E1DC(EnGm* this, PlayState* play) { s32 pad; f32 temp; if (this->unk_258 == 7) { temp = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; this->colliderSphere.dim.worldSphere.radius = temp; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } else { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } } -void func_8094E278(GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DM_CHAR07, 115.0f, 32.0f, -121.0f, 0, 0, 0, 3); +void func_8094E278(PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_DM_CHAR07, 115.0f, 32.0f, -121.0f, 0, 0, 0, 3); } void func_8094E2D0(EnGm* this) { @@ -451,7 +451,7 @@ s16 func_8094E4D0(EnGm* this, s32 arg1) { return cutscene; } -s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094E52C(EnGm* this, PlayState* play) { s32 pad; s16 sp2A = func_8094E4D0(this, 0); s32 ret = false; @@ -466,7 +466,7 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { ActorCutscene_Stop(sp2A); } else { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_3E0++; ret = true; @@ -474,8 +474,7 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { case 1: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), - this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); } this->unk_3E0++; ret = true; @@ -491,7 +490,7 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { return ret; } -s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094E69C(EnGm* this, PlayState* play) { Camera* camera; s16 sp4A = func_8094E4D0(this, 0); s16 sp48; @@ -502,7 +501,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { switch (this->unk_3E0) { case 0: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); - func_8094E054(this, globalCtx, 2); + func_8094E054(this, play, 2); this->unk_3E2 = 0; this->unk_3E0++; break; @@ -534,7 +533,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { if (func_8094E454(this, sp4A)) { case 4: case 6: - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp4A)); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp4A)); Camera_SetTargetActor(camera, &this->actor); this->unk_3E0++; ret = true; @@ -545,7 +544,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp4A)); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp4A)); Camera_SetTargetActor(camera, this->actor.child); } this->unk_3E0++; @@ -565,7 +564,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, sp48, 3, 0x2AA8); this->unk_3A4 &= ~0x20; } else { - func_8094E054(this, globalCtx, 1); + func_8094E054(this, play, 1); this->actor.shape.rot.y = sp48; this->unk_3E0++; this->unk_3E2 = 0; @@ -576,13 +575,13 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { return ret; } -s32 func_8094EA34(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094EA34(EnGm* this, PlayState* play) { s32 pad[2]; Actor* al; Actor* toto; - al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); - toto = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TOTO); + al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((al == NULL) || (al->update == NULL) || (toto == NULL) || (toto->update == NULL)) { this->unk_3E0++; return true; @@ -626,7 +625,7 @@ s32 func_8094EA34(EnGm* this, GlobalContext* globalCtx) { return true; } -s32 func_8094EB1C(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094EB1C(EnGm* this, PlayState* play) { s32 pad[2]; s32 ret = false; s16 oldYaw; @@ -639,7 +638,7 @@ s32 func_8094EB1C(EnGm* this, GlobalContext* globalCtx) { break; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); - func_8094E054(this, globalCtx, 2); + func_8094E054(this, play, 2); this->unk_3E2 = 0; this->unk_3E0++; @@ -669,7 +668,7 @@ s32 func_8094EB1C(EnGm* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, oldYaw, 3, 0x2AA8); this->unk_3A4 &= ~0x20; } else { - func_8094E054(this, globalCtx, 1); + func_8094E054(this, play, 1); this->actor.shape.rot.y = oldYaw; this->unk_3E2 = 0; this->unk_3E0++; @@ -680,7 +679,7 @@ s32 func_8094EB1C(EnGm* this, GlobalContext* globalCtx) { return ret; } -s32* func_8094EDBC(EnGm* this, GlobalContext* globalCtx) { +s32* func_8094EDBC(EnGm* this, PlayState* play) { switch (this->unk_258) { case 1: this->unk_3E4 = func_8094E52C; @@ -729,16 +728,16 @@ s32* func_8094EDBC(EnGm* this, GlobalContext* globalCtx) { return NULL; } -s32 func_8094EE84(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094EE84(EnGm* this, PlayState* play) { s32 ret = false; if (this->unk_3A4 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_3A4, 0, 7); this->unk_3E0 = 0; this->unk_3E4 = NULL; this->actor.child = this->unk_268; - this->unk_264 = func_8094EDBC(this, globalCtx); + this->unk_264 = func_8094EDBC(this, play); if ((this->unk_258 == 5) && !(gSaveContext.save.weekEventReg[50] & 1) && !(gSaveContext.save.weekEventReg[51] & 0x80) && !(gSaveContext.save.weekEventReg[75] & 2)) { @@ -758,13 +757,13 @@ s32 func_8094EE84(EnGm* this, GlobalContext* globalCtx) { return ret; } -s32 func_8094EFC4(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094EFC4(EnGm* this, PlayState* play) { s32 ret = false; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { if (this->unk_3F8 == 0) { - if ((globalCtx->sceneNum == SCENE_MILK_BAR) && (gSaveContext.sceneSetupIndex == 2)) { - func_8094E054(this, globalCtx, 0); + if ((play->sceneNum == SCENE_MILK_BAR) && (gSaveContext.sceneSetupIndex == 2)) { + func_8094E054(this, play, 0); this->unk_258 = 255; } this->unk_259 = 255; @@ -772,7 +771,7 @@ s32 func_8094EFC4(EnGm* this, GlobalContext* globalCtx) { } ret = true; } else if (this->unk_3F8 != 0) { - if (globalCtx->sceneNum == SCENE_MILK_BAR) { + if (play->sceneNum == SCENE_MILK_BAR) { this->unk_400 = 0; } this->unk_3F8 = 0; @@ -780,12 +779,12 @@ s32 func_8094EFC4(EnGm* this, GlobalContext* globalCtx) { return ret; } -Actor* func_8094F074(EnGm* this, GlobalContext* globalCtx) { +Actor* func_8094F074(EnGm* this, PlayState* play) { Actor* actor; switch (this->unk_258) { case 1: - actor = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL); + actor = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL); break; case 2: @@ -793,11 +792,11 @@ Actor* func_8094F074(EnGm* this, GlobalContext* globalCtx) { break; case 3: - actor = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TAB); + actor = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TAB); break; default: - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; break; } @@ -856,14 +855,14 @@ void func_8094F2E8(EnGm* this) { } } -void func_8094F3D0(EnGm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 sp28 = Message_GetState(&globalCtx->msgCtx); - s32 var = globalCtx->msgCtx.currentTextId; +void func_8094F3D0(EnGm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp28 = Message_GetState(&play->msgCtx); + s32 var = play->msgCtx.currentTextId; if ((&this->actor == player->targetActor) && ((var < 0xFF) || (var > 0x200)) && (sp28 == 3) && (this->unk_3F0 == 3)) { - if ((globalCtx->state.frames % 3) == 0) { + if ((play->state.frames % 3) == 0) { if (this->unk_3AC == 120.0f) { this->unk_3AC = 0.0f; } else { @@ -878,49 +877,49 @@ void func_8094F3D0(EnGm* this, GlobalContext* globalCtx) { this->unk_3F0 = sp28; } -s32 func_8094F4EC(EnGm* this, GlobalContext* globalCtx) { +s32 func_8094F4EC(EnGm* this, PlayState* play) { if ((this->unk_258 != 6) && (this->unk_3E8 == 12)) { this->unk_3A4 &= ~0x2000; - func_8094E054(this, globalCtx, 8); + func_8094E054(this, play, 8); } return true; } -s32 func_8094F53C(EnGm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 sp32 = globalCtx->msgCtx.currentTextId; - Actor* al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); - Actor* toto = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TOTO); +s32 func_8094F53C(EnGm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 sp32 = play->msgCtx.currentTextId; + Actor* al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + Actor* toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if (player->stateFlags1 & 0x440) { this->unk_3A4 |= 0x400; if (this->unk_3A6 != sp32) { switch (sp32) { case 0x2B13: - func_8094E054(this, globalCtx, 2); + func_8094E054(this, play, 2); break; case 0x2B14: case 0x2B18: - func_8094E054(this, globalCtx, 0); + func_8094E054(this, play, 0); break; case 0x2B16: - func_8094E054(this, globalCtx, 1); + func_8094E054(this, play, 1); break; case 0x2B15: - func_8094E054(this, globalCtx, 5); + func_8094E054(this, play, 5); break; case 0x2B17: - func_8094E054(this, globalCtx, 6); + func_8094E054(this, play, 6); break; default: if ((this->unk_3E8 == 7) || (this->unk_3E8 == 8)) { this->unk_3A4 |= 0x2000; - func_8094E054(this, globalCtx, 12); + func_8094E054(this, play, 12); } break; } @@ -956,21 +955,21 @@ s32 func_8094F53C(EnGm* this, GlobalContext* globalCtx) { this->unk_3A4 &= ~0x400; this->unk_3CA = this->unk_3C8; this->unk_3CC = 4; - func_8094F4EC(this, globalCtx); + func_8094F4EC(this, play); } if (this->unk_18C != NULL) { - this->unk_18C(this, globalCtx); + this->unk_18C(this, play); } - if ((this->unk_3E8 == 6) && !(globalCtx->actorCtx.unk5 & 0x20) && Animation_OnFrame(&this->skelAnime, 20.0f)) { + if ((this->unk_3E8 == 6) && !(play->actorCtx.unk5 & 0x20) && Animation_OnFrame(&this->skelAnime, 20.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); } return false; } -s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 arg3, s16 arg4) { +s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s16 arg4) { u8 sp4F = ENGM_GET_FF(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -980,10 +979,10 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 s32 ret = false; this->timePath = NULL; - actor = func_8094DEE0(this, globalCtx, arg3, arg4); + actor = func_8094DEE0(this, play, arg3, arg4); if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80951A0C[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]); } if ((actor != NULL) && (actor->update != NULL)) { @@ -1000,7 +999,7 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 return ret; } -s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = ENGM_GET_FF(&this->actor); EnDoor* door; @@ -1011,10 +1010,10 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_8094DF90(globalCtx, arg2->result); + door = func_8094DF90(play, arg2->result); if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp55, D_80951A0C[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[arg2->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -1038,7 +1037,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; - func_8094E054(this, globalCtx, 7); + func_8094E054(this, play, 7); this->actor.gravity = 0.0f; ret = true; } @@ -1046,7 +1045,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = ENGM_GET_FF(&this->actor); @@ -1055,7 +1054,7 @@ s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp2B, D_80951A0C[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[arg2->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1085,24 +1084,24 @@ s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; - func_8094E054(this, globalCtx, 7); + func_8094E054(this, play, 7); this->actor.gravity = -1.0f; ret = true; } return ret; } -s32 func_8094FCC4(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80951D90 = { 64.0f, 0.0f, -122.0f }; s32 ret = false; - if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TAB)) { + if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TAB)) { if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90); SubS_UpdateFlags(&this->unk_3A4, 3, 7); - func_8094E054(this, globalCtx, 0); + func_8094E054(this, play, 0); } else { - func_8094E054(this, globalCtx, 9); + func_8094E054(this, play, 9); this->skelAnime.moveFlags = 0x10; } this->unk_3A4 |= 0x100; @@ -1112,11 +1111,11 @@ s32 func_8094FCC4(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_8094FD88(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { - func_8094E054(this, globalCtx, 11); + if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { + func_8094E054(this, play, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; @@ -1125,13 +1124,13 @@ s32 func_8094FD88(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_8094FE10(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; Actor* al; - al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); - if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { - func_8094E054(this, globalCtx, 11); + al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { + func_8094E054(this, play, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_268 = al; if (!(gSaveContext.save.weekEventReg[86] & 0x20)) { @@ -1146,7 +1145,7 @@ s32 func_8094FE10(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80951D9C = { 64.0f, 0.0f, -122.0f }; u8 sp4F = ENGM_GET_FF(&this->actor); Vec3s* sp48; @@ -1158,7 +1157,7 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80951A0C[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]); } if (this->timePath != NULL) { @@ -1173,11 +1172,11 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; - func_8094E054(this, globalCtx, 0); - func_8094E278(globalCtx); + func_8094E054(this, play, 0); + func_8094E278(play); } else { Math_Vec3f_Copy(&this->actor.world.pos, &sp30); - func_8094E054(this, globalCtx, 9); + func_8094E054(this, play, 9); this->skelAnime.moveFlags = 0x10; } this->unk_400 = 0; @@ -1188,7 +1187,7 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80950088(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80950088(EnGm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80951DA8 = { 278.0f, 0.0f, 223.0f }; static Vec3s D_80951DB4 = { 0x0000, 0xC000, 0x0000 }; s32 pad; @@ -1199,11 +1198,11 @@ s32 func_80950088(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= (0x2000 | 0x100); this->unk_3A4 |= 0x200; - func_8094E054(this, globalCtx, 12); + func_8094E054(this, play, 12); return true; } -s32 func_80950120(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80950120(EnGm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80951DBC = { -525.0f, 214.0f, 515.0f }; static Vec3s D_80951DC8 = { 0x0000, 0x38E0, 0x0000 }; s32 pad; @@ -1214,11 +1213,11 @@ s32 func_80950120(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= (0x800 | 0x100); this->unk_3A4 |= 0x200; - func_8094E054(this, globalCtx, 4); + func_8094E054(this, play, 4); return true; } -s32 func_809501B8(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_809501B8(EnGm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80951DD0 = { -334.0f, 225.0f, 903.0f }; static Vec3s D_80951DDC = { 0x0000, 0x7FFF, 0x0000 }; s32 pad; @@ -1235,11 +1234,11 @@ s32 func_809501B8(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->unk_3CC = 8; this->actor.targetMode = 6; this->unk_3B4 = 60.0f; - func_8094E054(this, globalCtx, 10); + func_8094E054(this, play, 10); return true; } -s32 func_80950280(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) { s32 phi_v1; this->actor.flags |= ACTOR_FLAG_1; @@ -1252,31 +1251,31 @@ s32 func_80950280(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { switch (arg2->result) { case 1: - phi_v1 = func_8094FD88(this, globalCtx, arg2); + phi_v1 = func_8094FD88(this, play, arg2); break; case 2: - phi_v1 = func_8094FE10(this, globalCtx, arg2); + phi_v1 = func_8094FE10(this, play, arg2); break; case 3: - phi_v1 = func_8094FCC4(this, globalCtx, arg2); + phi_v1 = func_8094FCC4(this, play, arg2); break; case 5: - phi_v1 = func_8094FF04(this, globalCtx, arg2); + phi_v1 = func_8094FF04(this, play, arg2); break; case 6: - phi_v1 = func_80950088(this, globalCtx, arg2); + phi_v1 = func_80950088(this, play, arg2); break; case 7: - phi_v1 = func_809501B8(this, globalCtx, arg2); + phi_v1 = func_809501B8(this, play, arg2); break; case 8: - phi_v1 = func_80950120(this, globalCtx, arg2); + phi_v1 = func_80950120(this, play, arg2); break; case 9: @@ -1291,7 +1290,7 @@ s32 func_80950280(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 18: case 19: case 20: - phi_v1 = func_8094F904(this, globalCtx, arg2); + phi_v1 = func_8094F904(this, play, arg2); break; case 21: @@ -1304,7 +1303,7 @@ s32 func_80950280(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 28: case 29: case 30: - phi_v1 = func_8094FAC4(this, globalCtx, arg2); + phi_v1 = func_8094FAC4(this, play, arg2); break; default: @@ -1315,7 +1314,7 @@ s32 func_80950280(EnGm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return phi_v1; } -s32 func_80950388(EnGm* this, GlobalContext* globalCtx) { +s32 func_80950388(EnGm* this, PlayState* play) { Vec3f sp2C; Vec3f sp20; @@ -1328,22 +1327,22 @@ s32 func_80950388(EnGm* this, GlobalContext* globalCtx) { return false; } -s32 func_809503F8(EnGm* this, GlobalContext* globalCtx) { +s32 func_809503F8(EnGm* this, PlayState* play) { s32 pad; if (this->unk_3E8 == 9) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; SubS_UpdateFlags(&this->unk_3A4, 3, 7); - func_8094E054(this, globalCtx, 0); + func_8094E054(this, play, 0); } else { - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } } return false; } -s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { +s32 func_80950490(EnGm* this, PlayState* play) { static s32 D_80951DE4[] = { 1, 5, 5, 1, 6, 5, 1, 5, 6, 1, 5, 6, }; @@ -1355,7 +1354,7 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { this->unk_3CA = 1; this->unk_3CC = 8; this->unk_400 = 1; - func_8094E054(this, globalCtx, 3); + func_8094E054(this, play, 3); } return false; } @@ -1370,17 +1369,17 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; - func_8094E054(this, globalCtx, 0); - func_8094E278(globalCtx); + func_8094E054(this, play, 0); + func_8094E278(play); } else { - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } break; case 5: case 6: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_8094E054(this, globalCtx, D_80951DE4[this->unk_3F4]); + func_8094E054(this, play, D_80951DE4[this->unk_3F4]); this->unk_3F4++; this->unk_3F4 %= 12; this->unk_3DE = Rand_S16Offset(30, 30); @@ -1389,7 +1388,7 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { default: if (DECR(this->unk_3DE) == 0) { - func_8094E054(this, globalCtx, D_80951DE4[this->unk_3F4]); + func_8094E054(this, play, D_80951DE4[this->unk_3F4]); this->unk_3F4++; this->unk_3F4 %= 12; this->unk_3DE = Rand_S16Offset(30, 30); @@ -1399,15 +1398,15 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { return false; } -s32 func_80950690(EnGm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80950690(EnGm* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* al; Actor* toto; switch (this->unk_258) { case 2: - al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); - toto = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TOTO); + al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((al != NULL) && (al->update != NULL) && (toto != NULL) && (toto->update != NULL) && !(player->stateFlags1 & 0x40)) { if (DECR(this->unk_3B8) == 0) { @@ -1433,19 +1432,19 @@ s32 func_80950690(EnGm* this, GlobalContext* globalCtx) { break; } - SubS_FillLimbRotTables(globalCtx, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); + SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); return false; } -s32 func_80950804(EnGm* this, GlobalContext* globalCtx) { +s32 func_80950804(EnGm* this, PlayState* play) { EnDoor* door; Vec3f sp38; s32 pad; f32 temp_f0; - door = func_8094DF90(globalCtx, this->unk_258); - if (!SubS_InCsMode(globalCtx) && (this->timePathTimeSpeed != 0)) { + door = func_8094DF90(play, this->unk_258); + if (!SubS_InCsMode(play) && (this->timePathTimeSpeed != 0)) { if ((door != NULL) && (door->dyna.actor.update != NULL)) { if ((this->unk_3BA / (f32)this->unk_3B8) <= 0.9f) { door->unk_1A7 = this->unk_261; @@ -1469,7 +1468,7 @@ s32 func_80950804(EnGm* this, GlobalContext* globalCtx) { return false; } -s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) { +s32 func_8095097C(EnGm* this, PlayState* play) { f32 knots[265]; Vec3f sp70; Vec3f sp64; @@ -1485,7 +1484,7 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; this->unk_3A4 |= 8; } else { @@ -1495,7 +1494,7 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) { this->actor.world.pos.x = timePathTargetPos.x; this->actor.world.pos.z = timePathTargetPos.z; - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { sp54 = this->timePathElapsedTime; sp50 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -1513,7 +1512,7 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); } - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; @@ -1523,25 +1522,25 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) { return false; } -void func_80950C24(EnGm* this, GlobalContext* globalCtx) { +void func_80950C24(EnGm* this, PlayState* play) { switch (this->unk_258) { case 1: - func_80950388(this, globalCtx); + func_80950388(this, play); break; case 2: case 6: case 7: case 8: - func_80950690(this, globalCtx); + func_80950690(this, play); break; case 3: - func_809503F8(this, globalCtx); + func_809503F8(this, play); break; case 5: - func_80950490(this, globalCtx); + func_80950490(this, play); break; case 9: @@ -1556,7 +1555,7 @@ void func_80950C24(EnGm* this, GlobalContext* globalCtx) { case 18: case 19: case 20: - func_80950804(this, globalCtx); + func_80950804(this, play); break; case 21: @@ -1569,20 +1568,20 @@ void func_80950C24(EnGm* this, GlobalContext* globalCtx) { case 28: case 29: case 30: - func_8095097C(this, globalCtx); + func_8095097C(this, play); break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80950CDC(EnGm* this, GlobalContext* globalCtx) { +void func_80950CDC(EnGm* this, PlayState* play) { ScheduleResult sp20; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80951820, &sp20) || - ((this->unk_258 != sp20.result) && !func_80950280(this, globalCtx, &sp20))) { + if (!Schedule_RunScript(play, D_80951820, &sp20) || + ((this->unk_258 != sp20.result) && !func_80950280(this, play, &sp20))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp20.result = 0; @@ -1591,19 +1590,19 @@ void func_80950CDC(EnGm* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; } this->unk_258 = sp20.result; - this->unk_268 = func_8094F074(this, globalCtx); - func_80950C24(this, globalCtx); + this->unk_268 = func_8094F074(this, play); + func_80950C24(this, play); } -void func_80950DB8(EnGm* this, GlobalContext* globalCtx) { +void func_80950DB8(EnGm* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; Actor* al; - if (func_8010BF58(&this->actor, globalCtx, this->unk_264, this->unk_3E4, &this->unk_25C)) { + if (func_8010BF58(&this->actor, play, this->unk_264, this->unk_3E4, &this->unk_25C)) { SubS_UpdateFlags(&this->unk_3A4, 3, 7); - al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); + al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); if ((this->unk_258 == 2) && (al != NULL) && (al->update != NULL)) { this->unk_268 = al; this->unk_3B8 = Rand_S16Offset(60, 60); @@ -1622,26 +1621,26 @@ void func_80950DB8(EnGm* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp34, &sp40), 4, 0x2AA8); } } - SubS_FillLimbRotTables(globalCtx, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); + SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8)); } -void func_80950F2C(EnGm* this, GlobalContext* globalCtx) { +void func_80950F2C(EnGm* this, PlayState* play) { s32 sp50[] = { 0, 0, 3, 2 }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; Vec3f sp3C; Vec3f sp30; s32 sp2C; s16 yaw; - if (Cutscene_CheckActorAction(globalCtx, 526)) { - sp2C = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 526)]->action; + if (Cutscene_CheckActorAction(play, 526)) { + sp2C = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 526)]->action; if (this->unk_259 != (sp2C & 0xFF)) { if (sp2C == 3) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); } this->unk_259 = sp2C; - func_8094E054(this, globalCtx, sp50[sp2C]); + func_8094E054(this, play, sp50[sp2C]); } if ((this->unk_259 == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) { @@ -1658,21 +1657,20 @@ void func_80950F2C(EnGm* this, GlobalContext* globalCtx) { } } -void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Init(Actor* thisx, PlayState* play) { EnGm* this = THIS; - if (func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_GM)) { + if (func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_GM)) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, - 20); + SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, 20); this->unk_3E8 = -1; - func_8094E054(this, globalCtx, 0); - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitAndSetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); + func_8094E054(this, play, 0); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.room = -1; @@ -1680,52 +1678,52 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_3FC = 0; this->unk_258 = 0; this->actionFunc = func_80950CDC; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Destroy(Actor* thisx, PlayState* play) { EnGm* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroySphere(globalCtx, &this->colliderSphere); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroySphere(play, &this->colliderSphere); } -void EnGm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Update(Actor* thisx, PlayState* play) { EnGm* this = THIS; - if (!func_8094E0F8(this, globalCtx)) { - if (!func_8094EE84(this, globalCtx) && func_8094EFC4(this, globalCtx)) { - func_80950F2C(this, globalCtx); - func_8094DFF8(this, globalCtx); + if (!func_8094E0F8(this, play)) { + if (!func_8094EE84(this, play) && func_8094EFC4(this, play)) { + func_80950F2C(this, play); + func_8094DFF8(this, play); func_8094E2D0(this); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_8094F53C(this, globalCtx); + func_8094F53C(this, play); if (this->unk_258 != 0) { - func_8094DFF8(this, globalCtx); + func_8094DFF8(this, play); func_8094E2D0(this); func_8094F2E8(this); - func_8013C964(&this->actor, globalCtx, this->unk_3B4, 30.0f, EXCH_ITEM_NONE, this->unk_3A4 & 7); + func_8013C964(&this->actor, play, this->unk_3B4, 30.0f, EXCH_ITEM_NONE, this->unk_3A4 & 7); if ((this->unk_258 != 3) && (this->unk_258 != 5) && (this->unk_258 != 8)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } - func_8094E1DC(this, globalCtx); + func_8094E1DC(this, play); } } } -s32 EnGm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; EnGm* this = THIS; s32 phi_v0; if (limbIndex == 16) { - func_8094F3D0(this, globalCtx); + func_8094F3D0(this, play); } switch (limbIndex) { @@ -1754,7 +1752,7 @@ s32 EnGm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80951E24 = { 1400.0f, 0.0f, 0.0f }; EnGm* this = THIS; s32 pad[4]; @@ -1766,13 +1764,13 @@ void EnGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((limbIndex == 15) && (this->unk_3A4 & 0x800)) { gSPDisplayList(POLY_OPA_DISP++, object_in2_DL_007528); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (limbIndex == 9) { Matrix_MultVec3f(&gZeroVec3f, &sp30); @@ -1780,7 +1778,7 @@ void EnGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnGm* this = THIS; s32 overrideRot = true; s32 stepRot = false; @@ -1821,22 +1819,22 @@ void EnGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnGm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGm_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80951E30[] = { object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828, object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68 }; EnGm* this = THIS; if ((this->unk_258 != 0) && (this->unk_262 >= 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80951E30[this->unk_3CE])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGm_OverrideLimbDraw, EnGm_PostLimbDraw, EnGm_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 1dd161757a..ef70131adc 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -5,9 +5,9 @@ struct EnGm; -typedef void (*EnGmActionFunc)(struct EnGm*, GlobalContext*); -typedef s32 (*EnGmUnkFunc)(struct EnGm*, GlobalContext*); -typedef void (*EnGmUnkFunc2)(struct EnGm*, GlobalContext*); +typedef void (*EnGmActionFunc)(struct EnGm*, PlayState*); +typedef s32 (*EnGmUnkFunc)(struct EnGm*, PlayState*); +typedef void (*EnGmUnkFunc2)(struct EnGm*, PlayState*); #define ENGM_GET_FF(thisx) ((thisx)->params & 0xFF) 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 659473e30e..cb2c96cc51 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -14,20 +14,20 @@ #define THIS ((EnGo*)thisx) -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGo_Update(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 func_80A14798(EnGo* this, GlobalContext* globalCtx); -void func_80A149B0(EnGo* this, GlobalContext* globalCtx); -void func_80A14B30(EnGo* this, GlobalContext* globalCtx); -void func_80A14E14(EnGo* this, GlobalContext* globalCtx); -void func_80A14E74(EnGo* this, GlobalContext* globalCtx); -void func_80A14EB0(EnGo* this, GlobalContext* globalCtx); -void func_80A14FC8(EnGo* this, GlobalContext* globalCtx); -void func_80A153FC(EnGo* this, GlobalContext* globalCtx); -void func_80A157C4(EnGo* this, GlobalContext* globalCtx); -void func_80A15FEC(Actor* thisx, GlobalContext* globalCtx); +void func_80A14798(EnGo* this, PlayState* play); +void func_80A149B0(EnGo* this, PlayState* play); +void func_80A14B30(EnGo* this, PlayState* play); +void func_80A14E14(EnGo* this, PlayState* play); +void func_80A14E74(EnGo* this, PlayState* play); +void func_80A14EB0(EnGo* this, PlayState* play); +void func_80A14FC8(EnGo* this, PlayState* play); +void func_80A153FC(EnGo* this, PlayState* play); +void func_80A157C4(EnGo* this, PlayState* play); +void func_80A15FEC(Actor* thisx, PlayState* play); static s32 D_80A16100[] = { 0x00150800, 0x40010022, 0x00150200, 0x180E0E10, 0x0C0F0E11, 0x0C0F0E12, 0x0C0F0E13, 0x0C0F0E14, 0x0C111502, @@ -233,15 +233,15 @@ EnGoStruct* func_80A10FD0(EnGoStruct* ptr, Vec3f arg1, Vec3f arg2, Vec3f arg3, f return ptr; } -void func_80A11144(EnGoStruct* ptr, GlobalContext* globalCtx) { +void func_80A11144(EnGoStruct* ptr, PlayState* play) { s32 pad; s32 i; s32 flag = false; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 32; i++, ptr++) { @@ -260,23 +260,22 @@ void func_80A11144(EnGoStruct* ptr, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (u8)temp); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (ptr->unk_02 + (i * 3)) * 3, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (ptr->unk_02 + (i * 3)) * 3, (ptr->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(ptr->unk_10.x, ptr->unk_10.y, ptr->unk_10.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_34, ptr->unk_34, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGoronSteamModelDL); Matrix_Pop(); - if (globalCtx->state.gfxCtx) {} + if (play->state.gfxCtx) {} } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80A1143C(EnGoStruct* ptr, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4, f32 arg5, s32 arg6, s32 arg7) { @@ -299,7 +298,7 @@ void func_80A1143C(EnGoStruct* ptr, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4 } } -void func_80A115B4(EnGoStruct* ptr, GlobalContext* globalCtx) { +void func_80A115B4(EnGoStruct* ptr, PlayState* play) { static TexturePtr D_80A16644[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; @@ -317,9 +316,9 @@ void func_80A115B4(EnGoStruct* ptr, GlobalContext* globalCtx) { u8 flag = false; f32 temp; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 32; i++, ptr++) { if ((ptr->unk_00 >= 4) && (ptr->unk_00 < 7)) { @@ -339,19 +338,18 @@ void func_80A115B4(EnGoStruct* ptr, GlobalContext* globalCtx) { Matrix_Translate(ptr->unk_10.x, ptr->unk_10.y, ptr->unk_10.z, MTXMODE_NEW); Matrix_Scale(ptr->unk_34, ptr->unk_34, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A16644[(s32)(temp * 7.0f)])); gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL); Matrix_Pop(); } - if (globalCtx->state.gfxCtx) {} + if (play->state.gfxCtx) {} } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #ifdef NON_MATCHING @@ -450,13 +448,13 @@ void func_80A11BF8(EnGoStruct* ptr, f32 arg1) { } #ifdef NON_MATCHING -void func_80A11EC0(EnGoStruct* ptr, GlobalContext* globalCtx, Gfx* arg2, Gfx* arg3, u8 arg4) { +void func_80A11EC0(EnGoStruct* ptr, PlayState* play, Gfx* arg2, Gfx* arg3, u8 arg4) { s32 i; u8 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < 16; i++, ptr++) { if (ptr->unk_00 == arg4) { @@ -473,7 +471,7 @@ void func_80A11EC0(EnGoStruct* ptr, GlobalContext* globalCtx, Gfx* arg2, Gfx* ar Matrix_RotateYS(ptr->unk_0A.y, MTXMODE_APPLY); if (1) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, arg3); } @@ -482,10 +480,10 @@ void func_80A11EC0(EnGoStruct* ptr, GlobalContext* globalCtx, Gfx* arg2, Gfx* ar } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #else -void func_80A11EC0(EnGoStruct* ptr, GlobalContext* globalCtx, Gfx* arg2, Gfx* arg3, u8 arg4); +void func_80A11EC0(EnGoStruct* ptr, PlayState* play, Gfx* arg2, Gfx* arg3, u8 arg4); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Go/func_80A11EC0.s") #endif @@ -515,19 +513,16 @@ void func_80A1203C(EnGo* this) { } } -void func_80A1213C(EnGo* this, GlobalContext* globalCtx) { - func_80A11EC0(this->unk_3F8, globalCtx, gGoronLargeSnowballFragmentMaterialDL, gGoronLargeSnowballFragmentModelDL, - 1); - func_80A11EC0(this->unk_3F8, globalCtx, gGoronMediumSnowballFragmentMaterialDL, gGoronMediumSnowballFragmentModelDL, - 2); - func_80A11EC0(this->unk_3F8, globalCtx, gGoronSmallSnowballFragmentMaterialDL, gGoronSmallSnowballFragmentModelDL, - 3); - func_80A11144(this->unk_3F8, globalCtx); - func_80A115B4(this->unk_3F8, globalCtx); +void func_80A1213C(EnGo* this, PlayState* play) { + func_80A11EC0(this->unk_3F8, play, gGoronLargeSnowballFragmentMaterialDL, gGoronLargeSnowballFragmentModelDL, 1); + func_80A11EC0(this->unk_3F8, play, gGoronMediumSnowballFragmentMaterialDL, gGoronMediumSnowballFragmentModelDL, 2); + func_80A11EC0(this->unk_3F8, play, gGoronSmallSnowballFragmentMaterialDL, gGoronSmallSnowballFragmentModelDL, 3); + func_80A11144(this->unk_3F8, play); + func_80A115B4(this->unk_3F8, play); } -s32 func_80A121F4(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A121F4(PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->transformation == PLAYER_FORM_GORON) && (player->stateFlags3 & 0x2000000)) { return false; @@ -535,14 +530,14 @@ s32 func_80A121F4(GlobalContext* globalCtx) { return true; } -s32 func_80A1222C(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A1222C(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; - if (((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.ocarinaMode == 3) && - (globalCtx->msgCtx.unk1202E == 1) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || - (!(gSaveContext.save.weekEventReg[22] & 4) && (globalCtx->sceneNum == SCENE_16GORON_HOUSE) && - (gSaveContext.sceneSetupIndex == 0) && (this->unk_3EC == 0) && (globalCtx->csCtx.currentCsIndex == 1))) { + if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && + (play->msgCtx.unk1202E == 1) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || + (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneNum == SCENE_16GORON_HOUSE) && + (gSaveContext.sceneSetupIndex == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { ret = true; } return ret; @@ -570,7 +565,7 @@ s32 func_80A122EC(EnGo* this) { return false; } -void func_80A123A0(EnGo* this, GlobalContext* globalCtx) { +void func_80A123A0(EnGo* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); @@ -584,21 +579,21 @@ void func_80A123A0(EnGo* this, GlobalContext* globalCtx) { this->colliderSphere.dim.worldSphere.radius = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; - if (func_80A121F4(globalCtx)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + if (func_80A121F4(play)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSphere.base); } - 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 func_80A124A0(EnGo* this, GlobalContext* globalCtx) { +void func_80A124A0(EnGo* this, PlayState* play) { this->colliderSphere.dim.worldSphere.radius = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void func_80A124FC(EnGo* this, GlobalContext* globalCtx) { +void func_80A124FC(EnGo* this, PlayState* play) { Vec3f sp1C; Math_Vec3f_Copy(&sp1C, &this->actor.world.pos); @@ -612,10 +607,10 @@ void func_80A124FC(EnGo* this, GlobalContext* globalCtx) { this->colliderSphere.dim.worldSphere.radius = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); } -void func_80A125BC(EnGo* this, GlobalContext* globalCtx) { +void func_80A125BC(EnGo* this, PlayState* play) { s32 pad; Math_Vec3f_ToVec3s(&this->colliderCylinder.dim.pos, &this->actor.world.pos); @@ -624,21 +619,21 @@ void func_80A125BC(EnGo* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.height = 78; if (this->unk_3C6 == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } - 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); } -void func_80A12660(EnGo* this, GlobalContext* globalCtx) { +void func_80A12660(EnGo* this, PlayState* play) { Math_Vec3f_ToVec3s(&this->colliderCylinder.dim.pos, &this->actor.world.pos); this->colliderCylinder.dim.radius = 24; this->colliderCylinder.dim.height = 62; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } -void func_80A126BC(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A126BC(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags2 & 0x4000)) { if (this->unk_3C6 != 0) { @@ -647,20 +642,20 @@ void func_80A126BC(EnGo* this, GlobalContext* globalCtx) { } if (ENGO_GET_F(&this->actor) == ENGO_F_8) { - func_80A124A0(this, globalCtx); + func_80A124A0(this, play); } else if (this->unk_390 & 0x100) { - func_80A123A0(this, globalCtx); + func_80A123A0(this, play); } else if (this->unk_390 & 0x200) { - func_80A124FC(this, globalCtx); + func_80A124FC(this, play); } else if (this->unk_390 & 0x400) { - func_80A125BC(this, globalCtx); + func_80A125BC(this, play); } else { - func_80A12660(this, globalCtx); + func_80A12660(this, play); } } -s32 func_80A12774(EnGo* this, GlobalContext* globalCtx) { - if (!(this->unk_390 & 7) || !Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +s32 func_80A12774(EnGo* this, PlayState* play) { + if (!(this->unk_390 & 7) || !Actor_ProcessTalkRequest(&this->actor, &play->state)) { return false; } @@ -685,7 +680,7 @@ s32 func_80A12774(EnGo* this, GlobalContext* globalCtx) { return true; } -s32 func_80A12868(EnGo* this, GlobalContext* globalCtx) { +s32 func_80A12868(EnGo* this, PlayState* play) { this->unk_390 &= ~0x800; this->unk_390 &= ~0x1000; this->unk_390 &= ~0x2000; @@ -712,10 +707,10 @@ s32 func_80A12868(EnGo* this, GlobalContext* globalCtx) { return false; } -s32 func_80A12954(EnGo* this, GlobalContext* globalCtx) { - if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (globalCtx->csCtx.state != 0) && (this->actor.draw != NULL) && - (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.currentCsIndex == 0)) { +s32 func_80A12954(EnGo* this, PlayState* play) { + if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != 0) && (this->actor.draw != NULL) && + (play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (play->csCtx.currentCsIndex == 0)) { if (this->unk_3F0 == 0) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_394 = 255; @@ -735,7 +730,7 @@ s32 func_80A12954(EnGo* this, GlobalContext* globalCtx) { return false; } -s32 func_80A12A64(EnGo* this, GlobalContext* globalCtx) { +s32 func_80A12A64(EnGo* this, PlayState* play) { s8 objIdx = this->actor.objBankIndex; s8 objIdx2 = -1; s32 ret = 0; @@ -749,17 +744,17 @@ s32 func_80A12A64(EnGo* this, GlobalContext* globalCtx) { } if (objIdx2 >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objIdx2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objIdx2].segment); this->skelAnime.playSpeed = this->unk_398; ret = SkelAnime_Update(&this->skelAnime); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objIdx].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objIdx].segment); } return ret; } -s32 func_80A12B78(EnGo* this, GlobalContext* globalCtx) { - if (globalCtx->csCtx.state == 0) { +s32 func_80A12B78(EnGo* this, PlayState* play) { + if (play->csCtx.state == 0) { if (this->unk_3DC == 4) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_CIRCLE); @@ -781,7 +776,7 @@ s32 func_80A12B78(EnGo* this, GlobalContext* globalCtx) { return 0; } -s32 func_80A12C48(EnGo* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80A12C48(EnGo* this, PlayState* play, s32 arg2) { s8 objIdx = this->actor.objBankIndex; s8 objIdx2 = -1; s32 ret = false; @@ -795,11 +790,11 @@ s32 func_80A12C48(EnGo* this, GlobalContext* globalCtx, s32 arg2) { } if (objIdx2 >= 0) { - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objIdx2].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objIdx2].segment); this->unk_3DC = arg2; ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); this->unk_398 = this->skelAnime.playSpeed; - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[objIdx].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[objIdx].segment); } return ret; @@ -815,19 +810,19 @@ void func_80A12D6C(EnGo* this) { } } -void func_80A12DF4(EnGo* this, GlobalContext* globalCtx) { +void func_80A12DF4(EnGo* this, PlayState* play) { if (this->unk_3D4 == 0) { - func_80A12C48(this, globalCtx, 9); + func_80A12C48(this, play, 9); this->unk_3D4++; } else if ((this->unk_3D4 == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A12C48(this, globalCtx, 6); + func_80A12C48(this, play, 6); this->unk_3D4++; } } -s32 func_80A12E80(EnGo* this, GlobalContext* globalCtx) { - u16 temp = globalCtx->msgCtx.currentTextId; - Player* player = GET_PLAYER(globalCtx); +s32 func_80A12E80(EnGo* this, PlayState* play) { + u16 temp = play->msgCtx.currentTextId; + Player* player = GET_PLAYER(play); if (ENGO_GET_F(&this->actor) != ENGO_F_4) { return false; @@ -844,7 +839,7 @@ s32 func_80A12E80(EnGo* this, GlobalContext* globalCtx) { case 0xE1D: case 0xE25: if (ENGO_GET_70(&this->actor) == ENGO_70_1) { - this->unk_38C = &GET_PLAYER(globalCtx)->actor; + this->unk_38C = &GET_PLAYER(play)->actor; } break; @@ -860,7 +855,7 @@ s32 func_80A12E80(EnGo* this, GlobalContext* globalCtx) { case 0xE1F: if (ENGO_GET_70(&this->actor) == ENGO_70_0) { - this->unk_38C = &GET_PLAYER(globalCtx)->actor; + this->unk_38C = &GET_PLAYER(play)->actor; } break; } @@ -871,18 +866,18 @@ s32 func_80A12E80(EnGo* this, GlobalContext* globalCtx) { this->unk_3F4 = 0; this->unk_190 = NULL; this->unk_392 = 0; - func_80A12C48(this, globalCtx, 5); + func_80A12C48(this, play, 5); this->unk_390 &= ~8; } if (this->unk_190 != NULL) { - this->unk_190(this, globalCtx); + this->unk_190(this, play); } return false; } -s32 func_80A12FE8(EnGo* this, GlobalContext* globalCtx) { +s32 func_80A12FE8(EnGo* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; @@ -915,17 +910,17 @@ s32 func_80A12FE8(EnGo* this, GlobalContext* globalCtx) { return false; } -s32 func_80A131F8(EnGo* this, GlobalContext* globalCtx) { +s32 func_80A131F8(EnGo* this, PlayState* play) { if (this->unk_3F4 == 0) { - this->unk_38C = &GET_PLAYER(globalCtx)->actor; + this->unk_38C = &GET_PLAYER(play)->actor; } - func_80A12E80(this, globalCtx); + func_80A12E80(this, play); if (this->unk_390 & 8) { this->unk_390 &= ~0x40; this->unk_390 |= 0x10; - func_80A12FE8(this, globalCtx); + func_80A12FE8(this, play); } else if (this->unk_390 & 0x10) { this->unk_390 &= ~0x10; this->unk_3B0 = 0; @@ -941,8 +936,8 @@ s32 func_80A131F8(EnGo* this, GlobalContext* globalCtx) { return true; } -void func_80A132C8(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A132C8(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v1 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); if ((fabsf(this->actor.playerHeightRel) > 20.0f) || (this->actor.xzDistToPlayer > 300.0f)) { @@ -955,7 +950,7 @@ void func_80A132C8(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A133A8(EnGo* this, GlobalContext* globalCtx) { +void func_80A133A8(EnGo* this, PlayState* play) { if (gSaveContext.save.weekEventReg[21] & 8) { SubS_UpdateFlags(&this->unk_390, 3, 7); } else { @@ -963,12 +958,12 @@ void func_80A133A8(EnGo* this, GlobalContext* globalCtx) { } } -Actor* func_80A13400(EnGo* this, GlobalContext* globalCtx) { +Actor* func_80A13400(EnGo* this, PlayState* play) { Actor* actor; Actor* retActor = NULL; while (true) { - actor = SubS_FindActor(globalCtx, retActor, ACTORCAT_NPC, ACTOR_EN_GO); + actor = SubS_FindActor(play, retActor, ACTORCAT_NPC, ACTOR_EN_GO); retActor = actor; if ((actor != NULL) && ((EnGo*)actor != this) && (ENGO_GET_F(actor) == ENGO_F_4) && @@ -990,8 +985,8 @@ Actor* func_80A13400(EnGo* this, GlobalContext* globalCtx) { return NULL; } -void func_80A134B0(EnGo* this, GlobalContext* globalCtx, s32 arg2) { - if ((gSaveContext.save.weekEventReg[18] & 0x80) || (globalCtx->actorCtx.unk5 & 1) || arg2) { +void func_80A134B0(EnGo* this, PlayState* play, s32 arg2) { + if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.unk5 & 1) || arg2) { this->colliderSphere.dim.modelSphere.radius = 300; } else { this->colliderSphere.dim.modelSphere.radius = 380; @@ -1049,46 +1044,46 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) { return ret; } -void func_80A136B8(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { - s16 sp26 = Quake_Add(Play_GetCamera(globalCtx, CAM_ID_MAIN), 3); +void func_80A136B8(PlayState* play, s16 arg1, s16 arg2, s16 arg3) { + s16 sp26 = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); Quake_SetCountdown(sp26, arg3); Quake_SetSpeed(sp26, arg1); Quake_SetQuakeValues(sp26, arg2, 0, 0, 0); } -void func_80A13728(EnGo* this, GlobalContext* globalCtx) { - func_80A136B8(globalCtx, 0x6C77, 7, 20); - globalCtx->actorCtx.unk2 = 4; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, +void func_80A13728(EnGo* this, PlayState* play) { + func_80A136B8(play, 0x6C77, 7, 20); + play->actorCtx.unk2 = 4; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); - EffectSsBlast_SpawnWhiteShockwave(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f); + EffectSsBlast_SpawnWhiteShockwave(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f); } -void func_80A137C0(EnGo* this, GlobalContext* globalCtx, f32 arg2, f32 arg3) { +void func_80A137C0(EnGo* this, PlayState* play, f32 arg2, f32 arg3) { u32 frames1; u32 frames2; if (this->unk_390 & 0x400) { Matrix_Push(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(arg2 * 0.7f, arg2 * 0.8f, arg2, MTXMODE_APPLY); - func_800B8118(&this->actor, globalCtx, 0); + func_800B8118(&this->actor, play, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - frames1 = globalCtx->gameplayFrames % 256; - frames2 = (globalCtx->gameplayFrames * 2) % 256; + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + frames1 = play->gameplayFrames % 256; + frames2 = (play->gameplayFrames * 2) % 256; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)arg3); gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_050D10); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_Pop(); } @@ -1108,8 +1103,8 @@ void func_80A139E4(EnGo* this) { func_80A10FD0(&this->unk_3F8[16], sp48, D_80A16698, gZeroVec3f, 0.01f, 0.002f, 16); } -s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A13B1C(EnGo* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s32 ret = false; @@ -1149,7 +1144,7 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { switch (this->unk_3C4) { case 1: - func_80A12C48(this, globalCtx, 4); + func_80A12C48(this, play, 4); this->unk_390 |= 0x4000; this->unk_3C4++; break; @@ -1178,7 +1173,7 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { case 4: if (func_80A13564(this, 10.0f, 0.004f, 6)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_LAND_BIG); - func_80A13728(this, globalCtx); + func_80A13728(this, play); this->unk_3C4++; this->unk_3C2 = 0; gSaveContext.save.weekEventReg[88] |= 0x40; @@ -1188,7 +1183,7 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { case 5: this->unk_3C2++; if (this->unk_3C2 >= 10) { - func_80A12C48(this, globalCtx, 5); + func_80A12C48(this, play, 5); this->actor.shape.rot.x = 0; this->unk_390 &= ~0x200; this->unk_390 |= 0x80; @@ -1225,7 +1220,7 @@ s32 func_80A13B1C(EnGo* this, GlobalContext* globalCtx) { return ret; } -s32 func_80A13E80(EnGo* this, GlobalContext* globalCtx) { +s32 func_80A13E80(EnGo* this, PlayState* play) { static Vec3f D_80A166A4 = { 0.0f, 200.0f, 280.0f }; s32 pad; Vec3f sp48; @@ -1240,7 +1235,7 @@ s32 func_80A13E80(EnGo* this, GlobalContext* globalCtx) { break; case 1: - func_80A12C48(this, globalCtx, 7); + func_80A12C48(this, play, 7); this->unk_3C0++; case 2: @@ -1249,11 +1244,11 @@ s32 func_80A13E80(EnGo* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A12C48(this, globalCtx, 1); + func_80A12C48(this, play, 1); Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80A166A4, &sp48); gSaveContext.powderKegTimer = 2400; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, sp48.x, sp48.y, sp48.z, 1, 0, 0, 0); - func_80A134B0(this, globalCtx, 1); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, sp48.x, sp48.y, sp48.z, 1, 0, 0, 0); + func_80A134B0(this, play, 1); this->unk_3C2 = 0; this->unk_3C0++; } @@ -1274,7 +1269,7 @@ s32 func_80A13E80(EnGo* this, GlobalContext* globalCtx) { return ret; } -void func_80A14018(EnGo* this, GlobalContext* globalCtx) { +void func_80A14018(EnGo* this, PlayState* play) { static Vec3f D_80A166B0 = { 0.0f, 0.0f, 40.0f }; static s32 D_80A166BC[] = { 11, 10, 12, 13, 14, 17 }; Vec3f sp2C; @@ -1284,7 +1279,7 @@ void func_80A14018(EnGo* this, GlobalContext* globalCtx) { phi_v0 = ((gSaveContext.eventInf[2] & 0xF) + phi_v0) % 4; } - func_80A12C48(this, globalCtx, D_80A166BC[phi_v0]); + func_80A12C48(this, play, D_80A166BC[phi_v0]); if (this->unk_3DC == 14) { Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80A166B0, &sp2C); @@ -1298,11 +1293,11 @@ void func_80A14018(EnGo* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; } -void func_80A14104(EnGo* this, GlobalContext* globalCtx) { +void func_80A14104(EnGo* this, PlayState* play) { static s32 D_80A166D4[] = { 15, 16 }; s16 temp; - func_80A12C48(this, globalCtx, D_80A166D4[ENGO_GET_70(&this->actor) % 2]); + func_80A12C48(this, play, D_80A166D4[ENGO_GET_70(&this->actor) % 2]); temp = Rand_ZeroOne() * this->skelAnime.endFrame; this->skelAnime.curFrame = temp; this->actor.flags &= ~ACTOR_FLAG_1; @@ -1314,11 +1309,11 @@ void func_80A14104(EnGo* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; } -void func_80A141D4(EnGo* this, GlobalContext* globalCtx) { - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit1); +void func_80A141D4(EnGo* this, PlayState* play) { + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit1); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_3DC = -1; - func_80A12C48(this, globalCtx, 5); + func_80A12C48(this, play, 5); this->unk_3EC = 0; this->unk_39C = (this->unk_3A4 / 0.01f) * 0.9f; this->unk_3BE = 2; @@ -1328,7 +1323,7 @@ void func_80A141D4(EnGo* this, GlobalContext* globalCtx) { this->unk_3A0 = 100.0f; } -void func_80A1428C(EnGo* this, GlobalContext* globalCtx) { +void func_80A1428C(EnGo* this, PlayState* play) { s16 temp; Vec3f sp30; Vec3f sp24; @@ -1347,8 +1342,8 @@ void func_80A1428C(EnGo* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void func_80A14324(EnGo* this, GlobalContext* globalCtx) { - func_80A12C48(this, globalCtx, 8); +void func_80A14324(EnGo* this, PlayState* play) { + func_80A12C48(this, play, 8); Actor_SetScale(&this->actor, this->unk_3A4); this->unk_390 = 0; this->actor.gravity = -1.0f; @@ -1361,8 +1356,8 @@ void func_80A14324(EnGo* this, GlobalContext* globalCtx) { this->unk_3A0 = 0.0f; } -void func_80A143A8(EnGo* this, GlobalContext* globalCtx) { - func_80A12C48(this, globalCtx, 5); +void func_80A143A8(EnGo* this, PlayState* play) { + func_80A12C48(this, play, 5); Actor_SetScale(&this->actor, this->unk_3A4); this->unk_390 = 0; this->actor.gravity = -1.0f; @@ -1376,69 +1371,69 @@ void func_80A143A8(EnGo* this, GlobalContext* globalCtx) { this->unk_3A0 = 0.0f; } -void func_80A14430(EnGo* this, GlobalContext* globalCtx) { +void func_80A14430(EnGo* this, PlayState* play) { if (((gSaveContext.save.entranceIndex == 0xD000) || (gSaveContext.save.entranceIndex == 0xD020)) && (gSaveContext.save.weekEventReg[33] & 0x80)) { - func_80A14018(this, globalCtx); + func_80A14018(this, play); this->actionFunc = func_80A149B0; } else { Actor_MarkForDeath(&this->actor); } } -void func_80A1449C(EnGo* this, GlobalContext* globalCtx) { +void func_80A1449C(EnGo* this, PlayState* play) { if ((gSaveContext.save.entranceIndex == 0xD010) || (gSaveContext.save.entranceIndex == 0x1C00)) { - func_80A14104(this, globalCtx); + func_80A14104(this, play); this->actionFunc = func_80A149B0; } else { Actor_MarkForDeath(&this->actor); } } -void func_80A144F4(EnGo* this, GlobalContext* globalCtx) { +void func_80A144F4(EnGo* this, PlayState* play) { if (gSaveContext.save.day >= 2) { - this->unk_284 = SubS_GetDayDependentPath(globalCtx, ENGO_GET_7F80(&this->actor), 0xFF, &this->unk_3E4); + this->unk_284 = SubS_GetDayDependentPath(play, ENGO_GET_7F80(&this->actor), 0xFF, &this->unk_3E4); if (this->unk_284 != NULL) { this->unk_3E4 = 1; } - func_80A1428C(this, globalCtx); + func_80A1428C(this, play); this->actionFunc = func_80A153FC; this->unk_3D8 = func_80A13B1C; } else { - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); this->actionFunc = func_80A149B0; this->unk_3D8 = func_80A13B1C; } } -void func_80A145AC(EnGo* this, GlobalContext* globalCtx) { +void func_80A145AC(EnGo* this, PlayState* play) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && - (((globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.currentCsIndex == 0)) || + (((play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (play->csCtx.currentCsIndex == 0)) || !(gSaveContext.save.weekEventReg[21] & 8))) { - this->actor.child = func_80A13400(this, globalCtx); + this->actor.child = func_80A13400(this, play); this->actor.child->child = &this->actor; - func_80A141D4(this, globalCtx); + func_80A141D4(this, play); this->actionFunc = func_80A14E14; } else { - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); this->actionFunc = func_80A149B0; } } -void func_80A14668(EnGo* this, GlobalContext* globalCtx) { +void func_80A14668(EnGo* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[22] & 4)) { - func_80A14324(this, globalCtx); + func_80A14324(this, play); this->actionFunc = func_80A149B0; } else { - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); this->actionFunc = func_80A149B0; } } -void func_80A146CC(EnGo* this, GlobalContext* globalCtx) { - func_80A134B0(this, globalCtx, 0); - func_80A12C48(this, globalCtx, 0); +void func_80A146CC(EnGo* this, PlayState* play) { + func_80A134B0(this, play, 0); + func_80A12C48(this, play, 0); this->unk_3A4 *= 5.0f; Actor_SetScale(&this->actor, this->unk_3A4); this->actor.flags &= ~ACTOR_FLAG_1; @@ -1452,27 +1447,27 @@ void func_80A146CC(EnGo* this, GlobalContext* globalCtx) { this->actionFunc = func_80A149B0; } -void func_80A14798(EnGo* this, GlobalContext* globalCtx) { +void func_80A14798(EnGo* this, PlayState* play) { EffectTireMarkInit sp38 = { 0, 62, { 0, 0, 15, 100 }, }; - if ((this->unk_288 < 0) || SubS_IsObjectLoaded(this->unk_288, globalCtx) || (this->unk_289 < 0) || - SubS_IsObjectLoaded(this->unk_289, globalCtx)) { + if ((this->unk_288 < 0) || SubS_IsObjectLoaded(this->unk_288, play) || (this->unk_289 < 0) || + SubS_IsObjectLoaded(this->unk_289, play)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); this->unk_3DC = -1; - func_80A12C48(this, globalCtx, 2); + func_80A12C48(this, play, 2); this->actor.draw = func_80A15FEC; - Collider_InitAndSetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit2); + Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Effect_Add(globalCtx, &this->unk_3E8, EFFECT_TIRE_MARK, 0, 0, &sp38); + Effect_Add(play, &this->unk_3E8, EFFECT_TIRE_MARK, 0, 0, &sp38); this->actor.targetMode = 1; this->unk_3A4 = 0.01f; @@ -1480,29 +1475,29 @@ void func_80A14798(EnGo* this, GlobalContext* globalCtx) { switch (ENGO_GET_F(&this->actor)) { case ENGO_F_1: - func_80A14430(this, globalCtx); + func_80A14430(this, play); break; case ENGO_F_2: - func_80A1449C(this, globalCtx); + func_80A1449C(this, play); break; case ENGO_F_3: - func_80A144F4(this, globalCtx); + func_80A144F4(this, play); break; case ENGO_F_4: - func_80A145AC(this, globalCtx); + func_80A145AC(this, play); break; case ENGO_F_5: case ENGO_F_6: case ENGO_F_7: - func_80A14668(this, globalCtx); + func_80A14668(this, play); break; case ENGO_F_8: - func_80A146CC(this, globalCtx); + func_80A146CC(this, play); break; default: @@ -1512,24 +1507,24 @@ void func_80A14798(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A149B0(EnGo* this, GlobalContext* globalCtx) { +void func_80A149B0(EnGo* this, PlayState* play) { s16 sp26 = this->actor.world.rot.y; if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.save.entranceIndex == 0xD010)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); } else if (ENGO_GET_F(&this->actor) != ENGO_F_8) { - if (func_80A1222C(this, globalCtx)) { + if (func_80A1222C(this, play)) { SubS_UpdateFlags(&this->unk_390, 0, 7); this->unk_3EC = 1; this->actionFunc = func_80A14B30; } else if (ENGO_GET_F(&this->actor) == ENGO_F_4) { switch (ENGO_GET_70(&this->actor)) { case ENGO_70_0: - func_80A132C8(this, globalCtx); + func_80A132C8(this, play); break; case ENGO_70_1: - func_80A133A8(this, globalCtx); + func_80A133A8(this, play); break; } } else if (ENGO_GET_F(&this->actor) == ENGO_F_1) { @@ -1543,11 +1538,11 @@ void func_80A149B0(EnGo* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, sp26, 4, 0x2AA8); } -void func_80A14B30(EnGo* this, GlobalContext* globalCtx) { +void func_80A14B30(EnGo* this, PlayState* play) { s16 sp26 = this->actor.world.rot.y; u16 sfxId; - if (func_80A1222C(this, globalCtx)) { + if (func_80A1222C(this, play)) { this->unk_3EC = 1; } @@ -1567,7 +1562,7 @@ void func_80A14B30(EnGo* this, GlobalContext* globalCtx) { } } else if (this->unk_390 & 0x200) { if ((this->actor.xzDistToPlayer < 160.0f) && (this->actor.playerHeightRel < 20.0f) && (this->unk_3EC == 0)) { - func_80A12C48(this, globalCtx, 3); + func_80A12C48(this, play, 3); this->unk_390 &= ~0x80; this->unk_390 &= ~0x200; this->unk_390 |= 0x8000; @@ -1591,18 +1586,18 @@ void func_80A14B30(EnGo* this, GlobalContext* globalCtx) { } } else if ((this->actor.xzDistToPlayer >= 240.0f) || (this->actor.playerHeightRel >= 20.0f) || (this->unk_3EC != 0)) { - func_80A12C48(this, globalCtx, 4); + func_80A12C48(this, play, 4); this->unk_390 &= ~0x80; this->unk_390 &= ~0x200; this->unk_390 |= 0x4000; this->actor.shape.yOffset = 0.0f; } - SubS_FillLimbRotTables(globalCtx, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); + SubS_FillLimbRotTables(play, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); Math_ApproachS(&this->actor.shape.rot.y, sp26, 4, 0x2AA8); } -void func_80A14E14(EnGo* this, GlobalContext* globalCtx) { +void func_80A14E14(EnGo* this, PlayState* play) { Actor* actor = this->colliderCylinder.base.ac; if ((this->unk_390 & 0x1000) && (((actor != NULL) && (actor->id == ACTOR_OBJ_AQUA) && (actor->params & 1)) || @@ -1611,13 +1606,13 @@ void func_80A14E14(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A14E74(EnGo* this, GlobalContext* globalCtx) { +void func_80A14E74(EnGo* this, PlayState* play) { if (func_80A134F4(this, this->actor.cutscene)) { this->actionFunc = func_80A14EB0; } } -void func_80A14EB0(EnGo* this, GlobalContext* globalCtx) { +void func_80A14EB0(EnGo* this, PlayState* play) { EnGo* sp24 = (EnGo*)this->actor.child; if ((s32)(this->unk_39C * 3.0f) != 0) { @@ -1627,17 +1622,17 @@ void func_80A14EB0(EnGo* this, GlobalContext* globalCtx) { func_80A139E4(this); } else { ActorCutscene_Stop(this->actor.cutscene); - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (ENGO_GET_70(&this->actor) == ENGO_70_1)) { SubS_UpdateFlags(&this->unk_390, 4, 7); - func_80A143A8(sp24, globalCtx); + func_80A143A8(sp24, play); sp24->actionFunc = func_80A149B0; } this->actionFunc = func_80A149B0; } } -void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { +void func_80A14FC8(EnGo* this, PlayState* play) { s32 sp38[] = { 0, 2, 6, 20, 18, 5, 5, 15, }; @@ -1656,13 +1651,13 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { } if ((actorActionCmd == 128) || (actorActionCmd == 129)) { - if (Cutscene_CheckActorAction(globalCtx, actorActionCmd)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, actorActionCmd); - sp30 = globalCtx->csCtx.actorActions[actionIndex]->action; + if (Cutscene_CheckActorAction(play, actorActionCmd)) { + actionIndex = Cutscene_GetActorActionIndex(play, actorActionCmd); + sp30 = play->csCtx.actorActions[actionIndex]->action; if (this->unk_394 != (u8)sp30) { this->unk_394 = sp30; - func_80A12C48(this, globalCtx, sp38[sp30]); + func_80A12C48(this, play, sp38[sp30]); this->unk_390 = 0; this->unk_390 |= 0x20; this->unk_3BE = 0; @@ -1677,7 +1672,7 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { case 5: case 6: - func_80A141D4(this, globalCtx); + func_80A141D4(this, play); break; } } @@ -1685,13 +1680,13 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { switch (this->unk_394) { case 3: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->unk_3DC == 20)) { - func_80A12C48(this, globalCtx, 21); + func_80A12C48(this, play, 21); } break; case 4: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->unk_3DC == 18)) { - func_80A12C48(this, globalCtx, 19); + func_80A12C48(this, play, 19); } break; @@ -1702,13 +1697,13 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { this->unk_3A0 = (this->unk_39C / 0.9f) * 100.0f; func_80A139E4(this); } else if (this->unk_390 & 0x400) { - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); } break; } if (actorActionCmd == 128) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 55: case 100: case 130: @@ -1732,7 +1727,7 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { break; } } else if (actorActionCmd == 129) { - switch (globalCtx->csCtx.frames) { + switch (play->csCtx.frames) { case 360: case 390: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); @@ -1752,13 +1747,13 @@ void func_80A14FC8(EnGo* this, GlobalContext* globalCtx) { } } - SubS_FillLimbRotTables(globalCtx, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + SubS_FillLimbRotTables(play, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } } } -void func_80A153FC(EnGo* this, GlobalContext* globalCtx) { +void func_80A153FC(EnGo* this, PlayState* play) { Vec3s* sp5C; Vec3f sp50; Vec3f sp44; @@ -1776,16 +1771,16 @@ void func_80A153FC(EnGo* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); if (gSaveContext.save.day == 3) { - func_80A141D4(this, globalCtx); + func_80A141D4(this, play); this->actionFunc = func_80A14E14; } else { - func_80A143A8(this, globalCtx); + func_80A143A8(this, play); this->actionFunc = func_80A149B0; } } else if (this->unk_284 != NULL) { if (this->unk_390 & 0x800) { - func_800B8E58(GET_PLAYER(globalCtx), NA_SE_PL_BODY_HIT); - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8E58(GET_PLAYER(play), NA_SE_PL_BODY_HIT); + func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); } sp5C = Lib_SegmentedToVirtual(this->unk_284->points); @@ -1804,7 +1799,7 @@ void func_80A153FC(EnGo* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG); - func_800AE930(&globalCtx->colCtx, Effect_GetByIndex(this->unk_3E8), &this->actor.world.pos, 18.0f, + func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_3E8), &this->actor.world.pos, 18.0f, this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } else { func_800AEF44(Effect_GetByIndex(this->unk_3E8)); @@ -1816,7 +1811,7 @@ void func_80A153FC(EnGo* this, GlobalContext* globalCtx) { } } -s32* func_80A15684(EnGo* this, GlobalContext* globalCtx) { +s32* func_80A15684(EnGo* this, PlayState* play) { static s32 D_80A16704[] = { D_80A16100, D_80A16164, @@ -1861,18 +1856,18 @@ s32* func_80A15684(EnGo* this, GlobalContext* globalCtx) { } } -void func_80A157C4(EnGo* this, GlobalContext* globalCtx) { +void func_80A157C4(EnGo* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; - if (!func_8010BF58(&this->actor, globalCtx, func_80A15684(this, globalCtx), this->unk_3D8, &this->unk_28C)) { + if (!func_8010BF58(&this->actor, play, func_80A15684(this, play), this->unk_3D8, &this->unk_28C)) { if ((ENGO_GET_F(&this->actor) != ENGO_F_1) && !(this->unk_390 & 0x200)) { Math_Vec3f_Copy(&sp40, &this->unk_38C->world.pos); Math_Vec3f_Copy(&sp34, &this->actor.world.pos); Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp34, &sp40), 4, 0x2AA8); } - SubS_FillLimbRotTables(globalCtx, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); + SubS_FillLimbRotTables(play, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); return; } @@ -1890,38 +1885,38 @@ void func_80A157C4(EnGo* this, GlobalContext* globalCtx) { this->actionFunc = this->unk_18C; } -void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Init(Actor* thisx, PlayState* play) { EnGo* this = THIS; - this->unk_288 = SubS_GetObjectIndex(OBJECT_TAISOU, globalCtx); - this->unk_289 = SubS_GetObjectIndex(OBJECT_HAKUGIN_DEMO, globalCtx); + this->unk_288 = SubS_GetObjectIndex(OBJECT_TAISOU, play); + this->unk_289 = SubS_GetObjectIndex(OBJECT_HAKUGIN_DEMO, play); this->actionFunc = func_80A14798; } -void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Destroy(Actor* thisx, PlayState* play) { EnGo* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroySphere(globalCtx, &this->colliderSphere); - Effect_Destroy(globalCtx, this->unk_3E8); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroySphere(play, &this->colliderSphere); + Effect_Destroy(play, this->unk_3E8); } -void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGo_Update(Actor* thisx, PlayState* play) { EnGo* this = THIS; f32 phi_f0; - func_80A12868(this, globalCtx); - if (!func_80A12774(this, globalCtx)) { - func_80A12954(this, globalCtx); + func_80A12868(this, play); + if (!func_80A12774(this, play)) { + func_80A12954(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->unk_390 & 0x400)) { func_80A12D6C(this); - func_80A12A64(this, globalCtx); - func_80A131F8(this, globalCtx); - func_80A12B78(this, globalCtx); + func_80A12A64(this, play); + func_80A131F8(this, play); + func_80A12B78(this, play); } if (!(this->unk_390 & 0x100) && !(this->unk_390 & 0x200) && !(this->unk_390 & 0x400)) { @@ -1930,28 +1925,28 @@ void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) { } else { phi_f0 = this->colliderCylinder.dim.radius + 40; } - func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); + func_8013C964(&this->actor, play, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); } else if ((this->unk_390 & 0x200) && (this->unk_3EC != 0)) { phi_f0 = this->colliderCylinder.dim.radius + 40; - func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); + func_8013C964(&this->actor, play, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); } if ((ENGO_GET_F(&this->actor) != ENGO_F_8) && (ENGO_GET_F(&this->actor) != ENGO_F_2) && (ENGO_GET_F(&this->actor) != ENGO_F_1)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } func_80A122EC(this); - func_80A126BC(this, globalCtx); + func_80A126BC(this, play); func_80A1203C(this); } -void func_80A15B80(EnGo* this, GlobalContext* globalCtx) { +void func_80A15B80(EnGo* this, PlayState* play) { Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + this->actor.shape.yOffset, this->actor.world.pos.z, MTXMODE_NEW); @@ -1968,13 +1963,13 @@ void func_80A15B80(EnGo* this, GlobalContext* globalCtx) { Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (this->unk_390 & 0x100) ? gGoronSnowballDL : gGoronRolledUpDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGo* this = THIS; Vec3f sp30; s32 idx; @@ -2010,7 +2005,7 @@ s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnGo_TransfromLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnGo_TransfromLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnGo* this = THIS; u16 temp_v0; s32 stepRot; @@ -2060,30 +2055,30 @@ void EnGo_TransfromLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void func_80A15FEC(Actor* thisx, GlobalContext* globalCtx) { +void func_80A15FEC(Actor* thisx, PlayState* play) { static TexturePtr D_80A1670C[] = { gGoronEyeOpenTex, gGoronEyeHalfTex, gGoronEyeClosedTex, gGoronEyeHalfTex, gGoronEyeClosed2Tex, }; EnGo* this = THIS; if (!(this->unk_390 & 0x300)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A1670C[this->unk_3BE])); if (this->unk_3DC == 14) { Matrix_Translate(0.0f, 0.0f, -4000.0f, MTXMODE_APPLY); } - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGo_OverrideLimbDraw, NULL, EnGo_TransfromLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - func_80A15B80(this, globalCtx); + func_80A15B80(this, play); } - func_80A137C0(this, globalCtx, this->unk_39C, this->unk_3A0); - func_80A1213C(this, globalCtx); + func_80A137C0(this, play, this->unk_39C, this->unk_3A0); + func_80A1213C(this, play); } 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 ab7f068e15..0588141077 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -5,7 +5,7 @@ struct EnGo; -typedef void (*EnGoActionFunc)(struct EnGo*, GlobalContext*); +typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); #define ENGO_GET_F(thisx) (((thisx)->params & 0xF) & 0xFF) #define ENGO_GET_70(thisx) ((((thisx)->params & 0x70) >> 4) & 0xFF) 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 e4b8225468..0cddfab726 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -12,25 +12,25 @@ #define THIS ((EnGoroiwa*)thisx) -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 func_809419D0(EnGoroiwa* this); -void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941A10(EnGoroiwa* this, PlayState* play); void func_809421E0(EnGoroiwa* this); -void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx); +void func_8094220C(EnGoroiwa* this, PlayState* play); void func_809425CC(EnGoroiwa* this); -void func_80942604(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80942604(EnGoroiwa* this, PlayState* play); void func_80941DB4(EnGoroiwa* this); -void func_80941E28(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941E28(EnGoroiwa* this, PlayState* play); void func_80941EB4(EnGoroiwa* this); -void func_80941F10(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941F10(EnGoroiwa* this, PlayState* play); void func_80941F54(EnGoroiwa* this); -void func_80941FA4(EnGoroiwa* this, GlobalContext* globalCtx); +void func_80941FA4(EnGoroiwa* this, PlayState* play); void func_80942084(EnGoroiwa* this); -void func_809420F0(EnGoroiwa* this, GlobalContext* globalCtx); +void func_809420F0(EnGoroiwa* this, PlayState* play); const ActorInit En_Goroiwa_InitVars = { ACTOR_EN_GOROIWA, @@ -144,12 +144,12 @@ void func_8093E938(EnGoroiwa* this) { this->collider.elements->dim.worldSphere.radius = this->unk_1DC - 1.0f; } -void func_8093E9B0(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_8093E9B0(EnGoroiwa* this, PlayState* play) { s32 pad[2]; s32 params = ENGOROIWA_GET_C000(&this->actor); - 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); func_8093E938(this); this->collider.elements[0].dim.worldSphere.radius = this->unk_1DC - 1.0f; @@ -182,13 +182,13 @@ s32 func_8093EAD4(Vec3f* arg0, Vec3f* arg1) { return true; } -void func_8093EB58(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_8093EB58(EnGoroiwa* this, PlayState* play) { this->unk_1E4 = (this->actor.home.rot.x >> 1) & 3; } -f32 func_8093EB74(EnGoroiwa* this, GlobalContext* globalCtx) { +f32 func_8093EB74(EnGoroiwa* this, PlayState* play) { s32 i; - Path* path = &globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)]; + Path* path = &play->setupPathList[ENGOROIWA_GET_FF(&this->actor)]; s32 temp_s4 = path->count; f32 temp_f20 = 0.0f; Vec3f sp54; @@ -253,15 +253,15 @@ void func_8093EDB0(EnGoroiwa* this) { this->unk_1D8 += this->unk_1DA; } -void func_8093EDD8(EnGoroiwa* this, GlobalContext* globalCtx) { - this->unk_1D4 = globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; +void func_8093EDD8(EnGoroiwa* this, PlayState* play) { + this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; this->unk_1D6 = 0; this->unk_1D8 = 1; this->unk_1DA = 1; } -void func_8093EE18(EnGoroiwa* this, GlobalContext* globalCtx) { - this->unk_1D4 = globalCtx->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; +void func_8093EE18(EnGoroiwa* this, PlayState* play) { + this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; this->unk_1D6 = this->actor.home.rot.y; this->unk_1D8 = this->unk_1D6 + 1; this->unk_1DA = 1; @@ -294,7 +294,7 @@ s32 func_8093EEDC(EnGoroiwa* this) { return 0; } -void func_8093EF54(GlobalContext* globalCtx, Vec3f* arg1, Color_RGBA8* arg2, Color_RGBA8* arg3, f32 arg4) { +void func_8093EF54(PlayState* play, Vec3f* arg1, Color_RGBA8* arg2, Color_RGBA8* arg3, f32 arg4) { Vec3f spC4; f32 temp_f0; f32 temp_f20; @@ -322,12 +322,12 @@ void func_8093EF54(GlobalContext* globalCtx, Vec3f* arg1, Color_RGBA8* arg2, Col temp_f20 = Rand_ZeroOne(); spC4.z = (Math_CosS(phi_s0) * (temp_f24 * ((temp_f20 * 0.5f) + 0.5f))) + arg1->z; // clang-format on - func_800B0E48(globalCtx, &spC4, &D_80942E48, &D_80942E54, arg2, arg3, (Rand_ZeroOne() * temp_f28) + temp_f26, + func_800B0E48(play, &spC4, &D_80942E48, &D_80942E54, arg2, arg3, (Rand_ZeroOne() * temp_f28) + temp_f26, temp_f26); } } -void func_8093F198(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { +void func_8093F198(PlayState* play, Vec3f* arg1, f32 arg2) { Vec3f sp74; f32 temp_f20; s32 temp_f16; @@ -343,10 +343,10 @@ void func_8093F198(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2) { for (i = 0, phi_s0 = 0; i < temp_f16; i++, phi_s0 += temp_lo) { sp74.x = (Math_SinS((s32)(Rand_ZeroOne() * temp_lo) + phi_s0) * temp_f20) + arg1->x; sp74.z = (Math_CosS((s32)(Rand_ZeroOne() * temp_lo) + phi_s0) * temp_f20) + arg1->z; - EffectSsGSplash_Spawn(globalCtx, &sp74, NULL, NULL, 0, 0x15E); + EffectSsGSplash_Spawn(play, &sp74, NULL, NULL, 0, 0x15E); } - EffectSsGRipple_Spawn(globalCtx, arg1, 0x1F4, 0x384, 4); + EffectSsGRipple_Spawn(play, arg1, 0x1F4, 0x384, 4); } s32 func_8093F34C(EnGoroiwa* this) { @@ -433,7 +433,7 @@ s32 func_8093F5EC(EnGoroiwa* this) { return false; } -s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { f32 temp_f14; Vec3s* sp80 = &this->unk_1D0[this->unk_1D8]; f32 sp7C = sp80->y; @@ -450,7 +450,7 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { if ((this->actor.velocity.y < 0.0f) && (this->actor.world.pos.y <= sp7C)) { if (this->unk_1CA == 0) { if (this->actor.xzDistToPlayer < 400.0f) { - s16 sp72 = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 sp72 = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(sp72, 0x4350); Quake_SetQuakeValues(sp72, 3, 0, 0, 0); Quake_SetCountdown(sp72, 7); @@ -469,8 +469,7 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { sp60.y = this->actor.world.pos.y + 50.0f; sp60.z = this->actor.world.pos.z; - temp_f14 = - BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &poly, &bgId, &this->actor, &sp60); + temp_f14 = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &poly, &bgId, &this->actor, &sp60); temp_f2 = temp_f14 - this->actor.world.pos.y; if (fabsf(temp_f2) < (fabsf(this->actor.velocity.y) + 0.01f)) { @@ -479,7 +478,7 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { sp48.y = temp_f14 + 10.0f; sp48.z = this->actor.world.pos.z; - func_8093EF54(globalCtx, &sp48, &D_80942E30[ENGOROIWA_GET_C000(&this->actor)], + func_8093EF54(play, &sp48, &D_80942E30[ENGOROIWA_GET_C000(&this->actor)], &D_80942E3C[ENGOROIWA_GET_C000(&this->actor)], this->actor.scale.x); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGBALL_BOUND); @@ -501,8 +500,8 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { WaterBox* sp44; f32 sp40; - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &sp40, &sp44)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, + &sp44)) { if ((this->actor.world.pos.y + this->unk_1DC) <= sp40) { this->unk_1E5 |= 0x20; if (sp40 < (this->unk_1DC + sp78)) { @@ -512,7 +511,7 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { sp34.x = this->actor.world.pos.x; sp34.y = sp40; sp34.z = this->actor.world.pos.z; - func_8093F198(globalCtx, &sp34, this->actor.scale.x); + func_8093F198(play, &sp34, this->actor.scale.x); } this->actor.velocity.y *= 0.2f; } @@ -528,7 +527,7 @@ s32 func_8093F6F8(EnGoroiwa* this, GlobalContext* globalCtx) { return false; } -void func_8093FAA4(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_8093FAA4(EnGoroiwa* this, PlayState* play) { f32 temp; f32 tmp2; f32 sp7C; @@ -578,7 +577,7 @@ void func_8093FC00(EnGoroiwa* this) { } } -void func_8093FC6C(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_8093FC6C(EnGoroiwa* this, PlayState* play) { s32 i; Vec3f spC0; Vec3f spB4; @@ -622,8 +621,7 @@ void func_8093FC6C(EnGoroiwa* this, GlobalContext* globalCtx) { spA8.y = spB4.y * -0.05f; spA8.z = spB4.z * -0.02f; - EffectSsIceSmoke_Spawn(globalCtx, &spC0, &spB4, &spA8, - ((s32)(Rand_ZeroOne() * 170.0f) + 150) * temp_f24 * 10.0f); + EffectSsIceSmoke_Spawn(play, &spC0, &spB4, &spA8, ((s32)(Rand_ZeroOne() * 170.0f) + 150) * temp_f24 * 10.0f); } for (i = 0, phi_s0 = 0; i < sp80; i++, phi_s0 += temp) { @@ -644,11 +642,11 @@ void func_8093FC6C(EnGoroiwa* this, GlobalContext* globalCtx) { spC0.y = (Rand_ZeroOne() * 20.0f) + this->actor.world.pos.y; spC0.z = (spC0.z * temp_f20) + this->actor.world.pos.z; - EffectSsIceSmoke_Spawn(globalCtx, &spC0, &spB4, &spA8, (s32)(Rand_ZeroOne() * 1400.0f * temp_f24) + 100); + EffectSsIceSmoke_Spawn(play, &spC0, &spB4, &spA8, (s32)(Rand_ZeroOne() * 1400.0f * temp_f24) + 100); } } -void func_80940090(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80940090(EnGoroiwa* this, PlayState* play) { s32 pad; s32 pad2; s32 i; @@ -720,7 +718,7 @@ void func_80940090(EnGoroiwa* this, GlobalContext* globalCtx) { spF4.z = sp100.z * 0.16f * phi_f22; Math_Vec3f_Sum(&sp100, &sp10C, &sp100); - EffectSsKakera_Spawn(globalCtx, &sp100, &spF4, &sp100, phi_s2, phi_s0, 30, 0, 0, + EffectSsKakera_Spawn(play, &sp100, &spF4, &sp100, phi_s2, phi_s0, 30, 0, 0, ((Rand_ZeroOne() * 150.0f) + 300.0f) * this->actor.scale.x, phi_s3, 0, 0x32, -1, OBJECT_GOROIWA, phi_s1); if (this->unk_1E6 == 0) { @@ -728,18 +726,18 @@ void func_80940090(EnGoroiwa* this, GlobalContext* globalCtx) { sp100.y += ((Rand_ZeroOne() * 1400.0f) - 600.0f) * this->actor.scale.y; sp100.z += ((Rand_ZeroOne() * 1200.0f) - 600.0f) * this->actor.scale.z; - func_800B0E48(globalCtx, &sp100, &D_80942E48, &D_80942E54, &D_80942E30[sp120], &D_80942E3C[sp120], + func_800B0E48(play, &sp100, &D_80942E48, &D_80942E54, &D_80942E30[sp120], &D_80942E3C[sp120], (Rand_ZeroOne() * 50.0f) + (400.0f * spEC), (Rand_ZeroOne() * 60.0f) + (500.0f * spEC)); } } if (this->unk_1E6 != 0) { - func_8093FC6C(this, globalCtx); + func_8093FC6C(this, play); } } } -void func_80940588(GlobalContext* globalCtx, Vec3f* arg1, Gfx* arg2[], Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { +void func_80940588(PlayState* play, Vec3f* arg1, Gfx* arg2[], Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { Gfx* phi_s7; Vec3f sp100; Vec3f spF4; @@ -801,20 +799,20 @@ void func_80940588(GlobalContext* globalCtx, Vec3f* arg1, Gfx* arg2[], Color_RGB } } - EffectSsKakera_Spawn(globalCtx, &sp100, &spF4, &sp100, phi_fp, phi_s0, 30, 0, 0, + EffectSsKakera_Spawn(play, &sp100, &spF4, &sp100, phi_fp, phi_s0, 30, 0, 0, ((Rand_ZeroOne() * 100.0f) + 170.0f) * arg5, spC8, 0, 0x36, -1, OBJECT_GOROIWA, phi_s7); for (j = 0; j < 2; j++) { spE8.x = (((Rand_ZeroOne() * 1000.0f) - 500.0f) * arg5) + sp100.x; spE8.y = (((Rand_ZeroOne() * 1300.0f) - 500.0f) * arg5) + sp100.y; spE8.z = (((Rand_ZeroOne() * 1000.0f) - 500.0f) * arg5) + sp100.z; - func_800B0E48(globalCtx, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 80.0f) + spB0, + func_800B0E48(play, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 80.0f) + spB0, (Rand_ZeroOne() * 70.0f) + spAC); } } } -void func_80940A1C(GlobalContext* globalCtx, Vec3f* arg1, Gfx** arg2, Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { +void func_80940A1C(PlayState* play, Vec3f* arg1, Gfx** arg2, Color_RGBA8* arg3, Color_RGBA8* arg4, f32 arg5) { s32 i; Vec3f spE8; Vec3f spDC; @@ -872,19 +870,19 @@ void func_80940A1C(GlobalContext* globalCtx, Vec3f* arg1, Gfx** arg2, Color_RGBA } } - EffectSsKakera_Spawn(globalCtx, &spE8, &spDC, &spE8, phi_s2, phi_s0, 30, 0, 0, + EffectSsKakera_Spawn(play, &spE8, &spDC, &spE8, phi_s2, phi_s0, 30, 0, 0, ((Rand_ZeroOne() * 150.0f) + 250.0f) * arg5, phi_s3, 0, 0x36, -1, OBJECT_GOROIWA, phi_s1); spE8.x += ((Rand_ZeroOne() * 800.0f) - 400.0f) * arg5; spE8.y += ((Rand_ZeroOne() * 800.0f) - 250.0f) * arg5; spE8.z += ((Rand_ZeroOne() * 800.0f) - 400.0f) * arg5; - func_800B0E48(globalCtx, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 60.0f) + spAC, + func_800B0E48(play, &spE8, &D_80942E48, &D_80942E54, arg3, arg4, (Rand_ZeroOne() * 60.0f) + spAC, (Rand_ZeroOne() * 30.0f) + spAC); } } -void func_80940E38(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80940E38(EnGoroiwa* this, PlayState* play) { f32 sp5C; s32 pad; f32 sp54; @@ -909,7 +907,7 @@ void func_80940E38(EnGoroiwa* this, GlobalContext* globalCtx) { sp48.y = this->actor.world.pos.y + 20.0f; sp48.z = (Math_CosS(sp46) * sp54) + this->actor.world.pos.z; - func_800B0E48(globalCtx, &sp48, &D_80942E48, &D_80942E54, &D_80942E38, &D_80942E44, + func_800B0E48(play, &sp48, &D_80942E48, &D_80942E54, &D_80942E38, &D_80942E44, (Rand_ZeroOne() * 600.0f) + (600.0f * (this->actor.scale.x + 0.1f) * 0.5f), (s32)(Rand_ZeroOne() * 50.0f) + 30); } @@ -917,7 +915,7 @@ void func_80940E38(EnGoroiwa* this, GlobalContext* globalCtx) { } } -void func_80941060(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80941060(EnGoroiwa* this, PlayState* play) { Vec3f spAC; Vec3f spA0; Vec3f sp94; @@ -937,21 +935,21 @@ void func_80941060(EnGoroiwa* this, GlobalContext* globalCtx) { spAC.y = spA0.y * -0.06f; spAC.z = spA0.z * -0.06f; - func_800B0E48(globalCtx, &sp94, &spA0, &spAC, &D_80942E38, &D_80942E44, (s32)(Rand_ZeroOne() * 30.0f) + 15, + func_800B0E48(play, &sp94, &spA0, &spAC, &D_80942E38, &D_80942E44, (s32)(Rand_ZeroOne() * 30.0f) + 15, (s32)(Rand_ZeroOne() * 40.0f) + 30); } } -void func_80941274(EnGoroiwa* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_SNOWBALL_BROKEN); +void func_80941274(EnGoroiwa* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_SNOWBALL_BROKEN); } -void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Init(Actor* thisx, PlayState* play) { EnGoroiwa* this = THIS; f32 temp_f0; s32 params = ENGOROIWA_GET_FF(&this->actor); s32 sp28 = params * 8; - Path* sp2C = &globalCtx->setupPathList[params]; + Path* sp2C = &play->setupPathList[params]; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.world.rot.x = 0; @@ -962,7 +960,7 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = 0; func_8093E8A0(this); func_8093E91C(this); - func_8093E9B0(this, globalCtx); + func_8093E9B0(this, play); if (sp28 == 0x7F8) { Actor_MarkForDeath(&this->actor); @@ -981,22 +979,22 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 595.0f, ActorShadow_DrawCircle, 9.4f); this->actor.shape.shadowAlpha = 200; - func_8093EB58(this, globalCtx); + func_8093EB58(this, play); this->unk_1D0 = Lib_SegmentedToVirtual(sp2C->points); - func_8093EE18(this, globalCtx); + func_8093EE18(this, play); func_8093EE64(this, this->actor.home.rot.y); func_8093EEBC(this); func_8093EC50(this); if (ENGOROIWA_GET_3000(&this->actor) == ENGOROIWA_3000_2) { - temp_f0 = func_8093EB74(this, globalCtx); + temp_f0 = func_8093EB74(this, play); if (temp_f0 < 0.1f) { this->unk_1E0 = 0.0f; } else { - this->unk_1E0 = (D_80942DFC[this->unk_1E4] * ((s32)globalCtx->state.framerateDivisor * 0.5f)) / temp_f0; + this->unk_1E0 = (D_80942DFC[this->unk_1E4] * ((s32)play->state.framerateDivisor * 0.5f)) / temp_f0; this->unk_1E0 *= 0.020000001f; if (this->unk_1E0 > 0.00037f) { this->unk_1E0 = 0.00037f; @@ -1006,18 +1004,18 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { } } - Effect_Add(globalCtx, &this->unk_248, 4, 0, 0, &D_80942E8C); + Effect_Add(play, &this->unk_248, 4, 0, 0, &D_80942E8C); func_809419D0(this); } -void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Destroy(Actor* thisx, PlayState* play) { EnGoroiwa* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); - Effect_Destroy(globalCtx, this->unk_248); + Collider_DestroyJntSph(play, &this->collider); + Effect_Destroy(play, this->unk_248); } -s32 func_8094156C(EnGoroiwa* this, GlobalContext* globalCtx) { +s32 func_8094156C(EnGoroiwa* this, PlayState* play) { Actor* actor = &this->actor; s32 params = ENGOROIWA_GET_C000(&this->actor); EnGoroiwaStruct* ptr; @@ -1075,9 +1073,9 @@ s32 func_8094156C(EnGoroiwa* this, GlobalContext* globalCtx) { sp80.x = this->actor.world.pos.x; sp80.y = this->actor.world.pos.y + this->unk_1DC; sp80.z = this->actor.world.pos.z; - func_80940588(globalCtx, &sp80, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], + func_80940588(play, &sp80, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], this->actor.scale.x); - func_80941274(this, globalCtx); + func_80941274(this, play); phi_s0_2 = true; } else if (((params == ENGOROIWA_C000_1) && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & (0x400 | 0x100))) || @@ -1087,12 +1085,12 @@ s32 func_8094156C(EnGoroiwa* this, GlobalContext* globalCtx) { if ((params == ENGOROIWA_C000_2) && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x800)) { this->unk_1E6 = 1; } - func_80940090(this, globalCtx); - func_80941274(this, globalCtx); + func_80940090(this, play); + func_80941274(this, play); func_809425CC(this); phi_s0_2 = true; } else if ((params == ENGOROIWA_C000_2) && (this->unk_1E7 <= 0)) { - func_80941060(this, globalCtx); + func_80941060(this, play); this->unk_1E7 = 10; } } @@ -1103,7 +1101,7 @@ s32 func_8094156C(EnGoroiwa* this, GlobalContext* globalCtx) { } if (phi_s0_2) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x20); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x20); } } return phi_s0_2; @@ -1115,7 +1113,7 @@ void func_809419D0(EnGoroiwa* this) { this->unk_1C4 = 1.0f; } -void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80941A10(EnGoroiwa* this, PlayState* play) { static EnGoroiwaUnkFunc D_80942E94[] = { &func_8093F498, &func_8093F34C, @@ -1127,24 +1125,24 @@ void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx) { { NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG }, }; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp44 = ENGOROIWA_GET_400(&this->actor); s32 sp40 = ENGOROIWA_GET_3000(&this->actor); s16 y; s32 pad2; - if (!func_8094156C(this, globalCtx)) { + if (!func_8094156C(this, play)) { if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { s32 sp34 = this->actor.home.rot.z & 3; if (sp34 == 2) { - func_80940090(this, globalCtx); + func_80940090(this, play); if (sp40 == ENGOROIWA_3000_2) { func_8093E8A0(this); func_8093E91C(this); } - func_80941274(this, globalCtx); - func_8093EDD8(this, globalCtx); + func_80941274(this, play); + func_8093EDD8(this, play); func_8093EE64(this, 0); func_8093EEBC(this); } else { @@ -1158,7 +1156,7 @@ void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx) { } } - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); if (sp34 == 2) { func_80941EB4(this); @@ -1178,8 +1176,8 @@ void func_80941A10(EnGoroiwa* this, GlobalContext* globalCtx) { s32 sp30 = ENGOROIWA_GET_300(&this->actor); if ((sp30 == ENGOROIWA_300_1) && ((this->unk_1D8 == 0) || (this->unk_1D8 == this->unk_1D4))) { - func_80940090(this, globalCtx); - func_80941274(this, globalCtx); + func_80940090(this, play); + func_80941274(this, play); } if (((sp30 == ENGOROIWA_300_1) || (sp30 == ENGOROIWA_300_0)) && (sp40 == ENGOROIWA_3000_2) && @@ -1223,7 +1221,7 @@ void func_80941DB4(EnGoroiwa* this) { this->unk_1C4 = 1.0f; } -void func_80941E28(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80941E28(EnGoroiwa* this, PlayState* play) { func_8093F34C(this); if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { if ((this->unk_1E5 & 8) && ((this->actor.home.rot.z & 3) == 1)) { @@ -1243,8 +1241,8 @@ void func_80941EB4(EnGoroiwa* this) { this->unk_1C4 = 0.0f; } -void func_80941F10(EnGoroiwa* this, GlobalContext* globalCtx) { - if (!func_8094156C(this, globalCtx)) { +void func_80941F10(EnGoroiwa* this, PlayState* play) { + if (!func_8094156C(this, play)) { if (this->unk_1C8 > 0) { this->unk_1C8--; } else { @@ -1260,12 +1258,12 @@ void func_80941F54(EnGoroiwa* this) { this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f; } -void func_80941FA4(EnGoroiwa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80941FA4(EnGoroiwa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_8094156C(this, globalCtx) == 0) { + if (func_8094156C(this, play) == 0) { if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); func_800B8E58(player, NA_SE_PL_BODY_HIT); if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { this->unk_1CC = 50; @@ -1288,17 +1286,17 @@ void func_80942084(EnGoroiwa* this) { this->unk_1E5 &= ~0x20; } -void func_809420F0(EnGoroiwa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809420F0(EnGoroiwa* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_8094156C(this, globalCtx) == 0) { + if (func_8094156C(this, play) == 0) { if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & 0x80000)) { - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); func_800B8E58(player, NA_SE_PL_BODY_HIT); if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { this->unk_1CC = 50; } - } else if (func_8093F6F8(this, globalCtx)) { + } else if (func_8093F6F8(this, play)) { func_8093FC00(this); func_809419D0(this); this->unk_1E5 &= ~0x10; @@ -1312,7 +1310,7 @@ void func_809421E0(EnGoroiwa* this) { func_8093EAB0(this, 0); } -void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_8094220C(EnGoroiwa* this, PlayState* play) { s32 pad; EnGoroiwaStruct* ptr; s32 i; @@ -1346,7 +1344,7 @@ void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx) { spC4.y = ptr->unk_00.y + 25.0f; spC4.z = ptr->unk_00.z; - ptr->unk_18 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &ptr->unk_28, &spD0, &this->actor, &spC4); + ptr->unk_18 = BgCheck_EntityRaycastFloor5(&play->colCtx, &ptr->unk_28, &spD0, &this->actor, &spC4); if (ptr->unk_10 <= 0.0f) { Matrix_RotateZYX(ptr->unk_1C, ptr->unk_1E, ptr->unk_20, MTXMODE_NEW); @@ -1374,7 +1372,7 @@ void func_8094220C(EnGoroiwa* this, GlobalContext* globalCtx) { sp9C.x = ptr->unk_00.x; sp9C.y = (ptr->unk_00.y - ptr->unk_10) + 10.0f; sp9C.z = ptr->unk_00.z; - func_80940A1C(globalCtx, &sp9C, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], + func_80940A1C(play, &sp9C, D_80942E0C[params], &D_80942E30[params], &D_80942E3C[params], this->actor.scale.x); } } @@ -1409,7 +1407,7 @@ void func_809425CC(EnGoroiwa* this) { this->unk_1C8 = 100; } -void func_80942604(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80942604(EnGoroiwa* this, PlayState* play) { s32 pad; s16 sp22 = this->actor.shape.shadowAlpha; @@ -1422,10 +1420,10 @@ void func_80942604(EnGoroiwa* this, GlobalContext* globalCtx) { } } -void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; EnGoroiwa* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 bgId; s32 sp5C = false; Vec3f sp50; @@ -1452,7 +1450,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.flags & ACTOR_FLAG_40) { tmp = this->actor.floorPoly; if (tmp != NULL) { - temp_v0_2 = func_800C99D4(&globalCtx->colCtx, tmp, this->actor.floorBgId); + temp_v0_2 = func_800C99D4(&play->colCtx, tmp, this->actor.floorBgId); if ((temp_v0_2 == 14) || (temp_v0_2 == 15)) { if (!(this->unk_1E5 & 0x40)) { @@ -1460,7 +1458,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { sp50.y = this->actor.floorHeight; sp50.z = this->actor.world.pos.z; sp4C = (((Rand_ZeroOne() * 36.0f) + 250.0f) * this->actor.scale.x) + 10.0f; - func_800AE930(&globalCtx->colCtx, Effect_GetByIndex(this->unk_248), &sp50, sp4C, + func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_248), &sp50, sp4C, this->actor.world.rot.y, this->actor.floorPoly, this->actor.floorBgId); } sp48 = false; @@ -1473,26 +1471,26 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { func_800AEF44(Effect_GetByIndex(this->unk_248)); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { func_8093EC50(this); if (sp5C) { - func_80940E38(this, globalCtx); + func_80940E38(this, play); } switch (ENGOROIWA_GET_400(&this->actor)) { case ENGOROIWA_400_1: - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); break; case ENGOROIWA_400_0: sp50.x = this->actor.world.pos.x; sp50.y = this->actor.world.pos.y + 50.0f; sp50.z = this->actor.world.pos.z; - this->actor.floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, - &bgId, &this->actor, &sp50); + this->actor.floorHeight = + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &sp50); if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.floorBgId = bgId; if (this->actor.world.pos.y <= (this->actor.floorHeight + 2.0f)) { @@ -1507,7 +1505,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { break; } - func_8093FAA4(this, globalCtx); + func_8093FAA4(this, play); if (this->actor.flags & ACTOR_FLAG_40) { s32 params = ENGOROIWA_GET_C000(&this->actor); @@ -1517,19 +1515,19 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->unk_1E5 & 1) && (this->unk_1CC <= 0) && (!(player->stateFlags3 & 0x2000000) || (player->transformation != PLAYER_FORM_GORON) || ((params != ENGOROIWA_C000_1) && (params != ENGOROIWA_C000_2)))) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.atFlags &= ~AT_HIT; } if (this->unk_1E5 & 2) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.acFlags &= ~AC_HIT; } if ((this->unk_1E5 & 4) && (this->unk_1CC <= 0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.ocFlags1 &= ~OC1_HIT; } @@ -1542,7 +1540,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { +void func_80942B1C(EnGoroiwa* this, PlayState* play) { s32 pad; s32 pad2; s32 i; @@ -1568,12 +1566,12 @@ void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &sp80); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, phi_fp); + Gfx_DrawDListOpa(play, phi_fp); if ((ptr->unk_28 != 0) && (ptr->unk_2C > 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); @@ -1583,17 +1581,17 @@ void func_80942B1C(EnGoroiwa* this, GlobalContext* globalCtx) { Matrix_Put(&sp88); Matrix_Scale(this->actor.scale.x * 7.5f, 1.0f, this->actor.scale.z * 7.5f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } } -void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGoroiwa_Draw(Actor* thisx, PlayState* play) { static Gfx* D_80942EB4[] = { object_goroiwa_DL_005C20, object_goroiwa_DL_003B40, @@ -1603,8 +1601,8 @@ void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 params = ENGOROIWA_GET_C000(&this->actor); if (this->actionFunc == func_8094220C) { - func_80942B1C(this, globalCtx); + func_80942B1C(this, play); } else if (this->actionFunc != func_80942604) { - Gfx_DrawDListOpa(globalCtx, D_80942EB4[params]); + Gfx_DrawDListOpa(play, D_80942EB4[params]); } } 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 2a3ae2505f..db841977c6 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -5,7 +5,7 @@ struct EnGoroiwa; -typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, GlobalContext*); +typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, PlayState*); typedef s32 (*EnGoroiwaUnkFunc)(struct EnGoroiwa*); #define ENGOROIWA_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index e19d2fa378..1c37d5c85e 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -10,10 +10,10 @@ #define THIS ((EnGrasshopper*)thisx) -void EnGrasshopper_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGrasshopper_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGrasshopper_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGrasshopper_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGrasshopper_Init(Actor* thisx, PlayState* play); +void EnGrasshopper_Destroy(Actor* thisx, PlayState* play); +void EnGrasshopper_Update(Actor* thisx, PlayState* play); +void EnGrasshopper_Draw(Actor* thisx, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h index 5099fd8c29..dc8e95008a 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h @@ -5,7 +5,7 @@ struct EnGrasshopper; -typedef void (*EnGrasshopperActionFunc)(struct EnGrasshopper*, GlobalContext*); +typedef void (*EnGrasshopperActionFunc)(struct EnGrasshopper*, PlayState*); typedef struct EnGrasshopper { /* 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 a97de7b808..c1be4f1a92 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -12,29 +12,29 @@ #define THIS ((EnGs*)thisx) -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_80997D14(EnGs* this, GlobalContext* globalCtx); -void func_80997D38(EnGs* this, GlobalContext* globalCtx); -void func_80997E4C(EnGs* this, GlobalContext* globalCtx); -void func_80998040(EnGs* this, GlobalContext* globalCtx); -void func_8099807C(EnGs* this, GlobalContext* globalCtx); -void func_80998300(EnGs* this, GlobalContext* globalCtx); -void func_809984F4(EnGs* this, GlobalContext* globalCtx); -void func_809985B8(EnGs* this, GlobalContext* globalCtx); -void func_80998704(EnGs* this, GlobalContext* globalCtx); -void func_8099874C(EnGs* this, GlobalContext* globalCtx); -void func_809989B4(EnGs* this, GlobalContext* globalCtx); -void func_809989F4(EnGs* this, GlobalContext* globalCtx); -s32 func_80998A48(EnGs* this, GlobalContext* globalCtx); -s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx); -s32 func_80998D44(EnGs* this, GlobalContext* globalCtx); -s32 func_80998F9C(EnGs* this, GlobalContext* globalCtx); -s32 func_809995A4(EnGs* this, GlobalContext* globalCtx); -void func_80999A8C(EnGs* this, GlobalContext* globalCtx); +void func_80997D14(EnGs* this, PlayState* play); +void func_80997D38(EnGs* this, PlayState* play); +void func_80997E4C(EnGs* this, PlayState* play); +void func_80998040(EnGs* this, PlayState* play); +void func_8099807C(EnGs* this, PlayState* play); +void func_80998300(EnGs* this, PlayState* play); +void func_809984F4(EnGs* this, PlayState* play); +void func_809985B8(EnGs* this, PlayState* play); +void func_80998704(EnGs* this, PlayState* play); +void func_8099874C(EnGs* this, PlayState* play); +void func_809989B4(EnGs* this, PlayState* play); +void func_809989F4(EnGs* this, PlayState* play); +s32 func_80998A48(EnGs* this, PlayState* play); +s32 func_80998BBC(EnGs* this, PlayState* play); +s32 func_80998D44(EnGs* this, PlayState* play); +s32 func_80998F9C(EnGs* this, PlayState* play); +s32 func_809995A4(EnGs* this, PlayState* play); +void func_80999A8C(EnGs* this, PlayState* play); void func_80999AC0(EnGs* this); const ActorInit En_Gs_InitVars = { @@ -132,7 +132,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Init(Actor* thisx, PlayState* play) { s32 pad; EnGs* this = THIS; @@ -144,7 +144,7 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_196 = ENGS_GET_FE0(thisx); this->actor.params = ENGS_GET_F000(thisx); this->actor.world.rot.z = 0; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->actor.targetMode = 6; this->unk_216 = 0; @@ -163,38 +163,38 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.radius *= 1.5f; this->collider.dim.height *= 1.5f; } - func_80997D14(this, globalCtx); + func_80997D14(this, play); } -void EnGs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Destroy(Actor* thisx, PlayState* play) { EnGs* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); func_80165690(); } -void func_80997D14(EnGs* this, GlobalContext* globalCtx) { +void func_80997D14(EnGs* this, PlayState* play) { this->unk_19A &= ~0x200; this->actionFunc = func_80997D38; } -void func_80997D38(EnGs* this, GlobalContext* globalCtx) { +void func_80997D38(EnGs* this, PlayState* play) { static f32 D_8099A408[] = { 40.0f, 60.0f, 40.0f, 40.0f }; - if (Message_GetState(&globalCtx->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == 0) { if (this->actor.xzDistToPlayer <= D_8099A408[this->actor.params]) { - func_8013E8F8(&this->actor, globalCtx, D_8099A408[this->actor.params], D_8099A408[this->actor.params], + func_8013E8F8(&this->actor, play, D_8099A408[this->actor.params], D_8099A408[this->actor.params], EXCH_ITEM_NONE, 0x2000, 0x2000); } } if (this->actor.params != ENGS_2) { - func_800B874C(&this->actor, globalCtx, 100.0f, 100.0f); + func_800B874C(&this->actor, play, 100.0f, 100.0f); } } -void func_80997DEC(EnGs* this, GlobalContext* globalCtx) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) { +void func_80997DEC(EnGs* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->unk_210 = 0x20D1; } else { this->unk_210 = 0x20D0; @@ -203,10 +203,10 @@ void func_80997DEC(EnGs* this, GlobalContext* globalCtx) { this->actionFunc = func_80997E4C; } -void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80997E4C(EnGs* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: - Message_StartTextbox(globalCtx, this->unk_210, &this->actor); + Message_StartTextbox(play, this->unk_210, &this->actor); break; case 1: @@ -217,10 +217,10 @@ void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x20D0: - func_80997D14(this, globalCtx); + func_80997D14(this, play); break; case 0x20D1: @@ -249,11 +249,11 @@ void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { this->unk_210 = this->unk_195 + 0x20F7; break; } - func_80151938(globalCtx, this->unk_210); + func_80151938(play, this->unk_210); break; default: - func_80997D14(this, globalCtx); + func_80997D14(this, play); break; } } @@ -261,37 +261,37 @@ void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { } } -void func_80997FF0(EnGs* this, GlobalContext* globalCtx) { - if (SubS_StartActorCutscene(&this->actor, globalCtx->playerActorCsIds[0], -1, SUBS_CUTSCENE_NORMAL)) { - func_80998040(this, globalCtx); +void func_80997FF0(EnGs* this, PlayState* play) { + if (SubS_StartActorCutscene(&this->actor, play->playerActorCsIds[0], -1, SUBS_CUTSCENE_NORMAL)) { + func_80998040(this, play); } } -void func_80998040(EnGs* this, GlobalContext* globalCtx) { - func_80152434(globalCtx, 1); +void func_80998040(EnGs* this, PlayState* play) { + func_80152434(play, 1); this->actionFunc = func_8099807C; } -void func_8099807C(EnGs* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.ocarinaMode) { +void func_8099807C(EnGs* this, PlayState* play) { + switch (play->msgCtx.ocarinaMode) { case 3: - switch (globalCtx->msgCtx.unk1202E) { + switch (play->msgCtx.unk1202E) { case 7: case 8: - if (!Flags_GetSwitch(globalCtx, this->unk_196)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + if (!Flags_GetSwitch(play, this->unk_196)) { + 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, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - Flags_SetSwitch(globalCtx, this->unk_196); + Flags_SetSwitch(play, this->unk_196); } break; case 10: - if (!Flags_GetSwitch(globalCtx, this->unk_196)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + if (!Flags_GetSwitch(play, this->unk_196)) { + 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, 7); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); - Flags_SetSwitch(globalCtx, this->unk_196); + Flags_SetSwitch(play, this->unk_196); } break; @@ -301,7 +301,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { this->unk_19C = 5; this->unk_19A |= 1; func_80999AC0(this); - func_809984F4(this, globalCtx); + func_809984F4(this, play); } break; @@ -311,7 +311,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { this->unk_19C = 5; this->unk_19A |= 1; func_80999AC0(this); - func_809984F4(this, globalCtx); + func_809984F4(this, play); } break; @@ -321,7 +321,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { this->unk_19C = 5; this->unk_19A |= 1; func_80999AC0(this); - func_809984F4(this, globalCtx); + func_809984F4(this, play); } break; } @@ -329,22 +329,22 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { case 0: case 4: - func_80998300(this, globalCtx); + func_80998300(this, play); case 26: - func_80997D14(this, globalCtx); + func_80997D14(this, play); break; } } -void func_80998300(EnGs* this, GlobalContext* globalCtx) { +void func_80998300(EnGs* this, PlayState* play) { if (this->actor.cutscene != -1) { - ActorCutscene_Stop(globalCtx->playerActorCsIds[0]); + ActorCutscene_Stop(play->playerActorCsIds[0]); } } -f32 func_80998334(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, s16* arg4, f32 arg5, f32 arg6, f32 arg7, - s32 arg8, s32 arg9) { +f32 func_80998334(EnGs* this, PlayState* play, f32* arg2, f32* arg3, s16* arg4, f32 arg5, f32 arg6, f32 arg7, s32 arg8, + s32 arg9) { f32 sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); if (arg9 == 0) { @@ -356,32 +356,32 @@ f32 func_80998334(EnGs* this, GlobalContext* globalCtx, f32* arg2, f32* arg3, s1 return sp2C; } -void func_809984F4(EnGs* this, GlobalContext* globalCtx) { +void func_809984F4(EnGs* this, PlayState* play) { EnGs* gossipStone = NULL; do { - gossipStone = (EnGs*)SubS_FindActor(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); + gossipStone = (EnGs*)SubS_FindActor(play, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); if (gossipStone != NULL) { if ((this != gossipStone) && (this->unk_194 == gossipStone->unk_194)) { gossipStone->unk_19A |= 1; func_80999AC0(gossipStone); gossipStone->unk_19C = 3; - func_80998704(gossipStone, globalCtx); + func_80998704(gossipStone, play); } gossipStone = (EnGs*)gossipStone->actor.next; } } while (gossipStone != NULL); - func_800B7298(globalCtx, &this->actor, 7); + func_800B7298(play, &this->actor, 7); this->actionFunc = func_809985B8; } -void func_809985B8(EnGs* this, GlobalContext* globalCtx) { +void func_809985B8(EnGs* this, PlayState* play) { EnGs* gossipStone; Vec3f sp38; if (SubS_StartActorCutscene(&this->actor, this->unk_212[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_MultVecZ(160.0f, &sp38); @@ -393,7 +393,7 @@ void func_809985B8(EnGs* this, GlobalContext* globalCtx) { gossipStone = NULL; do { - gossipStone = (EnGs*)SubS_FindActor(globalCtx, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); + gossipStone = (EnGs*)SubS_FindActor(play, &gossipStone->actor, ACTORCAT_PROP, ACTOR_EN_GS); if (gossipStone != NULL) { if ((gossipStone != this) && (gossipStone->actor.params == ENGS_2) && (gossipStone->unk_198 == this->unk_198)) { @@ -404,40 +404,40 @@ void func_809985B8(EnGs* this, GlobalContext* globalCtx) { } } while (gossipStone != NULL); - func_80998704(this, globalCtx); + func_80998704(this, play); } } -void func_80998704(EnGs* this, GlobalContext* globalCtx) { +void func_80998704(EnGs* this, PlayState* play) { this->unk_19D = 0; this->unk_19A &= ~(0x100 | 0x4); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_G_STONE_CHANGE_COLOR); this->actionFunc = func_8099874C; } -void func_8099874C(EnGs* this, GlobalContext* globalCtx) { +void func_8099874C(EnGs* this, PlayState* play) { s32 phi_v0 = 0; switch (this->unk_19C) { case 0: - phi_v0 = func_80998A48(this, globalCtx); + phi_v0 = func_80998A48(this, play); break; case 1: - phi_v0 = func_80998BBC(this, globalCtx); + phi_v0 = func_80998BBC(this, play); break; case 2: - phi_v0 = func_80998D44(this, globalCtx); + phi_v0 = func_80998D44(this, play); break; case 3: case 5: - phi_v0 = func_80998F9C(this, globalCtx); + phi_v0 = func_80998F9C(this, play); break; case 4: - phi_v0 = func_809995A4(this, globalCtx); + phi_v0 = func_809995A4(this, play); break; } @@ -486,34 +486,34 @@ void func_8099874C(EnGs* this, GlobalContext* globalCtx) { } if (this->unk_20C > 0) { - func_809989B4(this, globalCtx); + func_809989B4(this, play); } else { - func_80997D14(this, globalCtx); + func_80997D14(this, play); } } else { - func_80997D14(this, globalCtx); + func_80997D14(this, play); } } else { - func_80997D14(this, globalCtx); + func_80997D14(this, play); } } } -void func_809989B4(EnGs* this, GlobalContext* globalCtx) { - Actor_PickUp(&this->actor, globalCtx, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); +void func_809989B4(EnGs* this, PlayState* play) { + Actor_PickUp(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809989F4; } -void func_809989F4(EnGs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_809989F4(EnGs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - func_80997D14(this, globalCtx); + func_80997D14(this, play); } else { - Actor_PickUp(&this->actor, globalCtx, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } -s32 func_80998A48(EnGs* this, GlobalContext* globalCtx) { +s32 func_80998A48(EnGs* this, PlayState* play) { s32 sp3C = -1; if (this->unk_19D == 0) { @@ -531,13 +531,12 @@ s32 func_80998A48(EnGs* this, GlobalContext* globalCtx) { this->unk_1DC = 0.5f; this->unk_1E0 = 0.0f; } else if (this->unk_19D == 1) { - if (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.007f, 0.001f, 7, - 0) == 0.0f) { - if ((this->actor.params != ENGS_0) && !Play_InCsMode(globalCtx) && - (Message_GetState(&globalCtx->msgCtx) == 0)) { + if (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.007f, 0.001f, 7, 0) == + 0.0f) { + if ((this->actor.params != ENGS_0) && !Play_InCsMode(play) && (Message_GetState(&play->msgCtx) == 0)) { this->unk_216 = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIVE_LUPY_COUNT); - Message_StartTextbox(globalCtx, 0x20D2, NULL); + Message_StartTextbox(play, 0x20D2, NULL); } this->unk_19A &= ~1; sp3C = 0; @@ -546,7 +545,7 @@ s32 func_80998A48(EnGs* this, GlobalContext* globalCtx) { return sp3C; } -s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx) { +s32 func_80998BBC(EnGs* this, PlayState* play) { s32 sp34 = -1; if (this->unk_19D == 0) { @@ -565,8 +564,8 @@ s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx) { } else if (this->unk_19D == 1) { this->unk_19E[0].z = (this->unk_1D4 % 8) * 0.125f * 360.0f * (0x10000 / 360.0f); this->unk_19E[1].z = -this->unk_19E[0].z; - if (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.005f, 0.001f, 7, - 0) == 0.0f) { + if (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.005f, 0.001f, 7, 0) == + 0.0f) { this->unk_19A &= ~1; sp34 = 0; } @@ -574,7 +573,7 @@ s32 func_80998BBC(EnGs* this, GlobalContext* globalCtx) { return sp34; } -s32 func_80998D44(EnGs* this, GlobalContext* globalCtx) { +s32 func_80998D44(EnGs* this, PlayState* play) { s32 sp3C = -1; f32 step; @@ -616,15 +615,15 @@ s32 func_80998D44(EnGs* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_19D += 1; } - } else if ((this->unk_19D == 4) && (func_80998334(this, globalCtx, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, - 1.0f, 0.03f, 0.001f, 5, 0) == 0.0f)) { + } else if ((this->unk_19D == 4) && (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 1.0f, + 0.03f, 0.001f, 5, 0) == 0.0f)) { this->unk_19A &= ~1; sp3C = 0; } return sp3C; } -s32 func_80998F9C(EnGs* this, GlobalContext* globalCtx) { +s32 func_80998F9C(EnGs* this, PlayState* play) { s32 sp4C = -1; f32 sp48; f32 sp44; @@ -747,7 +746,7 @@ void func_80999584(Color_RGB8* arg0, Color_RGB8* arg1) { arg0->b = arg1->b; } -s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { +s32 func_809995A4(EnGs* this, PlayState* play) { static Color_RGB8 flashColours[] = { { 255, 50, 50 }, { 50, 50, 255 }, @@ -820,8 +819,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { sp6C.y = this->actor.world.pos.y + 7.0f; sp6C.z = this->actor.world.pos.z + (2.0f * sp60.z); - func_800B0EB0(globalCtx, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, - 15); + func_800B0EB0(play, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, 15); } func_800B9010(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); @@ -843,7 +841,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { } if (this->unk_19D == 4) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 3); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 3); if (this->actor.bgCheckFlags & (0x10 | 0x8)) { Vec3f sp54; @@ -851,7 +849,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { sp54.y = this->actor.world.pos.y; sp54.z = this->actor.world.pos.z; Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - EffectSsBomb2_SpawnLayered(globalCtx, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20); + EffectSsBomb2_SpawnLayered(play, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20); this->unk_1D4 = 10; this->unk_19A |= 8; this->unk_216 = 0; @@ -870,7 +868,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { } if (this->actor.playerHeightRel < -12000.0f) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); Actor_MarkForDeath(&this->actor); sp7C = 0; @@ -880,7 +878,7 @@ s32 func_809995A4(EnGs* this, GlobalContext* globalCtx) { return sp7C; } -void func_80999A8C(EnGs* this, GlobalContext* globalCtx) { +void func_80999A8C(EnGs* this, PlayState* play) { if (this->unk_1D4-- <= 0) { Actor_MarkForDeath(&this->actor); } @@ -917,8 +915,8 @@ void func_80999B34(EnGs* this) { } } -void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80999BC8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnGs* this = THIS; s32 pad; @@ -927,7 +925,7 @@ void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19A |= 1; func_80999AC0(this); this->unk_19C = 0; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_208 = 0; } @@ -954,7 +952,7 @@ void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19A |= 1; func_80999AC0(this); this->unk_19C = 0; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_21A = 5; break; @@ -962,14 +960,14 @@ void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19A |= 1; func_80999AC0(this); this->unk_19C = 1; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_21A = 5; break; case 13: func_80999AC0(this); this->unk_19C = 2; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_21A = 5; break; @@ -977,7 +975,7 @@ void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19A |= 2; func_80999AC0(this); this->unk_19C = 4; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_21A = 5; break; @@ -985,51 +983,51 @@ void func_80999BC8(Actor* thisx, GlobalContext* globalCtx2) { this->unk_19A |= 1; func_80999AC0(this); this->unk_19C = 3; - func_80998704(this, globalCtx); + func_80998704(this, play); this->unk_21A = 5; break; } } 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 { this->collider.base.acFlags &= ~AC_HIT; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnGs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Update(Actor* thisx, PlayState* play) { s32 pad; EnGs* this = THIS; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; this->collider.base.acFlags &= ~AC_HIT; - func_80997DEC(this, globalCtx); - } else if (func_800B8718(&this->actor, &globalCtx->state)) { + func_80997DEC(this, play); + } else if (func_800B8718(&this->actor, &play->state)) { this->unk_19A |= 0x200; this->collider.base.acFlags &= ~AC_HIT; if (this->actor.cutscene != -1) { this->actionFunc = func_80997FF0; } else { - func_80998040(this, globalCtx); + func_80998040(this, play); } } else { s16 sp2E; s16 sp2C; if ((this->actor.flags & ACTOR_FLAG_40) || (this->unk_19A & 0x100) || (this->unk_19A & 0x200)) { - func_80999BC8(&this->actor, globalCtx); - Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); + func_80999BC8(&this->actor, play); + Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || (sp2C > SCREEN_HEIGHT)) { this->unk_216 = 0; } else if (this->unk_21C > 0) { - func_800BC848(&this->actor, globalCtx, this->unk_21C, this->unk_21E); + func_800BC848(&this->actor, play, this->unk_21C, this->unk_21E); } } else { this->unk_216 = 0; @@ -1056,7 +1054,7 @@ void EnGs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGs_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGs* this = THIS; u32 frames; @@ -1065,11 +1063,11 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - frames = globalCtx->gameplayFrames; + frames = play->gameplayFrames; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Push(); if (this->unk_19A & 1) { @@ -1082,7 +1080,7 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZS(this->unk_19E[1].z, MTXMODE_APPLY); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_gs_DL_000950); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1FA.r, this->unk_1FA.g, this->unk_1FA.b, 255); gSPDisplayList(POLY_OPA_DISP++, object_gs_DL_0009D0); @@ -1091,17 +1089,17 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); if (this->unk_19A & 2) { - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_8012C2DC(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 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 * 20, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 c76a0c346f..eed8d75f9c 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -5,7 +5,7 @@ struct EnGs; -typedef void (*EnGsActionFunc)(struct EnGs*, GlobalContext*); +typedef void (*EnGsActionFunc)(struct EnGs*, PlayState*); #define ENGS_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENGS_GET_FE0(thisx) (((thisx)->params >> 5) & 0x7F) diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index 1394efff77..d2d447db51 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -10,19 +10,19 @@ #define THIS ((EnGuardNuts*)thisx) -void EnGuardNuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGuardNuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGuardNuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGuardNuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGuardNuts_Init(Actor* thisx, PlayState* play); +void EnGuardNuts_Destroy(Actor* thisx, PlayState* play); +void EnGuardNuts_Update(Actor* thisx, PlayState* play); +void EnGuardNuts_Draw(Actor* thisx, PlayState* play); void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 index); void EnGuardNuts_SetupWait(EnGuardNuts* this); -void EnGuardNuts_Wait(EnGuardNuts* this, GlobalContext* globalCtx); +void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play); void func_80ABB540(EnGuardNuts* this); -void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx); -void EnGuardNuts_Burrow(EnGuardNuts* this, GlobalContext* globalCtx); -void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, GlobalContext* globalCtx); -void EnGuardNuts_Unburrow(EnGuardNuts* this, GlobalContext* globalCtx); +void func_80ABB590(EnGuardNuts* this, PlayState* play); +void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play); +void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, PlayState* play); +void EnGuardNuts_Unburrow(EnGuardNuts* this, PlayState* play); const ActorInit En_Guard_Nuts_InitVars = { ACTOR_EN_GUARD_NUTS, @@ -93,15 +93,15 @@ typedef enum { /* 4 */ GUARD_NUTS_UNK_STATE } EnGuardNutsState; -void EnGuardNuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGuardNuts_Init(Actor* thisx, PlayState* play) { EnGuardNuts* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuPalaceGuardSkel, &gDekuPalaceGuardWaitAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuPalaceGuardSkel, &gDekuPalaceGuardWaitAnim, this->jointTable, this->morphTable, DEKU_PALACE_GUARD_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.015f); Math_Vec3f_Copy(&this->guardPos, &this->actor.world.pos); this->guardNumber = sGuardCount; @@ -111,14 +111,14 @@ void EnGuardNuts_Init(Actor* thisx, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { EnGuardNuts_SetupWait(this); } else { - EnGuardNuts_Burrow(this, globalCtx); + EnGuardNuts_Burrow(this, play); } } -void EnGuardNuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGuardNuts_Destroy(Actor* thisx, PlayState* play) { EnGuardNuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** @@ -140,14 +140,14 @@ void EnGuardNuts_SetupWait(EnGuardNuts* this) { this->actionFunc = EnGuardNuts_Wait; } -void EnGuardNuts_Wait(EnGuardNuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 phi_a1; s16 yawDiff; SkelAnime_Update(&this->skelAnime); yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80ABB540(this); return; } @@ -171,7 +171,7 @@ void EnGuardNuts_Wait(EnGuardNuts* this, GlobalContext* globalCtx) { this->actor.textId = sTextIDs[this->guardTextIndex]; phi_a1 = this->actor.world.rot.y; if (D_80ABBE20 == 2) { - EnGuardNuts_Burrow(this, globalCtx); + EnGuardNuts_Burrow(this, play); return; } if (D_80ABBE20 == 1) { @@ -194,7 +194,7 @@ void EnGuardNuts_Wait(EnGuardNuts* this, GlobalContext* globalCtx) { this->targetHeadPos.y = -this->targetHeadPos.y; } } - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } void func_80ABB540(EnGuardNuts* this) { @@ -205,7 +205,7 @@ void func_80ABB540(EnGuardNuts* this) { this->actionFunc = func_80ABB590; } -void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx) { +void func_80ABB590(EnGuardNuts* this, PlayState* play) { s16 yaw = this->actor.yawTowardsPlayer; f32 curFrame; @@ -222,22 +222,22 @@ void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, yaw, 1, 0xBB8, 0); } - if (Message_GetState(&globalCtx->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == 5) { this->targetHeadPos.y = 0; this->targetHeadPos.x = 0; if ((this->guardTextIndex == 3) && (this->animIndex == WAIT_HEAD_TILT_ANIM)) { EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM); } - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (D_80ABBE38[this->guardTextIndex] != 1) { if (D_80ABBE38[this->guardTextIndex] == 2) { - func_801477B4(globalCtx); + func_801477B4(play); D_80ABBE20 = 2; gSaveContext.save.weekEventReg[12] |= 0x40; - EnGuardNuts_Burrow(this, globalCtx); + EnGuardNuts_Burrow(this, play); } else { this->guardTextIndex++; - Message_StartTextbox(globalCtx, sTextIDs[this->guardTextIndex], &this->actor); + Message_StartTextbox(play, sTextIDs[this->guardTextIndex], &this->actor); if (D_80ABBE38[this->guardTextIndex] == 2) { D_80ABBE20 = 1; } @@ -246,15 +246,15 @@ void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx) { } else if (this->guardTextIndex != 3) { this->targetHeadPos.x = 0; this->targetHeadPos.y = this->targetHeadPos.x; - func_801477B4(globalCtx); + func_801477B4(play); this->state = GUARD_NUTS_UNK_STATE; this->actionFunc = EnGuardNuts_Unburrow; } else { - func_801477B4(globalCtx); + func_801477B4(play); EnGuardNuts_SetupWait(this); } } - } else if ((Message_GetState(&globalCtx->msgCtx) >= 3) && (D_80ABBE20 == 0)) { + } else if ((Message_GetState(&play->msgCtx) >= 3) && (D_80ABBE20 == 0)) { if ((this->guardTextIndex == 0) || (this->guardTextIndex == 3) || (this->guardTextIndex >= 7)) { if (this->timer == 0) { this->timer = 2; @@ -267,13 +267,13 @@ void func_80ABB590(EnGuardNuts* this, GlobalContext* globalCtx) { } } -void EnGuardNuts_Burrow(EnGuardNuts* this, GlobalContext* globalCtx) { +void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play) { Vec3f digPos; EnGuardNuts_ChangeAnim(this, DIG_ANIM); Math_Vec3f_Copy(&digPos, &this->actor.world.pos); digPos.y = this->actor.floorHeight; - EffectSsHahen_SpawnBurst(globalCtx, &digPos, 4.0f, 0, 10, 3, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, -1, 10, NULL); this->targetHeadPos.y = 0; this->actor.flags |= ACTOR_FLAG_8000000; this->targetHeadPos.x = this->targetHeadPos.y; @@ -282,7 +282,7 @@ void EnGuardNuts_Burrow(EnGuardNuts* this, GlobalContext* globalCtx) { this->actionFunc = EnGuardNuts_SetupUnburrow; } -void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, GlobalContext* globalCtx) { +void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -294,7 +294,7 @@ void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, GlobalContext* globalCtx) { } } -void EnGuardNuts_Unburrow(EnGuardNuts* this, GlobalContext* globalCtx) { +void EnGuardNuts_Unburrow(EnGuardNuts* this, PlayState* play) { s16 yawDiff; Vec3f digPos; @@ -304,7 +304,7 @@ void EnGuardNuts_Unburrow(EnGuardNuts* this, GlobalContext* globalCtx) { if ((yawDiff < 0x4000) && ((D_80ABBE20 == 0) || (this->actor.xzDistToPlayer > 150.0f))) { Math_Vec3f_Copy(&digPos, &this->actor.world.pos); digPos.y = this->actor.floorHeight; - EffectSsHahen_SpawnBurst(globalCtx, &digPos, 4.0f, 0, 10, 3, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, -1, 10, NULL); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); D_80ABBE20 = 0; if (this->guardTextIndex == 9) { @@ -316,7 +316,7 @@ void EnGuardNuts_Unburrow(EnGuardNuts* this, GlobalContext* globalCtx) { } } -void EnGuardNuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGuardNuts_Update(Actor* thisx, PlayState* play) { EnGuardNuts* this = THIS; s32 pad; @@ -331,7 +331,7 @@ void EnGuardNuts_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 40.0f); Math_SmoothStepToS(&this->headRot.x, this->targetHeadPos.x, 1, 0xBB8, 0); Math_SmoothStepToS(&this->headRot.y, this->targetHeadPos.y, 1, 0xBB8, 0); @@ -344,15 +344,14 @@ void EnGuardNuts_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); if ((this->state != GUARD_NUTS_BURROWED_STATE) && (this->state != GUARD_NUTS_UNK_STATE)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 EnGuardNuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnGuardNuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGuardNuts* this = THIS; if (limbIndex == DEKU_PALACE_GUARD_LIMB_HEAD) { @@ -363,23 +362,23 @@ s32 EnGuardNuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnGuardNuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGuardNuts_Draw(Actor* thisx, PlayState* play) { EnGuardNuts* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnGuardNuts_OverrideLimbDraw, - NULL, &this->actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnGuardNuts_OverrideLimbDraw, NULL, + &this->actor); Matrix_Translate(this->guardPos.x, this->actor.floorHeight, this->guardPos.z, MTXMODE_NEW); Matrix_Scale(0.015f, 0.015f, 0.015f, 1); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuPalaceGuardFlower); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h index 4a42e4e5a0..6f45691ada 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.h @@ -6,7 +6,7 @@ struct EnGuardNuts; -typedef void (*EnGuardNutsActionFunc)(struct EnGuardNuts*, GlobalContext*); +typedef void (*EnGuardNutsActionFunc)(struct EnGuardNuts*, PlayState*); typedef struct EnGuardNuts { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 3830864d17..270fe3bac0 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -11,19 +11,19 @@ #define THIS ((EnGuruguru*)thisx) -void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx); -void EnGuruguru_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx); -void EnGuruguru_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnGuruguru_Init(Actor* thisx, PlayState* play); +void EnGuruguru_Destroy(Actor* thisx, PlayState* play); +void EnGuruguru_Update(Actor* thisx, PlayState* play); +void EnGuruguru_Draw(Actor* thisx, PlayState* play); -void EnGuruguru_DoNothing(EnGuruguru* this, GlobalContext* globalCtx); +void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play); void func_80BC6E10(EnGuruguru* this); -void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx); -void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx); -void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx); +void func_80BC6F14(EnGuruguru* this, PlayState* play); +void func_80BC701C(EnGuruguru* this, PlayState* play); +void func_80BC7068(EnGuruguru* this, PlayState* play); void func_80BC73F4(EnGuruguru* this); -void func_80BC7440(EnGuruguru* this, GlobalContext* globalCtx); -void func_80BC7520(EnGuruguru* this, GlobalContext* globalCtx); +void func_80BC7440(EnGuruguru* this, PlayState* play); +void func_80BC7520(EnGuruguru* this, PlayState* play); extern ColliderCylinderInit D_80BC79A0; @@ -68,16 +68,16 @@ static f32 D_80BC79D8[] = { 1.0f, 1.0f }; static TexturePtr sEyeTextures[] = { object_fu_Tex_005F20, object_fu_Tex_006320 }; static TexturePtr sMouthTextures[] = { object_fu_Tex_006720, object_fu_Tex_006920 }; -void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnGuruguru_Init(Actor* thisx, PlayState* play) { EnGuruguru* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fu_Skel_006C90, &object_fu_Anim_000B04, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_fu_Skel_006C90, &object_fu_Anim_000B04, this->jointTable, this->morphTable, 16); this->actor.targetMode = 0; if (this->actor.params != 2) { - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } if (!gSaveContext.save.isNight) { if (this->actor.params == 0) { @@ -97,11 +97,11 @@ void EnGuruguru_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnGuruguru_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnGuruguru_Destroy(Actor* thisx, PlayState* play) { EnGuruguru* this = THIS; if (this->actor.params != 2) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -111,7 +111,7 @@ void EnGuruguru_ChangeAnimation(EnGuruguru* this, s32 arg1) { -4.0f); } -void EnGuruguru_DoNothing(EnGuruguru* this, GlobalContext* globalCtx) { +void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play) { } void func_80BC6E10(EnGuruguru* this) { @@ -142,13 +142,13 @@ void func_80BC6E10(EnGuruguru* this) { this->actionFunc = func_80BC6F14; } -void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) { +void func_80BC6F14(EnGuruguru* this, PlayState* play) { s16 yaw; s16 yawTemp; SkelAnime_Update(&this->skelAnime); if (this->unk270 != 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->textIdIndex = 3; if (player->transformation == PLAYER_FORM_DEKU) { @@ -164,15 +164,15 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) { yawTemp = this->actor.yawTowardsPlayer - this->actor.world.rot.y; yaw = ABS_ALT(yawTemp); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BC701C(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BC701C(this, play); } else if (yaw <= 0x2890) { - func_800B8614(&this->actor, globalCtx, 60.0f); + func_800B8614(&this->actor, play, 60.0f); } } -void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BC701C(EnGuruguru* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->unk268 != 0) && (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU)) { @@ -184,14 +184,14 @@ void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) { this->actionFunc = func_80BC7068; } -void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BC7068(EnGuruguru* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk268 != 0) { SkelAnime_Update(&this->skelAnime); } else if (this->unusedTimer == 0) { this->unusedTimer = 6; - if (Message_GetState(&globalCtx->msgCtx) != 5) { + if (Message_GetState(&play->msgCtx) != 5) { if (this->unk266 == 0) { if (this->headZRotTarget != 0) { this->headZRotTarget = 0; @@ -207,11 +207,11 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { } } } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->headZRotTarget = 0; if ((this->textIdIndex == 13) || (this->textIdIndex == 14)) { - func_80151BB4(globalCtx, 0x13); + func_80151BB4(play, 0x13); gSaveContext.save.weekEventReg[79] |= 4; func_80BC6E10(this); return; @@ -223,7 +223,7 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { if (this->actor.textId == 0x292A) { gSaveContext.save.weekEventReg[38] |= 0x10; } - func_80151BB4(globalCtx, 0x13); + func_80151BB4(play, 0x13); func_80BC6E10(this); return; } @@ -234,8 +234,8 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { if (this->textIdIndex == 12) { gSaveContext.save.weekEventReg[38] |= 0x40; func_801A3B48(0); - func_80151BB4(globalCtx, 0x36); - func_80151BB4(globalCtx, 0x13); + func_80151BB4(play, 0x36); + func_80151BB4(play, 0x13); func_80BC6E10(this); return; } @@ -271,11 +271,11 @@ void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { this->skelAnime.playSpeed = 1.0f; } this->unk266 = 1; - func_80151938(globalCtx, textIDs[this->textIdIndex]); + func_80151938(play, textIDs[this->textIdIndex]); return; } func_801A3B48(0); - func_80151BB4(globalCtx, 0x13); + func_80151BB4(play, 0x13); func_80BC6E10(this); } } @@ -288,35 +288,35 @@ void func_80BC73F4(EnGuruguru* this) { this->actionFunc = func_80BC7440; } -void func_80BC7440(EnGuruguru* this, GlobalContext* globalCtx) { +void func_80BC7440(EnGuruguru* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->textIdIndex++; this->actor.textId = textIDs[this->textIdIndex]; func_801A3B48(1); - func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, EXCH_ITEM_MINUS1); this->unk268 = 0; gSaveContext.save.weekEventReg[38] |= 0x40; this->actionFunc = func_80BC7520; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_BREMEN, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_MASK_BREMEN, 300.0f, 300.0f); } } -void func_80BC7520(EnGuruguru* this, GlobalContext* globalCtx) { +void func_80BC7520(EnGuruguru* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BC7068; } else { - func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, EXCH_ITEM_MINUS1); } } -void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnGuruguru_Update(Actor* thisx, PlayState* play) { EnGuruguru* this = THIS; s32 yaw; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yawTemp; if (!gSaveContext.save.isNight) { @@ -329,7 +329,7 @@ void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == 2) { if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f) { @@ -363,13 +363,12 @@ void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->headXRot, this->headXRotTarget, 1, 3000, 0); Math_SmoothStepToS(&this->headZRot, this->headZRotTarget, 1, 1000, 0); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnGuruguru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnGuruguru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnGuruguru* this = THIS; if (limbIndex == 14) { @@ -380,15 +379,15 @@ s32 EnGuruguru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnGuruguru_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnGuruguru_Draw(Actor* thisx, PlayState* play) { EnGuruguru* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->texIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->texIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGuruguru_OverrideLimbDraw, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h index 98d8d05488..2178c62783 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h @@ -5,7 +5,7 @@ struct EnGuruguru; -typedef void (*EnGuruguruActionFunc)(struct EnGuruguru*, GlobalContext*); +typedef void (*EnGuruguruActionFunc)(struct EnGuruguru*, PlayState*); typedef struct EnGuruguru { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index 8feabc0c75..a5b8b3c300 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -13,24 +13,24 @@ #define THIS ((EnHakurock*)thisx) -void EnHakurock_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHakurock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHakurock_Update(Actor* thisx, GlobalContext* globalCtx); +void EnHakurock_Init(Actor* thisx, PlayState* play); +void EnHakurock_Destroy(Actor* thisx, PlayState* play); +void EnHakurock_Update(Actor* thisx, PlayState* play); void func_80B21BE0(BossHakugin* parent, Vec3f* arg1, s32 arg2); void func_80B21EA4(EnHakurock* this, s32 arg1); void func_80B21FFC(EnHakurock* this); -void func_80B22040(EnHakurock* this, GlobalContext* globalCtx); +void func_80B22040(EnHakurock* this, PlayState* play); void func_80B220A8(EnHakurock* this); -void func_80B221E8(EnHakurock* this, GlobalContext* globalCtx); -void func_80B222AC(EnHakurock* this, GlobalContext* globalCtx); -void func_80B2242C(EnHakurock* this, GlobalContext* globalCtx); +void func_80B221E8(EnHakurock* this, PlayState* play); +void func_80B222AC(EnHakurock* this, PlayState* play); +void func_80B2242C(EnHakurock* this, PlayState* play); void func_80B224C0(EnHakurock* this); -void func_80B22500(EnHakurock* this, GlobalContext* globalCtx); +void func_80B22500(EnHakurock* this, PlayState* play); void func_80B226AC(EnHakurock* this); -void func_80B22750(EnHakurock* this, GlobalContext* globalCtx); -void func_80B228F4(Actor* thisx, GlobalContext* globalCtx); -void EnHakurock_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80B22750(EnHakurock* this, PlayState* play); +void func_80B228F4(Actor* thisx, PlayState* play); +void EnHakurock_Draw(Actor* thisx, PlayState* play); const ActorInit En_Hakurock_InitVars = { ACTOR_EN_HAKUROCK, @@ -68,11 +68,11 @@ static CollisionCheckInfoInit sColChkInfoInit = { 0, 60, 60, MASS_IMMOVABLE }; // Stalactite -void EnHakurock_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHakurock_Init(Actor* thisx, PlayState* play) { EnHakurock* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 52.0f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (this->actor.params == EN_HAKUROCK_TYPE_BOULDER) { this->actor.gravity = -1.5f; @@ -84,10 +84,10 @@ void EnHakurock_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B21FFC(this); } -void EnHakurock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHakurock_Destroy(Actor* thisx, PlayState* play) { EnHakurock* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B21BE0(BossHakugin* parent, Vec3f* arg1, s32 arg2) { @@ -173,11 +173,11 @@ void func_80B21FFC(EnHakurock* this) { this->actionFunc = func_80B22040; } -void func_80B22040(EnHakurock* this, GlobalContext* globalCtx) { +void func_80B22040(EnHakurock* this, PlayState* play) { if (this->actor.params == EN_HAKUROCK_TYPE_BOULDER) { func_80B220A8(this); } else if (this->actor.params == EN_HAKUROCK_TYPE_UNK_2) { - func_80B222AC(this, globalCtx); + func_80B222AC(this, play); } else if (this->actor.params == EN_HAKUROCK_TYPE_FENCE_PILLAR) { func_80B226AC(this); } @@ -201,7 +201,7 @@ void func_80B220A8(EnHakurock* this) { this->actionFunc = func_80B221E8; } -void func_80B221E8(EnHakurock* this, GlobalContext* globalCtx) { +void func_80B221E8(EnHakurock* this, PlayState* play) { if (this->counter > 0) { this->counter--; } @@ -217,8 +217,8 @@ void func_80B221E8(EnHakurock* this, GlobalContext* globalCtx) { } } -void func_80B222AC(EnHakurock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B222AC(EnHakurock* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angle; this->actor.draw = EnHakurock_Draw; @@ -240,7 +240,7 @@ void func_80B222AC(EnHakurock* this, GlobalContext* globalCtx) { this->actionFunc = func_80B2242C; } -void func_80B2242C(EnHakurock* this, GlobalContext* globalCtx) { +void func_80B2242C(EnHakurock* this, PlayState* play) { if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.oc == this->actor.parent)) { func_80B21EA4(this, 1); func_80B21FFC(this); @@ -259,8 +259,8 @@ void func_80B224C0(EnHakurock* this) { this->actionFunc = func_80B22500; } -void func_80B22500(EnHakurock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B22500(EnHakurock* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->counter > 0) { this->counter--; @@ -307,52 +307,52 @@ void func_80B226AC(EnHakurock* this) { this->actionFunc = func_80B22750; } -void func_80B22750(EnHakurock* this, GlobalContext* globalCtx) { +void func_80B22750(EnHakurock* this, PlayState* play) { if (this->actor.params == EN_HAKUROCK_TYPE_UNK_0) { func_80B21EA4(this, 3); func_80B21FFC(this); } } -void EnHakurock_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHakurock_Update(Actor* thisx, PlayState* play) { EnHakurock* this = THIS; s16 rockParams; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); rockParams = this->actor.params; if ((rockParams == EN_HAKUROCK_TYPE_BOULDER) || (rockParams == EN_HAKUROCK_TYPE_UNK_2)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, this->collider.dim.radius, 0.0f, 0x85); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider.dim.radius, 0.0f, 0x85); if (this->actor.floorHeight == BGCHECK_Y_MIN) { func_80B21FFC(this); } else { 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); } } else if ((rockParams == EN_HAKUROCK_TYPE_STALACTITE) || (rockParams == EN_HAKUROCK_TYPE_FENCE_PILLAR)) { 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_80B228F4(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void func_80B228F4(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 185, 24, 255); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnHakurock_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void EnHakurock_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(-100.0f, 0.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_boss_hakugin_DL_011100); gSPDisplayList(POLY_OPA_DISP++, object_boss_hakugin_DL_011178); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.h b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.h index eb1c4eb5d4..93931e9f33 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.h +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.h @@ -5,7 +5,7 @@ struct EnHakurock; -typedef void (*EnHakurockActionFunc)(struct EnHakurock*, GlobalContext*); +typedef void (*EnHakurockActionFunc)(struct EnHakurock*, PlayState*); typedef enum { /* 0x0 */ EN_HAKUROCK_TYPE_UNK_0, diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index f90ed476b0..38f86041b3 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -11,15 +11,15 @@ #define THIS ((EnHanabi*)thisx) -void EnHanabi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHanabi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHanabi_Update(Actor* thisx, GlobalContext* globalCtx); +void EnHanabi_Init(Actor* thisx, PlayState* play); +void EnHanabi_Destroy(Actor* thisx, PlayState* play); +void EnHanabi_Update(Actor* thisx, PlayState* play); -void func_80B23894(EnHanabi* this, GlobalContext* globalCtx); -void func_80B238D4(EnHanabi* this, GlobalContext* globalCtx); -void func_80B23910(EnHanabi* this, GlobalContext* globalCtx); -void func_80B23934(EnHanabi* this, GlobalContext* globalCtx); -void EnHanabi_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80B23894(EnHanabi* this, PlayState* play); +void func_80B238D4(EnHanabi* this, PlayState* play); +void func_80B23910(EnHanabi* this, PlayState* play); +void func_80B23934(EnHanabi* this, PlayState* play); +void EnHanabi_Draw(Actor* thisx, PlayState* play); const ActorInit En_Hanabi_InitVars = { ACTOR_EN_HANABI, @@ -133,15 +133,15 @@ s32 func_80B22F34(EnHanabiStruct* arg0) { return count; } -void func_80B22FA8(EnHanabiStruct* arg0, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80B22FA8(EnHanabiStruct* arg0, PlayState* play2) { + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 i; u8 sp53; OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); @@ -154,17 +154,16 @@ void func_80B22FA8(EnHanabiStruct* arg0, GlobalContext* globalCtx2) { for (i = 0; i < 400; i++, arg0++) { if (arg0->unk_00 == 1) { Matrix_Translate(arg0->unk_08.x, arg0->unk_08.y, arg0->unk_08.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if (arg0->unk_01 < 40) { Matrix_Scale(arg0->unk_04 * 0.025f * arg0->unk_01, arg0->unk_04 * 0.025f * arg0->unk_01, 1.0f, MTXMODE_APPLY); } else { Matrix_Scale(arg0->unk_04, arg0->unk_04, 1.0f, MTXMODE_APPLY); } - Matrix_RotateZS(globalCtx->gameplayFrames * 4864, MTXMODE_APPLY); + Matrix_RotateZS(play->gameplayFrames * 4864, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (sp53 != arg0->unk_02) { gDPPipeSync(POLY_XLU_DISP++); @@ -189,8 +188,8 @@ void func_80B22FA8(EnHanabiStruct* arg0, GlobalContext* globalCtx2) { CLOSE_DISPS(gfxCtx); } -void EnHanabi_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHanabi_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHanabi* this = THIS; s32 i; @@ -204,7 +203,7 @@ void EnHanabi_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(this->unk_4608); i++) { Lights_PointNoGlowSetInfo(&this->unk_4608[i], thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 255, 255, 255, -1); - this->unk_4634[i] = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->unk_4608[i]); + this->unk_4634[i] = LightContext_InsertLight(play, &play->lightCtx, &this->unk_4608[i]); } if (ENHANABI_GET_1F(thisx) == ENHANABI_1F_1) { @@ -213,13 +212,13 @@ void EnHanabi_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnHanabi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHanabi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHanabi* this = THIS; s32 i; for (i = 0; i < ARRAY_COUNT(this->unk_4634); i++) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->unk_4634[i]); + LightContext_RemoveLight(play, &play->lightCtx, this->unk_4634[i]); } } @@ -264,7 +263,7 @@ void func_80B235CC(EnHanabi* this, Vec3f* arg1, s32 arg2) { } } -void func_80B236C8(EnHanabi* this, GlobalContext* globalCtx) { +void func_80B236C8(EnHanabi* this, PlayState* play) { Vec3f sp34; f32 sp30; s32 pad; @@ -303,52 +302,52 @@ void func_80B236C8(EnHanabi* this, GlobalContext* globalCtx) { } } -void func_80B23894(EnHanabi* this, GlobalContext* globalCtx) { - func_80B236C8(this, globalCtx); +void func_80B23894(EnHanabi* this, PlayState* play) { + func_80B236C8(this, play); if (func_80B22F34(this->unk_148) == 0) { Actor_MarkForDeath(&this->actor); } } -void func_80B238D4(EnHanabi* this, GlobalContext* globalCtx) { - func_80B236C8(this, globalCtx); +void func_80B238D4(EnHanabi* this, PlayState* play) { + func_80B236C8(this, play); if (this->actor.home.rot.x == 0) { this->actionFunc = func_80B23894; } } -void func_80B23910(EnHanabi* this, GlobalContext* globalCtx) { +void func_80B23910(EnHanabi* this, PlayState* play) { if (this->actor.home.rot.x != 0) { this->actionFunc = func_80B238D4; } } -void func_80B23934(EnHanabi* this, GlobalContext* globalCtx) { +void func_80B23934(EnHanabi* this, PlayState* play) { if ((gSaveContext.save.entranceIndex == 0x5410) && (gSaveContext.sceneSetupIndex == 7)) { - if (globalCtx->csCtx.frames > 1650) { - func_80B236C8(this, globalCtx); + if (play->csCtx.frames > 1650) { + func_80B236C8(this, play); func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); } } - if ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7) && - (globalCtx->csCtx.currentCsIndex == 0) && (globalCtx->csCtx.frames == 610)) { + if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7) && + (play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 610)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_GROAN); } } -void EnHanabi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHanabi_Update(Actor* thisx, PlayState* play) { EnHanabi* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80B22E0C(this->unk_148); } -void EnHanabi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHanabi_Draw(Actor* thisx, PlayState* play) { EnHanabi* this = THIS; Matrix_Push(); - func_80B22FA8(this->unk_148, globalCtx); + func_80B22FA8(this->unk_148, play); Matrix_Pop(); } diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.h b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.h index ed4963daf2..a219ab2baf 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.h +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.h @@ -5,7 +5,7 @@ struct EnHanabi; -typedef void (*EnHanabiActionFunc)(struct EnHanabi*, GlobalContext*); +typedef void (*EnHanabiActionFunc)(struct EnHanabi*, PlayState*); #define ENHANABI_GET_1F(thisx) ((thisx)->params & 0x1F) 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 1d7914d5a8..5eb2292fc1 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -11,10 +11,10 @@ #define THIS ((EnHata*)thisx) -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2); -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* play2); +void EnHata_Draw(Actor* thisx, PlayState* play); const ActorInit En_Hata_InitVars = { ACTOR_EN_HATA, @@ -28,45 +28,45 @@ const ActorInit En_Hata_InitVars = { (ActorFunc)EnHata_Draw, }; -void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Init(Actor* thisx, PlayState* play) { EnHata* this = THIS; s32 rand; f32 endFrame; - SkelAnime_Init(globalCtx, &this->skelAnime, &object_hata_Skel_002FD0, NULL, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &object_hata_Skel_002FD0, NULL, this->jointTable, this->morphTable, OBJECT_HATA_LIMB_MAX); endFrame = Animation_GetLastFrame(&object_hata_Anim_000444); Animation_Change(&this->skelAnime, &object_hata_Anim_000444, 1.0f, 0.0f, endFrame, ANIMMODE_LOOP, 0.0f); rand = Rand_ZeroFloat(endFrame); this->skelAnime.curFrame = rand; - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hata_Colheader_0000C0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_hata_Colheader_0000C0); Actor_SetScale(&this->dyna.actor, 0.013f); this->dyna.actor.uncullZoneScale = 500.0f; this->dyna.actor.uncullZoneDownward = 500.0f; this->dyna.actor.uncullZoneForward = 2200.0f; } -void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Destroy(Actor* thisx, PlayState* play) { EnHata* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + 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 = THIS; Vec3f sp34; f32 phi_fv0; s32 pad; - phi_fv0 = CLAMP(globalCtx->envCtx.windSpeed / 120.0f, 0.0f, 1.0f); + phi_fv0 = CLAMP(play->envCtx.windSpeed / 120.0f, 0.0f, 1.0f); this->skelAnime.playSpeed = 2.75f * phi_fv0; this->skelAnime.playSpeed += 1.0f + Rand_ZeroFloat(1.25f); - sp34.x = globalCtx->envCtx.windDir.x; - sp34.y = globalCtx->envCtx.windDir.y + ((1.0f - phi_fv0) * 240.0f); + sp34.x = play->envCtx.windDir.x; + sp34.y = play->envCtx.windDir.y + ((1.0f - phi_fv0) * 240.0f); sp34.y = CLAMP(sp34.y, -118.0f, 118.0f); - sp34.z = globalCtx->envCtx.windDir.z; + sp34.z = play->envCtx.windDir.z; phi_fv0 = CLAMP(phi_fv0, 0.1f, 0.4f); Math_ApproachF(&this->unk_2A4.x, sp34.x, phi_fv0, 1000.0f); @@ -81,8 +81,7 @@ void EnHata_Update(Actor* thisx, GlobalContext* globalCtx2) { SkelAnime_Update(&this->skelAnime); } -s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnHata_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHata* this = THIS; if ((limbIndex == OBJECT_HATA_LIMB_04) || (limbIndex == OBJECT_HATA_LIMB_0D)) { @@ -92,10 +91,10 @@ s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHata_Draw(Actor* thisx, PlayState* play) { EnHata* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, NULL, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, NULL, &this->dyna.actor); } diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index bb2fb002b7..74693be4e6 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -11,15 +11,15 @@ #define THIS ((EnHeishi*)thisx) -void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHeishi_Init(Actor* thisx, PlayState* play); +void EnHeishi_Destroy(Actor* thisx, PlayState* play); +void EnHeishi_Update(Actor* thisx, PlayState* play); +void EnHeishi_Draw(Actor* thisx, PlayState* play); void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex); void EnHeishi_SetHeadRotation(EnHeishi* this); void EnHeishi_SetupIdle(EnHeishi* this); -void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx); +void EnHeishi_Idle(EnHeishi* this, PlayState* play); typedef enum { /* 0 */ HEISHI_ANIMATION_STAND_HAND_ON_HIP, @@ -61,12 +61,12 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi_Init(Actor* thisx, PlayState* play) { EnHeishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, - this->morphTable, HEISHI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, this->morphTable, + HEISHI_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->paramsCopy = this->actor.params; this->yawTowardsPlayer = this->actor.world.rot.y; @@ -89,15 +89,15 @@ void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; this->actor.gravity = -3.0f; - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->actor.flags |= ACTOR_FLAG_8000000; EnHeishi_SetupIdle(this); } -void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi_Destroy(Actor* thisx, PlayState* play) { EnHeishi* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex) { @@ -139,10 +139,10 @@ void EnHeishi_SetupIdle(EnHeishi* this) { this->actionFunc = EnHeishi_Idle; } -void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx) { +void EnHeishi_Idle(EnHeishi* this, PlayState* play) { } -void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi_Update(Actor* thisx, PlayState* play) { s32 pad; EnHeishi* this = THIS; @@ -155,9 +155,9 @@ void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->paramsCopy != 0) && (gSaveContext.save.day == 3) && gSaveContext.save.isNight) { Actor_MarkForDeath(&this->actor); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 29); Actor_SetScale(&this->actor, 0.01f); if (this->shouldSetHeadRotation) { EnHeishi_SetHeadRotation(this); @@ -167,12 +167,11 @@ void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 3000, 0); Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 1000, 0); Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } } -s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHeishi* this = THIS; if (limbIndex == HEISHI_LIMB_HEAD) { @@ -184,10 +183,10 @@ s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dLi return false; } -void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHeishi_Draw(Actor* thisx, PlayState* play) { EnHeishi* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHeishi_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h index de65bac725..22071de5df 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h @@ -5,7 +5,7 @@ struct EnHeishi; -typedef void (*EnHeishiActionFunc)(struct EnHeishi*, GlobalContext*); +typedef void (*EnHeishiActionFunc)(struct EnHeishi*, PlayState*); typedef enum { /* 0 */ HEISHI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 2b77feacf1..1e73cda444 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -11,25 +11,25 @@ #define THIS ((EnHg*)thisx) -void EnHg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHg_Init(Actor* thisx, PlayState* play); +void EnHg_Destroy(Actor* thisx, PlayState* play); +void EnHg_Update(Actor* thisx, PlayState* play); +void EnHg_Draw(Actor* thisx, PlayState* play); void func_80BCF354(EnHg* this); -void func_80BCF398(EnHg* this, GlobalContext* globalCtx); +void func_80BCF398(EnHg* this, PlayState* play); void func_80BCF468(EnHg* this); void func_80BCF468(EnHg* this); -void func_80BCF4AC(EnHg* this, GlobalContext* globalCtx); +void func_80BCF4AC(EnHg* this, PlayState* play); void func_80BCF5F0(EnHg* this); -void func_80BCF634(EnHg* this, GlobalContext* globalCtx); +void func_80BCF634(EnHg* this, PlayState* play); void func_80BCF68C(EnHg* this); -void func_80BCF6D0(EnHg* this, GlobalContext* globalCtx); -void func_80BCF8A0(EnHg* this, GlobalContext* globalCtx); +void func_80BCF6D0(EnHg* this, PlayState* play); +void func_80BCF8A0(EnHg* this, PlayState* play); void func_80BCF93C(EnHg* this); -void func_80BCF95C(EnHg* this, GlobalContext* globalCtx); -s32 EnHg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); +void func_80BCF95C(EnHg* this, PlayState* play); +s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); const ActorInit En_Hg_InitVars = { ACTOR_EN_HG, @@ -115,16 +115,16 @@ static AnimationInfo sAnimations[] = { static u32 D_80BD00C8 = false; -void EnHg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHg_Init(Actor* thisx, PlayState* play) { EnHg* this = THIS; s16 currentCutscene = this->actor.cutscene; s32 i; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_harfgibud_Skel_008580, &object_harfgibud_Anim_00260C, + SkelAnime_InitFlex(play, &this->skelAnime, &object_harfgibud_Skel_008580, &object_harfgibud_Anim_00260C, this->jointTable, this->morphTable, HG_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, &sColChkInfoInit2); if ((gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.weekEventReg[52] & 0x20)) { Actor_MarkForDeath(&this->actor); @@ -142,10 +142,10 @@ void EnHg_Init(Actor* thisx, GlobalContext* globalCtx) { func_80BCF354(this); } -void EnHg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHg_Destroy(Actor* thisx, PlayState* play) { EnHg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BCF354(EnHg* this) { @@ -153,14 +153,14 @@ void func_80BCF354(EnHg* this) { this->actionFunc = func_80BCF398; } -void func_80BCF398(EnHg* this, GlobalContext* globalCtx) { +void func_80BCF398(EnHg* this, PlayState* play) { if (this->actor.colChkInfo.health == 1) { if ((this->actor.xzDistToPlayer < 200.0f && this->actor.playerHeightRel < 40.0f) && - !Cutscene_CheckActorAction(globalCtx, 0x1E3)) { + !Cutscene_CheckActorAction(play, 0x1E3)) { func_80BCF468(this); } - if ((gSaveContext.sceneSetupIndex == 0 && globalCtx->csCtx.currentCsIndex == 0) && - (globalCtx->csCtx.frames == 20 || globalCtx->csCtx.frames == 60)) { + if ((gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 0) && + (play->csCtx.frames == 20 || play->csCtx.frames == 60)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HALF_REDEAD_SURPRISE); } } @@ -171,12 +171,12 @@ void func_80BCF468(EnHg* this) { this->actionFunc = func_80BCF4AC; } -void func_80BCF4AC(EnHg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BCF4AC(EnHg* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; this->actor.speedXZ = 1.6f; - if (!(player->stateFlags2 & 0x08000000) && Message_GetState(&globalCtx->msgCtx) == 0) { + if (!(player->stateFlags2 & 0x08000000) && Message_GetState(&play->msgCtx) == 0) { if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) || ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) { Actor_MoveWithGravity(&this->actor); @@ -195,8 +195,8 @@ void func_80BCF5F0(EnHg* this) { this->actionFunc = func_80BCF634; } -void func_80BCF634(EnHg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BCF634(EnHg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos) < 200.0f) { func_80BCF468(this); @@ -208,23 +208,23 @@ void func_80BCF68C(EnHg* this) { this->actionFunc = func_80BCF6D0; } -void func_80BCF6D0(EnHg* this, GlobalContext* globalCtx) { +void func_80BCF6D0(EnHg* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80BCF5F0(this); } } -void func_80BCF710(EnHg* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 0) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x24F, &this->actor); +void func_80BCF710(EnHg* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x24F, &this->actor); } else { - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } } } -void func_80BCF778(EnHg* this, GlobalContext* globalCtx) { +void func_80BCF778(EnHg* this, PlayState* play) { if (this->actor.colChkInfo.health == 1) { if (this->actionFunc == func_80BCF4AC || this->actionFunc == func_80BCF6D0 || this->actionFunc == func_80BCF634) { @@ -233,17 +233,17 @@ void func_80BCF778(EnHg* this, GlobalContext* globalCtx) { } } -void func_80BCF7D8(EnHg* this, GlobalContext* globalCtx) { +void func_80BCF7D8(EnHg* this, PlayState* play) { if (this->actor.colChkInfo.health) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; func_80BCF68C(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->actionFunc != func_80BCF6D0 && this->actionFunc != func_80BCF8A0 && this->actionFunc != func_80BCF95C) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -252,7 +252,7 @@ void func_80BCF88C(EnHg* this) { this->actionFunc = func_80BCF8A0; } -void func_80BCF8A0(EnHg* this, GlobalContext* globalCtx) { +void func_80BCF8A0(EnHg* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->unk218])) { ActorCutscene_Start(this->cutscenes[this->unk218], &this->actor); func_80BCF93C(this); @@ -270,13 +270,13 @@ void func_80BCF93C(EnHg* this) { this->actionFunc = func_80BCF95C; } -void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 484)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 484); +void func_80BCF95C(EnHg* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 484)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 484); - if (this->cutscenes[3] != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->cutscenes[3] = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (this->cutscenes[3] != play->csCtx.actorActions[actionIndex]->action) { + this->cutscenes[3] = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->currentAnimation = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); @@ -337,16 +337,16 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) { } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); return; - } else if (globalCtx->csCtx.state == 0) { + } else if (play->csCtx.state == 0) { func_80BCF354(this); } this->cutscenes[3] = 0x63; } -void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BCFC0C(EnHg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.colChkInfo.health == 1 && !(fabsf(this->actor.playerHeightRel) >= 80.0f)) { if (player->stateFlags2 & 0x08000000) { @@ -357,8 +357,8 @@ void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { } else { D_80BD00C8 = false; } - if (globalCtx->msgCtx.ocarinaMode == 3) { - if (globalCtx->msgCtx.unk1202E == 7 && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (play->msgCtx.ocarinaMode == 3) { + if (play->msgCtx.unk1202E == 7 && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (INV_CONTENT(ITEM_MASK_GIBDO) == ITEM_MASK_GIBDO) { this->unk218 = 3; } else { @@ -379,27 +379,27 @@ void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { return; } } - func_80BCF710(this, globalCtx); + func_80BCF710(this, play); } } } -void EnHg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHg_Update(Actor* thisx, PlayState* play) { EnHg* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - func_80BCF7D8(this, globalCtx); - func_80BCFC0C(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 25.0f, 0.0f, 5); - func_80BCF778(this, globalCtx); + func_80BCF7D8(this, play); + func_80BCFC0C(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 0.0f, 5); + func_80BCF778(this, play); } -s32 EnHg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnHg* this = THIS; if (limbIndex == HG_LIMB_HEAD) { Matrix_Get(&this->unk1D8); @@ -408,15 +408,15 @@ void EnHg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnHg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHg_Draw(Actor* thisx, PlayState* play) { EnHg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHg_OverrideLimbDraw, EnHg_PostLimbDraw, &this->actor); Matrix_Put(&this->unk1D8); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_harfgibud_DL_005E28); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.h b/src/overlays/actors/ovl_En_Hg/z_en_hg.h index 489db0afbb..75703ccbd1 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.h +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.h @@ -5,7 +5,7 @@ struct EnHg; -typedef void (*EnHgActionFunc)(struct EnHg*, GlobalContext*); +typedef void (*EnHgActionFunc)(struct EnHg*, PlayState*); typedef enum { /* 00 */ HG_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index 813800efbc..9a38aba97b 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -11,22 +11,22 @@ #define THIS ((EnHgo*)thisx) -void EnHgo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHgo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHgo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHgo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHgo_Init(Actor* thisx, PlayState* play); +void EnHgo_Destroy(Actor* thisx, PlayState* play); +void EnHgo_Update(Actor* thisx, PlayState* play); +void EnHgo_Draw(Actor* thisx, PlayState* play); void func_80BD03EC(EnHgo* this); -void func_80BD0410(EnHgo* this, GlobalContext* globalCtx); -void func_80BD0434(EnHgo* this, GlobalContext* globalCtx); +void func_80BD0410(EnHgo* this, PlayState* play); +void func_80BD0434(EnHgo* this, PlayState* play); void func_80BD049C(EnHgo* this); -void func_80BD04E0(EnHgo* this, GlobalContext* globalCtx); +void func_80BD04E0(EnHgo* this, PlayState* play); void EnHgo_SetupDialogueHandler(EnHgo* this); -void EnHgo_DefaultDialogueHandler(EnHgo* this, GlobalContext* globalCtx); -void func_80BD06FC(EnHgo* this, GlobalContext* globalCtx); -s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx); -s32 EnHgo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnHgo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); +void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play); +void func_80BD06FC(EnHgo* this, PlayState* play); +s32 func_80BD0898(EnHgo* this, PlayState* play); +s32 EnHgo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnHgo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx); const ActorInit En_Hgo_InitVars = { ACTOR_EN_HGO, @@ -78,15 +78,15 @@ static TexturePtr sEyeTextures[] = { object_harfgibud_Tex_012138, }; -void EnHgo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHgo_Init(Actor* thisx, PlayState* play) { EnHgo* this = THIS; s32 pad; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_harfgibud_Skel_012A58, &object_harfgibud_Anim_00B644, + SkelAnime_InitFlex(play, &this->skelAnime, &object_harfgibud_Skel_012A58, &object_harfgibud_Anim_00B644, this->jointTable, this->morphTable, HGO_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(&thisx->colChkInfo, NULL, &sColChkInfoInit); thisx->targetMode = 6; this->unk_30C = 0; @@ -102,10 +102,10 @@ void EnHgo_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnHgo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHgo_Destroy(Actor* thisx, PlayState* play) { EnHgo* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BD03EC(EnHgo* this) { @@ -113,18 +113,18 @@ void func_80BD03EC(EnHgo* this) { this->actionFunc = func_80BD0410; } -void func_80BD0410(EnHgo* this, GlobalContext* globalCtx) { +void func_80BD0410(EnHgo* this, PlayState* play) { } void func_80BD0420(EnHgo* this) { this->actionFunc = func_80BD0434; } -void func_80BD0434(EnHgo* this, GlobalContext* globalCtx) { +void func_80BD0434(EnHgo* this, PlayState* play) { this->collider.dim.pos.x = this->actor.focus.pos.x; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.focus.pos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80BD049C(EnHgo* this) { @@ -132,40 +132,40 @@ void func_80BD049C(EnHgo* this) { this->actionFunc = func_80BD04E0; } -void func_80BD04E0(EnHgo* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) { +void func_80BD04E0(EnHgo* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { if (!(this->unk_310 & 4)) { this->unk_310 |= 4; - Message_StartTextbox(globalCtx, 0x15A5, &this->actor); + Message_StartTextbox(play, 0x15A5, &this->actor); this->unk_314 = 0x15A5; // That mask is a gibdo } else { - Message_StartTextbox(globalCtx, 0x15A7, &this->actor); + Message_StartTextbox(play, 0x15A7, &this->actor); this->unk_314 = 0x15A7; // can I research that mask } } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { if (!(this->unk_310 & 1)) { this->unk_310 |= 1; - Message_StartTextbox(globalCtx, 0x158F, &this->actor); + Message_StartTextbox(play, 0x158F, &this->actor); this->unk_314 = 0x158F; // Isn't this a fairy } else { - Message_StartTextbox(globalCtx, 0x1593, &this->actor); + Message_StartTextbox(play, 0x1593, &this->actor); this->unk_314 = 0x1593; // Never seen a fairy this lively } } else { if (!(this->unk_310 & 2)) { this->unk_310 |= 2; - Message_StartTextbox(globalCtx, 0x1595, &this->actor); + Message_StartTextbox(play, 0x1595, &this->actor); this->unk_314 = 0x1595; // ghost radar is reacting } else { - Message_StartTextbox(globalCtx, 0x1598, &this->actor); + Message_StartTextbox(play, 0x1598, &this->actor); this->unk_314 = 0x1598; // you seem to be similar to a ghost } } EnHgo_SetupDialogueHandler(this); } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -173,8 +173,8 @@ void EnHgo_SetupDialogueHandler(EnHgo* this) { this->actionFunc = EnHgo_DefaultDialogueHandler; } -void EnHgo_DefaultDialogueHandler(EnHgo* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -182,10 +182,10 @@ void EnHgo_DefaultDialogueHandler(EnHgo* this, GlobalContext* globalCtx) { case 4: break; case 5: - func_80BD06FC(this, globalCtx); + func_80BD06FC(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80BD049C(this); } } @@ -193,66 +193,66 @@ void EnHgo_DefaultDialogueHandler(EnHgo* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80BD06FC(EnHgo* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80BD06FC(EnHgo* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_314) { case 0x158F: - Message_StartTextbox(globalCtx, 0x1590, &this->actor); + Message_StartTextbox(play, 0x1590, &this->actor); this->unk_314 = 0x1590; break; case 0x1590: if (gSaveContext.save.weekEventReg[14] & 4) { - Message_StartTextbox(globalCtx, 0x1591, &this->actor); + Message_StartTextbox(play, 0x1591, &this->actor); this->unk_314 = 0x1591; break; } - Message_StartTextbox(globalCtx, 0x1592, &this->actor); + Message_StartTextbox(play, 0x1592, &this->actor); this->unk_314 = 0x1592; break; case 0x1591: - Message_StartTextbox(globalCtx, 0x1592, &this->actor); + Message_StartTextbox(play, 0x1592, &this->actor); this->unk_314 = 0x1592; break; case 0x1593: - Message_StartTextbox(globalCtx, 0x1594, &this->actor); + Message_StartTextbox(play, 0x1594, &this->actor); this->unk_314 = 0x1594; break; case 0x1595: - Message_StartTextbox(globalCtx, 0x1596, &this->actor); + Message_StartTextbox(play, 0x1596, &this->actor); this->unk_314 = 0x1596; break; case 0x1596: - Message_StartTextbox(globalCtx, 0x1597, &this->actor); + Message_StartTextbox(play, 0x1597, &this->actor); this->unk_314 = 0x1597; break; case 0x1598: - Message_StartTextbox(globalCtx, 0x1599, &this->actor); + Message_StartTextbox(play, 0x1599, &this->actor); this->unk_314 = 0x1599; break; case 0x15A5: - Message_StartTextbox(globalCtx, 0x15A6, &this->actor); + Message_StartTextbox(play, 0x15A6, &this->actor); this->unk_314 = 0x15A6; break; case 0x15A6: - Message_StartTextbox(globalCtx, 0x15A7, &this->actor); + Message_StartTextbox(play, 0x15A7, &this->actor); this->unk_314 = 0x15A7; break; case 0x15A7: - func_801477B4(globalCtx); + func_801477B4(play); func_80BD049C(this); break; } } } -s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx) { +s32 func_80BD0898(EnHgo* this, PlayState* play) { s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 486)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 486); - if (this->unk_316 != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->unk_316 = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_CheckActorAction(play, 486)) { + actionIndex = Cutscene_GetActorActionIndex(play, 486); + if (this->unk_316 != play->csCtx.actorActions[actionIndex]->action) { + this->unk_316 = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_218 = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); @@ -285,7 +285,7 @@ s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx) { if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->unk_312 == 0)) { this->unk_312 = 1; if ((gSaveContext.sceneSetupIndex == 0) && - ((globalCtx->csCtx.currentCsIndex == 2) || (globalCtx->csCtx.currentCsIndex == 4))) { + ((play->csCtx.currentCsIndex == 2) || (play->csCtx.currentCsIndex == 4))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_GBVO02); } } @@ -300,13 +300,13 @@ s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); return true; } - if ((globalCtx->csCtx.state == 0) && (((gSaveContext.save.weekEventReg[75]) & 0x20)) && + if ((play->csCtx.state == 0) && (((gSaveContext.save.weekEventReg[75]) & 0x20)) && (this->actionFunc == func_80BD0410)) { this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ELF_MSG2, this->actor.focus.pos.x, this->actor.focus.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_ELF_MSG2, this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z, 7, 0, 0, 0x7F5A); func_80BD0420(this); } @@ -314,8 +314,8 @@ s32 func_80BD0898(EnHgo* this, GlobalContext* globalCtx) { return false; } -void func_80BD0B8C(EnHgo* this, GlobalContext* globalCtx) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_300, &this->unk_306, this->actor.focus.pos); +void func_80BD0B8C(EnHgo* this, PlayState* play) { + Actor_TrackPlayer(play, &this->actor, &this->unk_300, &this->unk_306, this->actor.focus.pos); if (this->unk_30E > 2) { this->unk_30E--; } else if (this->unk_30E == 2) { @@ -330,24 +330,24 @@ void func_80BD0B8C(EnHgo* this, GlobalContext* globalCtx) { } } -void EnHgo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHgo_Update(Actor* thisx, PlayState* play) { EnHgo* this = THIS; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - if (func_80BD0898(this, globalCtx)) { + if (func_80BD0898(this, play)) { Actor_TrackNone(&this->unk_300, &this->unk_306); } else if (this->actionFunc != func_80BD0410) { if (this->actionFunc != func_80BD0434) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_80BD0B8C(this, globalCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_80BD0B8C(this, play); } } } -s32 EnHgo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnHgo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHgo* this = THIS; if (limbIndex == HGO_LIMB_PELVIS) { @@ -357,7 +357,7 @@ s32 EnHgo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHgo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { +void EnHgo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { EnHgo* this = THIS; if (limbIndex == HGO_LIMB_PELVIS) { @@ -366,16 +366,16 @@ void EnHgo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnHgo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHgo_Draw(Actor* thisx, PlayState* play) { EnHgo* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->unk_30C])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHgo_OverrideLimbDraw, &EnHgo_PostLimbDraw, &this->actor); Matrix_Put(&this->unk_1D8); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_harfgibud_DL_00F248); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h index f39aab0fdf..994dabcfb2 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h @@ -5,7 +5,7 @@ struct EnHgo; -typedef void (*EnHgoActionFunc)(struct EnHgo*, GlobalContext*); +typedef void (*EnHgoActionFunc)(struct EnHgo*, PlayState*); // Shares the same setup as en_hg typedef enum { diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index e1432c10a3..a4bd59c848 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -11,24 +11,24 @@ #define THIS ((EnHiddenNuts*)thisx) -void EnHiddenNuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHiddenNuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHiddenNuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHiddenNuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHiddenNuts_Init(Actor* thisx, PlayState* play); +void EnHiddenNuts_Destroy(Actor* thisx, PlayState* play); +void EnHiddenNuts_Update(Actor* thisx, PlayState* play); +void EnHiddenNuts_Draw(Actor* thisx, PlayState* play); void func_80BDB268(EnHiddenNuts* this); -void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx); +void func_80BDB2B8(EnHiddenNuts* this, PlayState* play); void func_80BDB580(EnHiddenNuts* this); -void func_80BDB59C(EnHiddenNuts* this, GlobalContext* globalCtx); +void func_80BDB59C(EnHiddenNuts* this, PlayState* play); void func_80BDB788(EnHiddenNuts* this); -void func_80BDB7E8(EnHiddenNuts* this, GlobalContext* globalCtx); -void func_80BDB8F4(EnHiddenNuts* this, GlobalContext* globalCtx); +void func_80BDB7E8(EnHiddenNuts* this, PlayState* play); +void func_80BDB8F4(EnHiddenNuts* this, PlayState* play); void func_80BDB930(EnHiddenNuts* this); -void func_80BDB978(EnHiddenNuts* this, GlobalContext* globalCtx); -void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx); -void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx); -void func_80BDBE70(EnHiddenNuts* this, GlobalContext* globalCtx); -void func_80BDBED4(EnHiddenNuts* this, GlobalContext* globalCtx); +void func_80BDB978(EnHiddenNuts* this, PlayState* play); +void func_80BDBA28(EnHiddenNuts* this, PlayState* play); +void func_80BDBB48(EnHiddenNuts* this, PlayState* play); +void func_80BDBE70(EnHiddenNuts* this, PlayState* play); +void func_80BDBED4(EnHiddenNuts* this, PlayState* play); const ActorInit En_Hidden_Nuts_InitVars = { ACTOR_EN_HIDDEN_NUTS, @@ -73,18 +73,18 @@ u8 D_80BDC120[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, }; -void EnHiddenNuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { EnHiddenNuts* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC, + SkelAnime_Init(play, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC, this->jointTable, this->morphTable, 10); Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 0; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_21E = ENHIDDENNUTS_GET_F80(&this->actor); this->switchFlag = ENHIDDENNUTS_GET_SWITCHFLAG(&this->actor); @@ -93,7 +93,7 @@ void EnHiddenNuts_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } - if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { Actor_MarkForDeath(&this->actor); return; } @@ -103,16 +103,16 @@ void EnHiddenNuts_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - this->path = SubS_GetPathByIndex(globalCtx, this->unk_21E, 0x3F); + this->path = SubS_GetPathByIndex(play, this->unk_21E, 0x3F); this->unk_226 = this->actor.cutscene; func_801A5080(2); func_80BDB268(this); } -void EnHiddenNuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHiddenNuts_Destroy(Actor* thisx, PlayState* play) { EnHiddenNuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BDB1B4(EnHiddenNuts* this, s32 arg1) { @@ -140,8 +140,8 @@ void func_80BDB268(EnHiddenNuts* this) { this->actionFunc = func_80BDB2B8; } -void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); @@ -155,7 +155,7 @@ void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx) { this->unk_20A = 0; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { func_80BDB580(this); return; } @@ -175,20 +175,19 @@ void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx) { sp74.x += randPlusMinusPoint5Scaled(15.0f); sp74.z += randPlusMinusPoint5Scaled(15.0f); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30, - 1); + EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30, 1); } this->unk_218 = 30; } if (!(this->actor.xzDistToPlayer > 120.0f)) { - if ((globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 0)) { - globalCtx->msgCtx.ocarinaMode = 4; + if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.unk1202E == 0)) { + play->msgCtx.ocarinaMode = 4; func_80BDB788(this); } else if (func_801A5100() == 2) { func_80BDB788(this); } else { - func_800B8614(&this->actor, globalCtx, BREG(13) + 100.0f); + func_800B8614(&this->actor, play, BREG(13) + 100.0f); } } } @@ -198,7 +197,7 @@ void func_80BDB580(EnHiddenNuts* this) { this->actionFunc = func_80BDB59C; } -void func_80BDB59C(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDB59C(EnHiddenNuts* this, PlayState* play) { s32 i; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); @@ -218,14 +217,13 @@ void func_80BDB59C(EnHiddenNuts* this, GlobalContext* globalCtx) { sp78.x += randPlusMinusPoint5Scaled(15.0f); sp78.z += randPlusMinusPoint5Scaled(15.0f); - EffectSsDtBubble_SpawnCustomColor(globalCtx, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30, - 1); + EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30, 1); } this->unk_218 = 30; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80BDB268(this); } } @@ -239,7 +237,7 @@ void func_80BDB788(EnHiddenNuts* this) { this->actionFunc = func_80BDB7E8; } -void func_80BDB7E8(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) { Vec3f sp3C; if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -259,14 +257,14 @@ void func_80BDB7E8(EnHiddenNuts* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp3C, &this->actor.world.pos); sp3C.y = this->actor.floorHeight + 30.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp3C, 4.0f, 0, 10, 3, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp3C, 4.0f, 0, 10, 3, 15, -1, 10, NULL); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); func_80BDB1B4(this, 7); this->actionFunc = func_80BDB8F4; } -void func_80BDB8F4(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDB8F4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->unk_22C <= curFrame) { @@ -281,7 +279,7 @@ void func_80BDB930(EnHiddenNuts* this) { this->actionFunc = func_80BDB978; } -void func_80BDB978(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDB978(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || @@ -292,12 +290,12 @@ void func_80BDB978(EnHiddenNuts* this, GlobalContext* globalCtx) { if (this->unk_22C <= curFrame) { this->unk_224++; if (this->unk_224 >= 2) { - func_80BDBA28(this, globalCtx); + func_80BDBA28(this, play); } } } -void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { Vec3f sp44; func_80BDB1B4(this, 2); @@ -306,7 +304,7 @@ void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp44, &this->actor.world.pos); sp44.y = this->actor.floorHeight + 30.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp44, 4.0f, 0, 10, 3, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp44, 4.0f, 0, 10, 3, 15, -1, 10, NULL); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); this->unk_208 = 1; @@ -323,7 +321,7 @@ void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx) { this->actionFunc = func_80BDBB48; } -void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { s32 pad[3]; f32 sp58 = this->skelAnime.curFrame; WaterBox* sp54; @@ -331,16 +329,15 @@ void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx) { s16 sp4E = 0; Vec3f sp40; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, - &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && (this->actor.world.pos.y < sp50)) { this->actor.velocity.y = 0.0f; Math_Vec3f_Copy(&sp40, &this->actor.world.pos); sp40.y = sp50; this->actor.gravity = 0.0f; - if ((globalCtx->gameplayFrames % 8) == 0) { - EffectSsGRipple_Spawn(globalCtx, &sp40, 650, 3150, 0); + if ((play->gameplayFrames % 8) == 0) { + EffectSsGRipple_Spawn(play, &sp40, 650, 3150, 0); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || @@ -375,7 +372,7 @@ void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx) { (this->path != NULL)) { this->unk_208++; if (this->unk_208 >= this->path->count) { - func_80BDBE70(this, globalCtx); + func_80BDBE70(this, play); } else if ((this->path != NULL) && !SubS_CopyPointFromPath(this->path, this->unk_208, &this->unk_20C)) { Actor_MarkForDeath(&this->actor); } @@ -383,16 +380,16 @@ void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx) { } } -void func_80BDBE70(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDBE70(EnHiddenNuts* this, PlayState* play) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } func_80BDB1B4(this, 8); this->unk_21A = 5; this->actionFunc = func_80BDBED4; } -void func_80BDBED4(EnHiddenNuts* this, GlobalContext* globalCtx) { +void func_80BDBED4(EnHiddenNuts* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Vec3f sp38; @@ -401,12 +398,12 @@ void func_80BDBED4(EnHiddenNuts* this, GlobalContext* globalCtx) { sp38.y = this->actor.floorHeight; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); - EffectSsHahen_SpawnBurst(globalCtx, &sp38, 4.0f, 0, 10, 3, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp38, 4.0f, 0, 10, 3, 15, -1, 10, NULL); Actor_MarkForDeath(&this->actor); } } -void EnHiddenNuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHiddenNuts_Update(Actor* thisx, PlayState* play) { s32 pad; EnHiddenNuts* this = THIS; @@ -417,22 +414,22 @@ void EnHiddenNuts_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 20.0f); SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Math_ApproachF(&this->actor.shape.yOffset, this->unk_228, 0.5f, 200.0f); if (this->unk_21A >= 4) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 40.0f, 0x1D); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void EnHiddenNuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHiddenNuts_Draw(Actor* thisx, PlayState* play) { EnHiddenNuts* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h index baff911b68..5ed3668f7d 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h @@ -5,7 +5,7 @@ struct EnHiddenNuts; -typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, GlobalContext*); +typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*); #define ENHIDDENNUTS_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) #define ENHIDDENNUTS_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F) diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index c9b9485ce3..71194f79c1 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -11,32 +11,32 @@ #define THIS ((EnHintSkb*)thisx) -void EnHintSkb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHintSkb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHintSkb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnHintSkb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnHintSkb_Init(Actor* thisx, PlayState* play); +void EnHintSkb_Destroy(Actor* thisx, PlayState* play); +void EnHintSkb_Update(Actor* thisx, PlayState* play); +void EnHintSkb_Draw(Actor* thisx, PlayState* play); void func_80C1FE0C(EnHintSkb* this); -void func_80C1FE20(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C1FE80(EnHintSkb* this, GlobalContext* globalCtx); +void func_80C1FE20(EnHintSkb* this, PlayState* play); +void func_80C1FE80(EnHintSkb* this, PlayState* play); void func_80C1FF30(EnHintSkb* this); -void func_80C1FF88(EnHintSkb* this, GlobalContext* globalCtx); +void func_80C1FF88(EnHintSkb* this, PlayState* play); void func_80C2003C(EnHintSkb* this); -void func_80C200B8(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C2016C(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C20334(EnHintSkb* this, GlobalContext* globalCtx); +void func_80C200B8(EnHintSkb* this, PlayState* play); +void func_80C2016C(EnHintSkb* this, PlayState* play); +void func_80C20334(EnHintSkb* this, PlayState* play); void func_80C20484(EnHintSkb* this); -void func_80C204F0(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C20590(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C2069C(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C2077C(EnHintSkb* this, GlobalContext* globalCtx); +void func_80C204F0(EnHintSkb* this, PlayState* play); +void func_80C20590(EnHintSkb* this, PlayState* play); +void func_80C2069C(EnHintSkb* this, PlayState* play); +void func_80C2077C(EnHintSkb* this, PlayState* play); void func_80C208BC(EnHintSkb* this); -void func_80C208D0(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C20B88(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C20C24(EnHintSkb* this, GlobalContext* globalCtx); +void func_80C208D0(EnHintSkb* this, PlayState* play); +void func_80C20B88(EnHintSkb* this, PlayState* play); +void func_80C20C24(EnHintSkb* this, PlayState* play); s32 func_80C21414(EnHintSkb* this); -void func_80C21468(EnHintSkb* this, GlobalContext* globalCtx); -void func_80C215E4(GlobalContext* globalCtx, EnHintSkb* this, Vec3f* arg2); +void func_80C21468(EnHintSkb* this, PlayState* play); +void func_80C215E4(PlayState* play, EnHintSkb* this, Vec3f* arg2); const ActorInit En_Hint_Skb_InitVars = { ACTOR_EN_HINT_SKB, @@ -146,15 +146,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void EnHintSkb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHintSkb_Init(Actor* thisx, PlayState* play) { s32 pad; EnHintSkb* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, this->morphtable, 20); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElement); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElement); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.hintId = 0x55; @@ -166,17 +166,17 @@ void EnHintSkb_Init(Actor* thisx, GlobalContext* globalCtx) { func_80C1FE0C(this); } -void EnHintSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHintSkb_Destroy(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80C1FE0C(EnHintSkb* this) { this->actionFunc = func_80C1FE20; } -void func_80C1FE20(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C1FE20(EnHintSkb* this, PlayState* play) { } void func_80C1FE30(EnHintSkb* this) { @@ -185,7 +185,7 @@ void func_80C1FE30(EnHintSkb* this) { this->actionFunc = func_80C1FE80; } -void func_80C1FE80(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C1FE80(EnHintSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_WALK); } @@ -203,7 +203,7 @@ void func_80C1FF30(EnHintSkb* this) { this->actionFunc = func_80C1FF88; } -void func_80C1FF88(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C1FF88(EnHintSkb* this, PlayState* play) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); func_80C2003C(this); @@ -214,7 +214,7 @@ void func_80C1FF88(EnHintSkb* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (func_80C21414(this) && (Player_GetMask(globalCtx) != PLAYER_MASK_CAPTAIN)) { + if (func_80C21414(this) && (Player_GetMask(play) != PLAYER_MASK_CAPTAIN)) { func_80C1FF30(this); } else { func_80C1FE30(this); @@ -228,7 +228,7 @@ void func_80C2003C(EnHintSkb* this) { this->actionFunc = func_80C200B8; } -void func_80C200B8(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C200B8(EnHintSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (func_80C21414(this)) { func_80C1FF30(this); @@ -246,7 +246,7 @@ void func_80C2011C(EnHintSkb* this) { this->actionFunc = func_80C2016C; } -void func_80C2016C(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C2016C(EnHintSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } else if (this->actor.bgCheckFlags & 1) { @@ -257,7 +257,7 @@ void func_80C2016C(EnHintSkb* this, GlobalContext* globalCtx) { if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { if (this->actor.colChkInfo.health == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); } else if (this->skelAnime.animation == &object_skb_Anim_00697C) { func_80C1FE0C(this); @@ -286,12 +286,12 @@ void func_80C20274(EnHintSkb* this) { this->actionFunc = func_80C20334; } -void func_80C20334(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C20334(EnHintSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { s32 i; for (i = 0; i < 10; i++) { - func_80C215E4(globalCtx, this, &this->actor.world.pos); + func_80C215E4(play, this, &this->actor.world.pos); } this->actor.speedXZ = 0.0f; } @@ -322,12 +322,12 @@ void func_80C20484(EnHintSkb* this) { this->actionFunc = func_80C204F0; } -void func_80C204F0(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C204F0(EnHintSkb* this, PlayState* play) { if (!(this->unk_3E8 & 8)) { return; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x10); Actor_MarkForDeath(&this->actor); } @@ -339,7 +339,7 @@ void func_80C20540(EnHintSkb* this) { this->actionFunc = func_80C20590; } -void func_80C20590(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C20590(EnHintSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -351,11 +351,11 @@ void func_80C20590(EnHintSkb* this, GlobalContext* globalCtx) { this->unk_3E8 |= 1; func_80C20274(this); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); } } else if (this->drawDmgEffTimer == 1) { - func_80C21468(this, globalCtx); + func_80C21468(this, play); } } @@ -366,7 +366,7 @@ void func_80C2066C(EnHintSkb* this) { this->actionFunc = func_80C2069C; } -void func_80C2069C(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C2069C(EnHintSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -378,7 +378,7 @@ void func_80C2069C(EnHintSkb* this, GlobalContext* globalCtx) { this->unk_3E8 |= 1; func_80C20274(this); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); } } @@ -390,15 +390,15 @@ void func_80C2075C(EnHintSkb* this) { this->actionFunc = func_80C2077C; } -void func_80C2077C(EnHintSkb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80C2077C(EnHintSkb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3E0 = 1; if (this->unk_3DC == 0) { this->unk_3DC = 1; - Message_StartTextbox(globalCtx, 0x1147, &this->actor); + Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; if (this->skelAnime.animation == &object_skb_Anim_00697C) { - globalCtx->msgCtx.msgMode = 0x44; + play->msgCtx.msgMode = 0x44; this->actor.speedXZ = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; @@ -406,12 +406,12 @@ void func_80C2077C(EnHintSkb* this, GlobalContext* globalCtx) { } } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); - Message_StartTextbox(globalCtx, 0x1148, &this->actor); + Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; } func_80C208BC(this); } else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -419,26 +419,26 @@ void func_80C208BC(EnHintSkb* this) { this->actionFunc = func_80C208D0; } -void func_80C208D0(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C208D0(EnHintSkb* this, PlayState* play) { this->unk_3DE = 0; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 3: - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { this->unk_3DE = 1; } break; case 4: - func_80C20B88(this, globalCtx); + func_80C20B88(this, play); break; case 5: - func_80C20C24(this, globalCtx); + func_80C20C24(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80C2075C(this); } break; @@ -456,13 +456,13 @@ void func_80C208D0(EnHintSkb* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; for (i = 0; i < 10; i++) { - func_80C215E4(globalCtx, this, &this->actor.world.pos); + func_80C215E4(play, this, &this->actor.world.pos); } } if ((this->skelAnime.animation == &object_skb_Anim_003584) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Message_StartTextbox(globalCtx, 0x1147, &this->actor); + Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); } @@ -474,76 +474,76 @@ void func_80C208D0(EnHintSkb* this, GlobalContext* globalCtx) { } } -void func_80C20A74(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C20A74(EnHintSkb* this, PlayState* play) { s32 params = ENHINTSKB_GET_FF(&this->actor); switch (params) { case 1: - Message_StartTextbox(globalCtx, 0x1149, &this->actor); + Message_StartTextbox(play, 0x1149, &this->actor); this->unk_3E6 = 0x1149; break; case 2: - Message_StartTextbox(globalCtx, 0x114A, &this->actor); + Message_StartTextbox(play, 0x114A, &this->actor); this->unk_3E6 = 0x114A; break; case 3: - Message_StartTextbox(globalCtx, 0x114B, &this->actor); + Message_StartTextbox(play, 0x114B, &this->actor); this->unk_3E6 = 0x114B; break; case 4: - Message_StartTextbox(globalCtx, 0x114C, &this->actor); + Message_StartTextbox(play, 0x114C, &this->actor); this->unk_3E6 = 0x114C; break; case 5: - Message_StartTextbox(globalCtx, 0x114D, &this->actor); + Message_StartTextbox(play, 0x114D, &this->actor); this->unk_3E6 = 0x114D; break; case 6: - Message_StartTextbox(globalCtx, 0x114E, &this->actor); + Message_StartTextbox(play, 0x114E, &this->actor); this->unk_3E6 = 0x114E; break; default: - Message_StartTextbox(globalCtx, 0x1149, &this->actor); + Message_StartTextbox(play, 0x1149, &this->actor); this->unk_3E6 = 0x1149; break; } } -void func_80C20B88(EnHintSkb* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { +void func_80C20B88(EnHintSkb* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); this->unk_3E8 |= 0x10; - Message_StartTextbox(globalCtx, 0x1150, &this->actor); + Message_StartTextbox(play, 0x1150, &this->actor); this->unk_3E6 = 0x1150; } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x1152, &this->actor); + Message_StartTextbox(play, 0x1152, &this->actor); this->unk_3E6 = 0x1152; } } } -void func_80C20C24(EnHintSkb* this, GlobalContext* globalCtx) { - if (!Message_ShouldAdvance(globalCtx)) { +void func_80C20C24(EnHintSkb* this, PlayState* play) { + if (!Message_ShouldAdvance(play)) { return; } switch (this->unk_3E6) { case 0x1147: - Message_StartTextbox(globalCtx, 0x1148, &this->actor); + Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); break; case 0x1148: - func_80C20A74(this, globalCtx); + func_80C20A74(this, play); break; case 0x1149: @@ -552,24 +552,24 @@ void func_80C20C24(EnHintSkb* this, GlobalContext* globalCtx) { case 0x114C: case 0x114D: case 0x114E: - Message_StartTextbox(globalCtx, 0x114F, &this->actor); + Message_StartTextbox(play, 0x114F, &this->actor); this->unk_3E6 = 0x114F; break; case 0x1152: - Message_StartTextbox(globalCtx, 0x1151, &this->actor); + Message_StartTextbox(play, 0x1151, &this->actor); this->unk_3E6 = 0x1151; break; case 0x1150: - Message_StartTextbox(globalCtx, 0x1151, &this->actor); + Message_StartTextbox(play, 0x1151, &this->actor); this->unk_3E6 = 0x1151; break; case 0x1151: - func_801477B4(globalCtx); + func_801477B4(play); if (this->unk_3E8 & 0x10) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); } else { func_80C2075C(this); @@ -578,11 +578,11 @@ void func_80C20C24(EnHintSkb* this, GlobalContext* globalCtx) { } } -void func_80C20D64(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C20D64(EnHintSkb* this, PlayState* play) { if ((this->actionFunc == func_80C1FE20) || (this->actionFunc == func_80C2077C) || (this->actionFunc == func_80C1FE80)) { if (this->actionFunc != func_80C2077C) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.hintId = 255; @@ -592,7 +592,7 @@ void func_80C20D64(EnHintSkb* this, GlobalContext* globalCtx) { } func_80C2075C(this); } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CAPTAIN) { + } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.hintId = 0x55; @@ -606,12 +606,12 @@ void func_80C20D64(EnHintSkb* this, GlobalContext* globalCtx) { } } -void func_80C20E90(EnHintSkb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C20E90(EnHintSkb* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.bgCheckFlags & 0x60) && (this->actor.depthInWater >= 40.0f)) { this->actor.colChkInfo.health = 0; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); return; } @@ -637,7 +637,7 @@ void func_80C20E90(EnHintSkb* this, GlobalContext* globalCtx) { case 10: case 11: if (this->drawDmgEffTimer > 1) { - func_80C21468(this, globalCtx); + func_80C21468(this, play); } this->drawDmgEffTimer = 0; break; @@ -646,7 +646,7 @@ void func_80C20E90(EnHintSkb* this, GlobalContext* globalCtx) { if (!Actor_ApplyDamage(&this->actor)) { if ((this->actor.colChkInfo.damageEffect != 3) && (this->actor.colChkInfo.damageEffect != 4)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); this->unk_3E8 |= 4; func_80C20484(this); return; @@ -730,23 +730,23 @@ void func_80C20E90(EnHintSkb* this, GlobalContext* globalCtx) { } } -void func_80C21250(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C21250(EnHintSkb* this, PlayState* play) { if (this->unk_3E0 != 1) { - func_80C20E90(this, globalCtx); + func_80C20E90(this, play); if (this->actionFunc == func_80C1FF88) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc != func_80C200B8) && (this->actionFunc != func_80C20334) && (this->actionFunc != func_80C204F0)) { - 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_80C21320(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C21320(EnHintSkb* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -772,7 +772,7 @@ s32 func_80C21414(EnHintSkb* this) { return false; } -void func_80C21468(EnHintSkb* this, GlobalContext* globalCtx) { +void func_80C21468(EnHintSkb* this, PlayState* play) { static Color_RGBA8 D_80C21E44 = { 170, 255, 255, 255 }; static Color_RGBA8 D_80C21E48 = { 200, 200, 255, 255 }; static Vec3f D_80C21E4C = { 0.0f, -1.0f, 0.0f }; @@ -787,7 +787,7 @@ void func_80C21468(EnHintSkb* this, GlobalContext* globalCtx) { phi_s4 = ARRAY_COUNT(this->limbPos); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < phi_s4; i++) { temp_s1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); @@ -796,11 +796,11 @@ void func_80C21468(EnHintSkb* this, GlobalContext* globalCtx) { sp84.z = Math_CosS(temp_s1) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(globalCtx, &this->limbPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); + EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80C21E4C, &D_80C21E44, &D_80C21E48, 30); } } -void func_80C215E4(GlobalContext* globalCtx, EnHintSkb* this, Vec3f* arg2) { +void func_80C215E4(PlayState* play, EnHintSkb* this, Vec3f* arg2) { Vec3f sp5C; Vec3f sp50 = { 0.0f, 8.0f, 0.0f }; Vec3f sp44 = { 0.0f, -1.5f, 0.0f }; @@ -816,14 +816,14 @@ void func_80C215E4(GlobalContext* globalCtx, EnHintSkb* this, Vec3f* arg2) { sp50.y += (Rand_ZeroOne() - 0.5f) * 4.0f; - EffectSsHahen_Spawn(globalCtx, &sp5C, &sp50, &sp44, 0, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, -1, 10, NULL); - func_800BBFB0(globalCtx, &sp5C, 10.0f, 1, 150, 0, 1); + EffectSsHahen_Spawn(play, &sp5C, &sp50, &sp44, 0, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, -1, 10, NULL); + func_800BBFB0(play, &sp5C, 10.0f, 1, 150, 0, 1); } -void EnHintSkb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHintSkb_Update(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != func_80C2016C) && (this->actionFunc != func_80C20590) && (this->actionFunc != func_80C2069C)) { @@ -831,26 +831,25 @@ void EnHintSkb_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); - func_80C21250(this, globalCtx); - func_80C20D64(this, globalCtx); - func_80C21320(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + func_80C21250(this, play); + func_80C20D64(this, play); + func_80C21320(this, play); } -s32 EnHintSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnHintSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHintSkb* this = THIS; f32 temp_f10; if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - temp_f10 = fabsf(Math_SinS(globalCtx->state.frames * 6000) * 95.0f) + 160.0f; + temp_f10 = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f; gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s16)temp_f10, (s16)temp_f10, (s16)temp_f10, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 10) { Matrix_MultZero(&this->actor.focus.pos); } else if ((limbIndex == 12) && (this->unk_3DE == 1)) { @@ -864,7 +863,7 @@ s32 EnHintSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnHintSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnHintSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80C21E70 = { 800.0f, 1200.0f, 0.0f }; EnHintSkb* this = THIS; @@ -872,11 +871,11 @@ void EnHintSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Collider_UpdateSpheres(limbIndex, &this->collider); if ((limbIndex == 11) && (this->unk_3E8 & 1) && !(this->unk_3E8 & 2)) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); this->unk_3E8 |= 2; } else if ((this->unk_3E8 & 4) && !(this->unk_3E8 & 8) && ((limbIndex != 11) || !(this->unk_3E8 & 1)) && (limbIndex != 12)) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); } if (this->drawDmgEffTimer != 0) { @@ -893,15 +892,15 @@ void EnHintSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnHintSkb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHintSkb_Draw(Actor* thisx, PlayState* play) { EnHintSkb* this = THIS; this->limbCount = 0; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintSkb_OverrideLimbDraw, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintSkb_OverrideLimbDraw, EnHintSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h index b67e563528..e8ede22261 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.h @@ -5,7 +5,7 @@ struct EnHintSkb; -typedef void (*EnHintSkbActionFunc)(struct EnHintSkb*, GlobalContext*); +typedef void (*EnHintSkbActionFunc)(struct EnHintSkb*, PlayState*); #define ENHINTSKB_GET_FF(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c index 78cfa14a09..17dfeb34ec 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.c @@ -10,11 +10,11 @@ #define THIS ((EnHitTag*)thisx) -void EnHitTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnHitTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnHitTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnHitTag_Init(Actor* thisx, PlayState* play); +void EnHitTag_Destroy(Actor* thisx, PlayState* play); +void EnHitTag_Update(Actor* thisx, PlayState* play); -void EnHitTag_WaitForHit(EnHitTag* this, GlobalContext* globalCtx); +void EnHitTag_WaitForHit(EnHitTag* this, PlayState* play); const ActorInit En_Hit_Tag_InitVars = { ACTOR_EN_HIT_TAG, @@ -48,26 +48,26 @@ static ColliderCylinderInit sCylinderInit = { { 16, 32, 0, { 0, 0, 0 } }, }; -void EnHitTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHitTag_Init(Actor* thisx, PlayState* play) { s32 pad; EnHitTag* this = THIS; Actor_SetScale(&this->actor, 1.0f); this->actionFunc = EnHitTag_WaitForHit; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); - if (Flags_GetSwitch(globalCtx, ENHITTAG_GET_SWITCHFLAG(thisx))) { + if (Flags_GetSwitch(play, ENHITTAG_GET_SWITCHFLAG(thisx))) { Actor_MarkForDeath(&this->actor); } } -void EnHitTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHitTag_Destroy(Actor* thisx, PlayState* play) { EnHitTag* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnHitTag_WaitForHit(EnHitTag* this, GlobalContext* globalCtx) { +void EnHitTag_WaitForHit(EnHitTag* this, PlayState* play) { Vec3f dropLocation; s32 i; @@ -79,14 +79,14 @@ void EnHitTag_WaitForHit(EnHitTag* this, GlobalContext* globalCtx) { dropLocation.z = this->actor.world.pos.z; for (i = 0; i < 3; i++) { - Item_DropCollectible(globalCtx, &dropLocation, ITEM00_RUPEE_GREEN); + Item_DropCollectible(play, &dropLocation, ITEM00_RUPEE_GREEN); } } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void EnHitTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHitTag_Update(Actor* thisx, PlayState* play) { EnHitTag* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h index 2117cb27d9..9985d5180f 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h @@ -5,7 +5,7 @@ struct EnHitTag; -typedef void (*EnHitTagActionFunc)(struct EnHitTag*, GlobalContext*); +typedef void (*EnHitTagActionFunc)(struct EnHitTag*, PlayState*); #define ENHITTAG_GET_SWITCHFLAG(thisx) (s32)(((thisx)->params & 0xFE00) >> 9) 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 01db67792b..5945af02f2 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -43,19 +43,19 @@ #define THIS ((EnHoll*)thisx) -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_SetupAction(EnHoll* this); -void EnHoll_SetPlayerSide(GlobalContext* globalCtx, EnHoll* this, Vec3f* transformedPlayerPos); -void EnHoll_ChangeRooms(GlobalContext* globalCtx); -void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx); -void EnHoll_VerticalIdle(EnHoll* this, GlobalContext* globalCtx); -void EnHoll_TransparentIdle(EnHoll* this, GlobalContext* globalCtx); -void EnHoll_VerticalBgCoverIdle(EnHoll* this, GlobalContext* globalCtx); -void EnHoll_RoomTransitionIdle(EnHoll* this, GlobalContext* globalCtx); +void EnHoll_SetPlayerSide(PlayState* play, EnHoll* this, Vec3f* transformedPlayerPos); +void EnHoll_ChangeRooms(PlayState* play); +void EnHoll_VisibleIdle(EnHoll* this, PlayState* play); +void EnHoll_VerticalIdle(EnHoll* this, PlayState* play); +void EnHoll_TransparentIdle(EnHoll* this, PlayState* play); +void EnHoll_VerticalBgCoverIdle(EnHoll* this, PlayState* play); +void EnHoll_RoomTransitionIdle(EnHoll* this, PlayState* play); const ActorInit En_Holl_InitVars = { ACTOR_EN_HOLL, @@ -105,14 +105,14 @@ void EnHoll_SetupAction(EnHoll* this) { } } -void EnHoll_SetPlayerSide(GlobalContext* globalCtx, EnHoll* this, Vec3f* transformedPlayerPos) { - Player* player = GET_PLAYER(globalCtx); +void EnHoll_SetPlayerSide(PlayState* play, EnHoll* this, Vec3f* transformedPlayerPos) { + Player* player = GET_PLAYER(play); Actor_OffsetOfPointInActorCoords(&this->actor, transformedPlayerPos, &player->actor.world.pos); this->playerSide = (transformedPlayerPos->z < 0.0f) ? EN_HOLL_BEHIND : EN_HOLL_BEFORE; } -void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Init(Actor* thisx, PlayState* play) { EnHoll* this = THIS; s32 pad; Vec3f transformedPlayerPos; @@ -121,37 +121,37 @@ void EnHoll_Init(Actor* thisx, GlobalContext* globalCtx) { EnHoll_SetupAction(this); this->bgCoverAlphaActive = false; this->alpha = 255; - EnHoll_SetPlayerSide(globalCtx, this, &transformedPlayerPos); + EnHoll_SetPlayerSide(play, this, &transformedPlayerPos); } -void EnHoll_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Destroy(Actor* thisx, PlayState* play) { EnHoll* this = THIS; if (!EN_HOLL_IS_SCENE_CHANGER(this)) { u32 enHollId = EN_HOLL_GET_ID_CAST(this); - globalCtx->doorCtx.transitionActorList[enHollId].id = -globalCtx->doorCtx.transitionActorList[enHollId].id; + play->doorCtx.transitionActorList[enHollId].id = -play->doorCtx.transitionActorList[enHollId].id; if (this == sInstancePlayingSound) { sInstancePlayingSound = NULL; } } } -void EnHoll_ChangeRooms(GlobalContext* globalCtx) { - Room tempRoom = globalCtx->roomCtx.currRoom; +void EnHoll_ChangeRooms(PlayState* play) { + Room tempRoom = play->roomCtx.currRoom; - globalCtx->roomCtx.currRoom = globalCtx->roomCtx.prevRoom; - globalCtx->roomCtx.prevRoom = tempRoom; - globalCtx->roomCtx.activeMemPage ^= 1; + play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.prevRoom = tempRoom; + play->roomCtx.activeMemPage ^= 1; } -void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) { +void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { s32 pad; Vec3f transformedPlayerPos; f32 playerDistFromCentralPlane; if (this->type == EN_HOLL_TYPE_DEFAULT) { - u32 actorCtxBitmask = (globalCtx->actorCtx.unkC & 0x2AA) >> 1 | (globalCtx->actorCtx.unkC & 0x155); + u32 actorCtxBitmask = (play->actorCtx.unkC & 0x2AA) >> 1 | (play->actorCtx.unkC & 0x155); u32 zActorBitmask = D_801AED48[EN_HOLL_GET_Z_ACTOR_BITMASK_INDEX(this)]; if (!(actorCtxBitmask & zActorBitmask)) { @@ -162,15 +162,15 @@ void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EV_INVISIBLE_MONKEY - SFX_FLAG); } } - if ((globalCtx->sceneLoadFlag != 0) || (globalCtx->unk_18B4A != 0)) { + if ((play->sceneLoadFlag != 0) || (play->unk_18B4A != 0)) { this->alpha = 255; } else { f32 enHollBottom = EN_HOLL_BOTTOM_DEFAULT; f32 enHollHalfwidth = EN_HOLL_HALFWIDTH_DEFAULT; - EnHoll_SetPlayerSide(globalCtx, this, &transformedPlayerPos); + EnHoll_SetPlayerSide(play, this, &transformedPlayerPos); playerDistFromCentralPlane = fabsf(transformedPlayerPos.z); - if (globalCtx->sceneNum == SCENE_IKANA) { + if (play->sceneNum == SCENE_IKANA) { enHollBottom = EN_HOLL_BOTTOM_IKANA; enHollHalfwidth = EN_HOLL_HALFWIDTH_IKANA; } @@ -180,23 +180,23 @@ void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) { u32 enHollId = EN_HOLL_GET_ID_AND(this); if (sLoadingPlaneDistance < playerDistFromCentralPlane) { - if ((globalCtx->roomCtx.prevRoom.num >= 0) && (globalCtx->roomCtx.unk31 == 0)) { - this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[this->playerSide].room; - if (globalCtx->roomCtx.prevRoom.num == this->actor.room) { - EnHoll_ChangeRooms(globalCtx); + if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.unk31 == 0)) { + this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide].room; + if (play->roomCtx.prevRoom.num == this->actor.room) { + EnHoll_ChangeRooms(play); } - func_8012EBF8(globalCtx, &globalCtx->roomCtx); + func_8012EBF8(play, &play->roomCtx); } } else if (this->type == EN_HOLL_TYPE_SCENE_CHANGER) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[EN_HOLL_GET_EXIT_LIST_INDEX(this)]; + play->nextEntranceIndex = play->setupExitList[EN_HOLL_GET_EXIT_LIST_INDEX(this)]; gSaveContext.unk_3DBB = 1; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1878C(globalCtx); + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; + play->unk_1878C(play); } else { - this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[this->playerSide ^ 1].room; - if (globalCtx->roomCtx.prevRoom.num < 0) { - Room_StartRoomTransition(globalCtx, &globalCtx->roomCtx, this->actor.room); + this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide ^ 1].room; + if (play->roomCtx.prevRoom.num < 0) { + Room_StartRoomTransition(play, &play->roomCtx, this->actor.room); if (this == sInstancePlayingSound) { sInstancePlayingSound = NULL; } @@ -204,28 +204,28 @@ void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) { s32 unclampedAlpha = EN_HOLL_SCALE_ALPHA(playerDistFromCentralPlane); this->alpha = CLAMP(unclampedAlpha, 0, 255); - if (globalCtx->roomCtx.currRoom.num != this->actor.room) { - EnHoll_ChangeRooms(globalCtx); + if (play->roomCtx.currRoom.num != this->actor.room) { + EnHoll_ChangeRooms(play); } } } - } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (globalCtx->sceneNum == SCENE_26SARUNOMORI) && + } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (play->sceneNum == SCENE_26SARUNOMORI) && (sInstancePlayingSound == NULL)) { sInstancePlayingSound = this; } } } -void EnHoll_TransparentIdle(EnHoll* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 useViewEye = gDbgCamEnabled || globalCtx->csCtx.state != 0; +void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 useViewEye = gDbgCamEnabled || play->csCtx.state != 0; Vec3f transformedPlayerPos; f32 enHollTop; f32 playerDistFromCentralPlane; Actor_OffsetOfPointInActorCoords(&this->actor, &transformedPlayerPos, - useViewEye ? &globalCtx->view.eye : &player->actor.world.pos); - enHollTop = (globalCtx->sceneNum == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; + useViewEye ? &play->view.eye : &player->actor.world.pos); + enHollTop = (play->sceneNum == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; if ((transformedPlayerPos.y > EN_HOLL_BOTTOM_DEFAULT) && (transformedPlayerPos.y < enHollTop) && (fabsf(transformedPlayerPos.x) < EN_HOLL_HALFWIDTH_TRANSPARENT)) { @@ -234,49 +234,49 @@ void EnHoll_TransparentIdle(EnHoll* this, GlobalContext* globalCtx) { playerDistFromCentralPlane > EN_HOLL_LOADING_PLANE_DISTANCE) { s32 enHollId = EN_HOLL_GET_ID_CAST(this); s32 playerSide = (transformedPlayerPos.z < 0.0f) ? EN_HOLL_BEHIND : EN_HOLL_BEFORE; - TransitionActorEntry* transitionActorEntry = &globalCtx->doorCtx.transitionActorList[enHollId]; + TransitionActorEntry* transitionActorEntry = &play->doorCtx.transitionActorList[enHollId]; s8 room = transitionActorEntry->sides[playerSide].room; this->actor.room = room; - if ((this->actor.room != globalCtx->roomCtx.currRoom.num) && - Room_StartRoomTransition(globalCtx, &globalCtx->roomCtx, this->actor.room)) { + if ((this->actor.room != play->roomCtx.currRoom.num) && + Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } } } } -void EnHoll_VerticalBgCoverIdle(EnHoll* this, GlobalContext* globalCtx) { +void EnHoll_VerticalBgCoverIdle(EnHoll* this, PlayState* play) { f32 playerDistFromCentralPlane; if ((this->actor.xzDistToPlayer < EN_HOLL_RADIUS) && (playerDistFromCentralPlane = fabsf(this->actor.playerHeightRel), playerDistFromCentralPlane < EN_HOLL_ACTIVATION_PLANE_DISTANCE_VERTICAL)) { if (playerDistFromCentralPlane < EN_HOLL_LOADING_PLANE_DISTANCE_VERTICAL) { - globalCtx->bgCoverAlpha = 255; + play->bgCoverAlpha = 255; } else { - globalCtx->bgCoverAlpha = EN_HOLL_SCALE_BG_COVER_ALPHA(playerDistFromCentralPlane); + play->bgCoverAlpha = EN_HOLL_SCALE_BG_COVER_ALPHA(playerDistFromCentralPlane); } if (playerDistFromCentralPlane > EN_HOLL_LOADING_PLANE_DISTANCE_VERTICAL) { s32 enHollId = EN_HOLL_GET_ID_CAST(this); s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; - this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[playerSide].room; + this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != globalCtx->roomCtx.currRoom.num) && - Room_StartRoomTransition(globalCtx, &globalCtx->roomCtx, this->actor.room)) { + if ((this->actor.room != play->roomCtx.currRoom.num) && + Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; this->bgCoverAlphaActive = true; } } } else if (this->bgCoverAlphaActive) { this->bgCoverAlphaActive = false; - globalCtx->bgCoverAlpha = 0; + play->bgCoverAlpha = 0; } } -void EnHoll_VerticalIdle(EnHoll* this, GlobalContext* globalCtx) { +void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { if (this->actor.xzDistToPlayer < EN_HOLL_RADIUS) { f32 playerDistFromCentralPlane = fabsf(this->actor.playerHeightRel); @@ -286,41 +286,41 @@ void EnHoll_VerticalIdle(EnHoll* this, GlobalContext* globalCtx) { s32 enHollId = EN_HOLL_GET_ID_CAST(this); s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; - this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != globalCtx->roomCtx.currRoom.num) && - Room_StartRoomTransition(globalCtx, &globalCtx->roomCtx, this->actor.room)) { + this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; + if ((this->actor.room != play->roomCtx.currRoom.num) && + Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } } } } -void EnHoll_RoomTransitionIdle(EnHoll* this, GlobalContext* globalCtx) { - if (globalCtx->roomCtx.unk31 == 0) { - func_8012EBF8(globalCtx, &globalCtx->roomCtx); - if (globalCtx->bgCoverAlpha == 0) { +void EnHoll_RoomTransitionIdle(EnHoll* this, PlayState* play) { + if (play->roomCtx.unk31 == 0) { + func_8012EBF8(play, &play->roomCtx); + if (play->bgCoverAlpha == 0) { this->bgCoverAlphaActive = false; } EnHoll_SetupAction(this); } } -void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Update(Actor* thisx, PlayState* play) { EnHoll* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0) && !(player->stateFlags1 & 0x200)) { - this->actionFunc(this, globalCtx); + if ((play->sceneLoadFlag == 0) && (play->unk_18B4A == 0) && !(player->stateFlags1 & 0x200)) { + this->actionFunc(this, play); } } -void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHoll_Draw(Actor* thisx, PlayState* play) { EnHoll* this = THIS; Gfx* dl; u32 dlIndex; if (this->alpha != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 255) { dl = POLY_OPA_DISP; dlIndex = 37; @@ -332,7 +332,7 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->playerSide == EN_HOLL_BEHIND) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); } - gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(dl++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(dl++, 0, 0, 0, 0, 0, this->alpha); gSPDisplayList(dl++, gEnHollCentralPlaneDL); if (this->alpha == 255) { @@ -340,6 +340,6 @@ void EnHoll_Draw(Actor* thisx, GlobalContext* globalCtx) { } else { POLY_XLU_DISP = dl; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } 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 868798bb21..689c443ef3 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -5,7 +5,7 @@ struct EnHoll; -typedef void (*EnHollActionFunc)(struct EnHoll*, GlobalContext*); +typedef void (*EnHollActionFunc)(struct EnHoll*, PlayState*); typedef enum { /* 0 */ EN_HOLL_TYPE_DEFAULT, 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 aaea882523..9f1566b862 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -10,25 +10,25 @@ #define THIS ((EnHonotrap*)thisx) -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 func_8092EBDC(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092ECF0(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092EDD8(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092EE1C(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092EE90(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092EF98(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F074(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F0B8(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F10C(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F208(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F3D8(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F5EC(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F7BC(EnHonotrap* this, GlobalContext* globalCtx); -void func_8092F878(EnHonotrap* this, GlobalContext* globalCtx); +void func_8092EBDC(EnHonotrap* this, PlayState* play); +void func_8092ECF0(EnHonotrap* this, PlayState* play); +void func_8092EDD8(EnHonotrap* this, PlayState* play); +void func_8092EE1C(EnHonotrap* this, PlayState* play); +void func_8092EE90(EnHonotrap* this, PlayState* play); +void func_8092EF98(EnHonotrap* this, PlayState* play); +void func_8092F074(EnHonotrap* this, PlayState* play); +void func_8092F0B8(EnHonotrap* this, PlayState* play); +void func_8092F10C(EnHonotrap* this, PlayState* play); +void func_8092F208(EnHonotrap* this, PlayState* play); +void func_8092F3D8(EnHonotrap* this, PlayState* play); +void func_8092F5EC(EnHonotrap* this, PlayState* play); +void func_8092F7BC(EnHonotrap* this, PlayState* play); +void func_8092F878(EnHonotrap* this, PlayState* play); #if 0 const ActorInit En_Honotrap_InitVars = { 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 f9983e26a3..4f3fb5b584 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -5,7 +5,7 @@ struct EnHonotrap; -typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, GlobalContext*); +typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); typedef struct EnHonotrap { /* 0x0000 */ Actor actor; 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 a0756abdf8..e6ca196c31 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -11,15 +11,15 @@ #define THIS ((EnHorse*)thisx) -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 func_8087D540(Actor* thisx, GlobalContext* globalCtx); +void func_8087D540(Actor* thisx, PlayState* play); void EnHorse_StartMountedIdleResetAnim(EnHorse* this); void EnHorse_StartMountedIdle(EnHorse* this); -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_MountedIdle(EnHorse* this, PlayState* play); void EnHorse_MountedIdleAnim(EnHorse* this); void EnHorse_MountedIdleWhinney(EnHorse* this); void EnHorse_StartTurning(EnHorse* this); @@ -29,62 +29,62 @@ void EnHorse_StartWalking(EnHorse* this); void EnHorse_StartTrotting(EnHorse* this); void EnHorse_StartGallopingInterruptable(EnHorse* this); void EnHorse_StartGalloping(EnHorse* this); -void EnHorse_StartBraking(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartBraking(EnHorse* this, PlayState* play); void EnHorse_StartReversingInterruptable(EnHorse* this); void EnHorse_StartReversing(EnHorse* this); -void EnHorse_StartLowJump(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_StartHighJump(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_StartLowJump(EnHorse* this, PlayState* play); +void EnHorse_StartHighJump(EnHorse* this, PlayState* play); void EnHorse_InitInactive(EnHorse* this); void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames); void EnHorse_ResetIdleAnimation(EnHorse* this); void EnHorse_StartIdleRidable(EnHorse* this); void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames); -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play); void EnHorse_InitIngoHorse(EnHorse* this); void EnHorse_UpdateIngoHorseAnim(EnHorse* this); -void func_80881290(EnHorse* this, GlobalContext* globalCtx); -void func_8088159C(EnHorse* this, GlobalContext* globalCtx); +void func_80881290(EnHorse* this, PlayState* play); +void func_8088159C(EnHorse* this, PlayState* play); void func_80881634(EnHorse* this); void func_8088168C(EnHorse* this); -void EnHorse_CsMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx); -void EnHorse_CsJumpInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_WarpMoveInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearingInit(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_CsWarpRearing(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void EnHorse_InitCutscene(EnHorse* this, GlobalContext* globalCtx); +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_InitCutscene(EnHorse* this, PlayState* play); void EnHorse_InitHorsebackArchery(EnHorse* this); void EnHorse_UpdateHbaAnim(EnHorse* this); -void func_80883BEC(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883CB0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883D64(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883DE0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883E10(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883EA0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883F18(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80883F98(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884010(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808840C4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884194(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_8088424C(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884314(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808843B4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884444(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808844E0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884564(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_80884604(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808846B4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808846DC(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action); -void func_808846F0(EnHorse* this, GlobalContext* globalCtx); +void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884010(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884194(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884314(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884444(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884564(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80884604(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_808846F0(EnHorse* this, PlayState* play); void func_80884994(EnHorse* this); -void func_80884D04(EnHorse* this, GlobalContext* globalCtx); +void func_80884D04(EnHorse* this, PlayState* play); void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle); -s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx); +s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play); typedef struct { s32 csAction; @@ -268,11 +268,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_800F415C(&this->actor, pos, turnAmount); } -void func_8087B7C0(EnHorse* this, GlobalContext* globalCtx, Path* path) { +void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { s32 spA4; Vec3s* spA0; f32 phi_f12; @@ -324,12 +324,12 @@ void func_8087B7C0(EnHorse* this, GlobalContext* globalCtx, Path* path) { func_8017D7C0(this->actor.world.pos.x, this->actor.world.pos.z, sp80.x, sp80.z, sp8C.x, sp8C.z, &sp70); if ((this->actor.bgCheckFlags & 8) || (this->unk_1EC & 4)) { - EnHorse_RotateToPoint(this, globalCtx, &sp8C, 0xC80); + EnHorse_RotateToPoint(this, play, &sp8C, 0xC80); if (this->unk_1EC & 4) { this->unk_1EC &= ~4; } } else { - EnHorse_RotateToPoint(this, globalCtx, &sp8C, 0x320); + EnHorse_RotateToPoint(this, play, &sp8C, 0x320); if (sp70 < SQ(100.0f)) { if ((this->actor.xzDistToPlayer < 100.0f) || (this->colliderJntSph.elements[0].info.ocElemFlags & OCELEM_HIT)) { @@ -408,7 +408,7 @@ void func_8087B7C0(EnHorse* this, GlobalContext* globalCtx, Path* path) { return; } - sp4A = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + sp4A = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((fabsf(Math_SinS(sp4A)) < 0.9f) && (Math_CosS(sp4A) > 0.0f)) { if (this->actor.speedXZ < this->unk_398) { @@ -433,7 +433,7 @@ void func_8087B7C0(EnHorse* this, GlobalContext* globalCtx, Path* path) { } this->unk_394 |= 1; } else if ((sp68 + 1) == this->curRaceWaypoint) { - s16 sp48 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + s16 sp48 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((fabsf(Math_SinS(sp48)) < 0.9f) && (Math_CosS(sp48) > 0.0f)) { if (this->actor.speedXZ < this->unk_398) { @@ -495,7 +495,7 @@ void func_8087C1C0(EnHorse* this) { } } -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)) { @@ -504,11 +504,11 @@ f32 EnHorse_SlopeSpeedMultiplier(EnHorse* this, GlobalContext* globalCtx) { return multiplier; } -void func_8087C288(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg1, arg2, arg3); +void func_8087C288(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, arg2, arg3); } -s32 func_8087C2B8(GlobalContext* globalCtx, EnHorse* this, Vec3f* arg2, f32 arg3) { +s32 func_8087C2B8(PlayState* play, EnHorse* this, Vec3f* arg2, f32 arg3) { f32 phi_f14; if ((arg2->z > 0.0f) && (arg2->z < (this->actor.uncullZoneForward + this->actor.uncullZoneScale))) { @@ -526,23 +526,23 @@ s32 func_8087C2B8(GlobalContext* globalCtx, EnHorse* this, Vec3f* arg2, f32 arg3 return false; } -s32 func_8087C38C(GlobalContext* globalCtx, EnHorse* this, Vec3f* arg2) { +s32 func_8087C38C(PlayState* play, EnHorse* this, Vec3f* arg2) { Vec3f sp24; f32 sp20; f32 eyeDist; - func_8087C288(globalCtx, arg2, &sp24, &sp20); + func_8087C288(play, arg2, &sp24, &sp20); if (fabsf(sp20) < 0.008f) { return false; } - eyeDist = Math3D_Distance(arg2, &globalCtx->view.eye); + eyeDist = Math3D_Distance(arg2, &play->view.eye); - return func_8087C2B8(globalCtx, this, &sp24, sp20) || (eyeDist < 100.0f); + return func_8087C2B8(play, this, &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)) || @@ -564,15 +564,15 @@ void EnHorse_IdleAnimSounds(EnHorse* this, GlobalContext* globalCtx) { } } -s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { +s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { s32 i; f32 dist; Path* path; s32 spawn = false; f32 minDist = 1.0e+38; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f spawnPos; - s32 pathIdx = func_800F3940(globalCtx); + s32 pathIdx = func_800F3940(play); s32 pathCount; Vec3s* pathPoints; @@ -580,7 +580,7 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { return false; } - path = &globalCtx->setupPathList[pathIdx]; + path = &play->setupPathList[pathIdx]; pathCount = path->count; pathPoints = Lib_SegmentedToVirtual(path->points); @@ -590,7 +590,7 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { spawnPos.z = pathPoints[i].z; dist = Math3D_Distance(&player->actor.world.pos, &spawnPos); - if ((minDist < dist) || func_8087C38C(globalCtx, this, &spawnPos)) { + if ((minDist < dist) || func_8087C38C(play, this, &spawnPos)) { continue; } @@ -600,9 +600,9 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { this->actor.world.pos.z = spawnPos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = 0; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); } @@ -626,38 +626,37 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { this->actor.world.pos.z = spawnPos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = 0; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); } 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 & 1) || (func_800B7128(GET_PLAYER(globalCtx)) == true) || - (player->stateFlags1 & 0x100000) || + if ((player->stateFlags1 & 1) || (func_800B7128(GET_PLAYER(play)) == true) || (player->stateFlags1 & 0x100000) || (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || - (this->action == 19) || (player->actor.flags & ACTOR_FLAG_100) || (globalCtx->csCtx.state != 0) || + (this->action == 19) || (player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != 0) || (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & 0x20) || (player->csMode != 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; @@ -670,11 +669,11 @@ void EnHorse_ClearDustFlags(u16* dustFlags) { void func_8087C9F8(EnHorse* this) { } -void func_8087CA04(EnHorse* this, GlobalContext* globalCtx) { +void func_8087CA04(EnHorse* this, PlayState* play) { } -void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHorse_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHorse* this = THIS; Skin* skin = &this->skin; @@ -697,7 +696,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->type = HORSE_4; this->unk_528 = 80.0f; this->boostSpeed = 12; - if ((this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HA)) < 0) { + if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { Actor_MarkForDeath(&this->actor); return; } @@ -707,10 +706,10 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->type = HORSE_2; this->unk_528 = 64.8f; this->boostSpeed = 15; - if ((this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HORSE_LINK_CHILD)) < 0) { - thisx->objBankIndex = Object_Spawn(&globalCtx->objectCtx, OBJECT_HORSE_LINK_CHILD); - Actor_SetObjectDependency(globalCtx, &this->actor); - Skin_Init(&globalCtx->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); + if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HORSE_LINK_CHILD)) < 0) { + thisx->objBankIndex = Object_Spawn(&play->objectCtx, OBJECT_HORSE_LINK_CHILD); + Actor_SetObjectDependency(play, &this->actor); + Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); this->unk_1EC |= 0x200; } else { @@ -719,7 +718,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { } else if (ENHORSE_GET_2000(&this->actor)) { this->type = HORSE_3; this->boostSpeed = 12; - if ((this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HA)) < 0) { + if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { Actor_MarkForDeath(&this->actor); return; } @@ -769,8 +768,8 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->stateFlags = 0; } - if (((globalCtx->sceneNum == SCENE_KOEPONARACE) && ((gSaveContext.save.weekEventReg[92] & (1 | 2 | 4)) == 1)) || - ((gSaveContext.save.entranceIndex == 0x6400) && Cutscene_GetSceneSetupIndex(globalCtx))) { + if (((play->sceneNum == SCENE_KOEPONARACE) && ((gSaveContext.save.weekEventReg[92] & (1 | 2 | 4)) == 1)) || + ((gSaveContext.save.entranceIndex == 0x6400) && Cutscene_GetSceneSetupIndex(play))) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -785,12 +784,12 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { sJntSphInit.elements[0].dim.limb = 10; } - Collider_InitCylinder(globalCtx, &this->colliderCylinder1); - Collider_SetCylinder(globalCtx, &this->colliderCylinder1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->colliderCylinder2); - Collider_SetCylinder(globalCtx, &this->colliderCylinder2, &this->actor, &sCylinderInit2); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); + Collider_InitCylinder(play, &this->colliderCylinder1); + Collider_SetCylinder(play, &this->colliderCylinder1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->colliderCylinder2); + Collider_SetCylinder(play, &this->colliderCylinder2, &this->actor, &sCylinderInit2); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); if (this->type == HORSE_2) { this->colliderCylinder1.dim.radius = this->colliderCylinder1.dim.radius * 0.8f; @@ -815,7 +814,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { thisx->focus.pos.y += 70.0f; if (!(this->unk_1EC & 1) && !(this->unk_1EC & 0x200) && (thisx->update == EnHorse_Update)) { - Skin_Init(&globalCtx->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); + Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } this->animationIdx = 0; @@ -824,41 +823,38 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { this->postDrawFunc = NULL; this->blinkTimer = 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 (thisx->params == ENHORSE_2) { this->unk_53C = 0; EnHorse_InitInactive(this); } else if (thisx->params == ENHORSE_3) { EnHorse_InitIngoHorse(this); - this->rider = - (EnIn*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, - thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); + this->rider = (EnIn*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); this->unk_398 = 14.34f; } else if (thisx->params == ENHORSE_4) { func_80881634(this); this->unk_398 = 14.34f; - this->rider = - (EnIn*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, - thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); + this->rider = (EnIn*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); this->unk_1EC |= 0x100; } else if (thisx->params == ENHORSE_5) { func_80881634(this); this->unk_398 = 14.525f; - this->rider = - (EnIn*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, - thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 2); + this->rider = (EnIn*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 2); this->unk_1EC |= 0x100; } else if (thisx->params == ENHORSE_9) { - EnHorse_InitCutscene(this, globalCtx); + EnHorse_InitCutscene(this, play); } else if (thisx->params == ENHORSE_10) { EnHorse_InitHorsebackArchery(this); - func_80112AFC(globalCtx); + func_80112AFC(play); } else if (thisx->params == ENHORSE_14) { - func_808846F0(this, globalCtx); - if ((globalCtx->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(globalCtx)) { + func_808846F0(this, play); + if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } } else if (thisx->params == ENHORSE_16) { @@ -870,16 +866,16 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { } else if (thisx->params == ENHORSE_19) { EnIn* in; - func_80884D04(this, globalCtx); - in = (EnIn*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, + func_80884D04(this, play); + in = (EnIn*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); this->rider = in; in->unk4AC |= (0x20 | 0x4); } else if (thisx->params == ENHORSE_20) { EnIn* in; - func_80884D04(this, globalCtx); - in = (EnIn*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, + func_80884D04(this, play); + in = (EnIn*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, 1, 1); this->rider = in; in->unk4AC |= (0x20 | 0x8 | 0x4); @@ -905,53 +901,53 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_8087D540(Actor* thisx, GlobalContext* globalCtx) { +void func_8087D540(Actor* thisx, PlayState* play) { EnHorse* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnHorse_Update; if (this->unk_1EC & 1) { if (this->type == HORSE_3) { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, &object_ha_Skel_008C68, NULL, this->jointTable, + SkelAnime_InitFlex(play, &this->skin.skelAnime, &object_ha_Skel_008C68, NULL, this->jointTable, this->morphTable, OBJECT_HA_1_LIMB_MAX); } else { - SkelAnime_InitFlex(globalCtx, &this->skin.skelAnime, &object_ha_Skel_0150D8, NULL, this->jointTable, + SkelAnime_InitFlex(play, &this->skin.skelAnime, &object_ha_Skel_0150D8, NULL, this->jointTable, this->morphTable, OBJECT_HA_2_LIMB_MAX); } } else { - Skin_Init(&globalCtx->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); + Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); } } -void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Destroy(Actor* thisx, PlayState* play) { EnHorse* this = THIS; if (this->stateFlags & ENHORSE_DRAW) { Audio_StopSfxByPos(&this->unk_218); } - Skin_Free(&globalCtx->state, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder1); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder2); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Skin_Free(&play->state, &this->skin); + Collider_DestroyCylinder(play, &this->colliderCylinder1); + Collider_DestroyCylinder(play, &this->colliderCylinder2); + Collider_DestroyJntSph(play, &this->colliderJntSph); } -void EnHorse_RotateToPlayer(EnHorse* this, GlobalContext* globalCtx) { - EnHorse_RotateToPoint(this, globalCtx, &GET_PLAYER(globalCtx)->actor.world.pos, 0x320); +void EnHorse_RotateToPlayer(EnHorse* this, PlayState* play) { + EnHorse_RotateToPoint(this, play, &GET_PLAYER(play)->actor.world.pos, 0x320); if (this->stateFlags & ENHORSE_OBSTACLE) { this->actor.world.rot.y += 1600; } this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnHorse_Freeze(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Freeze(EnHorse* this, PlayState* play) { if ((this->action != ENHORSE_ACT_HBA) && (this->action != ENHORSE_ACT_21) && (this->action != ENHORSE_ACT_FLEE_PLAYER)) { if (sResetNoInput[this->actor.params] && (this->actor.params != ENHORSE_6)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->noInputTimerMax = 0; this->noInputTimer = 0; @@ -967,7 +963,7 @@ void EnHorse_Freeze(EnHorse* this, GlobalContext* globalCtx) { } } -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) { @@ -980,7 +976,7 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMountedIdleResetAnim(this); } else if (this->actor.params == ENHORSE_11) { this->actor.params = ENHORSE_7; - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { EnHorse_StartMountedIdle(this); } else { this->actor.speedXZ = 8.0f; @@ -1005,15 +1001,15 @@ void EnHorse_Frozen(EnHorse* this, GlobalContext* globalCtx) { } } -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) { f32 phi_f0; f32 stickMag; s16 stickAngle; s16 turn; f32 temp_f12; - if (!EnHorse_PlayerCanMove(this, globalCtx)) { + if (!EnHorse_PlayerCanMove(this, play)) { if (this->actor.speedXZ > 8.0f) { this->actor.speedXZ -= decel; } else if (this->actor.speedXZ < 0.0f) { @@ -1022,7 +1018,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel return; } - baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, globalCtx); + baseSpeed *= EnHorse_SlopeSpeedMultiplier(this, play); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (Math_CosS(stickAngle) <= brakeAngle) { @@ -1044,14 +1040,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) / + (((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) - this->actor.speedXZ) / (16.0f - 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; } @@ -1115,14 +1111,14 @@ void EnHorse_StartMountedIdle(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_MountedIdle(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { f32 mag; s16 angle = 0; this->actor.speedXZ = 0.0f; EnHorse_StickDirection(&this->curStick, &mag, &angle); if (mag > 10.0f) { - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(angle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(angle) <= 0.7071f) { @@ -1162,14 +1158,14 @@ 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.0f; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (stickMag > 10.0f) { - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(stickAngle) <= -0.5f) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(stickAngle) <= 0.7071f) { @@ -1195,17 +1191,17 @@ void EnHorse_StartTurning(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][4]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedTurn(EnHorse* this, PlayState* play) { f32 stickMag; s16 clampedYaw; s16 stickAngle; this->actor.speedXZ = 0.0f; EnHorse_PlayWalkingSound(this); - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { 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); @@ -1220,7 +1216,7 @@ void EnHorse_MountedTurn(EnHorse* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - if (EnHorse_PlayerCanMove(this, globalCtx) == true) { + if (EnHorse_PlayerCanMove(this, play) == true) { if (Math_CosS(stickAngle) <= 0.7071f) { EnHorse_StartTurning(this); } else { @@ -1267,7 +1263,7 @@ void EnHorse_MountedWalkingReset(EnHorse* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); } -void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; @@ -1276,7 +1272,7 @@ void EnHorse_MountedWalk(EnHorse* this, GlobalContext* globalCtx) { if ((this->noInputTimerMax == 0) || ((this->noInputTimer > 0) && (this->noInputTimer < (this->noInputTimerMax - 20)))) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 0x320); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 0x320); } else { this->actor.speedXZ = 3.0f; } @@ -1335,11 +1331,11 @@ void EnHorse_MountedTrotReset(EnHorse* this) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); } -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, 800); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 800); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (this->actor.speedXZ < 3.0f) { EnHorse_StartWalkingInterruptable(this); @@ -1383,7 +1379,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; @@ -1396,14 +1392,14 @@ void EnHorse_JumpLanding(EnHorse* this, GlobalContext* globalCtx) { this->postDrawFunc = NULL; } -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) { - EnHorse_UpdateSpeed(this, globalCtx, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 800); + EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 800); } else if (this->noInputTimer > 0) { this->noInputTimer--; this->actor.speedXZ = 8.0f; @@ -1418,9 +1414,9 @@ void EnHorse_MountedGallop(EnHorse* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); func_8013ECE0(0.0f, 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 { @@ -1465,7 +1461,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; @@ -1485,7 +1481,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; @@ -1507,7 +1503,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_LOW_JUMP; this->animationIdx = ENHORSE_ANIM_STOPPING; if (sAnimationHeaders[this->type][this->animationIdx] == NULL) { @@ -1537,7 +1533,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 -= 0.6f; if (this->actor.speedXZ < 0.0f) { @@ -1548,7 +1544,7 @@ void EnHorse_Stopping(EnHorse* this, GlobalContext* globalCtx) { if ((this->stateFlags & ENHORSE_STOPPING_NEIGH_SOUND) && (this->skin.skelAnime.curFrame > 29.0f)) { this->actor.speedXZ = 0.0f; if ((Rand_ZeroOne() > 0.5f) && - ((gSaveContext.save.entranceIndex != 0x6400) || !Cutscene_GetSceneSetupIndex(globalCtx))) { + ((gSaveContext.save.entranceIndex != 0x6400) || !Cutscene_GetSceneSetupIndex(play))) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); @@ -1595,15 +1591,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) || ((this->noInputTimer > 0) && (this->noInputTimer < (this->noInputTimerMax - 20)))) { if ((stickMag < 10.0f) && (this->noInputTimer <= 0)) { @@ -1621,7 +1617,7 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } else if (stickMag < 10.0f) { stickAngle = -0x7FFF; } - } else if ((player->actor.flags & ACTOR_FLAG_100) || (globalCtx->csCtx.state != 0) || + } else if ((player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != 0) || (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & 0x20)) { EnHorse_StartMountedIdleResetAnim(this); this->actor.speedXZ = 0.0f; @@ -1646,7 +1642,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) && (this->noInputTimer <= 0) && - (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); @@ -1659,12 +1655,12 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { } } -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; @@ -1694,7 +1690,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; f32 temp_f0; f32 curFrame; @@ -1712,8 +1708,7 @@ void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight - 5.0f; - temp_f0 = - BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &colPoly, &floorBgId, &this->actor, &pos); + temp_f0 = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &colPoly, &floorBgId, &this->actor, &pos); if ((this->actor.floorHeight - 120.0f) < temp_f0) { this->actor.floorHeight = temp_f0; this->actor.floorPoly = colPoly; @@ -1752,16 +1747,16 @@ void EnHorse_LowJump(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - EnHorse_JumpLanding(this, globalCtx); + EnHorse_JumpLanding(this, 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; @@ -1793,7 +1788,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; f32 temp_f0; f32 curFrame; @@ -1811,8 +1806,7 @@ void EnHorse_HighJump(EnHorse* this, GlobalContext* globalCtx) { Vec3f pos = this->actor.world.pos; pos.y = this->actor.floorHeight - 5.0f; - temp_f0 = - BgCheck_EntityRaycastFloor5_2(globalCtx, &globalCtx->colCtx, &colPoly, &floorBgId, &this->actor, &pos); + temp_f0 = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &colPoly, &floorBgId, &this->actor, &pos); if ((this->actor.floorHeight - 120.0f) < temp_f0) { this->actor.floorHeight = temp_f0; this->actor.floorPoly = colPoly; @@ -1850,8 +1844,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_800B1598(globalCtx, 25.0f, &this->actor.world.pos); - EnHorse_JumpLanding(this, globalCtx); + func_800B1598(play, 25.0f, &this->actor.world.pos); + EnHorse_JumpLanding(this, play); } } @@ -1865,10 +1859,10 @@ void EnHorse_InitInactive(EnHorse* this) { this->followTimer = 0; } -void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_Inactive(EnHorse* this, PlayState* play) { if ((D_801BDAA4 != 0) && (this->type == HORSE_2)) { D_801BDAA4 = 0; - if (EnHorse_Spawn(this, globalCtx)) { + if (EnHorse_Spawn(this, play)) { if (this->type == HORSE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } @@ -1878,7 +1872,7 @@ void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx) { if (!(this->stateFlags & ENHORSE_INACTIVE)) { this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); this->actor.params = ENHORSE_0; this->colliderCylinder1.base.ocFlags1 |= OC1_ON; this->colliderCylinder2.base.ocFlags1 |= OC1_ON; @@ -1942,21 +1936,21 @@ void EnHorse_StartIdleRidable(EnHorse* this) { this->stateFlags &= ~ENHORSE_UNRIDEABLE; } -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 ((D_801BDAA4 != 0) && (this->type == HORSE_2)) { D_801BDAA4 = 0; - if (!func_8087C38C(globalCtx, this, &this->actor.world.pos)) { - if (EnHorse_Spawn(this, globalCtx)) { + if (!func_8087C38C(play, this, &this->actor.world.pos)) { + if (EnHorse_Spawn(this, play)) { if (this->type == HORSE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); } this->followTimer = 0; - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); } } else { if (this->type == HORSE_2) { @@ -2004,9 +1998,9 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 } } -void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { s32 anim = ENHORSE_ANIM_WALK; - f32 distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + f32 distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { anim = ENHORSE_ANIM_GALLOP; @@ -2039,11 +2033,11 @@ void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { EnHorse_StartMovingAnimation(this, anim, -3.0f, 0.0f); } -void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; D_801BDAA4 = 0; - distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); if (((this->playerDir == PLAYER_DIR_BACK_R) || (this->playerDir == PLAYER_DIR_BACK_L)) && (distToPlayer > 300.0f) && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER)) { @@ -2051,7 +2045,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; - this->angleToPlayer = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + this->angleToPlayer = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); angleDiff = (f32)this->angleToPlayer - this->actor.world.rot.y; if (angleDiff > 0x7FFF) { @@ -2078,7 +2072,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { } } } else { - EnHorse_RotateToPlayer(this, globalCtx); + EnHorse_RotateToPlayer(this, play); } if (this->animationIdx == ENHORSE_ANIM_GALLOP) { @@ -2124,7 +2118,7 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { if (distToPlayer < 100.0f) { EnHorse_StartIdleRidable(this); } else { - EnHorse_SetFollowAnimation(this, globalCtx); + EnHorse_SetFollowAnimation(this, play); } } } @@ -2212,11 +2206,11 @@ 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); } @@ -2246,12 +2240,12 @@ void EnHorse_UpdateIngoRace(EnHorse* this, GlobalContext* globalCtx) { } } -void func_8088126C(EnHorse* this, GlobalContext* globalCtx) { +void func_8088126C(EnHorse* this, PlayState* play) { this->skin.skelAnime.curFrame = 0.0f; - func_80881290(this, globalCtx); + func_80881290(this, play); } -void func_80881290(EnHorse* this, GlobalContext* globalCtx) { +void func_80881290(EnHorse* this, PlayState* play) { f32 curFrame; this->action = ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING; @@ -2271,7 +2265,7 @@ void func_80881290(EnHorse* this, GlobalContext* globalCtx) { func_8013ECE0(0.0f, 170, 10, 10); } -void func_80881398(EnHorse* this, GlobalContext* globalCtx) { +void func_80881398(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; s32 animeUpdated; @@ -2313,12 +2307,12 @@ void func_80881398(EnHorse* this, GlobalContext* globalCtx) { this->stateFlags &= ~ENHORSE_FLAG_30; this->actor.gravity = -3.5f; this->actor.world.pos.y = this->actor.floorHeight; - func_800B1598(globalCtx, 25.0f, &this->actor.world.pos); - func_8088159C(this, globalCtx); + func_800B1598(play, 25.0f, &this->actor.world.pos); + func_8088159C(this, play); } } -void func_8088159C(EnHorse* this, GlobalContext* globalCtx) { +void func_8088159C(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; @@ -2407,12 +2401,12 @@ void func_8088168C(EnHorse* this) { } } -void func_808819D8(EnHorse* this, GlobalContext* globalCtx) { +void func_808819D8(EnHorse* this, PlayState* play) { Path* path; f32 animSpeed; 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); } @@ -2426,11 +2420,11 @@ void func_808819D8(EnHorse* this, GlobalContext* globalCtx) { } if (this->actor.params == ENHORSE_4) { - path = &globalCtx->setupPathList[0]; - func_8087B7C0(this, globalCtx, path); + path = &play->setupPathList[0]; + func_8087B7C0(this, play, path); } else if (this->actor.params == ENHORSE_5) { - path = &globalCtx->setupPathList[1]; - func_8087B7C0(this, globalCtx, path); + path = &play->setupPathList[1]; + func_8087B7C0(this, play, path); } if (!this->inRace) { @@ -2464,14 +2458,14 @@ void func_808819D8(EnHorse* this, GlobalContext* globalCtx) { } } -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.2f * 1.5f); } -void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Vec3f endPos; s32 pad; @@ -2480,7 +2474,7 @@ void EnHorse_CsMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAc endPos.z = action->endPos.z; if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 0x320); + EnHorse_RotateToPoint(this, play, &endPos, 0x320); this->actor.speedXZ = 8.0f; this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; } else { @@ -2496,12 +2490,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; @@ -2528,20 +2522,20 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, GlobalContext* globalCtx) { func_8013ECE0(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 curFrame; f32 y; Vec3s* jointTable; s32 pad[2]; if (this->cutsceneFlags & 1) { - EnHorse_CsMoveToPoint(this, globalCtx, action); + EnHorse_CsMoveToPoint(this, play, action); return; } @@ -2580,7 +2574,7 @@ void EnHorse_CsJump(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* a this->actor.gravity = -3.5f; this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - func_800B1598(globalCtx, 25.0f, &this->actor.world.pos); + func_800B1598(play, 25.0f, &this->actor.world.pos); this->animationIdx = ENHORSE_ANIM_GALLOP; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], sPlaybackSpeeds[6]); @@ -2593,7 +2587,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; @@ -2609,7 +2603,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)) { @@ -2637,7 +2631,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; @@ -2652,7 +2646,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; s32 pad; @@ -2661,7 +2655,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, GlobalContext* globalCtx, CsCmdAct endPos.z = action->endPos.z; if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { - EnHorse_RotateToPoint(this, globalCtx, &endPos, 0x320); + EnHorse_RotateToPoint(this, play, &endPos, 0x320); this->actor.speedXZ = 8.0f; this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; } else { @@ -2677,7 +2671,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; @@ -2702,7 +2696,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)) { @@ -2730,7 +2724,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_HBA; this->cutsceneAction = 0; @@ -2753,15 +2747,15 @@ s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { return 0; } -void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; - CsCmdActorAction* playerAction = globalCtx->csCtx.playerAction; + CsCmdActorAction* playerAction = play->csCtx.playerAction; - if (globalCtx->csCtx.state == 3) { + if (play->csCtx.state == 3) { this->playerControlled = true; this->actor.params = ENHORSE_12; this->action = ENHORSE_ACT_IDLE; - EnHorse_Freeze(this, globalCtx); + EnHorse_Freeze(this, play); return; } @@ -2779,14 +2773,14 @@ void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { this->actor.prevPos = this->actor.world.pos; } this->cutsceneAction = csFunctionIdx; - sCutsceneInitFuncs[csFunctionIdx](this, globalCtx, playerAction); + sCutsceneInitFuncs[csFunctionIdx](this, play, playerAction); } - sCutsceneActionFuncs[this->cutsceneAction](this, globalCtx, playerAction); + sCutsceneActionFuncs[this->cutsceneAction](this, play, playerAction); } } } -s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* raceInfo) { +s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f pos; f32 px; f32 pz; @@ -2809,7 +2803,7 @@ s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInfo* } if (!(this->hbaFlags & 1)) { - EnHorse_RotateToPoint(this, globalCtx, &pos, 0x640); + EnHorse_RotateToPoint(this, play, &pos, 0x640); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -2895,7 +2889,7 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } } -void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { f32 playSpeed; s32 sp28; @@ -2903,22 +2897,22 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { EnHorse_PlayWalkingSound(this); } - if (globalCtx->interfaceCtx.hbaAmmo == 0) { + if (play->interfaceCtx.hbaAmmo == 0) { this->hbaTimer++; } sp28 = Audio_IsSequencePlaying(0x41); - EnHorse_UpdateHbaRaceInfo(this, globalCtx, &sHbaInfo); + EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if (((this->hbaFlags & 1) || (this->hbaTimer > 45)) && (sp28 != 1) && (gSaveContext.minigameState != 3)) { gSaveContext.save.cutscene = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x40; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x40; } - if (globalCtx->interfaceCtx.hbaAmmo) {} + if (play->interfaceCtx.hbaAmmo) {} - if (((globalCtx->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { + if (((play->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { this->hbaFlags &= ~4; Audio_QueueSeqCmd(0x8041); } @@ -2947,8 +2941,8 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, GlobalContext* globalCtx) { } } -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; @@ -3009,7 +3003,7 @@ void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { } else { nextAnim = ENHORSE_ANIM_IDLE; } - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); this->skin.skelAnime.playSpeed = 1.0f; } @@ -3104,7 +3098,7 @@ void func_80883B70(EnHorse* this, CsCmdActorAction* action) { this->actor.prevPos = this->actor.world.pos; } -void func_80883BEC(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->animationIdx = ENHORSE_ANIM_IDLE; this->unk_3E0 = 1; @@ -3114,8 +3108,8 @@ void func_80883BEC(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac this->stateFlags |= ENHORSE_SANDDUST_SOUND; } -void func_80883CB0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - EnHorse_IdleAnimSounds(this, globalCtx); +void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + EnHorse_IdleAnimSounds(this, play); if (SkelAnime_Update(&this->skin.skelAnime)) { this->animationIdx = ENHORSE_ANIM_IDLE; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, @@ -3124,18 +3118,18 @@ void func_80883CB0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac } } -void func_80883D64(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 2; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00A8DC, 0.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00A8DC), ANIMMODE_ONCE, 0.0f); } -void func_80883DE0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { SkelAnime_Update(&this->skin.skelAnime); } -void func_80883E10(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 3; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00A8DC, 1.0f, 0.0f, @@ -3143,28 +3137,28 @@ void func_80883E10(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } -void func_80883EA0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00B3E0, 1.0f, 11.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00B3E0), ANIMMODE_ONCE, 0.0f); } } -void func_80883F18(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 4; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00AD08, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00AD08), ANIMMODE_ONCE, -3.0f); } -void func_80883F98(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorAction* action) { if (Animation_OnFrame(&this->skin.skelAnime, Animation_GetLastFrame(&object_horse_link_child_Anim_00AD08) - 1.0f)) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } SkelAnime_Update(&this->skin.skelAnime); } -void func_80884010(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80884010(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 5; this->animationIdx = ENHORSE_ANIM_WALK; @@ -3172,9 +3166,9 @@ void func_80884010(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void func_808840C4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { EnHorse_PlayWalkingSound(this); - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, this->unk_530); + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, @@ -3182,7 +3176,7 @@ void func_808840C4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac } } -void func_80884194(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80884194(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 6; this->animationIdx = ENHORSE_ANIM_GALLOP; @@ -3191,8 +3185,8 @@ void func_80884194(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac func_8087C1C0(this); } -void func_8088424C(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, this->unk_530); +void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, @@ -3201,7 +3195,7 @@ void func_8088424C(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac } } -void func_80884314(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80884314(EnHorse* this, PlayState* play, CsCmdActorAction* action) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); func_80883B70(this, action); this->unk_3E0 = 7; @@ -3210,17 +3204,17 @@ void func_80884314(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } -void func_808843B4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { SkelAnime_Update(&this->skin.skelAnime); if (this->curFrame > 42.0f) { if (((s32)this->curFrame % 11) == 0) { func_8087C1C0(this); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, this->unk_530); + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); } } -void func_80884444(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80884444(EnHorse* this, PlayState* play, CsCmdActorAction* action) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); func_80883B70(this, action); this->cutsceneAction = 8; @@ -3229,8 +3223,8 @@ void func_80884444(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac func_8087C1C0(this); } -void func_808844E0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, this->unk_530); +void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00D4E8, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00D4E8), ANIMMODE_ONCE, 0.0f); @@ -3238,7 +3232,7 @@ void func_808844E0(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac } } -void func_80884564(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_80884564(EnHorse* this, PlayState* play, CsCmdActorAction* action) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); func_80883B70(this, action); this->cutsceneAction = 8; @@ -3247,8 +3241,8 @@ void func_80884564(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac func_8087C1C0(this); } -void func_80884604(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, this->unk_530); +void func_80884604(EnHorse* this, PlayState* play, CsCmdActorAction* action) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00BDE0, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00BDE0), ANIMMODE_ONCE, 0.0f); @@ -3259,26 +3253,26 @@ void func_80884604(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* ac } } -void func_808846B4(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Actor_MarkForDeath(&this->actor); } -void func_808846DC(EnHorse* this, GlobalContext* globalCtx, CsCmdActorAction* action) { +void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } -void func_808846F0(EnHorse* this, GlobalContext* globalCtx) { +void func_808846F0(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACT_21; this->unk_3E0 = -1; this->actor.speedXZ = 0.0f; } -void func_80884718(EnHorse* this, GlobalContext* globalCtx) { +void func_80884718(EnHorse* this, PlayState* play) { CsCmdActorAction* action; - if (Cutscene_CheckActorAction(globalCtx, 0x70)) { - this->unk_530 = Cutscene_GetActorActionIndex(globalCtx, 0x70); - action = globalCtx->csCtx.actorActions[this->unk_530]; + if (Cutscene_CheckActorAction(play, 0x70)) { + this->unk_530 = Cutscene_GetActorActionIndex(play, 0x70); + action = play->csCtx.actorActions[this->unk_530]; this->unk_1EC |= 0x20; if (this->unk_3E0 != action->action) { @@ -3295,12 +3289,12 @@ void func_80884718(EnHorse* this, GlobalContext* globalCtx) { this->unk_3E0 = action->action; if (D_808890F0[this->unk_3E0] != NULL) { - D_808890F0[this->unk_3E0](this, globalCtx, action); + D_808890F0[this->unk_3E0](this, play, action); } } if (D_8088911C[this->unk_3E0] != NULL) { - D_8088911C[this->unk_3E0](this, globalCtx, action); + D_8088911C[this->unk_3E0](this, play, action); } } } @@ -3312,7 +3306,7 @@ void func_80884868(EnHorse* this) { this->stateFlags |= ENHORSE_UNRIDEABLE; } -void func_808848C8(EnHorse* this, GlobalContext* globalCtx) { +void func_808848C8(EnHorse* this, PlayState* play) { Vec3f sp24 = { -1916.0f, -106.0f, -523.0f }; EnHorse_PlayWalkingSound(this); @@ -3334,7 +3328,7 @@ void func_80884994(EnHorse* this) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void func_80884A40(EnHorse* this, GlobalContext* globalCtx) { +void func_80884A40(EnHorse* this, PlayState* play) { s32 sp44[] = { 5, 6, 0 }; s32 sp40; s32 temp_v0; @@ -3374,7 +3368,7 @@ void func_80884A40(EnHorse* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_RUN); } else if (this->unk_538 == 2) { if (this->animationIdx == ENHORSE_ANIM_IDLE) { - EnHorse_IdleAnimSounds(this, globalCtx); + EnHorse_IdleAnimSounds(this, play); } else if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_GROAN); } @@ -3382,7 +3376,7 @@ void func_80884A40(EnHorse* this, GlobalContext* globalCtx) { } } -void func_80884D04(EnHorse* this, GlobalContext* globalCtx) { +void func_80884D04(EnHorse* this, PlayState* play) { f32 playSpeed; this->actor.speedXZ = 10.0f; @@ -3396,7 +3390,7 @@ void func_80884D04(EnHorse* this, GlobalContext* globalCtx) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, 0.0f); } -void func_80884E0C(EnHorse* this, GlobalContext* globalCtx) { +void func_80884E0C(EnHorse* this, PlayState* play) { f32 playSpeed = (this->unk_56C * 0.2f * 0.5f) + 1.0f; Vec3f pos; CollisionPoly* sp3C; @@ -3416,7 +3410,7 @@ void func_80884E0C(EnHorse* this, GlobalContext* globalCtx) { this->actor.world.pos.z = this->unk_570.z; this->unk_56C = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos); - if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(globalCtx) != PLAYER_MASK_CIRCUS_LEADER)) { + if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) { this->rider->unk488 = 7; } else { EnHorse_SetIngoAnimation(this->animationIdx, this->skin.skelAnime.curFrame, this->unk_394 & 1, @@ -3426,7 +3420,7 @@ void func_80884E0C(EnHorse* this, GlobalContext* globalCtx) { pos = this->actor.world.pos; pos.y += 10.0f; - if (BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp3C, &pos) != BGCHECK_Y_MIN) { + if (BgCheck_EntityRaycastFloor1(&play->colCtx, &sp3C, &pos) != BGCHECK_Y_MIN) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.terminalVelocity) { this->actor.velocity.y = this->actor.terminalVelocity; @@ -3443,25 +3437,25 @@ void EnHorse_Vec3fOffset(Vec3f* src, s16 yaw, f32 dist, f32 height, Vec3f* dst) dst->z = (Math_CosS(yaw) * dist) + src->z; } -s32 EnHorse_CalcFloorHeight(EnHorse* this, GlobalContext* globalCtx, Vec3f* pos, CollisionPoly** polyFloor, - f32* floorHeight, s32* bgId) { +s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, CollisionPoly** polyFloor, f32* floorHeight, + s32* bgId) { f32 waterY; WaterBox* waterbox; *polyFloor = NULL; - *floorHeight = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, polyFloor, bgId, pos); + *floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, polyFloor, bgId, pos); if (*floorHeight == BGCHECK_Y_MIN) { return 1; // No floor } - if ((WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, pos->x, pos->z, &waterY, &waterbox) == 1) && + if ((WaterBox_GetSurface1_2(play, &play->colCtx, pos->x, pos->z, &waterY, &waterbox) == 1) && (*floorHeight < waterY)) { return 2; // Water } if ((COLPOLY_GET_NORMAL((*polyFloor)->normal.y) < 0.81915206f) || - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, *polyFloor, *bgId) || - (func_800C99D4(&globalCtx->colCtx, *polyFloor, *bgId) == 7)) { + SurfaceType_IsHorseBlocked(&play->colCtx, *polyFloor, *bgId) || + (func_800C99D4(&play->colCtx, *polyFloor, *bgId) == 7)) { return 3; // Horse blocked surface } @@ -3476,7 +3470,7 @@ 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) { +void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, s32 galloping) { if (this->action != ENHORSE_ACT_HBA) { if ((this->action == ENHORSE_ACT_MOUNTED_IDLE) || (this->action == ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING)) { this->actor.world.pos = this->actor.prevPos; @@ -3488,7 +3482,7 @@ void EnHorse_ObstructMovement(EnHorse* this, GlobalContext* globalCtx, s32 obsta this->unk_1EC |= 0x80; this->actor.world.pos = this->actor.prevPos; this->actor.speedXZ = 0.0f; - } else if ((globalCtx->sceneNum != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { + } else if ((play->sceneNum != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { this->unk_1EC &= ~2; this->actor.world.pos = this->lastPos; this->stateFlags |= ENHORSE_OBSTACLE; @@ -3515,7 +3509,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 pad; CollisionPoly* frontFloor; CollisionPoly* backFloor; @@ -3533,10 +3527,10 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { WaterBox* waterbox; f32 dist; - if ((WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterHeight, &waterbox) == true) && + if ((WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterHeight, + &waterbox) == true) && (this->actor.floorHeight < waterHeight)) { - EnHorse_ObstructMovement(this, globalCtx, 1, galloping); + EnHorse_ObstructMovement(this, play, 1, galloping); return; } @@ -3546,16 +3540,16 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, 15.0f, 30.0f, &frontPos); } - status = EnHorse_CalcFloorHeight(this, globalCtx, &frontPos, &frontFloor, &this->yFront, &this->unk_24C); + status = EnHorse_CalcFloorHeight(this, play, &frontPos, &frontFloor, &this->yFront, &this->unk_24C); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } if (status == 3) { this->unk_1EC |= 2; - EnHorse_ObstructMovement(this, globalCtx, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } @@ -3565,16 +3559,16 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, -15.0f, 30.0f, &backPos); } - status = EnHorse_CalcFloorHeight(this, globalCtx, &backPos, &backFloor, &this->yBack, &bgId); + status = EnHorse_CalcFloorHeight(this, play, &backPos, &backFloor, &this->yBack, &bgId); if (status == 1) { this->actor.shape.rot.x = 0; - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } if (status == 3) { this->unk_1EC |= 2; - EnHorse_ObstructMovement(this, globalCtx, 5, galloping); + EnHorse_ObstructMovement(this, play, 5, galloping); return; } @@ -3591,7 +3585,7 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { if ((frontFloor != 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, 4, galloping); + EnHorse_ObstructMovement(this, play, 4, galloping); return; } @@ -3602,17 +3596,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) || - SurfaceType_IsHorseBlocked(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) || - (func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7)) { + SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || + (func_800C99D4(&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); } } else if (this->stateFlags & 4) { this->actor.shape.rot.x = 0; @@ -3627,24 +3621,24 @@ void EnHorse_CheckFloors(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_MountDismount(EnHorse* this, GlobalContext* globalCtx) { - s32 mountSide = EnHorse_GetMountSide(this, globalCtx); +void EnHorse_MountDismount(EnHorse* this, PlayState* play) { + s32 mountSide = EnHorse_GetMountSide(this, play); if ((mountSide != 0) && !(this->stateFlags & ENHORSE_UNRIDEABLE)) { - Actor_SetRideActor(globalCtx, &this->actor, mountSide); + Actor_SetRideActor(play, &this->actor, mountSide); } - if ((this->playerControlled == false) && (Actor_HasRider(globalCtx, &this->actor) == true)) { + if ((this->playerControlled == false) && (Actor_HasRider(play, &this->actor) == true)) { this->noInputTimer = 26; this->noInputTimerMax = 26; this->playerControlled = true; - EnHorse_Freeze(this, globalCtx); - } else if ((this->playerControlled == true) && (Actor_HasNoRider(globalCtx, &this->actor) == true)) { + EnHorse_Freeze(this, play); + } else if ((this->playerControlled == true) && (Actor_HasNoRider(play, &this->actor) == true)) { this->noInputTimer = 35; this->noInputTimerMax = 35; this->stateFlags &= ~ENHORSE_UNRIDEABLE; this->playerControlled = false; - EnHorse_Freeze(this, globalCtx); + EnHorse_Freeze(this, play); } } @@ -3654,15 +3648,15 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) { *angle = Math_Atan2S(-curStick->x, curStick->z); } -void EnHorse_UpdateStick(EnHorse* this, GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[this->unk_52C]; +void EnHorse_UpdateStick(EnHorse* this, PlayState* play) { + Input* input = &play->state.input[this->unk_52C]; this->lastStick = this->curStick; this->curStick.x = input->rel.stick_x; this->curStick.z = input->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; @@ -3683,7 +3677,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 = 40.0f; Vec3f start; Vec3f end; @@ -3698,13 +3692,12 @@ 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, true, false, false, true, - &bgId)) { - EnHorse_ResolveCollision(this, globalCtx, colPoly); + if (BgCheck_EntityLineTest1(&play->colCtx, &start, &end, &intersect, &colPoly, true, false, false, true, &bgId)) { + EnHorse_ResolveCollision(this, play, colPoly); } } -void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { s32 pad2[2]; Vec3f startPos; Vec3f endPos; @@ -3729,9 +3722,9 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { if ((this->actor.params != ENHORSE_4) && (this->actor.params != ENHORSE_5) && (this->actor.params != ENHORSE_19) && (this->actor.params != ENHORSE_20) && (this->actor.params != ENHORSE_18)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 35.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, 0x1D); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 35.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, 0x1C); } if ((this->actor.bgCheckFlags & 8) && (Math_CosS(this->actor.wallYaw - this->actor.world.rot.y) < -0.3f)) { @@ -3745,7 +3738,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } } - horseJump = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + horseJump = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (!(this->stateFlags & ENHORSE_JUMPING)) { if ((horseJump != NULL) && (horseJump->actor.id == ACTOR_EN_HORSE_GAME_CHECK) && @@ -3780,7 +3773,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { movingFast = true; } } else { - EnHorse_BgCheckSlowMoving(this, globalCtx); + EnHorse_BgCheckSlowMoving(this, play); return; } @@ -3795,7 +3788,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { intersect = endPos; wall = NULL; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &startPos, &endPos, &intersect, &wall, true, false, false, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &startPos, &endPos, &intersect, &wall, true, false, false, true, &bgId) == true) { intersectDist = sqrtf(Math3D_Vec3fDistSq(&startPos, &intersect)); this->stateFlags |= ENHORSE_OBSTACLE; @@ -3803,29 +3796,28 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { if (wall != NULL) { if (intersectDist < 30.0f) { - EnHorse_ResolveCollision(this, globalCtx, wall); + EnHorse_ResolveCollision(this, play, wall); } sp7E = BINANG_ROT180(this->actor.world.rot.y - Math_Atan2S(wall->normal.x, wall->normal.z)); - if ((Math_CosS(sp7E) < 0.5f) || SurfaceType_IsHorseBlocked(&globalCtx->colCtx, wall, bgId)) { + if ((Math_CosS(sp7E) < 0.5f) || SurfaceType_IsHorseBlocked(&play->colCtx, wall, bgId)) { return; } if (((movingFast == false) && (intersectDist < 80.0f)) || ((movingFast == true) && (intersectDist < 150.0f))) { - if ((globalCtx->sceneNum != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && - (this->playerControlled == true)) { + if ((play->sceneNum != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && (this->playerControlled == true)) { 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; } - horseJump = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + horseJump = DynaPoly_GetActor(&play->colCtx, bgId); if ((this->stateFlags & ENHORSE_FLAG_26) && (((horseJump != NULL) && (horseJump->actor.id != ACTOR_BG_UMAJUMP)) || (horseJump == NULL))) { if (this->playerControlled == true) { @@ -3833,7 +3825,7 @@ 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; @@ -3848,7 +3840,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { 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; @@ -3868,27 +3860,27 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { COLPOLY_GET_NORMAL(obstacleFloor->normal.z), obstacleFloor->dist, &this->actor.world.pos) > 40.0f)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && - (globalCtx->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } this->stateFlags |= ENHORSE_OBSTACLE; return; } temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y); - if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) || - (func_800C99D4(&globalCtx->colCtx, obstacleFloor, bgId) == 7)) { + if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || + (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) && - (this->action != ENHORSE_ACT_LOW_JUMP) && (globalCtx->sceneNum != SCENE_KOEPONARACE)) { + (this->action != ENHORSE_ACT_LOW_JUMP) && (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } return; } if (wall == NULL) { - horseGameCheck = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + horseGameCheck = DynaPoly_GetActor(&play->colCtx, bgId); if ((horseGameCheck == NULL) || (horseGameCheck->actor.id != ACTOR_EN_HORSE_GAME_CHECK) || ((horseGameCheck->actor.params & 0xFF) != 5)) { return; @@ -3903,7 +3895,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } if ((this->action == ENHORSE_ACT_MOUNTED_IDLE) && !(this->stateFlags & ENHORSE_FLAG_30)) { - horseGameCheck = DynaPoly_GetActor(&globalCtx->colCtx, bgId); + horseGameCheck = DynaPoly_GetActor(&play->colCtx, bgId); if ((horseGameCheck != NULL) && (horseGameCheck->actor.id == ACTOR_EN_HORSE_GAME_CHECK) && ((horseGameCheck->actor.params & 0xFF) == 5)) { this->stateFlags |= ENHORSE_FLAG_30; @@ -3927,7 +3919,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; @@ -3940,18 +3932,18 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y); - if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&globalCtx->colCtx, obstacleFloor, bgId) || - (func_800C99D4(&globalCtx->colCtx, obstacleFloor, bgId) == 7)) { + if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || + (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && - (globalCtx->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -70.0f) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && - (globalCtx->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; - EnHorse_StartBraking(this, globalCtx); + EnHorse_StartBraking(this, play); } } else { temp_f0 = (this->actor.scale.y * 100.0f); @@ -3979,14 +3971,14 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } } -void func_80886C00(EnHorse* this, GlobalContext* globalCtx) { - Input* input = &globalCtx->state.input[this->unk_52C]; +void func_80886C00(EnHorse* this, PlayState* play) { + Input* input = &play->state.input[this->unk_52C]; if (((this->action == ENHORSE_ACT_MOUNTED_GALLOP) || (this->action == ENHORSE_ACT_MOUNTED_REARING) || (this->action == ENHORSE_ACT_STOPPING)) && - (CHECK_BTN_ALL(input->press.button, BTN_A) || (func_801A5100() == 5)) && - (globalCtx->interfaceCtx.unk_212 == 8) && !(this->stateFlags & ENHORSE_BOOST) && - !(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) { + (CHECK_BTN_ALL(input->press.button, BTN_A) || (func_801A5100() == 5)) && (play->interfaceCtx.unk_212 == 8) && + !(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) && + !(this->stateFlags & ENHORSE_FLAG_9)) { if (this->numBoosts > 0) { func_8013ECE0(0.0f, 180, 20, 100); this->stateFlags |= ENHORSE_BOOST; @@ -4016,7 +4008,7 @@ void func_80886C00(EnHorse* this, GlobalContext* globalCtx) { } } -void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { +void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { s32 playSfx; if ((this->numBoosts < 6) && (this->numBoosts > 0)) { @@ -4070,11 +4062,11 @@ void EnHorse_RegenBoost(EnHorse* this, GlobalContext* globalCtx) { } } - globalCtx->interfaceCtx.numHorseBoosts = this->numBoosts; + play->interfaceCtx.numHorseBoosts = this->numBoosts; } -void EnHorse_UpdatePlayerDir(EnHorse* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 angle = Actor_YawBetweenActors(&this->actor, &player->actor) - this->actor.world.rot.y; f32 s = Math_SinS(angle); f32 c = Math_CosS(angle); @@ -4096,7 +4088,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; @@ -4120,16 +4112,16 @@ 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->actor != player->rideActor) || - !SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + !SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { return false; } - conveyorDir = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); conveyorDir = (conveyorDir * 0x400) - this->actor.world.rot.y; if (conveyorDir > 0x640) { this->actor.world.rot.y += 0x640; @@ -4174,12 +4166,12 @@ static EnHorseActionFunc sActionFuncs[] = { func_80884A40, func_80884E0C, }; -void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnHorse_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHorse* this = THIS; 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); if (this->type == HORSE_2) { Actor_SetScale(&this->actor, 0.00648f); @@ -4190,11 +4182,11 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } 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) { @@ -4208,7 +4200,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - sActionFuncs[this->action](this, globalCtx); + sActionFuncs[this->action](this, play); this->stateFlags &= ~ENHORSE_OBSTACLE; this->unk_3EC = thisx->world.rot.y; @@ -4222,11 +4214,11 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { if (!(this->stateFlags & ENHORSE_INACTIVE)) { if ((this->action == ENHORSE_ACT_STOPPING) || (this->action == ENHORSE_ACT_MOUNTED_REARING) || (this->action == ENHORSE_ACT_MOUNTED_GALLOP)) { - func_80886C00(this, globalCtx); + func_80886C00(this, play); } if (this->playerControlled == true) { - EnHorse_RegenBoost(this, globalCtx); + EnHorse_RegenBoost(this, play); } if (ActorCutscene_GetCurrentIndex() != -1) { @@ -4273,7 +4265,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->action != ENHORSE_ACT_INGO_RACE) && (this->action != ENHORSE_ACT_MOUNTED_IDLE) && (this->action != ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING)) { - EnHorse_TiltBody(this, globalCtx); + EnHorse_TiltBody(this, play); } if ((this->playerControlled == false) && (this->unk_1EC & 8)) { @@ -4316,25 +4308,25 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { (s16)(Math_CosS(thisx->shape.rot.y) * -10.8f) + this->colliderCylinder2.dim.pos.z; } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder1.base); if (!(this->stateFlags & ENHORSE_JUMPING) && !(this->unk_1EC & 0x20)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder2.base); } else { this->unk_1EC &= ~0x20; } if (this->unk_1EC & 0x100) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder2.base); } if ((player->stateFlags1 & ENHORSE_BOOST) && (player->rideActor != NULL)) { - EnHorse_UpdateConveyors(this, globalCtx); + EnHorse_UpdateConveyors(this, play); } - EnHorse_UpdateBgCheckInfo(this, globalCtx); - EnHorse_CheckFloors(this, globalCtx); + EnHorse_UpdateBgCheckInfo(this, play); + EnHorse_CheckFloors(this, play); if (thisx->world.pos.y < this->yFront) { if (thisx->world.pos.y < this->yBack) { if (this->yBack < this->yFront) { @@ -4371,26 +4363,26 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->dustFlags & 1) { this->dustFlags &= ~1; - func_800B12F0(globalCtx, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, + func_800B12F0(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, EnHorse_RandInt(10.0f) + 30, EnHorse_RandInt(20.0f) + 30); } else if (this->dustFlags & 2) { this->dustFlags &= ~2; - func_800B12F0(globalCtx, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, + func_800B12F0(play, &this->frontLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, EnHorse_RandInt(10.0f) + 30, EnHorse_RandInt(20.0f) + 30); } else if (this->dustFlags & 4) { this->dustFlags &= ~4; - func_800B12F0(globalCtx, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, + func_800B12F0(play, &this->backRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, EnHorse_RandInt(10.0f) + 30, EnHorse_RandInt(20.0f) + 30); } else if (this->dustFlags & 8) { this->dustFlags &= ~8; - func_800B12F0(globalCtx, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, + func_800B12F0(play, &this->backLeftHoof, &dustVel, &dustAcc, EnHorse_RandInt(100.0f) + 200, EnHorse_RandInt(10.0f) + 30, EnHorse_RandInt(20.0f) + 30); } this->stateFlags &= ~ENHORSE_DRAW; } } -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; } @@ -4402,7 +4394,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_XZDistanceBetweenActors(&this->actor, &player->actor) > 75.0f) { @@ -4418,7 +4410,7 @@ s32 EnHorse_MountSideCheck(EnHorse* this, GlobalContext* globalCtx, Player* play return 0; } - mountSide = EnHorse_PlayerDirToMountSide(this, globalCtx, player); + mountSide = EnHorse_PlayerDirToMountSide(this, play, player); if (mountSide == -1) { return -1; } @@ -4430,7 +4422,7 @@ 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; } @@ -4439,7 +4431,7 @@ s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx) { 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) { @@ -4448,7 +4440,7 @@ void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { dst->z = ((Rand_ZeroOne() * (2.0f * dist)) + src->z) - dist; } -void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { s32 pad; EnHorse* this = THIS; Vec3f sp7C = { 0.0f, 0.0f, 0.0f }; @@ -4483,7 +4475,7 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { Skin_GetLimbPos(skin, 13, &sp7C, &sp38); } - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp38, &this->unk_218, &sp34); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp38, &this->unk_218, &sp34); if ((this->animationIdx == ENHORSE_ANIM_IDLE) && (this->action != ENHORSE_ACT_FROZEN) && (((curFrame > 40.0f) && (curFrame < 45.0f) && (this->type == 0)) || @@ -4639,11 +4631,11 @@ void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { //! In the case of OC, this can cause unwanted effects such as a very large amount of displacement being applied to //! a colliding actor. if (!(this->stateFlags & ENHORSE_JUMPING)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } } -s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, Skin* skin) { +s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* skin) { static TexturePtr D_80889204[] = { object_horse_link_child_Tex_001D28, object_horse_link_child_Tex_001928, @@ -4653,7 +4645,7 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbInd EnHorse* this = THIS; s32 drawOriginalLimb = true; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((limbIndex != 13) || (this->type != HORSE_EPONA)) { if ((limbIndex == 13) && (this->type == HORSE_2)) { @@ -4665,12 +4657,12 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbInd } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return drawOriginalLimb; } -s32 func_80888D18(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80888D18(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { Vec3f sp1C = { -98.0f, -1454.0f, 0.0f }; EnHorse* this = THIS; @@ -4680,17 +4672,17 @@ s32 func_80888D18(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorse_Draw(Actor* thisx, PlayState* play) { EnHorse* this = THIS; if (!(this->stateFlags & ENHORSE_INACTIVE) && (this->actor.update != func_8087D540)) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); this->stateFlags |= ENHORSE_DRAW; if (!(this->unk_1EC & 1)) { if (this->stateFlags & ENHORSE_JUMPING) { - func_80138258(&this->actor, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); + func_80138258(&this->actor, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false); } else { - func_80138258(&this->actor, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); + func_80138258(&this->actor, play, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true); } } else { if (this->stateFlags & ENHORSE_JUMPING) { @@ -4698,12 +4690,12 @@ void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx) { this->skin.skelAnime.jointTable->y = 0; this->skin.skelAnime.jointTable->z = 0; } - 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, func_80888D18, NULL, &this->actor); } 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 2dc5e44f51..a05e1a2c58 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -9,9 +9,9 @@ struct EnHorse; -typedef void (*EnHorseActionFunc)(struct EnHorse*, GlobalContext*); -typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, GlobalContext*); -typedef void (*EnHorseCsFunc)(struct EnHorse*, GlobalContext*, CsCmdActorAction*); +typedef void (*EnHorseActionFunc)(struct EnHorse*, PlayState*); +typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, PlayState*); +typedef void (*EnHorseCsFunc)(struct EnHorse*, PlayState*, CsCmdActorAction*); #define ENHORSE_BOOST (1 << 0) /* 0x1 */ #define ENHORSE_BOOST_DECEL (1 << 1) /* 0x2 */ 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 ae5f25c877..4217723020 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 @@ -11,29 +11,29 @@ #define THIS ((EnHorseGameCheck*)thisx) -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); -s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F8C24(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F8C5C(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F8C70(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F8CCC(EnHorseGameCheck* this, GlobalContext* globalCtx2); -s32 func_808F8E94(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F9830(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F9868(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F987C(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F990C(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F9944(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F9958(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F999C(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F99B0(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F99C4(EnHorseGameCheck* this, GlobalContext* globalCtx); -s32 func_808F99D8(EnHorseGameCheck* this, GlobalContext* globalCtx); +s32 func_808F8AA0(EnHorseGameCheck* this, PlayState* play); +s32 func_808F8C24(EnHorseGameCheck* this, PlayState* play); +s32 func_808F8C5C(EnHorseGameCheck* this, PlayState* play); +s32 func_808F8C70(EnHorseGameCheck* this, PlayState* play); +s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2); +s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play); +s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play); +s32 func_808F96E4(EnHorseGameCheck* this, PlayState* play); +s32 func_808F9830(EnHorseGameCheck* this, PlayState* play); +s32 func_808F9868(EnHorseGameCheck* this, PlayState* play); +s32 func_808F987C(EnHorseGameCheck* this, PlayState* play); +s32 func_808F990C(EnHorseGameCheck* this, PlayState* play); +s32 func_808F9944(EnHorseGameCheck* this, PlayState* play); +s32 func_808F9958(EnHorseGameCheck* this, PlayState* play); +s32 func_808F999C(EnHorseGameCheck* this, PlayState* play); +s32 func_808F99B0(EnHorseGameCheck* this, PlayState* play); +s32 func_808F99C4(EnHorseGameCheck* this, PlayState* play); +s32 func_808F99D8(EnHorseGameCheck* this, PlayState* play); const ActorInit En_Horse_Game_Check_InitVars = { ACTOR_EN_HORSE_GAME_CHECK, @@ -49,7 +49,7 @@ const ActorInit En_Horse_Game_Check_InitVars = { #include "overlays/ovl_En_Horse_Game_Check/ovl_En_Horse_Game_Check.c" -s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F8AA0(EnHorseGameCheck* this, PlayState* play) { s32 pad[3]; CollisionHeader* sp78 = NULL; MtxF sp38; @@ -66,13 +66,13 @@ s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&object_horse_game_check_Colheader_003918, &sp78); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp78); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp78); this->unk_15C = ENHORSEGAMECHECK_FF_5; this->dyna.actor.floorPoly = NULL; this->dyna.actor.world.pos.y += 100.0f; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor2( - globalCtx, &globalCtx->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos); + this->dyna.actor.floorHeight = + BgCheck_EntityRaycastFloor2(play, &play->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight + 3.0f; func_800C0094(this->dyna.actor.floorPoly, this->dyna.actor.world.pos.x, this->dyna.actor.floorHeight, this->dyna.actor.world.pos.z, &sp38); @@ -87,27 +87,27 @@ s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx) { return true; } -s32 func_808F8C24(EnHorseGameCheck* this, GlobalContext* globalCtx) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +s32 func_808F8C24(EnHorseGameCheck* this, PlayState* play) { + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); return true; } -s32 func_808F8C5C(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F8C5C(EnHorseGameCheck* this, PlayState* play) { return true; } -s32 func_808F8C70(EnHorseGameCheck* this, GlobalContext* globalCtx) { - if (Matrix_NewMtx(globalCtx->state.gfxCtx) == NULL) { +s32 func_808F8C70(EnHorseGameCheck* this, PlayState* play) { + if (Matrix_NewMtx(play->state.gfxCtx) == NULL) { return true; } else { - Gfx_DrawDListXlu(globalCtx, object_horse_game_check_DL_003030); - Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0030C0); + Gfx_DrawDListXlu(play, object_horse_game_check_DL_003030); + Gfx_DrawDListOpa(play, object_horse_game_check_DL_0030C0); } return true; } -s32 func_808F8CCC(EnHorseGameCheck* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { + PlayState* play = play2; s32 pad; Vec3f sp4C = { -1262.0f, 15.0f, 780.0f }; Vec3f sp40 = { -1262.0f, -26.0f, 470.0f }; @@ -122,49 +122,49 @@ s32 func_808F8CCC(EnHorseGameCheck* this, GlobalContext* globalCtx2) { } func_8010E9F0(4, 0); - globalCtx->interfaceCtx.unk_280 = 1; + play->interfaceCtx.unk_280 = 1; - this->horse1 = (EnHorse*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, - 0x7FFF, 0, 0x2004); + this->horse1 = + (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, 0x2004); if (this->horse1 == NULL) { __assert("../z_en_horse_game_check.c", 1517); } - this->horse2 = (EnHorse*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0, - 0x7FFF, 0, 0x2005); + this->horse2 = + (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, 0x2005); if (this->horse2 == NULL) { __assert("../z_en_horse_game_check.c", 1526); } this->unk_17C = -1; - func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 10); - Play_CameraSetAtEye(globalCtx, 0, &sp40, &sp4C); - Play_CameraSetFov(globalCtx, 0, 45.0f); + func_800DFAC8(play->cameraPtrs[CAM_ID_MAIN], 10); + Play_CameraSetAtEye(play, 0, &sp40, &sp4C); + Play_CameraSetFov(play, 0, 45.0f); func_800FE484(); return false; } -s32 func_808F8E94(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play) { gSaveContext.unk_3DD0[4] = 0; return true; } -s32 func_808F8EB0(EnHorseGameCheck* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->nextEntranceIndex == 0xCE20) { + if (play->nextEntranceIndex == 0xCE20) { return false; } if (GET_RACE_FLAGS == RACE_FLAG_3) { - globalCtx->unk_1887F = 0x40; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 2; } else if (GET_RACE_FLAGS == RACE_FLAG_2) { - globalCtx->unk_1887F = 0x50; + play->unk_1887F = 0x50; gSaveContext.nextTransition = 3; } else if (GET_RACE_FLAGS == RACE_FLAG_4) { SET_RACE_FLAGS(RACE_FLAG_3); - globalCtx->unk_1887F = 2; + play->unk_1887F = 2; gSaveContext.nextTransition = 2; } @@ -172,8 +172,8 @@ s32 func_808F8EB0(EnHorseGameCheck* this, GlobalContext* globalCtx) { if (player->stateFlags1 & 0x800000) { D_801BDAA0 = 1; } - globalCtx->nextEntranceIndex = 0xCE20; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0xCE20; + play->sceneLoadFlag = 0x14; return false; } @@ -198,9 +198,9 @@ f32 D_808F9BCC[] = { 5368.0f, }; -s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; EnHorse* horse = (EnHorse*)player->rideActor; s32 pad3[2]; @@ -212,10 +212,10 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { if ((this->unk_168 > 50) && !(this->unk_164 & 2)) { this->unk_164 |= 2; - } else if ((globalCtx->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 1)) { + } else if ((play->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 1)) { this->unk_164 |= 1; horse->inRace = true; - } else if ((globalCtx->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 8)) { + } else if ((play->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 8)) { EnHorse* horse = this->horse1; horse->inRace = true; @@ -228,7 +228,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { if ((this->unk_17C != -1) && ((this->unk_168 - this->unk_17C) > 10)) { this->unk_17C = -1; - func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); + func_800DFAC8(play->cameraPtrs[CAM_ID_MAIN], 4); } this->unk_168++; @@ -242,7 +242,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { if (this->unk_174 > 0) { this->unk_174--; } else { - func_808F8EB0(this, globalCtx); + func_808F8EB0(this, play); } return true; } @@ -277,7 +277,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { } } - horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, this->horse1->unk_24C); + horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&play->colCtx, this->horse1->unk_24C); if ((this->unk_164 & 0x4000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x40000)) { @@ -310,7 +310,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { } } - horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, this->horse2->unk_24C); + horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&play->colCtx, this->horse2->unk_24C); if ((this->unk_164 & 0x200000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x02000000)) { @@ -339,7 +339,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { this->unk_164 |= 0x80; } - horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, horse->unk_24C); + horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&play->colCtx, horse->unk_24C); if ((this->unk_164 & 0x80) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x800)) { @@ -353,7 +353,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) { return true; } -s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F96E4(EnHorseGameCheck* this, PlayState* play) { s32 pad[3]; CollisionHeader* sp78 = NULL; MtxF sp38; @@ -362,13 +362,13 @@ s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&ovl_En_Horse_Game_Check_Colheader_0010C8, &sp78); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp78); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp78); this->unk_15C = ENHORSEGAMECHECK_FF_7; this->dyna.actor.floorPoly = NULL; this->dyna.actor.world.pos.y += 100.0f; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor2( - globalCtx, &globalCtx->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos); + this->dyna.actor.floorHeight = + BgCheck_EntityRaycastFloor2(play, &play->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight + 1.0f; func_800C0094(this->dyna.actor.floorPoly, this->dyna.actor.world.pos.x, this->dyna.actor.floorHeight, this->dyna.actor.world.pos.z, &sp38); @@ -383,12 +383,12 @@ s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx) { return true; } -s32 func_808F9830(EnHorseGameCheck* this, GlobalContext* globalCtx) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +s32 func_808F9830(EnHorseGameCheck* this, PlayState* play) { + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); return true; } -s32 func_808F9868(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F9868(EnHorseGameCheck* this, PlayState* play) { return true; } @@ -397,7 +397,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; -s32 func_808F987C(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F987C(EnHorseGameCheck* this, PlayState* play) { s32 pad[3]; CollisionHeader* sp28 = NULL; s32 pad2; @@ -408,39 +408,39 @@ s32 func_808F987C(EnHorseGameCheck* this, GlobalContext* globalCtx) { this->dyna.actor.scale.x = 1.0f; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_horse_game_check_Colheader_002FB8, &sp28); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp28); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp28); this->unk_15C = ENHORSEGAMECHECK_FF_8; return true; } -s32 func_808F990C(EnHorseGameCheck* this, GlobalContext* globalCtx) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +s32 func_808F990C(EnHorseGameCheck* this, PlayState* play) { + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); return true; } -s32 func_808F9944(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F9944(EnHorseGameCheck* this, PlayState* play) { return true; } -s32 func_808F9958(EnHorseGameCheck* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0014B0); - Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0013A0); +s32 func_808F9958(EnHorseGameCheck* this, PlayState* play) { + Gfx_DrawDListOpa(play, object_horse_game_check_DL_0014B0); + Gfx_DrawDListOpa(play, object_horse_game_check_DL_0013A0); return true; } -s32 func_808F999C(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F999C(EnHorseGameCheck* this, PlayState* play) { return true; } -s32 func_808F99B0(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F99B0(EnHorseGameCheck* this, PlayState* play) { return true; } -s32 func_808F99C4(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F99C4(EnHorseGameCheck* this, PlayState* play) { return true; } -s32 func_808F99D8(EnHorseGameCheck* this, GlobalContext* globalCtx) { +s32 func_808F99D8(EnHorseGameCheck* this, PlayState* play) { return true; } @@ -460,7 +460,7 @@ EnHorseGameCheckUnkFunc D_808F9C5C[] = { NULL, NULL, NULL, NULL, NULL, func_808F8C70, NULL, NULL, func_808F9958, func_808F99D8, }; -void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Init(Actor* thisx, PlayState* play) { EnHorseGameCheck* this = THIS; this->unk_15C = ENHORSEGAMECHECK_GET_FF(&this->dyna.actor); @@ -471,30 +471,30 @@ void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) { } if (D_808F9BE4[this->unk_15C] != NULL) { - D_808F9BE4[this->unk_15C](this, globalCtx); + D_808F9BE4[this->unk_15C](this, play); } } -void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Destroy(Actor* thisx, PlayState* play) { EnHorseGameCheck* this = THIS; if (D_808F9C0C[this->unk_15C] != NULL) { - D_808F9C0C[this->unk_15C](this, globalCtx); + D_808F9C0C[this->unk_15C](this, play); } } -void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Update(Actor* thisx, PlayState* play) { EnHorseGameCheck* this = THIS; if (D_808F9C34[this->unk_15C] != NULL) { - D_808F9C34[this->unk_15C](this, globalCtx); + D_808F9C34[this->unk_15C](this, play); } } -void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseGameCheck_Draw(Actor* thisx, PlayState* play) { EnHorseGameCheck* this = THIS; if (D_808F9C5C[this->unk_15C] != NULL) { - D_808F9C5C[this->unk_15C](this, globalCtx); + D_808F9C5C[this->unk_15C](this, 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 886187b498..f07aafc1d3 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 EnHorseGameCheck; -typedef s32 (*EnHorseGameCheckUnkFunc)(struct EnHorseGameCheck*, GlobalContext*); +typedef s32 (*EnHorseGameCheckUnkFunc)(struct EnHorseGameCheck*, PlayState*); #define ENHORSEGAMECHECK_GET_FF(thisx) ((thisx)->params & 0xFF) #define ENHORSEGAMECHECK_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) 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 26295c6eb7..398bac6ca8 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 @@ -11,20 +11,20 @@ #define THIS ((EnHorseLinkChild*)thisx) -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_808DEA0C(EnHorseLinkChild* this, GlobalContext* globalCtx); -void func_808DEB14(EnHorseLinkChild* this, GlobalContext* globalCtx); +void func_808DEA0C(EnHorseLinkChild* this, PlayState* play); +void func_808DEB14(EnHorseLinkChild* this, PlayState* play); void func_808DECA0(EnHorseLinkChild* this); -void func_808DED40(EnHorseLinkChild* this, GlobalContext* globalCtx); +void func_808DED40(EnHorseLinkChild* this, PlayState* play); void func_808DEFE8(EnHorseLinkChild* this); -void func_808DF194(EnHorseLinkChild* this, GlobalContext* globalCtx); -void func_808DF620(EnHorseLinkChild* this, GlobalContext* globalCtx); +void func_808DF194(EnHorseLinkChild* this, PlayState* play); +void func_808DF620(EnHorseLinkChild* this, PlayState* play); void func_808DF788(EnHorseLinkChild* this); -void func_808DF838(EnHorseLinkChild* this, GlobalContext* globalCtx); +void func_808DF838(EnHorseLinkChild* this, PlayState* play); const ActorInit En_Horse_Link_Child_InitVars = { ACTOR_EN_HORSE_LINK_CHILD, @@ -131,7 +131,7 @@ f32 func_808DE728(EnHorseLinkChild* this) { return phi_fv1; } -void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -146,14 +146,13 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Skin_Init(&globalCtx->state, &this->skin, &object_horse_link_child_Skel_00A480, - &object_horse_link_child_Anim_002F98); + Skin_Init(&play->state, &this->skin, &object_horse_link_child_Skel_00A480, &object_horse_link_child_Anim_002F98); this->unk_148 = 0; Animation_PlayOnce(&this->skin.skelAnime, D_808DFEC0[0]); - Collider_InitCylinder(globalCtx, &this->colldierCylinder); - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); + Collider_InitCylinder(play, &this->colldierCylinder); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->unk_1E8 = 0; @@ -168,12 +167,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 = THIS; - Skin_Free(&globalCtx->state, &this->skin); - Collider_DestroyCylinder(globalCtx, &this->colldierCylinder); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Skin_Free(&play->state, &this->skin); + Collider_DestroyCylinder(play, &this->colldierCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void func_808DE9A8(EnHorseLinkChild* this) { @@ -186,7 +185,7 @@ void func_808DE9A8(EnHorseLinkChild* this) { this->skin.skelAnime.playSpeed = func_808DE728(this); } -void func_808DEA0C(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_808DEA0C(EnHorseLinkChild* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_808DE9A8(this); @@ -208,8 +207,8 @@ void func_808DEA54(EnHorseLinkChild* this, s32 arg1) { } } -void func_808DEB14(EnHorseLinkChild* this, GlobalContext* globalCtx) { - f32 sp44 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); +void func_808DEB14(EnHorseLinkChild* this, PlayState* play) { + f32 sp44 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); s32 phi_v0; if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -243,13 +242,13 @@ void func_808DECA0(EnHorseLinkChild* this) { Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } -void func_808DED40(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_808DED40(EnHorseLinkChild* this, PlayState* play) { f32 temp_fv0; s16 temp_a0; s32 phi_v0; if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { - temp_a0 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + temp_a0 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (temp_a0 > 0x12C) { this->actor.world.rot.y += 0x12C; } else if (temp_a0 < -0x12C) { @@ -261,7 +260,7 @@ void func_808DED40(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - temp_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + temp_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); if (temp_fv0 > 1000.0f) { func_808DEA54(this, 0); return; @@ -301,9 +300,9 @@ void func_808DEFE8(EnHorseLinkChild* this) { Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } -void func_808DF088(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_808DF088(EnHorseLinkChild* this, PlayState* play) { if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 sp32; s32 phi_v0; s32 pad; @@ -332,15 +331,15 @@ void func_808DF088(EnHorseLinkChild* this, GlobalContext* globalCtx) { } } -void func_808DF194(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_808DF194(EnHorseLinkChild* this, PlayState* play) { Player* player; f32 sp50; s32 sp4C; s32 sp48; - func_808DF088(this, globalCtx); + func_808DF088(this, play); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); sp50 = Actor_XZDistanceBetweenActors(&this->actor, &player->actor); sp48 = this->unk_148; sp4C = SkelAnime_Update(&this->skin.skelAnime); @@ -422,7 +421,7 @@ void func_808DF560(EnHorseLinkChild* this) { Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f); } -void func_808DF620(EnHorseLinkChild* this, GlobalContext* globalCtx) { +void func_808DF620(EnHorseLinkChild* this, PlayState* play) { s16 sp36; if (D_801BDAA4 != 0) { @@ -433,10 +432,10 @@ void func_808DF620(EnHorseLinkChild* this, GlobalContext* globalCtx) { } this->actor.speedXZ = 0.0f; - sp36 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; + sp36 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((Math_CosS(sp36) < 0.7071f) && (this->unk_148 == 2)) { - func_800F415C(&this->actor, &GET_PLAYER(globalCtx)->actor.world.pos, 0x12C); + func_800F415C(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C); } if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -460,8 +459,8 @@ void func_808DF788(EnHorseLinkChild* this) { Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } -void func_808DF838(EnHorseLinkChild* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808DF838(EnHorseLinkChild* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 phi_fv0; s32 phi_v0; @@ -480,7 +479,7 @@ void func_808DF838(EnHorseLinkChild* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { if (this->unk_1E0 == 0) { - phi_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(globalCtx)->actor); + phi_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); } else { phi_fv0 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); } @@ -523,13 +522,13 @@ void func_808DF838(EnHorseLinkChild* this, GlobalContext* globalCtx) { } } -void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { s32 pad; EnHorseLinkChild* this = THIS; - D_808DFF30[this->unk_144](this, globalCtx); + D_808DFF30[this->unk_144](this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 55.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, 0x1D); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; @@ -544,12 +543,12 @@ void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->colldierCylinder); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colldierCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colldierCylinder.base); func_808DE660(this); } -void EnHorseLinkChild_PostSkinDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) { +void EnHorseLinkChild_PostSkinDraw(Actor* thisx, PlayState* play, Skin* skin) { Vec3f sp4C; Vec3f sp40; EnHorseLinkChild* this = THIS; @@ -569,13 +568,13 @@ void EnHorseLinkChild_PostSkinDraw(Actor* thisx, GlobalContext* globalCtx, Skin* this->colliderJntSph.elements[i].dim.modelSphere.radius * this->colliderJntSph.elements[i].dim.scale; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } -s32 EnHorseLinkChild_OverrideSkinDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, Skin* skin) { +s32 EnHorseLinkChild_OverrideSkinDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* skin) { EnHorseLinkChild* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == OBJECT_HORSE_LINK_CHILD_LIMB_0D) { u8 index = D_808DFF54[this->unk_1E4]; @@ -583,15 +582,15 @@ s32 EnHorseLinkChild_OverrideSkinDraw(Actor* thisx, GlobalContext* globalCtx, s3 gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808DFF48[index])); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return true; } -void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play) { EnHorseLinkChild* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_80138258(&this->actor, globalCtx, &this->skin, EnHorseLinkChild_PostSkinDraw, - EnHorseLinkChild_OverrideSkinDraw, true); + func_8012C28C(play->state.gfxCtx); + func_80138258(&this->actor, play, &this->skin, EnHorseLinkChild_PostSkinDraw, EnHorseLinkChild_OverrideSkinDraw, + 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 0cdbdda9a8..660261ca21 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 (*EnHorseLinkChildUnkFunc)(struct EnHorseLinkChild*, GlobalContext*); +typedef void (*EnHorseLinkChildUnkFunc)(struct EnHorseLinkChild*, PlayState*); typedef struct EnHorseLinkChild { /* 0x000 */ 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 60eb90c50c..f245875e19 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -10,18 +10,18 @@ #define THIS ((EnHs*)thisx) -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_80952FE0(EnHs* this, GlobalContext* globalCtx); -void func_80953098(EnHs* this, GlobalContext* globalCtx); -void func_80953180(EnHs* this, GlobalContext* globalCtx); -void EnHs_DoNothing(EnHs* this, GlobalContext* globalCtx); -void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, GlobalContext* globalCtx); -void func_80953354(EnHs* this, GlobalContext* globalCtx); -void func_8095345C(EnHs* this, GlobalContext* globalCtx); +void func_80952FE0(EnHs* this, PlayState* play); +void func_80953098(EnHs* this, PlayState* play); +void func_80953180(EnHs* this, PlayState* play); +void EnHs_DoNothing(EnHs* this, PlayState* play); +void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play); +void func_80953354(EnHs* this, PlayState* play); +void func_8095345C(EnHs* this, PlayState* play); const ActorInit En_Hs_InitVars = { ACTOR_EN_HS, @@ -57,8 +57,8 @@ static ColliderCylinderInit sCylinderInit = { Vec3f D_8095393C = { 300.0f, 1000.0f, 0.0f }; -void func_80952C50(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80952C50(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; for (i = 0; i < ARRAY_COUNT(this->nwcPos); i++) { @@ -69,39 +69,39 @@ void func_80952C50(EnHs* this, GlobalContext* globalCtx) { this->actor.home.rot.z = 0; // reset chick count } -void EnHs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Init(Actor* thisx, PlayState* play) { s32 pad; EnHs* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gHsSkeleton, &gHsIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gHsSkeleton, &gHsIdleAnim, this->jointTable, this->morphTable, OBJECT_HS_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gHsIdleAnim); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_8095345C; - if (globalCtx->curSpawn == 1) { + if (play->curSpawn == 1) { this->actor.flags |= ACTOR_FLAG_10000; } this->stateFlags = 0; this->actor.targetMode = 6; - func_80952C50(this, globalCtx); + func_80952C50(this, play); } -void EnHs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Destroy(Actor* thisx, PlayState* play) { EnHs* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80952DFC(GlobalContext* globalCtx) { +void func_80952DFC(PlayState* play) { if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { - func_80151BB4(globalCtx, 0x2E); + func_80151BB4(play, 0x2E); } - func_80151BB4(globalCtx, 0x10); + func_80151BB4(play, 0x10); } void EnHs_UpdateChickPos(Vec3f* dst, Vec3f src, f32 offset) { @@ -124,8 +124,8 @@ void EnHs_UpdateChickPos(Vec3f* dst, Vec3f src, f32 offset) { dst->z += diff.z; } -void func_80952F00(EnHs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80952F00(EnHs* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; f32 offset; @@ -142,7 +142,7 @@ void func_80952F00(EnHs* this, GlobalContext* globalCtx) { } } -void func_80952FE0(EnHs* this, GlobalContext* globalCtx) { +void func_80952FE0(EnHs* this, PlayState* play) { if (this->stateTimer < 40) { Math_SmoothStepToS(&this->headRot.y, 0x1F40, 6, 0x1838, 0x64); } else if (this->stateTimer < 80) { @@ -150,53 +150,53 @@ void func_80952FE0(EnHs* this, GlobalContext* globalCtx) { } else { this->actionFunc = func_80953180; this->stateFlags &= ~4; - func_80151938(globalCtx, 0x33F6); - func_80952DFC(globalCtx); + func_80151938(play, 0x33F6); + func_80952DFC(play); } this->stateTimer++; } -void func_80953098(EnHs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80953098(EnHs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_8095345C; this->actor.flags |= ACTOR_FLAG_10000; this->stateFlags |= 0x10; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } else { this->stateFlags |= 8; if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 10000.0f, 50.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_BUNNY, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, GI_MASK_BUNNY, 10000.0f, 50.0f); } } } -void func_80953180(EnHs* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { +void func_80953180(EnHs* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x33F4: // text: laughing that they are all roosters (!) case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_8095345C; break; case 0x33F7: // text: notice his chicks are grown up, happy, wants to give you bunny hood this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80953098; - func_80953098(this, globalCtx); + func_80953098(this, play); break; case 0x33F9: // text: laughing that they are all roosters (.) this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_8095345C; break; case 0x33F5: // He heard from his gramps (?) the moon is going to fall - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80952FE0; this->stateTimer = 0; this->headRot.z = 0; @@ -204,36 +204,36 @@ void func_80953180(EnHs* this, GlobalContext* globalCtx) { break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_8095345C; break; } } } -void EnHs_DoNothing(EnHs* this, GlobalContext* globalCtx) { +void EnHs_DoNothing(EnHs* this, PlayState* play) { } -void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, GlobalContext* globalCtx) { +void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[HS_GET_EXIT_INDEX(&this->actor)]; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = play->setupExitList[HS_GET_EXIT_INDEX(&this->actor)]; + play->sceneLoadFlag = 0x14; gSaveContext.save.weekEventReg[25] |= 8; this->actionFunc = EnHs_DoNothing; } } -void func_80953354(EnHs* this, GlobalContext* globalCtx) { - if (!Play_InCsMode(globalCtx)) { - func_800B7298(globalCtx, &this->actor, 7); +void func_80953354(EnHs* this, PlayState* play) { + if (!Play_InCsMode(play)) { + func_800B7298(play, &this->actor, 7); this->actionFunc = EnHs_SceneTransitToBunnyHoodDialogue; } } -void func_809533A0(EnHs* this, GlobalContext* globalCtx) { +void func_809533A0(EnHs* this, PlayState* play) { u16 sp1E; - if ((globalCtx->curSpawn == 1) && !(this->stateFlags & 0x20)) { + if ((play->curSpawn == 1) && !(this->stateFlags & 0x20)) { sp1E = 0x33F7; this->stateFlags |= 0x20; } else if (this->stateFlags & 0x10) { @@ -245,59 +245,59 @@ void func_809533A0(EnHs* this, GlobalContext* globalCtx) { sp1E = 0x33F5; } - Message_StartTextbox(globalCtx, sp1E, &this->actor); + Message_StartTextbox(play, sp1E, &this->actor); if (sp1E == 0x33F4) { - func_80952DFC(globalCtx); + func_80952DFC(play); } } -void func_8095345C(EnHs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_8095345C(EnHs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80953180; - func_809533A0(this, globalCtx); + func_809533A0(this, play); if (this->stateFlags & 8) { - func_80952DFC(globalCtx); + func_80952DFC(play); this->stateFlags &= ~8; } } else if (this->actor.home.rot.x >= 20) { // chicks turned adult >= 10 this->actionFunc = func_80953354; this->stateTimer = 40; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_10000)) { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); this->stateFlags |= 1; - } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x2000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 130.0f); + } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x2000, play)) { + func_800B8614(&this->actor, play, 130.0f); this->stateFlags |= 1; } else { this->stateFlags &= ~1; } } -void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs_Update(Actor* thisx, PlayState* play) { s32 pad; EnHs* this = THIS; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80952F00(this, globalCtx); + func_80952F00(this, play); if (this->stateFlags & 4) { Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unusedRot.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unusedRot.y, 0, 6, 0x1838, 0x64); } else if (this->stateFlags & 1) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRot, &this->unusedRot, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unusedRot, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->headRot.x, 0x3200, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); @@ -306,7 +306,7 @@ void EnHs_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnHs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHs* this = THIS; switch (limbIndex) { @@ -345,7 +345,7 @@ s32 EnHs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnHs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnHs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnHs* this = THIS; if (limbIndex == HS_LIMB_HEAD) { @@ -353,10 +353,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 = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnHs_OverrideLimbDraw, EnHs_PostLimbDraw, &this->actor); } 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 62fc1d2a14..d6979dc32f 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*); #define HS_GET_EXIT_INDEX(thisx) ((thisx)->params & 0xF) 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 02625ff9ee..3e6ab858fe 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -10,12 +10,12 @@ #define THIS ((EnHs2*)thisx) -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 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 EnHs2_DoNothing(EnHs2* this, GlobalContext* globalCtx); +void EnHs2_DoNothing(EnHs2* this, PlayState* play); const ActorInit En_Hs2_InitVars = { ACTOR_EN_HS2, @@ -29,24 +29,24 @@ const ActorInit En_Hs2_InitVars = { (ActorFunc)EnHs2_Draw, }; -void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Init(Actor* thisx, PlayState* play) { EnHs2* this = THIS; Actor_SetScale(&this->actor, 1.0f); this->actionFunc = EnHs2_DoNothing; } -void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Destroy(Actor* thisx, PlayState* play) { } -void EnHs2_DoNothing(EnHs2* this, GlobalContext* globalCtx) { +void EnHs2_DoNothing(EnHs2* this, PlayState* play) { } -void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Update(Actor* thisx, PlayState* play) { EnHs2* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnHs2_Draw(Actor* thisx, PlayState* play) { } 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 3c7145f3ac..2c7568235a 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h @@ -5,7 +5,7 @@ struct EnHs2; -typedef void (*EnHs2ActionFunc)(struct EnHs2*, GlobalContext*); +typedef void (*EnHs2ActionFunc)(struct EnHs2*, PlayState*); typedef struct EnHs2 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index f15f15d59d..072ec01d40 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -12,13 +12,13 @@ #define THIS ((EnIg*)thisx) -void EnIg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnIg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnIg_Init(Actor* thisx, PlayState* play); +void EnIg_Destroy(Actor* thisx, PlayState* play); +void EnIg_Update(Actor* thisx, PlayState* play); +void EnIg_Draw(Actor* thisx, PlayState* play); -void func_80BF2AF8(EnIg* this, GlobalContext* globalCtx); -void func_80BF2BD4(EnIg* this, GlobalContext* globalCtx); +void func_80BF2AF8(EnIg* this, PlayState* play); +void func_80BF2BD4(EnIg* this, PlayState* play); static u8 D_80BF3260[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(1, 0xB6 - 0x05), @@ -156,12 +156,12 @@ static AnimationInfoS sAnimations[] = { { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -Actor* func_80BF1150(EnIg* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +Actor* func_80BF1150(EnIg* this, PlayState* play, u8 actorCat, s16 actorId) { Actor* foundActor = NULL; Actor* temp_v0; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); + foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); if (foundActor == NULL) { break; @@ -182,7 +182,7 @@ Actor* func_80BF1150(EnIg* this, GlobalContext* globalCtx, u8 actorCat, s16 acto return foundActor; } -EnDoor* func_80BF1200(GlobalContext* globalCtx, s32 arg1) { +EnDoor* func_80BF1200(PlayState* play, s32 arg1) { s32 phi_a1; switch (arg1) { @@ -201,7 +201,7 @@ EnDoor* func_80BF1200(GlobalContext* globalCtx, s32 arg1) { phi_a1 = -1; break; } - return SubS_FindDoor(globalCtx, phi_a1); + return SubS_FindDoor(play, phi_a1); } void func_80BF1258(EnIg* this) { @@ -244,11 +244,11 @@ s32 func_80BF1284(EnIg* this, s32 arg1) { return ret; } -void func_80BF1354(EnIg* this, GlobalContext* globalCtx) { +void func_80BF1354(EnIg* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider1); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); this->collider2.dim.worldSphere.radius = this->collider2.dim.modelSphere.radius * this->collider2.dim.scale; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } void func_80BF13E4(EnIg* this) { @@ -261,13 +261,13 @@ void func_80BF13E4(EnIg* this) { } } -Actor* func_80BF146C(EnIg* this, GlobalContext* globalCtx) { +Actor* func_80BF146C(EnIg* this, PlayState* play) { Actor* retActor; if (this->scheduleResult == 3) { - retActor = func_80BF1150(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AN); + retActor = func_80BF1150(this, play, ACTORCAT_NPC, ACTOR_EN_AN); } else { - retActor = &GET_PLAYER(globalCtx)->actor; + retActor = &GET_PLAYER(play)->actor; } return retActor; } @@ -348,7 +348,7 @@ s16 func_80BF1744(EnIg* this, s32 arg1) { return cs; } -s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF17BC(EnIg* this, PlayState* play) { s32 pad; s16 sp2A; s32 ret; @@ -362,7 +362,7 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { case 2: case 4: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); } this->unk_3F6++; @@ -376,7 +376,7 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { ActorCutscene_Stop(sp2A); this->unk_3F6 = 5; } else { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_3F6++; ret = true; @@ -391,7 +391,7 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { return ret; } -s32* func_80BF1920(EnIg* this, GlobalContext* globalCtx) { +s32* func_80BF1920(EnIg* this, PlayState* play) { switch (this->scheduleResult) { case 3: this->unk_3F8 = func_80BF17BC; @@ -417,16 +417,16 @@ s32* func_80BF1920(EnIg* this, GlobalContext* globalCtx) { } } -s32 func_80BF19A0(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF19A0(EnIg* this, PlayState* play) { s32 ret = false; if (this->unk_3D0 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_3D0, 0, 7); this->unk_3F6 = 0; this->unk_3F8 = NULL; this->actor.child = this->unk_2A8; - this->unk_29C = func_80BF1920(this, globalCtx); + this->unk_29C = func_80BF1920(this, play); if ((this->scheduleResult != 2) && (this->scheduleResult != 3) && (this->scheduleResult != 4)) { this->unk_3D0 |= 0x20; } @@ -437,7 +437,7 @@ s32 func_80BF19A0(EnIg* this, GlobalContext* globalCtx) { return ret; } -void func_80BF1A60(EnIg* this, GlobalContext* globalCtx) { +void func_80BF1A60(EnIg* this, PlayState* play) { if (this->unk_3F4 == 0) { func_80BF1284(this, 4); this->unk_3F4++; @@ -447,7 +447,7 @@ void func_80BF1A60(EnIg* this, GlobalContext* globalCtx) { } } -s32 func_80BF1AE0(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF1AE0(EnIg* this, PlayState* play) { switch (this->scheduleResult) { case 3: func_80BF1284(this, 0); @@ -464,9 +464,9 @@ s32 func_80BF1AE0(EnIg* this, GlobalContext* globalCtx) { return true; } -s32 func_80BF1B40(EnIg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp = globalCtx->msgCtx.currentTextId; +s32 func_80BF1B40(EnIg* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp = play->msgCtx.currentTextId; s32 pad; if (player->stateFlags1 & 0xC40) { @@ -486,17 +486,17 @@ s32 func_80BF1B40(EnIg* this, GlobalContext* globalCtx) { this->unk_3D2 = 0; this->unk_3D0 &= ~0x400; if (1) {} - func_80BF1AE0(this, globalCtx); + func_80BF1AE0(this, play); } if (this->unk_18C != NULL) { - this->unk_18C(this, globalCtx); + this->unk_18C(this, play); } return false; } -s32 func_80BF1C44(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2, s32 arg3, s32 arg4) { +s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s32 arg4) { u8 sp4F = ENIG_GET_FF(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -505,11 +505,11 @@ s32 func_80BF1C44(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2, s3 s32 pad; s32 sp24 = false; - sp2C = func_80BF1150(this, globalCtx, arg3, arg4); + sp2C = func_80BF1150(this, play, arg3, arg4); this->timePath = NULL; if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80BF3318[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -526,10 +526,10 @@ s32 func_80BF1C44(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2, s3 return sp24; } -s32 func_80BF1D78(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleResult* arg2) { s32 sp2C = 0; - if (func_80BF1C44(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { + if (func_80BF1C44(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { func_80BF1284(this, 0); SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x20; @@ -539,7 +539,7 @@ s32 func_80BF1D78(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return sp2C; } -s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = ENIG_GET_FF(&this->actor); EnDoor* door; @@ -550,10 +550,10 @@ s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_80BF1200(globalCtx, arg2->result); + door = func_80BF1200(play, arg2->result); if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp55, D_80BF3318[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[arg2->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -584,7 +584,7 @@ s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BF1FA8(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = ENIG_GET_FF(&this->actor); @@ -594,7 +594,7 @@ s32 func_80BF1FA8(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp2B, D_80BF3318[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[arg2->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -633,7 +633,7 @@ s32 func_80BF1FA8(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BF219C(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) { u8 sp4F = ENIG_GET_FF(&this->actor); Vec3f sp40; Vec3f sp34; @@ -644,7 +644,7 @@ s32 func_80BF219C(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80BF3318[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -678,7 +678,7 @@ s32 func_80BF219C(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BF2368(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->actor.targetMode = 0; @@ -691,7 +691,7 @@ s32 func_80BF2368(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 7: case 8: case 9: - ret = func_80BF1DF4(this, globalCtx, arg2); + ret = func_80BF1DF4(this, play, arg2); break; case 10: @@ -699,22 +699,22 @@ s32 func_80BF2368(EnIg* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 12: case 13: case 14: - ret = func_80BF1FA8(this, globalCtx, arg2); + ret = func_80BF1FA8(this, play, arg2); break; case 2: case 4: - ret = func_80BF219C(this, globalCtx, arg2); + ret = func_80BF219C(this, play, arg2); break; case 3: - ret = func_80BF1D78(this, globalCtx, arg2); + ret = func_80BF1D78(this, play, arg2); break; } return ret; } -s32 func_80BF2400(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF2400(EnIg* this, PlayState* play) { Vec3f sp2C; Vec3f sp20; @@ -727,13 +727,13 @@ s32 func_80BF2400(EnIg* this, GlobalContext* globalCtx) { return true; } -s32 func_80BF2470(EnIg* this, GlobalContext* globalCtx) { - EnDoor* door = func_80BF1200(globalCtx, this->scheduleResult); +s32 func_80BF2470(EnIg* this, PlayState* play) { + EnDoor* door = func_80BF1200(play, this->scheduleResult); Vec3f sp38; f32 temp; s32 pad; - if (!SubS_InCsMode(globalCtx) && (this->timePathTimeSpeed != 0)) { + if (!SubS_InCsMode(play) && (this->timePathTimeSpeed != 0)) { if ((door != NULL) && (door->dyna.actor.update != NULL)) { if (((f32)this->unk_3E2 / this->unk_3E0) <= 0.9f) { door->unk_1A7 = this->unk_2A4; @@ -755,7 +755,7 @@ s32 func_80BF2470(EnIg* this, GlobalContext* globalCtx) { return false; } -s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF25E8(EnIg* this, PlayState* play) { f32 knots[265]; Vec3f sp70; Vec3f sp64; @@ -770,7 +770,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; this->unk_3D0 |= 8; } else { @@ -780,7 +780,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) { this->actor.world.pos.x = timePathTargetPos.x; this->actor.world.pos.z = timePathTargetPos.z; - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { sp54 = this->timePathElapsedTime; sp50 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -798,7 +798,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); } - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; @@ -808,7 +808,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) { return false; } -s32 func_80BF2890(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF2890(EnIg* this, PlayState* play) { if ((this->unk_3D0 & 0x100) && (this->unk_3F2 == 2)) { this->unk_3D0 &= ~0x100; } @@ -824,7 +824,7 @@ s32 func_80BF2890(EnIg* this, GlobalContext* globalCtx) { return true; } -s32 func_80BF293C(EnIg* this, GlobalContext* globalCtx) { +s32 func_80BF293C(EnIg* this, PlayState* play) { if (this->actor.world.rot.y != this->actor.home.rot.y) { if ((this->actor.world.rot.y / 182) != (this->actor.home.rot.y / 182)) { Math_ApproachS(&this->actor.world.rot.y, this->actor.home.rot.y, 3, 0x2AA8); @@ -839,14 +839,14 @@ s32 func_80BF293C(EnIg* this, GlobalContext* globalCtx) { return true; } -void func_80BF2A50(EnIg* this, GlobalContext* globalCtx) { +void func_80BF2A50(EnIg* this, PlayState* play) { switch (this->scheduleResult) { case 10: case 11: case 12: case 13: case 14: - func_80BF25E8(this, globalCtx); + func_80BF25E8(this, play); break; case 5: @@ -854,31 +854,31 @@ void func_80BF2A50(EnIg* this, GlobalContext* globalCtx) { case 7: case 8: case 9: - func_80BF2470(this, globalCtx); + func_80BF2470(this, play); break; case 2: - func_80BF293C(this, globalCtx); + func_80BF293C(this, play); break; case 3: - func_80BF2400(this, globalCtx); + func_80BF2400(this, play); break; case 4: - func_80BF2890(this, globalCtx); + func_80BF2890(this, play); break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80BF2AF8(EnIg* this, GlobalContext* globalCtx) { +void func_80BF2AF8(EnIg* this, PlayState* play) { ScheduleResult sp20; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BF3260, &sp20) || - ((this->scheduleResult != sp20.result) && !func_80BF2368(this, globalCtx, &sp20))) { + if (!Schedule_RunScript(play, D_80BF3260, &sp20) || + ((this->scheduleResult != sp20.result) && !func_80BF2368(this, play, &sp20))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp20.result = 0; @@ -886,17 +886,17 @@ void func_80BF2AF8(EnIg* this, GlobalContext* globalCtx) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_1; } - this->unk_2A8 = func_80BF146C(this, globalCtx); + this->unk_2A8 = func_80BF146C(this, play); this->scheduleResult = sp20.result; - func_80BF2A50(this, globalCtx); + func_80BF2A50(this, play); } -void func_80BF2BD4(EnIg* this, GlobalContext* globalCtx) { +void func_80BF2BD4(EnIg* this, PlayState* play) { s16 yaw; Vec3f sp38; Vec3f sp2C; - if (func_8010BF58(&this->actor, globalCtx, this->unk_29C, this->unk_3F8, &this->unk_2A0)) { + if (func_8010BF58(&this->actor, play, this->unk_29C, this->unk_3F8, &this->unk_2A0)) { SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 &= ~0x20; this->unk_3D0 |= 0x200; @@ -912,52 +912,51 @@ void func_80BF2BD4(EnIg* this, GlobalContext* globalCtx) { } } -void EnIg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIg_Init(Actor* thisx, PlayState* play) { EnIg* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, - 19); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19); this->unk_3FC = -1; func_80BF1284(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); - Collider_InitAndSetSphere(globalCtx, &this->collider2, &this->actor, &sSphereInit); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitAndSetSphere(play, &this->collider2, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->scheduleResult = 0; this->actor.gravity = 0.0f; this->actionFunc = func_80BF2AF8; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnIg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIg_Destroy(Actor* thisx, PlayState* play) { EnIg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroySphere(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroySphere(play, &this->collider2); } -void EnIg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIg_Update(Actor* thisx, PlayState* play) { EnIg* this = THIS; - func_80BF19A0(this, globalCtx); + func_80BF19A0(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80BF1B40(this, globalCtx); + func_80BF1B40(this, play); if (this->scheduleResult != 0) { func_80BF1258(this); func_80BF13E4(this); func_80BF15EC(this); - func_8013C964(&this->actor, globalCtx, 60.0f, 30.0f, EXCH_ITEM_NONE, this->unk_3D0 & 7); + func_8013C964(&this->actor, play, 60.0f, 30.0f, EXCH_ITEM_NONE, this->unk_3D0 & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); - func_80BF1354(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + func_80BF1354(this, play); } } -s32 EnIg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnIg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnIg* this = THIS; @@ -967,7 +966,7 @@ s32 EnIg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnIg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80BF351C = { 1800.0f, -2000.0f, 0.0f }; static Vec3f D_80BF3528 = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -997,7 +996,7 @@ void EnIg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnIg_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx, Gfx** gfx) { +void EnIg_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** gfx) { EnIg* this = THIS; s32 stepRot; s32 overrideRot; @@ -1027,7 +1026,7 @@ void EnIg_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnIg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIg_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80BF3534[] = { object_dai_Tex_0107B0, object_dai_Tex_010FB0, object_dai_Tex_0117B0, object_dai_Tex_011FB0, object_dai_Tex_0127B0, @@ -1036,22 +1035,22 @@ void EnIg_Draw(Actor* thisx, GlobalContext* globalCtx) { EnIg* this = THIS; if (this->scheduleResult != 0) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BF3534[this->unk_3F2])); - POLY_OPA_DISP = SubS_DrawTransformFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SubS_DrawTransformFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnIg_OverrideLimbDraw, EnIg_PostLimbDraw, EnIg_TransformLimbDraw, &this->actor, POLY_OPA_DISP); Matrix_Put(&this->unk_190); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dai_DL_00C538); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.h b/src/overlays/actors/ovl_En_Ig/z_en_ig.h index 9acf34ae94..51004b4702 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.h +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.h @@ -5,9 +5,9 @@ struct EnIg; -typedef void (*EnIgActionFunc)(struct EnIg*, GlobalContext*); -typedef s32 (*EnIgUnkFunc)(struct EnIg*, GlobalContext*); -typedef void (*EnIgUnkFunc2)(struct EnIg*, GlobalContext*); +typedef void (*EnIgActionFunc)(struct EnIg*, PlayState*); +typedef s32 (*EnIgUnkFunc)(struct EnIg*, PlayState*); +typedef void (*EnIgUnkFunc2)(struct EnIg*, PlayState*); #define ENIG_GET_FF(thisx) ((thisx)->params & 0xFF) 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 b782b82a33..328fa8fe2b 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -10,10 +10,10 @@ #define THIS ((EnIk*)thisx) -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); #if 0 const ActorInit En_Ik_InitVars = { 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 ac6d71d821..ae63547907 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -5,7 +5,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 7d8848fd4f..54117e8b83 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -12,15 +12,15 @@ #define THIS ((EnIn*)thisx) -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_808F5A94(EnIn* this, GlobalContext* globalCtx); -void func_808F3690(EnIn* this, GlobalContext* globalCtx); -void func_808F5A34(EnIn* this, GlobalContext* globalCtx); -s32 func_808F5994(EnIn* this, GlobalContext* globalCtx, Vec3f* arg2, s16 arg3); +void func_808F5A94(EnIn* this, PlayState* play); +void func_808F3690(EnIn* this, PlayState* play); +void func_808F5A34(EnIn* this, PlayState* play); +s32 func_808F5994(EnIn* this, PlayState* play, Vec3f* arg2, s16 arg3); const ActorInit En_In_InitVars = { ACTOR_EN_IN, @@ -163,16 +163,16 @@ s32 func_808F30B0(SkelAnime* skelAnime, s16 animIndex) { return ret; } -s32 func_808F3178(EnIn* this, GlobalContext* globalCtx) { +s32 func_808F3178(EnIn* this, PlayState* play) { u8 prevUnk260 = this->unk260; u8 prevUnk261 = this->unk261; u8 tmp; - this->unk260 = tmp = SubS_IsFloorAbove(globalCtx, &this->unk248, -6.0f); + this->unk260 = tmp = SubS_IsFloorAbove(play, &this->unk248, -6.0f); if (this->unk260 != 0 && prevUnk260 == 0 && tmp) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_CONCRETE); } - this->unk261 = tmp = SubS_IsFloorAbove(globalCtx, &this->unk254, -6.0f); + this->unk261 = tmp = SubS_IsFloorAbove(play, &this->unk254, -6.0f); if (this->unk261 != 0 && prevUnk261 == 0 && tmp) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_CONCRETE); } @@ -190,24 +190,24 @@ void func_808F322C(EnIn* this, s32 arg1) { } } -void func_808F32A0(EnIn* this, GlobalContext* globalCtx) { +void func_808F32A0(EnIn* this, PlayState* play) { this->colliderCylinder.dim.pos.x = this->actor.world.pos.x; this->colliderCylinder.dim.pos.y = this->actor.world.pos.y; this->colliderCylinder.dim.pos.z = this->actor.world.pos.z; if (this->unk23D == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } } -s32 func_808F3310(EnIn* this, GlobalContext* globalCtx) { +s32 func_808F3310(EnIn* this, PlayState* play) { if (this->colliderCylinder.base.acFlags & AC_HIT) { this->colliderCylinder.base.acFlags &= ~AC_HIT; } return 0; } -s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808F3334(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~AT_HIT; @@ -215,7 +215,7 @@ s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) { return 0; } Actor_PlaySfxAtPos(&player->actor, NA_SE_PL_BODY_HIT); - func_800B8D98(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 6.0f); + func_800B8D98(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 6.0f); } return 1; } @@ -229,8 +229,8 @@ s32 func_808F33B8(void) { return ret; } -void func_808F3414(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808F3414(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f point; if (this->unk23D == 0) { @@ -251,28 +251,28 @@ void func_808F3414(EnIn* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } func_808F322C(this, 3); - func_808F3178(this, globalCtx); - SubS_FillLimbRotTables(globalCtx, this->unk376, this->unk39E, ARRAY_COUNT(this->unk376)); + func_808F3178(this, play); + SubS_FillLimbRotTables(play, this->unk376, this->unk39E, ARRAY_COUNT(this->unk376)); } -void func_808F35AC(EnIn* this, GlobalContext* globalCtx) { +void func_808F35AC(EnIn* this, PlayState* play) { this->unk4AC |= 0x10; if (this->unk4A4 != NULL) { this->unk4A4->unk4AC |= 0x10; } } -void func_808F35D8(EnIn* this, GlobalContext* globalCtx) { +void func_808F35D8(EnIn* this, PlayState* play) { this->unk4AC &= ~0x10; if (this->unk4A4 != NULL) { this->unk4A4->unk4AC &= ~0x10; } } -void EnIn_DoNothing(EnIn* this, GlobalContext* globalCtx) { +void EnIn_DoNothing(EnIn* this, PlayState* play) { } -void func_808F3618(EnIn* this, GlobalContext* globalCtx) { +void func_808F3618(EnIn* this, PlayState* play) { if (ENIN_GET_PATH(&this->actor) != 0x3F) { func_808F30B0(&this->skelAnime, 9); } @@ -283,7 +283,7 @@ void func_808F3618(EnIn* this, GlobalContext* globalCtx) { } } -void func_808F3690(EnIn* this, GlobalContext* globalCtx) { +void func_808F3690(EnIn* this, PlayState* play) { s16 sp36; Vec3f sp28; @@ -297,7 +297,7 @@ void func_808F3690(EnIn* this, GlobalContext* globalCtx) { } } -void func_808F374C(EnIn* this, GlobalContext* globalCtx) { +void func_808F374C(EnIn* this, PlayState* play) { AnimationHeader* sAnimations[] = { &object_in_Anim_015E38, &object_in_Anim_016A60, &object_in_Anim_0177AC, &object_in_Anim_016484, &object_in_Anim_0170DC, &object_in_Anim_018240, &object_in_Anim_0187C8, &object_in_Anim_0198A8, @@ -323,11 +323,11 @@ void func_808F374C(EnIn* this, GlobalContext* globalCtx) { } } -void func_808F38F8(EnIn* this, GlobalContext* globalCtx) { +void func_808F38F8(EnIn* this, PlayState* play) { this->unk4A4 = NULL; while (true) { //! @bug: Infinite loop if there is only one ACTOR_EN_IN - this->unk4A4 = (EnIn*)SubS_FindActor(globalCtx, &this->unk4A4->actor, ACTORCAT_NPC, ACTOR_EN_IN); + this->unk4A4 = (EnIn*)SubS_FindActor(play, &this->unk4A4->actor, ACTORCAT_NPC, ACTOR_EN_IN); if (this->unk4A4 != NULL && this->unk4A4 != this) { break; } @@ -335,20 +335,20 @@ void func_808F38F8(EnIn* this, GlobalContext* globalCtx) { } } -void func_808F395C(EnIn* this, GlobalContext* globalCtx) { +void func_808F395C(EnIn* this, PlayState* play) { if (this->unk4B0 == RACE_FLAG_END) { this->actionFunc = func_808F5A94; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = func_808F5A34; this->unk48C = 1; } else { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } } -void func_808F39DC(EnIn* this, GlobalContext* globalCtx) { +void func_808F39DC(EnIn* this, PlayState* play) { u16 textId = 0; if (gSaveContext.save.day != 3) { @@ -382,82 +382,82 @@ void func_808F39DC(EnIn* this, GlobalContext* globalCtx) { } } -void func_808F3AD4(EnIn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_808F3AD4(EnIn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } -void func_808F3B40(EnIn* this, GlobalContext* globalCtx) { +void func_808F3B40(EnIn* this, PlayState* play) { u16 textId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_808F3AD4; textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4; this->actor.textId = textId; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); } } -void func_808F3BD4(EnIn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_808F3BD4(EnIn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } -void func_808F3C40(EnIn* this, GlobalContext* globalCtx) { +void func_808F3C40(EnIn* this, PlayState* play) { u16 textId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actor.flags |= ACTOR_FLAG_10000; this->actionFunc = func_808F3BD4; textId = gSaveContext.save.day != 3 ? 0x346A : 0x3492; this->actor.textId = textId; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); } } -void func_808F3CD4(EnIn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_808F3CD4(EnIn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } -void func_808F3D40(EnIn* this, GlobalContext* globalCtx) { +void func_808F3D40(EnIn* this, PlayState* play) { u16 textId; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_808F3CD4; textId = gSaveContext.save.day != 3 ? 0x347D : 0x34A0; this->actor.textId = textId; this->actor.flags |= ACTOR_FLAG_10000; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_GARO, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); } } -u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { +u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { u16 textId = 0; - if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER) { + if (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) { s32 requiredScopeTemp; if (!(gSaveContext.save.weekEventReg[63] & 0x40)) { @@ -540,24 +540,24 @@ u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { return textId; } -void func_808F4054(GlobalContext* globalCtx, EnIn* this, s32 arg2, u16 textId) { +void func_808F4054(PlayState* play, EnIn* this, s32 arg2, u16 textId) { s32 unused; if (textId == 0x34AE || textId == 0x34B0 || textId == 0x34B2) { unused = textId; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); } switch (arg2) { case 1: case 5: case 7: if (textId == 0x3473) { - func_808F35D8(this, globalCtx); + func_808F35D8(this, play); } break; case 2: if (textId == 0x3473) { - func_808F35D8(this, globalCtx); + func_808F35D8(this, play); } break; case 0: @@ -565,42 +565,42 @@ void func_808F4054(GlobalContext* globalCtx, EnIn* this, s32 arg2, u16 textId) { } } -void func_808F4108(EnIn* this, GlobalContext* globalCtx, u16 textId) { - Actor_ChangeFocus(&this->actor, globalCtx, &this->unk4A4->actor); +void func_808F4108(EnIn* this, PlayState* play, u16 textId) { + Actor_ChangeFocus(&this->actor, play, &this->unk4A4->actor); this->actor.textId = 0; this->unk4A4->actor.textId = textId; this->unk4A4->unk48C = 2; this->unk48C = 0; } -s32 func_808F4150(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext* msgCtx) { +s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) { EnIn* this2 = this; if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { - func_801159EC(-globalCtx->msgCtx.unk1206C); + if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + func_801159EC(-play->msgCtx.unk1206C); if (!(gSaveContext.save.weekEventReg[57] & 1)) { - func_808F4108(this, globalCtx, 0x3474); + func_808F4108(this, play, 0x3474); } else if (this->unk4AC & 8) { - func_808F4108(this, globalCtx, 0x3475); + func_808F4108(this, play, 0x3475); } else { - Actor_ContinueText(globalCtx, &this->actor, 0x3475); + Actor_ContinueText(play, &this->actor, 0x3475); } } else { play_sound(NA_SE_SY_ERROR); - Actor_ContinueText(globalCtx, &this->actor, 0x3473); + Actor_ContinueText(play, &this->actor, 0x3473); } } else { func_8019F230(); - Actor_ContinueText(globalCtx, &this->actor, 0x3472); + Actor_ContinueText(play, &this->actor, 0x3472); } return 0; } -s32 func_808F4270(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext* msgCtx, s32 arg4) { +s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, s32 arg4) { s32 pad; - s32 fee = globalCtx->msgCtx.unk1206C != 0xFFFF ? globalCtx->msgCtx.unk1206C : 10; + s32 fee = play->msgCtx.unk1206C != 0xFFFF ? play->msgCtx.unk1206C : 10; if (msgCtx->choiceIndex == 0) { func_8019F208(); @@ -608,28 +608,28 @@ s32 func_808F4270(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext func_801159EC(-fee); if (!(gSaveContext.save.weekEventReg[57] & 1)) { if (arg4 != 0) { - Actor_ContinueText(globalCtx, &this->actor, 0x3474); + Actor_ContinueText(play, &this->actor, 0x3474); } else { - func_808F4108(this, globalCtx, 0x3474); + func_808F4108(this, play, 0x3474); } } else { if (arg4 != 0) { - Actor_ContinueText(globalCtx, &this->actor, 0x3475); + Actor_ContinueText(play, &this->actor, 0x3475); } else { - func_808F4108(this, globalCtx, 0x3475); + func_808F4108(this, play, 0x3475); } } } else { play_sound(NA_SE_SY_ERROR); if (arg4 != 0) { - Actor_ContinueText(globalCtx, &this->actor, 0x3473); + Actor_ContinueText(play, &this->actor, 0x3473); } else { - func_808F4108(this, globalCtx, 0x3473); + func_808F4108(this, play, 0x3473); } } } else { func_8019F230(); - Actor_ContinueText(globalCtx, &this->actor, 0x3472); + Actor_ContinueText(play, &this->actor, 0x3472); } return 0; } @@ -641,40 +641,40 @@ s32 func_808F43E0(EnIn* this) { return 0; } -s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { +s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { u16 textId = this->actor.textId; s32 ret = true; - MessageContext* msgCtx = &globalCtx->msgCtx; + MessageContext* msgCtx = &play->msgCtx; s32 pad[2]; switch (textId) { case 0x34AF: - Actor_ContinueText(globalCtx, &this->actor, 0x34B0); + Actor_ContinueText(play, &this->actor, 0x34B0); ret = false; break; case 0x34A9: - func_808F4108(this, globalCtx, 0x34AA); + func_808F4108(this, play, 0x34AA); gSaveContext.save.weekEventReg[63] |= 0x40; ret = false; break; case 0x34AA: - func_808F4108(this, globalCtx, 0x34AB); + func_808F4108(this, play, 0x34AB); ret = false; break; case 0x34AB: - func_808F4108(this, globalCtx, 0x34AC); + func_808F4108(this, play, 0x34AC); ret = false; break; case 0x34AC: - func_808F4108(this, globalCtx, 0x34AD); + func_808F4108(this, play, 0x34AD); ret = false; break; case 0x34AD: - Actor_ContinueText(globalCtx, &this->actor, 0x34AE); + Actor_ContinueText(play, &this->actor, 0x34AE); ret = false; break; case 0x34B1: - Actor_ContinueText(globalCtx, &this->actor, 0x34B2); + Actor_ContinueText(play, &this->actor, 0x34B2); ret = false; break; default: @@ -686,47 +686,47 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { switch (textId) { case 0x3458: gSaveContext.save.weekEventReg[15] |= 8; - Actor_ContinueText(globalCtx, &this->actor, 0x3459); + Actor_ContinueText(play, &this->actor, 0x3459); ret = false; break; case 0x3459: - Actor_ContinueText(globalCtx, &this->actor, 0x345A); + Actor_ContinueText(play, &this->actor, 0x345A); ret = false; break; case 0x345A: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x345B: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x345C: - Actor_ContinueText(globalCtx, &this->actor, 0x345D); + Actor_ContinueText(play, &this->actor, 0x345D); ret = false; break; case 0x345D: - Actor_ContinueText(globalCtx, &this->actor, 0x345E); + Actor_ContinueText(play, &this->actor, 0x345E); ret = false; break; case 0x345E: - Actor_ContinueText(globalCtx, &this->actor, 0x345F); + Actor_ContinueText(play, &this->actor, 0x345F); ret = false; break; case 0x345F: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x3460: - Actor_ContinueText(globalCtx, &this->actor, 0x3461); + Actor_ContinueText(play, &this->actor, 0x3461); ret = false; break; case 0x3461: - Actor_ContinueText(globalCtx, &this->actor, 0x3462); + Actor_ContinueText(play, &this->actor, 0x3462); ret = false; break; case 0x3462: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; } @@ -735,110 +735,110 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { switch (textId) { case 0x3463: gSaveContext.save.weekEventReg[15] |= 0x10; - Actor_ContinueText(globalCtx, &this->actor, 0x3464); + Actor_ContinueText(play, &this->actor, 0x3464); ret = false; break; case 0x3464: - Actor_ContinueText(globalCtx, &this->actor, 0x3465); + Actor_ContinueText(play, &this->actor, 0x3465); ret = false; break; case 0x3465: - Actor_ContinueText(globalCtx, &this->actor, 0x3466); + Actor_ContinueText(play, &this->actor, 0x3466); ret = false; break; case 0x3466: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3C40; - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); - func_801159EC(-globalCtx->msgCtx.unk1206C); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + func_801159EC(-play->msgCtx.unk1206C); ret = true; } else { - Actor_ContinueText(globalCtx, &this->actor, 0x3469); + Actor_ContinueText(play, &this->actor, 0x3469); ret = false; } } else { play_sound(NA_SE_SY_ERROR); - Actor_ContinueText(globalCtx, &this->actor, 0x3468); + Actor_ContinueText(play, &this->actor, 0x3468); ret = false; } } else { func_8019F230(); - Actor_ContinueText(globalCtx, &this->actor, 0x3467); + Actor_ContinueText(play, &this->actor, 0x3467); ret = false; } break; case 0x3467: case 0x3468: case 0x3469: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x346B: - Actor_ContinueText(globalCtx, &this->actor, 0x346C); + Actor_ContinueText(play, &this->actor, 0x346C); ret = false; break; case 0x346C: - Actor_ContinueText(globalCtx, &this->actor, 0x3466); + Actor_ContinueText(play, &this->actor, 0x3466); ret = false; break; case 0x346A: this->actionFunc = func_808F5A94; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; } break; case 2: switch (textId) { case 0x346E: - func_808F4108(this, globalCtx, 0x346F); + func_808F4108(this, play, 0x346F); ret = false; break; case 0x3470: - Actor_ContinueText(globalCtx, &this->actor, 0x3471); + Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; case 0x3483: - Actor_ContinueText(globalCtx, &this->actor, 0x3471); + Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; case 0x3471: - func_808F4150(globalCtx, this, arg2, msgCtx); + func_808F4150(play, this, arg2, msgCtx); ret = false; break; case 0x3472: func_808F43E0(this); gSaveContext.save.weekEventReg[56] &= (u8)~8; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x3473: gSaveContext.save.weekEventReg[56] &= (u8)~8; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x3475: SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); - globalCtx->nextEntranceIndex = 0xCE50; - globalCtx->unk_1887F = 5; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0xCE50; + play->unk_1887F = 5; + play->sceneLoadFlag = 0x14; gSaveContext.save.weekEventReg[57] |= 1; break; case 0x3478: if (msgCtx->choiceIndex == 0) { - func_808F4150(globalCtx, this, arg2, msgCtx); + func_808F4150(play, this, arg2, msgCtx); ret = false; } else { func_8019F230(); gSaveContext.save.weekEventReg[56] &= (u8)~8; - func_808F4108(this, globalCtx, 0x3479); + func_808F4108(this, play, 0x3479); ret = false; } break; case 0x347B: - func_808F4108(this, globalCtx, 0x347C); + func_808F4108(this, play, 0x347C); gSaveContext.save.weekEventReg[56] &= (u8)~8; ret = false; break; @@ -847,96 +847,96 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 3: switch (textId) { case 0x346D: - func_808F4108(this, globalCtx, 0x346E); + func_808F4108(this, play, 0x346E); gSaveContext.save.weekEventReg[56] |= 4; gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x346F: - func_808F4108(this, globalCtx, 0x3470); + func_808F4108(this, play, 0x3470); ret = false; break; case 0x3482: - func_808F4108(this, globalCtx, 0x3483); + func_808F4108(this, play, 0x3483); gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3484: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x3485: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x3474: - func_808F4108(this, globalCtx, 0x3475); + func_808F4108(this, play, 0x3475); ret = false; break; case 0x3476: - Actor_ContinueText(globalCtx, &this->actor, 0x3477); + Actor_ContinueText(play, &this->actor, 0x3477); func_808F30B0(&this->skelAnime, 1); func_808F30B0(&this->unk4A4->skelAnime, 7); ret = false; break; case 0x3477: gSaveContext.save.weekEventReg[56] |= 8; - func_808F4108(this, globalCtx, 0x3478); + func_808F4108(this, play, 0x3478); ret = false; break; case 0x347A: func_808F30B0(&this->skelAnime, 1); func_808F30B0(&this->unk4A4->skelAnime, 7); if (INV_CONTENT(ITEM_MASK_GARO) == ITEM_MASK_GARO) { - Actor_ContinueText(globalCtx, &this->actor, 0x347E); + Actor_ContinueText(play, &this->actor, 0x347E); ret = false; } else { gSaveContext.save.weekEventReg[56] |= 8; - func_808F4108(this, globalCtx, 0x347B); + func_808F4108(this, play, 0x347B); ret = false; } break; case 0x347E: - func_808F35D8(this, globalCtx); + func_808F35D8(this, play); if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3B40; - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; } else { - Actor_ContinueText(globalCtx, &this->actor, 0x347F); + Actor_ContinueText(play, &this->actor, 0x347F); ret = false; } break; case 0x347F: - Actor_ContinueText(globalCtx, &this->actor, 0x3480); + Actor_ContinueText(play, &this->actor, 0x3480); ret = false; break; case 0x3480: func_808F43E0(this); - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x3479: func_808F43E0(this); - func_808F35D8(this, globalCtx); - func_80151BB4(globalCtx, 0x11); + func_808F35D8(this, play); + func_80151BB4(play, 0x11); ret = true; break; case 0x347C: this->actionFunc = func_808F3D40; - Actor_PickUp(&this->actor, globalCtx, GI_MASK_GARO, 500.0f, 100.0f); - func_808F35D8(this, globalCtx); + Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); + func_808F35D8(this, play); ret = true; break; case 0x3481: this->actionFunc = func_808F5A34; func_808F43E0(this); - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x347D: this->actionFunc = func_808F5A34; func_808F43E0(this); - func_80151BB4(globalCtx, 0x11); - func_80151BB4(globalCtx, 0x2F); + func_80151BB4(play, 0x11); + func_80151BB4(play, 0x2F); ret = true; break; } @@ -944,34 +944,34 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 4: switch (textId) { case 0x3486: - Actor_ContinueText(globalCtx, &this->actor, 0x3487); + Actor_ContinueText(play, &this->actor, 0x3487); gSaveContext.save.weekEventReg[16] |= 1; ret = false; break; case 0x3487: - Actor_ContinueText(globalCtx, &this->actor, 0x3488); + Actor_ContinueText(play, &this->actor, 0x3488); ret = false; break; case 0x3488: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x3489: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x348A: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x348B: - Actor_ContinueText(globalCtx, &this->actor, 0x348C); + Actor_ContinueText(play, &this->actor, 0x348C); ret = false; break; case 0x348C: - Actor_ContinueText(globalCtx, &this->actor, 0x348D); + Actor_ContinueText(play, &this->actor, 0x348D); ret = false; break; case 0x348D: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; } @@ -981,167 +981,167 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 0x3468: case 0x3469: case 0x3491: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x348E: case 0x34B3: - Actor_ContinueText(globalCtx, &this->actor, 0x348F); + Actor_ContinueText(play, &this->actor, 0x348F); gSaveContext.save.weekEventReg[16] |= 2; ret = false; break; case 0x3493: - Actor_ContinueText(globalCtx, &this->actor, 0x3494); + Actor_ContinueText(play, &this->actor, 0x3494); ret = false; break; case 0x348F: case 0x3494: - Actor_ContinueText(globalCtx, &this->actor, 0x3490); + Actor_ContinueText(play, &this->actor, 0x3490); ret = false; break; case 0x3490: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3C40; - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); - func_801159EC(-globalCtx->msgCtx.unk1206C); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + func_801159EC(-play->msgCtx.unk1206C); ret = true; } else { - Actor_ContinueText(globalCtx, &this->actor, 0x3469); + Actor_ContinueText(play, &this->actor, 0x3469); ret = false; } } else { play_sound(NA_SE_SY_ERROR); - Actor_ContinueText(globalCtx, &this->actor, 0x3468); + Actor_ContinueText(play, &this->actor, 0x3468); ret = false; } } else { func_8019F230(); - Actor_ContinueText(globalCtx, &this->actor, 0x3491); + Actor_ContinueText(play, &this->actor, 0x3491); ret = false; } break; case 0x3492: this->actionFunc = func_808F5A94; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; } break; case 7: switch (textId) { case 0x34A8: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x34A7: - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x3495: - func_808F4108(this, globalCtx, 0x3496); + func_808F4108(this, play, 0x3496); gSaveContext.save.weekEventReg[16] |= 4; gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3497: - func_808F4108(this, globalCtx, 0x3498); + func_808F4108(this, play, 0x3498); ret = false; break; case 0x34A4: this->actionFunc = func_808F5A34; func_808F43E0(this); - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x34A5: - func_808F4108(this, globalCtx, 0x34A6); + func_808F4108(this, play, 0x34A6); gSaveContext.save.weekEventReg[56] |= 8; ret = false; break; case 0x3473: gSaveContext.save.weekEventReg[56] &= (u8)~8; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); break; case 0x3474: - Actor_ContinueText(globalCtx, &this->actor, 0x3475); + Actor_ContinueText(play, &this->actor, 0x3475); ret = false; break; case 0x3475: SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); - globalCtx->nextEntranceIndex = 0xCE50; - globalCtx->unk_1887F = 5; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = 0xCE50; + play->unk_1887F = 5; + play->sceneLoadFlag = 0x14; gSaveContext.save.weekEventReg[57] |= 1; break; case 0x349D: func_808F30B0(&this->skelAnime, 1); func_808F30B0(&this->unk4A4->skelAnime, 7); if (INV_CONTENT(ITEM_MASK_GARO) == ITEM_MASK_GARO) { - Actor_ContinueText(globalCtx, &this->actor, 0x34A1); + Actor_ContinueText(play, &this->actor, 0x34A1); ret = false; } else { gSaveContext.save.weekEventReg[56] |= 8; - func_808F4108(this, globalCtx, 0x349E); + func_808F4108(this, play, 0x349E); ret = false; } break; case 0x349F: this->actionFunc = func_808F3D40; - Actor_PickUp(&this->actor, globalCtx, GI_MASK_GARO, 500.0f, 100.0f); - func_808F35D8(this, globalCtx); + Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); + func_808F35D8(this, play); ret = true; break; case 0x34A0: this->actionFunc = func_808F5A34; - func_80151BB4(globalCtx, 0x11); - func_80151BB4(globalCtx, 0x2F); + func_80151BB4(play, 0x11); + func_80151BB4(play, 0x2F); func_808F43E0(this); ret = true; break; case 0x34A1: - func_808F35D8(this, globalCtx); + func_808F35D8(this, play); if (Interface_HasEmptyBottle()) { this->actionFunc = func_808F3B40; - Actor_PickUp(&this->actor, globalCtx, GI_MILK, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; } else { - Actor_ContinueText(globalCtx, &this->actor, 0x34A2); + Actor_ContinueText(play, &this->actor, 0x34A2); ret = false; } break; case 0x34A2: - Actor_ContinueText(globalCtx, &this->actor, 0x34A3); + Actor_ContinueText(play, &this->actor, 0x34A3); ret = false; break; case 0x34A3: func_808F43E0(this); - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x3499: - Actor_ContinueText(globalCtx, &this->actor, 0x349A); + Actor_ContinueText(play, &this->actor, 0x349A); func_808F30B0(&this->skelAnime, 1); func_808F30B0(&this->unk4A4->skelAnime, 7); ret = false; break; case 0x349A: - Actor_ContinueText(globalCtx, &this->actor, 0x349B); + Actor_ContinueText(play, &this->actor, 0x349B); ret = false; break; case 0x349B: if (msgCtx->choiceIndex == 0) { - func_808F4270(globalCtx, this, arg2, msgCtx, 1); + func_808F4270(play, this, arg2, msgCtx, 1); ret = false; } else { func_8019F230(); - Actor_ContinueText(globalCtx, &this->actor, 0x349C); + Actor_ContinueText(play, &this->actor, 0x349C); ret = false; } break; case 0x349C: func_808F43E0(this); - func_808F35D8(this, globalCtx); - func_80151BB4(globalCtx, 0x11); + func_808F35D8(this, play); + func_80151BB4(play, 0x11); ret = true; break; } @@ -1149,26 +1149,26 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { case 6: switch (textId) { case 0x3496: - func_808F4108(this, globalCtx, 0x3497); + func_808F4108(this, play, 0x3497); ret = false; break; case 0x3498: case 0x34A6: - Actor_ContinueText(globalCtx, &this->actor, 0x3471); + Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; case 0x3471: - func_808F4270(globalCtx, this, arg2, msgCtx, 0); + func_808F4270(play, this, arg2, msgCtx, 0); ret = false; break; case 0x3472: func_808F43E0(this); gSaveContext.save.weekEventReg[56] &= (u8)~8; - func_80151BB4(globalCtx, 0x11); + func_80151BB4(play, 0x11); ret = true; break; case 0x349E: - func_808F4108(this, globalCtx, 0x349F); + func_808F4108(this, play, 0x349F); gSaveContext.save.weekEventReg[56] &= (u8)~8; ret = false; break; @@ -1178,19 +1178,19 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { return ret; } -s32 func_808F5674(GlobalContext* globalCtx, EnIn* this, s32 arg2) { +s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { s32 pad; s32 ret = false; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 2: - func_808F4054(globalCtx, this, arg2, this->actor.textId); + func_808F4054(play, this, arg2, this->actor.textId); ret = true; break; case 4: case 5: - if (Message_ShouldAdvance(globalCtx) && func_808F4414(globalCtx, this, arg2)) { - func_801477B4(globalCtx); + if (Message_ShouldAdvance(play) && func_808F4414(play, this, arg2)) { + func_801477B4(play); ret = true; } break; @@ -1198,7 +1198,7 @@ s32 func_808F5674(GlobalContext* globalCtx, EnIn* this, s32 arg2) { return ret; } -s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { +s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { s16 rotDiff; s16 yawDiff; Player* player; @@ -1207,24 +1207,24 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { return 0; } if (*arg3 == 2) { - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); *arg3 = 1; return 0; } if (*arg3 == 3) { - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); *arg3 = 1; return 0; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { *arg3 = 1; return 1; } if (*arg3 == 1) { s32 requiredScopeTemp; - player = GET_PLAYER(globalCtx); - func_808F5994(this, globalCtx, &player->actor.world.pos, 0xC80); + player = GET_PLAYER(play); + func_808F5994(this, play, &player->actor.world.pos, 0xC80); } else { rotDiff = this->actor.home.rot.y - this->actor.world.rot.y; if (rotDiff > 0x320) { @@ -1237,12 +1237,12 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { this->actor.shape.rot.y = this->actor.world.rot.y; } if (*arg3 == 1) { - if (func_808F5674(globalCtx, this, arg2)) { + if (func_808F5674(play, this, arg2)) { *arg3 = 0; } return 0; } - if (!func_800B8934(globalCtx, &this->actor)) { + if (!func_800B8934(play, &this->actor)) { return 0; } yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); @@ -1253,16 +1253,16 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { return 0; } if (this->actor.xyzDistToPlayerSq <= SQ(80.0f)) { - if (func_800B8614(&this->actor, globalCtx, 80.0f)) { - this->actor.textId = func_808F3DD4(globalCtx, this, arg2); + if (func_800B8614(&this->actor, play, 80.0f)) { + this->actor.textId = func_808F3DD4(play, this, arg2); } - } else if (func_800B863C(&this->actor, globalCtx)) { - this->actor.textId = func_808F3DD4(globalCtx, this, arg2); + } else if (func_800B863C(&this->actor, play)) { + this->actor.textId = func_808F3DD4(play, this, arg2); } return 0; } -s32 func_808F5994(EnIn* this, GlobalContext* globalCtx, Vec3f* arg2, s16 arg3) { +s32 func_808F5994(EnIn* this, PlayState* play, Vec3f* arg2, s16 arg3) { s32 ret = 0; s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, arg2) - this->actor.world.rot.y; @@ -1279,60 +1279,60 @@ s32 func_808F5994(EnIn* this, GlobalContext* globalCtx, Vec3f* arg2, s16 arg3) { return ret; } -void func_808F5A34(EnIn* this, GlobalContext* globalCtx) { +void func_808F5A34(EnIn* this, PlayState* play) { if (gSaveContext.save.day != 3) { - func_808F5728(globalCtx, this, 3, &this->unk48C); + func_808F5728(play, this, 3, &this->unk48C); } else { - func_808F5728(globalCtx, this, 7, &this->unk48C); + func_808F5728(play, this, 7, &this->unk48C); } } -void func_808F5A94(EnIn* this, GlobalContext* globalCtx) { - if (func_800F41E4(globalCtx, &globalCtx->actorCtx)) { +void func_808F5A94(EnIn* this, PlayState* play) { + if (func_800F41E4(play, &play->actorCtx)) { if (gSaveContext.save.day == 3) { - func_808F5728(globalCtx, this, 7, &this->unk48C); + func_808F5728(play, this, 7, &this->unk48C); } else { - func_808F5728(globalCtx, this, 3, &this->unk48C); + func_808F5728(play, this, 3, &this->unk48C); } } else { if (gSaveContext.save.day == 3) { - func_808F5728(globalCtx, this, 5, &this->unk48C); + func_808F5728(play, this, 5, &this->unk48C); } else { - func_808F5728(globalCtx, this, 1, &this->unk48C); + func_808F5728(play, this, 1, &this->unk48C); } } } -void func_808F5B58(EnIn* this, GlobalContext* globalCtx) { - if (func_800F41E4(globalCtx, &globalCtx->actorCtx)) { - if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || +void func_808F5B58(EnIn* this, PlayState* play) { + if (func_800F41E4(play, &play->actorCtx)) { + if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || gSaveContext.save.weekEventReg[56] & 8) { if (gSaveContext.save.day == 3) { - func_808F5728(globalCtx, this, 6, &this->unk48C); + func_808F5728(play, this, 6, &this->unk48C); } else { - func_808F5728(globalCtx, this, 2, &this->unk48C); + func_808F5728(play, this, 2, &this->unk48C); } } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CIRCUS_LEADER || - (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40)) { + } else if (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER || + (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40)) { if (gSaveContext.save.day == 3) { - func_808F5728(globalCtx, this, 4, &this->unk48C); + func_808F5728(play, this, 4, &this->unk48C); } else { - func_808F5728(globalCtx, this, 0, &this->unk48C); + func_808F5728(play, this, 0, &this->unk48C); } } } -void func_808F5C98(EnIn* this, GlobalContext* globalCtx) { +void func_808F5C98(EnIn* this, PlayState* play) { if (this->unk4B0 == RACE_FLAG_END) { this->actionFunc = func_808F5B58; } - if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || + if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.save.weekEventReg[63] & 0x40) || gSaveContext.save.weekEventReg[56] & 8) { if (gSaveContext.save.day != 3) { - func_808F5728(globalCtx, this, 2, &this->unk48C); + func_808F5728(play, this, 2, &this->unk48C); } else { - func_808F5728(globalCtx, this, 6, &this->unk48C); + func_808F5728(play, this, 6, &this->unk48C); } } if (this->unk4A8 == 2) { @@ -1352,18 +1352,17 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; -void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Init(Actor* thisx, PlayState* play) { EnIn* this = THIS; s32 pad[2]; s16 type; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, - 20); + SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, 20); func_808F30B0(&this->skelAnime, 0); - 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); this->unk48A = 0; this->unk48C = 0; @@ -1383,18 +1382,18 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk23D = 1; this->actionFunc = func_808F374C; } else { - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, &this->colliderJntSphElement); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, &this->colliderJntSphElement); Actor_SetScale(&this->actor, 0.01f); this->actor.gravity = -4.0f; - this->path = SubS_GetPathByIndex(globalCtx, ENIN_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH(&this->actor), 0x3F); this->unk23D = 0; if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) { if (GET_RACE_FLAGS == RACE_FLAG_2 || GET_RACE_FLAGS == RACE_FLAG_3) { gSaveContext.save.weekEventReg[56] &= (u8)~8; this->unk4A8 = 0; this->unk4AC |= 2; - func_808F35AC(this, globalCtx); + func_808F35AC(this, play); this->unk23C = 0; D_801BDAA0 = 0; if (GET_RACE_FLAGS == RACE_FLAG_2) { @@ -1421,7 +1420,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_808F5A94; } else { if (gSaveContext.save.weekEventReg[52] & 1) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_KANBAN, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, 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, 0xF); Actor_MarkForDeath(&this->actor); @@ -1448,45 +1447,45 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Destroy(Actor* thisx, PlayState* play) { EnIn* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } -void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Update(Actor* thisx, PlayState* play) { EnIn* this = THIS; - func_808F3310(this, globalCtx); - func_808F3334(this, globalCtx); + func_808F3310(this, play); + func_808F3334(this, play); if (this->unk4AC & 2) { this->unk4AC &= ~2; - func_808F38F8(this, globalCtx); + func_808F38F8(this, play); } - if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER) { + if (Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) { this->unk4AC |= 0x40; } else { this->unk4AC &= ~0x40; } - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); - func_808F3414(this, globalCtx); - func_808F32A0(this, globalCtx); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + func_808F3414(this, play); + func_808F32A0(this, play); } -void func_808F6334(EnIn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808F6334(EnIn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 newUnk4C8; - newUnk4C8 = Message_GetState(&globalCtx->msgCtx); + newUnk4C8 = Message_GetState(&play->msgCtx); this->unk4C4 += this->unk4C0 != 0.0f ? 40.0f : -40.0f; this->unk4C4 = CLAMP(this->unk4C4, 0.0f, 80.0f); Matrix_Translate(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY); if (&this->actor == player->targetActor && - !(globalCtx->msgCtx.currentTextId >= 0xFF && globalCtx->msgCtx.currentTextId <= 0x200) && newUnk4C8 == 3 && + !(play->msgCtx.currentTextId >= 0xFF && play->msgCtx.currentTextId <= 0x200) && newUnk4C8 == 3 && this->unk4C8 == 3) { - if (!(globalCtx->state.frames & 1)) { + if (!(play->state.frames & 1)) { this->unk4C0 = this->unk4C0 != 0.0f ? 0.0f : 1.0f; } } else { @@ -1495,7 +1494,7 @@ void func_808F6334(EnIn* this, GlobalContext* globalCtx) { this->unk4C8 = newUnk4C8; } -s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnIn* this = THIS; s32 pad; Gfx* sp50[] = { @@ -1530,24 +1529,23 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, *dList = object_in_DL_01C528; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 16) { TexturePtr sp38[] = { object_in_Tex_0035E0, object_in_Tex_004820, object_in_Tex_004C20, object_in_Tex_0043E0 }; gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp38[this->unk482])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(object_in_Tex_003520)); } else { - AnimatedMat_DrawStep(globalCtx, Lib_SegmentedToVirtual(object_in_Matanimheader_001C30), - this->unk4AC & 8 ? 1 : 0); + AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(object_in_Matanimheader_001C30), this->unk4AC & 8 ? 1 : 0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (limbIndex == 16) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); - func_808F6334(this, globalCtx); + func_808F6334(this, play); } if (limbIndex == 9) { Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY); @@ -1575,7 +1573,7 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnIn* this = THIS; Vec3f sp50 = { 1600.0f, 0.0f, 0.0f }; Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; @@ -1594,33 +1592,33 @@ void EnIn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } if (this->unk23C == 0) { if (!(this->unk4AC & 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 12) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007A70); } if (limbIndex == 15) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } if (this->unk4AC & 0x20) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == 12) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnIn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnIn_Draw(Actor* thisx, PlayState* play) { EnIn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnIn_OverrideLimbDraw, EnIn_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 e0667e0c23..6ffbfdf8d7 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -5,7 +5,7 @@ struct EnIn; -typedef void (*EnInActionFunc)(struct EnIn*, GlobalContext*); +typedef void (*EnInActionFunc)(struct EnIn*, PlayState*); typedef enum { /* 0 */ ENIN_UNK_TYPE, 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 75c70113e8..e3a6439824 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -11,24 +11,24 @@ #define THIS ((EnInsect*)thisx) -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 func_8091AC78(EnInsect* this); -void func_8091ACC4(EnInsect* this, GlobalContext* globalCtx); +void func_8091ACC4(EnInsect* this, PlayState* play); void func_8091AE10(EnInsect* this); -void func_8091AE5C(EnInsect* this, GlobalContext* globalCtx); +void func_8091AE5C(EnInsect* this, PlayState* play); void func_8091B030(EnInsect* this); -void func_8091B07C(EnInsect* this, GlobalContext* globalCtx); -void func_8091B2D8(EnInsect* this, GlobalContext* globalCtx); +void func_8091B07C(EnInsect* this, PlayState* play); +void func_8091B2D8(EnInsect* this, PlayState* play); void func_8091B3D0(EnInsect* this); -void func_8091B440(EnInsect* this, GlobalContext* globalCtx); +void func_8091B440(EnInsect* this, PlayState* play); void func_8091B618(EnInsect* this); -void func_8091B670(EnInsect* this, GlobalContext* globalCtx); +void func_8091B670(EnInsect* this, PlayState* play); void func_8091B928(EnInsect* this); -void func_8091B984(EnInsect* this, GlobalContext* globalCtx); +void func_8091B984(EnInsect* this, PlayState* play); s16 D_8091BD60 = 0; @@ -90,9 +90,9 @@ f32 EnInsect_XZDistanceSquared(Vec3f* arg0, Vec3f* arg1) { return SQ(arg0->x - arg1->x) + SQ(arg0->z - arg1->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 sp1C; if (this->actor.xzDistToPlayer < 32.0f) { @@ -120,7 +120,7 @@ void func_8091A9E4(EnInsect* this) { } } -void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Init(Actor* thisx, PlayState* play) { EnInsect* this = THIS; f32 rand; @@ -131,11 +131,11 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); func_8091A8A0(this); - SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, - this->jointTable, this->morphTable, 24); + SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable, + this->morphTable, 24); Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, 1, 0.0f); - 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); { ColliderJntSphElement* colliderElement = &this->collider.elements[0]; @@ -165,8 +165,8 @@ void EnInsect_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnInsect_Destroy(Actor* thisx, GlobalContext* globalCtx) { - Collider_DestroyJntSph(globalCtx, &THIS->collider); +void EnInsect_Destroy(Actor* thisx, PlayState* play) { + Collider_DestroyJntSph(play, &THIS->collider); } void func_8091AC78(EnInsect* this) { @@ -175,7 +175,7 @@ void func_8091AC78(EnInsect* this) { this->unk_30C |= 0x100; } -void func_8091ACC4(EnInsect* this, GlobalContext* globalCtx) { +void func_8091ACC4(EnInsect* this, PlayState* play) { f32 temp_f2; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.5f, 0.0f); @@ -211,7 +211,7 @@ void func_8091AE10(EnInsect* this) { this->unk_30C |= 0x100; } -void func_8091AE5C(EnInsect* this, GlobalContext* globalCtx) { +void func_8091AE5C(EnInsect* this, PlayState* play) { s32 pad; f32 temp_f0; @@ -251,7 +251,7 @@ void func_8091B030(EnInsect* this) { this->unk_30C |= 0x100; } -void func_8091B07C(EnInsect* this, GlobalContext* globalCtx) { +void func_8091B07C(EnInsect* this, PlayState* play) { s32 pad; f32 speed; s16 frames; @@ -265,7 +265,7 @@ void func_8091B07C(EnInsect* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 0x7D0); } else if (sp38) { - frames = globalCtx->state.frames; + frames = play->state.frames; yaw = BINANG_ROT180(this->actor.yawTowardsPlayer); if ((frames & 0x10) != 0) { if ((frames & 0x20) != 0) { @@ -275,7 +275,7 @@ void func_8091B07C(EnInsect* this, GlobalContext* globalCtx) { yaw -= 0x2000; } - if (globalCtx) {} + if (play) {} Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 0x7D0); } @@ -302,7 +302,7 @@ void func_8091B274(EnInsect* this) { this->unk_30C &= ~0x100; } -void func_8091B2D8(EnInsect* this, GlobalContext* globalCtx) { +void func_8091B2D8(EnInsect* this, PlayState* play) { if ((this->unk_312 == 20) && !(this->unk_30C & 4)) { this->actor.draw = EnInsect_Draw; } else if (this->unk_312 == 0) { @@ -329,7 +329,7 @@ void func_8091B3D0(EnInsect* this) { this->unk_30C |= 8; } -void func_8091B440(EnInsect* this, GlobalContext* globalCtx) { +void func_8091B440(EnInsect* this, PlayState* play) { s32 pad[2]; Vec3f sp34; @@ -347,7 +347,7 @@ void func_8091B440(EnInsect* this, GlobalContext* globalCtx) { sp34.x = Math_SinS(this->actor.shape.rot.y) * -0.6f; sp34.y = Math_SinS(this->actor.shape.rot.x) * 0.6f; sp34.z = Math_CosS(this->actor.shape.rot.y) * -0.6f; - func_800B1210(globalCtx, &this->actor.world.pos, &sp34, &D_8091BDCC, (Rand_ZeroOne() * 5.0f) + 8.0f, + func_800B1210(play, &this->actor.world.pos, &sp34, &D_8091BDCC, (Rand_ZeroOne() * 5.0f) + 8.0f, (Rand_ZeroOne() * 5.0f) + 8.0f); } @@ -364,7 +364,7 @@ void func_8091B618(EnInsect* this) { this->unk_30C &= ~0x100; } -void func_8091B670(EnInsect* this, GlobalContext* globalCtx) { +void func_8091B670(EnInsect* this, PlayState* play) { s32 pad[2]; s16 temp; Vec3f sp40; @@ -401,7 +401,7 @@ void func_8091B670(EnInsect* this, GlobalContext* globalCtx) { sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y + this->actor.depthInWater; sp40.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp40, 40, 200, 4); + EffectSsGRipple_Spawn(play, &sp40, 40, 200, 4); } if ((this->unk_312 <= 0) || ((this->unk_30C & 4) && (this->unk_314 <= 0))) { @@ -423,13 +423,13 @@ void func_8091B928(EnInsect* this) { this->unk_30C |= 8; } -void func_8091B984(EnInsect* this, GlobalContext* globalCtx) { +void func_8091B984(EnInsect* this, PlayState* play) { this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.y += 0xC8; Actor_SetScale(&this->actor, CLAMP_MIN(this->actor.scale.x - 0.00005f, 0.001f)); if ((this->actor.depthInWater > 5.0f) && (this->actor.depthInWater < 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->unk_312 <= 0) { @@ -437,7 +437,7 @@ void func_8091B984(EnInsect* this, GlobalContext* globalCtx) { } } -void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Update(Actor* thisx, PlayState* play) { EnInsect* this = THIS; s32 phi_v0; @@ -453,7 +453,7 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_314--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { Actor_MoveWithGravity(&this->actor); @@ -474,10 +474,10 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { if (phi_v0 != 0) { phi_v0 |= 0x40; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 8.0f, 5.0f, 0.0f, phi_v0); + Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 5.0f, 0.0f, phi_v0); } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_8091B274(this); } else if ((this->actor.xzDistToPlayer < 50.0f) && (this->actionFunc != func_8091B2D8)) { @@ -487,11 +487,11 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { colliderElement->dim.worldSphere.center.x = this->actor.world.pos.x; colliderElement->dim.worldSphere.center.y = this->actor.world.pos.y; colliderElement->dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (!(this->unk_30C & 8) && (D_8091BD60 < 4) && EnInsect_InBottleRange(this, globalCtx) && - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 60.0f, 30.0f)) { + if (!(this->unk_30C & 8) && (D_8091BD60 < 4) && EnInsect_InBottleRange(this, play) && + Actor_PickUp(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { D_8091BD60++; } } @@ -500,10 +500,10 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnInsect_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnInsect_Draw(Actor* thisx, PlayState* play) { EnInsect* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); D_8091BD60 = 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 612c6ab205..6e30eca32f 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -5,7 +5,7 @@ struct EnInsect; -typedef void (*EnInsectActionFunc)(struct EnInsect*, GlobalContext*); +typedef void (*EnInsectActionFunc)(struct EnInsect*, PlayState*); #define ENINSECT_GET_1(thisx) ((thisx)->params & 1) diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 4c9dcc0e8e..821b02e5f1 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -18,158 +18,158 @@ #define THIS ((EnInvadepoh*)thisx) -void EnInvadepoh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnInvadepoh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnInvadepoh_Update(Actor* thisx, GlobalContext* globalCtx); +void EnInvadepoh_Init(Actor* thisx, PlayState* play); +void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); +void EnInvadepoh_Update(Actor* thisx, PlayState* play); void func_80B46DA8(EnInvadepoh* this); -void func_80B46DC8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46DC8(EnInvadepoh* this, PlayState* play); void func_80B46E20(EnInvadepoh* this); -void func_80B46E44(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46E44(EnInvadepoh* this, PlayState* play); void func_80B46EC0(EnInvadepoh* this); -void func_80B46EE8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46EE8(EnInvadepoh* this, PlayState* play); void func_80B46F88(EnInvadepoh* this); -void func_80B46FA8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B46FA8(EnInvadepoh* this, PlayState* play); void func_80B47064(EnInvadepoh* this); -void func_80B47084(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47084(EnInvadepoh* this, PlayState* play); void func_80B470E0(EnInvadepoh* this); -void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47108(EnInvadepoh* this, PlayState* play); void func_80B471C0(EnInvadepoh* this); -void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B471E0(EnInvadepoh* this, PlayState* play); void func_80B47248(EnInvadepoh* this); -void func_80B47268(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47268(EnInvadepoh* this, PlayState* play); +void func_80B47298(EnInvadepoh* this, PlayState* play); void func_80B47304(EnInvadepoh* this); -void func_80B47324(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B473E4(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B474DC(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B47600(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B477B4(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B48324(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4ACF0(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B47324(EnInvadepoh* this, PlayState* play); +void func_80B473E4(EnInvadepoh* this, PlayState* play); +void func_80B474DC(EnInvadepoh* this, PlayState* play); +void func_80B47600(EnInvadepoh* this, PlayState* play); +void func_80B477B4(EnInvadepoh* this, PlayState* play); +void func_80B48324(EnInvadepoh* this, PlayState* play); +void func_80B4ACF0(EnInvadepoh* this, PlayState* play); void func_80B4AD3C(EnInvadepoh* this); -void func_80B4AD60(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AD60(EnInvadepoh* this, PlayState* play); void func_80B4ADB8(EnInvadepoh* this); -void func_80B4ADCC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4ADCC(EnInvadepoh* this, PlayState* play); void func_80B4AEC0(EnInvadepoh* this); -void func_80B4AEDC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AEDC(EnInvadepoh* this, PlayState* play); void func_80B4AF80(EnInvadepoh* this); -void func_80B4AF94(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4AF94(EnInvadepoh* this, PlayState* play); void func_80B4B024(EnInvadepoh* this); -void func_80B4B048(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4B484(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B048(EnInvadepoh* this, PlayState* play); +void func_80B4B484(EnInvadepoh* this, PlayState* play); void func_80B4B510(EnInvadepoh* this); -void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B564(EnInvadepoh* this, PlayState* play); void func_80B4B724(EnInvadepoh* this); -void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B768(EnInvadepoh* this, PlayState* play); void func_80B4B820(EnInvadepoh* this); -void func_80B4B864(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4B864(EnInvadepoh* this, PlayState* play); void func_80B48374(EnInvadepoh* this); -void func_80B483CC(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4994C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B497EC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B483CC(EnInvadepoh* this, PlayState* play); +void func_80B49A00(EnInvadepoh* this, PlayState* play); +void func_80B4994C(EnInvadepoh* this, PlayState* play); +void func_80B497EC(EnInvadepoh* this, PlayState* play); void func_80B49628(EnInvadepoh* this); -void func_80B49670(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B49454(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4934C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49670(EnInvadepoh* this, PlayState* play); +void func_80B49454(EnInvadepoh* this, PlayState* play); +void func_80B4934C(EnInvadepoh* this, PlayState* play); void func_80B491EC(EnInvadepoh* this); -void func_80B49228(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B49C38(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4A5E4(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4D480(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B49228(EnInvadepoh* this, PlayState* play); +void func_80B49C38(EnInvadepoh* this, PlayState* play); +void func_80B49DFC(EnInvadepoh* this, PlayState* play); +void func_80B4A350(EnInvadepoh* this, PlayState* play); +void func_80B4A5E4(EnInvadepoh* this, PlayState* play); +void func_80B4A67C(EnInvadepoh* this, PlayState* play); +void func_80B4A81C(EnInvadepoh* this, PlayState* play); +void func_80B4BC4C(EnInvadepoh* this, PlayState* play); +void func_80B4C058(EnInvadepoh* this, PlayState* play); +void func_80B4C218(EnInvadepoh* this, PlayState* play); +void func_80B4C730(EnInvadepoh* this, PlayState* play); +void func_80B4CB0C(EnInvadepoh* this, PlayState* play); +void func_80B4CCCC(EnInvadepoh* this, PlayState* play); +void func_80B4D480(EnInvadepoh* this, PlayState* play); void func_80B47568(EnInvadepoh* this); -void func_80B478F4(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B478F4(EnInvadepoh* this, PlayState* play); void func_80B47938(EnInvadepoh* this); -void func_80B479E8(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B479E8(EnInvadepoh* this, PlayState* play); void func_80B4843C(EnInvadepoh* this); -void func_80B484EC(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B484EC(EnInvadepoh* this, PlayState* play); void func_80B48588(EnInvadepoh* this); -void func_80B48610(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B48848(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48610(EnInvadepoh* this, PlayState* play); +void func_80B48848(EnInvadepoh* this, PlayState* play); void func_80B47278(EnInvadepoh* this); -void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B48AD4(EnInvadepoh* this, PlayState* play); +void func_80B48E4C(EnInvadepoh* this, PlayState* play); void func_80B49404(EnInvadepoh* this); void func_80B4A570(EnInvadepoh* this); void func_80B4C1BC(EnInvadepoh* this); -void func_80B4D290(EnInvadepoh* this, GlobalContext* globalCtx); +void func_80B4D290(EnInvadepoh* this, PlayState* play); void func_80B4CC70(EnInvadepoh* this); void func_80B4770C(EnInvadepoh* this); void func_80B48948(EnInvadepoh* this); void func_80B49904(EnInvadepoh* this); void func_80B499BC(EnInvadepoh* this); void func_80B492FC(EnInvadepoh* this); -void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitAlien(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitParentCow(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitChildCow(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitDog(EnInvadepoh* this, GlobalContext* globalCtx); -void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46BB0(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46BC0(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C08(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C34(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C7C(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46C94(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46CC0(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46CF4(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B46D28(EnInvadepoh* this, GlobalContext* globalCtx); -void func_80B4D670(Actor* thisx, GlobalContext* globalCtx); -void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx); -void func_80B47D30(Actor* thisx, GlobalContext* globalCtx); -void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx); -void func_80B48060(Actor* thisx, GlobalContext* globalCtx); -void func_80B481C4(Actor* thisx, GlobalContext* globalCtx); -void func_80B4827C(Actor* thisx, GlobalContext* globalCtx); -void func_80B48620(Actor* thisx, GlobalContext* globalCtx); -void func_80B48FB0(Actor* thisx, GlobalContext* globalCtx); -void func_80B49F88(Actor* thisx, GlobalContext* globalCtx); -void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx); -void func_80B4B0C4(Actor* thisx, GlobalContext* globalCtx); -void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx); -void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx); -void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx); -void func_80B49B1C(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E158(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx); -void func_80B4D9B4(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E1B0(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E324(Actor* thisx, GlobalContext* globalCtx); -void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E660(Actor* thisx, GlobalContext* globalCtx); -void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx); -void func_80B4E7BC(Actor* thisx, GlobalContext* globalCtx); -void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx); -void func_80B4ABDC(Actor* thisx, GlobalContext* globalCtx); -void func_80B4D054(Actor* thisx, GlobalContext* globalCtx); -void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx); -void func_80B4D760(Actor* thisx, GlobalContext* globalCtx); -void func_80B4A168(Actor* thisx, GlobalContext* globalCtx); -void func_80B4873C(Actor* thisx, GlobalContext* globalCtx); -void func_80B490F0(Actor* thisx, GlobalContext* globalCtx); -void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx); -void func_80B4B218(Actor* thisx, GlobalContext* globalCtx); -void func_80B4BA30(Actor* thisx, GlobalContext* globalCtx); -void func_80B4C568(Actor* thisx, GlobalContext* globalCtx); -void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx); +void func_80B4627C(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play); +void func_80B468B4(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play); +void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play); +void func_80B46BB0(EnInvadepoh* this, PlayState* play); +void func_80B46BC0(EnInvadepoh* this, PlayState* play); +void func_80B46C08(EnInvadepoh* this, PlayState* play); +void func_80B46C34(EnInvadepoh* this, PlayState* play); +void func_80B46C50(EnInvadepoh* this, PlayState* play); +void func_80B46C50(EnInvadepoh* this, PlayState* play); +void func_80B46C7C(EnInvadepoh* this, PlayState* play); +void func_80B46C50(EnInvadepoh* this, PlayState* play); +void func_80B46C50(EnInvadepoh* this, PlayState* play); +void func_80B46C50(EnInvadepoh* this, PlayState* play); +void func_80B46C94(EnInvadepoh* this, PlayState* play); +void func_80B46CC0(EnInvadepoh* this, PlayState* play); +void func_80B46CF4(EnInvadepoh* this, PlayState* play); +void func_80B46D28(EnInvadepoh* this, PlayState* play); +void func_80B4D670(Actor* thisx, PlayState* play); +void func_80B47BAC(Actor* thisx, PlayState* play); +void func_80B47D30(Actor* thisx, PlayState* play); +void func_80B47FA8(Actor* thisx, PlayState* play); +void func_80B48060(Actor* thisx, PlayState* play); +void func_80B481C4(Actor* thisx, PlayState* play); +void func_80B4827C(Actor* thisx, PlayState* play); +void func_80B48620(Actor* thisx, PlayState* play); +void func_80B48FB0(Actor* thisx, PlayState* play); +void func_80B49F88(Actor* thisx, PlayState* play); +void func_80B4A9C8(Actor* thisx, PlayState* play); +void func_80B4B0C4(Actor* thisx, PlayState* play); +void func_80B4CE54(Actor* thisx, PlayState* play); +void func_80B4B8BC(Actor* thisx, PlayState* play); +void func_80B4C3A0(Actor* thisx, PlayState* play); +void func_80B49B1C(Actor* thisx, PlayState* play); +void func_80B4E158(Actor* thisx, PlayState* play); +void func_80B4E3F0(Actor* thisx, PlayState* play); +void func_80B4D9B4(Actor* thisx, PlayState* play); +void func_80B4E1B0(Actor* thisx, PlayState* play); +void func_80B4E324(Actor* thisx, PlayState* play); +void func_80B4BA84(Actor* thisx, PlayState* play); +void func_80B4E660(Actor* thisx, PlayState* play); +void func_80B4C5C0(Actor* thisx, PlayState* play); +void func_80B4E7BC(Actor* thisx, PlayState* play); +void func_80B4A1B8(Actor* thisx, PlayState* play); +void func_80B4ABDC(Actor* thisx, PlayState* play); +void func_80B4D054(Actor* thisx, PlayState* play); +void func_80B4DB14(Actor* thisx, PlayState* play); +void func_80B4D760(Actor* thisx, PlayState* play); +void func_80B4A168(Actor* thisx, PlayState* play); +void func_80B4873C(Actor* thisx, PlayState* play); +void func_80B490F0(Actor* thisx, PlayState* play); +void func_80B4AB8C(Actor* thisx, PlayState* play); +void func_80B4B218(Actor* thisx, PlayState* play); +void func_80B4BA30(Actor* thisx, PlayState* play); +void func_80B4C568(Actor* thisx, PlayState* play); +void func_80B4CFFC(Actor* thisx, PlayState* play); void func_80B46184(unkStruct80B50350* unkStruct); s32 func_80B450C0(f32* arg0, f32* arg1, f32 arg2, f32 arg3, f32 arg4); s32 func_80B4516C(EnInvadepoh* this); @@ -800,8 +800,8 @@ f32 EnInvadepoh_GetTotalPathLength(EnInvadepoh* this) { return totalDistance; } -void func_80B44024(EnInvadepoh* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[(this->actor.params >> 8) & 0x7F]; +void func_80B44024(EnInvadepoh* this, PlayState* play) { + Path* path = &play->setupPathList[(this->actor.params >> 8) & 0x7F]; this->endPoint = path->count - 1; this->pathPoints = Lib_SegmentedToVirtual(path->points); @@ -923,14 +923,14 @@ void func_80B443A0(EnInvadepoh* this) { } } -void func_80B444BC(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B444BC(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); func_80B443A0(this); } -void func_80B444F4(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B444F4(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); } void func_80B44514(EnInvadepoh* this) { @@ -940,8 +940,8 @@ void func_80B44514(EnInvadepoh* this) { } } -void func_80B44540(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B44540(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); } @@ -960,8 +960,8 @@ void func_80B44570(EnInvadepoh* this) { } } -void func_80B44620(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B44620(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); } void func_80B44640(EnInvadepoh* this) { @@ -970,8 +970,8 @@ void func_80B44640(EnInvadepoh* this) { } } -void func_80B44664(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B44664(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); this->direction = DIRECTION_FORWARD; } @@ -984,8 +984,8 @@ void func_80B44690(EnInvadepoh* this) { } } -void func_80B446D0(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44024(this, globalCtx); +void func_80B446D0(EnInvadepoh* this, PlayState* play) { + func_80B44024(this, play); this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); } @@ -1005,7 +1005,7 @@ void func_80B44700(EnInvadepoh* this) { } } -void func_80B447C0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B447C0(EnInvadepoh* this, PlayState* play) { s32 pad1; Vec3s* sp60; s32 pad2; @@ -1046,7 +1046,7 @@ void func_80B447C0(EnInvadepoh* this, GlobalContext* globalCtx) { } Math_Vec3f_Copy(&this->actor.world.pos, &this->curPathPos); - func_800B4AEC(globalCtx, &this->actor, 0.0f); + func_800B4AEC(play, &this->actor, 0.0f); if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { if (sp40 < this->actor.floorHeight) { if (this->actor.velocity.y < 0.0f) { @@ -1077,7 +1077,7 @@ void func_80B447C0(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B44A90(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B44A90(EnInvadepoh* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { this->actor.velocity.y *= 0.3f; this->actor.speedXZ *= 0.8f; @@ -1089,33 +1089,33 @@ void func_80B44A90(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.speedXZ *= 0.8f; } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 40.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); } void func_80B44B78(EnInvadepoh* this) { } -s32 func_80B44B84(EnInvadepoh* this, GlobalContext* globalCtx, f32 speed, f32 arg3) { +s32 func_80B44B84(EnInvadepoh* this, PlayState* play, f32 speed, f32 arg3) { s32 pad; Vec3s* pathPoint = &this->pathPoints[this->pathIndex + 1]; s32 retVal = func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, pathPoint->x, pathPoint->z, speed); - func_800B4AEC(globalCtx, &this->actor, arg3); + func_800B4AEC(play, &this->actor, arg3); func_80B4516C(this); return retVal; } -void func_80B44C24(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B44C24(EnInvadepoh* this, PlayState* play) { s32 pad; f32 worldPosY = this->actor.world.pos.y; func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); this->actor.world.pos.y = worldPosY; - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); } -s32 func_80B44C80(EnInvadepoh* this, GlobalContext* globalCtx) { +s32 func_80B44C80(EnInvadepoh* this, PlayState* play) { s32 pad[6]; Vec3s* temp_a2 = &this->pathPoints[this->pathIndex]; f32 temp_f0; @@ -1171,24 +1171,24 @@ s32 func_80B44C80(EnInvadepoh* this, GlobalContext* globalCtx) { phi_v0 = 5; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 0.0f, phi_v0); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, phi_v0); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); return sp40; } -void func_80B44E90(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B44E90(EnInvadepoh* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, 5); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); } -void func_80B44EFC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B44EFC(EnInvadepoh* this, PlayState* play) { s32 pad; f32 worldPosY = this->actor.world.pos.y; func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); this->actor.world.pos.y = worldPosY; - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); } @@ -1254,7 +1254,7 @@ s32 func_80B4516C(EnInvadepoh* this) { return false; } -void func_80B451A0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B451A0(EnInvadepoh* this, PlayState* play) { s32 currentTime; s32 temp_v0_2; s32 i; @@ -1294,33 +1294,33 @@ void func_80B451A0(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B452EC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B452EC(EnInvadepoh* this, PlayState* play) { s32 phi_s2 = (this->actor.params >> 8) & 0x7F; s32 i; for (i = 0; i < this->unk379; i++) { - D_80B50320[i] = (EnInvadepoh*)Actor_Spawn( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, (i & 7) | ((phi_s2 << 8) & 0x7F00) | 0x10); + D_80B50320[i] = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + (i & 7) | ((phi_s2 << 8) & 0x7F00) | 0x10); if (phi_s2 != 0xFF) { - Path* path = &globalCtx->setupPathList[phi_s2]; + Path* path = &play->setupPathList[phi_s2]; phi_s2 = path->unk1; } } } -void func_80B453F4(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, +void func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); } -void func_80B45460(EnInvadepoh* this, GlobalContext* globalCtx) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, +void func_80B45460(EnInvadepoh* this, PlayState* play) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x40); } -void func_80B454BC(EnInvadepoh* this, GlobalContext* globalCtx) { - D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, +void func_80B454BC(EnInvadepoh* this, PlayState* play) { + D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x60); } @@ -1332,9 +1332,9 @@ void EnInvadepoh_SetSysMatrix(Vec3f* vec) { sysMatrix->zw = vec->z; } -s32 func_80B45550(EnInvadepoh* this, GlobalContext* globalCtx, f32 range, s32 arg3) { +s32 func_80B45550(EnInvadepoh* this, PlayState* play, f32 range, s32 arg3) { s32 pad; - Actor* actorIterator = globalCtx->actorCtx.actorLists[ACTORCAT_DOOR].first; + Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_DOOR].first; s32 retVal = false; while (actorIterator != NULL) { @@ -1350,9 +1350,9 @@ s32 func_80B45550(EnInvadepoh* this, GlobalContext* globalCtx, f32 range, s32 ar return retVal; } -void EnInvadepoh_SetTextID(EnInvadepoh* this, GlobalContext* globalCtx, u16 arg2) { +void EnInvadepoh_SetTextID(EnInvadepoh* this, PlayState* play, u16 arg2) { this->textId = arg2; - Message_StartTextbox(globalCtx, arg2, &this->actor); + Message_StartTextbox(play, arg2, &this->actor); } void func_80B45648(EnInvadepoh* this) { @@ -1365,11 +1365,11 @@ void func_80B45648(EnInvadepoh* this) { } } -s32 func_80B456A8(GlobalContext* globalCtx, Vec3f* vec) { +s32 func_80B456A8(PlayState* play, Vec3f* vec) { Vec3f multDest; f32 wDest; - Actor_GetProjectedPos(globalCtx, vec, &multDest, &wDest); + Actor_GetProjectedPos(play, vec, &multDest, &wDest); if (((multDest.z > 1.0f) && (fabsf(multDest.x * wDest) < 1.0f)) && (fabsf(multDest.y * wDest) < 1.0f)) { s32 wX = (multDest.x * wDest * 160.0f) + 160.0f; s32 wY = (multDest.y * wDest * -120.0f) + 120.0f; @@ -1550,7 +1550,7 @@ void func_80B45CE0(AlienBehaviorInfo* substruct) { func_80B45BB8(&substruct->unk10); } -void func_80B45EC8(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { +void func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { s16 phi_s0 = 0; Vec3f spA8; Vec3f sp9C; @@ -1577,7 +1577,7 @@ void func_80B45EC8(EnInvadepoh* this, GlobalContext* globalCtx, s32 arg2) { spA8.y = ((Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y) - 90.0f; spA8.z = (spA8.z * 100.0f) + this->actor.world.pos.z; - EffectSsKirakira_SpawnDispersed(globalCtx, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); + EffectSsKirakira_SpawnDispersed(play, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); } } @@ -1627,7 +1627,7 @@ s32 func_80B461DC(void) { return phi_s4; } -void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4627C(EnInvadepoh* this, PlayState* play) { s32 invadepohType; s32 i; @@ -1635,7 +1635,7 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { invadepohType = (this->actor.params >> 8) & 0x7F; for (i = 1; i < 8; i++) { - Path* path = &globalCtx->setupPathList[invadepohType]; + Path* path = &play->setupPathList[invadepohType]; invadepohType = path->unk1; if (invadepohType == 0xFF) { break; @@ -1643,9 +1643,9 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { } this->unk379 = i; - func_80B451A0(this, globalCtx); + func_80B451A0(this, play); func_80B45648(this); - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_SWITCH); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_SWITCH); if (D_80B4E940 == 1) { func_80B46DA8(this); @@ -1653,8 +1653,8 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { func_80B46DA8(this); } else { - func_80B454BC(this, globalCtx); - func_80B452EC(this, globalCtx); + func_80B454BC(this, play); + func_80B452EC(this, play); Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); func_80B46F88(this); } @@ -1672,11 +1672,11 @@ void func_80B4627C(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void EnInvadepoh_InitAlien(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, D_80B4EC24); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); this->actor.shape.shadowAlpha = 140; this->actor.flags = (ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000); @@ -1685,36 +1685,35 @@ void EnInvadepoh_InitAlien(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; } else { this->actor.update = func_80B47BAC; - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitAlien); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitAlien); this->actor.colChkInfo.mass = 40; } - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_UCH); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_UCH); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } } -void EnInvadepoh_InitParentCow(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChainParentCow); this->actor.update = func_80B47FA8; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, - 0x30); - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_COW); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } } -void EnInvadepoh_InitChildCow(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChainChildCow); this->actor.update = func_80B481C4; - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_COW); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } } -void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { s32 pad; s32 temp = INVADEPOH_TYPE(this); @@ -1722,11 +1721,11 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.targetMode = (temp == 7 || temp == 0xC) ? 3 : 6; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(globalCtx, &this->collider); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); + Collider_InitCylinder(play, &this->collider); if (temp != 4) { ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); this->actor.colChkInfo.mass = MASS_IMMOVABLE; } if (temp == 4) { @@ -1744,7 +1743,7 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.update = func_80B4CE54; } - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MA1); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA1); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } @@ -1773,11 +1772,11 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B468B4(EnInvadepoh* this, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_80B4EC68); this->actor.update = func_80B49B1C; this->actor.draw = func_80B4E3F0; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { this->actor.world.pos.x += D_80B4E934.x; this->actor.world.pos.y += D_80B4E934.y + 3000.0f; @@ -1791,32 +1790,32 @@ void func_80B468B4(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void EnInvadepoh_InitDog(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, sInitChainDog); this->actor.update = func_80B4B8BC; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitDog); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDog); this->actor.colChkInfo.mass = 80; ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_DOG); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DOG); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } } -void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx) { +void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, sInitChainCremia); this->actor.update = func_80B4C3A0; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); this->actor.colChkInfo.mass = MASS_HEAVY; ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MA2); + this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA2); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); } @@ -1826,24 +1825,24 @@ void EnInvadepoh_InitCremia(EnInvadepoh* this, GlobalContext* globalCtx) { D_80B503F8 = this; } -void EnInvadepoh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnInvadepoh_Init(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - D_80B4ECB0[INVADEPOH_TYPE(this)](this, globalCtx); + D_80B4ECB0[INVADEPOH_TYPE(this)](this, play); } -void func_80B46BB0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46BB0(EnInvadepoh* this, PlayState* play) { } -void func_80B46BC0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46BC0(EnInvadepoh* this, PlayState* play) { s32 pad; s32 invadepohType = this->actor.params & 7; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); D_80B50320[invadepohType] = 0; } -void func_80B46C08(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46C08(EnInvadepoh* this, PlayState* play) { if (this->actor.parent != NULL) { this->actor.parent->child = NULL; } @@ -1853,46 +1852,46 @@ void func_80B46C08(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B46C34(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46C34(EnInvadepoh* this, PlayState* play) { if (this->actor.parent != NULL) { this->actor.parent->child = NULL; } } -void func_80B46C50(EnInvadepoh* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); +void func_80B46C50(EnInvadepoh* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); } -void func_80B46C7C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46C7C(EnInvadepoh* this, PlayState* play) { D_80B503F0 = NULL; } -void func_80B46C94(EnInvadepoh* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); +void func_80B46C94(EnInvadepoh* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); } -void func_80B46CC0(EnInvadepoh* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); +void func_80B46CC0(EnInvadepoh* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); D_80B503F8 = NULL; } -void func_80B46CF4(EnInvadepoh* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); +void func_80B46CF4(EnInvadepoh* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); D_80B503F4 = NULL; } -void func_80B46D28(EnInvadepoh* this, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &this->collider); +void func_80B46D28(EnInvadepoh* this, PlayState* play) { + Collider_DestroyCylinder(play, &this->collider); if (!this) {} // required to match if (this->actor.child != NULL) { this->actor.child->parent = NULL; } } -void EnInvadepoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - D_80B4ECE8[INVADEPOH_TYPE(this)](this, globalCtx); + D_80B4ECE8[INVADEPOH_TYPE(this)](this, play); } void func_80B46DA8(EnInvadepoh* this) { @@ -1900,10 +1899,10 @@ void func_80B46DA8(EnInvadepoh* this) { this->actionFunc = func_80B46DC8; } -void func_80B46DC8(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46DC8(EnInvadepoh* this, PlayState* play) { if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { - func_80B454BC(this, globalCtx); - func_80B452EC(this, globalCtx); + func_80B454BC(this, play); + func_80B452EC(this, play); func_80B46E20(this); } } @@ -1914,7 +1913,7 @@ void func_80B46E20(EnInvadepoh* this) { this->actionFunc = func_80B46E44; } -void func_80B46E44(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46E44(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else if (ActorCutscene_GetCanPlayNext(D_80B50404[0])) { @@ -1931,7 +1930,7 @@ void func_80B46EC0(EnInvadepoh* this) { this->actionFunc = func_80B46EE8; } -void func_80B46EE8(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46EE8(EnInvadepoh* this, PlayState* play) { s32 i; for (i = 0; i < 8; i++) { @@ -1953,7 +1952,7 @@ void func_80B46F88(EnInvadepoh* this) { this->actionFunc = func_80B46FA8; } -void func_80B46FA8(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B46FA8(EnInvadepoh* this, PlayState* play) { s32 i; if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { @@ -1975,7 +1974,7 @@ void func_80B47064(EnInvadepoh* this) { this->actionFunc = func_80B47084; } -void func_80B47084(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B47084(EnInvadepoh* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(D_80B50404[1])) { ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[1], &this->actor); func_80B470E0(this); @@ -1990,16 +1989,16 @@ void func_80B470E0(EnInvadepoh* this) { this->actionFunc = func_80B47108; } -void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B47108(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 100) { func_801A3098(NA_BGM_CLEAR_EVENT); } this->actionTimer--; if (this->actionTimer <= 0) { - globalCtx->nextEntranceIndex = 0x6460; + play->nextEntranceIndex = 0x6460; gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x49; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x49; gSaveContext.nextTransition = 0x48; D_801BDAA0 = 1; D_801BDA9C = 0; @@ -2012,12 +2011,12 @@ void func_80B471C0(EnInvadepoh* this) { this->actionFunc = func_80B471E0; } -void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B471E0(EnInvadepoh* this, PlayState* play) { if (D_80B4E998) { - globalCtx->nextEntranceIndex = 0x6470; + play->nextEntranceIndex = 0x6470; gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x48; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x48; gSaveContext.nextTransition = 0x48; func_80B47248(this); } @@ -2028,7 +2027,7 @@ void func_80B47248(EnInvadepoh* this) { this->actionFunc = func_80B47268; } -void func_80B47268(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B47268(EnInvadepoh* this, PlayState* play) { } void func_80B47278(EnInvadepoh* this) { @@ -2036,11 +2035,11 @@ void func_80B47278(EnInvadepoh* this) { this->actionFunc = func_80B47298; } -void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x6400; +void func_80B47298(EnInvadepoh* this, PlayState* play) { + play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF3; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x48; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x48; gSaveContext.nextTransition = 0x48; gSaveContext.save.weekEventReg[89] |= 0x10; func_80B47304(this); @@ -2051,13 +2050,13 @@ void func_80B47304(EnInvadepoh* this) { this->actionFunc = func_80B47324; } -void func_80B47324(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B47324(EnInvadepoh* this, PlayState* play) { } -void EnInvadepoh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnInvadepoh_Update(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (func_80B461DC()) { this->actor.draw = func_80B4D9B4; } else { @@ -2078,9 +2077,9 @@ void func_80B47380(EnInvadepoh* this) { this->actionFunc = func_80B473E4; } -void func_80B473E4(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B473E4(EnInvadepoh* this, PlayState* play) { func_80B442E4(this); - func_80B447C0(this, globalCtx); + func_80B447C0(this, play); func_80B43DD4(this, 800, 0); if (D_80B50340[this->actor.params & 7] & 1) { Actor_SetScale(&this->actor, 0.01f); @@ -2103,9 +2102,9 @@ void func_80B47478(EnInvadepoh* this) { this->actionFunc = func_80B474DC; } -void func_80B474DC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B474DC(EnInvadepoh* this, PlayState* play) { func_80B442E4(this); - func_80B447C0(this, globalCtx); + func_80B447C0(this, play); func_80B43DD4(this, 800, 0); if (this->clockTime > 0.0f) { Actor_SetScale(&this->actor, 0.01f); @@ -2129,9 +2128,9 @@ void func_80B47568(EnInvadepoh* this) { this->actionFunc = func_80B47600; } -void func_80B47600(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B47600(EnInvadepoh* this, PlayState* play) { func_80B442E4(this); - func_80B447C0(this, globalCtx); + func_80B447C0(this, play); func_80B43DD4(this, 800, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->clockTime >= 0.9999f) { @@ -2173,9 +2172,9 @@ void func_80B4770C(EnInvadepoh* this) { this->actionFunc = func_80B477B4; } -void func_80B477B4(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B477B4(EnInvadepoh* this, PlayState* play) { func_80B442E4(this); - func_80B447C0(this, globalCtx); + func_80B447C0(this, play); func_80B43DD4(this, 800, 0); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); if (this->clockTime >= 0.9999f) { @@ -2200,8 +2199,8 @@ void func_80B47830(EnInvadepoh* this) { this->actionFunc = func_80B478F4; } -void func_80B478F4(EnInvadepoh* this, GlobalContext* globalCtx) { - func_80B44A90(this, globalCtx); +void func_80B478F4(EnInvadepoh* this, PlayState* play) { + func_80B44A90(this, play); this->actionTimer--; if (this->actionTimer <= 0) { func_80B47938(this); @@ -2224,7 +2223,7 @@ void func_80B47938(EnInvadepoh* this) { this->actionFunc = func_80B479E8; } -void func_80B479E8(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B479E8(EnInvadepoh* this, PlayState* play) { s16 unk2F2; u32 index; @@ -2258,37 +2257,37 @@ void func_80B479E8(EnInvadepoh* this, GlobalContext* globalCtx) { this->counter++; if (this->actionTimer == 8) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y - 10.0f, this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, + this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); } if (this->actionTimer == 8) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } this->actionTimer--; if (this->actionTimer <= 0) { func_80B43AF0(this->actor.params & 7); func_80B43AB0(); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_ARROWS_30); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_30); func_80B47478(this); } } -void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B47BAC(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B45080(); this->actor.update = func_80B47D30; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_uch_Skel_004E50, &object_uch_Anim_001D80, - this->jointTable, this->morphTable, 14); + SkelAnime_InitFlex(play, &this->skelAnime, &object_uch_Skel_004E50, &object_uch_Anim_001D80, this->jointTable, + this->morphTable, 14); this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.125f; - func_80B444BC(this, globalCtx); + func_80B444BC(this, play); func_80B442E4(this); - func_80B447C0(this, globalCtx); + func_80B447C0(this, play); func_80B43F0C(this); func_80B4516C(this); if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { @@ -2305,7 +2304,7 @@ void func_80B47BAC(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B47D30(Actor* thisx, GlobalContext* globalCtx) { +void func_80B47D30(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; @@ -2328,51 +2327,50 @@ void func_80B47D30(Actor* thisx, GlobalContext* globalCtx) { thisx->gravity = 0.0f; thisx->velocity.y = acAttached->velocity.y * 0.5f; thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); func_80B47830(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (thisx->draw != NULL) { this->animPlayFlag = SkelAnime_Update(&this->skelAnime); } 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); } else { this->collider.base.atFlags &= ~AT_HIT; } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.acFlags &= ~AC_HIT; } if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.ocFlags1 &= ~OC1_HIT; } } -void func_80B47FA8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B47FA8(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, thisx); + Actor_SetObjectDependency(play, thisx); this->actor.update = func_80B48060; this->actor.draw = func_80B4E158; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, - COW_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); } } -void func_80B48060(Actor* thisx, GlobalContext* globalCtx) { +void func_80B48060(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; s32 temp; @@ -2401,22 +2399,22 @@ void func_80B48060(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B481C4(Actor* thisx, GlobalContext* globalCtx) { +void func_80B481C4(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); this->actor.update = func_80B4827C; this->actor.draw = func_80B4E1B0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, COW_TAIL_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); } } -void func_80B4827C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4827C(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if (D_80B503F0 == NULL || this->actor.parent == NULL) { @@ -2434,10 +2432,10 @@ void func_80B482D4(EnInvadepoh* this) { this->actionFunc = func_80B48324; } -void func_80B48324(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B48324(EnInvadepoh* this, PlayState* play) { this->actionTimer--; if (this->actionTimer <= 0) { - EnInvadepoh_SetTextID(this, globalCtx, 0x332F); + EnInvadepoh_SetTextID(this, play, 0x332F); this->actor.draw = func_80B4E324; func_80B48374(this); } @@ -2450,7 +2448,7 @@ void func_80B48374(EnInvadepoh* this) { this->actionFunc = func_80B483CC; } -void func_80B483CC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B483CC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 20) { f32 unkFloat = 0.1f; @@ -2482,7 +2480,7 @@ void func_80B4843C(EnInvadepoh* this) { this->actionFunc = func_80B484EC; } -void func_80B484EC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B484EC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 40) { this->behaviorInfo.unk26.y = 7000; } else if (this->actionTimer == 30) { @@ -2512,27 +2510,27 @@ void func_80B48588(EnInvadepoh* this) { this->actionFunc = func_80B48610; } -void func_80B48610(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B48610(EnInvadepoh* this, PlayState* play) { } -void func_80B48620(Actor* thisx, GlobalContext* globalCtx) { +void func_80B48620(Actor* thisx, PlayState* play) { s32 pad[2]; EnInvadepoh* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); this->actor.update = func_80B4873C; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, this->jointTable, + this->morphTable, 23); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 5000, 0.05f, 0.3f, 0.12f); Animation_PlayLoop(&this->skelAnime, &object_ma1_Anim_009E58); func_80B482D4(this); } } -void func_80B4873C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4873C(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; AlienBehaviorInfo* substruct = &this->behaviorInfo; @@ -2541,7 +2539,7 @@ void func_80B4873C(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); func_80B45CE0(substruct); if (substruct->unk40 != 0) { @@ -2564,11 +2562,11 @@ void func_80B487B4(EnInvadepoh* this) { this->actionFunc = func_80B48848; } -void func_80B48848(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B48848(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); - if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { func_80B44514(this); this->behaviorInfo.unk4C = 0xC8; this->actor.speedXZ *= 0.25f; @@ -2624,7 +2622,7 @@ void func_80B48948(EnInvadepoh* this) { this->actionFunc = func_80B48AD4; } -void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B48AD4(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; Player* player; s16 new_var3; @@ -2632,15 +2630,15 @@ void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) { s32 temp_v1_3; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); - if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { func_80B44514(this); } if (this->rand == 0) { s32 requiredScopeTemp; - if ((this->actor.xzDistToPlayer < 350.0f) && ((globalCtx->gameplayFrames & 0x60) != 0)) { - player = GET_PLAYER(globalCtx); + if ((this->actor.xzDistToPlayer < 350.0f) && ((play->gameplayFrames & 0x60) != 0)) { + player = GET_PLAYER(play); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; temp_v1 -= this->actor.shape.rot.x; substruct->unk26.x = CLAMP(temp_v1, -2500, 2500); @@ -2698,9 +2696,9 @@ void func_80B48DE4(EnInvadepoh* this) { this->actionFunc = func_80B48E4C; } -void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B48E4C(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -2713,51 +2711,51 @@ void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx) { diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); temp_v1 = diff * 0.7f; substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B48948(this); } } -void func_80B48FB0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B48FB0(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); this->actor.update = func_80B490F0; this->actor.draw = func_80B4E324; this->actor.textId = 0x3330; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, this->jointTable, + this->morphTable, 23); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B444F4(this, globalCtx); + func_80B444F4(this, play); EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); func_80B487B4(this); } } -void func_80B490F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B490F0(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); + s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); if (isTalking) { - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); func_80B48DE4(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp2C) { SkelAnime_Update(&this->skelAnime); func_80B45CE0(&this->behaviorInfo); if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -2770,7 +2768,7 @@ void func_80B491EC(EnInvadepoh* this) { this->actionFunc = func_80B49228; } -void func_80B49228(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49228(EnInvadepoh* this, PlayState* play) { s32 pad; f32 temp_f0; @@ -2780,7 +2778,7 @@ void func_80B49228(EnInvadepoh* this, GlobalContext* globalCtx) { fabsf(this->actor.velocity.y), 1.0f); func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); if (fabsf(temp_f0) < 1.0f) { - func_80B45EC8(this, globalCtx, 50); + func_80B45EC8(this, play, 50); func_80B492FC(this); } } @@ -2794,7 +2792,7 @@ void func_80B492FC(EnInvadepoh* this) { this->actionFunc = func_80B4934C; } -void func_80B4934C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4934C(EnInvadepoh* this, PlayState* play) { f32 temp = this->actor.home.pos.y + D_80B4E934.y + 300.0f; if (this->actor.world.pos.y < temp) { @@ -2822,7 +2820,7 @@ void func_80B49404(EnInvadepoh* this) { this->actionFunc = func_80B49454; } -void func_80B49454(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49454(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; s32 pad2; @@ -2834,7 +2832,7 @@ void func_80B49454(EnInvadepoh* this, GlobalContext* globalCtx) { this->unk3AC++; this->unk3AC = CLAMP_MAX(this->unk3AC, 4); this->actor.gravity = 33.0f; - func_80B45EC8(this, globalCtx, 20); + func_80B45EC8(this, play, 20); } Math_Vec3f_Sum(&D_80B4EDD0[this->unk3AC], &this->actor.home.pos, &sp30); @@ -2871,7 +2869,7 @@ void func_80B49628(EnInvadepoh* this) { this->actionFunc = func_80B49670; } -void func_80B49670(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49670(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -2879,7 +2877,7 @@ void func_80B49670(EnInvadepoh* this, GlobalContext* globalCtx) { sp30.y = this->actor.home.pos.y + 1500.0f; sp30.z = this->actor.home.pos.z; Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 0xA, 0xBB8, 0x64); - if ((globalCtx->gameplayFrames % 64) < 14) { + if ((play->gameplayFrames % 64) < 14) { Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); } else { this->actor.speedXZ *= 0.97f; @@ -2905,7 +2903,7 @@ void func_80B497A4(EnInvadepoh* this) { this->actionFunc = func_80B497EC; } -void func_80B497EC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B497EC(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -2937,7 +2935,7 @@ void func_80B49904(EnInvadepoh* this) { this->actionFunc = func_80B4994C; } -void func_80B4994C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4994C(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 150.0f, 4.0f); this->actor.velocity.y *= 0.95f; Actor_MoveWithGravity(&this->actor); @@ -2957,7 +2955,7 @@ void func_80B499BC(EnInvadepoh* this) { this->actionFunc = func_80B49A00; } -void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49A00(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -2973,7 +2971,7 @@ void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.gravity = 2.0f; } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->actionTimer > 0) { this->actionTimer--; } else { @@ -2981,11 +2979,11 @@ void func_80B49A00(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B49B1C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B49B1C(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; f32 scale; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->scaleAdjAngle += this->unk3AA; Math_StepToF(&this->scaleFactorAdj, this->scaleTarget, this->scaleStep); scale = Math_SinS(this->scaleAdjAngle) * this->scaleFactorAdj + 1.0f; @@ -3007,20 +3005,20 @@ void func_80B49BD0(EnInvadepoh* this) { this->actionFunc = func_80B49C38; } -void func_80B49C38(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49C38(EnInvadepoh* this, PlayState* play) { s32 pad; s32 temp_v0_2; func_80B44570(this); - func_80B44C24(this, globalCtx); + func_80B44C24(this, play); func_80B43E6C(this, 6, 2000, 100); if (1) {} if (this->pathIndex == 0 || (this->pathIndex + 1) == this->endPoint) { if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(globalCtx); + temp_v0_2 = func_800FE620(play); if (temp_v0_2 > 0) { temp_v0_2 = (REG(15) * -16.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), temp_v0_2); + this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); } } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3046,9 +3044,9 @@ void func_80B49DA0(EnInvadepoh* this) { this->actionFunc = func_80B49DFC; } -void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B49DFC(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -3061,7 +3059,7 @@ void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { temp_v1 = diff; temp_v1 *= 0.7f; substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { gSaveContext.save.weekEventReg[54] |= 0x10; this->actor.textId = 0x332E; @@ -3070,22 +3068,22 @@ void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { +void func_80B49F88(Actor* thisx, PlayState* play) { s32 pad[2]; EnInvadepoh* this = THIS; s32 sp38; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, + this->morphTable, 23); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B44540(this, globalCtx); + func_80B44540(this, play); func_80B44570(this); - func_80B44C24(this, globalCtx); + func_80B44C24(this, play); func_80B43F0C(this); func_80B4516C(this); if (0x20 & gSaveContext.save.weekEventReg[21]) { @@ -3112,7 +3110,7 @@ void func_80B49F88(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4A168(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4A168(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 0))) { @@ -3122,25 +3120,25 @@ void func_80B4A168(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4A1B8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4A1B8(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); + s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); if (isTalking) { - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); func_80B49DA0(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp2C && this->actor.update != NULL) { SkelAnime_Update(&this->skelAnime); func_80B45CE0(&this->behaviorInfo); if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 350.0f); + func_800B8614(&this->actor, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3159,7 +3157,7 @@ void func_80B4A2C0(EnInvadepoh* this) { this->actionFunc = func_80B4A350; } -void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4A350(EnInvadepoh* this, PlayState* play) { s16 temp_v0; s16 temp_v1_2; s16 diff; @@ -3167,7 +3165,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { s16 sp42; AlienBehaviorInfo* substruct = &this->behaviorInfo; - if ((globalCtx->gameplayFrames % 256) == 0) { + if ((play->gameplayFrames % 256) == 0) { Math_Vec3s_ToVec3f(&sp44, this->pathPoints); sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); temp_v0 = Rand_S16Offset(-0x1F40, 0x3E80); @@ -3178,7 +3176,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40); if (this->actor.xzDistToPlayer < 300.0f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); temp_v1_2 *= 0.85f; @@ -3188,7 +3186,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { temp_v1_2 = diff; temp_v1_2 *= 0.7f; substruct->unk26.y = CLAMP(temp_v1_2, -0x1F40, 0x1F40); - if ((globalCtx->gameplayFrames % 256) == 0) { + if ((play->gameplayFrames % 256) == 0) { substruct->unk26.z = Rand_S16Offset(-0x5DC, 0xBB8); } } else { @@ -3216,7 +3214,7 @@ void func_80B4A570(EnInvadepoh* this) { this->actionFunc = func_80B4A5E4; } -void func_80B4A5E4(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4A5E4(EnInvadepoh* this, PlayState* play) { if (this->animPlayFlag) { func_80B4A2C0(this); } @@ -3234,11 +3232,11 @@ void func_80B4A614(EnInvadepoh* this) { this->actionFunc = func_80B4A67C; } -void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4A67C(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); - if (func_80B44B84(this, globalCtx, this->actor.speedXZ, 50.0f)) { + if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { func_80B44640(this); this->behaviorInfo.unk4C = 0x5DC; this->actor.speedXZ *= 0.5f; @@ -3248,7 +3246,7 @@ void func_80B4A67C(EnInvadepoh* this, GlobalContext* globalCtx) { func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x32); if (this->pathIndex == 0) { if (this->unk378 == 0) { - this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), -0xF); + this->unk378 = func_80B45550(this, play, SQ(80.0f), -0xF); } this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); } else { @@ -3272,9 +3270,9 @@ void func_80B4A7C0(EnInvadepoh* this) { this->actionFunc = func_80B4A81C; } -void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4A81C(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -3288,7 +3286,7 @@ void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { temp_v1 *= 0.7f; substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { if (this->actor.textId == 0x332D) { gSaveContext.save.weekEventReg[54] |= 0x10; this->actor.textId = 0x332E; @@ -3301,20 +3299,20 @@ void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4A9C8(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad[2]; s32 sp38; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, + this->morphTable, 23); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B44620(this, globalCtx); + func_80B44620(this, play); if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) { this->pathIndex = 0; this->actor.update = func_80B4AB8C; @@ -3327,7 +3325,7 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { EnInvadepoh_SetPathPointToWorldPos(this, this->pathIndex); func_80B43F0C(this); - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); if (gSaveContext.save.weekEventReg[21] & 0x20) { if (gSaveContext.save.weekEventReg[54] & 0x10) { @@ -3341,7 +3339,7 @@ void func_80B4A9C8(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4AB8C(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { @@ -3351,25 +3349,25 @@ void func_80B4AB8C(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4ABDC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4ABDC(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); + s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); if (isTalking) { - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); func_80B4A7C0(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp2C) { this->animPlayFlag = SkelAnime_Update(&this->skelAnime); func_80B45CE0(&this->behaviorInfo); if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3377,7 +3375,7 @@ void func_80B4ACDC(EnInvadepoh* this) { this->actionFunc = func_80B4ACF0; } -void func_80B4ACF0(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4ACF0(EnInvadepoh* this, PlayState* play) { if (gSaveContext.save.weekEventReg[22] & 1) { this->actor.draw = func_80B4E324; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -3390,12 +3388,12 @@ void func_80B4AD3C(EnInvadepoh* this) { this->actionFunc = func_80B4AD60; } -void func_80B4AD60(EnInvadepoh* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnInvadepoh_SetTextID(this, globalCtx, 0x3331); +void func_80B4AD60(EnInvadepoh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnInvadepoh_SetTextID(this, play, 0x3331); func_80B4ADB8(this); } else { - func_800B8614(&this->actor, globalCtx, 2000.0f); + func_800B8614(&this->actor, play, 2000.0f); } } @@ -3403,22 +3401,22 @@ void func_80B4ADB8(EnInvadepoh* this) { this->actionFunc = func_80B4ADCC; } -void func_80B4ADCC(EnInvadepoh* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->textId == 0x3331) { if (gSaveContext.save.weekEventReg[22] & 2) { - EnInvadepoh_SetTextID(this, globalCtx, 0x3334); - func_80151BB4(globalCtx, 0x1D); - func_80151BB4(globalCtx, 5); + EnInvadepoh_SetTextID(this, play, 0x3334); + func_80151BB4(play, 0x1D); + func_80151BB4(play, 5); return; } - EnInvadepoh_SetTextID(this, globalCtx, 0x3333); + EnInvadepoh_SetTextID(this, play, 0x3333); return; } if (this->textId == 0x3333) { func_80B4AEC0(this); } else if (this->textId == 0x3334) { - func_801477B4(globalCtx); + func_801477B4(play); func_80B4B024(this); } } @@ -3429,19 +3427,19 @@ void func_80B4AEC0(EnInvadepoh* this) { this->actionFunc = func_80B4AEDC; } -void func_80B4AEDC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4AEDC(EnInvadepoh* this, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; if (this->actionTimer == 0) { - func_801477B4(globalCtx); + func_801477B4(play); } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; gSaveContext.save.weekEventReg[22] |= 2; func_80B4AF80(this); } else { - Actor_PickUp(&this->actor, globalCtx, GI_MILK_BOTTLE, 2000.0f, 2000.0f); + Actor_PickUp(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); } } @@ -3449,15 +3447,15 @@ void func_80B4AF80(EnInvadepoh* this) { this->actionFunc = func_80B4AF94; } -void func_80B4AF94(EnInvadepoh* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnInvadepoh_SetTextID(this, globalCtx, 0x3334); - func_80151BB4(globalCtx, 0x1E); - func_80151BB4(globalCtx, 0x1D); - func_80151BB4(globalCtx, 5); +void func_80B4AF94(EnInvadepoh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnInvadepoh_SetTextID(this, play, 0x3334); + func_80151BB4(play, 0x1E); + func_80151BB4(play, 0x1D); + func_80151BB4(play, 5); func_80B4ADB8(this); } else { - func_800B85E0(&this->actor, globalCtx, 2000.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 2000.0f, EXCH_ITEM_MINUS1); } } @@ -3466,40 +3464,40 @@ void func_80B4B024(EnInvadepoh* this) { this->actionFunc = func_80B4B048; } -void func_80B4B048(EnInvadepoh* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.unk120B1 == 0) { - if (globalCtx->msgCtx.msgMode == 0) { +void func_80B4B048(EnInvadepoh* this, PlayState* play) { + if (play->msgCtx.unk120B1 == 0) { + if (play->msgCtx.msgMode == 0) { D_80B4E998 = 1; - } else if ((Message_GetState(&globalCtx->msgCtx) == 6) || (Message_GetState(&globalCtx->msgCtx) == 5)) { + } else if ((Message_GetState(&play->msgCtx) == 6) || (Message_GetState(&play->msgCtx) == 5)) { D_80B4E998 = 1; } } } -void func_80B4B0C4(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4B0C4(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; AlienBehaviorInfo* substruct; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); this->actor.update = func_80B4B218; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, + this->morphTable, 23); Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, 0.0f); substruct = &this->behaviorInfo; func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 2000, 0.08f, 0.3f, 0.03f); substruct->unk30 = 0.08f; substruct->unk2C = 0x7D0; - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); func_80B4ACDC(this); } } -void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4B218(Actor* thisx, PlayState* play) { s16 diff; EnInvadepoh* this = THIS; s16 temp_v1; @@ -3507,10 +3505,10 @@ void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) { Player* player; AlienBehaviorInfo* substruct = &this->behaviorInfo; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp38 && this->actor.update != NULL) { SkelAnime_Update(&this->skelAnime); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f); @@ -3522,7 +3520,7 @@ void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) { substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); func_80B45CE0(substruct); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3540,9 +3538,9 @@ void func_80B4B430(EnInvadepoh* this) { this->actionFunc = func_80B4B484; } -void func_80B4B484(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4B484(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 1.1f, 0.5f); - if (func_80B44C80(this, globalCtx)) { + if (func_80B44C80(this, play)) { func_80B44690(this); } func_80B4B3DC(this); @@ -3563,7 +3561,7 @@ void func_80B4B510(EnInvadepoh* this) { this->actionFunc = func_80B4B564; } -void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4B564(EnInvadepoh* this, PlayState* play) { s32 pad; Vec3f sp28; f32 temp_f0; @@ -3585,7 +3583,7 @@ void func_80B4B564(EnInvadepoh* this, GlobalContext* globalCtx) { } } func_80B4B3DC(this); - if (func_80B44C80(this, globalCtx)) { + if (func_80B44C80(this, play)) { func_80B44690(this); } @@ -3606,13 +3604,13 @@ void func_80B4B724(EnInvadepoh* this) { this->actionFunc = func_80B4B768; } -void func_80B4B768(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4B768(EnInvadepoh* this, PlayState* play) { s32 pad; Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); Math_SmoothStepToS(&this->actor.world.rot.y, Actor_YawBetweenActors(&this->actor, &D_80B5040C->actor), 5, 0x1388, 0x64); - func_80B44E90(this, globalCtx); + func_80B44E90(this, play); if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } @@ -3626,27 +3624,27 @@ void func_80B4B820(EnInvadepoh* this) { this->actionFunc = func_80B4B864; } -void func_80B4B864(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4B864(EnInvadepoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.5f, 1.0f); - func_80B44E90(this, globalCtx); + func_80B44E90(this, play); if (this->animPlayFlag) { func_80B4B510(this); } } -void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4B8BC(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, + Actor_SetObjectDependency(play, &this->actor); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, DOG_LIMB_MAX); func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &gZeroVec3s, 3000, 0.1f, 0.0f, 0.0f); - func_80B44664(this, globalCtx); + func_80B44664(this, play); EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); Math_Vec3f_Copy(&this->curPathPos, &this->actor.world.pos); if (D_80B4E940 == 2) { @@ -3663,7 +3661,7 @@ void func_80B4B8BC(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4BA30(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4BA30(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if (D_80B4E940 == 2) { @@ -3674,7 +3672,7 @@ void func_80B4BA30(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4BA84(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; s32 temp_v0_3; s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); @@ -3710,12 +3708,12 @@ void func_80B4BA84(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->animPlayFlag = SkelAnime_Update(&this->skelAnime); if (sp34 && (this->actor.update != NULL)) { func_80B45CE0(&this->behaviorInfo); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3733,7 +3731,7 @@ void func_80B4BBE0(EnInvadepoh* this) { this->actionFunc = func_80B4BC4C; } -void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4BC4C(EnInvadepoh* this, PlayState* play) { s8 temp_v0; s16 diff; EnInvadepoh* temp_t6 = D_80B503F4; @@ -3763,14 +3761,14 @@ void func_80B4BC4C(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.world.pos.x = (Math_SinS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.x; this->actor.world.pos.y = temp_t6->actor.world.pos.y; this->actor.world.pos.z = (Math_CosS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.z; - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); func_80B4516C(this); Math_StepToS(&this->behaviorInfo.unk4C, 0xBB8, 0x1F5); if (Math3D_Vec3fDistSq(&this->actor.prevPos, &this->actor.world.pos) > SQ(0.01f)) { Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.prevPos, &this->actor.world.pos), 3, this->behaviorInfo.unk4C, 0x1F4); } - temp_v1 = (globalCtx->gameplayFrames + 0x14) % 128; + temp_v1 = (play->gameplayFrames + 0x14) % 128; if ((temp_v1 & 0x40) != 0) { sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &temp_t6->actor.world.pos); if (temp_v1 == 64) { @@ -3808,9 +3806,9 @@ void func_80B4BFFC(EnInvadepoh* this) { this->actionFunc = func_80B4C058; } -void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4C058(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -3827,7 +3825,7 @@ void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) { substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B4BBE0(this); } } @@ -3840,9 +3838,9 @@ void func_80B4C1BC(EnInvadepoh* this) { this->actionFunc = func_80B4C218; } -void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4C218(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Actor* temp_v0; s16 temp_v1; s16 diff; @@ -3865,18 +3863,18 @@ void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4C3A0(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { s32 pad[2]; s32 currentTime = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44FEC(); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma2_Skel_015C28, &object_ma2_Anim_016720, - this->jointTable, this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma2_Skel_015C28, &object_ma2_Anim_016720, this->jointTable, + this->morphTable, 22); func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; if (currentTime < 0xD5A0) { @@ -3903,7 +3901,7 @@ void func_80B4C3A0(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4C568(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4C568(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { @@ -3913,25 +3911,25 @@ void func_80B4C568(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4C5C0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4C5C0(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); + s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); if (isTalking) { - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); func_80B4BFFC(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp2C && (this->actor.update != NULL)) { SkelAnime_Update(&this->skelAnime); func_80B45CE0(&this->behaviorInfo); if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 350.0f); + func_800B8614(&this->actor, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -3947,7 +3945,7 @@ void func_80B4C6C8(EnInvadepoh* this) { this->actionFunc = func_80B4C730; } -void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4C730(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; EnInvadepoh* sp68 = D_80B503F8; s32 phi_a2; @@ -3962,7 +3960,7 @@ void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) { s16 pad2; func_80B44700(this); - func_80B44EFC(this, globalCtx); + func_80B44EFC(this, play); func_80B43E6C(this, 6, 2000, 100); phi_a2 = ((this->pathIndex < this->endPoint) ? this->pathIndex : this->endPoint - 1); @@ -3971,10 +3969,10 @@ void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40), 5, 0x7D0, 0x64); if ((this->pathIndex == 0) || ((this->pathIndex + 1) == this->endPoint)) { if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(globalCtx); + temp_v0_2 = func_800FE620(play); if (temp_v0_2 > 0) { temp_v0_2 = (REG(15) * -23.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, globalCtx, SQ(80.0f), temp_v0_2); + this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); } } @@ -3984,7 +3982,7 @@ void func_80B4C730(EnInvadepoh* this, GlobalContext* globalCtx) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - temp_v1_3 = globalCtx->gameplayFrames % 128; + temp_v1_3 = play->gameplayFrames % 128; if ((temp_v1_3 & 0x40) != 0) { sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); if (temp_v1_3 == 64) { @@ -4026,9 +4024,9 @@ void func_80B4CAB0(EnInvadepoh* this) { this->actionFunc = func_80B4CB0C; } -void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4CB0C(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -4042,7 +4040,7 @@ void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) { temp_v1 = diff; temp_v1 *= 0.7f; substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80B4C6C8(this); } } @@ -4055,9 +4053,9 @@ void func_80B4CC70(EnInvadepoh* this) { this->actionFunc = func_80B4CCCC; } -void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4CCCC(EnInvadepoh* this, PlayState* play) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v1; s16 diff; @@ -4078,24 +4076,24 @@ void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4CE54(Actor* thisx, PlayState* play) { s32 pad[2]; EnInvadepoh* this = THIS; s32 sp38; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { sp38 = gSaveContext.save.time; this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, - this->jointTable, this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, + this->morphTable, 23); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B446D0(this, globalCtx); + func_80B446D0(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; func_80B44700(this); - func_80B44EFC(this, globalCtx); + func_80B44EFC(this, play); func_80B43F0C(this); func_80B4516C(this); this->actor.textId = 0x33CE; @@ -4112,7 +4110,7 @@ void func_80B4CE54(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4CFFC(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (gSaveContext.save.time < 0xD7E1)) { @@ -4122,25 +4120,25 @@ void func_80B4CFFC(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B4D054(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4D054(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); + s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); if (isTalking) { - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); func_80B4CAB0(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp2C && this->actor.update != NULL) { SkelAnime_Update(&this->skelAnime); func_80B45CE0(&this->behaviorInfo); if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) { - func_800B8614(thisx, globalCtx, 350.0f); + func_800B8614(thisx, play, 350.0f); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -4169,7 +4167,7 @@ void func_80B4D15C(EnInvadepoh* this) { this->actor.velocity.y = 0.0f; } -void func_80B4D290(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4D290(EnInvadepoh* this, PlayState* play) { Actor* temp_v1; f32 sp28; @@ -4215,7 +4213,7 @@ void func_80B4D3E4(EnInvadepoh* this) { this->actionFunc = func_80B4D480; } -void func_80B4D480(EnInvadepoh* this, GlobalContext* globalCtx) { +void func_80B4D480(EnInvadepoh* this, PlayState* play) { f32 target; s32 pad2; s32 sp2C = false; @@ -4267,51 +4265,51 @@ void func_80B4D480(EnInvadepoh* this, GlobalContext* globalCtx) { } } -void func_80B4D670(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4D670(Actor* thisx, PlayState* play) { s32 pad; EnInvadepoh* this = THIS; s32 invadepohType; - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { invadepohType = this->actor.params & 7; this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); func_80B45080(); this->actor.update = func_80B4D760; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_uch_Skel_004E50, &object_uch_Anim_001674, - this->jointTable, this->morphTable, 14); + SkelAnime_InitFlex(play, &this->skelAnime, &object_uch_Skel_004E50, &object_uch_Anim_001674, this->jointTable, + this->morphTable, 14); if (invadepohType < 3) { - func_80B453F4(this, globalCtx, invadepohType); + func_80B453F4(this, play, invadepohType); func_80B4D15C(this); } else { - func_80B45460(this, globalCtx); + func_80B45460(this, play); func_80B4D3E4(this); } } } -void func_80B4D760(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4D760(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { SkelAnime_Update(&this->skelAnime); func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); } } -void func_80B4D7B8(GlobalContext* globalCtx) { +void func_80B4D7B8(PlayState* play) { s32 temp_v0; u32 temp_s5; u32 temp_s6; unkStruct80B50350* phi_s2; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (phi_s2 = D_80B50350, i = 0; i < 10; phi_s2++, i++) { if (phi_s2->unk1 > 0) { - temp_v0 = globalCtx->gameplayFrames; + temp_v0 = play->gameplayFrames; temp_s5 = (temp_v0 + ((0x10 * i) & 0xFFU)) & 0x7F; temp_s6 = (u8)(temp_v0 * -0xF); Matrix_Translate(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW); @@ -4319,27 +4317,25 @@ void func_80B4D7B8(GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, phi_s2->unk2); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - temp_v0 = globalCtx->gameplayFrames; + temp_v0 = play->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_02E510); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B4D9B4(Actor* thisx, GlobalContext* globalCtx) { - func_80B4D7B8(globalCtx); +void func_80B4D9B4(Actor* thisx, PlayState* play) { + func_80B4D7B8(play); } -s32 func_80B4D9D8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +s32 func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { return 0; } -void func_80B4D9F4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnInvadepoh* this = THIS; if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) { @@ -4362,10 +4358,10 @@ void func_80B4D9F4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4DB14(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; Gfx* gfx; - GraphicsContext* spCC = globalCtx->state.gfxCtx; + GraphicsContext* spCC = play->state.gfxCtx; OPEN_DISPS(spCC); func_8012C2DC(spCC); @@ -4376,34 +4372,34 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { GraphicsContext* spB8; if (this->alienAlpha == 255) { - func_8012C28C(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, D_80B50400); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + func_8012C28C(play->state.gfxCtx); + AnimatedMat_Draw(play, D_80B50400); + Scene_SetRenderModeXlu(play, 0, 1); gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255); - spCC->polyOpa.p = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + spCC->polyOpa.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, spCC->polyOpa.p); } else { - AnimatedMat_Draw(globalCtx, D_80B50400); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + AnimatedMat_Draw(play, D_80B50400); + Scene_SetRenderModeXlu(play, 1, 2); gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha); - spCC->polyXlu.p = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + spCC->polyXlu.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, spCC->polyXlu.p); } if (this->alienBeamAlpha != 0) { - AnimatedMat_Draw(globalCtx, D_80B503FC); - spB8 = globalCtx->state.gfxCtx; + AnimatedMat_Draw(play, D_80B503FC); + spB8 = play->state.gfxCtx; gfx = spBC = spB8->polyXlu.p; gDPPipeSync(spBC++); gDPSetPrimColor(spBC++, 0, 255, 240, 180, 100, 60); gDPSetEnvColor(spBC++, 255, 255, 255, this->alienBeamAlpha * (150.0f / 255.0f)); Matrix_Mult(&D_80B502A0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(spBC++, object_uch_DL_000080); Matrix_Mult(&D_80B502E0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(spBC++, object_uch_DL_000080); spB8->polyXlu.p = spBC; } @@ -4414,8 +4410,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { &this->actor.shape.rot); Matrix_Scale(this->alienDeathEffectScale.x, this->alienDeathEffectScale.y, this->alienDeathEffectScale.z, MTXMODE_APPLY); - gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(spCC->polyXlu.p++, object_uch_DL_000720); } @@ -4423,7 +4418,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp80; Vec3f sp74; s32 alpha2; - GraphicsContext* sp6C = globalCtx->state.gfxCtx; + GraphicsContext* sp6C = play->state.gfxCtx; u32 pad; gfx = sp6C->polyXlu.p; @@ -4431,7 +4426,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { gDPSetDither(gfx++, G_CD_NOISE); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_NEW); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); Matrix_MultVecZ(60.0f, &sp80); sp74.x = thisx->world.pos.x + sp80.x; sp74.y = thisx->world.pos.y + sp80.y + 68.0f; @@ -4441,12 +4436,11 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { alpha2 = this->alienAlpha * (100.0f / 255.0f); gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, alpha2); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); sp6C->polyXlu.p = gfx; - if ((this->alienAlpha > 128) && func_80B456A8(globalCtx, &sp74)) { - func_800F9824(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, sp74, 10.0f, 9.0f, - 0, 0); + if ((this->alienAlpha > 128) && func_80B456A8(play, &sp74)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); } } @@ -4454,7 +4448,7 @@ void func_80B4DB14(Actor* thisx, GlobalContext* globalCtx) { CLOSE_DISPS(spCC); } -s32 func_80B4E120(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == 5) { EnInvadepoh* this = THIS; rot->x -= this->actor.shape.rot.x; @@ -4462,23 +4456,23 @@ s32 func_80B4E120(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80B4E158(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E158(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4E120, NULL, &this->actor); } -void func_80B4E1B0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E1B0(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); } -s32 func_80B4E200(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == 14) { EnInvadepoh* this = THIS; // both of these needed to match @@ -4494,59 +4488,58 @@ s32 func_80B4E200(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80B4E2AC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnInvadepoh* this = THIS; if (limbIndex == 19) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 14) { Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); } } -void func_80B4E324(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E324(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E958[this->behaviorInfo.unk10.unkF]); gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E944[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4E200, func_80B4E2AC, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B4E3F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E3F0(Actor* thisx, PlayState* play) { s32 pad[2]; Vec3f sp5C; Matrix_Push(); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_NEW); + Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); Matrix_MultVecZ(200.0f, &sp5C); Matrix_Pop(); sp5C.x += thisx->world.pos.x; sp5C.y += thisx->world.pos.y; sp5C.z += thisx->world.pos.z; EnInvadepoh_SetSysMatrix(&sp5C); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZS(((EnInvadepoh*)thisx)->unk304, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); - if (func_80B456A8(globalCtx, &sp5C)) { - func_800F9824(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, - 0); + if (func_80B456A8(play, &sp5C)) { + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 func_80B4E5B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { EnInvadepoh* this = THIS; @@ -4559,7 +4552,7 @@ s32 func_80B4E5B0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80B4E61C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnInvadepoh* this = THIS; if (limbIndex == DOG_LIMB_HEAD) { @@ -4567,18 +4560,18 @@ void func_80B4E61C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void func_80B4E660(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E660(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 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, func_80B4E5B0, func_80B4E61C, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 func_80B4E6E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == 9) { EnInvadepoh* this = THIS; // both of these needed to match @@ -4593,7 +4586,7 @@ s32 func_80B4E6E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void func_80B4E784(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnInvadepoh* this = THIS; if (limbIndex == 9) { @@ -4601,14 +4594,14 @@ void func_80B4E784(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void func_80B4E7BC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B4E7BC(Actor* thisx, PlayState* play) { EnInvadepoh* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E984[this->behaviorInfo.unk10.unkF]); gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E96C[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4E6E4, func_80B4E784, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h index 3a242eace7..8db9b6412a 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -5,9 +5,9 @@ struct EnInvadepoh; -typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, GlobalContext*); -typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, GlobalContext*); -typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, GlobalContext*); +typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, PlayState*); +typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, PlayState*); +typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, PlayState*); #define INVADEPOH_TYPE(x) (x->actor.params >> 4 & 0xF) diff --git a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c index 5696764dd8..4391beecd2 100644 --- a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c +++ b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.c @@ -10,17 +10,17 @@ #define THIS ((EnInvadepohDemo*)thisx) -void EnInvadepohDemo_Init(Actor* thisx, GlobalContext* globalCtx); -void EnInvadepohDemo_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnInvadepohDemo_Update(Actor* thisx, GlobalContext* globalCtx); -void EnInvadepohDemo_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnInvadepohDemo_Init(Actor* thisx, PlayState* play); +void EnInvadepohDemo_Destroy(Actor* thisx, PlayState* play); +void EnInvadepohDemo_Update(Actor* thisx, PlayState* play); +void EnInvadepohDemo_Draw(Actor* thisx, PlayState* play); -void func_80C19AB4(EnInvadepohDemo* this, GlobalContext* globalCtx); -void func_80C19D00(EnInvadepohDemo* this, GlobalContext* globalCtx); -void func_80C19D48(EnInvadepohDemo* this, GlobalContext* globalCtx); -void func_80C19E04(EnInvadepohDemo* this, GlobalContext* globalCtx); -void func_80C19EC0(EnInvadepohDemo* this, GlobalContext* globalCtx); -void func_80C19F7C(EnInvadepohDemo* this, GlobalContext* globalCtx); +void func_80C19AB4(EnInvadepohDemo* this, PlayState* play); +void func_80C19D00(EnInvadepohDemo* this, PlayState* play); +void func_80C19D48(EnInvadepohDemo* this, PlayState* play); +void func_80C19E04(EnInvadepohDemo* this, PlayState* play); +void func_80C19EC0(EnInvadepohDemo* this, PlayState* play); +void func_80C19F7C(EnInvadepohDemo* this, PlayState* play); #if 0 const ActorInit En_Invadepoh_Demo_InitVars = { diff --git a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h index df29dbc602..2841e39db7 100644 --- a/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h +++ b/src/overlays/actors/ovl_En_Invadepoh_Demo/z_en_invadepoh_demo.h @@ -5,7 +5,7 @@ struct EnInvadepohDemo; -typedef void (*EnInvadepohDemoActionFunc)(struct EnInvadepohDemo*, GlobalContext*); +typedef void (*EnInvadepohDemoActionFunc)(struct EnInvadepohDemo*, PlayState*); typedef struct EnInvadepohDemo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c index 3609275335..d7bda51803 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c @@ -10,13 +10,13 @@ #define THIS ((EnInvisibleRuppe*)thisx) -void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx); -void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx); +void EnInvisibleRuppe_Init(Actor* thisx, PlayState* play); +void EnInvisibleRuppe_Destroy(Actor* thisx, PlayState* play); +void EnInvisibleRuppe_Update(Actor* thisx, PlayState* play); -void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx); -void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx); -void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx); +void func_80C258A0(EnInvisibleRuppe* this, PlayState* play); +void func_80C2590C(EnInvisibleRuppe* this, PlayState* play); +void func_80C259E8(EnInvisibleRuppe* this, PlayState* play); const ActorInit En_Invisible_Ruppe_InitVars = { ACTOR_EN_INVISIBLE_RUPPE, @@ -52,44 +52,44 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx) { +void func_80C258A0(EnInvisibleRuppe* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 0.0f, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); } -void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx) { +void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { switch (INVISIBLERUPPE_GET_3(this)) { case 0: play_sound(NA_SE_SY_GET_RUPY); - Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN); + Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN); break; case 1: play_sound(NA_SE_SY_GET_RUPY); - Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_BLUE); + Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_BLUE); break; case 2: play_sound(NA_SE_SY_GET_RUPY); - Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED); break; } if (this->unk_190 >= 0) { - Flags_SetSwitch(globalCtx, this->unk_190); + Flags_SetSwitch(play, this->unk_190); } this->actionFunc = func_80C259E8; } } -void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx) { +void func_80C259E8(EnInvisibleRuppe* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } -void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnInvisibleRuppe_Init(Actor* thisx, PlayState* play) { s32 pad; EnInvisibleRuppe* this = THIS; @@ -99,26 +99,26 @@ void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_190 = -1; } - if ((this->unk_190 >= 0) && Flags_GetSwitch(globalCtx, this->unk_190)) { + if ((this->unk_190 >= 0) && Flags_GetSwitch(play, this->unk_190)) { Actor_MarkForDeath(&this->actor); return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actionFunc = func_80C2590C; } -void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnInvisibleRuppe_Destroy(Actor* thisx, PlayState* play) { EnInvisibleRuppe* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnInvisibleRuppe_Update(Actor* thisx, PlayState* play) { EnInvisibleRuppe* this = THIS; - this->actionFunc(this, globalCtx); - func_80C258A0(this, globalCtx); + this->actionFunc(this, play); + func_80C258A0(this, play); } diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h index eef1acbfe3..c5b9d77339 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h @@ -5,7 +5,7 @@ struct EnInvisibleRuppe; -typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, GlobalContext*); +typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, PlayState*); #define INVISIBLERUPPE_GET_3(thisx) ((thisx)->actor.params & 3) #define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->actor.params & 0x1FC) >> 2) 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 6f29acf4a4..5bef331c23 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -13,30 +13,30 @@ #define THIS ((EnIshi*)thisx) -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnIshi_Update(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 func_8095D804(Actor* thisx, GlobalContext* globalCtx); -void func_8095DABC(Actor* thisx, GlobalContext* globalCtx); -void func_8095DDA8(EnIshi* this, GlobalContext* globalCtx); -void func_8095DE9C(EnIshi* this, GlobalContext* globalCtx); +void func_8095D804(Actor* thisx, PlayState* play); +void func_8095DABC(Actor* thisx, PlayState* play); +void func_8095DDA8(EnIshi* this, PlayState* play); +void func_8095DE9C(EnIshi* this, PlayState* play); void func_8095E5AC(EnIshi* this); -void func_8095E5C0(EnIshi* this, GlobalContext* globalCtx); +void func_8095E5C0(EnIshi* this, PlayState* play); void func_8095E64C(EnIshi* this); -void func_8095E660(EnIshi* this, GlobalContext* globalCtx); +void func_8095E660(EnIshi* this, PlayState* play); void func_8095E934(EnIshi* this); -void func_8095E95C(EnIshi* this, GlobalContext* globalCtx); +void func_8095E95C(EnIshi* this, PlayState* play); void func_8095EA70(EnIshi* this); -void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx); +void func_8095EBDC(EnIshi* this, PlayState* play); void func_8095F060(EnIshi* this); -void func_8095F0A4(EnIshi* this, GlobalContext* globalCtx); +void func_8095F0A4(EnIshi* this, PlayState* play); void func_8095F180(EnIshi* this); -void func_8095F194(EnIshi* this, GlobalContext* globalCtx); -void func_8095F210(EnIshi* this, GlobalContext* globalCtx); -void func_8095F36C(EnIshi* this, GlobalContext* globalCtx); -void func_8095F61C(Actor* thisx, GlobalContext* globalCtx); -void func_8095F654(Actor* thisx, GlobalContext* globalCtx); +void func_8095F194(EnIshi* this, PlayState* play); +void func_8095F210(EnIshi* this, PlayState* play); +void func_8095F36C(EnIshi* this, PlayState* play); +void func_8095F61C(Actor* thisx, PlayState* play); +void func_8095F654(Actor* thisx, PlayState* play); static s16 D_8095F690 = 0; @@ -142,15 +142,15 @@ static u16 D_8095F7AC[] = { NA_SE_PL_PULL_UP_ROCK, NA_SE_PL_PULL_UP_BIGROCK }; static EnIshiUnkFunc D_8095F7B0[] = { func_8095F210, func_8095F36C }; -void func_8095D6E0(Actor* thisx, GlobalContext* globalCtx) { +void func_8095D6E0(Actor* thisx, PlayState* play) { EnIshi* this = THIS; - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit[ENISHI_GET_1(&this->actor)]); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit[ENISHI_GET_1(&this->actor)]); Collider_UpdateCylinder(&this->actor, &this->collider); } -s32 func_8095D758(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { +s32 func_8095D758(EnIshi* this, PlayState* play, f32 arg2) { Vec3f sp24; s32 sp20; @@ -158,7 +158,7 @@ s32 func_8095D758(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { sp24.y = this->actor.world.pos.y + 30.0f; sp24.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp20, &this->actor, &sp24); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp20, &this->actor, &sp24); if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.world.pos.y = this->actor.floorHeight + arg2; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -167,7 +167,7 @@ s32 func_8095D758(EnIshi* this, GlobalContext* globalCtx, f32 arg2) { return false; } -void func_8095D804(Actor* thisx, GlobalContext* globalCtx) { +void func_8095D804(Actor* thisx, PlayState* play) { EnIshi* this = THIS; s32 i; s16 temp; @@ -203,12 +203,12 @@ void func_8095D804(Actor* thisx, GlobalContext* globalCtx) { spC4.y += (Rand_ZeroOne() * 7.0f) + 6.0f; spC4.z += (Rand_ZeroOne() - 0.5f) * 11.0f; - EffectSsKakera_Spawn(globalCtx, &spB8, &spC4, &spB8, -420, ((s32)Rand_Next() > 0) ? 65 : 33, 30, 5, 0, - D_8095F74C[i], 3, 10, 40, -1, temp, phi_s4); + EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -420, ((s32)Rand_Next() > 0) ? 65 : 33, 30, 5, 0, D_8095F74C[i], + 3, 10, 40, -1, temp, phi_s4); } } -void func_8095DABC(Actor* thisx, GlobalContext* globalCtx) { +void func_8095DABC(Actor* thisx, PlayState* play) { EnIshi* this = THIS; Vec3f spD8; Vec3f spCC; @@ -254,12 +254,12 @@ void func_8095DABC(Actor* thisx, GlobalContext* globalCtx) { phi_v1 = -320; } - EffectSsKakera_Spawn(globalCtx, &spCC, &spD8, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, D_8095F758[i], - 5, 2, 70, 0, GAMEPLAY_FIELD_KEEP, gameplay_field_keep_DL_006420); + EffectSsKakera_Spawn(play, &spCC, &spD8, &this->actor.world.pos, phi_v1, phi_v0, 30, 5, 0, D_8095F758[i], 5, 2, + 70, 0, GAMEPLAY_FIELD_KEEP, gameplay_field_keep_DL_006420); } } -void func_8095DDA8(EnIshi* this, GlobalContext* globalCtx) { +void func_8095DDA8(EnIshi* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); @@ -272,10 +272,10 @@ void func_8095DDA8(EnIshi* this, GlobalContext* globalCtx) { sp2C.y += 2.0f * this->actor.velocity.y; sp2C.z -= 2.0f * this->actor.velocity.z; } - func_800BBFB0(globalCtx, &sp2C, 60.0f, 3, 80, 60, 1); + func_800BBFB0(play, &sp2C, 60.0f, 3, 80, 60, 1); } -void func_8095DE9C(EnIshi* this, GlobalContext* globalCtx) { +void func_8095DE9C(EnIshi* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); @@ -288,16 +288,16 @@ void func_8095DE9C(EnIshi* this, GlobalContext* globalCtx) { sp2C.y += 2.0f * this->actor.velocity.y; sp2C.z -= 2.0f * this->actor.velocity.z; } - func_800BBFB0(globalCtx, &sp2C, 140.0f, 10, 180, 90, 1); + func_800BBFB0(play, &sp2C, 140.0f, 10, 180, 90, 1); } -void func_8095DF90(EnIshi* this, GlobalContext* globalCtx) { +void func_8095DF90(EnIshi* this, PlayState* play) { if (!ENISHI_GET_1(&this->actor) && !ENISHI_GET_100(&this->actor)) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, ENISHI_GET_F0(&this->actor) * 0x10); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, ENISHI_GET_F0(&this->actor) * 0x10); } } -void func_8095DFF0(EnIshi* this, GlobalContext* globalCtx) { +void func_8095DFF0(EnIshi* this, PlayState* play) { s32 pad; s32 temp = D_8095F76C[ENISHI_GET_70(&this->actor)]; Actor* sp3C; @@ -307,7 +307,7 @@ void func_8095DFF0(EnIshi* this, GlobalContext* globalCtx) { s16 temp_v1_2; if (temp >= 0) { - sp3C = Item_DropCollectible(globalCtx, &this->actor.world.pos, temp | (ENISHI_GET_FE00(&this->actor) << 8)); + sp3C = Item_DropCollectible(play, &this->actor.world.pos, temp | (ENISHI_GET_FE00(&this->actor) << 8)); if (sp3C != NULL) { Matrix_Push(); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); @@ -346,11 +346,11 @@ void func_8095E180(Vec3f* arg0, f32 arg1) { arg0->z -= arg0->z * arg1; } -void func_8095E204(EnIshi* this, GlobalContext* globalCtx) { +void func_8095E204(EnIshi* this, PlayState* play) { s32 i; for (i = 0; i < 3; i++) { - if (Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, + if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, this->actor.cutscene, this->actor.unk20, NULL) == NULL) { break; @@ -358,21 +358,21 @@ void func_8095E204(EnIshi* this, GlobalContext* globalCtx) { } } -s32 func_8095E2B0(EnIshi* this, GlobalContext* globalCtx) { +s32 func_8095E2B0(EnIshi* this, PlayState* play) { s32 pad; WaterBox* sp30; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, - &sp30, &sp28) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + &sp28) && (this->actor.world.pos.y < sp2C)) { return true; } return false; } -void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Init(Actor* thisx, PlayState* play) { s32 pad; EnIshi* this = THIS; s32 sp34 = ENISHI_GET_1(&this->actor); @@ -384,7 +384,7 @@ void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain[sp34]); - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { this->actor.uncullZoneForward += 1000.0f; } @@ -393,9 +393,9 @@ void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetScale(&this->actor, D_8095F6B8[sp34]); - func_8095D6E0(&this->actor, globalCtx); + func_8095D6E0(&this->actor, play); - if ((sp34 == 1) && Flags_GetSwitch(globalCtx, ENISHI_GET_FE00(&this->actor))) { + if ((sp34 == 1) && Flags_GetSwitch(play, ENISHI_GET_FE00(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } @@ -412,16 +412,16 @@ void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = D_8095F6C0[sp34]; - if ((sp30 == 0) && !func_8095D758(this, globalCtx, 0)) { + if ((sp30 == 0) && !func_8095D758(this, play, 0)) { Actor_MarkForDeath(&this->actor); return; } - if (func_8095E2B0(this, globalCtx)) { + if (func_8095E2B0(this, play)) { this->unk_197 |= 1; } - this->unk_196 = Object_GetIndex(&globalCtx->objectCtx, D_8095F6E8[ENISHI_GET_8(&this->actor)]); + this->unk_196 = Object_GetIndex(&play->objectCtx, D_8095F6E8[ENISHI_GET_8(&this->actor)]); if (this->unk_196 < 0) { Actor_MarkForDeath(&this->actor); return; @@ -430,19 +430,19 @@ void EnIshi_Init(Actor* thisx, GlobalContext* globalCtx) { func_8095E5AC(this); } -void EnIshi_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnIshi_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnIshi* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_8095E5AC(EnIshi* this) { this->actionFunc = func_8095E5C0; } -void func_8095E5C0(EnIshi* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_196)) { +void func_8095E5C0(EnIshi* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->unk_196)) { this->actor.objBankIndex = this->unk_196; this->actor.flags &= ~ACTOR_FLAG_10; if (!ENISHI_GET_8(&this->actor)) { @@ -458,7 +458,7 @@ void func_8095E64C(EnIshi* this) { this->actionFunc = func_8095E660; } -void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { +void func_8095E660(EnIshi* this, PlayState* play) { s32 pad; s32 sp38 = ENISHI_GET_1(&this->actor); s32 sp34 = (this->collider.base.acFlags & AC_HIT) != 0; @@ -468,11 +468,11 @@ void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { func_8095E934(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, D_8095F7AC[sp38]); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, D_8095F7AC[sp38]); if (ENISHI_GET_2(&this->actor)) { - func_8095E204(this, globalCtx); + func_8095E204(this, play); } this->actor.shape.shadowDraw = ActorShadow_DrawCircle; return; @@ -480,14 +480,14 @@ void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { if (sp34 && (sp38 == 0) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x508)) { if (sp30 != 0) { - func_8095DFF0(this, globalCtx); + func_8095DFF0(this, play); func_8095F060(this); return; } - func_8095DF90(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp38], D_8095F6D0[sp38]); - D_8095F6D8[sp38](&this->actor, globalCtx); - D_8095F6E0[sp38](this, globalCtx); + func_8095DF90(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, D_8095F6D4[sp38], D_8095F6D0[sp38]); + D_8095F6D8[sp38](&this->actor, play); + D_8095F6E0[sp38](this, play); Actor_MarkForDeath(&this->actor); return; } @@ -506,14 +506,14 @@ void func_8095E660(EnIshi* this, GlobalContext* globalCtx) { } } - 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 < 90.0f) && (sp30 == 0)) { if (sp38 == 1) { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 80.0f, 20.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 80.0f, 20.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 50.0f, 10.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 50.0f, 10.0f); } } } @@ -525,27 +525,27 @@ void func_8095E934(EnIshi* this) { this->actor.flags |= ACTOR_FLAG_10; } -void func_8095E95C(EnIshi* this, GlobalContext* globalCtx) { +void func_8095E95C(EnIshi* this, PlayState* play) { s32 pad; Vec3f sp30; s32 sp2C; - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; if (ENISHI_GET_1(&this->actor) == 1) { - Flags_SetSwitch(globalCtx, ENISHI_GET_FE00(&this->actor)); + Flags_SetSwitch(play, ENISHI_GET_FE00(&this->actor)); } func_8095EA70(this); func_8095E14C(this); func_8095E180(&this->actor.velocity, D_8095F6C8[ENISHI_GET_1(&this->actor)]); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); } else { sp30.x = this->actor.world.pos.x; sp30.y = this->actor.world.pos.y + 20.0f; sp30.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); } } @@ -568,7 +568,7 @@ void func_8095EA70(EnIshi* this) { this->actionFunc = func_8095EBDC; } -void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { +void func_8095EBDC(EnIshi* this, PlayState* play) { s32 pad; s32 sp70 = ENISHI_GET_1(&this->actor); s16 temp_s0; @@ -584,16 +584,16 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { this->unk_194--; if ((this->actor.bgCheckFlags & 9) || temp_v0 || (this->unk_194 <= 0)) { - func_8095DF90(this, globalCtx); - D_8095F6D8[sp70](&this->actor, globalCtx); + func_8095DF90(this, play); + D_8095F6D8[sp70](&this->actor, play); if (!(this->actor.bgCheckFlags & 0x20)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp70], D_8095F6D0[sp70]); - D_8095F6E0[sp70](this, globalCtx); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, D_8095F6D4[sp70], D_8095F6D0[sp70]); + D_8095F6E0[sp70](this, play); } if (sp70 == 1) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x4350); Quake_SetQuakeValues(quake, 3, 0, 0, 0); @@ -610,20 +610,20 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { sp58.x = this->actor.world.pos.x; sp58.y = this->actor.world.pos.y + this->actor.depthInWater; sp58.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 350); - EffectSsGRipple_Spawn(globalCtx, &sp58, 150, 650, 0); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 350); + EffectSsGRipple_Spawn(play, &sp58, 150, 650, 0); } else { sp58.y = this->actor.world.pos.y + this->actor.depthInWater; for (phi_s0 = 0, i = 0; i < 11; i++, phi_s0 += 0x1746) { sp58.x = (Math_SinS((s32)(Rand_ZeroOne() * 2000.0f) + phi_s0) * 50.0f) + this->actor.world.pos.x; sp58.z = (Math_CosS((s32)(Rand_ZeroOne() * 2000.0f) + phi_s0) * 50.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 350); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 350); } sp58.x = this->actor.world.pos.x; sp58.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp58, 500, 900, 4); + EffectSsGRipple_Spawn(play, &sp58, 500, 900, 4); } this->actor.terminalVelocity = -6.0f; @@ -635,7 +635,7 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { D_8095F690 >>= 2; D_8095F694 >>= 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 &= ~0x40; } @@ -645,10 +645,10 @@ void func_8095EBDC(EnIshi* this, GlobalContext* globalCtx) { Actor_UpdatePos(&this->actor); this->actor.shape.rot.x += D_8095F690; this->actor.shape.rot.y += D_8095F694; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); 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 func_8095F060(EnIshi* this) { @@ -657,15 +657,15 @@ void func_8095F060(EnIshi* this) { this->actionFunc = func_8095F0A4; } -void func_8095F0A4(EnIshi* this, GlobalContext* globalCtx) { +void func_8095F0A4(EnIshi* this, PlayState* play) { s32 pad; s32 sp28 = ENISHI_GET_1(&this->actor); if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, D_8095F6D4[sp28], D_8095F6D0[sp28]); - D_8095F6D8[sp28](&this->actor, globalCtx); - D_8095F6E0[sp28](this, globalCtx); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, D_8095F6D4[sp28], D_8095F6D0[sp28]); + D_8095F6D8[sp28](&this->actor, play); + D_8095F6E0[sp28](this, play); this->actor.draw = NULL; func_8095F180(this); } else { @@ -677,7 +677,7 @@ void func_8095F180(EnIshi* this) { this->actionFunc = func_8095F194; } -void func_8095F194(EnIshi* this, GlobalContext* globalCtx) { +void func_8095F194(EnIshi* this, PlayState* play) { if (this->actor.cutscene < 0) { Actor_MarkForDeath(&this->actor); } else if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { @@ -685,48 +685,48 @@ void func_8095F194(EnIshi* this, GlobalContext* globalCtx) { } } -void EnIshi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnIshi_Update(Actor* thisx, PlayState* play) { EnIshi* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_8095F210(EnIshi* this, GlobalContext* globalCtx) { +void func_8095F210(EnIshi* this, PlayState* play) { s32 pad; s32 sp28; if ((this->actor.projectedPos.z <= 1200.0f) || ((this->unk_197 & 1) && (this->actor.projectedPos.z < 1300.0f))) { - Gfx_DrawDListOpa(globalCtx, gameplay_field_keep_DL_0066B0); + Gfx_DrawDListOpa(play, gameplay_field_keep_DL_0066B0); return; } if (this->actor.projectedPos.z < 1300.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp28 = (1300.0f - this->actor.projectedPos.z) * 2.55f; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s32)sp28); gSPDisplayList(POLY_XLU_DISP++, gameplay_field_keep_DL_006760); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_8095F36C(EnIshi* this, GlobalContext* globalCtx) { +void func_8095F36C(EnIshi* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actor.projectedPos.z <= 2150.0f) || ((this->unk_197 & 1) && (this->actor.projectedPos.z < 2250.0f))) { this->actor.shape.shadowAlpha = 160; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_field_keep_DL_0061E8); } else if (this->actor.projectedPos.z < 2250.0f) { @@ -734,25 +734,25 @@ void func_8095F36C(EnIshi* this, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = sp20 * 0.627451f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s32)sp20); gSPDisplayList(POLY_XLU_DISP++, gameplay_field_keep_DL_0061E8); } else { this->actor.shape.shadowAlpha = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8095F61C(Actor* thisx, GlobalContext* globalCtx) { +void func_8095F61C(Actor* thisx, PlayState* play) { EnIshi* this = THIS; - D_8095F7B0[ENISHI_GET_1(&this->actor)](this, globalCtx); + D_8095F7B0[ENISHI_GET_1(&this->actor)](this, play); } -void func_8095F654(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_ishi_DL_0009B0); +void func_8095F654(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_ishi_DL_0009B0); } 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 404fec2b1b..0652b84bf1 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -5,9 +5,9 @@ struct EnIshi; -typedef void (*EnIshiActionFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiUnkFunc)(struct EnIshi*, GlobalContext*); -typedef void (*EnIshiUnkFunc2)(Actor*, GlobalContext*); +typedef void (*EnIshiActionFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiUnkFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiUnkFunc2)(Actor*, PlayState*); #define ENISHI_GET_1(thisx) ((thisx)->params & 1) #define ENISHI_GET_2(thisx) (((thisx)->params >> 1) & 1) diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index 5659e5ba9c..153edf8539 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -11,16 +11,16 @@ #define THIS ((EnJa*)thisx) -void EnJa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJa_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJa_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJa_Init(Actor* thisx, PlayState* play); +void EnJa_Destroy(Actor* thisx, PlayState* play); +void EnJa_Update(Actor* thisx, PlayState* play); +void EnJa_Draw(Actor* thisx, PlayState* play); -void func_80BC21A8(EnJa* this, GlobalContext* globalCtx); -void func_80BC22F4(EnJa* this, GlobalContext* globalCtx); +void func_80BC21A8(EnJa* this, PlayState* play); +void func_80BC22F4(EnJa* this, PlayState* play); void func_80BC2EA4(EnJa* this); -void func_80BC32D8(EnJa* this, GlobalContext* globalCtx); -void func_80BC3594(EnJa* this, GlobalContext* globalCtx); +void func_80BC32D8(EnJa* this, PlayState* play); +void func_80BC3594(EnJa* this, PlayState* play); static u8 D_80BC35F0[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(3, 0x05 - 0x04), @@ -112,18 +112,18 @@ s32 func_80BC192C(EnJa* this, s32 arg1) { return ret; } -void func_80BC1984(EnJa* this, GlobalContext* globalCtx) { +void func_80BC1984(EnJa* this, PlayState* play) { s32 pad[2]; Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.height = (s16)fabsf(this->actor.focus.pos.y - this->actor.world.pos.y) + 5; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80BC19FC(EnJa* this, GlobalContext* globalCtx) { +s32 func_80BC19FC(EnJa* this, PlayState* play) { s32 ret = false; - if ((this->unk_340 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if ((this->unk_340 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_340, 0, 7); this->actionFunc = func_80BC22F4; ret = true; @@ -141,8 +141,8 @@ void func_80BC1A68(EnJa* this) { } } -s32 func_80BC1AE0(EnJa* this, GlobalContext* globalCtx) { - Actor* ja = SubS_FindNearestActor(&this->actor, globalCtx, ACTORCAT_NPC, ACTOR_EN_JA); +s32 func_80BC1AE0(EnJa* this, PlayState* play) { + Actor* ja = SubS_FindNearestActor(&this->actor, play, ACTORCAT_NPC, ACTOR_EN_JA); Vec3f sp30; Vec3f sp24; @@ -157,11 +157,11 @@ s32 func_80BC1AE0(EnJa* this, GlobalContext* globalCtx) { return this->actor.child; } -Player* func_80BC1B50(EnJa* this, GlobalContext* globalCtx) { - return GET_PLAYER(globalCtx); +Player* func_80BC1B50(EnJa* this, PlayState* play) { + return GET_PLAYER(play); } -s32 func_80BC1B60(EnJa* this, GlobalContext* globalCtx) { +s32 func_80BC1B60(EnJa* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; @@ -192,11 +192,11 @@ s32 func_80BC1B60(EnJa* this, GlobalContext* globalCtx) { return true; } -s32 func_80BC1D70(EnJa* this, GlobalContext* globalCtx) { +s32 func_80BC1D70(EnJa* this, PlayState* play) { if (this->unk_340 & 8) { - this->unk_1D8.player = func_80BC1B50(this, globalCtx); + this->unk_1D8.player = func_80BC1B50(this, play); if (this->unk_1D8.player != NULL) { - func_80BC1B60(this, globalCtx); + func_80BC1B60(this, play); } this->unk_340 &= ~0x10; this->unk_340 |= 0x20; @@ -214,14 +214,14 @@ s32 func_80BC1D70(EnJa* this, GlobalContext* globalCtx) { return true; } -void func_80BC1E40(EnJa* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 sp20 = Message_GetState(&globalCtx->msgCtx); +void func_80BC1E40(EnJa* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp20 = Message_GetState(&play->msgCtx); f32 phi_f0; - if (((globalCtx->msgCtx.currentTextId < 0xFF) || (globalCtx->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && + if (((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && (this->unk_374 == 3) && (&this->actor == player->targetActor)) { - if ((globalCtx->state.frames % 2) == 0) { + if ((play->state.frames % 2) == 0) { if (this->unk_348 != 0.0f) { this->unk_348 = 0.0f; } else { @@ -239,10 +239,10 @@ void func_80BC1E40(EnJa* this, GlobalContext* globalCtx) { this->unk_374 = sp20; } -s32 func_80BC1FC8(EnJa* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80BC1AE0(this, globalCtx)) { + if (func_80BC1AE0(this, play)) { SubS_UpdateFlags(&this->unk_340, 3, 7); this->unk_340 |= 0x10; func_80BC192C(this, 5); @@ -252,10 +252,10 @@ s32 func_80BC1FC8(EnJa* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BC203C(EnJa* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80BC1AE0(this, globalCtx)) { + if (func_80BC1AE0(this, play)) { if (ENJA_GET_3(&this->actor) == 0) { func_80BC192C(this, 1); } else { @@ -269,41 +269,41 @@ s32 func_80BC203C(EnJa* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BC20D0(EnJa* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->unk_340 = 0; switch (arg2->result) { case 1: - ret = func_80BC1FC8(this, globalCtx, arg2); + ret = func_80BC1FC8(this, play, arg2); if (ret == 1) {} break; case 2: - ret = func_80BC203C(this, globalCtx, arg2); + ret = func_80BC203C(this, play, arg2); break; } return ret; } -s32 func_80BC213C(EnJa* this, GlobalContext* globalCtx) { +s32 func_80BC213C(EnJa* this, PlayState* play) { return true; } -void func_80BC2150(EnJa* this, GlobalContext* globalCtx) { +void func_80BC2150(EnJa* this, PlayState* play) { if ((this->unk_1D8.unk_00 == 1) || (this->unk_1D8.unk_00 == 2)) { - func_80BC213C(this, globalCtx); + func_80BC213C(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } -void func_80BC21A8(EnJa* this, GlobalContext* globalCtx) { +void func_80BC21A8(EnJa* this, PlayState* play) { ScheduleResult sp18; this->unk_35C = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BC35F0, &sp18) || - ((this->unk_1D8.unk_00 != sp18.result) && !func_80BC20D0(this, globalCtx, &sp18))) { + if (!Schedule_RunScript(play, D_80BC35F0, &sp18) || + ((this->unk_1D8.unk_00 != sp18.result) && !func_80BC20D0(this, play, &sp18))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp18.result = 0; @@ -312,10 +312,10 @@ void func_80BC21A8(EnJa* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; } this->unk_1D8.unk_00 = sp18.result; - func_80BC2150(this, globalCtx); + func_80BC2150(this, play); } -s32* func_80BC2274(EnJa* this, GlobalContext* globalCtx) { +s32* func_80BC2274(EnJa* this, PlayState* play) { switch (this->unk_1D8.unk_00) { case 1: if (ENJA_GET_3(&this->actor) == 0) { @@ -332,8 +332,8 @@ s32* func_80BC2274(EnJa* this, GlobalContext* globalCtx) { return D_80BC360C; } -void func_80BC22F4(EnJa* this, GlobalContext* globalCtx) { - if (func_8010BF58(&this->actor, globalCtx, func_80BC2274(this, globalCtx), this->unk_368, &this->unk_1D8.unk_04)) { +void func_80BC22F4(EnJa* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, func_80BC2274(this, play), this->unk_368, &this->unk_1D8.unk_04)) { this->unk_340 &= ~8; SubS_UpdateFlags(&this->unk_340, 3, 7); this->unk_1D8.unk_04 = 0; @@ -343,15 +343,14 @@ void func_80BC22F4(EnJa* this, GlobalContext* globalCtx) { } } -void EnJa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJa_Init(Actor* thisx, PlayState* play) { EnJa* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, - 16); + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, 16); this->unk_36C = -1; func_80BC192C(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; @@ -364,52 +363,52 @@ void EnJa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80BC21A8; } -void EnJa_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJa_Destroy(Actor* thisx, PlayState* play) { EnJa* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnJa_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJa_Update(Actor* thisx, PlayState* play) { EnJa* this = THIS; f32 height; f32 radius; - func_80BC19FC(this, globalCtx); + func_80BC19FC(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1D8.unk_00 != 0) { func_80BC1900(this); func_80BC1A68(this); - func_80BC1D70(this, globalCtx); + func_80BC1D70(this, play); radius = this->collider.dim.radius + 30; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_340 & 7); + func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_340 & 7); if (this->unk_1D8.unk_00 != 2) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } - func_80BC1984(this, globalCtx); + func_80BC1984(this, play); } if (this->unk_1D8.unk_00 == 1) { - func_80BC32D8(this, globalCtx); + func_80BC32D8(this, play); } } -s32 EnJa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnJa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnJa* this = THIS; if (limbIndex == 15) { - func_80BC1E40(this, globalCtx); + func_80BC1E40(this, play); } return false; } -void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80BC3774 = { -87.0f, 444.0f, -49.0f }; static Vec3f D_80BC3780 = { 600.0f, 0.0f, 0.0f }; static Vec3f D_80BC378C = { 400.0f, 0.0f, -400.0f }; @@ -423,27 +422,27 @@ void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVec3f(&D_80BC3780, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } else if ((this->unk_340 & 0x40) && (limbIndex == 11)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_TranslateRotateZYX(&D_80BC3774, &D_80BC37A4); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_00BA30); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->unk_1D8.unk_00 == 1) { if ((limbIndex == 11) && (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) || ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(D_80BC378C.x, D_80BC378C.y, D_80BC378C.z, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPPipeSync(POLY_OPA_DISP++); @@ -469,21 +468,20 @@ void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec break; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_00BCC8); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 14) { if ((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 18.0f)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(D_80BC3798.x, D_80BC3798.y, D_80BC3798.z, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gDPPipeSync(POLY_OPA_DISP++); @@ -509,19 +507,19 @@ void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec break; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_00BCC8); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } } -void EnJa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnJa* this = THIS; s32 stepRot; s32 overrideRot; @@ -568,7 +566,7 @@ void EnJa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnJa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJa_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 D_80BC37AC[] = { { 200, 0, 80, 0 }, { 0, 130, 220, 0 }, @@ -594,28 +592,28 @@ void EnJa_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (this->unk_1D8.unk_00 != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, D_80BC37AC[phi_t2].r, D_80BC37AC[phi_t2].g, - D_80BC37AC[phi_t2].b, D_80BC37AC[phi_t2].a)); + Gfx_EnvColor(play->state.gfxCtx, D_80BC37AC[phi_t2].r, D_80BC37AC[phi_t2].g, D_80BC37AC[phi_t2].b, + D_80BC37AC[phi_t2].a)); gSPSegment(POLY_OPA_DISP++, 0x09, - Gfx_EnvColor(globalCtx->state.gfxCtx, D_80BC37B4[phi_t2].r, D_80BC37B4[phi_t2].g, - D_80BC37B4[phi_t2].b, D_80BC37B4[phi_t2].a)); + Gfx_EnvColor(play->state.gfxCtx, D_80BC37B4[phi_t2].r, D_80BC37B4[phi_t2].g, D_80BC37B4[phi_t2].b, + D_80BC37B4[phi_t2].a)); gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_80BC37BC[this->unk_362])); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJa_OverrideLimbDraw, EnJa_PostLimbDraw, EnJa_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->unk_1D8.unk_00 == 1) { - func_80BC3594(this, globalCtx); + func_80BC3594(this, play); } } @@ -691,7 +689,7 @@ void func_80BC3154(EnJa* this, EnJaStruct* ptr) { } } -void func_80BC32D8(EnJa* this, GlobalContext* globalCtx) { +void func_80BC32D8(EnJa* this, PlayState* play) { EnJaStruct* phi_s0 = &this->unk_234[0]; s32 i; @@ -719,14 +717,14 @@ void func_80BC32D8(EnJa* this, GlobalContext* globalCtx) { } } -void func_80BC33C0(EnJaStruct* ptr, GlobalContext* globalCtx) { +void func_80BC33C0(EnJaStruct* ptr, PlayState* play) { s32 pad; if (((ptr->unk_0E < 0) || (ptr->unk_0E >= 19)) && ((ptr->unk_0E < 83) || (ptr->unk_0E >= 103))) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); switch (ptr->unk_0C) { @@ -751,18 +749,18 @@ void func_80BC33C0(EnJaStruct* ptr, GlobalContext* globalCtx) { break; } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_00BCC8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80BC3594(EnJa* this, GlobalContext* globalCtx) { +void func_80BC3594(EnJa* this, PlayState* play) { EnJaStruct* phi_s0 = this->unk_234; s32 i; for (i = 0; i < ARRAY_COUNT(this->unk_234); i++, phi_s0++) { - func_80BC33C0(phi_s0, globalCtx); + func_80BC33C0(phi_s0, play); } } diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.h b/src/overlays/actors/ovl_En_Ja/z_en_ja.h index 561f76f555..078863b48b 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.h +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.h @@ -5,7 +5,7 @@ struct EnJa; -typedef void (*EnJaActionFunc)(struct EnJa*, GlobalContext*); +typedef void (*EnJaActionFunc)(struct EnJa*, PlayState*); #define ENJA_GET_3(thisx) (((thisx)->params & 3) & 0xFF) diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 6afe9c1a09..8647b553bb 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -11,14 +11,14 @@ #define THIS ((EnJcMato*)thisx) -void EnJcMato_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJcMato_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJcMato_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJcMato_Init(Actor* thisx, PlayState* play); +void EnJcMato_Destroy(Actor* thisx, PlayState* play); +void EnJcMato_Update(Actor* thisx, PlayState* play); +void EnJcMato_Draw(Actor* thisx, PlayState* play); -s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx); +s32 EnJcMato_CheckForHit(EnJcMato* this, PlayState* play); void EnJcMato_SetupIdle(EnJcMato* this); -void EnJcMato_Idle(EnJcMato* this, GlobalContext* globalCtx); +void EnJcMato_Idle(EnJcMato* this, PlayState* play); const ActorInit En_Jc_Mato_InitVars = { ACTOR_EN_JC_MATO, @@ -87,19 +87,19 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx) { +s32 EnJcMato_CheckForHit(EnJcMato* this, PlayState* play) { this->collider.dim.worldSphere.center.x = this->pos.x; this->collider.dim.worldSphere.center.y = this->pos.y; this->collider.dim.worldSphere.center.z = this->pos.z; if ((this->collider.base.acFlags & AC_HIT) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { this->collider.base.acFlags &= ~AC_HIT; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - globalCtx->interfaceCtx.unk_25C = 1; + play->interfaceCtx.unk_25C = 1; this->hitFlag = true; return 1; } else { - 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); return 0; } } @@ -108,7 +108,7 @@ void EnJcMato_SetupIdle(EnJcMato* this) { this->actionFunc = EnJcMato_Idle; } -void EnJcMato_Idle(EnJcMato* this, GlobalContext* globalCtx) { +void EnJcMato_Idle(EnJcMato* this, PlayState* play) { s16 shouldDespawn; if (this->hitFlag) { @@ -124,12 +124,12 @@ void EnJcMato_Idle(EnJcMato* this, GlobalContext* globalCtx) { } } -void EnJcMato_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJcMato_Init(Actor* thisx, PlayState* play) { EnJcMato* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - Collider_InitSphere(globalCtx, &this->collider); - Collider_SetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); this->collider.dim.worldSphere.radius = 0xF; this->actor.colChkInfo.damageTable = &sDamageTable; Actor_SetScale(&this->actor, 0.008f); @@ -138,30 +138,30 @@ void EnJcMato_Init(Actor* thisx, GlobalContext* globalCtx) { EnJcMato_SetupIdle(this); } -void EnJcMato_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJcMato_Destroy(Actor* thisx, PlayState* play) { EnJcMato* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -void EnJcMato_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJcMato_Update(Actor* thisx, PlayState* play) { EnJcMato* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(gSaveContext.eventInf[4] & 1)) { - EnJcMato_CheckForHit(this, globalCtx); + EnJcMato_CheckForHit(this, play); } } static Vec3f movement = { 0.0f, -2500.0f, 0.0f }; -void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJcMato_Draw(Actor* thisx, PlayState* play) { EnJcMato* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tru_DL_000390); Matrix_MultVec3f(&movement, &this->pos); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.h b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.h index cb1e69ac8e..165a768e2c 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.h +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.h @@ -5,7 +5,7 @@ struct EnJcMato; -typedef void (*EnJcMatoActionFunc)(struct EnJcMato*, GlobalContext*); +typedef void (*EnJcMatoActionFunc)(struct EnJcMato*, PlayState*); typedef struct EnJcMato { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 5c7d0d4fea..a66992637e 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -15,24 +15,24 @@ #define FLAG_LOOKING_AT_PLAYER (1 << 2) #define FLAG_DRUM_SPAWNED (1 << 3) -void EnJg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJg_Init(Actor* thisx, PlayState* play); +void EnJg_Destroy(Actor* thisx, PlayState* play); +void EnJg_Update(Actor* thisx, PlayState* play); +void EnJg_Draw(Actor* thisx, PlayState* play); -void EnJg_GoronShrineTalk(EnJg* this, GlobalContext* globalCtx); -void EnJg_GoronShrineCheer(EnJg* this, GlobalContext* globalCtx); -void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, GlobalContext* globalCtx); -void EnJg_Walk(EnJg* this, GlobalContext* globalCtx); -void EnJg_Talk(EnJg* this, GlobalContext* globalCtx); -void EnJg_SetupWalk(EnJg* this, GlobalContext* globalCtx); -void EnJg_FrozenIdle(EnJg* this, GlobalContext* globalCtx); -void EnJg_EndFrozenInteraction(EnJg* this, GlobalContext* globalCtx); -void EnJg_TeachLullabyIntro(EnJg* this, GlobalContext* globalCtx); -void EnJg_LullabyIntroCutsceneAction(EnJg* this, GlobalContext* globalCtx); +void EnJg_GoronShrineTalk(EnJg* this, PlayState* play); +void EnJg_GoronShrineCheer(EnJg* this, PlayState* play); +void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play); +void EnJg_Walk(EnJg* this, PlayState* play); +void EnJg_Talk(EnJg* this, PlayState* play); +void EnJg_SetupWalk(EnJg* this, PlayState* play); +void EnJg_FrozenIdle(EnJg* this, PlayState* play); +void EnJg_EndFrozenInteraction(EnJg* this, PlayState* play); +void EnJg_TeachLullabyIntro(EnJg* this, PlayState* play); +void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play); s32 EnJg_GetNextTextId(EnJg* this); -s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx); -void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, GlobalContext* globalCtx); +s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play); +void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play); typedef enum { /* 0 */ EN_JG_ANIMATION_IDLE, @@ -172,8 +172,8 @@ static Vec3f sBreathAccelOffset = { 0.0f, 0.0f, -0.070000000298f }; * returning a pointer to the specified Goron so the camera * can focus on them. */ -Actor* EnJg_GetShrineGoronToFocusOn(GlobalContext* globalCtx, u8 focusedShrineGoronParam) { - Actor* actorIterator = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +Actor* EnJg_GetShrineGoronToFocusOn(PlayState* play, u8 focusedShrineGoronParam) { + Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actorIterator != NULL) { if ((actorIterator->id == ACTOR_EN_S_GORO) && @@ -187,14 +187,14 @@ Actor* EnJg_GetShrineGoronToFocusOn(GlobalContext* globalCtx, u8 focusedShrineGo return NULL; } -void EnJg_UpdateCollision(EnJg* this, GlobalContext* globalCtx) { +void EnJg_UpdateCollision(EnJg* this, PlayState* play) { 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; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 30.0f, 30.0f, 7); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, 7); } s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ) { @@ -293,7 +293,7 @@ void EnJg_SetupGoronShrineCheer(EnJg* this) { } } -void EnJg_SetupTalk(EnJg* this, GlobalContext* globalCtx) { +void EnJg_SetupTalk(EnJg* this, PlayState* play) { switch (this->textId) { case 0xDAC: // What was I doing? this->animationIndex = EN_JG_ANIMATION_SHAKING_HEAD; @@ -342,37 +342,37 @@ void EnJg_SetupTalk(EnJg* this, GlobalContext* globalCtx) { } } -void EnJg_Idle(EnJg* this, GlobalContext* globalCtx) { - EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, globalCtx); +void EnJg_Idle(EnJg* this, PlayState* play) { + EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, play); } -void EnJg_GoronShrineIdle(EnJg* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnJg_GoronShrineIdle(EnJg* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->flags |= FLAG_LOOKING_AT_PLAYER; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_GoronShrineTalk; } else if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isTargeted)) { - func_800B863C(&this->actor, globalCtx); - this->textId = EnJg_GetStartingConversationTextId(this, globalCtx); + func_800B863C(&this->actor, play); + this->textId = EnJg_GetStartingConversationTextId(this, play); } } -void EnJg_GoronShrineTalk(EnJg* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void EnJg_GoronShrineTalk(EnJg* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if ((this->textId == 0xDCC) || (this->textId == 0xDDD) || (this->textId == 0xDE0)) { // There is nothing more to say after these lines, so end the current conversation. - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_GoronShrineIdle; } else { this->textId = EnJg_GetNextTextId(this); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } } } -void EnJg_GoronShrineCheer(EnJg* this, GlobalContext* globalCtx) { +void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { switch (this->textId) { case 0xDD0: // The greatest Goron hero of all? @@ -381,15 +381,15 @@ void EnJg_GoronShrineCheer(EnJg* this, GlobalContext* globalCtx) { case 0xDD4: // "Darmani, greatest of Gorons!" case 0xDD6: // Darmani, greatest in the world! // Focus on a specifc Goron for these lines - this->shrineGoron = EnJg_GetShrineGoronToFocusOn(globalCtx, this->focusedShrineGoronParam); + this->shrineGoron = EnJg_GetShrineGoronToFocusOn(play, this->focusedShrineGoronParam); ActorCutscene_Start(this->cutscene, this->shrineGoron); - Camera_SetTargetActor(globalCtx->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); + Camera_SetTargetActor(play->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; default: // Focus on the whole group for these lines ActorCutscene_Start(this->cutscene, &this->actor); - Camera_SetTargetActor(globalCtx->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); + Camera_SetTargetActor(play->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; } this->actionFunc = EnJg_GoronShrineTalk; @@ -414,8 +414,8 @@ void EnJg_GoronShrineCheer(EnJg* this, GlobalContext* globalCtx) { * Additionally, when the elder has reached the end of his specified path, this function will * set his speed to 0, causing him to walk in place. */ -void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, GlobalContext* globalCtx) { - u8 messageState = Message_GetState(&globalCtx->msgCtx); +void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { + u8 messageState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -425,9 +425,9 @@ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } } else if (this->animationIndex == EN_JG_ANIMATION_SURPRISE_LOOP) { - if ((messageState == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((messageState == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->animationIndex = EN_JG_ANIMATION_WALK; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); @@ -435,11 +435,11 @@ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, GlobalContext* globalCtx) { } } else if (this->animationIndex == EN_JG_ANIMATION_WALK) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); - EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, globalCtx); + EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, play); } } -void EnJg_Walk(EnJg* this, GlobalContext* globalCtx) { +void EnJg_Walk(EnJg* this, PlayState* play) { s16 yRotation; f32 distSQ; @@ -466,11 +466,11 @@ void EnJg_Walk(EnJg* this, GlobalContext* globalCtx) { } } - EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, globalCtx); + EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, play); } -void EnJg_Talk(EnJg* this, GlobalContext* globalCtx) { - u8 messageState = Message_GetState(&globalCtx->msgCtx); +void EnJg_Talk(EnJg* this, PlayState* play) { + u8 messageState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); u16 temp; @@ -480,12 +480,12 @@ void EnJg_Talk(EnJg* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } - if ((messageState == 5) && Message_ShouldAdvance(globalCtx)) { + if ((messageState == 5) && Message_ShouldAdvance(play)) { temp = this->textId; if ((temp == 0xDB4) || (temp == 0xDB5) || (temp == 0xDC4) || (temp == 0xDC6)) { // There is nothing more to say after these lines, so end the current conversation. - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; return; @@ -496,22 +496,22 @@ void EnJg_Talk(EnJg* this, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[24] & 0x80)) { // The player hasn't talked to the Goron Child at least once, so they can't learn // the Lullaby Intro. End the current conversation with the player. - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; } else if (((gSaveContext.save.weekEventReg[24] & 0x40)) || (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO))) { // The player already has the Lullaby or Lullaby Intro, so say "I'm counting on you" this->textId = EnJg_GetNextTextId(this); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_SetupTalk; } else { // To get to this point, the player *has* talked to the Goron Child, but doesn't // already have the Lullaby or Lullaby Intro. End the current conversation and // start the cutscene that teaches the Lullaby Intro. - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->cutscene = EnJg_GetCutsceneForTeachingLullabyIntro(this); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -522,13 +522,13 @@ void EnJg_Talk(EnJg* this, GlobalContext* globalCtx) { } } else { this->textId = EnJg_GetNextTextId(this); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_SetupTalk; } } } -void EnJg_SetupWalk(EnJg* this, GlobalContext* globalCtx) { +void EnJg_SetupWalk(EnJg* this, PlayState* play) { if (this->animationIndex != EN_JG_ANIMATION_WALK) { this->animationIndex = EN_JG_ANIMATION_WALK; this->freezeTimer = 1000; @@ -540,7 +540,7 @@ void EnJg_SetupWalk(EnJg* this, GlobalContext* globalCtx) { } } -void EnJg_Freeze(EnJg* this, GlobalContext* globalCtx) { +void EnJg_Freeze(EnJg* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -548,7 +548,7 @@ void EnJg_Freeze(EnJg* this, GlobalContext* globalCtx) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; this->freezeTimer = 1000; this->skelAnime.curFrame = lastFrame; - this->icePoly = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, + this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, 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, 0xFF50); this->animationIndex = EN_JG_ANIMATION_FROZEN_LOOP; @@ -558,7 +558,7 @@ void EnJg_Freeze(EnJg* this, GlobalContext* globalCtx) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; if (currentFrame == lastFrame) { this->freezeTimer = 1000; - this->icePoly = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, + this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, 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, 0xFF50); this->animationIndex = EN_JG_ANIMATION_FROZEN_LOOP; @@ -568,7 +568,7 @@ void EnJg_Freeze(EnJg* this, GlobalContext* globalCtx) { } } -void EnJg_FrozenIdle(EnJg* this, GlobalContext* globalCtx) { +void EnJg_FrozenIdle(EnJg* this, PlayState* play) { if (this->icePoly->update == NULL) { this->icePoly = NULL; if (this->animationIndex == EN_JG_ANIMATION_FROZEN_LOOP) { @@ -590,24 +590,24 @@ void EnJg_FrozenIdle(EnJg* this, GlobalContext* globalCtx) { } } } else { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x236, &this->actor); // The old Goron is frozen solid! + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x236, &this->actor); // The old Goron is frozen solid! this->actionFunc = EnJg_EndFrozenInteraction; } else if (this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } } -void EnJg_EndFrozenInteraction(EnJg* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void EnJg_EndFrozenInteraction(EnJg* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnJg_FrozenIdle; } } -void EnJg_TeachLullabyIntro(EnJg* this, GlobalContext* globalCtx) { +void EnJg_TeachLullabyIntro(EnJg* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); this->actionFunc = EnJg_LullabyIntroCutsceneAction; @@ -619,16 +619,16 @@ void EnJg_TeachLullabyIntro(EnJg* this, GlobalContext* globalCtx) { } } -void EnJg_LullabyIntroCutsceneAction(EnJg* this, GlobalContext* globalCtx) { +void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { s32 pad; - if (Cutscene_CheckActorAction(globalCtx, 470)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 470); + if (Cutscene_CheckActorAction(play, 470)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 470); - if (this->csAction != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->csAction = globalCtx->csCtx.actorActions[actionIndex]->action; + if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { + this->csAction = play->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->cutsceneAnimationIndex = EN_JG_ANIMATION_CUTSCENE_IDLE; if (this->drum != NULL) { @@ -685,7 +685,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, GlobalContext* globalCtx) { (this->action == EN_JG_ACTION_LULLABY_INTRO_CS)))) { this->flags |= FLAG_DRUM_SPAWNED; this->drum = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_OBJ_JG_GAKKI, this->actor.world.pos.x, this->actor.world.pos.y, + &play->actorCtx, play, ACTOR_OBJ_JG_GAKKI, 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, this->actor.cutscene, this->actor.unk20, NULL); } @@ -843,8 +843,8 @@ s32 EnJg_GetNextTextId(EnJg* this) { * under most circumstances. Some circumstances (like the very first time the player * talks to him after he thaws) bypass this function. */ -s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!EN_JG_IS_IN_GORON_SHRINE(&this->actor)) { if (player->transformation == PLAYER_FORM_GORON) { @@ -881,11 +881,11 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, GlobalContext* globalCtx) { return 0xDCB; // Welcome to spring } -void EnJg_SpawnBreath(EnJg* this, GlobalContext* globalCtx) { +void EnJg_SpawnBreath(EnJg* this, PlayState* play) { s16 scale = (Rand_ZeroOne() * 20.0f) + 30.0f; - if (globalCtx->state.frames % 8 == 0) { - EffectSsIceSmoke_Spawn(globalCtx, &this->breathPos, &this->breathVelocity, &this->breathAccel, scale); + if (play->state.frames % 8 == 0) { + EffectSsIceSmoke_Spawn(play, &this->breathPos, &this->breathVelocity, &this->breathAccel, scale); } } @@ -897,11 +897,11 @@ void EnJg_SpawnBreath(EnJg* this, GlobalContext* globalCtx) { * freeze timer is 0 or negative, this function starts the process of freezing him before * handing it off to EnJg_Freeze. */ -void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, GlobalContext* globalCtx) { +void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->flags |= FLAG_LOOKING_AT_PLAYER; this->actor.speedXZ = 0.0f; @@ -913,13 +913,13 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, GlobalContext* gSaveContext.save.weekEventReg[24] |= 0x10; } - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnJg_SetupTalk; } else { if ((this->actor.xzDistToPlayer < 100.0f) || (this->actor.isTargeted)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); if (this->action == EN_JG_ACTION_FIRST_THAW) { - this->textId = EnJg_GetStartingConversationTextId(this, globalCtx); + this->textId = EnJg_GetStartingConversationTextId(this, play); } } @@ -933,23 +933,23 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, GlobalContext* } } -void EnJg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJg_Init(Actor* thisx, PlayState* play) { s32 pad; EnJg* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronElderSkel, &gGoronElderIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronElderSkel, &gGoronElderIdleAnim, this->jointTable, this->morphTable, GORON_ELDER_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); Actor_SetScale(&this->actor, 0.01f); if (!EN_JG_IS_IN_GORON_SHRINE(thisx)) { - if ((globalCtx->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && - (globalCtx->csCtx.currentCsIndex == 0)) { + if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && + (play->csCtx.currentCsIndex == 0)) { // This is the elder that appears in the cutscene for learning the full Goron Lullaby. this->animationIndex = EN_JG_ANIMATION_IDLE; this->action = EN_JG_ACTION_LULLABY_INTRO_CS; @@ -957,7 +957,7 @@ void EnJg_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnJg_LullabyIntroCutsceneAction; } else { // This is the elder that appears in Mountain Village or the Path to Goron Village in winter. - this->path = SubS_GetPathByIndex(globalCtx, EN_JG_GET_PATH(thisx), 0x3F); + this->path = SubS_GetPathByIndex(play, EN_JG_GET_PATH(thisx), 0x3F); this->animationIndex = EN_JG_ANIMATION_SURPRISE_START; this->action = EN_JG_ACTION_SPAWNING; this->freezeTimer = 1000; @@ -974,31 +974,30 @@ void EnJg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnJg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJg_Destroy(Actor* thisx, PlayState* play) { EnJg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnJg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJg_Update(Actor* thisx, PlayState* play) { EnJg* this = THIS; if ((this->actionFunc != EnJg_FrozenIdle) && (this->actionFunc != EnJg_EndFrozenInteraction)) { - EnJg_UpdateCollision(this, globalCtx); + EnJg_UpdateCollision(this, play); Actor_MoveWithGravity(&this->actor); SkelAnime_Update(&this->skelAnime); if ((this->action != EN_JG_ACTION_LULLABY_INTRO_CS) && (!EN_JG_IS_IN_GORON_SHRINE(&this->actor))) { - EnJg_SpawnBreath(this, globalCtx); + EnJg_SpawnBreath(this, play); } - Actor_TrackPlayer(globalCtx, &this->actor, &this->unusedRotation1, &this->unusedRotation2, - this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unusedRotation1, &this->unusedRotation2, this->actor.focus.pos); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnJg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnJg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnJg* this = THIS; if (limbIndex == GORON_ELDER_LIMB_ROOT) { @@ -1015,7 +1014,7 @@ s32 EnJg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnJg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnJg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnJg* this = THIS; if (limbIndex == GORON_ELDER_LIMB_HEAD) { @@ -1030,9 +1029,9 @@ void EnJg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnJg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJg_Draw(Actor* thisx, PlayState* play) { EnJg* this = THIS; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJg_OverrideLimbDraw, EnJg_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.h b/src/overlays/actors/ovl_En_Jg/z_en_jg.h index 67ba1d6389..f225b51f7c 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h @@ -9,7 +9,7 @@ struct EnJg; -typedef void (*EnJgActionFunc)(struct EnJg*, GlobalContext*); +typedef void (*EnJgActionFunc)(struct EnJg*, PlayState*); typedef struct EnJg { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 4d9f9b82fa..27027c87f4 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -11,30 +11,30 @@ #define THIS ((EnJgameTsn*)thisx) -void EnJgameTsn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJgameTsn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJgameTsn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJgameTsn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJgameTsn_Init(Actor* thisx, PlayState* play); +void EnJgameTsn_Destroy(Actor* thisx, PlayState* play); +void EnJgameTsn_Update(Actor* thisx, PlayState* play); +void EnJgameTsn_Draw(Actor* thisx, PlayState* play); -void func_80C13A2C(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C13A2C(EnJgameTsn* this, PlayState* play); void func_80C13B74(EnJgameTsn* this); -void func_80C13BB8(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C13BB8(EnJgameTsn* this, PlayState* play); void func_80C13E6C(EnJgameTsn* this); -void func_80C13E90(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C13F9C(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C13E90(EnJgameTsn* this, PlayState* play); +void func_80C13F9C(EnJgameTsn* this, PlayState* play); void func_80C14030(EnJgameTsn* this); -void func_80C14044(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C1418C(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C14044(EnJgameTsn* this, PlayState* play); +void func_80C1418C(EnJgameTsn* this, PlayState* play); void func_80C141DC(EnJgameTsn* this); -void func_80C14230(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C144F8(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C14554(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C14230(EnJgameTsn* this, PlayState* play); +void func_80C144F8(EnJgameTsn* this, PlayState* play); +void func_80C14554(EnJgameTsn* this, PlayState* play); void func_80C145FC(EnJgameTsn* this); -void func_80C14610(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C14684(EnJgameTsn* this, GlobalContext* globalCtx); -void func_80C147B4(EnJgameTsn* this, GlobalContext* globalCtx); -s32 func_80C149B0(GlobalContext* globalCtx, EnJgameTsnStruct* arg1); -s32 func_80C14BCC(EnJgameTsn* this, GlobalContext* globalCtx); +void func_80C14610(EnJgameTsn* this, PlayState* play); +void func_80C14684(EnJgameTsn* this, PlayState* play); +void func_80C147B4(EnJgameTsn* this, PlayState* play); +s32 func_80C149B0(PlayState* play, EnJgameTsnStruct* arg1); +s32 func_80C14BCC(EnJgameTsn* this, PlayState* play); const ActorInit En_Jgame_Tsn_InitVars = { ACTOR_EN_JGAME_TSN, @@ -79,16 +79,16 @@ TexturePtr D_80C150A4[] = { object_tsn_Tex_0085B8, }; -void EnJgameTsn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnJgameTsn_Init(Actor* thisx, PlayState* play) { s32 pad; EnJgameTsn* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tsn_Skel_008AB8, &object_tsn_Anim_0092FC, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_tsn_Skel_008AB8, &object_tsn_Anim_0092FC, this->jointTable, this->morphTable, OBJECT_TSN_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); this->actor.targetMode = 6; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -103,12 +103,12 @@ void EnJgameTsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_21C = 0; this->unk_2FE = 0; - func_80C13A2C(this, globalCtx); + func_80C13A2C(this, play); func_80C13B74(this); } -void func_80C13A2C(EnJgameTsn* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[ENJGAMETSN_GET_FF(&this->actor)]; +void func_80C13A2C(EnJgameTsn* this, PlayState* play) { + Path* path = &play->setupPathList[ENJGAMETSN_GET_FF(&this->actor)]; s32 i; if (path == NULL) { @@ -119,7 +119,7 @@ void func_80C13A2C(EnJgameTsn* this, GlobalContext* globalCtx) { this->unk_1D8[i].points = Lib_SegmentedToVirtual(path->points); this->unk_1D8[i].count = path->count; - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; if (path == NULL) { Actor_MarkForDeath(&this->actor); } @@ -128,7 +128,7 @@ void func_80C13A2C(EnJgameTsn* this, GlobalContext* globalCtx) { this->unk_1F8.points = Lib_SegmentedToVirtual(path->points); this->unk_1F8.count = path->count; - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; if (path == NULL) { Actor_MarkForDeath(&this->actor); } @@ -137,10 +137,10 @@ void func_80C13A2C(EnJgameTsn* this, GlobalContext* globalCtx) { this->unk_200.count = path->count; } -void EnJgameTsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) { EnJgameTsn* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); gSaveContext.save.weekEventReg[90] &= (u8)~0x20; } @@ -149,48 +149,48 @@ void func_80C13B74(EnJgameTsn* this) { this->actionFunc = func_80C13BB8; } -void func_80C13BB8(EnJgameTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C13BB8(EnJgameTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.flags & ACTOR_FLAG_10000) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.unk_3DE0[4] > 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - Message_StartTextbox(globalCtx, 0x10A2, &this->actor); + Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else if (gSaveContext.minigameScore < 20) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - Message_StartTextbox(globalCtx, 0x10A2, &this->actor); + Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x10A3, &this->actor); + Message_StartTextbox(play, 0x10A3, &this->actor); this->unk_300 = 0x10A3; } } else if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { - Message_StartTextbox(globalCtx, 0x1094, &this->actor); + Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; } else if (this->unk_2F8 == 0) { this->unk_2F8 = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - Message_StartTextbox(globalCtx, 0x1095, &this->actor); + Message_StartTextbox(play, 0x1095, &this->actor); this->unk_300 = 0x1095; } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - Message_StartTextbox(globalCtx, 0x1096, &this->actor); + Message_StartTextbox(play, 0x1096, &this->actor); this->unk_300 = 0x1096; } func_80C14030(this); } else if (this->actor.flags & ACTOR_FLAG_10000) { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } else { - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } if ((player->actor.bgCheckFlags & 1) && !(player->stateFlags1 & 0x2000) && (this->unk_2FE == 0) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && func_80C149B0(globalCtx, &this->unk_1F8)) { + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && func_80C149B0(play, &this->unk_1F8)) { this->unk_2FE = 1; func_80C13E6C(this); } else if (!(player->actor.bgCheckFlags & 1)) { @@ -206,22 +206,22 @@ void func_80C13E6C(EnJgameTsn* this) { this->actionFunc = func_80C13E90; } -void func_80C13E90(EnJgameTsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80C13E90(EnJgameTsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x1094, &this->actor); + Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - Message_StartTextbox(globalCtx, 0x1098, &this->actor); + Message_StartTextbox(play, 0x1098, &this->actor); this->unk_300 = 0x1098; } func_80C14030(this); } else { - func_800B8614(&this->actor, globalCtx, 1000.0f); + func_800B8614(&this->actor, play, 1000.0f); } } @@ -229,7 +229,7 @@ void func_80C13F88(EnJgameTsn* this) { this->actionFunc = func_80C13F9C; } -void func_80C13F9C(EnJgameTsn* this, GlobalContext* globalCtx) { +void func_80C13F9C(EnJgameTsn* this, PlayState* play) { if (this->actor.cutscene != -1) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); @@ -249,8 +249,8 @@ void func_80C14030(EnJgameTsn* this) { this->actionFunc = func_80C14044; } -void func_80C14044(EnJgameTsn* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80C14044(EnJgameTsn* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -258,15 +258,15 @@ void func_80C14044(EnJgameTsn* this, GlobalContext* globalCtx) { break; case 4: - func_80C14684(this, globalCtx); + func_80C14684(this, play); break; case 5: - func_80C147B4(this, globalCtx); + func_80C147B4(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); } @@ -279,22 +279,22 @@ void func_80C14044(EnJgameTsn* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80C1410C(EnJgameTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C1410C(EnJgameTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; func_801A2BB8(0x25); - globalCtx->interfaceCtx.unk_280 = 1; - func_80112AFC(globalCtx); + play->interfaceCtx.unk_280 = 1; + func_80112AFC(play); gSaveContext.save.weekEventReg[90] |= 0x20; func_8010E9F0(4, 0x78); this->actionFunc = func_80C1418C; } -void func_80C1418C(EnJgameTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C1418C(EnJgameTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->interfaceCtx.unk_280 == 8) { + if (play->interfaceCtx.unk_280 == 8) { func_80C141DC(this); player->stateFlags1 &= ~0x20; } @@ -307,12 +307,12 @@ void func_80C141DC(EnJgameTsn* this) { this->actionFunc = func_80C14230; } -void func_80C14230(EnJgameTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C14230(EnJgameTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 rand; - if ((this->unk_2FC > 100) || func_80C14BCC(this, globalCtx)) { + if ((this->unk_2FC > 100) || func_80C14BCC(this, play)) { rand = Rand_Next() % 3; this->unk_2FC = 0; @@ -334,9 +334,9 @@ void func_80C14230(EnJgameTsn* this, GlobalContext* globalCtx) { this->unk_2FC++; - if ((player->actor.bgCheckFlags & 2) && func_80C149B0(globalCtx, &this->unk_200)) { + if ((player->actor.bgCheckFlags & 2) && func_80C149B0(play, &this->unk_200)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x109F, &this->actor); + Message_StartTextbox(play, 0x109F, &this->actor); this->unk_300 = 0x109F; player->stateFlags1 |= 0x20; *this->unk_208[this->unk_218] &= ~1; @@ -344,7 +344,7 @@ void func_80C14230(EnJgameTsn* this, GlobalContext* globalCtx) { func_80C14030(this); } else if ((player->actor.bgCheckFlags & 0x40) || (player->actor.bgCheckFlags & 0x20)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x10A0, &this->actor); + Message_StartTextbox(play, 0x10A0, &this->actor); this->unk_300 = 0x10A0; player->stateFlags1 |= 0x20; *this->unk_208[this->unk_218] &= ~1; @@ -353,7 +353,7 @@ void func_80C14230(EnJgameTsn* this, GlobalContext* globalCtx) { } if (gSaveContext.unk_3DE0[4] == 0) { - Message_StartTextbox(globalCtx, 0x10A1, &this->actor); + Message_StartTextbox(play, 0x10A1, &this->actor); this->unk_300 = 0x10A1; player->stateFlags1 |= 0x20; *this->unk_208[this->unk_218] &= ~1; @@ -366,10 +366,10 @@ void func_80C144E4(EnJgameTsn* this) { this->actionFunc = func_80C144F8; } -void func_80C144F8(EnJgameTsn* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x68D0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x50; +void func_80C144F8(EnJgameTsn* this, PlayState* play) { + play->nextEntranceIndex = 0x68D0; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x50; gSaveContext.nextTransition = 3; } @@ -377,16 +377,16 @@ void func_80C14540(EnJgameTsn* this) { this->actionFunc = func_80C14554; } -void func_80C14554(EnJgameTsn* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80C14554(EnJgameTsn* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if (!(gSaveContext.save.weekEventReg[82] & 0x10)) { gSaveContext.save.weekEventReg[82] |= 0x10; } func_80C145FC(this); } else if (gSaveContext.save.weekEventReg[82] & 0x10) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } } @@ -394,38 +394,38 @@ void func_80C145FC(EnJgameTsn* this) { this->actionFunc = func_80C14610; } -void func_80C14610(EnJgameTsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x10A4, &this->actor); +void func_80C14610(EnJgameTsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x10A4, &this->actor); this->unk_300 = 0x10A4; func_80C14030(this); } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, -1); + func_800B85E0(&this->actor, play, 200.0f, -1); } } -void func_80C14684(EnJgameTsn* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { +void func_80C14684(EnJgameTsn* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.save.playerData.rupees >= 20) { - Message_StartTextbox(globalCtx, 0x109E, &this->actor); + Message_StartTextbox(play, 0x109E, &this->actor); this->unk_300 = 0x109E; func_801159EC(-20); } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x109D, &this->actor); + Message_StartTextbox(play, 0x109D, &this->actor); this->unk_300 = 0x109D; } } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Message_StartTextbox(globalCtx, 0x109C, &this->actor); + Message_StartTextbox(play, 0x109C, &this->actor); this->unk_300 = 0x109C; } } } -void func_80C1476C(EnJgameTsn* this, GlobalContext* globalCtx) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void func_80C1476C(EnJgameTsn* this, PlayState* play) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (prop != NULL) { if (prop->id == ACTOR_OBJ_JGAME_LIGHT) { @@ -435,33 +435,33 @@ void func_80C1476C(EnJgameTsn* this, GlobalContext* globalCtx) { } } -void func_80C147B4(EnJgameTsn* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80C147B4(EnJgameTsn* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_300) { case 0x1095: - Message_StartTextbox(globalCtx, 0x1096, &this->actor); + Message_StartTextbox(play, 0x1096, &this->actor); this->unk_300 = 0x1096; break; case 0x1096: - Message_StartTextbox(globalCtx, 0x1097, &this->actor); + Message_StartTextbox(play, 0x1097, &this->actor); this->unk_300 = 0x1097; break; case 0x1098: - Message_StartTextbox(globalCtx, 0x1099, &this->actor); + Message_StartTextbox(play, 0x1099, &this->actor); this->unk_300 = 0x1099; func_80C13F88(this); break; case 0x1099: - Message_StartTextbox(globalCtx, 0x109A, &this->actor); + Message_StartTextbox(play, 0x109A, &this->actor); this->unk_300 = 0x109A; break; case 0x109A: Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); - Message_StartTextbox(globalCtx, 0x109B, &this->actor); + Message_StartTextbox(play, 0x109B, &this->actor); this->unk_300 = 0x109B; break; @@ -469,15 +469,15 @@ void func_80C147B4(EnJgameTsn* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); } - func_801477B4(globalCtx); - func_80C1476C(this, globalCtx); - func_80C1410C(this, globalCtx); + func_801477B4(play); + func_80C1476C(this, play); + func_80C1410C(this, play); break; case 0x109F: case 0x10A0: case 0x10A1: - func_801477B4(globalCtx); + func_801477B4(play); gSaveContext.minigameState = 3; gSaveContext.unk_3DD0[4] = 5; gSaveContext.save.weekEventReg[90] &= (u8)~0x20; @@ -485,9 +485,9 @@ void func_80C147B4(EnJgameTsn* this, GlobalContext* globalCtx) { break; case 0x10A3: - func_801477B4(globalCtx); + func_801477B4(play); func_80C14540(this); - func_80C14554(this, globalCtx); + func_80C14554(this, play); break; } } @@ -504,10 +504,10 @@ s32 func_80C14960(Vec2f arg0, Vec2f arg1) { return phi_v1; } -s32 func_80C149B0(GlobalContext* globalCtx, EnJgameTsnStruct* arg1) { +s32 func_80C149B0(PlayState* play, EnJgameTsnStruct* arg1) { s32 i = 1; s32 temp_s3; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec2f sp64; Vec2f sp5C; s32 sp58 = true; @@ -544,14 +544,14 @@ s32 func_80C149B0(GlobalContext* globalCtx, EnJgameTsnStruct* arg1) { return sp58; } -s32 func_80C14BCC(EnJgameTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80C14BCC(EnJgameTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 phi_s3 = -1; if (player->actor.bgCheckFlags & 2) { for (i = 0; i < ARRAY_COUNT(this->unk_1D8); i++) { - if (func_80C149B0(globalCtx, &this->unk_1D8[i])) { + if (func_80C149B0(play, &this->unk_1D8[i])) { phi_s3 = i; } } @@ -563,14 +563,14 @@ s32 func_80C14BCC(EnJgameTsn* this, GlobalContext* globalCtx) { if (phi_s3 == this->unk_218) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= 2; - globalCtx->interfaceCtx.unk_25C = 1; + play->interfaceCtx.unk_25C = 1; return true; } if (*this->unk_208[phi_s3] & 1) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= 2; - globalCtx->interfaceCtx.unk_25C = 1; + play->interfaceCtx.unk_25C = 1; } else { *this->unk_208[phi_s3] |= 4; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); @@ -580,13 +580,13 @@ s32 func_80C14BCC(EnJgameTsn* this, GlobalContext* globalCtx) { return false; } -void func_80C14D14(EnJgameTsn* this, GlobalContext* globalCtx) { +void func_80C14D14(EnJgameTsn* this, PlayState* 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_80C14D58(EnJgameTsn* this, GlobalContext* globalCtx) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2EC, &this->unk_2F2, this->actor.focus.pos); +void func_80C14D58(EnJgameTsn* this, PlayState* play) { + Actor_TrackPlayer(play, &this->actor, &this->unk_2EC, &this->unk_2F2, this->actor.focus.pos); if (DECR(this->unk_2FA) == 0) { this->unk_2FA = Rand_S16Offset(60, 60); @@ -599,18 +599,17 @@ void func_80C14D58(EnJgameTsn* this, GlobalContext* globalCtx) { } } -void EnJgameTsn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnJgameTsn_Update(Actor* thisx, PlayState* play) { EnJgameTsn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - func_80C14D14(this, globalCtx); - func_80C14D58(this, globalCtx); + func_80C14D14(this, play); + func_80C14D58(this, play); } -s32 EnJgamesTsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnJgamesTsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnJgameTsn* this = THIS; s16 temp_v0 = this->unk_2EC.x >> 1; @@ -624,24 +623,24 @@ s32 EnJgamesTsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnJgamesTsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnJgamesTsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { if (limbIndex == OBJECT_TSN_LIMB_0F) { Matrix_MultZero(&thisx->focus.pos); } } -void EnJgameTsn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnJgameTsn_Draw(Actor* thisx, PlayState* play) { EnJgameTsn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C150A4[this->unk_21C])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C150A4[this->unk_21C])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJgamesTsn_OverrideLimbDraw, EnJgamesTsn_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h index 08d07376df..8a6c3ec1ea 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h @@ -6,7 +6,7 @@ struct EnJgameTsn; -typedef void (*EnJgameTsnActionFunc)(struct EnJgameTsn*, GlobalContext*); +typedef void (*EnJgameTsnActionFunc)(struct EnJgameTsn*, PlayState*); #define ENJGAMETSN_GET_FF(thisx) ((thisx)->params & 0xFF) 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 15426db829..57763a190d 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -10,10 +10,10 @@ #define THIS ((EnJs*)thisx) -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); #if 0 const ActorInit En_Js_InitVars = { 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 db56605185..441ec5f177 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -5,7 +5,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_Jso/z_en_jso.c b/src/overlays/actors/ovl_En_Jso/z_en_jso.c index 3c7e5ce75a..4baeaafa9c 100644 --- a/src/overlays/actors/ovl_En_Jso/z_en_jso.c +++ b/src/overlays/actors/ovl_En_Jso/z_en_jso.c @@ -10,27 +10,27 @@ #define THIS ((EnJso*)thisx) -void EnJso_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJso_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJso_Update(Actor* thisx, GlobalContext* globalCtx); +void EnJso_Init(Actor* thisx, PlayState* play); +void EnJso_Destroy(Actor* thisx, PlayState* play); +void EnJso_Update(Actor* thisx, PlayState* play); -void func_809ADCB8(EnJso* this, GlobalContext* globalCtx); -void func_809AE87C(EnJso* this, GlobalContext* globalCtx); -void func_809AEA08(EnJso* this, GlobalContext* globalCtx); -void func_809AED00(EnJso* this, GlobalContext* globalCtx); -void func_809AEDAC(EnJso* this, GlobalContext* globalCtx); -void func_809AEEC0(EnJso* this, GlobalContext* globalCtx); -void func_809AF110(EnJso* this, GlobalContext* globalCtx); -void func_809AF2F8(EnJso* this, GlobalContext* globalCtx); -void func_809AF3C0(EnJso* this, GlobalContext* globalCtx); -void func_809AF440(EnJso* this, GlobalContext* globalCtx); -void func_809AF53C(EnJso* this, GlobalContext* globalCtx); -void func_809AF714(EnJso* this, GlobalContext* globalCtx); -void func_809AF7F4(EnJso* this, GlobalContext* globalCtx); -void func_809AF99C(EnJso* this, GlobalContext* globalCtx); -void func_809AFAF4(EnJso* this, GlobalContext* globalCtx); -void func_809AFC10(EnJso* this, GlobalContext* globalCtx); -void func_809AFE38(EnJso* this, GlobalContext* globalCtx); +void func_809ADCB8(EnJso* this, PlayState* play); +void func_809AE87C(EnJso* this, PlayState* play); +void func_809AEA08(EnJso* this, PlayState* play); +void func_809AED00(EnJso* this, PlayState* play); +void func_809AEDAC(EnJso* this, PlayState* play); +void func_809AEEC0(EnJso* this, PlayState* play); +void func_809AF110(EnJso* this, PlayState* play); +void func_809AF2F8(EnJso* this, PlayState* play); +void func_809AF3C0(EnJso* this, PlayState* play); +void func_809AF440(EnJso* this, PlayState* play); +void func_809AF53C(EnJso* this, PlayState* play); +void func_809AF714(EnJso* this, PlayState* play); +void func_809AF7F4(EnJso* this, PlayState* play); +void func_809AF99C(EnJso* this, PlayState* play); +void func_809AFAF4(EnJso* this, PlayState* play); +void func_809AFC10(EnJso* this, PlayState* play); +void func_809AFE38(EnJso* this, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Jso/z_en_jso.h b/src/overlays/actors/ovl_En_Jso/z_en_jso.h index 5b7e7630d3..7fd25473e9 100644 --- a/src/overlays/actors/ovl_En_Jso/z_en_jso.h +++ b/src/overlays/actors/ovl_En_Jso/z_en_jso.h @@ -5,7 +5,7 @@ struct EnJso; -typedef void (*EnJsoActionFunc)(struct EnJso*, GlobalContext*); +typedef void (*EnJsoActionFunc)(struct EnJso*, PlayState*); typedef struct EnJso { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c index 8d29b93834..874cac6bd4 100644 --- a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c +++ b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.c @@ -10,29 +10,29 @@ #define THIS ((EnJso2*)thisx) -void EnJso2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnJso2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnJso2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnJso2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnJso2_Init(Actor* thisx, PlayState* play); +void EnJso2_Destroy(Actor* thisx, PlayState* play); +void EnJso2_Update(Actor* thisx, PlayState* play); +void EnJso2_Draw(Actor* thisx, PlayState* play); -void func_80A778F8(EnJso2* this, GlobalContext* globalCtx); -void func_80A785E4(EnJso2* this, GlobalContext* globalCtx); -void func_80A78868(EnJso2* this, GlobalContext* globalCtx); -void func_80A78ACC(EnJso2* this, GlobalContext* globalCtx); -void func_80A78B70(EnJso2* this, GlobalContext* globalCtx); -void func_80A78C7C(EnJso2* this, GlobalContext* globalCtx); -void func_80A78F04(EnJso2* this, GlobalContext* globalCtx); -void func_80A79038(EnJso2* this, GlobalContext* globalCtx); -void func_80A7919C(EnJso2* this, GlobalContext* globalCtx); -void func_80A79364(EnJso2* this, GlobalContext* globalCtx); -void func_80A794C8(EnJso2* this, GlobalContext* globalCtx); -void func_80A79600(EnJso2* this, GlobalContext* globalCtx); -void func_80A7980C(EnJso2* this, GlobalContext* globalCtx); -void func_80A798C8(EnJso2* this, GlobalContext* globalCtx); -void func_80A79A84(EnJso2* this, GlobalContext* globalCtx); -void func_80A79BA0(EnJso2* this, GlobalContext* globalCtx); -void func_80A7A124(EnJso2* this, GlobalContext* globalCtx); -void func_80A7A2EC(EnJso2* this, GlobalContext* globalCtx); +void func_80A778F8(EnJso2* this, PlayState* play); +void func_80A785E4(EnJso2* this, PlayState* play); +void func_80A78868(EnJso2* this, PlayState* play); +void func_80A78ACC(EnJso2* this, PlayState* play); +void func_80A78B70(EnJso2* this, PlayState* play); +void func_80A78C7C(EnJso2* this, PlayState* play); +void func_80A78F04(EnJso2* this, PlayState* play); +void func_80A79038(EnJso2* this, PlayState* play); +void func_80A7919C(EnJso2* this, PlayState* play); +void func_80A79364(EnJso2* this, PlayState* play); +void func_80A794C8(EnJso2* this, PlayState* play); +void func_80A79600(EnJso2* this, PlayState* play); +void func_80A7980C(EnJso2* this, PlayState* play); +void func_80A798C8(EnJso2* this, PlayState* play); +void func_80A79A84(EnJso2* this, PlayState* play); +void func_80A79BA0(EnJso2* this, PlayState* play); +void func_80A7A124(EnJso2* this, PlayState* play); +void func_80A7A2EC(EnJso2* this, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.h b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.h index 9a52e20b57..30f7872d55 100644 --- a/src/overlays/actors/ovl_En_Jso2/z_en_jso2.h +++ b/src/overlays/actors/ovl_En_Jso2/z_en_jso2.h @@ -5,7 +5,7 @@ struct EnJso2; -typedef void (*EnJso2ActionFunc)(struct EnJso2*, GlobalContext*); +typedef void (*EnJso2ActionFunc)(struct EnJso2*, PlayState*); typedef struct EnJso2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 721e8c1a4d..6e41305766 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -10,9 +10,9 @@ #define THIS ((EnKaizoku*)thisx) -void EnKaizoku_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKaizoku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKaizoku_Update(Actor* thisx, GlobalContext* globalCtx); +void EnKaizoku_Init(Actor* thisx, PlayState* play); +void EnKaizoku_Destroy(Actor* thisx, PlayState* play); +void EnKaizoku_Update(Actor* thisx, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index db49373f83..265b55ea32 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -5,7 +5,7 @@ struct EnKaizoku; -typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, GlobalContext*); +typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); typedef struct EnKaizoku { /* 0x0000 */ Actor actor; 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 78441bc419..5f4b0e3f1d 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -11,38 +11,38 @@ #define THIS ((EnKakasi*)thisx) -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 EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play); void EnKakasi_InitTimeSkipDialogue(EnKakasi* this); void EnKakasi_SetupIdleStanding(EnKakasi* this); -void EnKakasi_8096F88C(GlobalContext* globalCtx, EnKakasi* this); +void EnKakasi_8096F88C(PlayState* play, EnKakasi* this); -void EnKakasi_TimeSkipDialogue(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_OcarinaRemark(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_PostSongLearnTwirl(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play); +void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play); +void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play); +void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play); +void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play); +void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play); void EnKakasi_SetupDigAway(EnKakasi* this); -void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_RisenDialogue(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play); +void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play); void EnKakasi_SetupIdleUnderground(EnKakasi* this); -void EnKakasi_IdleUnderground(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play); void EnKakasi_SetupIdleRisen(EnKakasi* this); -void EnKakasi_IdleRisen(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_RisingOutOfGround(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_DancingRemark(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play); +void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play); +void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play); +void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play); void EnKakasi_SetupDanceNightAway(EnKakasi* this); -void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_DoNothing(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx); -void EnKakasi_SetupSongTeach(EnKakasi* this, GlobalContext* globalCtx); +void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play); +void EnKakasi_DoNothing(EnKakasi* this, PlayState* play); +void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play); +void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play); void EnKakasi_SetupDialogue(EnKakasi* this); @@ -134,19 +134,19 @@ static u8 sAnimModes[] = { ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, }; -void EnKakasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Destroy(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnKakasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Init(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; s32 tempCutscene; s32 i; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &D_80971D80); - SkelAnime_InitFlex(globalCtx, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &D_80971D80); + SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); this->songSummonDist = GET_KAKASI_SUMMON_DISTANCE(this) * 20.0f; if (this->songSummonDist < 40.0f) { @@ -205,8 +205,8 @@ void EnKakasi_SetAnimation(EnKakasi* this, s32 index) { /* * set by init, called... nowhere? left over from OOT? */ -void EnKakasi_8096F88C(GlobalContext* globalCtx, EnKakasi* this) { - func_8013A530(globalCtx, &this->actor, 0x7, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +void EnKakasi_8096F88C(PlayState* play, EnKakasi* this) { + func_8013A530(play, &this->actor, 0x7, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); } void EnKakasi_CheckAnimationSfx(EnKakasi* this) { @@ -237,13 +237,13 @@ void EnKakasi_CheckAnimationSfx(EnKakasi* this) { /* * moves the player's position relative to scarecrow during song teach, also each frame of dance the night away */ -void EnKakasi_CheckPlayerPosition(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->sceneNum == SCENE_8ITEMSHOP) { + if (play->sceneNum == SCENE_8ITEMSHOP) { player->actor.world.pos.x = -50.0f; player->actor.world.pos.z = 155.0f; - } else if (globalCtx->sceneNum == SCENE_TENMON_DAI) { + } else if (play->sceneNum == SCENE_TENMON_DAI) { player->actor.world.pos.x = 60.0f; player->actor.world.pos.z = -190.0f; } @@ -255,7 +255,7 @@ void EnKakasi_CheckPlayerPosition(EnKakasi* this, GlobalContext* globalCtx) { * this goes off every frame of dancing the night away, and song teaching * something to do with cutscene camera? */ -void func_8096FAAC(EnKakasi* this, GlobalContext* globalCtx) { +void func_8096FAAC(EnKakasi* this, PlayState* play) { if (this->cutsceneCamId != CAM_ID_MAIN) { Math_ApproachF(&this->unk214.x, this->unk238.x, 0.4f, 4.0f); Math_ApproachF(&this->unk214.y, this->unk238.y, 0.4f, 4.0f); @@ -267,17 +267,17 @@ void func_8096FAAC(EnKakasi* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk20C, this->unk210, 0.3f, 10.0f); - Play_CameraSetAtEye(globalCtx, this->cutsceneCamId, &this->unk220, &this->unk214); - Play_CameraSetFov(globalCtx, this->cutsceneCamId, this->unk20C); + Play_CameraSetAtEye(play, this->cutsceneCamId, &this->unk220, &this->unk214); + Play_CameraSetFov(play, this->cutsceneCamId, this->unk20C); } } /* * goes off every frame of song teach, but... doing what? */ -void func_8096FBB8(EnKakasi* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.unk12048 == 0 || globalCtx->msgCtx.unk12048 == 1 || globalCtx->msgCtx.unk12048 == 2 || - globalCtx->msgCtx.unk12048 == 3 || globalCtx->msgCtx.unk12048 == 4) { +void func_8096FBB8(EnKakasi* this, PlayState* play) { + if (play->msgCtx.unk12048 == 0 || play->msgCtx.unk12048 == 1 || play->msgCtx.unk12048 == 2 || + play->msgCtx.unk12048 == 3 || play->msgCtx.unk12048 == 4) { // why not 0 < x < 4? fewer branches this->unk190++; } @@ -298,8 +298,8 @@ void EnKakasi_InitTimeSkipDialogue(EnKakasi* this) { this->actionFunc = EnKakasi_TimeSkipDialogue; } -void EnKakasi_TimeSkipDialogue(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (gSaveContext.respawnFlag != -4 && gSaveContext.respawnFlag != -8) { if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && @@ -314,13 +314,13 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_10000; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->stateFlags1 &= ~0x20; this->unkState196 = 2; this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnKakasi_RegularDialogue; } else { - func_800B8500(&this->actor, globalCtx, 9999.9f, 9999.9f, -1); + func_800B8500(&this->actor, play, 9999.9f, 9999.9f, -1); } } } @@ -331,32 +331,32 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { this->actionFunc = EnKakasi_IdleStanding; } -void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { u32 saveContextDay = gSaveContext.save.day; s16 x; s16 y; // first talk to scarecrow dialogue this->actor.textId = 0x1644; - if (func_800B8718(&this->actor, &globalCtx->state)) { + if (func_800B8718(&this->actor, &play->state)) { this->skelanime.playSpeed = 1.0f; - EnKakasi_SetupSongTeach(this, globalCtx); + EnKakasi_SetupSongTeach(this, play); return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->skelanime.playSpeed = 1.0f; EnKakasi_SetupDialogue(this); return; } - if (globalCtx->actorCtx.unk5 & 0x4) { - Actor_GetScreenPos(globalCtx, &this->actor, &x, &y); + if (play->actorCtx.unk5 & 0x4) { + Actor_GetScreenPos(play, &this->actor, &x, &y); if (this->actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { // faster shaking EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; } - } else if (Player_GetMask(globalCtx) == PLAYER_MASK_KAMARO) { + } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; @@ -370,8 +370,8 @@ void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_IDLE); } if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->actor, globalCtx, 100.0f); - func_800B874C(&this->actor, globalCtx, 100.0f, 80.0f); + func_800B8614(&this->actor, play, 100.0f); + func_800B874C(&this->actor, play, 100.0f, 80.0f); } } @@ -387,7 +387,7 @@ void EnKakasi_SetupDialogue(EnKakasi* this) { this->actionFunc = EnKakasi_RegularDialogue; } -void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { u32 saveContextDay = gSaveContext.save.day; f32 currentAnimeFrame = this->skelanime.curFrame; @@ -411,16 +411,16 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { } if (this->unkState1A8 == 2 && this->unkState196 == 2) { - func_800B7298(globalCtx, &this->actor, 0x49); + func_800B7298(play, &this->actor, 0x49); this->unkState1A8 = 0; } - if ((this->unkMsgState1AC == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((this->unkMsgState1AC == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + func_801477B4(play); if (this->unkMsgState1AC == 5) { // bad song input if (this->unkState196 == 2 && this->actor.textId == 0x1647) { - func_800B7298(globalCtx, &this->actor, 6); + func_800B7298(play, &this->actor, 6); } // after timeskip @@ -442,12 +442,12 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { this->actor.textId = 0x1645; } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); return; } else if (this->actor.textId == 0x165D || this->actor.textId == 0x165F || this->actor.textId == 0x1660 || this->actor.textId == 0x1652) { - func_800B7298(globalCtx, &this->actor, 4); + func_800B7298(play, &this->actor, 4); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); @@ -513,7 +513,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { } else { this->unkMsgState1AC = 5; - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { func_8019F208(); if (this->actor.textId == 0x1656) { this->actor.textId = 0x1658; @@ -540,13 +540,13 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { } } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } -void EnKakasi_SetupSongTeach(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { this->actor.textId = 0x1646; - Message_StartTextbox(globalCtx, this->actor.textId, &this->actor); + Message_StartTextbox(play, this->actor.textId, &this->actor); this->cutsceneCamId = CAM_ID_MAIN; this->unk20C = 0.0f; this->unk210 = 60.0f; @@ -559,9 +559,9 @@ void EnKakasi_SetupSongTeach(EnKakasi* this, GlobalContext* globalCtx) { * you took out ocarina hes talking about how he wants to hear you play him a song * before actually teaching */ -void EnKakasi_OcarinaRemark(EnKakasi* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_80152434(globalCtx, 0x35); +void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_80152434(play, 0x35); this->unkState1A8 = 0; if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -582,10 +582,10 @@ void EnKakasi_OcarinaRemark(EnKakasi* this, GlobalContext* globalCtx) { } } -void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { Vec3f tempVec; - EnKakasi_CheckPlayerPosition(this, globalCtx); + EnKakasi_CheckPlayerPosition(this, play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); if (this->unkState1A8 == 0) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -615,10 +615,10 @@ void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk244, &this->unk22C); Math_Vec3f_Copy(&this->unk214, &this->unk238); Math_Vec3f_Copy(&this->unk220, &this->unk244); - func_8096FAAC(this, globalCtx); - func_8096FBB8(this, globalCtx); + func_8096FAAC(this, play); + func_8096FBB8(this, play); - if (globalCtx->msgCtx.ocarinaMode == 4) { // song failed + if (play->msgCtx.ocarinaMode == 4) { // song failed this->unk190 = 0; this->unkCounter1A4 = 0; ActorCutscene_Stop(this->actorCutscenes[0]); @@ -632,7 +632,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); this->actionFunc = EnKakasi_RegularDialogue; - } else if (globalCtx->msgCtx.ocarinaMode == 3) { // song success + } else if (play->msgCtx.ocarinaMode == 3) { // song success this->postTeachTimer = 30; this->skelanime.playSpeed = 2.0f; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); @@ -641,7 +641,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx) { } } -void EnKakasi_PostSongLearnTwirl(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { f32 animeFrame = this->skelanime.curFrame; if (this->postTeachTimer == 0 && this->animIndex != ENKAKASI_ANIM_TWIRL) { @@ -649,13 +649,13 @@ void EnKakasi_PostSongLearnTwirl(EnKakasi* this, GlobalContext* globalCtx) { this->skelanime.playSpeed = 2.0f; } if (this->postTeachTimer == 0 && this->animIndex == ENKAKASI_ANIM_TWIRL && this->animeFrameCount <= animeFrame) { - EnKakasi_SetupPostSongLearnDialogue(this, globalCtx); + EnKakasi_SetupPostSongLearnDialogue(this, play); } } -void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { ActorCutscene_Stop(this->actorCutscenes[0]); - globalCtx->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = 4; this->unk190 = 0; this->unkCounter1A4 = 0; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); @@ -667,8 +667,8 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCt this->unk210 = 60.0f; } -void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 tempAnimFrame = this->skelanime.curFrame; Vec3f vec3fCopy; @@ -676,10 +676,10 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&player->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); if (this->unk190 == 0) { - func_801477B4(globalCtx); - func_800B7298(globalCtx, &this->actor, 0x56); + func_801477B4(play); + func_800B7298(play, &this->actor, 0x56); this->actor.textId = 0x1648; - Message_StartTextbox(globalCtx, (this->actor.textId), &this->actor); + Message_StartTextbox(play, (this->actor.textId), &this->actor); this->unkState1A8 = 0; this->unk190 = 1; } @@ -713,13 +713,13 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - func_800B7298(globalCtx, &this->actor, 0x56); + func_800B7298(play, &this->actor, 0x56); this->unkState1A8 = 1; } if (this->cutsceneCamId != CAM_ID_MAIN) { this->unk22C.y = this->actor.home.pos.y + 50.0f; - EnKakasi_CheckPlayerPosition(this, globalCtx); + EnKakasi_CheckPlayerPosition(this, play); this->unk238.x = D_80971FA0[this->unk190].x; this->unk238.y = D_80971FA0[this->unk190].y; this->unk238.z = D_80971FA0[this->unk190].z; @@ -732,12 +732,12 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk220, &this->unk244); } - func_8096FAAC(this, globalCtx); + func_8096FAAC(this, play); - if ((this->unkState1A8 != 0) && (Message_GetState(&globalCtx->msgCtx) == this->unkMsgState1AC) && - Message_ShouldAdvance(globalCtx)) { + if ((this->unkState1A8 != 0) && (Message_GetState(&play->msgCtx) == this->unkMsgState1AC) && + Message_ShouldAdvance(play)) { - func_801477B4(globalCtx); + func_801477B4(play); if (this->unkMsgState1AC == 5) { this->unk190++; @@ -746,7 +746,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { } if (this->actor.textId == 0x1648) { - func_800B7298(globalCtx, &this->actor, 7); + func_800B7298(play, &this->actor, 7); this->actor.textId = 0x1649; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -772,7 +772,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { } else { this->unkMsgState1AC = 5; - if (globalCtx->msgCtx.choiceIndex == 1) { + if (play->msgCtx.choiceIndex == 1) { func_8019F208(); // play 0x4808 sfx (decide) and calls func_801A75E8 this->actor.textId = 0x164A; } else { @@ -780,14 +780,14 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { this->actor.textId = 0x1661; } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } /* * talking before dancing the night away, and cutscene setup */ -void EnKakasi_DancingRemark(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { u32 currentDay = gSaveContext.save.day; this->unkState196 = 3; @@ -819,13 +819,13 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) { this->actionFunc = EnKakasi_DancingNightAway; } -void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { f32 currentFrame; Vec3f localVec3f; Player* player; currentFrame = this->skelanime.curFrame; - EnKakasi_CheckPlayerPosition(this, globalCtx); + EnKakasi_CheckPlayerPosition(this, play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); this->unk22C.y = this->actor.home.pos.y + 50.0f; @@ -847,7 +847,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 0x800; } - func_8096FAAC(this, globalCtx); + func_8096FAAC(this, play); // switching through manual cutscene states switch (this->unk190) { @@ -918,7 +918,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { this->unk190++; this->unk204 = 0xA; if (this->unk190 == 0xE) { - func_800B7298(globalCtx, &this->actor, 0x49); + func_800B7298(play, &this->actor, 0x49); func_80165690(); this->unk204 = 0x14; } @@ -929,11 +929,11 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { // otherwise its the end when camera is back to normal and link is confused Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); if (this->unk204 == 0) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); - Play_SetRespawnData(&globalCtx->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), - player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); - func_80169EFC(&globalCtx->state); + Play_SetRespawnData(&play->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, + 0xBFF, &player->unk_3C0, player->unk_3CC); + func_80169EFC(&play->state); if (0) {} if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { @@ -951,7 +951,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { } } -void EnKakasi_DoNothing(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_DoNothing(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupDigAway(EnKakasi* this) { @@ -967,7 +967,7 @@ void EnKakasi_SetupDigAway(EnKakasi* this) { this->actionFunc = EnKakasi_DiggingAway; } -void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Vec3f tempunk238; Vec3f tempWorldPos; @@ -984,7 +984,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { this->unk244.z = ((f32)D_8097203C.z) + this->unk22C.z; Math_Vec3f_Copy(&this->unk214, &this->unk238); Math_Vec3f_Copy(&this->unk220, &this->unk244); - func_8096FAAC(this, globalCtx); + func_8096FAAC(this, play); } if (this->unkCounter1A4 < 15) { @@ -994,19 +994,19 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 0x3000; Math_SmoothStepToS(&this->unk190, 500, 5, 50, 0); - if ((globalCtx->gameplayFrames % 4) == 0) { + if ((play->gameplayFrames % 4) == 0) { Math_Vec3f_Copy(&tempWorldPos, &this->actor.world.pos); tempWorldPos.y = this->actor.floorHeight; tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); - if (globalCtx->sceneNum == SCENE_8ITEMSHOP) { - EffectSsGSplash_Spawn(globalCtx, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); + if (play->sceneNum == SCENE_8ITEMSHOP) { + EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); + SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); } else { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, - this->actor.shape.shadowScale - 20.0f, 5, 4.0f, 200, 10, 1); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, + 5, 4.0f, 200, 10, 1); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); } } @@ -1014,7 +1014,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); if (fabsf(this->actor.shape.yOffset + 6000.0f) < 10.0f) { gSaveContext.save.weekEventReg[79] |= 8; - func_800B7298(globalCtx, &this->actor, 6); + func_800B7298(play, &this->actor, 6); ActorCutscene_Stop(this->actorCutscenes[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; @@ -1030,16 +1030,16 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { this->actionFunc = EnKakasi_IdleUnderground; } -void EnKakasi_IdleUnderground(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { if ((gSaveContext.save.weekEventReg[79] & 8) && this->actor.xzDistToPlayer < this->songSummonDist && - (BREG(1) != 0 || globalCtx->msgCtx.ocarinaMode == 0xD)) { + (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { this->actor.flags &= ~ACTOR_FLAG_8000000; - globalCtx->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = 4; this->actionFunc = EnKakasi_SetupRiseOutOfGround; } } -void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play) { s32 cutsceneIndex; cutsceneIndex = 0; @@ -1063,16 +1063,16 @@ void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, GlobalContext* globalCtx) { } } -void EnKakasi_RisingOutOfGround(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { this->actor.shape.rot.y += 0x3000; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (this->actor.shape.yOffset < -10.0f) { - if ((globalCtx->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, - this->actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); + if ((play->gameplayFrames % 8) == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, + 10, 8.0f, 500, 10, 1); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); } Math_ApproachF(&this->actor.shape.yOffset, 0.0f, 0.5f, 200.0f); @@ -1089,25 +1089,25 @@ void EnKakasi_SetupIdleRisen(EnKakasi* this) { this->actor.shape.yOffset = 0.0f; } -void EnKakasi_IdleRisen(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnKakasi_RisenDialogue; } else { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } -void EnKakasi_RisenDialogue(EnKakasi* this, GlobalContext* globalCtx) { +void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); EnKakasi_SetupIdleRisen(this); } } -void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Update(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; s32 pad; @@ -1134,17 +1134,17 @@ void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, this->unkHeight); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); if (this->actor.draw != NULL) { 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 EnKakasi_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnKakasi* this = THIS; if (limbIndex == 4) { @@ -1152,9 +1152,9 @@ void EnKakasi_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, - NULL, EnKakasi_PostLimbDraw, &this->actor); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, + EnKakasi_PostLimbDraw, &this->actor); } 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 2cb4f6cba1..c6ee704d68 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -5,8 +5,8 @@ struct EnKakasi; -typedef void (*EnKakasiActionFunc)(struct EnKakasi*, GlobalContext*); -typedef void (*EnKakasiUnkFunc)(GlobalContext*, struct EnKakasi*); +typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*); +typedef void (*EnKakasiUnkFunc)(PlayState*, struct EnKakasi*); typedef struct EnKakasi { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index ab3e8531f4..039a269e3b 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -11,35 +11,35 @@ #define THIS ((EnKame*)thisx) -void EnKame_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKame_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKame_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKame_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKame_Init(Actor* thisx, PlayState* play); +void EnKame_Destroy(Actor* thisx, PlayState* play); +void EnKame_Update(Actor* thisx, PlayState* play); +void EnKame_Draw(Actor* thisx, PlayState* play); void func_80AD70A0(EnKame* this); -void func_80AD70EC(EnKame* this, GlobalContext* globalCtx); +void func_80AD70EC(EnKame* this, PlayState* play); void func_80AD71B4(EnKame* this); -void func_80AD7254(EnKame* this, GlobalContext* globalCtx); +void func_80AD7254(EnKame* this, PlayState* play); void func_80AD73A8(EnKame* this); -void func_80AD7424(EnKame* this, GlobalContext* globalCtx); +void func_80AD7424(EnKame* this, PlayState* play); void func_80AD76CC(EnKame* this); -void func_80AD7798(EnKame* this, GlobalContext* globalCtx); +void func_80AD7798(EnKame* this, PlayState* play); void func_80AD792C(EnKame* this); -void func_80AD7948(EnKame* this, GlobalContext* globalCtx); +void func_80AD7948(EnKame* this, PlayState* play); void func_80AD7B18(EnKame* this); -void func_80AD7B90(EnKame* this, GlobalContext* globalCtx); -void func_80AD7D40(EnKame* this, GlobalContext* globalCtx); +void func_80AD7B90(EnKame* this, PlayState* play); +void func_80AD7D40(EnKame* this, PlayState* play); void func_80AD7DA4(EnKame* this); -void func_80AD7E0C(EnKame* this, GlobalContext* globalCtx); +void func_80AD7E0C(EnKame* this, PlayState* play); void func_80AD7EC0(EnKame* this); -void func_80AD7F10(EnKame* this, GlobalContext* globalCtx); -void func_80AD7FF8(EnKame* this, GlobalContext* globalCtx); -void func_80AD810C(EnKame* this, GlobalContext* globalCtx); -void func_80AD8148(EnKame* this, GlobalContext* globalCtx); -void func_80AD825C(EnKame* this, GlobalContext* globalCtx); +void func_80AD7F10(EnKame* this, PlayState* play); +void func_80AD7FF8(EnKame* this, PlayState* play); +void func_80AD810C(EnKame* this, PlayState* play); +void func_80AD8148(EnKame* this, PlayState* play); +void func_80AD825C(EnKame* this, PlayState* play); void func_80AD8364(EnKame* this); -void func_80AD8388(EnKame* this, GlobalContext* globalCtx); -void func_80AD8D64(Actor* thisx, GlobalContext* globalCtx); +void func_80AD8388(EnKame* this, PlayState* play); +void func_80AD8D64(Actor* thisx, PlayState* play); const ActorInit En_Kame_InitVars = { ACTOR_EN_KAME, @@ -121,16 +121,16 @@ static InitChainEntry sInitChain[] = { static s32 D_80AD8E50 = false; -void EnKame_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKame_Init(Actor* thisx, PlayState* play) { EnKame* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime1, &object_tl_Skel_007C70, &object_tl_Anim_004210, this->jointTable1, + SkelAnime_InitFlex(play, &this->skelAnime1, &object_tl_Skel_007C70, &object_tl_Anim_004210, this->jointTable1, this->morphTable1, 13); - SkelAnime_InitFlex(globalCtx, &this->skelAnime2, &object_tl_Skel_001A50, &object_tl_Anim_000B30, this->jointTable2, + SkelAnime_InitFlex(play, &this->skelAnime2, &object_tl_Skel_001A50, &object_tl_Anim_000B30, this->jointTable2, this->morphTable2, 4); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 55.0f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (!D_80AD8E50) { @@ -145,10 +145,10 @@ void EnKame_Init(Actor* thisx, GlobalContext* globalCtx) { func_80AD70A0(this); } -void EnKame_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKame_Destroy(Actor* thisx, PlayState* play) { EnKame* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80AD6F34(EnKame* this) { @@ -173,12 +173,12 @@ void func_80AD6F9C(EnKame* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_80AD7018(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7018(EnKame* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -189,15 +189,15 @@ void func_80AD70A0(EnKame* this) { this->actionFunc = func_80AD70EC; } -void func_80AD70EC(EnKame* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD70EC(EnKame* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Animation_OnFrame(&this->skelAnime1, 10.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_VOICE); this->unk_2A0 = 40; } - if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && (this->actor.xzDistToPlayer < 240.0f)) { func_80AD73A8(this); } else if (SkelAnime_Update(&this->skelAnime1)) { @@ -215,10 +215,10 @@ void func_80AD71B4(EnKame* this) { this->actionFunc = func_80AD7254; } -void func_80AD7254(EnKame* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD7254(EnKame* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && (this->actor.xzDistToPlayer < 240.0f)) { func_80AD73A8(this); return; @@ -253,11 +253,11 @@ void func_80AD73A8(EnKame* this) { this->actionFunc = func_80AD7424; } -void func_80AD7424(EnKame* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD7424(EnKame* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime1)) { - if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000) && ((this->unk_29E == 0) || (this->actor.xzDistToPlayer < 120.0f))) { func_80AD76CC(this); } else { @@ -282,20 +282,20 @@ void func_80AD7568(EnKame* this) { this->actor.shape.rot.z = this->unk_2A6 * 0.11016949f; } -void func_80AD75A8(EnKame* this, GlobalContext* globalCtx) { +void func_80AD75A8(EnKame* this, PlayState* play) { static Color_RGBA8 D_80AD8E54 = { 250, 250, 250, 255 }; static Color_RGBA8 D_80AD8E58 = { 180, 180, 180, 255 }; static Vec3f D_80AD8E5C = { 0.0f, 0.75f, 0.0f }; if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ >= 3.0f)) { - if ((globalCtx->gameplayFrames % 2) == 0) { - u32 temp_v0 = func_800C9BB8(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + if ((play->gameplayFrames % 2) == 0) { + u32 temp_v0 = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((temp_v0 == 0) || (temp_v0 == 1)) { - func_800B1210(globalCtx, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, 550, 100); + func_800B1210(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, 550, 100); } else if (temp_v0 == 14) { - func_800B0DE0(globalCtx, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, &D_80AD8E54, &D_80AD8E58, - 550, 100); + func_800B0DE0(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, &D_80AD8E54, &D_80AD8E58, 550, + 100); } } } @@ -324,7 +324,7 @@ void func_80AD76CC(EnKame* this) { this->actionFunc = func_80AD7798; } -void func_80AD7798(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7798(EnKame* this, PlayState* play) { if (this->unk_29E == 15) { this->unk_2AC += 0.2f; if (this->unk_2AC > 1.1f) { @@ -348,7 +348,7 @@ void func_80AD7798(EnKame* this, GlobalContext* globalCtx) { if (!(this->unk_2BC.y < this->actor.home.pos.y) || (this->actionFunc != func_80AD7798)) { func_80AD7568(this); } - func_80AD75A8(this, globalCtx); + func_80AD75A8(this, play); } void func_80AD792C(EnKame* this) { @@ -356,11 +356,11 @@ void func_80AD792C(EnKame* this) { this->actionFunc = func_80AD7948; } -void func_80AD7948(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7948(EnKame* this, PlayState* play) { s32 temp_v1; this->actor.shape.rot.y += this->unk_2A6; - func_80AD75A8(this, globalCtx); + func_80AD75A8(this, play); if (this->unk_29E == -1) { s16 temp_v0 = Actor_YawToPoint(&this->actor, &this->unk_2BC) - this->actor.world.rot.y; @@ -408,7 +408,7 @@ void func_80AD7B18(EnKame* this) { this->actionFunc = func_80AD7B90; } -void func_80AD7B90(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7B90(EnKame* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime1)) { func_80AD71B4(this); } else if (this->skelAnime1.curFrame > 7.0f) { @@ -444,7 +444,7 @@ void func_80AD7C54(EnKame* this) { this->actionFunc = func_80AD7D40; } -void func_80AD7D40(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7D40(EnKame* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime1)) { if (this->unk_29E == 1) { func_80AD71B4(this); @@ -464,7 +464,7 @@ void func_80AD7DA4(EnKame* this) { this->actionFunc = func_80AD7E0C; } -void func_80AD7E0C(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7E0C(EnKame* this, PlayState* play) { if (this->unk_29E > 0) { this->unk_29E--; if (SkelAnime_Update(&this->skelAnime1)) { @@ -486,7 +486,7 @@ void func_80AD7EC0(EnKame* this) { this->actionFunc = func_80AD7F10; } -void func_80AD7F10(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7F10(EnKame* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime1)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; func_80AD71B4(this); @@ -506,13 +506,13 @@ void func_80AD7FA4(EnKame* this) { this->actionFunc = func_80AD7FF8; } -void func_80AD7FF8(EnKame* this, GlobalContext* globalCtx) { +void func_80AD7FF8(EnKame* this, PlayState* play) { if (this->unk_2A2 != 0) { this->unk_2A2--; } if (this->unk_2A2 == 0) { - func_80AD7018(this, globalCtx); + func_80AD7018(this, play); if (this->actor.colChkInfo.health == 0) { func_80AD8148(this, NULL); } else { @@ -532,13 +532,13 @@ void func_80AD8060(EnKame* this) { this->actionFunc = func_80AD810C; } -void func_80AD810C(EnKame* this, GlobalContext* globalCtx) { +void func_80AD810C(EnKame* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime1)) { func_80AD7DA4(this); } } -void func_80AD8148(EnKame* this, GlobalContext* globalCtx) { +void func_80AD8148(EnKame* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime1, &object_tl_Anim_000AF4); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); this->collider.base.acFlags &= ~AC_ON; @@ -546,8 +546,8 @@ void func_80AD8148(EnKame* this, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~(AC_HARD | AC_HIT); this->actor.velocity.y = 15.0f; this->actor.speedXZ = 1.5f; - if (globalCtx != NULL) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + if (play != NULL) { + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.draw == func_80AD8D64) { this->actor.draw = EnKame_Draw; } else { @@ -562,7 +562,7 @@ void func_80AD8148(EnKame* this, GlobalContext* globalCtx) { this->actionFunc = func_80AD825C; } -void func_80AD825C(EnKame* this, GlobalContext* globalCtx) { +void func_80AD825C(EnKame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime1); if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); @@ -585,7 +585,7 @@ void func_80AD8364(EnKame* this) { this->actionFunc = func_80AD8388; } -void func_80AD8388(EnKame* this, GlobalContext* globalCtx) { +void func_80AD8388(EnKame* this, PlayState* play) { Vec3f sp34; SkelAnime_Update(&this->skelAnime1); @@ -593,13 +593,13 @@ void func_80AD8388(EnKame* this, GlobalContext* globalCtx) { if (this->unk_29E > 0) { this->unk_29E--; if (this->unk_29E == 0) { - SoundSource_PlaySfxEachFrameAtFixedWorldPos(globalCtx, &this->actor.world.pos, 21, + SoundSource_PlaySfxEachFrameAtFixedWorldPos(play, &this->actor.world.pos, 21, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } } else { this->actor.scale.x -= 0.001f; if (this->actor.scale.x <= 0.0f) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); Actor_MarkForDeath(&this->actor); } else { this->actor.scale.y = this->actor.scale.x; @@ -608,11 +608,11 @@ void func_80AD8388(EnKame* this, GlobalContext* globalCtx) { sp34.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x; sp34.y = this->actor.world.pos.y + 15.0f; sp34.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z; - func_800B3030(globalCtx, &sp34, &gZeroVec3f, &gZeroVec3f, 100, 0, 2); + func_800B3030(play, &sp34, &gZeroVec3f, &gZeroVec3f, 100, 0, 2); } } -void func_80AD84C0(EnKame* this, GlobalContext* globalCtx) { +void func_80AD84C0(EnKame* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -622,18 +622,18 @@ void func_80AD84C0(EnKame* this, GlobalContext* globalCtx) { return; } - func_80AD7018(this, globalCtx); + func_80AD7018(this, play); if (this->actor.colChkInfo.damageEffect == 13) { return; } if (this->actor.colChkInfo.damageEffect == 14) { - func_80AD8148(this, globalCtx); + func_80AD8148(this, play); } else if (this->actor.colChkInfo.damageEffect == 15) { if (this->collider.base.acFlags & AC_HARD) { func_80AD7C54(this); } else if (!Actor_ApplyDamage(&this->actor)) { - func_80AD8148(this, globalCtx); + func_80AD8148(this, play); } else { func_80AD8060(this); } @@ -670,13 +670,13 @@ void func_80AD84C0(EnKame* this, GlobalContext* globalCtx) { this->drawDmgEffScale = 0.6f; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); } if (!Actor_ApplyDamage(&this->actor)) { - func_80AD8148(this, globalCtx); + func_80AD8148(this, play); } else { func_80AD8060(this); } @@ -684,14 +684,14 @@ void func_80AD84C0(EnKame* this, GlobalContext* globalCtx) { } } - if ((globalCtx->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f)) && + if ((play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f)) && (this->collider.base.acFlags & AC_ON)) { - func_80AD7018(this, globalCtx); + func_80AD7018(this, play); func_80AD7C54(this); } } -void EnKame_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKame_Update(Actor* thisx, PlayState* play) { s32 pad; EnKame* this = THIS; @@ -701,7 +701,7 @@ void EnKame_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A0--; } - func_80AD84C0(this, globalCtx); + func_80AD84C0(this, play); if ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.atFlags & AT_BOUNCED)) { this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); @@ -713,10 +713,10 @@ void EnKame_Update(Actor* thisx, GlobalContext* globalCtx) { func_80AD7568(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 60.0f, 40.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 60.0f, 40.0f, 0x1F); if (this->actor.shape.shadowDraw != NULL) { Actor_SetFocus(&this->actor, 25.0f); @@ -724,14 +724,14 @@ void EnKame_Update(Actor* thisx, GlobalContext* globalCtx) { } 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); if (this->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -748,7 +748,7 @@ void EnKame_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80AD8A48(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80AD8A48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKame* this = THIS; if ((this->actionFunc == func_80AD7424) || (this->actionFunc == func_80AD7B90)) { @@ -761,7 +761,7 @@ s32 func_80AD8A48(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80AD8AF8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80AD8AF8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80AD8E68[] = { { 1500.0f, 0.0f, -2000.0f }, { 1500.0f, 0.0f, 2000.0f }, { 1500.0f, 2000.0f, 0.0f }, { 1500.0f, -2000.0f, 0.0f }, { 2500.0f, 0.0f, 0.0f }, @@ -792,7 +792,7 @@ void func_80AD8AF8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnKame_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKame_Draw(Actor* thisx, PlayState* play) { EnKame* this = THIS; Vec3f sp40; @@ -800,29 +800,28 @@ void EnKame_Draw(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp40, &this->actor.world.pos); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_80AD8E34[this->unk_29C]); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime1.skeleton, this->skelAnime1.jointTable, - this->skelAnime1.dListCount, func_80AD8A48, func_80AD8AF8, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + SkelAnime_DrawFlexOpa(play, this->skelAnime1.skeleton, this->skelAnime1.jointTable, this->skelAnime1.dListCount, + func_80AD8A48, func_80AD8AF8, &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); if (this->actor.shape.shadowDraw == NULL) { - ActorShadow_DrawCircle(&this->actor, NULL, globalCtx); + ActorShadow_DrawCircle(&this->actor, NULL, play); Actor_SetFocus(&this->actor, 25.0f); Collider_UpdateCylinder(&this->actor, &this->collider); Math_Vec3f_Copy(&this->actor.world.pos, &sp40); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 Enkame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 Enkame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKame* this = THIS; if (limbIndex == 1) { @@ -835,10 +834,10 @@ s32 Enkame_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void func_80AD8D64(Actor* thisx, GlobalContext* globalCtx) { +void func_80AD8D64(Actor* thisx, PlayState* play) { EnKame* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime2.skeleton, this->skelAnime2.jointTable, - this->skelAnime2.dListCount, Enkame_OverrideLimbDraw, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime2.skeleton, this->skelAnime2.jointTable, this->skelAnime2.dListCount, + Enkame_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.h b/src/overlays/actors/ovl_En_Kame/z_en_kame.h index d47e96d541..1bcdb43f71 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.h +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.h @@ -5,7 +5,7 @@ struct EnKame; -typedef void (*EnKameActionFunc)(struct EnKame*, GlobalContext*); +typedef void (*EnKameActionFunc)(struct EnKame*, PlayState*); typedef struct EnKame { /* 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 921cb96337..103039f56b 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -12,10 +12,10 @@ #define THIS ((EnKanban*)thisx) -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, @@ -140,7 +140,7 @@ void func_80954960(EnKanban* this) { } } -void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Init(Actor* thisx, PlayState* play) { EnKanban* this = THIS; Actor_SetScale(&this->actor, 0.01f); @@ -148,8 +148,8 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 0; this->actor.flags |= ACTOR_FLAG_1; this->unk_19A = Rand_ZeroFloat(1.9f); - 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->actor.params == ENKANBAN_FISHING) { if (LINK_IS_CHILD) { @@ -163,36 +163,36 @@ void EnKanban_Init(Actor* thisx, GlobalContext* globalCtx) { this->bounceX = 1; this->partFlags = 0xFFFF; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); func_80954960(this); } } -void EnKanban_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKanban_Destroy(Actor* thisx, PlayState* play) { EnKanban* this = THIS; if (this->actionState == ENKANBAN_SIGN) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_80954BE8(EnKanban* this, GlobalContext* globalCtx) { +void func_80954BE8(EnKanban* this, PlayState* play) { s16 yaw; if (!this->msgFlag) { if (this->msgTimer == 0) { yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS_ALT(yaw) < 0x2800) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->msgFlag = true; } else { - func_800B8614(&this->actor, globalCtx, 68.0f); + func_800B8614(&this->actor, play, 68.0f); } } } else { this->msgTimer--; } - } else if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + } else if (Actor_TextboxIsClosing(&this->actor, play)) { this->msgFlag = false; this->msgTimer = 20; } @@ -200,12 +200,12 @@ void func_80954BE8(EnKanban* this, GlobalContext* globalCtx) { #ifdef NON_MATCHING // Lots of branch likely stuff -void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { - // GlobalContext* globalCtx = globalCtx2; +void EnKanban_Update(Actor* thisx, PlayState* play) { + // PlayState* play = play2; u8 bounced = false; s32 pad; EnKanban* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f offset; EnKanban* piece; EnKanban* signpost; @@ -234,7 +234,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->partFlags == 0xFFFF) { - func_80954BE8(this, globalCtx); + func_80954BE8(this, play); } if ((this->invincibilityTimer == 0) && (this->collider.base.acFlags & AC_HIT)) { @@ -245,7 +245,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { this->invincibilityTimer = 6; piece = (EnKanban*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_KANBAN, this->actor.world.pos.x, + &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); if (piece != NULL) { @@ -261,7 +261,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_19A = 1 - this->unk_19A; if (this->unk_199 == 0) { this->unk_199++; - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.focus.pos, 0x60); + Item_DropCollectibleRandom(play, NULL, &this->actor.focus.pos, 0x60); } } else { this->cutType = 0; @@ -393,8 +393,8 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { 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_1; @@ -433,7 +433,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 10.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 10.0f, 50.0f, 5); tempX = this->actor.world.pos.x; tempY = this->actor.world.pos.y; @@ -442,7 +442,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { tempWaterDepth = this->actor.depthInWater; 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, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); func_80954960(this); this->actor.world.pos.x = tempX; @@ -507,16 +507,16 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->bounceX = this->bounceZ = 0; this->actor.world.pos.y += this->actor.depthInWater; - 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; break; } if (onGround) { - temp_v0_18 = func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + temp_v0_18 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((temp_v0_18 == 15) || (temp_v0_18 == 14)) { this->unk_197 = 1; @@ -657,7 +657,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { for (j = 0; j < dustCount + 3; j++) { pos.x = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.x; pos.z = randPlusMinusPoint5Scaled((this->partCount * 0.5f) + 20.0f) + this->actor.world.pos.z; - func_800B0F18(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 100, 5, + func_800B0F18(play, &pos, &velocity, &accel, &primColor, &envColor, 100, 5, Rand_ZeroFloat(5.0f) + 14.0f); } } @@ -709,7 +709,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); if (this->actor.speedXZ != 0.0f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 5); if (this->actor.bgCheckFlags & 8) { this->actor.speedXZ *= -0.5f; if (this->spinVel.y > 0) { @@ -744,9 +744,9 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { } 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.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { + } else if ((play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(100.0f))) { f32 hammerStrength = (100.0f - sqrtf(this->actor.xyzDistToPlayerSq)) * 0.05f; this->actionState = ENKANBAN_AIR; @@ -775,7 +775,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->bounceX == 0) { - Actor* explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; f32 dx; f32 dy; f32 dz; @@ -825,13 +825,13 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx) { switch (this->ocarinaFlag) { case 0: - if (globalCtx->msgCtx.ocarinaMode == 1) { + if (play->msgCtx.ocarinaMode == 1) { this->ocarinaFlag = 1; } break; case 1: - if ((globalCtx->msgCtx.ocarinaMode == 4) && (globalCtx->msgCtx.unk1202E == 7)) { + if ((play->msgCtx.ocarinaMode == 4) && (play->msgCtx.unk1202E == 7)) { this->actionState = ENKANBAN_REPAIR; this->bounceX = 1; play_sound(NA_SE_SY_TRE_BOX_APPEAR); @@ -911,18 +911,18 @@ static f32 sCutAngles[] = { #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 = THIS; f32 zShift; f32 zShift2; s32 i; - Player* player = GET_PLAYER(globalCtx); - u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, ARRAY_COUNT(sShadowTexFlags)); + Player* player = GET_PLAYER(play); + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, ARRAY_COUNT(sShadowTexFlags)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_kanban_DL_000C30); @@ -945,7 +945,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateYS(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0; i < ARRAY_COUNT(sPartFlags); i++) { if (sPartFlags[i] & this->partFlags) { @@ -960,7 +960,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { } this->actor.world.pos.y = this->actor.home.pos.y + phi_f0; Matrix_Translate(0.0f, 0.0f, -100.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->partFlags == 0xFFFF) { gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05AED0); @@ -982,8 +982,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), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_kanban_DL_001630); } } @@ -1025,7 +1024,7 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateXS(this->spinRot.x, MTXMODE_APPLY); Matrix_RotateYS(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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0; i < ARRAY_COUNT(sShadowTexFlags); i++) { if (sShadowTexFlags[i] & this->partFlags) { @@ -1039,5 +1038,5 @@ void EnKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gEnKanban_D_80957DE0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 94452e054a..228fad0534 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -12,32 +12,32 @@ #define THIS ((EnKarebaba*)thisx) -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 func_808F155C(EnKarebaba* this); -void func_808F15B0(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F15B0(EnKarebaba* this, PlayState* play); void func_808F1648(EnKarebaba* this); -void func_808F169C(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F169C(EnKarebaba* this, PlayState* play); void func_808F16FC(EnKarebaba* this); -void func_808F1778(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F1778(EnKarebaba* this, PlayState* play); void func_808F1878(EnKarebaba* this); -void func_808F190C(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F190C(EnKarebaba* this, PlayState* play); void func_808F1A3C(EnKarebaba* this); -void func_808F1A58(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F1A58(EnKarebaba* this, PlayState* play); void func_808F1BF8(EnKarebaba* this); -void func_808F1C84(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F1C84(EnKarebaba* this, PlayState* play); void func_808F1FAC(EnKarebaba* this); -void func_808F200C(EnKarebaba* this, GlobalContext* globalCtx); -void func_808F20FC(EnKarebaba* this, GlobalContext* globalCtx); -void func_808F21A4(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F200C(EnKarebaba* this, PlayState* play); +void func_808F20FC(EnKarebaba* this, PlayState* play); +void func_808F21A4(EnKarebaba* this, PlayState* play); void func_808F220C(EnKarebaba* this); -void func_808F228C(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F228C(EnKarebaba* this, PlayState* play); void func_808F238C(EnKarebaba* this); -void func_808F241C(EnKarebaba* this, GlobalContext* globalCtx); -void func_808F254C(EnKarebaba* this, GlobalContext* globalCtx); +void func_808F241C(EnKarebaba* this, PlayState* play); +void func_808F254C(EnKarebaba* this, PlayState* play); const ActorInit En_Karebaba_InitVars = { ACTOR_EN_KAREBABA, @@ -137,17 +137,17 @@ Color_RGBA8 D_808F2E28 = { 0, 0, 0, 0 }; Gfx* D_808F2E2C[] = { object_dekubaba_DL_001330, object_dekubaba_DL_001628, object_dekubaba_DL_001828 }; -void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Init(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, - this->jointTable, this->morphTable, 8); + SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, + this->morphTable, 8); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit1); Collider_UpdateCylinder(&this->actor, &this->collider2); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit2); Collider_UpdateCylinder(&this->actor, &this->collider1); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -165,14 +165,14 @@ void EnKarebaba_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKarebaba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); } -void func_808F1374(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F1374(EnKarebaba* this, PlayState* play) { s32 phi_a3; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -183,11 +183,11 @@ void func_808F1374(EnKarebaba* this, GlobalContext* globalCtx) { } else { phi_a3 = 4; } - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, phi_a3, 4, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, phi_a3, 4, 0.3f, 0.2f); } } -void func_808F13FC(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F13FC(EnKarebaba* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 2) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffScale = 0.75f; @@ -196,7 +196,7 @@ void func_808F13FC(EnKarebaba* this, GlobalContext* globalCtx) { this->drawDmgEffScale = 0.75f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 3.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider2.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider2.info.bumper.hitPos.x, this->collider2.info.bumper.hitPos.y, this->collider2.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == 3) { @@ -227,7 +227,7 @@ void func_808F155C(EnKarebaba* this) { this->actionFunc = func_808F15B0; } -void func_808F15B0(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F15B0(EnKarebaba* this, PlayState* play) { f32 sp1C; this->unk_1EE++; @@ -246,7 +246,7 @@ void func_808F1648(EnKarebaba* this) { this->actionFunc = func_808F169C; } -void func_808F169C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F169C(EnKarebaba* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 200.0f) && (fabsf(this->actor.playerHeightRel) < 30.0f)) { func_808F16FC(this); } @@ -259,7 +259,7 @@ void func_808F16FC(EnKarebaba* this) { this->actionFunc = func_808F1778; } -void func_808F1778(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F1778(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f) && (this->actor.params == ENKAREBABA_2)) { @@ -275,7 +275,7 @@ void func_808F1778(EnKarebaba* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); } void func_808F1878(EnKarebaba* this) { @@ -299,8 +299,8 @@ void func_808F1878(EnKarebaba* this) { this->actionFunc = func_808F190C; } -void func_808F190C(EnKarebaba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808F190C(EnKarebaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -313,13 +313,13 @@ void func_808F190C(EnKarebaba* this, GlobalContext* globalCtx) { } if (this->collider2.base.acFlags & AC_HIT) { - func_808F13FC(this, globalCtx); + func_808F13FC(this, play); if (this->actor.params == ENKAREBABA_1) { func_808F1BF8(this); } else { func_808F1FAC(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) { func_808F220C(this); } else if ((this->unk_1EE == 0) && (this->actor.params == ENKAREBABA_1)) { @@ -332,7 +332,7 @@ void func_808F1A3C(EnKarebaba* this) { this->actionFunc = func_808F1A58; } -void func_808F1A58(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F1A58(EnKarebaba* this, PlayState* play) { s32 phi_v0; f32 sp28; @@ -362,9 +362,9 @@ void func_808F1A58(EnKarebaba* this, GlobalContext* globalCtx) { this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * sp28) + this->actor.home.pos.z; if (this->collider2.base.acFlags & AC_HIT) { - func_808F13FC(this, globalCtx); + func_808F13FC(this, play); func_808F1BF8(this); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (this->unk_1EE == 0) { func_808F1878(this); } @@ -386,7 +386,7 @@ void func_808F1BF8(EnKarebaba* this) { this->actionFunc = func_808F1C84; } -void func_808F1C84(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F1C84(EnKarebaba* this, PlayState* play) { s32 i; Vec3f sp78; f32 temp_f20; @@ -400,14 +400,14 @@ void func_808F1C84(EnKarebaba* this, GlobalContext* globalCtx) { this->actor.speedXZ = 3.0f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); - func_808F1374(this, globalCtx); + func_808F1374(this, play); } } else { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f); if (this->unk_1EE == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); if ((this->actor.scale.x > 0.005f) && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) { this->actor.scale.z = 0.0f; @@ -415,7 +415,7 @@ void func_808F1C84(EnKarebaba* this, GlobalContext* globalCtx) { this->actor.scale.x = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, -1, 10, NULL); } if (this->actor.bgCheckFlags & 2) { @@ -430,14 +430,14 @@ void func_808F1C84(EnKarebaba* this, GlobalContext* globalCtx) { temp_f22 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 4; i++) { - func_800B1210(globalCtx, &sp78, &gZeroVec3f, &gZeroVec3f, 500, 50); + func_800B1210(play, &sp78, &gZeroVec3f, &gZeroVec3f, 500, 50); sp78.x += temp_f20; sp78.y += temp_f24; sp78.z += temp_f22; } - func_800B1210(globalCtx, &this->actor.home.pos, &gZeroVec3f, &gZeroVec3f, 500, 100); - func_808F20FC(this, globalCtx); + func_800B1210(play, &this->actor.home.pos, &gZeroVec3f, &gZeroVec3f, 500, 100); + func_808F20FC(this, play); } } } @@ -452,18 +452,18 @@ void func_808F1FAC(EnKarebaba* this) { this->actionFunc = func_808F200C; } -void func_808F200C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F200C(EnKarebaba* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->unk_1EE--; if (this->unk_1EE == 0) { - func_808F1374(this, globalCtx); + func_808F1374(this, play); } } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); func_808F238C(this); } else { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 1.0f); } this->actor.scale.y = this->actor.scale.x; @@ -471,29 +471,29 @@ void func_808F200C(EnKarebaba* this, GlobalContext* globalCtx) { } } -void func_808F20FC(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F20FC(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; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 8); + func_800BC154(play, &play->actorCtx, &this->actor, 8); this->unk_1EE = 200; this->actor.flags &= ~ACTOR_FLAG_20; this->drawDmgEffAlpha = 0.0f; this->actionFunc = func_808F21A4; } -void func_808F21A4(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F21A4(EnKarebaba* this, PlayState* play) { if (this->unk_1EE != 0) { this->unk_1EE--; } - if (Actor_HasParent(&this->actor, globalCtx) || (this->unk_1EE == 0)) { + if (Actor_HasParent(&this->actor, play) || (this->unk_1EE == 0)) { func_808F238C(this); } else { - Actor_PickUpNearby(&this->actor, globalCtx, GI_STICKS_1); + Actor_PickUpNearby(&this->actor, play, GI_STICKS_1); } } @@ -504,7 +504,7 @@ void func_808F220C(EnKarebaba* this) { this->actionFunc = func_808F228C; } -void func_808F228C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F228C(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f) && (this->actor.params == ENKAREBABA_2)) { @@ -520,7 +520,7 @@ void func_808F228C(EnKarebaba* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y += 0x1999; - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, -1, 10, NULL); } void func_808F238C(EnKarebaba* this) { @@ -535,7 +535,7 @@ void func_808F238C(EnKarebaba* this) { this->actionFunc = func_808F254C; } -void func_808F241C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F241C(EnKarebaba* this, PlayState* play) { f32 sp1C; this->unk_1EE++; @@ -547,7 +547,7 @@ void func_808F241C(EnKarebaba* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); if (this->actor.params == ENKAREBABA_1) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, 5); } func_808F1648(this); } @@ -561,7 +561,7 @@ void func_808F24F8(EnKarebaba* this) { this->actionFunc = func_808F241C; } -void func_808F254C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F254C(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_1EE != 0) { @@ -573,12 +573,12 @@ void func_808F254C(EnKarebaba* this, GlobalContext* globalCtx) { } } -void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnKarebaba_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnKarebaba* this = THIS; f32 max; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -597,9 +597,9 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->actionFunc != func_808F254C) { if (this->actionFunc == func_808F1C84) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 10.0f, 5); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->unk_22C == 0) { this->unk_22C = this->actor.floorPoly; } @@ -608,11 +608,11 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actionFunc != func_808F1C84) && (this->actionFunc != func_808F200C) && (this->actionFunc != func_808F21A4)) { if ((this->actionFunc != func_808F241C) && (this->actionFunc != func_808F15B0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(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); Actor_SetFocus(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f); max = this->actor.home.pos.y + 40.0f; @@ -623,12 +623,12 @@ void EnKarebaba_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_808F280C(EnKarebaba* this, GlobalContext* globalCtx) { +void func_808F280C(EnKarebaba* this, PlayState* play) { MtxF sp40; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); @@ -636,35 +636,34 @@ void func_808F280C(EnKarebaba* this, GlobalContext* globalCtx) { Matrix_Mult(&sp40, MTXMODE_NEW); Matrix_Scale(0.15f, 1.0f, 0.15f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKarebaba_Draw(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; s32 i; s32 sp94; s16 limbCount; f32 sp8C = 0.01f; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Math_Vec3f_Copy(this->limbPos, &this->actor.world.pos); if (this->actionFunc == func_808F21A4) { if ((this->unk_1EE > 40) || (this->unk_1EE & 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); } } else if (this->actionFunc != func_808F254C) { - func_800AE2A0(globalCtx, &D_808F2E28, 1, 2); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_800AE2A0(play, &D_808F2E28, 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 == func_808F241C) || (this->actionFunc == func_808F200C) || @@ -686,8 +685,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < sp94; i++) { Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_808F2E2C[i]); Matrix_MultZero(&this->limbPos[1 + i]); @@ -696,10 +694,10 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - func_800AE2A0(globalCtx, &D_808F2E28, 1, 2); + func_800AE2A0(play, &D_808F2E28, 1, 2); Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); if (this->actionFunc != func_808F15B0) { @@ -709,19 +707,19 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(sp8C, sp8C, sp8C, MTXMODE_APPLY); Matrix_RotateYS(this->actor.home.rot.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); if (this->actionFunc == func_808F1C84) { Matrix_RotateZYX(-0x4000, this->actor.shape.rot.y - this->actor.home.rot.y, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); Matrix_MultZero(&this->limbPos[3]); } - func_800AE5A0(globalCtx); + func_800AE5A0(play); if (this->actor.params == ENKAREBABA_2) { limbCount = 1; @@ -729,12 +727,12 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { limbCount = ARRAY_COUNT(this->limbPos); } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, limbCount, this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, limbCount, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); if (this->unk_22C != 0) { - func_808F280C(this, globalCtx); + func_808F280C(this, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 e91e151ae4..a1b3e5a837 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -5,7 +5,7 @@ struct EnKarebaba; -typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, GlobalContext*); +typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, PlayState*); enum { /* 0 */ ENKAREBABA_0, diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index 0953781373..ad85d9edb7 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -10,17 +10,17 @@ #define THIS ((EnKbt*)thisx) -void EnKbt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKbt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKbt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKbt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKbt_Init(Actor* thisx, PlayState* play); +void EnKbt_Destroy(Actor* thisx, PlayState* play); +void EnKbt_Update(Actor* thisx, PlayState* play); +void EnKbt_Draw(Actor* thisx, PlayState* play); -s32 func_80B33E64(GlobalContext* globalCtx); -s32 func_80B33E8C(GlobalContext* globalCtx); +s32 func_80B33E64(PlayState* play); +s32 func_80B33E8C(PlayState* play); void func_80B33EF0(EnKbt* this, s16 arg1); -Actor* func_80B3403C(GlobalContext* globalCtx); -void func_80B34314(EnKbt* this, GlobalContext* globalCtx); -void func_80B34598(EnKbt* this, GlobalContext* globalCtx); +Actor* func_80B3403C(PlayState* play); +void func_80B34314(EnKbt* this, PlayState* play); +void func_80B34598(EnKbt* this, PlayState* play); const ActorInit En_Kbt_InitVars = { ACTOR_EN_KBT, @@ -34,11 +34,11 @@ const ActorInit En_Kbt_InitVars = { (ActorFunc)EnKbt_Draw, }; -void EnKbt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKbt_Init(Actor* thisx, PlayState* play) { EnKbt* this = THIS; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_kbt_Skel_00DEE8, &object_kbt_Anim_004274, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_kbt_Skel_00DEE8, &object_kbt_Anim_004274, this->jointTable, this->morphTable, OBJECT_KBT_LIMB_MAX); this->unk_27C = 0; this->actor.home.rot.z = 0; @@ -46,13 +46,13 @@ void EnKbt_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_27F = 0; this->unk_280 = 13; this->unk_282 = 13; - this->unk_278 = func_80B3403C(globalCtx); + this->unk_278 = func_80B3403C(play); this->unk_284 = 0; this->actor.textId = 0; - if (func_80B33E64(globalCtx)) { + if (func_80B33E64(play)) { func_80B33EF0(this, 6); this->unk_282 = 11; - if (func_80B33E8C(globalCtx)) { + if (func_80B33E8C(play)) { this->actor.textId = 0xC50; } else { this->actor.textId = 0xC4E; @@ -67,16 +67,16 @@ void EnKbt_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void EnKbt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKbt_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80B33E64(GlobalContext* globalCtx) { - return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; +s32 func_80B33E64(PlayState* play) { + return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; } -s32 func_80B33E8C(GlobalContext* globalCtx) { +s32 func_80B33E8C(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { return true; } return false; @@ -106,8 +106,8 @@ void func_80B33EF0(EnKbt* this, s16 arg1) { } } -Actor* func_80B3403C(GlobalContext* globalCtx) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +Actor* func_80B3403C(PlayState* play) { + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npc != NULL) { if (npc->id == ACTOR_EN_KGY) { @@ -234,14 +234,14 @@ void func_80B3415C(EnKbt* this) { } } -void func_80B34314(EnKbt* this, GlobalContext* globalCtx) { +void func_80B34314(EnKbt* this, PlayState* play) { s32 playerForm; func_80B34078(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B34598; - Actor_ChangeFocus(&this->actor, globalCtx, this->unk_278); + Actor_ChangeFocus(&this->actor, play, this->unk_278); this->unk_278->textId = this->actor.textId; this->unk_27C &= ~4; if (this->actor.textId == 0xC4E) { @@ -270,13 +270,13 @@ void func_80B34314(EnKbt* this, GlobalContext* globalCtx) { this->actor.textId = 0xC37; } } else if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - if (func_80B33E8C(globalCtx)) { + if (func_80B33E8C(play)) { this->actor.textId = 0xC50; } else { this->actor.textId = 0xC4E; } } - func_800B8614(&this->actor, globalCtx, 260.0f); + func_800B8614(&this->actor, play, 260.0f); } } func_80B3415C(this); @@ -289,7 +289,7 @@ void func_80B34574(EnKbt* this) { this->actionFunc = func_80B34314; } -void func_80B34598(EnKbt* this, GlobalContext* globalCtx) { +void func_80B34598(EnKbt* this, PlayState* play) { func_80B34078(this); switch (this->actor.textId) { @@ -333,7 +333,7 @@ void func_80B34598(EnKbt* this, GlobalContext* globalCtx) { this->unk_27E = 4; this->unk_27F = 0; this->unk_282 = 11; - if (func_80B33E8C(globalCtx)) { + if (func_80B33E8C(play)) { this->actor.textId = 0xC50; } else if (this->unk_27C & 0x10) { this->actor.textId = 0xC4F; @@ -516,13 +516,13 @@ void func_80B34598(EnKbt* this, GlobalContext* globalCtx) { func_80B3415C(this); } -void EnKbt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKbt_Update(Actor* thisx, PlayState* play) { EnKbt* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnKbt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnKbt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKbt* this = THIS; if (!(this->unk_27C & 1) && (limbIndex == OBJECT_KBT_LIMB_0E)) { @@ -533,7 +533,7 @@ s32 EnKbt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f D_80B34B84 = { 500.0f, 500.0f, 0.0f }; -void EnKbt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnKbt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnKbt* this = THIS; if (limbIndex == OBJECT_KBT_LIMB_09) { @@ -550,14 +550,14 @@ TexturePtr D_80B34B98[] = { object_kbt_Tex_00B5B8, object_kbt_Tex_00BDB8, object_kbt_Tex_00C5B8, object_kbt_Tex_00CDB8, object_kbt_Tex_00D5B8, }; -void EnKbt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKbt_Draw(Actor* thisx, PlayState* play) { EnKbt* this = THIS; Gfx* gfx; TexturePtr tex; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -569,8 +569,8 @@ void EnKbt_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = &gfx[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(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, EnKbt_OverrideLimbDraw, EnKbt_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h index 7556e3f5c8..b3c6679296 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.h @@ -6,7 +6,7 @@ struct EnKbt; -typedef void (*EnKbtActionFunc)(struct EnKbt*, GlobalContext*); +typedef void (*EnKbtActionFunc)(struct EnKbt*, PlayState*); typedef struct EnKbt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index fac169b9db..0c902754d4 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -12,30 +12,30 @@ #define THIS ((EnKendoJs*)thisx) -void EnKendoJs_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKendoJs_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKendoJs_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKendoJs_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKendoJs_Init(Actor* thisx, PlayState* play); +void EnKendoJs_Destroy(Actor* thisx, PlayState* play); +void EnKendoJs_Update(Actor* thisx, PlayState* play); +void EnKendoJs_Draw(Actor* thisx, PlayState* play); void func_80B26538(EnKendoJs* this); -void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B2654C(EnKendoJs* this, PlayState* play); void func_80B26AE8(EnKendoJs* this); -void func_80B26AFC(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B26AFC(EnKendoJs* this, PlayState* play); void func_80B2701C(EnKendoJs* this); -void func_80B27030(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B27030(EnKendoJs* this, PlayState* play); void func_80B2714C(EnKendoJs* this); -void func_80B27188(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B27188(EnKendoJs* this, PlayState* play); void func_80B273D0(EnKendoJs* this); -void func_80B2740C(EnKendoJs* this, GlobalContext* globalCtx); -void func_80B274BC(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B2740C(EnKendoJs* this, PlayState* play); +void func_80B274BC(EnKendoJs* this, PlayState* play); void func_80B276C4(EnKendoJs* this); -void func_80B276D8(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B276D8(EnKendoJs* this, PlayState* play); void func_80B27760(EnKendoJs* this); -void func_80B27774(EnKendoJs* this, GlobalContext* globalCtx); -void func_80B2783C(EnKendoJs* this, GlobalContext* globalCtx); -s32 func_80B278C4(GlobalContext* globalCtx, Vec3f arg1); -void func_80B279F0(EnKendoJs* this, GlobalContext* globalCtx, s32 arg2); -void func_80B27A90(EnKendoJs* this, GlobalContext* globalCtx); +void func_80B27774(EnKendoJs* this, PlayState* play); +void func_80B2783C(EnKendoJs* this, PlayState* play); +s32 func_80B278C4(PlayState* play, Vec3f arg1); +void func_80B279F0(EnKendoJs* this, PlayState* play, s32 arg2); +void func_80B27A90(EnKendoJs* this, PlayState* play); const ActorInit En_Kendo_Js_InitVars = { ACTOR_EN_KENDO_JS, @@ -96,25 +96,25 @@ s16 D_80B27D10[] = { 0x271B, 0x271D, 0x271F, 0x2721, 0x2723, 0x2725, 0x2727, }; -void EnKendoJs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKendoJs_Init(Actor* thisx, PlayState* play) { s32 pad; EnKendoJs* this = THIS; 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable, this->morphTable, 13); if ((CURRENT_DAY == 3) && !((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) { if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_KANBAN, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z - 10.0f, this->actor.home.rot.x, - this->actor.home.rot.y, this->actor.home.rot.z, 0x10); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KANBAN, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z - 10.0f, this->actor.home.rot.x, this->actor.home.rot.y, + this->actor.home.rot.z, 0x10); Actor_MarkForDeath(&this->actor); } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); @@ -123,10 +123,10 @@ void EnKendoJs_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { - Path* path = &globalCtx->setupPathList[ENKENDOJS_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENKENDOJS_GET_FF00(&this->actor)]; this->unk_274 = Lib_SegmentedToVirtual(path->points); } @@ -142,10 +142,10 @@ void EnKendoJs_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B26538(this); } -void EnKendoJs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKendoJs_Destroy(Actor* thisx, PlayState* play) { EnKendoJs* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); gSaveContext.save.weekEventReg[82] &= (u8)~8; } @@ -153,11 +153,11 @@ void func_80B26538(EnKendoJs* this) { this->actionFunc = func_80B2654C; } -void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx) { +void func_80B2654C(EnKendoJs* this, PlayState* play) { s32 phi_v0; s32 sp30; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { if (CURRENT_DAY != 0) { sp30 = CURRENT_DAY - 1; } else { @@ -165,7 +165,7 @@ void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx) { } if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) { - Message_StartTextbox(globalCtx, 0x273C, &this->actor); + Message_StartTextbox(play, 0x273C, &this->actor); this->unk_288 = 0x273C; } else if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { switch (gSaveContext.save.playerForm) { @@ -186,14 +186,14 @@ void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx) { break; } - Message_StartTextbox(globalCtx, D_80B27CE0[phi_v0][sp30], &this->actor); + Message_StartTextbox(play, D_80B27CE0[phi_v0][sp30], &this->actor); this->unk_288 = D_80B27CE0[phi_v0][sp30]; - } else if ((Player_GetMask(globalCtx) != PLAYER_MASK_NONE) && (Player_GetMask(globalCtx) < PLAYER_MASK_GIANT)) { - u16 sp2E = Player_GetMask(globalCtx) + 0x273C; + } else if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) { + u16 sp2E = Player_GetMask(play) + 0x273C; if (0) {} - Message_StartTextbox(globalCtx, sp2E, &this->actor); + Message_StartTextbox(play, sp2E, &this->actor); this->unk_288 = sp2E; } else { if (this->unk_28A == 0) { @@ -202,33 +202,33 @@ void func_80B2654C(EnKendoJs* this, GlobalContext* globalCtx) { } else { phi_v0 = 1; } - Message_StartTextbox(globalCtx, D_80B27CF4[phi_v0][sp30], &this->actor); + Message_StartTextbox(play, D_80B27CF4[phi_v0][sp30], &this->actor); this->unk_288 = D_80B27CF4[phi_v0][sp30]; } func_80B26AE8(this); } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void func_80B26758(EnKendoJs* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx) && (this->unk_288 == 0x2716)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_80B26758(EnKendoJs* this, PlayState* play) { + if (Message_ShouldAdvance(play) && (this->unk_288 == 0x2716)) { + switch (play->msgCtx.choiceIndex) { case 0: if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x272C, &this->actor); + Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - } else if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x2718, &this->actor); + Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; } else { func_8019F208(); - func_801159EC(-globalCtx->msgCtx.unk1206C); - Message_StartTextbox(globalCtx, 0x2719, &this->actor); + func_801159EC(-play->msgCtx.unk1206C); + Message_StartTextbox(play, 0x2719, &this->actor); this->unk_288 = 0x2719; } break; @@ -236,33 +236,33 @@ void func_80B26758(EnKendoJs* this, GlobalContext* globalCtx) { case 1: if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x272C, &this->actor); + Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - } else if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk12070) { + } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk12070) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x2718, &this->actor); + Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; } else { func_8019F208(); - func_801159EC(-globalCtx->msgCtx.unk12070); - Message_StartTextbox(globalCtx, 0x273A, &this->actor); + func_801159EC(-play->msgCtx.unk12070); + Message_StartTextbox(play, 0x273A, &this->actor); this->unk_288 = 0x273A; } break; case 2: func_8019F230(); - Message_StartTextbox(globalCtx, 0x2717, &this->actor); + Message_StartTextbox(play, 0x2717, &this->actor); this->unk_288 = 0x2717; } } } -void func_80B269A4(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B269A4(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (!Message_ShouldAdvance(globalCtx)) { + if (!Message_ShouldAdvance(play)) { return; } @@ -273,38 +273,38 @@ void func_80B269A4(EnKendoJs* this, GlobalContext* globalCtx) { case 0x2713: case 0x2714: case 0x2715: - Message_StartTextbox(globalCtx, 0x2716, &this->actor); + Message_StartTextbox(play, 0x2716, &this->actor); this->unk_288 = 0x2716; break; case 0x2719: - func_801477B4(globalCtx); + func_801477B4(play); player->stateFlags1 |= 0x20; func_80B2701C(this); break; case 0x271A: - func_801477B4(globalCtx); + func_801477B4(play); func_80B2714C(this); break; case 0x273A: - Message_StartTextbox(globalCtx, 0x273B, &this->actor); + Message_StartTextbox(play, 0x273B, &this->actor); this->unk_288 = 0x273B; break; case 0x273B: - func_801477B4(globalCtx); - func_80112AFC(globalCtx); + func_801477B4(play); + func_80112AFC(play); player->stateFlags1 |= 0x20; func_80B273D0(this); break; case 0x272D: - func_801477B4(globalCtx); + func_801477B4(play); gSaveContext.minigameState = 3; func_80B276C4(this); - func_80B276D8(this, globalCtx); + func_80B276D8(this, play); break; } } @@ -313,20 +313,20 @@ void func_80B26AE8(EnKendoJs* this) { this->actionFunc = func_80B26AFC; } -void func_80B26AFC(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B26AFC(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - func_80B26758(this, globalCtx); + func_80B26758(this, play); break; case 5: - func_80B269A4(this, globalCtx); + func_80B269A4(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_288 == 0x272C) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); } @@ -347,12 +347,12 @@ void func_80B26AFC(EnKendoJs* this, GlobalContext* globalCtx) { } } -s32 func_80B26BF8(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B26BF8(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_284) { case 0: - if (func_80122FCC(globalCtx)) { + if (func_80122FCC(play)) { return 0; } @@ -372,7 +372,7 @@ s32 func_80B26BF8(EnKendoJs* this, GlobalContext* globalCtx) { break; case 2: - if (func_80122F9C(globalCtx)) { + if (func_80122F9C(play)) { return 0; } @@ -433,24 +433,24 @@ s32 func_80B26BF8(EnKendoJs* this, GlobalContext* globalCtx) { return 2; } -void func_80B26EB4(EnKendoJs* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, D_80B27D00[this->unk_284], &this->actor); +void func_80B26EB4(EnKendoJs* this, PlayState* play) { + Message_StartTextbox(play, D_80B27D00[this->unk_284], &this->actor); this->unk_288 = D_80B27D00[this->unk_284]; this->unk_284++; } -void func_80B26F14(EnKendoJs* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, D_80B27D10[this->unk_284], &this->actor); +void func_80B26F14(EnKendoJs* this, PlayState* play) { + Message_StartTextbox(play, D_80B27D10[this->unk_284], &this->actor); this->unk_288 = D_80B27D10[this->unk_284]; } -s32 func_80B26F6C(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B26F6C(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (this->unk_288) { case 0x271D: if (func_80124190(player)) { - Message_StartTextbox(globalCtx, 0x272A, &this->actor); + Message_StartTextbox(play, 0x272A, &this->actor); this->unk_288 = 0x272A; return true; } @@ -458,7 +458,7 @@ s32 func_80B26F6C(EnKendoJs* this, GlobalContext* globalCtx) { case 0x2721: if (this->unk_292 != 0) { - Message_StartTextbox(globalCtx, 0x272B, &this->actor); + Message_StartTextbox(play, 0x272B, &this->actor); this->unk_288 = 0x272B; return true; } @@ -471,23 +471,23 @@ void func_80B2701C(EnKendoJs* this) { this->actionFunc = func_80B27030; } -void func_80B27030(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B27030(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp20 = this->actor.world.pos; sp20.z += 200.0f; - if (func_80B278C4(globalCtx, sp20)) { + if (func_80B278C4(play, sp20)) { this->actor.flags |= ACTOR_FLAG_10000; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; player->stateFlags1 &= ~0x20; - func_80B279F0(this, globalCtx, 0); - Message_StartTextbox(globalCtx, 0x271A, &this->actor); + func_80B279F0(this, play, 0); + Message_StartTextbox(play, 0x271A, &this->actor); this->unk_288 = 0x271A; func_80B26AE8(this); } else { - func_800B8614(&this->actor, globalCtx, 800.0f); + func_800B8614(&this->actor, play, 800.0f); } } } @@ -501,18 +501,18 @@ void func_80B2714C(EnKendoJs* this) { this->actionFunc = func_80B27188; } -void func_80B27188(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B27188(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_288 == 0x2729) { - func_80B26F14(this, globalCtx); - } else if (!func_80B26F6C(this, globalCtx)) { + func_80B26F14(this, play); + } else if (!func_80B26F6C(this, play)) { if (this->skelAnime.animation == &object_js_Anim_00016C) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); } this->unk_286 = 2; - func_801477B4(globalCtx); + func_801477B4(play); player->stateFlags1 &= ~0x20; } } else if (this->unk_286 == 2) { @@ -520,19 +520,19 @@ void func_80B27188(EnKendoJs* this, GlobalContext* globalCtx) { } if (this->unk_286 == 1) { - switch (func_80B26BF8(this, globalCtx)) { + switch (func_80B26BF8(this, play)) { case 0: this->unk_286 = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); player->stateFlags1 |= 0x20; - func_80B26EB4(this, globalCtx); + func_80B26EB4(this, play); break; case 1: Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); this->unk_286 = 0; player->stateFlags1 |= 0x20; - Message_StartTextbox(globalCtx, 0x2729, &this->actor); + Message_StartTextbox(play, 0x2729, &this->actor); this->unk_288 = 0x2729; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); break; @@ -542,7 +542,7 @@ void func_80B27188(EnKendoJs* this, GlobalContext* globalCtx) { this->unk_290++; if (this->unk_290 == 30) { this->unk_290 = 0; - func_80B279F0(this, globalCtx, 0); + func_80B279F0(this, play, 0); } } break; @@ -568,29 +568,29 @@ void func_80B273D0(EnKendoJs* this) { this->actionFunc = func_80B2740C; } -void func_80B2740C(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B2740C(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp18 = this->actor.world.pos; sp18.z += 300.0f; - if (func_80B278C4(globalCtx, sp18)) { + if (func_80B278C4(play, sp18)) { this->unk_28C = 0; player->stateFlags1 &= ~0x20; this->actionFunc = func_80B274BC; } } -void func_80B274BC(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B274BC(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_290 >= 140) { if (this->unk_284 == 5) { if (gSaveContext.minigameScore == 30) { - Message_StartTextbox(globalCtx, 0x272D, &this->actor); + Message_StartTextbox(play, 0x272D, &this->actor); this->unk_288 = 0x272D; } else { - Message_StartTextbox(globalCtx, 0x272E, &this->actor); + Message_StartTextbox(play, 0x272E, &this->actor); this->unk_288 = 0x272E; } player->stateFlags1 |= 0x20; @@ -600,12 +600,12 @@ void func_80B274BC(EnKendoJs* this, GlobalContext* globalCtx) { } play_sound(NA_SE_SY_FOUND); - func_80B279F0(this, globalCtx, (((s32)Rand_Next() & 0xFF) % 3) + 1); - func_80B279F0(this, globalCtx, (((s32)Rand_Next() & 0xFF) % 3) + 4); + func_80B279F0(this, play, (((s32)Rand_Next() & 0xFF) % 3) + 1); + func_80B279F0(this, play, (((s32)Rand_Next() & 0xFF) % 3) + 4); this->unk_290 = 0; this->unk_284++; } else if (this->unk_290 == 120) { - func_80B27A90(this, globalCtx); + func_80B27A90(this, play); this->unk_290++; } else { this->unk_290++; @@ -613,33 +613,33 @@ void func_80B274BC(EnKendoJs* this, GlobalContext* globalCtx) { if (this->unk_28E == 1) { if ((player->swordAnimation == 17) || (player->swordAnimation == 20)) { - globalCtx->interfaceCtx.unk_25C = 3; + play->interfaceCtx.unk_25C = 3; if (gSaveContext.minigameScore >= 27) { player->stateFlags1 |= 0x20; } } else if (player->swordAnimation == 12) { - globalCtx->interfaceCtx.unk_25C = 2; + play->interfaceCtx.unk_25C = 2; } else { - globalCtx->interfaceCtx.unk_25C = 1; + play->interfaceCtx.unk_25C = 1; } Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); this->unk_28E = 0; } - func_80B2783C(this, globalCtx); + func_80B2783C(this, play); } void func_80B276C4(EnKendoJs* this) { this->actionFunc = func_80B276D8; } -void func_80B276D8(EnKendoJs* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B276D8(EnKendoJs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; func_80B27760(this); } else if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 800.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 800.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 800.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 800.0f, 100.0f); } } @@ -647,34 +647,34 @@ void func_80B27760(EnKendoJs* this) { this->actionFunc = func_80B27774; } -void func_80B27774(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B27774(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (!(gSaveContext.save.weekEventReg[63] & 0x20)) { gSaveContext.save.weekEventReg[63] |= 0x20; - Message_StartTextbox(globalCtx, 0x272F, &this->actor); + Message_StartTextbox(play, 0x272F, &this->actor); this->unk_288 = 0x272F; } else { - Message_StartTextbox(globalCtx, 0x2730, &this->actor); + Message_StartTextbox(play, 0x2730, &this->actor); this->unk_288 = 0x2730; } func_80B26AE8(this); player->stateFlags1 &= ~0x20; } else { - func_800B85E0(&this->actor, globalCtx, 1000.0f, -1); + func_800B85E0(&this->actor, play, 1000.0f, -1); } } -void func_80B2783C(EnKendoJs* this, GlobalContext* globalCtx) { +void func_80B2783C(EnKendoJs* this, PlayState* play) { if (this->actor.cutscene != -1) { - Camera_ChangeDataIdx(globalCtx->cameraPtrs[CAM_ID_MAIN], + Camera_ChangeDataIdx(play->cameraPtrs[CAM_ID_MAIN], ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); } } -void func_80B27880(EnKendoJs* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B27880(EnKendoJs* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f0 = this->actor.world.pos.z + 70.0f; if ((ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) && (player->actor.world.pos.z < temp_f0)) { @@ -682,8 +682,8 @@ void func_80B27880(EnKendoJs* this, GlobalContext* globalCtx) { } } -s32 func_80B278C4(GlobalContext* globalCtx, Vec3f arg1) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B278C4(PlayState* play, Vec3f arg1) { + Player* player = GET_PLAYER(play); f32 temp_f0; f32 sp28; s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1); @@ -698,8 +698,8 @@ s32 func_80B278C4(GlobalContext* globalCtx, Vec3f arg1) { sp28 = 80.0f; } - globalCtx->actorCtx.unk268 = 1; - func_800B6F20(globalCtx, &globalCtx->actorCtx.unk_26C, sp28, sp22); + play->actorCtx.unk268 = 1; + func_800B6F20(play, &play->actorCtx.unk_26C, sp28, sp22); if (temp_f0 < 20.0f) { return true; @@ -708,22 +708,22 @@ s32 func_80B278C4(GlobalContext* globalCtx, Vec3f arg1) { } } -void func_80B279AC(EnKendoJs* this, GlobalContext* globalCtx) { +void func_80B279AC(EnKendoJs* this, PlayState* 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_80B279F0(EnKendoJs* this, GlobalContext* globalCtx, s32 arg2) { +void func_80B279F0(EnKendoJs* this, PlayState* play, s32 arg2) { f32 x = this->unk_274[arg2].x; f32 y = this->unk_274[arg2].y; f32 z = this->unk_274[arg2].z; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_MARUTA, x, y, z, 0, 0, 0, 0); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MARUTA, x, y, z, 0, 0, 0, 0); this->unk_28C++; } -void func_80B27A90(EnKendoJs* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void func_80B27A90(EnKendoJs* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (actor != NULL) { if (actor->id == ACTOR_EN_MARUTA) { @@ -735,19 +735,18 @@ void func_80B27A90(EnKendoJs* this, GlobalContext* globalCtx) { this->unk_28C = 0; } -void EnKendoJs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKendoJs_Update(Actor* thisx, PlayState* play) { EnKendoJs* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); - func_80B279AC(this, globalCtx); - func_80B27880(this, globalCtx); + Actor_TrackPlayer(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos); + func_80B279AC(this, play); + func_80B27880(this, play); } -s32 EnKendoJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnKendoJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKendoJs* this = THIS; if (limbIndex == 12) { @@ -756,13 +755,13 @@ s32 EnKendoJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnKendoJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnKendoJs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnKendoJs_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKendoJs_Draw(Actor* thisx, PlayState* play) { EnKendoJs* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnKendoJs_OverrideLimbDraw, EnKendoJs_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h index 2820aac217..b811563a9d 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h @@ -5,7 +5,7 @@ struct EnKendoJs; -typedef void (*EnKendoJsActionFunc)(struct EnKendoJs*, GlobalContext*); +typedef void (*EnKendoJsActionFunc)(struct EnKendoJs*, PlayState*); #define ENKENDOJS_GET_FF(thisx) ((thisx)->params & 0xFF) #define ENKENDOJS_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index dec6be3f8d..b2a44dd1f9 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -14,24 +14,24 @@ #define THIS ((EnKgy*)thisx) -void EnKgy_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKgy_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKgy_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKgy_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKgy_Init(Actor* thisx, PlayState* play); +void EnKgy_Destroy(Actor* thisx, PlayState* play); +void EnKgy_Update(Actor* thisx, PlayState* play); +void EnKgy_Draw(Actor* thisx, PlayState* play); void EnKgy_ChangeAnim(EnKgy* this, s16 arg1, u8 arg2, f32 arg3); -EnKbt* EnKgy_FindZubora(GlobalContext* globalCtx); -ObjIcePoly* EnKgy_FindIceBlock(GlobalContext* globalCtx); -void func_80B40D30(GlobalContext* globalCtx); -s32 func_80B40D64(GlobalContext* globalCtx); -s32 func_80B40DB4(GlobalContext* globalCtx); -void func_80B419B0(EnKgy* this, GlobalContext* globalCtx); -void func_80B41A48(EnKgy* this, GlobalContext* globalCtx); -void func_80B41E18(EnKgy* this, GlobalContext* globalCtx); -void func_80B42508(EnKgy* this, GlobalContext* globalCtx); -void func_80B425A0(EnKgy* this, GlobalContext* globalCtx); -void func_80B42714(EnKgy* this, GlobalContext* globalCtx); -void func_80B42D28(EnKgy* this, GlobalContext* globalCtx); +EnKbt* EnKgy_FindZubora(PlayState* play); +ObjIcePoly* EnKgy_FindIceBlock(PlayState* play); +void func_80B40D30(PlayState* play); +s32 func_80B40D64(PlayState* play); +s32 func_80B40DB4(PlayState* play); +void func_80B419B0(EnKgy* this, PlayState* play); +void func_80B41A48(EnKgy* this, PlayState* play); +void func_80B41E18(EnKgy* this, PlayState* play); +void func_80B42508(EnKgy* this, PlayState* play); +void func_80B425A0(EnKgy* this, PlayState* play); +void func_80B42714(EnKgy* this, PlayState* play); +void func_80B42D28(EnKgy* this, PlayState* play); const ActorInit En_Kgy_InitVars = { ACTOR_EN_KGY, @@ -45,30 +45,30 @@ const ActorInit En_Kgy_InitVars = { (ActorFunc)EnKgy_Draw, }; -void EnKgy_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKgy_Init(Actor* thisx, PlayState* play) { EnKgy* this = THIS; s16 cs; s32 i; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_kgy_Skel_00F910, &object_kgy_Anim_004B98, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_kgy_Skel_00F910, &object_kgy_Anim_004B98, this->jointTable, this->morphTable, 23); this->unk_2D2 = -1; this->unk_29C = 0; this->unk_2E4 = 0; this->unk_2E2 = -1; - this->zubora = EnKgy_FindZubora(globalCtx); - this->iceBlock = EnKgy_FindIceBlock(globalCtx); - Flags_UnsetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor) + 1); - if (Flags_GetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor)) || (gSaveContext.save.weekEventReg[33] & 0x80)) { - Flags_SetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor) + 1); - globalCtx->envCtx.lightSettingOverride = 1; + this->zubora = EnKgy_FindZubora(play); + this->iceBlock = EnKgy_FindIceBlock(play); + Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); + if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || (gSaveContext.save.weekEventReg[33] & 0x80)) { + Flags_SetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); + play->envCtx.lightSettingOverride = 1; gSaveContext.save.weekEventReg[21] |= 1; - if (!func_80B40D64(globalCtx)) { + if (!func_80B40D64(play)) { EnKgy_ChangeAnim(this, 4, 0, 0); this->actionFunc = func_80B425A0; this->actor.textId = 0xC35; - } else if (!func_80B40DB4(globalCtx)) { + } else if (!func_80B40DB4(play)) { EnKgy_ChangeAnim(this, 6, 2, 0); this->actionFunc = func_80B419B0; this->actor.textId = 0xC4E; @@ -99,15 +99,15 @@ void EnKgy_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, 64, 64, -1); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_300 = -1; this->actor.flags &= ~ACTOR_FLAG_1; } -void EnKgy_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKgy_Destroy(Actor* thisx, PlayState* play) { EnKgy* this = THIS; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 transitionRate) { @@ -128,8 +128,8 @@ void func_80B40BC0(EnKgy* this, s16 arg1) { } } -EnKbt* EnKgy_FindZubora(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +EnKbt* EnKgy_FindZubora(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { if (actor->id == ACTOR_EN_KBT) { @@ -140,8 +140,8 @@ EnKbt* EnKgy_FindZubora(GlobalContext* globalCtx) { return NULL; } -ObjIcePoly* EnKgy_FindIceBlock(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +ObjIcePoly* EnKgy_FindIceBlock(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { if (actor->id == ACTOR_OBJ_ICE_POLY) { @@ -152,34 +152,34 @@ ObjIcePoly* EnKgy_FindIceBlock(GlobalContext* globalCtx) { return NULL; } -void func_80B40C74(GlobalContext* globalCtx) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 1; +void func_80B40C74(PlayState* play) { + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; if (CURRENT_DAY == 1) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 2; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 2; } else { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~2; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~2; } } -void func_80B40D00(GlobalContext* globalCtx) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= 4; +void func_80B40D00(PlayState* play) { + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 4; } -void func_80B40D30(GlobalContext* globalCtx) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; +void func_80B40D30(PlayState* play) { + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; } -s32 func_80B40D64(GlobalContext* globalCtx) { - return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 1; +s32 func_80B40D64(PlayState* play) { + return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; } -s32 func_80B40D8C(GlobalContext* globalCtx) { - return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 4; +s32 func_80B40D8C(PlayState* play) { + return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 4; } -s32 func_80B40DB4(GlobalContext* globalCtx) { +s32 func_80B40DB4(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { return true; } return false; @@ -204,17 +204,17 @@ s32 func_80B40E54(EnKgy* this) { return 0; } -void func_80B40E74(EnKgy* this, GlobalContext* globalCtx, u16 textId) { - func_80151938(globalCtx, textId); +void func_80B40E74(EnKgy* this, PlayState* play, u16 textId) { + func_80151938(play, textId); this->actor.textId = textId; func_80B40E18(this, this->actor.textId); } -void func_80B40EBC(EnKgy* this, GlobalContext* globalCtx, u16 arg2) { - func_80B40E74(this, globalCtx, ++arg2); +void func_80B40EBC(EnKgy* this, PlayState* play, u16 arg2) { + func_80B40E74(this, play, ++arg2); } -void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) { +void func_80B40EE8(EnKgy* this, PlayState* play) { s32 pad; if (this->unk_2E4 > 0) { @@ -245,14 +245,14 @@ void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) { f32 sp34; f32 temp_f0; - Actor_GetProjectedPos(globalCtx, &this->unk_2B4, &sp38, &sp34); + Actor_GetProjectedPos(play, &this->unk_2B4, &sp38, &sp34); temp_f0 = sp38.x * sp34; if (this->unk_2E6 > 0) { this->unk_2E6--; } if (((temp_f0 < 0.15f) && (temp_f0 > -0.15f)) || (this->unk_2E6 == 0)) { - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); this->unk_29C &= ~0x2; func_80B40E18(this, this->actor.textId); @@ -263,7 +263,7 @@ void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) { break; case 0xC43: - if (func_80B40D64(globalCtx)) { + if (func_80B40D64(play)) { func_80B40BC0(this, 7); } else { func_80B40BC0(this, 1); @@ -290,17 +290,17 @@ void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) { if ((this->actor.textId == 0xC1D) || (this->actor.textId == 0xC2D)) { this->unk_2E4 = 20; this->unk_2E2 = 3; - func_80B40EBC(this, globalCtx, this->actor.textId); + func_80B40EBC(this, play, this->actor.textId); } else { - func_80B40EBC(this, globalCtx, this->actor.textId); + func_80B40EBC(this, play, this->actor.textId); } this->unk_29C &= ~4; } } } -void func_80B411DC(EnKgy* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { + Player* player = GET_PLAYER(play); switch (arg2) { case 0: @@ -343,9 +343,9 @@ void func_80B411DC(EnKgy* this, GlobalContext* globalCtx, s32 arg2) { } } -void func_80B41368(EnKgy* this, GlobalContext* globalCtx, s32 arg2) { +void func_80B41368(EnKgy* this, PlayState* play, s32 arg2) { ActorCutscene_Stop(this->unk_2D4[this->unk_2E0]); - func_80B411DC(this, globalCtx, arg2); + func_80B411DC(this, play, arg2); this->unk_2E6 = 20; this->unk_29C |= 2; } @@ -375,7 +375,7 @@ s32 func_80B41460(void) { return 0xC3A; } -s32 func_80B41528(GlobalContext* globalCtx) { +s32 func_80B41528(PlayState* play) { if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_SWORD_GILDED) { return 0xC4C; } @@ -387,7 +387,7 @@ s32 func_80B41528(GlobalContext* globalCtx) { return 0xC3B; } -void func_80B415A8(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80B415A8(PlayState* play, Vec3f* arg1) { static EffectShieldParticleInit D_80B43298 = { 16, { 0, 0, 0 }, @@ -413,10 +413,10 @@ void func_80B415A8(GlobalContext* globalCtx, Vec3f* arg1) { D_80B43298.lightPoint.y = D_80B43298.position.y; D_80B43298.lightPoint.z = D_80B43298.position.z; - Effect_Add(globalCtx, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &D_80B43298); + Effect_Add(play, &effectIndex, EFFECT_SHIELD_PARTICLE, 0, 1, &D_80B43298); } -void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) { +void func_80B4163C(EnKgy* this, PlayState* play) { this->actor.focus.pos = this->unk_2A8; if (SkelAnime_Update(&this->skelAnime)) { @@ -440,7 +440,7 @@ void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) { case 13: case 19: case 25: - func_80B415A8(globalCtx, &this->unk_2C0); + func_80B415A8(play, &this->unk_2C0); this->lightInfo.params.point.x = this->unk_2C0.x; this->lightInfo.params.point.y = this->unk_2C0.y; this->lightInfo.params.point.z = this->unk_2C0.z; @@ -455,20 +455,20 @@ void func_80B4163C(EnKgy* this, GlobalContext* globalCtx) { } } -void func_80B417B8(EnKgy* this, GlobalContext* globalCtx) { - func_80B4163C(this, globalCtx); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_80B417B8(EnKgy* this, PlayState* play) { + func_80B4163C(this, play); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80B413C8(this); this->actor.flags &= ~ACTOR_FLAG_100; this->actionFunc = func_80B419B0; func_80B40E18(this, 7); } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B41858(EnKgy* this, GlobalContext* globalCtx) { - func_80B4163C(this, globalCtx); +void func_80B41858(EnKgy* this, PlayState* play) { + func_80B4163C(this, play); if (ActorCutscene_GetCanPlayNext(this->unk_2D4[5])) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[5], &this->actor); this->actionFunc = func_80B419B0; @@ -478,28 +478,28 @@ void func_80B41858(EnKgy* this, GlobalContext* globalCtx) { } } -void func_80B418C4(EnKgy* this, GlobalContext* globalCtx) { - func_80B4163C(this, globalCtx); +void func_80B418C4(EnKgy* this, PlayState* play) { + func_80B4163C(this, play); if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx) && - ((globalCtx->msgCtx.currentTextId == 0xC4E) || (globalCtx->msgCtx.currentTextId == 0xC4F))) { - func_801477B4(globalCtx); + (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play) && + ((play->msgCtx.currentTextId == 0xC4E) || (play->msgCtx.currentTextId == 0xC4F))) { + func_801477B4(play); this->actor.textId = 0xC4F; func_80B413C8(this); ActorCutscene_SetIntentToPlay(this->unk_2D4[5]); this->actionFunc = func_80B41858; this->actor.flags &= ~ACTOR_FLAG_100; } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B419B0(EnKgy* this, GlobalContext* globalCtx) { +void func_80B419B0(EnKgy* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_80B4163C(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) || (&this->actor == player->targetActor)) { - func_80B411DC(this, globalCtx, 4); + func_80B4163C(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state) || (&this->actor == player->targetActor)) { + func_80B411DC(this, play, 4); func_80B40E18(this, this->actor.textId); if (this->actor.textId == 0xC37) { this->actionFunc = func_80B417B8; @@ -509,29 +509,29 @@ void func_80B419B0(EnKgy* this, GlobalContext* globalCtx) { } } -void func_80B41A48(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41A48(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_2E4 > 0) { this->unk_2E4--; } else { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[ENKGY_GET_1F(&this->actor)]; - globalCtx->sceneLoadFlag = 20; + play->nextEntranceIndex = play->setupExitList[ENKGY_GET_1F(&this->actor)]; + play->sceneLoadFlag = 20; } } -void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41ACC(EnKgy* this, PlayState* play) { s32 itemActionParam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) == 0x10) { - itemActionParam = func_80123810(globalCtx); + if (Message_GetState(&play->msgCtx) == 0x10) { + itemActionParam = func_80123810(play); if (itemActionParam != PLAYER_AP_NONE) { this->actionFunc = func_80B41E18; } if (itemActionParam > PLAYER_AP_NONE) { - func_801477B4(globalCtx); + func_801477B4(play); if (itemActionParam == PLAYER_AP_BOTTLE_GOLD_DUST) { if (this->unk_29C & 0x10) { this->actor.textId = 0xC55; @@ -539,7 +539,7 @@ void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0xC46; player->actor.textId = 0xC46; - func_80B40D00(globalCtx); + func_80B40D00(play); } } else if (this->unk_29C & 0x10) { this->actor.textId = 0xC57; @@ -556,100 +556,100 @@ void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) { this->actor.textId = 0xC47; } player->actor.textId = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 4); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 4); } } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B41C30(EnKgy* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B41C30(EnKgy* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (&this->actor != player->targetActor) { this->actionFunc = func_80B42508; } } -void func_80B41C54(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41C54(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80B41C30; this->actor.flags &= ~ACTOR_FLAG_100; } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B41CBC(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41CBC(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80B40E18(this, this->actor.textId); this->actionFunc = func_80B41E18; - func_80B411DC(this, globalCtx, 4); + func_80B411DC(this, play, 4); } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); } } -void func_80B41D64(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41D64(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80B41CBC; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); } else { - Actor_PickUp(&this->actor, globalCtx, this->unk_2EA, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { +void func_80B41E18(EnKgy* this, PlayState* play) { u16 temp; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 3)) { func_80B40BC0(this, 4); } if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && func_80B40E54(this) == 0) { - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx)) { - temp = globalCtx->msgCtx.currentTextId; + if (Message_ShouldAdvance(play)) { + temp = play->msgCtx.currentTextId; switch (temp) { case 0xC3B: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); - func_80B40E74(this, globalCtx, 0xC3F); + func_80B40E74(this, play, 0xC3F); } else { func_8019F208(); - func_80B40E74(this, globalCtx, 0xC42); - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_80B40E74(this, play, 0xC42); + func_801159EC(-play->msgCtx.unk1206C); } break; case 1: func_8019F230(); - func_80B40EBC(this, globalCtx, temp); + func_80B40EBC(this, play, temp); break; } break; case 0xC3E: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80B40E74(this, globalCtx, func_80B41460()); + func_80B40E74(this, play, func_80B41460()); break; case 1: func_8019F230(); - func_80B40E74(this, globalCtx, 0xC3C); + func_80B40E74(this, play, 0xC3C); break; } break; @@ -658,12 +658,12 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - temp = globalCtx->msgCtx.currentTextId; + if (Message_ShouldAdvance(play)) { + temp = play->msgCtx.currentTextId; switch (temp) { case 0xC35: - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actor.textId = temp; this->unk_29C |= 4; this->unk_2E8 = 3; @@ -671,8 +671,8 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { break; case 0xC36: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 4); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 4); this->actor.textId = func_80B41460(); break; @@ -680,7 +680,7 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { case 0xC39: case 0xC52: case 0xC54: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B425A0; func_80B413C8(this); func_80B40E18(this, 5); @@ -689,18 +689,18 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { break; case 0xC3A: - func_80B40E74(this, globalCtx, func_80B41528(globalCtx)); + func_80B40E74(this, play, func_80B41528(play)); func_80B40BC0(this, 4); break; case 0xC3C: case 0xC3F: case 0xC4C: - func_80B40EBC(this, globalCtx, temp); + func_80B40EBC(this, play, temp); break; case 0xC3D: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC3E; func_80B413C8(this); @@ -708,19 +708,19 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { break; case 0xC40: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 0); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 0); this->actor.textId = 0xC43; break; case 0xC42: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 0); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 0); this->actor.textId = 0xC43; CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; SET_EQUIP_VALUE(EQUIP_SWORD, 0); - func_80112B40(globalCtx, 0); - func_80B40C74(globalCtx); + func_80112B40(play, 0); + func_80B40C74(play); break; case 0xC4D: @@ -728,15 +728,15 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { this->unk_29C |= 0x10; case 0xC45: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 3); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 3); this->actor.textId = 0xFF; this->actionFunc = func_80B41ACC; break; case 0xC57: this->unk_29C &= ~0x8; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC58; func_80B413C8(this); @@ -745,14 +745,14 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { case 0xC46: case 0xC55: - func_80123D50(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); player->exchangeItemId = EXCH_ITEM_NONE; this->unk_29C &= ~0x8; - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 4); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 4); if (this->unk_29C & 0x10) { this->actor.textId = 0xC56; - func_801159EC(globalCtx->msgCtx.unk1206C); + func_801159EC(play->msgCtx.unk1206C); } else { this->actor.textId = 0xC42; } @@ -764,25 +764,25 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { player->exchangeItemId = EXCH_ITEM_NONE; this->unk_29C &= ~8; } - func_80B40EBC(this, globalCtx, temp); + func_80B40EBC(this, play, temp); break; case 0xC48: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 0); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 0); this->actor.textId = temp + 1; break; case 0xC49: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 4); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 4); this->actor.textId = temp + 1; break; case 0xC4A: case 0xC4B: func_80B40BC0(this, 4); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC4B; func_80B413C8(this); @@ -790,29 +790,29 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { break; case 0xC50: - if (func_80B40D8C(globalCtx)) { + if (func_80B40D8C(play)) { this->unk_2EA = 57; this->actor.textId = 0xC53; } else { this->unk_2EA = 56; this->actor.textId = 0xC51; } - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41D64; func_80B413C8(this); - Actor_PickUp(&this->actor, globalCtx, this->unk_2EA, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); break; case 0xC51: case 0xC53: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 0); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 0); this->actor.textId = temp + 1; - func_80B40D30(globalCtx); + func_80B40D30(play); break; case 0xC56: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC56; func_80B413C8(this); @@ -824,56 +824,56 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { } } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B42508(EnKgy* this, GlobalContext* globalCtx) { +void func_80B42508(EnKgy* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) || (&this->actor == player->targetActor)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) || (&this->actor == player->targetActor)) { this->actionFunc = func_80B41E18; - func_80B411DC(this, globalCtx, 4); + func_80B411DC(this, play, 4); func_80B40E18(this, this->actor.textId); } } -void func_80B425A0(EnKgy* this, GlobalContext* globalCtx) { +void func_80B425A0(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B41E18; func_80B40BC0(this, 1); - func_80B411DC(this, globalCtx, 0); + func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); } else if (this->actor.xzDistToPlayer < 200.0f) { - func_800B8614(&this->actor, globalCtx, 210.0f); + func_800B8614(&this->actor, play, 210.0f); } } -void func_80B42660(EnKgy* this, GlobalContext* globalCtx) { +void func_80B42660(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); func_80B413C8(this); this->actor.flags &= ~ACTOR_FLAG_100; this->actionFunc = func_80B42714; func_80B40E18(this, 7); } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B42714(EnKgy* this, GlobalContext* globalCtx) { +void func_80B42714(EnKgy* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) || (&this->actor == player->targetActor)) { - func_80B411DC(this, globalCtx, 4); + if (Actor_ProcessTalkRequest(&this->actor, &play->state) || (&this->actor == player->targetActor)) { + func_80B411DC(this, play, 4); func_80B40E18(this, this->actor.textId); if (this->actor.textId == 0xC37) { this->actionFunc = func_80B42660; @@ -883,7 +883,7 @@ void func_80B42714(EnKgy* this, GlobalContext* globalCtx) { } } -void func_80B427C8(EnKgy* this, GlobalContext* globalCtx) { +void func_80B427C8(EnKgy* this, PlayState* play) { s32 pad; u16 temp_a2; @@ -897,30 +897,30 @@ void func_80B427C8(EnKgy* this, GlobalContext* globalCtx) { } if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - temp_a2 = globalCtx->msgCtx.currentTextId; + (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + temp_a2 = play->msgCtx.currentTextId; switch (temp_a2) { case 0xC30: - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actor.textId = temp_a2; this->unk_29C |= 4; this->unk_2E8 = 3; break; case 0xC31: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 4); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 4); this->actor.textId = temp_a2 + 1; break; case 0xC32: case 0xC33: - func_80B40EBC(this, globalCtx, temp_a2); + func_80B40EBC(this, play, temp_a2); break; case 0xC34: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B41C54; func_80B413C8(this); func_80B40E18(this, 6); @@ -929,32 +929,32 @@ void func_80B427C8(EnKgy* this, GlobalContext* globalCtx) { break; } } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B4296C(EnKgy* this, GlobalContext* globalCtx) { +void func_80B4296C(EnKgy* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) { func_80B40BC0(this, 2); } this->actor.focus.pos = this->unk_2A8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B427C8; if (this->unk_2D2 == 4) { func_80B40BC0(this, 7); } else { EnKgy_ChangeAnim(this, 5, 2, -5.0f); } - func_80B411DC(this, globalCtx, 0); + func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); this->actor.flags &= ~ACTOR_FLAG_10000; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_NONE); } } -void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) { +void func_80B42A8C(EnKgy* this, PlayState* play) { u16 temp_a2; s32 pad; @@ -969,20 +969,20 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) { } if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - temp_a2 = globalCtx->msgCtx.currentTextId; + (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + temp_a2 = play->msgCtx.currentTextId; switch (temp_a2) { case 0xC1D: case 0xC2D: - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actor.textId = temp_a2; this->unk_29C |= 4; this->unk_2E8 = 3; break; case 0xC1E: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 1); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 1); this->actor.textId = temp_a2 + 1; func_80B40E38(this); break; @@ -991,13 +991,13 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) { case 0xC23: case 0xC24: case 0xC27: - func_80B40EBC(this, globalCtx, temp_a2); + func_80B40EBC(this, play, temp_a2); break; case 0xC20: case 0xC28: func_80B40BC0(this, 1); - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->unk_29C |= 4; this->unk_2E8 = 3; this->actor.textId = temp_a2; @@ -1006,8 +1006,8 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) { case 0xC21: case 0xC29: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 0); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 0); this->actor.textId = temp_a2 + 1; break; @@ -1015,42 +1015,42 @@ void func_80B42A8C(EnKgy* this, GlobalContext* globalCtx) { case 0xC26: case 0xC2B: case 0xC2E: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 1); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 1); this->actor.textId = temp_a2 + 1; break; case 0xC25: - globalCtx->msgCtx.unk11F10 = 0; - func_80B41368(this, globalCtx, 2); + play->msgCtx.unk11F10 = 0; + func_80B41368(this, play, 2); this->actor.textId = temp_a2 + 1; break; case 0xC2A: this->unk_2E4 = 20; this->unk_2E2 = 3; - func_80B40EBC(this, globalCtx, this->actor.textId); + func_80B40EBC(this, play, this->actor.textId); break; case 0xC2C: case 0xC2F: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B42D28; func_80B413C8(this); func_80B40E18(this, 1); break; } } - func_80B40EE8(this, globalCtx); + func_80B40EE8(this, play); } -void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { +void func_80B42D28(EnKgy* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) { func_80B40BC0(this, 2); } this->actor.focus.pos = this->unk_2A8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B42A8C; if (this->actor.textId == 0xC2D) { func_80B40BC0(this, 1); @@ -1058,10 +1058,10 @@ void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { EnKgy_ChangeAnim(this, 5, 2, -5.0f); gSaveContext.save.weekEventReg[20] |= 0x80; } - func_80B411DC(this, globalCtx, 0); + func_80B411DC(this, play, 0); func_80B40E18(this, this->actor.textId); } else { - if (Flags_GetSwitch(globalCtx, ENKGY_GET_FE00(&this->actor))) { + if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor))) { this->actor.textId = 0xC30; this->actionFunc = func_80B4296C; gSaveContext.save.weekEventReg[21] |= 1; @@ -1071,7 +1071,7 @@ void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0xC1D; } - func_800B8614(&this->actor, globalCtx, 210.0f); + func_800B8614(&this->actor, play, 210.0f); } if ((this->unk_2D2 == 0) && (this->actor.xzDistToPlayer < 200.0f)) { @@ -1080,24 +1080,24 @@ void func_80B42D28(EnKgy* this, GlobalContext* globalCtx) { } } -void EnKgy_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKgy_Update(Actor* thisx, PlayState* play) { EnKgy* this = THIS; s32 pad; Vec3s sp30; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_2D2 == 2) { sp30.z = 0; sp30.y = 0; sp30.x = 0; - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2CC, &sp30, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_2CC, &sp30, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_2CC.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2CC.y, 0, 6, 6200, 100); } } -s32 EnKgy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnKgy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnKgy* this = THIS; if (!(this->unk_29C & 1)) { @@ -1115,7 +1115,7 @@ s32 EnKgy_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnKgy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnKgy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80B432D8 = { 1000.0f, 2000.0f, 0.0f }; static Vec3f D_80B432E4 = { 3000.0f, 4000.0f, 300.0f }; EnKgy* this = THIS; @@ -1129,28 +1129,28 @@ void EnKgy_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void func_80B43074(EnKgy* this, GlobalContext* globalCtx) { +void func_80B43074(EnKgy* this, PlayState* play) { s32 pad; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, MTXMODE_NEW); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, MTXMODE_NEW); Matrix_Push(); Matrix_Translate(-800.0f, 3100.0f, 8400.0f, MTXMODE_APPLY); Matrix_RotateXS(0x4000, MTXMODE_APPLY); - if (func_80B40D8C(globalCtx)) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_kgy_Matanimheader_00F6A0)); + if (func_80B40D8C(play)) { + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_kgy_Matanimheader_00F6A0)); } else { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_kgy_Matanimheader_00EE58)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_kgy_Matanimheader_00EE58)); } gfx = POLY_OPA_DISP; - gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (func_80B40D8C(globalCtx)) { + if (func_80B40D8C(play)) { gSPDisplayList(&gfx[1], gameplay_keep_DL_001D00); gSPDisplayList(&gfx[2], object_kgy_DL_00F180); } else { @@ -1159,18 +1159,18 @@ void func_80B43074(EnKgy* this, GlobalContext* globalCtx) { } POLY_OPA_DISP = &gfx[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_Pop(); } -void EnKgy_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKgy_Draw(Actor* thisx, PlayState* play) { EnKgy* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_29C & 1) { - func_80B43074(this, globalCtx); + func_80B43074(this, play); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnKgy_OverrideLimbDraw, EnKgy_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h index 6f55b2e58a..a6d1703c0d 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h @@ -5,7 +5,7 @@ struct EnKgy; -typedef void (*EnKgyActionFunc)(struct EnKgy*, GlobalContext*); +typedef void (*EnKgyActionFunc)(struct EnKgy*, PlayState*); #define ENKGY_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENKGY_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c index 5a83ecad48..f928c23935 100644 --- a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c +++ b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.c @@ -10,9 +10,9 @@ #define THIS ((EnKitan*)thisx) -void EnKitan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKitan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKitan_Update(Actor* thisx, GlobalContext* globalCtx); +void EnKitan_Init(Actor* thisx, PlayState* play); +void EnKitan_Destroy(Actor* thisx, PlayState* play); +void EnKitan_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Kitan_InitVars = { diff --git a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.h b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.h index d7149e8775..4973a7eda2 100644 --- a/src/overlays/actors/ovl_En_Kitan/z_en_kitan.h +++ b/src/overlays/actors/ovl_En_Kitan/z_en_kitan.h @@ -5,7 +5,7 @@ struct EnKitan; -typedef void (*EnKitanActionFunc)(struct EnKitan*, GlobalContext*); +typedef void (*EnKitanActionFunc)(struct EnKitan*, PlayState*); typedef struct EnKitan { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c index 8f64644116..9c925c56c7 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c @@ -10,40 +10,40 @@ #define THIS ((EnKnight*)thisx) -void EnKnight_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKnight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKnight_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKnight_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKnight_Init(Actor* thisx, PlayState* play); +void EnKnight_Destroy(Actor* thisx, PlayState* play); +void EnKnight_Update(Actor* thisx, PlayState* play); +void EnKnight_Draw(Actor* thisx, PlayState* play); -void func_809B331C(EnKnight* this, GlobalContext* globalCtx); -void func_809B33F0(EnKnight* this, GlobalContext* globalCtx); -void func_809B3618(EnKnight* this, GlobalContext* globalCtx); -void func_809B3834(EnKnight* this, GlobalContext* globalCtx); -void func_809B3958(EnKnight* this, GlobalContext* globalCtx); -void func_809B3B94(EnKnight* this, GlobalContext* globalCtx); -void func_809B40E8(EnKnight* this, GlobalContext* globalCtx); -void func_809B41F8(EnKnight* this, GlobalContext* globalCtx); -void func_809B4308(EnKnight* this, GlobalContext* globalCtx); -void func_809B4C58(EnKnight* this, GlobalContext* globalCtx); -void func_809B4ED8(EnKnight* this, GlobalContext* globalCtx); -void func_809B5058(EnKnight* this, GlobalContext* globalCtx); -void func_809B52E8(EnKnight* this, GlobalContext* globalCtx); -void func_809B5698(EnKnight* this, GlobalContext* globalCtx); -void func_809B58D4(EnKnight* this, GlobalContext* globalCtx); -void func_809B5B08(EnKnight* this, GlobalContext* globalCtx); -void func_809B5D54(EnKnight* this, GlobalContext* globalCtx); -void func_809B5ED0(EnKnight* this, GlobalContext* globalCtx); -void func_809B601C(EnKnight* this, GlobalContext* globalCtx); -void func_809B6764(EnKnight* this, GlobalContext* globalCtx); -void func_809B6C54(EnKnight* this, GlobalContext* globalCtx); -void func_809B6D94(EnKnight* this, GlobalContext* globalCtx); -void func_809B6F40(EnKnight* this, GlobalContext* globalCtx); -void func_809B71DC(EnKnight* this, GlobalContext* globalCtx); -void func_809B7778(EnKnight* this, GlobalContext* globalCtx); -void func_809B7950(EnKnight* this, GlobalContext* globalCtx); -void func_809B8458(EnKnight* this, GlobalContext* globalCtx); -void func_809BA0CC(EnKnight* this, GlobalContext* globalCtx); -void func_809BA978(EnKnight* this, GlobalContext* globalCtx); +void func_809B331C(EnKnight* this, PlayState* play); +void func_809B33F0(EnKnight* this, PlayState* play); +void func_809B3618(EnKnight* this, PlayState* play); +void func_809B3834(EnKnight* this, PlayState* play); +void func_809B3958(EnKnight* this, PlayState* play); +void func_809B3B94(EnKnight* this, PlayState* play); +void func_809B40E8(EnKnight* this, PlayState* play); +void func_809B41F8(EnKnight* this, PlayState* play); +void func_809B4308(EnKnight* this, PlayState* play); +void func_809B4C58(EnKnight* this, PlayState* play); +void func_809B4ED8(EnKnight* this, PlayState* play); +void func_809B5058(EnKnight* this, PlayState* play); +void func_809B52E8(EnKnight* this, PlayState* play); +void func_809B5698(EnKnight* this, PlayState* play); +void func_809B58D4(EnKnight* this, PlayState* play); +void func_809B5B08(EnKnight* this, PlayState* play); +void func_809B5D54(EnKnight* this, PlayState* play); +void func_809B5ED0(EnKnight* this, PlayState* play); +void func_809B601C(EnKnight* this, PlayState* play); +void func_809B6764(EnKnight* this, PlayState* play); +void func_809B6C54(EnKnight* this, PlayState* play); +void func_809B6D94(EnKnight* this, PlayState* play); +void func_809B6F40(EnKnight* this, PlayState* play); +void func_809B71DC(EnKnight* this, PlayState* play); +void func_809B7778(EnKnight* this, PlayState* play); +void func_809B7950(EnKnight* this, PlayState* play); +void func_809B8458(EnKnight* this, PlayState* play); +void func_809BA0CC(EnKnight* this, PlayState* play); +void func_809BA978(EnKnight* this, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.h b/src/overlays/actors/ovl_En_Knight/z_en_knight.h index 8191b13a20..b7faee749c 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.h +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.h @@ -5,7 +5,7 @@ struct EnKnight; -typedef void (*EnKnightActionFunc)(struct EnKnight*, GlobalContext*); +typedef void (*EnKnightActionFunc)(struct EnKnight*, PlayState*); typedef struct EnKnight { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index caf235b058..6032856b6b 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -13,26 +13,26 @@ #define THIS ((EnKujiya*)thisx) -void EnKujiya_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKujiya_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKujiya_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKujiya_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKujiya_Init(Actor* thisx, PlayState* play); +void EnKujiya_Destroy(Actor* thisx, PlayState* play); +void EnKujiya_Update(Actor* thisx, PlayState* play); +void EnKujiya_Draw(Actor* thisx, PlayState* play); void EnKujiya_SetupWait(EnKujiya* this); -void EnKujiya_Wait(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_Wait(EnKujiya* this, PlayState* play); void EnKujiya_SetupTalk(EnKujiya* this); -void EnKujiya_Talk(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_Talk(EnKujiya* this, PlayState* play); void EnKujiya_SetupGivePrize(EnKujiya* this); -void EnKujiya_GivePrize(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_GivePrize(EnKujiya* this, PlayState* play); void EnKujiya_SetupFinishGivePrize(EnKujiya* this); -void EnKujiya_FinishGivePrize(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_FinishGivePrize(EnKujiya* this, PlayState* play); s32 EnKujiya_CheckBoughtTicket(void); void EnKujiya_SetBoughtTicket(void); void EnKujiya_UnsetBoughtTicket(void); void EnKujiya_SetupTurnToOpen(EnKujiya* this); -void EnKujiya_TurnToOpen(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_TurnToOpen(EnKujiya* this, PlayState* play); void EnKujiya_SetupTurnToClosed(EnKujiya* this); -void EnKujiya_TurnToClosed(EnKujiya* this, GlobalContext* globalCtx); +void EnKujiya_TurnToClosed(EnKujiya* this, PlayState* play); const ActorInit En_Kujiya_InitVars = { ACTOR_EN_KUJIYA, @@ -54,7 +54,7 @@ const ActorInit En_Kujiya_InitVars = { ((u32)((void)0, gSaveContext.save.lotteryCodes[CURRENT_DAY - 1][2]) == \ (((void)0, gSaveContext.save.lotteryCodeGuess & 0xFFFF) & 0xF))) -void EnKujiya_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKujiya_Init(Actor* thisx, PlayState* play) { EnKujiya* this = THIS; Actor_SetScale(&this->actor, 0.1f); @@ -74,28 +74,28 @@ void EnKujiya_Init(Actor* thisx, GlobalContext* globalCtx) { EnKujiya_SetupWait(this); } -void EnKujiya_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKujiya_Destroy(Actor* thisx, PlayState* play) { } void EnKujiya_SetupWait(EnKujiya* this) { this->actionFunc = EnKujiya_Wait; } -void EnKujiya_Wait(EnKujiya* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnKujiya_Wait(EnKujiya* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < CLOCK_TIME(18, 0))) { if (EnKujiya_CheckBoughtTicket()) { - Message_StartTextbox(globalCtx, 0x2B61, &this->actor); + Message_StartTextbox(play, 0x2B61, &this->actor); this->textId = 0x2B61; // Come back tomorrow } else { - Message_StartTextbox(globalCtx, 0x2B5C, &this->actor); + Message_StartTextbox(play, 0x2B5C, &this->actor); this->textId = 0x2B5C; // Pick 3 numbers } } else if (EnKujiya_CheckBoughtTicket()) { - Message_StartTextbox(globalCtx, 0x2B64, &this->actor); + Message_StartTextbox(play, 0x2B64, &this->actor); this->textId = 0x2B64; // Announce winning numbers } else { - Message_StartTextbox(globalCtx, 0x2B63, &this->actor); + Message_StartTextbox(play, 0x2B63, &this->actor); this->textId = 0x2B63; // Exchanging winning tickets } @@ -104,32 +104,32 @@ void EnKujiya_Wait(EnKujiya* this, GlobalContext* globalCtx) { (this->actor.shape.rot.y == 0)) { EnKujiya_SetupTurnToOpen(this); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void EnKujiya_HandlePlayerChoice(EnKujiya* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { // Buy +void EnKujiya_HandlePlayerChoice(EnKujiya* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { // Buy if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x2B62, &this->actor); + Message_StartTextbox(play, 0x2B62, &this->actor); this->textId = 0x2B62; // Not enough Rupees } else { func_8019F208(); func_801159EC(-10); - Message_StartTextbox(globalCtx, 0x2B5F, &this->actor); + Message_StartTextbox(play, 0x2B5F, &this->actor); this->textId = 0x2B5F; // Enter number } } else { // Don't buy func_8019F230(); - Message_StartTextbox(globalCtx, 0x2B5E, &this->actor); + Message_StartTextbox(play, 0x2B5E, &this->actor); this->textId = 0x2B5E; // Too bad } } } -void EnKujiya_ChooseNextDialogue(EnKujiya* this, GlobalContext* globalCtx) { +void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) { // Build suspense if (this->textId == 0x2B65) { // Your numbers vs winning numbers if (this->timer != 0) { @@ -138,40 +138,40 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, GlobalContext* globalCtx) { } } - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x2B5C: - Message_StartTextbox(globalCtx, 0x2B5D, &this->actor); + Message_StartTextbox(play, 0x2B5D, &this->actor); this->textId = 0x2B5D; // Buy or not break; case 0x2B60: EnKujiya_SetBoughtTicket(); - func_801477B4(globalCtx); + func_801477B4(play); EnKujiya_SetupTurnToClosed(this); break; case 0x2B64: EnKujiya_UnsetBoughtTicket(); this->timer = 20; - Message_StartTextbox(globalCtx, 0x2B65, &this->actor); + Message_StartTextbox(play, 0x2B65, &this->actor); this->textId = 0x2B65; // Your numbers vs winning numbers break; case 0x2B65: if (CHECK_LOTTERY_NUMBERS) { - Message_StartTextbox(globalCtx, 0x2B66, &this->actor); + Message_StartTextbox(play, 0x2B66, &this->actor); this->textId = 0x2B66; // Won 50 Rupees } else { - Message_StartTextbox(globalCtx, 0x2B67, &this->actor); + Message_StartTextbox(play, 0x2B67, &this->actor); this->textId = 0x2B67; // Lost, come back tomorrow } break; case 0x2B66: - func_801477B4(globalCtx); + func_801477B4(play); EnKujiya_SetupGivePrize(this); - EnKujiya_GivePrize(this, globalCtx); + EnKujiya_GivePrize(this, play); break; } } @@ -181,29 +181,29 @@ void EnKujiya_SetupTalk(EnKujiya* this) { this->actionFunc = EnKujiya_Talk; } -void EnKujiya_Talk(EnKujiya* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnKujiya_Talk(EnKujiya* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: break; case 4: - EnKujiya_HandlePlayerChoice(this, globalCtx); + EnKujiya_HandlePlayerChoice(this, play); break; case 5: - EnKujiya_ChooseNextDialogue(this, globalCtx); + EnKujiya_ChooseNextDialogue(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnKujiya_SetupWait(this); } break; case 17: - if (Message_ShouldAdvance(globalCtx)) { - Inventory_SaveLotteryCodeGuess(globalCtx); - Message_StartTextbox(globalCtx, 0x2B60, &this->actor); + if (Message_ShouldAdvance(play)) { + Inventory_SaveLotteryCodeGuess(play); + Message_StartTextbox(play, 0x2B60, &this->actor); this->textId = 0x2B60; // Will announce winning numbers after 6 } break; @@ -214,11 +214,11 @@ void EnKujiya_SetupGivePrize(EnKujiya* this) { this->actionFunc = EnKujiya_GivePrize; } -void EnKujiya_GivePrize(EnKujiya* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnKujiya_GivePrize(EnKujiya* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { EnKujiya_SetupFinishGivePrize(this); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } @@ -226,8 +226,8 @@ void EnKujiya_SetupFinishGivePrize(EnKujiya* this) { this->actionFunc = EnKujiya_FinishGivePrize; } -void EnKujiya_FinishGivePrize(EnKujiya* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { +void EnKujiya_FinishGivePrize(EnKujiya* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { EnKujiya_SetupWait(this); } } @@ -295,7 +295,7 @@ void EnKujiya_SetupTurnToOpen(EnKujiya* this) { this->actionFunc = EnKujiya_TurnToOpen; } -void EnKujiya_TurnToOpen(EnKujiya* this, GlobalContext* globalCtx) { +void EnKujiya_TurnToOpen(EnKujiya* this, PlayState* play) { if (this->actor.cutscene != -1) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); @@ -323,7 +323,7 @@ void EnKujiya_SetupTurnToClosed(EnKujiya* this) { this->actionFunc = EnKujiya_TurnToClosed; } -void EnKujiya_TurnToClosed(EnKujiya* this, GlobalContext* globalCtx) { +void EnKujiya_TurnToClosed(EnKujiya* this, PlayState* play) { if (this->actor.cutscene != -1) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); @@ -346,22 +346,22 @@ void EnKujiya_TurnToClosed(EnKujiya* this, GlobalContext* globalCtx) { } } -void EnKujiya_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKujiya_Update(Actor* thisx, PlayState* play) { EnKujiya* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnKujiya_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKujiya_Draw(Actor* thisx, PlayState* play) { EnKujiya* this = THIS; - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gLotteryShopTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gLotteryShopTexAnim)); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gLotteryShopCylinderDL); gSPDisplayList(POLY_OPA_DISP++, gLotteryShopBackSignDL); gSPDisplayList(POLY_OPA_DISP++, gLotteryShopOpenBoxDL); @@ -373,5 +373,5 @@ void EnKujiya_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gLotteryShopScrollingArrowDL); gSPDisplayList(POLY_OPA_DISP++, gLotteryShopMaskDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h index b95a5bb366..69fad156ed 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.h @@ -5,7 +5,7 @@ struct EnKujiya; -typedef void (*EnKujiyaActionFunc)(struct EnKujiya*, GlobalContext*); +typedef void (*EnKujiyaActionFunc)(struct EnKujiya*, PlayState*); typedef struct EnKujiya { /* 0x000 */ 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 fb20fcd67e..78825fbe2f 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -14,34 +14,34 @@ #define THIS ((EnKusa*)thisx) -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKusa_Update(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); -s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset); -void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx); +s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset); +void EnKusa_DropCollectible(EnKusa* this, PlayState* play); void EnKusa_UpdateVelY(EnKusa* this); void EnKusa_RandScaleVecToZero(Vec3f* vec, f32 scaleFactor); void EnKusa_SetScaleSmall(EnKusa* this); -s32 EnKusa_GetWaterBox(EnKusa* this, GlobalContext* globalCtx); +s32 EnKusa_GetWaterBox(EnKusa* this, PlayState* play); void EnKusa_SetupWaitObject(EnKusa* this); -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_WaitForInteract(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_WaitObject(EnKusa* this, PlayState* play); +void EnKusa_WaitForInteract(EnKusa* this, PlayState* play); void EnKusa_SetupLiftedUp(EnKusa* this); -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_LiftedUp(EnKusa* this, PlayState* play); +void EnKusa_WaitObject(EnKusa* this, PlayState* play); void EnKusa_SetupInteract(EnKusa* this); void EnKusa_SetupFall(EnKusa* this); -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_Fall(EnKusa* this, PlayState* play); void EnKusa_SetupCut(EnKusa* this); -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_DoNothing(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_DoNothing(EnKusa* this, PlayState* play); void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx); +void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play); void EnKusa_SetupRegrow(EnKusa* this); -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx); -void EnKusa_DrawBush(Actor* thisx, GlobalContext* globalCtx2); -void EnKusa_DrawGrass(Actor* thisx, GlobalContext* globalCtx); +void EnKusa_Regrow(EnKusa* this, PlayState* play); +void EnKusa_DrawBush(Actor* thisx, PlayState* play2); +void EnKusa_DrawGrass(Actor* thisx, PlayState* play); s16 rotSpeedXtarget = 0; s16 rotSpeedX = 0; @@ -215,11 +215,11 @@ void EnKusa_Sway(void) { * if no poit is found, a false value is returned. * * @param this - * @param globalCtx + * @param play * @param yOffset offset of Y coordinate, can be positive or negative. * @return true/false if the bush is able to snap to the floor and is above BGCHECK_Y_MIN */ -s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { +s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) { s32 pad; CollisionPoly* poly; Vec3f pos; @@ -230,7 +230,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_EntityRaycastFloor5(&globalCtx->colCtx, &poly, &bgId, &this->actor, &pos); + floorY = BgCheck_EntityRaycastFloor5(&play->colCtx, &poly, &bgId, &this->actor, &pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY + yOffset; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -240,22 +240,22 @@ s32 EnKusa_SnapToFloor(EnKusa* this, GlobalContext* globalCtx, f32 yOffset) { } } -void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { s32 collectible; s32 collectableParams; if ((GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_GRASS) || (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_BUSH)) { if (!(KUSA_GET_PARAMS_0C(&this->actor))) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, KUSA_GET_RAND_COLLECTIBLE_ID(&this->actor) * 0x10); } } else if (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_REGROWING_GRASS) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, 3); + Item_DropCollectible(play, &this->actor.world.pos, 3); } else { collectible = func_800A8150(KUSA_GET_PARAMS_3F(&this->actor)); if (collectible >= 0) { collectableParams = KUSA_GET_COLLECTIBLE_ID(&this->actor); - Item_DropCollectible(globalCtx, &this->actor.world.pos, (collectableParams << 8) | collectible); + Item_DropCollectible(play, &this->actor.world.pos, (collectableParams << 8) | collectible); } } } @@ -286,7 +286,7 @@ void EnKusa_SetScaleSmall(EnKusa* this) { this->actor.scale.z = 120.0f * 0.001f; } -void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { Vec3f velocity; Vec3f pos; s32 i; @@ -306,8 +306,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, - 0x50, -1, 1, gKakeraLeafMiddle); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 0x50, + -1, 1, gKakeraLeafMiddle); pos.x = this->actor.world.pos.x + (directon->x * this->actor.scale.x * 40.0f); pos.y = this->actor.world.pos.y + (directon->y * this->actor.scale.y * 40.0f) + 10.0f; @@ -318,18 +318,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, - 0x50, -1, 1, gKakeraLeafTip); + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 0x50, + -1, 1, gKakeraLeafTip); } } -void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { u32 numBugs; for (numBugs = 0; numBugs < 3; numBugs++) { - Actor* bug = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, 1, this->actor.cutscene, this->actor.unk20, 0); + Actor* bug = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, + this->actor.cutscene, this->actor.unk20, 0); if (bug == NULL) { break; @@ -337,39 +337,39 @@ void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) { } } -s32 EnKusa_GetWaterBox(EnKusa* this, GlobalContext* globalCtx) { +s32 EnKusa_GetWaterBox(EnKusa* this, PlayState* play) { s32 pad; WaterBox* waterBox; f32 ySurface; s32 bgId; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &ySurface, &waterBox, &bgId) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterBox, &bgId) && (this->actor.world.pos.y < ySurface)) { return true; } return false; } -void EnKusa_InitCollider(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_InitCollider(Actor* thisx, PlayState* play) { EnKusa* this = THIS; - 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(thisx, &this->collider); } -void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = THIS; s32 pad; s32 kusaType = GET_KUSA_TYPE(&this->actor); Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { this->actor.uncullZoneForward += 1000.0f; } - EnKusa_InitCollider(&this->actor, globalCtx); + EnKusa_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (kusaType == ENKUSA_TYPE_BUSH) { @@ -385,15 +385,15 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; } - if (!EnKusa_SnapToFloor(this, globalCtx, 0.0f)) { + if (!EnKusa_SnapToFloor(this, play, 0.0f)) { Actor_MarkForDeath(&this->actor); return; } - if (EnKusa_GetWaterBox(this, globalCtx)) { + if (EnKusa_GetWaterBox(this, play)) { this->isInWater |= 1; } - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, objectIds[(GET_KUSA_TYPE(&this->actor))]); + this->objIndex = Object_GetIndex(&play->objectCtx, objectIds[(GET_KUSA_TYPE(&this->actor))]); if (this->objIndex < 0) { Actor_MarkForDeath(&this->actor); return; @@ -408,27 +408,27 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) { D_80936CE0 = Rand_Next() >> 0x10; D_809366B4 = false; EnKusa_Sway(); - kusaGameplayFrames = globalCtx->gameplayFrames; + kusaGameplayFrames = play->gameplayFrames; } this->kusaMtxIdx = D_809366B0 & 7; D_809366B0++; } -void EnKusa_Destroy(Actor* thisx, GlobalContext* globalCtx) { - GlobalContext* globalCtx2 = globalCtx; +void EnKusa_Destroy(Actor* thisx, PlayState* play) { + PlayState* play2 = play; EnKusa* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnKusa_SetupWaitObject(EnKusa* this) { this->actionFunc = EnKusa_WaitObject; } -void EnKusa_WaitObject(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_WaitObject(EnKusa* this, PlayState* play) { s32 pad; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { s32 kusaType = GET_KUSA_TYPE(&this->actor); if (this->isCut) { @@ -451,23 +451,23 @@ void EnKusa_SetupInteract(EnKusa* this) { this->actor.flags &= ~ACTOR_FLAG_10; } -void EnKusa_WaitForInteract(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_WaitForInteract(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); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } 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 (KUSA_SHOULD_SPAWN_BUGS(&this->actor)) { if (GET_KUSA_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { - EnKusa_SpawnBugs(this, globalCtx); + EnKusa_SpawnBugs(this, play); } } if (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_BUSH) { @@ -484,13 +484,13 @@ void EnKusa_WaitForInteract(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) { if (GET_KUSA_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } } @@ -504,13 +504,13 @@ void EnKusa_SetupLiftedUp(EnKusa* this) { this->actor.flags |= ACTOR_FLAG_10; } -void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { s32 pad; Vec3f pos; s32 bgId; - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.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); @@ -519,14 +519,14 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) { EnKusa_UpdateVelY(this); EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.005f); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); this->actor.gravity = -3.2f; } else { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); } } @@ -539,7 +539,7 @@ void EnKusa_SetupFall(EnKusa* this) { this->timer = 0; } -void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Fall(EnKusa* this, PlayState* play) { s32 pad; s32 wasHit; Vec3f contactPos; @@ -554,10 +554,10 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { this->timer++; if ((this->actor.bgCheckFlags & 0xB) || wasHit || (this->timer >= 100)) { if (!(this->actor.bgCheckFlags & 0x20)) { - 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 (GET_KUSA_TYPE(&this->actor)) { case ENKUSA_TYPE_BUSH: case ENKUSA_TYPE_GRASS: @@ -578,12 +578,12 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 15.0f) + this->actor.world.pos.x; contactPos.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 190); + EffectSsGSplash_Spawn(play, &contactPos, NULL, NULL, 0, 190); } contactPos.x = this->actor.world.pos.x; contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &contactPos, NULL, NULL, 0, 280); - EffectSsGRipple_Spawn(globalCtx, &contactPos, 300, 700, 0); + EffectSsGSplash_Spawn(play, &contactPos, NULL, NULL, 0, 280); + EffectSsGRipple_Spawn(play, &contactPos, 300, 700, 0); this->actor.terminalVelocity = -3.0f; this->actor.velocity.x *= 0.1f; this->actor.velocity.y *= 0.4f; @@ -594,7 +594,7 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { rotSpeedY >>= 1; rotSpeedYtarget >>= 1; this->actor.bgCheckFlags &= ~0x40; - 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); Math_StepToS(&rotSpeedX, rotSpeedXtarget, 500); @@ -603,10 +603,10 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += rotSpeedY; EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.05f); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); 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); } } @@ -623,14 +623,14 @@ void EnKusa_SetupCut(EnKusa* this) { this->timer = 0; } -void EnKusa_CutWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play) { this->timer++; 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) { @@ -643,7 +643,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { this->actionFunc = EnKusa_UprootedWaitRegrow; } -void EnKusa_UprootedWaitRegrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play) { this->timer++; if (this->timer > 120) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f) && (this->timer >= 170)) { @@ -659,7 +659,7 @@ void EnKusa_SetupRegrow(EnKusa* this) { this->actor.shape.rot = this->actor.home.rot; } -void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { +void EnKusa_Regrow(EnKusa* this, PlayState* play) { s32 isFullyGrown = 1; isFullyGrown &= Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f); @@ -672,63 +672,63 @@ void EnKusa_Regrow(EnKusa* this, GlobalContext* globalCtx) { } } -void EnKusa_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnKusa_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnKusa* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->isCut) { this->actor.shape.yOffset = -6.25f; } else { this->actor.shape.yOffset = 0.0f; } - if ((kusaGameplayFrames != globalCtx->gameplayFrames) && (globalCtx->roomCtx.currRoom.unk3 == 0)) { + if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { EnKusa_Sway(); - kusaGameplayFrames = globalCtx->gameplayFrames; + kusaGameplayFrames = play->gameplayFrames; } } -void EnKusa_DrawBush(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnKusa_DrawBush(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnKusa* this = THIS; if ((this->actor.projectedPos.z <= 1200.0f) || ((this->isInWater & 1) && (this->actor.projectedPos.z < 1300.0f))) { - if ((globalCtx->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && + if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } - Gfx_DrawDListOpa(globalCtx, gKusaBushType1); + Gfx_DrawDListOpa(play, gKusaBushType1); } else if (this->actor.projectedPos.z < 1300.0f) { s32 alpha; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); alpha = (1300.0f - this->actor.projectedPos.z) * 2.55f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, alpha); gSPDisplayList(POLY_XLU_DISP++, gKusaBushType2); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnKusa_DrawGrass(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { EnKusa* this = THIS; if (this->isCut) { - Gfx_DrawDListOpa(globalCtx, gKusaStump); + Gfx_DrawDListOpa(play, gKusaStump); } else { - if ((globalCtx->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { + if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } } - Gfx_DrawDListOpa(globalCtx, gKusaSprout); + Gfx_DrawDListOpa(play, gKusaSprout); } } 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 2f0d29dd97..6f41a6866b 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -5,7 +5,7 @@ struct EnKusa; -typedef void (*EnKusaActionFunc)(struct EnKusa*, GlobalContext*); +typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); typedef enum { /* 0 */ ENKUSA_TYPE_BUSH, diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 8852319dfd..5a7a0a5c21 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -13,37 +13,37 @@ #define THIS ((EnKusa2*)thisx) -void EnKusa2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnKusa2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnKusa2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnKusa2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnKusa2_Init(Actor* thisx, PlayState* play); +void EnKusa2_Destroy(Actor* thisx, PlayState* play); +void EnKusa2_Update(Actor* thisx, PlayState* play); +void EnKusa2_Draw(Actor* thisx, PlayState* play); void func_80A5C70C(EnKusa2UnkBssSubStruct* arg0); void func_80A5CF44(EnKusa2* this); void func_80A5D5E0(EnKusa2* this); -void func_80A5D5F4(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D5F4(EnKusa2* this, PlayState* play); void func_80A5D618(EnKusa2* this); -void func_80A5D62C(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D62C(EnKusa2* this, PlayState* play); void func_80A5D6B0(EnKusa2* this); -void func_80A5D6C4(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D6C4(EnKusa2* this, PlayState* play); void func_80A5D754(EnKusa2* this); -void func_80A5D794(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D794(EnKusa2* this, PlayState* play); void func_80A5D7A4(EnKusa2* this); -void func_80A5D7C4(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D7C4(EnKusa2* this, PlayState* play); void func_80A5D964(EnKusa2* this); -void func_80A5D9C8(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5D9C8(EnKusa2* this, PlayState* play); void func_80A5DC70(EnKusa2* this); -void func_80A5DC98(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5DC98(EnKusa2* this, PlayState* play); void func_80A5DE18(EnKusa2* this); -void func_80A5DEB4(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5DEB4(EnKusa2* this, PlayState* play); void func_80A5E1D8(EnKusa2* this); -void func_80A5E210(EnKusa2* this, GlobalContext* globalCtx); +void func_80A5E210(EnKusa2* this, PlayState* play); void func_80A5E418(EnKusa2* this); -void func_80A5E4BC(EnKusa2* this, GlobalContext* globalCtx); -void func_80A5E604(Actor* thisx, GlobalContext* globalCtx); -void func_80A5E6F0(Actor* thisx, GlobalContext* globalCtx); -void func_80A5E9B4(Actor* thisx, GlobalContext* globalCtx); -void func_80A5EA48(Actor* thisx, GlobalContext* globalCtx); +void func_80A5E4BC(EnKusa2* this, PlayState* play); +void func_80A5E604(Actor* thisx, PlayState* play); +void func_80A5E6F0(Actor* thisx, PlayState* play); +void func_80A5E9B4(Actor* thisx, PlayState* play); +void func_80A5EA48(Actor* thisx, PlayState* play); static EnKusa2UnkBssStruct D_80A5F1C0; static u32 D_80A60900; @@ -92,7 +92,7 @@ static Vec3s D_80A5EAF4 = { 0, 0, 0 }; static Vec3s D_80A5EAFC = { 0, 0, 0 }; static Vec3s D_80A5EB04 = { 0, 0, 0 }; -void func_80A5B160(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5B160(EnKusa2* this, PlayState* play) { s32 i; s16 temp_s1; EnKusa2** ptr; @@ -101,7 +101,7 @@ void func_80A5B160(EnKusa2* this, GlobalContext* globalCtx) { if (this->unk_194[0] == NULL) { ptr = this->unk_194; actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_KUSA2, this->actor.world.pos.x, this->actor.world.pos.y, + &play->actorCtx, play, ACTOR_EN_KUSA2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, Rand_Next() >> 0x10, 0, 1, this->actor.cutscene, this->actor.unk20, NULL); *ptr = actor; @@ -116,7 +116,7 @@ void func_80A5B160(EnKusa2* this, GlobalContext* globalCtx) { if (this->unk_194[i] == NULL) { ptr = &this->unk_194[i]; actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_EN_KUSA2, (Math_SinS(temp_s1) * 80.0f) + this->actor.world.pos.x, + &play->actorCtx, play, ACTOR_EN_KUSA2, (Math_SinS(temp_s1) * 80.0f) + this->actor.world.pos.x, this->actor.world.pos.y, (Math_CosS(temp_s1) * 80.0f) + this->actor.world.pos.z, 0, Rand_Next() >> 0x10, 0, 1, this->actor.cutscene, this->actor.unk20, NULL); *ptr = actor; @@ -128,7 +128,7 @@ void func_80A5B160(EnKusa2* this, GlobalContext* globalCtx) { } } -void func_80A5B334(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5B334(EnKusa2* this, PlayState* play) { s32 i; EnKusa2** ptr; @@ -136,7 +136,7 @@ void func_80A5B334(EnKusa2* this, GlobalContext* globalCtx) { ptr = &this->unk_194[i]; if (*ptr != NULL) { - if (!Actor_HasParent(&(*ptr)->actor, globalCtx)) { + if (!Actor_HasParent(&(*ptr)->actor, play)) { Actor_MarkForDeath(&(*ptr)->actor); } *ptr = NULL; @@ -156,8 +156,8 @@ void func_80A5B3BC(EnKusa2* this) { } } -void func_80A5B490(EnKusa2* this, GlobalContext* globalCtx) { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_KITAN, this->actor.world.pos.x, +void func_80A5B490(EnKusa2* this, PlayState* play) { + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_KITAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, ENKUSA2_GET_7F00(&this->actor) << 9, this->actor.cutscene, this->actor.unk20, NULL); } @@ -250,7 +250,7 @@ void func_80A5B954(MtxF* matrix, f32 arg1) { } } -s32 func_80A5BA58(EnKusa2* this, GlobalContext* globalCtx) { +s32 func_80A5BA58(EnKusa2* this, PlayState* play) { Vec3f sp24; s32 sp20; @@ -258,7 +258,7 @@ s32 func_80A5BA58(EnKusa2* this, GlobalContext* globalCtx) { sp24.y = this->actor.world.pos.y + 30.0f; sp24.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp20, &this->actor, &sp24); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp20, &this->actor, &sp24); if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.floorBgId = sp20; this->actor.world.pos.y = this->actor.floorHeight; @@ -268,11 +268,11 @@ s32 func_80A5BA58(EnKusa2* this, GlobalContext* globalCtx) { return false; } -void func_80A5BAFC(EnKusa2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 35.0f, 0.0f, 0x45); +void func_80A5BAFC(EnKusa2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 35.0f, 0.0f, 0x45); } -void func_80A5BB40(EnKusa2* this, GlobalContext* globalCtx, s32 arg2) { +void func_80A5BB40(EnKusa2* this, PlayState* play, s32 arg2) { static Vec3f D_80A5EB0C = { 0.0f, 0.3f, 0.0f }; static Vec3f D_80A5EB18 = { 0.0f, 0.0f, 0.0f }; s32 pad; @@ -300,12 +300,12 @@ void func_80A5BB40(EnKusa2* this, GlobalContext* globalCtx, s32 arg2) { D_80A5EB0C.x = D_80A5EB18.x * -0.09f; D_80A5EB0C.z = D_80A5EB18.z * -0.09f; - func_800B1210(globalCtx, &sp84, &D_80A5EB18, &D_80A5EB0C, 10, 50); + func_800B1210(play, &sp84, &D_80A5EB18, &D_80A5EB0C, 10, 50); } } } -void func_80A5BD14(EnKusa2* this, GlobalContext* globalCtx, s32 arg2) { +void func_80A5BD14(EnKusa2* this, PlayState* play, s32 arg2) { static s32 D_80A5EB24[] = { ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_RED, @@ -316,7 +316,7 @@ void func_80A5BD14(EnKusa2* this, GlobalContext* globalCtx, s32 arg2) { if (kusa2->unk_1BC > 8) { kusa2->unk_1BC = 8; } - Item_DropCollectible(globalCtx, &this->actor.world.pos, D_80A5EB24[kusa2->unk_1BC]); + Item_DropCollectible(play, &this->actor.world.pos, D_80A5EB24[kusa2->unk_1BC]); kusa2->unk_1BC += arg2; } } @@ -327,7 +327,7 @@ void func_80A5BD94(EnKusa2* this) { } } -void func_80A5BDB0(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5BDB0(EnKusa2* this, PlayState* play) { s32 pad[2]; s32 i; Vec3f sp50; @@ -338,14 +338,14 @@ void func_80A5BDB0(EnKusa2* this, GlobalContext* globalCtx) { for (phi_s0 = 0, i = 0; i < 4; i++, phi_s0 += 0x4000) { sp50.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.x; sp50.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp50, NULL, NULL, 0, 190); + EffectSsGSplash_Spawn(play, &sp50, NULL, NULL, 0, 190); } sp50.x = this->actor.world.pos.x; sp50.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp50, NULL, NULL, 0, 280); - EffectSsGRipple_Spawn(globalCtx, &sp50, 300, 700, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + EffectSsGSplash_Spawn(play, &sp50, NULL, NULL, 0, 280); + EffectSsGRipple_Spawn(play, &sp50, 300, 700, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } void func_80A5BF38(EnKusa2* this, s32 arg1) { @@ -366,19 +366,19 @@ void func_80A5BF60(EnKusa2* this, s32 arg1) { } } -void func_80A5BF84(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5BF84(EnKusa2* this, PlayState* play) { 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 func_80A5BFD8(EnKusa2* this, GlobalContext* globalCtx) { +s32 func_80A5BFD8(EnKusa2* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { s32 pad; func_80A5CF44(this); - func_80A5BD14(this, globalCtx, (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000000) ? 1 : 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); + func_80A5BD14(this, play, (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000000) ? 1 : 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); func_80A5BD94(this); Actor_MarkForDeath(&this->actor); return true; @@ -853,7 +853,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void EnKusa2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa2_Init(Actor* thisx, PlayState* play) { s32 pad; EnKusa2* this = THIS; @@ -862,11 +862,11 @@ void EnKusa2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.update = func_80A5E604; this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_20; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 1); + func_800BC154(play, &play->actorCtx, &this->actor, 1); this->unk_1BE = 0; if (D_80A5EAEC != 0) { D_80A5EAEC = 0; - D_80A60900 = globalCtx->gameplayFrames; + D_80A60900 = play->gameplayFrames; func_80A5CAD4(&D_80A5F1C0); D_80A60B08 = Rand_Next() >> 0x10; D_80A60B0A = Rand_Next() >> 0x10; @@ -877,11 +877,11 @@ void EnKusa2_Init(Actor* thisx, GlobalContext* globalCtx) { } func_80A5D5E0(this); } else { - Collider_InitCylinder(globalCtx, &this->collider); - if (!func_80A5BA58(this, globalCtx)) { + Collider_InitCylinder(play, &this->collider); + if (!func_80A5BA58(this, play)) { Actor_MarkForDeath(&this->actor); } else { - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_1CE = D_80A5EAF0 & 7; @@ -894,11 +894,11 @@ void EnKusa2_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnKusa2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa2_Destroy(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (ENKUSA2_GET_1(&this->actor) == 1) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -906,7 +906,7 @@ void func_80A5D5E0(EnKusa2* this) { this->actionFunc = func_80A5D5F4; } -void func_80A5D5F4(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D5F4(EnKusa2* this, PlayState* play) { func_80A5D618(this); } @@ -914,12 +914,12 @@ void func_80A5D618(EnKusa2* this) { this->actionFunc = func_80A5D62C; } -void func_80A5D62C(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D62C(EnKusa2* this, PlayState* play) { if (this->unk_1BE != 0) { - func_80A5B490(this, globalCtx); + func_80A5B490(this, play); func_80A5D754(this); } else if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1600.0f)) { - func_80A5B160(this, globalCtx); + func_80A5B160(this, play); func_80A5D6B0(this); } } @@ -928,13 +928,13 @@ void func_80A5D6B0(EnKusa2* this) { this->actionFunc = func_80A5D6C4; } -void func_80A5D6C4(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D6C4(EnKusa2* this, PlayState* play) { func_80A5B3BC(this); if (this->unk_1BE != 0) { - func_80A5B490(this, globalCtx); + func_80A5B490(this, play); func_80A5D754(this); } else if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) > SQ(1750.0f)) { - func_80A5B334(this, globalCtx); + func_80A5B334(this, play); func_80A5D618(this); } } @@ -949,7 +949,7 @@ void func_80A5D754(EnKusa2* this) { this->actionFunc = func_80A5D794; } -void func_80A5D794(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D794(EnKusa2* this, PlayState* play) { } void func_80A5D7A4(EnKusa2* this) { @@ -957,12 +957,12 @@ void func_80A5D7A4(EnKusa2* this) { this->actionFunc = func_80A5D7C4; } -void func_80A5D7C4(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D7C4(EnKusa2* this, PlayState* play) { EnKusa2* this2 = this; s16 sp2A; - if (Actor_HasParent(&this->actor, globalCtx)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); + if (Actor_HasParent(&this->actor, play)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.shape.shadowAlpha = 60; this->actor.room = -1; @@ -971,7 +971,7 @@ void func_80A5D7C4(EnKusa2* this, GlobalContext* globalCtx) { return; } - if (!func_80A5BFD8(this, globalCtx)) { + if (!func_80A5BFD8(this, play)) { if ((this->unk_1C0 != NULL) && (this->unk_1C0->unk_1BE != 0)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; if (this2->unk_1C0 != NULL) { @@ -985,11 +985,11 @@ void func_80A5D7C4(EnKusa2* this, GlobalContext* globalCtx) { } if (this->actor.xzDistToPlayer < 600.0f) { - 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) { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } } @@ -1011,7 +1011,7 @@ void func_80A5D964(EnKusa2* this) { this->unk_1D0 = 30; } -void func_80A5D9C8(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5D9C8(EnKusa2* this, PlayState* play) { s32 pad; Vec3f sp30; s32 sp2C; @@ -1032,14 +1032,14 @@ void func_80A5D9C8(EnKusa2* this, GlobalContext* globalCtx) { D_80A5EAFC.y = Math_SinS(D_80A5EB04.y) * 1000.0f; D_80A5EAFC.z = Math_SinS(D_80A5EB04.z) * 1000.0f; - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; this->actor.colChkInfo.mass = 80; this->actor.home.rot.y = this->actor.world.rot.y; this->actor.velocity.y = 12.5f; this->actor.speedXZ += 3.0f; Actor_MoveWithGravity(&this->actor); - func_80A5BAFC(this, globalCtx); + func_80A5BAFC(this, play); func_80A5CD0C(this); this->unk_1C8 = 30; func_80A5DC70(this); @@ -1059,7 +1059,7 @@ void func_80A5D9C8(EnKusa2* this, GlobalContext* globalCtx) { } this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); } } @@ -1069,8 +1069,8 @@ void func_80A5DC70(EnKusa2* this) { this->unk_1CA = 80; } -void func_80A5DC98(EnKusa2* this, GlobalContext* globalCtx) { - if (!func_80A5BFD8(this, globalCtx)) { +void func_80A5DC98(EnKusa2* this, PlayState* play) { + if (!func_80A5BFD8(this, play)) { if (this->actor.velocity.y > 1.0f) { Math_StepToF(&this->actor.scale.y, 0.3f, 0.060000002f); Math_StepToF(&this->actor.scale.x, 0.328f, 0.040000003f); @@ -1082,17 +1082,17 @@ void func_80A5DC98(EnKusa2* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.x; Math_StepToF(&this->actor.gravity, -7.0f, 1.8f); Actor_MoveWithGravity(&this->actor); - func_80A5BAFC(this, globalCtx); + func_80A5BAFC(this, play); func_80A5BF38(this, 4); - func_80A5BF84(this, globalCtx); + func_80A5BF84(this, play); if (this->actor.bgCheckFlags & 1) { func_80A5CD0C(this); - func_80A5BB40(this, globalCtx, 1); + func_80A5BB40(this, play, 1); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); func_80A5DE18(this); } else if (this->actor.bgCheckFlags & 0x20) { - func_80A5BDB0(this, globalCtx); + func_80A5BDB0(this, play); func_80A5E418(this); } else if (this->unk_1CA > 0) { this->unk_1CA--; @@ -1111,13 +1111,13 @@ void func_80A5DE18(EnKusa2* this) { this->unk_1CA = Rand_S16Offset(19, 2); } -void func_80A5DEB4(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5DEB4(EnKusa2* this, PlayState* play) { s32 pad; s32 pad2; s16 sp24; s32 sp20; - if (!func_80A5BFD8(this, globalCtx)) { + if (!func_80A5BFD8(this, play)) { if (this->unk_1D0 > 0) { this->unk_1D0--; if (this->unk_1D0 == 0) { @@ -1148,22 +1148,22 @@ void func_80A5DEB4(EnKusa2* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.x = (s32)(fabsf(Math_SinS(this->unk_1C4)) * 4000.0f) - 0x6A4; - func_80A5BAFC(this, globalCtx); + func_80A5BAFC(this, play); func_80A5BF38(this, 4); - func_80A5BF84(this, globalCtx); + func_80A5BF84(this, play); if (Rand_Next() < 0xFFFFFFF) { func_80A5CD0C(this); } if (this->actor.bgCheckFlags & 0x20) { - func_80A5BDB0(this, globalCtx); + func_80A5BDB0(this, play); func_80A5E418(this); } else { this->unk_1C8--; if (this->unk_1C8 <= 0) { func_80A5CD0C(this); - func_80A5BB40(this, globalCtx, 4); + func_80A5BB40(this, play, 4); this->actor.speedXZ += 4.0f; this->actor.velocity.y = (Rand_ZeroOne() * 4.0f) + 15.0f; func_80A5E1D8(this); @@ -1171,7 +1171,7 @@ void func_80A5DEB4(EnKusa2* this, GlobalContext* globalCtx) { this->unk_1CA--; if (this->unk_1CA <= 0) { func_80A5CD0C(this); - func_80A5BB40(this, globalCtx, 2); + func_80A5BB40(this, play, 2); this->actor.velocity.y = (Rand_ZeroOne() * 6.0f) + 7.0f; this->actor.speedXZ += 2.0f; if (this->actor.yawTowardsPlayer < this->actor.world.rot.y) { @@ -1196,19 +1196,19 @@ void func_80A5E1D8(EnKusa2* this) { func_80A5CB74(this); } -void func_80A5E210(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5E210(EnKusa2* this, PlayState* play) { Math_StepToF(&this->actor.gravity, -4.0f, 0.5f); if (this->actor.bgCheckFlags & 1) { this->actor.speedXZ *= 0.4f; if (this->actor.bgCheckFlags & 2) { func_80A5D178(this); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_KUSAMUSHI_HIDE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_KUSAMUSHI_HIDE); } } Actor_MoveWithGravity(&this->actor); - func_80A5BAFC(this, globalCtx); + func_80A5BAFC(this, play); if (this->actor.velocity.y > 0.01f) { func_80A5BF38(this, 4); @@ -1258,18 +1258,18 @@ void func_80A5E418(EnKusa2* this) { this->actionFunc = func_80A5E4BC; } -void func_80A5E4BC(EnKusa2* this, GlobalContext* globalCtx) { +void func_80A5E4BC(EnKusa2* this, PlayState* play) { Math_StepToF(&this->actor.scale.y, 0.4f, 0.032f); Math_StepToF(&this->actor.scale.x, 0.4f, 0.032f); this->actor.scale.z = this->actor.scale.x; Actor_MoveWithGravity(&this->actor); - func_80A5BAFC(this, globalCtx); + func_80A5BAFC(this, play); func_80A5BF60(this, 6); this->actor.shape.rot.x -= 0x5DC; this->actor.shape.rot.y += this->unk_1CC; if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 5.0f) && (Rand_ZeroOne() < 0.8f)) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, (Rand_ZeroOne() * 0.08f) + 0.04f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, (Rand_ZeroOne() * 0.08f) + 0.04f); } this->unk_1CF -= 15; @@ -1278,38 +1278,38 @@ void func_80A5E4BC(EnKusa2* this, GlobalContext* globalCtx) { } } -void func_80A5E604(Actor* thisx, GlobalContext* globalCtx) { +void func_80A5E604(Actor* thisx, PlayState* play) { s32 pad; EnKusa2* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (D_80A60900 == globalCtx->gameplayFrames) { + if (D_80A60900 == play->gameplayFrames) { this->actor.draw = NULL; } else { this->actor.draw = func_80A5E6F0; - if (globalCtx->roomCtx.currRoom.unk3 == 0) { + if (play->roomCtx.currRoom.unk3 == 0) { func_80A5B508(); } func_80A5CAF4(&D_80A5F1C0); - D_80A60900 = globalCtx->gameplayFrames; + D_80A60900 = play->gameplayFrames; } } -void EnKusa2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa2_Update(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if ((this->unk_1C0 != NULL) && (this->unk_1C0->actor.update == NULL)) { this->unk_1C0 = NULL; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80A5CCD4(this); } -void func_80A5E6F0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A5E6F0(Actor* thisx, PlayState* play) { static Gfx* D_80A5EB68[] = { gKakeraLeafTip, gKakeraLeafMiddle, @@ -1317,9 +1317,9 @@ void func_80A5E6F0(Actor* thisx, GlobalContext* globalCtx) { EnKusa2* this = THIS; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(D_80A5F1C0.unk_0480); i++) { EnKusa2UnkBssSubStruct2* s = &D_80A5F1C0.unk_0480[i]; @@ -1328,42 +1328,41 @@ void func_80A5E6F0(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(s->unk_04.x, s->unk_04.y, s->unk_04.z, &s->unk_20); Matrix_Scale(s->unk_00, s->unk_00, s->unk_00, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_80A5EB68[i & 1]); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A5E80C(GlobalContext* globalCtx, s32 arg1) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80A5E80C(PlayState* play, s32 arg1) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, arg1); gSPDisplayList(POLY_XLU_DISP++, gKusaBushType2); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnKusa2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnKusa2_Draw(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->actor.projectedPos.z <= 1200.0f) { - if ((globalCtx->roomCtx.currRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && + if ((play->roomCtx.currRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A5B954(&D_80A60908[this->unk_1CE], 0.0015f); } - Gfx_DrawDListOpa(globalCtx, gKusaBushType1); + Gfx_DrawDListOpa(play, gKusaBushType1); } else if (this->actor.projectedPos.z < 1300.0f) { - func_80A5E80C(globalCtx, (1300.0f - this->actor.projectedPos.z) * 2.55f); + func_80A5E80C(play, (1300.0f - this->actor.projectedPos.z) * 2.55f); } } -void func_80A5E9B4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A5E9B4(Actor* thisx, PlayState* play) { Vec3s sp18; sp18.x = thisx->shape.rot.x + D_80A5EAFC.x; @@ -1371,15 +1370,15 @@ void func_80A5E9B4(Actor* thisx, GlobalContext* globalCtx) { sp18.z = thisx->shape.rot.z + D_80A5EAFC.z; Matrix_SetTranslateRotateYXZ(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, &sp18); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gKusaBushType1); + Gfx_DrawDListOpa(play, gKusaBushType1); } -void func_80A5EA48(Actor* thisx, GlobalContext* globalCtx) { +void func_80A5EA48(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->unk_1CF == 0xFF) { - Gfx_DrawDListOpa(globalCtx, gKusaBushType1); + Gfx_DrawDListOpa(play, gKusaBushType1); } else { - func_80A5E80C(globalCtx, this->unk_1CF); + func_80A5E80C(play, this->unk_1CF); } } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h index f18c1a6a7a..6d62df60ad 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h @@ -6,7 +6,7 @@ struct EnKusa2; struct EnKusa2UnkBssSubStruct; -typedef void (*EnKusa2ActionFunc)(struct EnKusa2*, GlobalContext*); +typedef void (*EnKusa2ActionFunc)(struct EnKusa2*, PlayState*); typedef void (*EnKusa2BssFunc)(struct EnKusa2UnkBssSubStruct*); #define ENKUSA2_GET_1(thisx) (((thisx)->params) & 1) diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index 8669a3544c..85e57c550a 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -10,10 +10,10 @@ #define THIS ((EnLiftNuts*)thisx) -void EnLiftNuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLiftNuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLiftNuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLiftNuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnLiftNuts_Init(Actor* thisx, PlayState* play); +void EnLiftNuts_Destroy(Actor* thisx, PlayState* play); +void EnLiftNuts_Update(Actor* thisx, PlayState* play); +void EnLiftNuts_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Lift_Nuts_InitVars = { diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h index fe63bb8f16..a683e3f79a 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.h @@ -5,7 +5,7 @@ struct EnLiftNuts; -typedef void (*EnLiftNutsActionFunc)(struct EnLiftNuts*, GlobalContext*); +typedef void (*EnLiftNutsActionFunc)(struct EnLiftNuts*, PlayState*); typedef struct EnLiftNuts { /* 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 9dc919e0e2..538b7b28db 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -11,12 +11,12 @@ #define THIS ((EnLight*)thisx) -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_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 func_80865F38(Actor* thisx, GlobalContext* globalCtx); +void func_80865F38(Actor* thisx, PlayState* play); const ActorInit En_Light_InitVars = { ACTOR_EN_LIGHT, @@ -47,7 +47,7 @@ EnLightStruct D_808666D0[] = { { { 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) { s32 pad; EnLight* this = THIS; @@ -61,7 +61,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { ((this->actor.params < 0) ? 1 : 40) + (s32)this->actor.world.pos.y, 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_808666D0[ENLIGHT_GET_F(&this->actor)].unk_07 * 0.0001f); @@ -70,7 +70,7 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { if (ENLIGHT_GET_800(&this->actor)) { this->actor.update = func_80865F38; - if (ENLIGHT_GET_1000(&this->actor) && Flags_GetSwitch(globalCtx, ENLIGHT_SWITCHFLAG(&this->actor))) { + if (ENLIGHT_GET_1000(&this->actor) && Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { Actor_SetScale(&this->actor, 0.0f); } } else if (ENLIGHT_GET_2000(&this->actor)) { @@ -78,16 +78,16 @@ void EnLight_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Destroy(Actor* thisx, PlayState* play) { EnLight* this = THIS; if (!ENLIGHT_GET_4000(&this->actor)) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } } -void func_80865BF8(EnLight* this, GlobalContext* globalCtx) { - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); +void func_80865BF8(EnLight* this, PlayState* play) { + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); if (this->actor.parent != NULL) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.parent->world.pos); @@ -97,7 +97,7 @@ void func_80865BF8(EnLight* this, GlobalContext* globalCtx) { this->unk_144++; } -void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Update(Actor* thisx, PlayState* play) { EnLight* this = THIS; if (!ENLIGHT_GET_4000(&this->actor)) { @@ -109,14 +109,14 @@ void EnLight_Update(Actor* thisx, GlobalContext* globalCtx) { (u8)(sp28->unk_00.b * temp_f2), radius); } - func_80865BF8(this, globalCtx); + func_80865BF8(this, play); if ((this->actor.params >= 0) && !ENLIGHT_GET_4000(&this->actor)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void func_80865F38(Actor* thisx, GlobalContext* globalCtx) { +void func_80865F38(Actor* thisx, PlayState* play) { EnLight* this = THIS; EnLightStruct* sp38 = &D_808666D0[ENLIGHT_GET_F(&this->actor)]; f32 temp_f2; @@ -124,7 +124,7 @@ void func_80865F38(Actor* thisx, GlobalContext* globalCtx) { s32 sp2C = false; if (ENLIGHT_GET_1000(&this->actor)) { - if (Flags_GetSwitch(globalCtx, ENLIGHT_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { Math_StepToF(&sp30, 1.0f, 0.05f); sp2C = true; } else { @@ -134,7 +134,7 @@ void func_80865F38(Actor* thisx, GlobalContext* globalCtx) { } Math_StepToF(&sp30, 0.0f, 0.05f); } - } else if (Flags_GetSwitch(globalCtx, ENLIGHT_SWITCHFLAG(&this->actor))) { + } else if (Flags_GetSwitch(play, ENLIGHT_SWITCHFLAG(&this->actor))) { if (sp30 < 0.1f) { Actor_SetScale(&this->actor, 0.0f); sp30 = 0.0f; @@ -153,41 +153,40 @@ void func_80865F38(Actor* thisx, GlobalContext* globalCtx) { (u8)(sp38->unk_00.b * temp_f2), 300.0f * sp30); } - func_80865BF8(this, globalCtx); + func_80865BF8(this, play); if ((this->actor.params >= 0) && (sp2C == true)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } -void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnLight_Draw(Actor* thisx, PlayState* play) { s32 pad; EnLight* this = THIS; EnLightStruct* sp6C = &D_808666D0[ENLIGHT_GET_F(&this->actor)]; Gfx* sp68; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (this->actor.params >= 0) { - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_144 * -20) & 0x1FF, - 0x20, 0x80)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_144 * -20) & 0x1FF, 0x20, 0x80)); sp68 = gGameplayKeepDrawFlameDL; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sp6C->unk_00.r, sp6C->unk_00.g, sp6C->unk_00.b, sp6C->unk_00.a); gDPSetEnvColor(POLY_XLU_DISP++, sp6C->unk_04.r, sp6C->unk_04.g, sp6C->unk_04.b, 0); } else { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x10, 0x20, 1, (this->unk_144 * 2) & 0x3F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x10, 0x20, 1, (this->unk_144 * 2) & 0x3F, (this->unk_144 * -6) & 0x7F, 0x10, 0x20)); sp68 = gameplay_keep_DL_01ACF0; gDPSetPrimColor(POLY_XLU_DISP++, 0xC0, 0xC0, 255, 200, 0, 0); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); } - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y), - MTXMODE_APPLY); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y), MTXMODE_APPLY); if (ENLIGHT_GET_1(&this->actor)) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); @@ -195,8 +194,8 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sp68); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index 774acf1182..8888ad4885 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -10,18 +10,18 @@ #define THIS ((EnLookNuts*)thisx) -void EnLookNuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnLookNuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnLookNuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnLookNuts_Init(Actor* thisx, PlayState* play); +void EnLookNuts_Destroy(Actor* thisx, PlayState* play); +void EnLookNuts_Update(Actor* thisx, PlayState* play); +void EnLookNuts_Draw(Actor* thisx, PlayState* play); void EnLookNuts_SetupPatrol(EnLookNuts* this); -void EnLookNuts_Patrol(EnLookNuts* this, GlobalContext* globalCtx); +void EnLookNuts_Patrol(EnLookNuts* this, PlayState* play); void EnLookNuts_SetupStandAndWait(EnLookNuts* this); -void EnLookNuts_StandAndWait(EnLookNuts* this, GlobalContext* globalCtx); -void EnLookNuts_RunToPlayer(EnLookNuts* this, GlobalContext* globalCtx); +void EnLookNuts_StandAndWait(EnLookNuts* this, PlayState* play); +void EnLookNuts_RunToPlayer(EnLookNuts* this, PlayState* play); void EnLookNuts_SetupSendPlayerToSpawn(EnLookNuts* this); -void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, GlobalContext* globalCtx); +void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play); const ActorInit En_Look_Nuts_InitVars = { ACTOR_EN_LOOK_NUTS, @@ -99,17 +99,17 @@ typedef enum { /* 0x03 */ PALACE_GUARD_CAUGHT_PLAYER } PalaceGuardState; -void EnLookNuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnLookNuts_Init(Actor* thisx, PlayState* play) { EnLookNuts* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuPalaceGuardSkel, &gDekuPalaceGuardDigAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gDekuPalaceGuardSkel, &gDekuPalaceGuardDigAnim, this->jointTable, this->morphTable, DEKU_PALACE_GUARD_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.flags |= ACTOR_FLAG_8000000; this->pathLocation = LOOKNUTS_GET_PATROL_LOCATION(&this->actor); this->switchFlag = LOOKNUTS_GET_SCENE_FLAG(&this->actor); @@ -118,7 +118,7 @@ void EnLookNuts_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->switchFlag == 0x7F) { this->switchFlag = -1; } - if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { Actor_MarkForDeath(&this->actor); return; } @@ -131,10 +131,10 @@ void EnLookNuts_Init(Actor* thisx, GlobalContext* globalCtx) { EnLookNuts_SetupPatrol(this); } -void EnLookNuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnLookNuts_Destroy(Actor* thisx, PlayState* play) { EnLookNuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnLookNuts_SetupPatrol(EnLookNuts* this) { @@ -144,12 +144,12 @@ void EnLookNuts_SetupPatrol(EnLookNuts* this) { this->actionFunc = EnLookNuts_Patrol; } -void EnLookNuts_Patrol(EnLookNuts* this, GlobalContext* globalCtx) { +void EnLookNuts_Patrol(EnLookNuts* this, PlayState* play) { f32 sp34 = 0.0f; f32 sp30; SkelAnime_Update(&this->skelAnime); - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { this->actor.speedXZ = 0.0f; return; } @@ -164,7 +164,7 @@ void EnLookNuts_Patrol(EnLookNuts* this, GlobalContext* globalCtx) { return; } - this->path = SubS_GetPathByIndex(globalCtx, this->pathLocation, 0x1F); + this->path = SubS_GetPathByIndex(play, this->pathLocation, 0x1F); if (this->path != NULL) { sp34 = SubS_GetDistSqAndOrientPath(this->path, this->currentPathIndex, &this->actor.world.pos, &sp30); } @@ -202,12 +202,12 @@ void EnLookNuts_SetupStandAndWait(EnLookNuts* this) { } // Patrol Guards will stand in place and wait for a maximum of ~12 frames. -void EnLookNuts_StandAndWait(EnLookNuts* this, GlobalContext* globalCtx) { +void EnLookNuts_StandAndWait(EnLookNuts* this, PlayState* play) { s16 randOffset; SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 1.0f); - if (!Play_InCsMode(globalCtx) && (D_80A6862C == 0) && (this->eventTimer == 0)) { + if (!Play_InCsMode(play) && (D_80A6862C == 0) && (this->eventTimer == 0)) { this->eventTimer = 10; switch (this->waitTimer) { case 0: @@ -260,16 +260,16 @@ void EnLookNuts_StandAndWait(EnLookNuts* this, GlobalContext* globalCtx) { } } -void EnLookNuts_DetectedPlayer(EnLookNuts* this, GlobalContext* globalCtx) { +void EnLookNuts_DetectedPlayer(EnLookNuts* this, PlayState* play) { Animation_Change(&this->skelAnime, &gDekuPalaceGuardWalkAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gDekuPalaceGuardWalkAnim), 0, -10.0f); this->state = PALACE_GUARD_RUNNING_TO_PLAYER; this->eventTimer = 300; - Message_StartTextbox(globalCtx, 0x833, &this->actor); + Message_StartTextbox(play, 0x833, &this->actor); this->actionFunc = EnLookNuts_RunToPlayer; } -void EnLookNuts_RunToPlayer(EnLookNuts* this, GlobalContext* globalCtx) { +void EnLookNuts_RunToPlayer(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); @@ -290,22 +290,22 @@ void EnLookNuts_SetupSendPlayerToSpawn(EnLookNuts* this) { this->actionFunc = EnLookNuts_SendPlayerToSpawn; } -void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, GlobalContext* globalCtx) { +void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(this->spawnIndex); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); + play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(this->spawnIndex); gSaveContext.nextCutsceneIndex = 0; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; gSaveContext.save.weekEventReg[17] |= 4; } } static Vec3f effectVecInitialize = { 0.0f, 0.0f, 0.0f }; -void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnLookNuts_Update(Actor* thisx, PlayState* play) { s32 pad; EnLookNuts* this = THIS; Vec3f effectVelOffset; @@ -319,7 +319,7 @@ void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx) { this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->blinkTimer != 0) { this->blinkTimer--; } @@ -344,24 +344,24 @@ void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.save.isNight) { drawFlag = 0; } - if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { - EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &gZeroVec3f, 50, - &this->isPlayerDetected, drawFlag); + if (Player_GetMask(play) != PLAYER_MASK_STONE) { + EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->isPlayerDetected, + drawFlag); } } if ((this->isPlayerDetected == true) || (this->actor.xzDistToPlayer < 20.0f)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!(player->stateFlags3 & 0x100) && !Play_InCsMode(globalCtx)) { + if (!(player->stateFlags3 & 0x100) && !Play_InCsMode(play)) { Math_Vec3f_Copy(&this->headRotTarget, &gZeroVec3f); this->state = PALACE_GUARD_RUNNING_TO_PLAYER; play_sound(NA_SE_SY_FOUND); - func_800B7298(globalCtx, &this->actor, 0x1A); + func_800B7298(play, &this->actor, 0x1A); D_80A6862C = 1; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_10); this->actor.gravity = 0.0f; - EnLookNuts_DetectedPlayer(this, globalCtx); + EnLookNuts_DetectedPlayer(this, play); } else { this->isPlayerDetected = false; } @@ -372,7 +372,7 @@ void EnLookNuts_Update(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachF(&this->headRotation.z, this->headRotTarget.z, 1.0f, 2000.0f); this->actor.shape.rot.y = this->actor.world.rot.y; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -382,14 +382,14 @@ static TexturePtr sEyeTextures[] = { gDekuPalaceGuardEyeClosedTex, }; -void EnLookNuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnLookNuts_Draw(Actor* thisx, PlayState* play) { EnLookNuts* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h index e6eb6597ae..91b8db8714 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h @@ -6,7 +6,7 @@ struct EnLookNuts; -typedef void (*EnLookNutsActionFunc)(struct EnLookNuts*, GlobalContext*); +typedef void (*EnLookNutsActionFunc)(struct EnLookNuts*, PlayState*); #define LOOKNUTS_GET_SPAWN_INDEX(thisx) (((thisx)->params >> 0xC) & 0xF) #define LOOKNUTS_GET_SCENE_FLAG(thisx) ((thisx)->params & 0x7F) 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 4da43c3cff..e42e70ca30 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 @@ -10,9 +10,9 @@ #define THIS ((EnMFire1*)thisx) -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, @@ -46,24 +46,24 @@ static ColliderCylinderInit sCylinderInit = { { 100, 100, 0, { 0, 0, 0 } }, }; -void EnMFire1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Init(Actor* thisx, PlayState* play) { EnMFire1* this = THIS; s32 pad; - 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->actor.params != 0) { this->collider.info.toucher.dmgFlags = 0x40000; } } -void EnMFire1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMFire1_Destroy(Actor* thisx, PlayState* play) { EnMFire1* this = THIS; - 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 = THIS; s32 pad; @@ -71,6 +71,6 @@ void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&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 a7f83a42c9..82e3999c11 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 @@ -10,10 +10,10 @@ #define THIS ((EnMThunder*)thisx) -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); #if 0 const ActorInit En_M_Thunder_InitVars = { 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 a05546ba42..d3b6590d4a 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 @@ -5,7 +5,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_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 226059ae24..3f92ffd5f5 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -11,34 +11,34 @@ #define THIS ((EnMa4*)thisx) -void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMa4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMa4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMa4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMa4_Init(Actor* thisx, PlayState* play); +void EnMa4_Destroy(Actor* thisx, PlayState* play); +void EnMa4_Update(Actor* thisx, PlayState* play); +void EnMa4_Draw(Actor* thisx, PlayState* play); void EnMa4_SetupWait(EnMa4* this); -void EnMa4_Wait(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_Wait(EnMa4* this, PlayState* play); +void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play); +void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play); void EnMa4_SetupDialogueHandler(EnMa4* this); -void EnMa4_DialogueHandler(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_DialogueHandler(EnMa4* this, PlayState* play); void EnMa4_SetupBeginHorsebackGame(EnMa4* this); -void EnMa4_BeginHorsebackGame(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_HorsebackGameTalking(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_HorsebackGameWait(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_BeginHorsebackGame(EnMa4* this, PlayState* play); +void EnMa4_HorsebackGameTalking(EnMa4* this, PlayState* play); +void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play); +void EnMa4_SetupHorsebackGameWait(EnMa4* this, PlayState* play); +void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play); +void EnMa4_SetupHorsebackGameEnd(EnMa4* this, PlayState* play); +void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play); void EnMa4_SetupBeginEponasSongCs(EnMa4* this); -void EnMa4_BeginEponasSongCs(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_BeginEponasSongCs(EnMa4* this, PlayState* play); void EnMa4_SetupEponasSongCs(EnMa4* this); -void EnMa4_EponasSongCs(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_EponasSongCs(EnMa4* this, PlayState* play); void EnMa4_SetupEndEponasSongCs(EnMa4* this); -void EnMa4_EndEponasSongCs(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_EndEponasSongCs(EnMa4* this, PlayState* play); void EnMa4_SetupBeginDescribeThemCs(EnMa4* this); -void EnMa4_BeginDescribeThemCs(EnMa4* this, GlobalContext* globalCtx); -void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx); +void EnMa4_BeginDescribeThemCs(EnMa4* this, PlayState* play); +void EnMa4_StartDialogue(EnMa4* this, PlayState* play); void EnMa4_SetFaceExpression(EnMa4* this, s16 overrideEyeTexIndex, s16 mouthTexIndex); void EnMa4_InitFaceExpression(EnMa4* this); @@ -141,8 +141,8 @@ void EnMa4_ChangeAnim(EnMa4* this, s32 index) { sAnimationInfo[index].morphFrames); } -void func_80ABDD9C(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ABDD9C(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 flag; if (this->unk_1D8.unk_00 == 0 && ((this->skelAnime.animation == &object_ma1_Anim_007328) || @@ -158,11 +158,11 @@ void func_80ABDD9C(EnMa4* this, GlobalContext* globalCtx) { func_800BD888(&this->actor, &this->unk_1D8, 0, flag); } -void EnMa4_InitPath(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_InitPath(EnMa4* this, PlayState* play) { Path* path; Vec3f nextPoint; - path = &globalCtx->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathIndex = 0; this->pathPointsCount = path->count; @@ -178,19 +178,19 @@ void EnMa4_InitPath(EnMa4* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &nextPoint); } -void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMa4_Init(Actor* thisx, PlayState* play) { EnMa4* this = THIS; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, MA1_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, DamageTable_Get(0x16), &D_80AC00DC); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; @@ -209,12 +209,12 @@ void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) { this->hasBow = false; } - if (Cutscene_GetSceneSetupIndex(globalCtx) != 0) { // if (sceneSetupIndex != 0) + if (Cutscene_GetSceneSetupIndex(play) != 0) { // if (sceneSetupIndex != 0) EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_HORSEBACKGAME; - EnMa4_InitHorsebackGame(this, globalCtx); + EnMa4_InitHorsebackGame(this, play); } else { - EnMa4_InitPath(this, globalCtx); + EnMa4_InitPath(this, play); if (gSaveContext.save.entranceIndex == 0x6410) { EnMa4_ChangeAnim(this, 0); @@ -236,15 +236,15 @@ void EnMa4_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMa4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMa4_Destroy(Actor* thisx, PlayState* play) { EnMa4* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); gSaveContext.save.weekEventReg[8] &= (u8)~1; } // Running in circles in the ranch -void EnMa4_RunInCircles(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { static s32 sCurrentAnim = 9; static s32 D_80AC0250 = 0; static s16 D_80AC0254 = 10; @@ -298,7 +298,7 @@ void EnMa4_RunInCircles(EnMa4* this, GlobalContext* globalCtx) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Actor_MoveWithGravity(&this->actor); if (this->skelAnime.animation == &object_ma1_Anim_007328) { // Walking animation if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { @@ -327,14 +327,14 @@ void EnMa4_SetupWait(EnMa4* this) { this->actionFunc = EnMa4_Wait; } -void EnMa4_Wait(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMa4_Wait(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; if ((this->state == MA4_STATE_AFTERHORSEBACKGAME) || (this->state == MA4_STATE_AFTERDESCRIBETHEMCS)) { this->actor.flags |= ACTOR_FLAG_10000; } else if (this->type != MA4_TYPE_ALIENS_WON) { - EnMa4_RunInCircles(this, globalCtx); + EnMa4_RunInCircles(this, play); } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->animTimer++; if (this->animTimer == 5) { @@ -345,233 +345,233 @@ void EnMa4_Wait(EnMa4* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { - EnMa4_StartDialogue(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { + EnMa4_StartDialogue(this, play); EnMa4_SetupDialogueHandler(this); } else if (this->type != MA4_TYPE_ALIENS_WON || ABS_ALT(yaw) < 0x4000) { if (!(player->stateFlags1 & 0x800000)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } } // Chooses the next dialogue based on player's selection -void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x3339: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x333A, &this->actor); + Message_StartTextbox(play, 0x333A, &this->actor); this->textId = 0x333A; } else { func_8019F208(); - Message_StartTextbox(globalCtx, 0x333B, &this->actor); + Message_StartTextbox(play, 0x333B, &this->actor); this->textId = 0x333B; } break; case 0x3341: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); gSaveContext.save.weekEventReg[21] |= 0x20; - Message_StartTextbox(globalCtx, 0x3343, &this->actor); + Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { func_8019F230(); EnMa4_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x3342, &this->actor); + Message_StartTextbox(play, 0x3342, &this->actor); this->textId = 0x3342; this->state = MA4_STATE_DEFAULT; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } break; case 0x3346: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); gSaveContext.save.weekEventReg[21] |= 0x20; - Message_StartTextbox(globalCtx, 0x3343, &this->actor); + Message_StartTextbox(play, 0x3343, &this->actor); this->textId = 0x3343; } else { func_8019F230(); EnMa4_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x3342, &this->actor); + Message_StartTextbox(play, 0x3342, &this->actor); this->textId = 0x3342; } break; case 0x3347: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x3349, &this->actor); + Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x3348, &this->actor); + Message_StartTextbox(play, 0x3348, &this->actor); this->textId = 0x3348; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } break; - case 0x334D: // Asks if you understood her explanation. - if (globalCtx->msgCtx.choiceIndex == 0) { // Yes + case 0x334D: // Asks if you understood her explanation. + if (play->msgCtx.choiceIndex == 0) { // Yes s32 aux; func_8019F208(); - Message_StartTextbox(globalCtx, 0x334E, &this->actor); + Message_StartTextbox(play, 0x334E, &this->actor); this->textId = 0x334E; if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { - func_80151BB4(globalCtx, 0x1C); + func_80151BB4(play, 0x1C); } - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } else { // No. func_8019F230(); EnMa4_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x334C, &this->actor); + Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; } break; case 0x3354: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x3349, &this->actor); + Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { func_8019F230(); EnMa4_SetFaceExpression(this, 1, 0); - Message_StartTextbox(globalCtx, 0x3355, &this->actor); + Message_StartTextbox(play, 0x3355, &this->actor); this->textId = 0x3355; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } break; case 0x3356: // "Try again?" - if (globalCtx->msgCtx.choiceIndex == 0) { // Yes + if (play->msgCtx.choiceIndex == 0) { // Yes func_8019F208(); - func_801477B4(globalCtx); + func_801477B4(play); EnMa4_SetupBeginHorsebackGame(this); } else { // No if (this->type == MA4_TYPE_ALIENS_DEFEATED) { func_8019F230(); EnMa4_SetFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x3357, &this->actor); + Message_StartTextbox(play, 0x3357, &this->actor); this->textId = 0x3357; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } else { func_8019F230(); EnMa4_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x335B, &this->actor); + Message_StartTextbox(play, 0x335B, &this->actor); this->textId = 0x335B; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } } break; case 0x3359: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x3349, &this->actor); + Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; } else { func_8019F230(); EnMa4_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x335A, &this->actor); + Message_StartTextbox(play, 0x335A, &this->actor); this->textId = 0x335A; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } break; } } } -void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 aux; - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x2390: - func_801477B4(globalCtx); + func_801477B4(play); EnMa4_SetupBeginHorsebackGame(this); break; case 0x3335: EnMa4_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3336, &this->actor); + Message_StartTextbox(play, 0x3336, &this->actor); this->textId = 0x3336; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); break; case 0x3338: - Message_StartTextbox(globalCtx, 0x3339, &this->actor); + Message_StartTextbox(play, 0x3339, &this->actor); this->textId = 0x3339; break; case 0x333A: case 0x333B: EnMa4_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x333C, &this->actor); + Message_StartTextbox(play, 0x333C, &this->actor); this->textId = 0x333C; break; case 0x333C: EnMa4_SetFaceExpression(this, 0, 2); - Message_StartTextbox(globalCtx, 0x333D, &this->actor); + Message_StartTextbox(play, 0x333D, &this->actor); this->textId = 0x333D; break; case 0x333D: - Message_StartTextbox(globalCtx, 0x333E, &this->actor); + Message_StartTextbox(play, 0x333E, &this->actor); this->textId = 0x333E; break; case 0x333E: - func_801477B4(globalCtx); + func_801477B4(play); EnMa4_SetupBeginDescribeThemCs(this); break; case 0x333F: - Message_StartTextbox(globalCtx, 0x3340, &this->actor); + Message_StartTextbox(play, 0x3340, &this->actor); this->textId = 0x3340; break; case 0x3340: EnMa4_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3341, &this->actor); + Message_StartTextbox(play, 0x3341, &this->actor); this->textId = 0x3341; break; case 0x3343: EnMa4_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x3344, &this->actor); + Message_StartTextbox(play, 0x3344, &this->actor); this->textId = 0x3344; break; case 0x3344: - Message_StartTextbox(globalCtx, 0x3345, &this->actor); + Message_StartTextbox(play, 0x3345, &this->actor); this->textId = 0x3345; break; case 0x3345: - Message_StartTextbox(globalCtx, 0x3349, &this->actor); + Message_StartTextbox(play, 0x3349, &this->actor); this->textId = 0x3349; break; case 0x3349: - Message_StartTextbox(globalCtx, 0x334A, &this->actor); + Message_StartTextbox(play, 0x334A, &this->actor); this->textId = 0x334A; break; case 0x334A: - func_801477B4(globalCtx); + func_801477B4(play); EnMa4_SetupBeginHorsebackGame(this); break; case 0x334C: - Message_StartTextbox(globalCtx, 0x334D, &this->actor); + Message_StartTextbox(play, 0x334D, &this->actor); this->textId = 0x334D; break; @@ -580,10 +580,10 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) { case 0x335D: case 0x335E: if (this->type == MA4_TYPE_DAY1) { - Message_StartTextbox(globalCtx, 0x3352, &this->actor); + Message_StartTextbox(play, 0x3352, &this->actor); this->textId = 0x3352; } else { - Message_StartTextbox(globalCtx, 0x3356, &this->actor); + Message_StartTextbox(play, 0x3356, &this->actor); this->textId = 0x3356; } break; @@ -594,23 +594,23 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) { // Check if player has Epona's song if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { - Message_StartTextbox(globalCtx, 0x334C, &this->actor); + Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; } else { - func_801477B4(globalCtx); + func_801477B4(play); player->stateFlags1 |= 0x20; EnMa4_SetupBeginEponasSongCs(this); - EnMa4_BeginEponasSongCs(this, globalCtx); + EnMa4_BeginEponasSongCs(this, play); } break; case 0x3358: if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || !(CHECK_QUEST_ITEM(QUEST_SONG_EPONA))) { - Message_StartTextbox(globalCtx, 0x335C, &this->actor); + Message_StartTextbox(play, 0x335C, &this->actor); this->textId = 0x335C; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } else { - Message_StartTextbox(globalCtx, 0x3359, &this->actor); + Message_StartTextbox(play, 0x3359, &this->actor); this->textId = 0x3359; } break; @@ -627,24 +627,24 @@ void EnMa4_SetupDialogueHandler(EnMa4* this) { this->actionFunc = EnMa4_DialogueHandler; } -void EnMa4_DialogueHandler(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_DialogueHandler(EnMa4* this, PlayState* play) { s32 temp_v0; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { default: break; case 4: // Player answered a question - EnMa4_HandlePlayerChoice(this, globalCtx); + EnMa4_HandlePlayerChoice(this, play); break; case 5: // End message block - EnMa4_ChooseNextDialogue(this, globalCtx); + EnMa4_ChooseNextDialogue(this, play); break; case 6: // End conversation - if (Message_ShouldAdvance(globalCtx)) { - if ((globalCtx->msgCtx.unk120B1 == 0) || !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { + if (Message_ShouldAdvance(play)) { + if ((play->msgCtx.unk120B1 == 0) || !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { EnMa4_SetupWait(this); } } @@ -665,108 +665,108 @@ void EnMa4_SetupBeginHorsebackGame(EnMa4* this) { this->actionFunc = EnMa4_BeginHorsebackGame; } -void EnMa4_BeginHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x6400; +void EnMa4_BeginHorsebackGame(EnMa4* this, PlayState* play) { + play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x50; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x50; gSaveContext.nextTransition = 3; } -void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { // "You're feeling confident" - Message_StartTextbox(globalCtx, 0x336E, &this->actor); + Message_StartTextbox(play, 0x336E, &this->actor); this->actionFunc = EnMa4_HorsebackGameTalking; } else if ((gSaveContext.unk_3DE0[4] < 115 * 100)) { // timer < 115 seconds - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void EnMa4_HorsebackGameTalking(EnMa4* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void EnMa4_HorsebackGameTalking(EnMa4* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnMa4_HorsebackGameWait; } } -void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); - globalCtx->interfaceCtx.unk_280 = 1; + play->interfaceCtx.unk_280 = 1; func_8010E9F0(4, 0); gSaveContext.save.weekEventReg[8] |= 1; - func_80112AFC(globalCtx); + func_80112AFC(play); player->stateFlags1 |= 0x20; this->actionFunc = EnMa4_SetupHorsebackGameWait; } -void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMa4_SetupHorsebackGameWait(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->interfaceCtx.unk_280 == 8) { + if (play->interfaceCtx.unk_280 == 8) { this->actionFunc = EnMa4_HorsebackGameWait; player->stateFlags1 &= ~0x20; } } -void EnMa4_HorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { static s16 D_80AC0258 = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags3 |= 0x400; - EnMa4_HorsebackGameCheckPlayerInteractions(this, globalCtx); + EnMa4_HorsebackGameCheckPlayerInteractions(this, play); if (this->poppedBalloonCounter != D_80AC0258) { D_80AC0258 = this->poppedBalloonCounter; - globalCtx->interfaceCtx.unk_25C = 1; + play->interfaceCtx.unk_25C = 1; } if ((gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) // timer >= 2 minutes || (this->poppedBalloonCounter == 10)) { gSaveContext.unk_3DD0[4] = 6; - EnMa4_SetupHorsebackGameEnd(this, globalCtx); + EnMa4_SetupHorsebackGameEnd(this, play); D_80AC0258 = 0; } } -void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_SetupHorsebackGameEnd(EnMa4* this, PlayState* play) { gSaveContext.save.weekEventReg[8] &= (u8)~1; this->actionFunc = EnMa4_HorsebackGameEnd; Audio_QueueSeqCmd(NA_BGM_STOP); Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); } -void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) { static s32 sFrameCounter = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x100000) { - globalCtx->actorCtx.unk268 = 1; - globalCtx->actorCtx.unk_26C.press.button = BTN_A; + play->actorCtx.unk268 = 1; + play->actorCtx.unk_26C.press.button = BTN_A; } else { - globalCtx->actorCtx.unk268 = 1; + play->actorCtx.unk268 = 1; } if (sFrameCounter == 25) { if (this->poppedBalloonCounter == 10) { - Message_StartTextbox(globalCtx, 0x334F, &this->actor); + Message_StartTextbox(play, 0x334F, &this->actor); this->textId = 0x334F; } else { - Message_StartTextbox(globalCtx, 0x334B, &this->actor); + Message_StartTextbox(play, 0x334B, &this->actor); this->textId = 0x334B; } } else if (sFrameCounter == 50) { - globalCtx->actorCtx.unk268 = 0; - globalCtx->nextEntranceIndex = 0x6410; + play->actorCtx.unk268 = 0; + play->nextEntranceIndex = 0x6410; gSaveContext.nextCutsceneIndex = 0; sFrameCounter = 0; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; if (this->poppedBalloonCounter == 10) { - globalCtx->unk_1887F = 0x50; + play->unk_1887F = 0x50; gSaveContext.nextTransition = 3; } else { - globalCtx->unk_1887F = 0x40; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 2; } @@ -781,7 +781,7 @@ void EnMa4_SetupBeginEponasSongCs(EnMa4* this) { } // Epona's Song cutscene is an ActorCutscene -void EnMa4_BeginEponasSongCs(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_BeginEponasSongCs(EnMa4* this, PlayState* play) { s16 cutsceneIndex = this->actor.cutscene; if (ActorCutscene_GetCanPlayNext(cutsceneIndex) != 0) { @@ -801,16 +801,16 @@ void EnMa4_SetupEponasSongCs(EnMa4* this) { } static u16 D_80AC0260 = 99; -void EnMa4_EponasSongCs(EnMa4* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 120)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 120); +void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 120)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 120); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - if (globalCtx->csCtx.actorActions[actionIndex]->action != D_80AC0260) { - D_80AC0260 = globalCtx->csCtx.actorActions[actionIndex]->action; + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + if (play->csCtx.actorActions[actionIndex]->action != D_80AC0260) { + D_80AC0260 = play->csCtx.actorActions[actionIndex]->action; this->animTimer = 0; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->hasBow = true; EnMa4_ChangeAnim(this, 1); @@ -824,15 +824,15 @@ void EnMa4_EponasSongCs(EnMa4* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); if (D_80AC0260 == 2 && this->animTimer == 0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMa4_ChangeAnim(this, 7); } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); D_80AC0260 = 99; this->hasBow = true; EnMa4_SetupEndEponasSongCs(this); @@ -843,18 +843,18 @@ void EnMa4_SetupEndEponasSongCs(EnMa4* this) { this->actionFunc = EnMa4_EndEponasSongCs; } -void EnMa4_EndEponasSongCs(EnMa4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMa4_EndEponasSongCs(EnMa4* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.flags |= ACTOR_FLAG_10000; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { player->stateFlags1 &= ~0x20; - Message_StartTextbox(globalCtx, 0x334C, &this->actor); + Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; this->actor.flags &= ~ACTOR_FLAG_10000; EnMa4_SetupDialogueHandler(this); } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } @@ -862,15 +862,15 @@ void EnMa4_SetupBeginDescribeThemCs(EnMa4* this) { this->actionFunc = EnMa4_BeginDescribeThemCs; } -void EnMa4_BeginDescribeThemCs(EnMa4* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x6400; +void EnMa4_BeginDescribeThemCs(EnMa4* this, PlayState* play) { + play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF5; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x40; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 2; } -void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { +void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { s32 pad; OSTime time; @@ -879,25 +879,25 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { if ((gSaveContext.save.weekEventReg[21] & 0x80)) { EnMa4_SetFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x3337, &this->actor); + Message_StartTextbox(play, 0x3337, &this->actor); this->textId = 0x3337; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } else { - Message_StartTextbox(globalCtx, 0x3335, &this->actor); + Message_StartTextbox(play, 0x3335, &this->actor); this->textId = 0x3335; gSaveContext.save.weekEventReg[21] |= 0x80; } } else if (this->state == MA4_STATE_DEFAULT) { if ((gSaveContext.save.weekEventReg[21] & 0x40)) { if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { - Message_StartTextbox(globalCtx, 0x3346, &this->actor); + Message_StartTextbox(play, 0x3346, &this->actor); this->textId = 0x3346; } else { - Message_StartTextbox(globalCtx, 0x3347, &this->actor); + Message_StartTextbox(play, 0x3347, &this->actor); this->textId = 0x3347; } } else { - Message_StartTextbox(globalCtx, 0x3338, &this->actor); + Message_StartTextbox(play, 0x3338, &this->actor); this->textId = 0x3338; gSaveContext.save.weekEventReg[21] |= 0x40; } @@ -905,7 +905,7 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { // "Too bad Grasshopper" EnMa4_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x336D, &this->actor); + Message_StartTextbox(play, 0x336D, &this->actor); this->textId = 0x336D; } else { time = gSaveContext.unk_3DE0[4]; @@ -913,11 +913,11 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { // [Score] New record! gSaveContext.save.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3350, &this->actor); + Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; } else { // [Score] Great. - Message_StartTextbox(globalCtx, 0x3351, &this->actor); + Message_StartTextbox(play, 0x3351, &this->actor); this->textId = 0x3351; } } @@ -925,7 +925,7 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10000; } else if (this->state == MA4_STATE_AFTERDESCRIBETHEMCS) { // "Cremia doesn't believe me..." - Message_StartTextbox(globalCtx, 0x3340, &this->actor); + Message_StartTextbox(play, 0x3340, &this->actor); this->textId = 0x3340; this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -935,31 +935,31 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { if ((gSaveContext.save.weekEventReg[21] & 0x80)) { EnMa4_SetFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x3337, &this->actor); + Message_StartTextbox(play, 0x3337, &this->actor); this->textId = 0x3337; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } else { - Message_StartTextbox(globalCtx, 0x3335, &this->actor); + Message_StartTextbox(play, 0x3335, &this->actor); this->textId = 0x3335; gSaveContext.save.weekEventReg[21] |= 0x80; } } else if (this->state == MA4_STATE_DEFAULT) { - Message_StartTextbox(globalCtx, 0x3354, &this->actor); + Message_StartTextbox(play, 0x3354, &this->actor); this->textId = 0x3354; } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { // "Try again?" - Message_StartTextbox(globalCtx, 0x3356, &this->actor); + Message_StartTextbox(play, 0x3356, &this->actor); this->textId = 0x3356; } else { time = gSaveContext.unk_3DE0[4]; if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { gSaveContext.save.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3350, &this->actor); + Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; } else { - Message_StartTextbox(globalCtx, 0x3351, &this->actor); + Message_StartTextbox(play, 0x3351, &this->actor); this->textId = 0x3351; } } @@ -971,23 +971,23 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { case MA4_TYPE_ALIENS_WON: if (this->state == MA4_STATE_DEFAULT) { // "Huh... You?" - Message_StartTextbox(globalCtx, 0x3358, &this->actor); + Message_StartTextbox(play, 0x3358, &this->actor); this->textId = 0x3358; } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { // "Try again?" - Message_StartTextbox(globalCtx, 0x3356, &this->actor); + Message_StartTextbox(play, 0x3356, &this->actor); this->textId = 0x3356; } else { time = gSaveContext.unk_3DE0[4]; if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { // New record gSaveContext.save.horseBackBalloonHighScore = time; - Message_StartTextbox(globalCtx, 0x335D, &this->actor); + Message_StartTextbox(play, 0x335D, &this->actor); this->textId = 0x335D; } else { // "Old record was: [record]" - Message_StartTextbox(globalCtx, 0x335E, &this->actor); + Message_StartTextbox(play, 0x335E, &this->actor); this->textId = 0x335E; } } @@ -998,7 +998,7 @@ void EnMa4_StartDialogue(EnMa4* this, GlobalContext* globalCtx) { default: // Dead code - Message_StartTextbox(globalCtx, 0x3335, &this->actor); + Message_StartTextbox(play, 0x3335, &this->actor); this->textId = 0x3335; break; } @@ -1017,19 +1017,19 @@ void EnMa4_InitFaceExpression(EnMa4* this) { } } -void EnMa4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMa4_Update(Actor* thisx, PlayState* play) { EnMa4* this = THIS; 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); EnMa4_UpdateEyes(this); - this->actionFunc(this, globalCtx); - func_80ABDD9C(this, globalCtx); + this->actionFunc(this, play); + func_80ABDD9C(this, play); } -s32 EnMa4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnMa4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMa4* this = THIS; Vec3s sp4; @@ -1047,7 +1047,7 @@ s32 EnMa4_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnMa4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMa4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMa4* this = THIS; Vec3f sp28 = { 800.0f, 0.0f, 0.0f }; @@ -1055,29 +1055,29 @@ void EnMa4_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Matrix_MultVec3f(&sp28, &this->actor.focus.pos); } else if (limbIndex == MA1_LIMB_HAND_LEFT) { if (this->hasBow == true) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnMa4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMa4_Draw(Actor* thisx, PlayState* play) { EnMa4* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->type == MA4_TYPE_ALIENS_WON) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_000A20); } - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[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, EnMa4_OverrideLimbDraw, EnMa4_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h index b1e25569b9..41936445b4 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h @@ -6,7 +6,7 @@ struct EnMa4; -typedef void (*EnMa4ActionFunc)(struct EnMa4*, GlobalContext*); +typedef void (*EnMa4ActionFunc)(struct EnMa4*, PlayState*); typedef struct EnMa4 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 52c6a29981..bf36301334 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -11,54 +11,54 @@ #define THIS ((EnMaYto*)thisx) -void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMaYto_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMaYto_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMaYto_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMaYto_Init(Actor* thisx, PlayState* play); +void EnMaYto_Destroy(Actor* thisx, PlayState* play); +void EnMaYto_Update(Actor* thisx, PlayState* play); +void EnMaYto_Draw(Actor* thisx, PlayState* play); -s32 EnMaYto_CheckValidSpawn(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_InitAnimation(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_ChooseAction(EnMaYto* this, GlobalContext* globalCtx); -s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx); +s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play); +void EnMaYto_InitAnimation(EnMaYto* this, PlayState* play); +void EnMaYto_ChooseAction(EnMaYto* this, PlayState* play); +s32 EnMaYto_TryFindRomani(EnMaYto* this, PlayState* play); void EnMaYto_SetupKeepLookingForRomani(EnMaYto* this); -void EnMaYto_KeepLookingForRomani(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_KeepLookingForRomani(EnMaYto* this, PlayState* play); void EnMaYto_SetupDefaultWait(EnMaYto* this); -void EnMaYto_DefaultWait(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_DefaultWait(EnMaYto* this, PlayState* play); void EnMaYto_SetupDefaultDialogueHandler(EnMaYto* this); -void EnMaYto_DefaultDialogueHandler(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DefaultHandlePlayerChoice(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_DefaultDialogueHandler(EnMaYto* this, PlayState* play); +void EnMaYto_DefaultHandlePlayerChoice(EnMaYto* this, PlayState* play); +void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, PlayState* play); void EnMaYto_SetupDinnerWait(EnMaYto* this); -void EnMaYto_DinnerWait(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play); void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this); -void EnMaYto_DinnerDialogueHandler(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DinnerHandlePlayerChoice(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_DinnerDialogueHandler(EnMaYto* this, PlayState* play); +void EnMaYto_DinnerHandlePlayerChoice(EnMaYto* this, PlayState* play); +void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, PlayState* play); void EnMaYto_SetupBarnWait(EnMaYto* this); -void EnMaYto_BarnWait(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_BarnWait(EnMaYto* this, PlayState* play); void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this); -void EnMaYto_BarnDialogueHandler(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_BarnDialogueHandler(EnMaYto* this, PlayState* play); +void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, PlayState* play); void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this); -void EnMaYto_AfterMilkRunInit(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_AfterMilkRunInit(EnMaYto* this, PlayState* play); void EnMaYto_SetupAfterMilkRunDialogueHandler(EnMaYto* this); -void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, PlayState* play); +void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, PlayState* play); void EnMaYto_SetupPostMilkRunGiveReward(EnMaYto* this); -void EnMaYto_PostMilkRunGiveReward(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_PostMilkRunGiveReward(EnMaYto* this, PlayState* play); void EnMaYto_SetupPostMilkRunExplainReward(EnMaYto* this); -void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play); void EnMaYto_SetupBeginWarmFuzzyFeelingCs(EnMaYto* this); -void EnMaYto_BeginWarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_BeginWarmFuzzyFeelingCs(EnMaYto* this, PlayState* play); void EnMaYto_SetupWarmFuzzyFeelingCs(EnMaYto* this); -void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play); void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this); -void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play); void EnMaYto_SetupPostMilkRunEnd(EnMaYto* this); -void EnMaYto_PostMilkRunEnd(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DefaultStartDialogue(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx); -void EnMaYto_BarnStartDialogue(EnMaYto* this, GlobalContext* globalCtx); +void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play); +void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play); +void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play); +void EnMaYto_BarnStartDialogue(EnMaYto* this, PlayState* play); void EnMaYto_ChangeAnim(EnMaYto* this, s32 index); void EnMaYto_UpdateEyes(EnMaYto* this); void func_80B90E50(EnMaYto* this, s16); @@ -132,7 +132,7 @@ static TexturePtr sEyesTextures[] = { object_ma2_Tex_0132D8, object_ma2_Tex_013AD8, object_ma2_Tex_0142D8, }; -void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYto_Init(Actor* thisx, PlayState* play) { EnMaYto* this = THIS; s32 pad; @@ -151,29 +151,29 @@ void EnMaYto_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk31E = 0; this->blinkTimer = 100; this->type = EN_MA_YTO_PARSE_TYPE(this->actor.params); - if (!EnMaYto_CheckValidSpawn(this, globalCtx)) { + if (!EnMaYto_CheckValidSpawn(this, play)) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma2_Skel_015C28, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma2_Skel_015C28, NULL, this->jointTable, this->morphTable, MA2_LIMB_MAX); - EnMaYto_InitAnimation(this, globalCtx); + EnMaYto_InitAnimation(this, play); - 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, DamageTable_Get(0x16), &sColChkInfoInit2); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (EnMaYto_TryFindRomani(this, globalCtx) == 1) { + if (EnMaYto_TryFindRomani(this, play) == 1) { EnMaYto_SetupKeepLookingForRomani(this); } else { - EnMaYto_ChooseAction(this, globalCtx); + EnMaYto_ChooseAction(this, play); } } -s32 EnMaYto_CheckValidSpawn(EnMaYto* this, GlobalContext* globalCtx) { +s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: if (CURRENT_DAY == 3 && !(gSaveContext.save.weekEventReg[22] & 1)) { @@ -215,7 +215,7 @@ s32 EnMaYto_CheckValidSpawn(EnMaYto* this, GlobalContext* globalCtx) { return true; } -void EnMaYto_InitAnimation(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_InitAnimation(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: EnMaYto_ChangeAnim(this, 10); @@ -252,7 +252,7 @@ void EnMaYto_InitAnimation(EnMaYto* this, GlobalContext* globalCtx) { } } -void EnMaYto_ChooseAction(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_ChooseAction(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: EnMaYto_SetupDefaultWait(this); @@ -288,8 +288,8 @@ void EnMaYto_ChooseAction(EnMaYto* this, GlobalContext* globalCtx) { } } -s32 EnMaYto_SearchRomani(EnMaYto* this, GlobalContext* globalCtx) { - Actor* npcActor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +s32 EnMaYto_SearchRomani(EnMaYto* this, PlayState* play) { + Actor* npcActor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npcActor != NULL) { if (npcActor->id == ACTOR_EN_MA_YTS) { @@ -318,7 +318,7 @@ s32 EnMaYto_SearchRomani(EnMaYto* this, GlobalContext* globalCtx) { * - 1: Romani was not found. * - 0: There's no need to find Romani. */ -s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { +s32 EnMaYto_TryFindRomani(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: return 0; @@ -327,7 +327,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { if (!(gSaveContext.save.weekEventReg[22] & 1) && CURRENT_DAY == 2) { return 0; } - if (EnMaYto_SearchRomani(this, globalCtx)) { + if (EnMaYto_SearchRomani(this, play)) { return 2; } return 1; @@ -335,7 +335,7 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { case MA_YTO_TYPE_BARN: // if (AliensDefeated) if (gSaveContext.save.weekEventReg[22] & 1) { - if (EnMaYto_SearchRomani(this, globalCtx)) { + if (EnMaYto_SearchRomani(this, play)) { return 2; } return 1; @@ -352,19 +352,19 @@ s32 EnMaYto_TryFindRomani(EnMaYto* this, GlobalContext* globalCtx) { return 0; } -void EnMaYto_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYto_Destroy(Actor* thisx, PlayState* play) { EnMaYto* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnMaYto_SetupKeepLookingForRomani(EnMaYto* this) { this->actionFunc = EnMaYto_KeepLookingForRomani; } -void EnMaYto_KeepLookingForRomani(EnMaYto* this, GlobalContext* globalCtx) { - if (EnMaYto_TryFindRomani(this, globalCtx) == 2) { - EnMaYto_ChooseAction(this, globalCtx); +void EnMaYto_KeepLookingForRomani(EnMaYto* this, PlayState* play) { + if (EnMaYto_TryFindRomani(this, play) == 2) { + EnMaYto_ChooseAction(this, play); } } @@ -382,7 +382,7 @@ void EnMaYto_SetupDefaultWait(EnMaYto* this) { this->actionFunc = EnMaYto_DefaultWait; } -void EnMaYto_DefaultWait(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_DefaultWait(EnMaYto* this, PlayState* play) { s16 rotY = this->actor.home.rot.y - 0x8000; s16 direction; @@ -393,11 +393,11 @@ void EnMaYto_DefaultWait(EnMaYto* this, GlobalContext* globalCtx) { EnMaYto_ChangeAnim(this, 11); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnMaYto_DefaultStartDialogue(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnMaYto_DefaultStartDialogue(this, play); EnMaYto_SetupDefaultDialogueHandler(this); } else if (ABS_ALT(direction) < 0x1555) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -407,18 +407,18 @@ void EnMaYto_SetupDefaultDialogueHandler(EnMaYto* this) { this->actionFunc = EnMaYto_DefaultDialogueHandler; } -void EnMaYto_DefaultDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMaYto_DefaultDialogueHandler(EnMaYto* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 4: - EnMaYto_DefaultHandlePlayerChoice(this, globalCtx); + EnMaYto_DefaultHandlePlayerChoice(this, play); break; case 5: - EnMaYto_DefaultChooseNextDialogue(this, globalCtx); + EnMaYto_DefaultChooseNextDialogue(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk31E = 0; EnMaYto_SetupDefaultWait(this); } @@ -438,50 +438,50 @@ void EnMaYto_DefaultDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { } } -void EnMaYto_DefaultHandlePlayerChoice(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { // Yes +void EnMaYto_DefaultHandlePlayerChoice(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { // Yes func_8019F208(); EnMaYto_SetFaceExpression(this, 0, 3); // "Milk Road is fixed!" - Message_StartTextbox(globalCtx, 0x3392, &this->actor); + Message_StartTextbox(play, 0x3392, &this->actor); this->textId = 0x3392; } else { // No func_8019F230(); // "Don't lie!" - Message_StartTextbox(globalCtx, 0x3391, &this->actor); + Message_StartTextbox(play, 0x3391, &this->actor); this->textId = 0x3391; } } } -void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x3391: EnMaYto_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3392, &this->actor); + Message_StartTextbox(play, 0x3392, &this->actor); this->textId = 0x3392; break; case 0x3392: EnMaYto_SetFaceExpression(this, 3, 1); - Message_StartTextbox(globalCtx, 0x3393, &this->actor); + Message_StartTextbox(play, 0x3393, &this->actor); this->textId = 0x3393; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); break; case 0x3394: EnMaYto_ChangeAnim(this, 2); - Message_StartTextbox(globalCtx, 0x3395, &this->actor); + Message_StartTextbox(play, 0x3395, &this->actor); this->textId = 0x3395; break; case 0x3395: EnMaYto_ChangeAnim(this, 1); - Message_StartTextbox(globalCtx, 0x3396, &this->actor); + Message_StartTextbox(play, 0x3396, &this->actor); this->textId = 0x3396; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); break; } } @@ -500,28 +500,28 @@ void EnMaYto_SetupDinnerWait(EnMaYto* this) { this->actionFunc = EnMaYto_DinnerWait; } -void EnMaYto_DinnerWait(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { s16 direction = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnMaYto_DinnerStartDialogue(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnMaYto_DinnerStartDialogue(this, play); EnMaYto_SetupDinnerDialogueHandler(this); } else { Actor* child = this->actor.child; - if (child != NULL && Actor_ProcessTalkRequest(child, &globalCtx->state)) { - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); - EnMaYto_DinnerStartDialogue(this, globalCtx); + if (child != NULL && Actor_ProcessTalkRequest(child, &play->state)) { + Actor_ChangeFocus(&this->actor, play, &this->actor); + EnMaYto_DinnerStartDialogue(this, play); EnMaYto_SetupDinnerDialogueHandler(this); } else if (ABS_ALT(direction) < 0x4000) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); child = this->actor.child; if (child != NULL && CURRENT_DAY != 2) { s16 childDirection = child->shape.rot.y - child->yawTowardsPlayer; if (ABS_ALT(childDirection) < 0x4000) { - func_800B8614(child, globalCtx, 120.0f); + func_800B8614(child, play, 120.0f); } } } @@ -539,18 +539,18 @@ void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this) { this->actionFunc = EnMaYto_DinnerDialogueHandler; } -void EnMaYto_DinnerDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMaYto_DinnerDialogueHandler(EnMaYto* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 4: - EnMaYto_DinnerHandlePlayerChoice(this, globalCtx); + EnMaYto_DinnerHandlePlayerChoice(this, play); break; case 5: - EnMaYto_DinnerChooseNextDialogue(this, globalCtx); + EnMaYto_DinnerChooseNextDialogue(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnMaYto_SetupDinnerWait(this); } break; @@ -563,117 +563,117 @@ void EnMaYto_DinnerDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { } } -void EnMaYto_DinnerHandlePlayerChoice(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { // Yes +void EnMaYto_DinnerHandlePlayerChoice(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { // Yes func_8019F208(); EnMaYto_SetFaceExpression(this, 0, 3); // "Milk Road is fixed!" - Message_StartTextbox(globalCtx, 0x3399, &this->actor); + Message_StartTextbox(play, 0x3399, &this->actor); this->textId = 0x3399; } else { // No func_8019F230(); // "Don't lie!" - Message_StartTextbox(globalCtx, 0x3398, &this->actor); + Message_StartTextbox(play, 0x3398, &this->actor); this->textId = 0x3398; } } } -void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x3398: EnMaYto_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x3399, &this->actor); + Message_StartTextbox(play, 0x3399, &this->actor); this->textId = 0x3399; break; case 0x3399: EnMaYto_SetFaceExpression(this, 3, 1); - Message_StartTextbox(globalCtx, 0x339A, &this->actor); + Message_StartTextbox(play, 0x339A, &this->actor); this->textId = 0x339A; break; case 0x339A: this->unk31E = 1; EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x339B, &this->actor); + Message_StartTextbox(play, 0x339B, &this->actor); this->textId = 0x339B; break; case 0x339B: - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); func_80B90E50(this, 0); EnMaYto_SetRomaniFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x339C, &this->actor); + Message_StartTextbox(play, 0x339C, &this->actor); this->textId = 0x339C; break; case 0x339C: this->unk31E = 1; - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_SetFaceExpression(this, 0, 2); - Message_StartTextbox(globalCtx, 0x339D, &this->actor); + Message_StartTextbox(play, 0x339D, &this->actor); this->textId = 0x339D; break; case 0x339D: func_80B90E50(this, 1); - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); EnMaYto_SetRomaniFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x339E, &this->actor); + Message_StartTextbox(play, 0x339E, &this->actor); this->textId = 0x339E; - func_80151BB4(globalCtx, 6); - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 6); + func_80151BB4(play, 5); break; case 0x339F: this->unk31E = 0; - Message_StartTextbox(globalCtx, 0x33A0, &this->actor); + Message_StartTextbox(play, 0x33A0, &this->actor); this->textId = 0x33A0; break; case 0x33A0: - Message_StartTextbox(globalCtx, 0x33A1, &this->actor); + Message_StartTextbox(play, 0x33A1, &this->actor); this->textId = 0x33A1; break; case 0x33A1: func_80B90E50(this, 1); - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); EnMaYto_SetRomaniFaceExpression(this, 0, 2); - Message_StartTextbox(globalCtx, 0x33A2, &this->actor); + Message_StartTextbox(play, 0x33A2, &this->actor); this->textId = 0x33A2; break; case 0x33A2: this->unk31E = 1; - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_SetFaceExpression(this, 4, 3); - Message_StartTextbox(globalCtx, 0x33A3, &this->actor); + Message_StartTextbox(play, 0x33A3, &this->actor); this->textId = 0x33A3; break; case 0x33A3: this->unk31E = 0; EnMaYto_SetFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x33A4, &this->actor); + Message_StartTextbox(play, 0x33A4, &this->actor); this->textId = 0x33A4; - func_80151BB4(globalCtx, 6); - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 6); + func_80151BB4(play, 5); break; case 0x33A5: - Message_StartTextbox(globalCtx, 0x33A6, &this->actor); + Message_StartTextbox(play, 0x33A6, &this->actor); this->textId = 0x33A6; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); break; case 0x33A7: - Message_StartTextbox(globalCtx, 0x33A8, &this->actor); + Message_StartTextbox(play, 0x33A8, &this->actor); this->textId = 0x33A8; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); break; } } @@ -694,26 +694,26 @@ void EnMaYto_SetupBarnWait(EnMaYto* this) { this->actionFunc = EnMaYto_BarnWait; } -void EnMaYto_BarnWait(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { s16 direction = this->actor.shape.rot.y + 0x471C; direction -= this->actor.yawTowardsPlayer; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnMaYto_BarnStartDialogue(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnMaYto_BarnStartDialogue(this, play); EnMaYto_SetupBarnDialogueHandler(this); } else { Actor* child = this->actor.child; - if (child != NULL && Actor_ProcessTalkRequest(child, &globalCtx->state)) { - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); - EnMaYto_BarnStartDialogue(this, globalCtx); + if (child != NULL && Actor_ProcessTalkRequest(child, &play->state)) { + Actor_ChangeFocus(&this->actor, play, &this->actor); + EnMaYto_BarnStartDialogue(this, play); EnMaYto_SetupBarnDialogueHandler(this); } else if (!(gSaveContext.save.weekEventReg[22] & 1) || ABS_ALT(direction) < 0x2000) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); child = this->actor.child; if (child != NULL) { - func_800B8614(child, globalCtx, 100.0f); + func_800B8614(child, play, 100.0f); } } } @@ -729,14 +729,14 @@ void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this) { this->actionFunc = EnMaYto_BarnDialogueHandler; } -void EnMaYto_BarnDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMaYto_BarnDialogueHandler(EnMaYto* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 5: - EnMaYto_BarnChooseNextDialogue(this, globalCtx); + EnMaYto_BarnChooseNextDialogue(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->unk31E = 0; EnMaYto_SetupBarnWait(this); } @@ -751,114 +751,114 @@ void EnMaYto_BarnDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { } } -void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMaYto_BarnChooseNextDialogue(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x33A9: func_80B90E50(this, 0); - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); EnMaYto_SetRomaniFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x33AA, &this->actor); + Message_StartTextbox(play, 0x33AA, &this->actor); this->textId = 0x33AA; break; case 0x33AA: - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); this->unk31E = 1; - Message_StartTextbox(globalCtx, 0x33AB, &this->actor); + Message_StartTextbox(play, 0x33AB, &this->actor); this->textId = 0x33AB; break; case 0x33AB: func_80B90E50(this, 1); - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); EnMaYto_SetRomaniFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33AC, &this->actor); + Message_StartTextbox(play, 0x33AC, &this->actor); this->textId = 0x33AC; break; case 0x33AC: this->unk31E = 0; - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); - Message_StartTextbox(globalCtx, 0x33AD, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); + Message_StartTextbox(play, 0x33AD, &this->actor); this->textId = 0x33AD; - func_80151BB4(globalCtx, 6); - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 6); + func_80151BB4(play, 5); break; case 0x33AE: func_80B90E50(this, 1); - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); EnMaYto_SetRomaniFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x33AF, &this->actor); + Message_StartTextbox(play, 0x33AF, &this->actor); this->textId = 0x33AF; break; case 0x33AF: this->unk31E = 1; - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x33B0, &this->actor); + Message_StartTextbox(play, 0x33B0, &this->actor); this->textId = 0x33B0; - func_80151BB4(globalCtx, 6); - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 6); + func_80151BB4(play, 5); break; case 0x33B1: this->unk31E = 2; EnMaYto_SetFaceExpression(this, 5, 3); // "I should had believed what Romani said" - Message_StartTextbox(globalCtx, 0x33B2, &this->actor); + Message_StartTextbox(play, 0x33B2, &this->actor); this->textId = 0x33B2; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); break; case 0x33C6: - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); this->unk31E = 0; EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33C7, &this->actor); + Message_StartTextbox(play, 0x33C7, &this->actor); this->textId = 0x33C7; break; case 0x33C7: - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); this->unk31E = 1; EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33C8, &this->actor); + Message_StartTextbox(play, 0x33C8, &this->actor); this->textId = 0x33C8; break; case 0x33C8: - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); func_80B90E50(this, 1); EnMaYto_SetRomaniFaceExpression(this, 0, 2); - Message_StartTextbox(globalCtx, 0x33C9, &this->actor); + Message_StartTextbox(play, 0x33C9, &this->actor); this->textId = 0x33C9; break; case 0x33C9: - Actor_ChangeFocus(&this->actor, globalCtx, &this->actor); + Actor_ChangeFocus(&this->actor, play, &this->actor); this->unk31E = 1; EnMaYto_SetFaceExpression(this, 3, 1); - Message_StartTextbox(globalCtx, 0x33CA, &this->actor); + Message_StartTextbox(play, 0x33CA, &this->actor); this->textId = 0x33CA; break; case 0x33CA: this->unk31E = 1; - Message_StartTextbox(globalCtx, 0x33CB, &this->actor); + Message_StartTextbox(play, 0x33CB, &this->actor); this->textId = 0x33CB; break; case 0x33CB: - Actor_ChangeFocus(&this->actor, globalCtx, this->actor.child); + Actor_ChangeFocus(&this->actor, play, this->actor.child); func_80B90E50(this, 1); EnMaYto_SetRomaniFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x33CC, &this->actor); + Message_StartTextbox(play, 0x33CC, &this->actor); this->textId = 0x33CC; - func_80151BB4(globalCtx, 6); - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 6); + func_80151BB4(play, 5); break; default: @@ -877,31 +877,31 @@ void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) { this->actionFunc = EnMaYto_AfterMilkRunInit; } -void EnMaYto_AfterMilkRunInit(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_AfterMilkRunInit(EnMaYto* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) - Message_StartTextbox(globalCtx, 0x33C1, &this->actor); + Message_StartTextbox(play, 0x33C1, &this->actor); this->textId = 0x33C1; } else { // Fails milk minigame EnMaYto_SetFaceExpression(this, 5, 2); - Message_StartTextbox(globalCtx, 0x33C0, &this->actor); + Message_StartTextbox(play, 0x33C0, &this->actor); this->textId = 0x33C0; // Attempted Cremia Cart Ride gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 4; EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); return; } EnMaYto_SetupAfterMilkRunDialogueHandler(this); } else { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } } @@ -909,8 +909,8 @@ void EnMaYto_SetupAfterMilkRunDialogueHandler(EnMaYto* this) { this->actionFunc = EnMaYto_AfterMilkRunDialogueHandler; } -void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -920,27 +920,27 @@ void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, GlobalContext* globalCtx break; case 5: - EnMaYto_AfterMilkRunChooseNextDialogue(this, globalCtx); + EnMaYto_AfterMilkRunChooseNextDialogue(this, play); break; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x71C, 0xB6); } -void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x33C1: EnMaYto_SetFaceExpression(this, 3, 1); // "Thank you. You were cool back there." - Message_StartTextbox(globalCtx, 0x33C2, &this->actor); + Message_StartTextbox(play, 0x33C2, &this->actor); this->textId = 0x33C2; break; case 0x33C2: - func_801477B4(globalCtx); + func_801477B4(play); EnMaYto_SetupPostMilkRunGiveReward(this); - EnMaYto_PostMilkRunGiveReward(this, globalCtx); + EnMaYto_PostMilkRunGiveReward(this, play); break; } } @@ -950,14 +950,14 @@ void EnMaYto_SetupPostMilkRunGiveReward(EnMaYto* this) { this->actionFunc = EnMaYto_PostMilkRunGiveReward; } -void EnMaYto_PostMilkRunGiveReward(EnMaYto* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnMaYto_PostMilkRunGiveReward(EnMaYto* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { EnMaYto_SetupPostMilkRunExplainReward(this); } else if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_HUGE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); this->unk310 = 2; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_ROMANI, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MASK_ROMANI, 500.0f, 100.0f); this->unk310 = 1; } } @@ -966,33 +966,33 @@ void EnMaYto_SetupPostMilkRunExplainReward(EnMaYto* this) { this->actionFunc = EnMaYto_PostMilkRunExplainReward; } -void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->unk310 == 1) { // Romani's mask explanation EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33C3, &this->actor); + Message_StartTextbox(play, 0x33C3, &this->actor); this->textId = 0x33C3; // Attempted Cremia Cart Ride gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 3; - func_80151BB4(globalCtx, 0x20); - func_80151BB4(globalCtx, 0x1F); - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 0x20); + func_80151BB4(play, 0x1F); + func_80151BB4(play, 6); EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); } else { // You already have the mask EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33D0, &this->actor); + Message_StartTextbox(play, 0x33D0, &this->actor); this->textId = 0x33D0; // Attempted Cremia Cart Ride gSaveContext.save.weekEventReg[14] |= 1; this->unk310 = 3; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); } } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } @@ -1000,7 +1000,7 @@ void EnMaYto_SetupBeginWarmFuzzyFeelingCs(EnMaYto* this) { this->actionFunc = EnMaYto_BeginWarmFuzzyFeelingCs; } -void EnMaYto_BeginWarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_BeginWarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); EnMaYto_SetupWarmFuzzyFeelingCs(this); @@ -1019,12 +1019,12 @@ void EnMaYto_SetupWarmFuzzyFeelingCs(EnMaYto* this) { static u16 D_80B915F0 = 99; -void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 556)) { - s32 csActionIndex = Cutscene_GetActorActionIndex(globalCtx, 556); +void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 556)) { + s32 csActionIndex = Cutscene_GetActorActionIndex(play, 556); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[csActionIndex]->startFrame) { - u16 action = globalCtx->csCtx.actorActions[csActionIndex]->action; + if (play->csCtx.frames == play->csCtx.actorActions[csActionIndex]->startFrame) { + u16 action = play->csCtx.actorActions[csActionIndex]->action; if (1) {} @@ -1048,7 +1048,7 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, csActionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); if (D_80B915F0 == 2 && this->skelAnime.animation == &object_ma2_Anim_001FD0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 20); @@ -1062,15 +1062,15 @@ void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this) { this->actionFunc = EnMaYto_PostMilkRunWaitDialogueEnd; } -void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 || Message_GetState(&globalCtx->msgCtx) == 5) { - if (Message_ShouldAdvance(globalCtx) && Message_GetState(&globalCtx->msgCtx) == 5) { - func_800B7298(globalCtx, &this->actor, 7); - func_801477B4(globalCtx); +void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 || Message_GetState(&play->msgCtx) == 5) { + if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == 5) { + func_800B7298(play, &this->actor, 7); + func_801477B4(play); } } - if (Message_GetState(&globalCtx->msgCtx) == 0 && globalCtx->msgCtx.unk120B1 == 0) { + if (Message_GetState(&play->msgCtx) == 0 && play->msgCtx.unk120B1 == 0) { EnMaYto_SetupPostMilkRunEnd(this); } } @@ -1079,115 +1079,115 @@ void EnMaYto_SetupPostMilkRunEnd(EnMaYto* this) { this->actionFunc = EnMaYto_PostMilkRunEnd; } -void EnMaYto_PostMilkRunEnd(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) { if (this->unk310 == 3) { // Termina Field - globalCtx->nextEntranceIndex = 0x54D0; + play->nextEntranceIndex = 0x54D0; } else { // Romani Ranch - globalCtx->nextEntranceIndex = 0x6480; + play->nextEntranceIndex = 0x6480; } gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x50; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x50; gSaveContext.nextTransition = 3; } -void EnMaYto_DefaultStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { if (CURRENT_DAY == 1) { - if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - switch (Player_GetMask(globalCtx)) { + if (Player_GetMask(play) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: - Message_StartTextbox(globalCtx, 0x235D, &this->actor); + Message_StartTextbox(play, 0x235D, &this->actor); this->textId = 0x235D; break; case PLAYER_MASK_CIRCUS_LEADER: EnMaYto_SetFaceExpression(this, 1, 3); - Message_StartTextbox(globalCtx, 0x235E, &this->actor); + Message_StartTextbox(play, 0x235E, &this->actor); this->textId = 0x235E; break; case PLAYER_MASK_KAFEIS_MASK: EnMaYto_SetFaceExpression(this, 1, 2); - Message_StartTextbox(globalCtx, 0x235F, &this->actor); + Message_StartTextbox(play, 0x235F, &this->actor); this->textId = 0x235F; break; case PLAYER_MASK_COUPLE: - Message_StartTextbox(globalCtx, 0x2360, &this->actor); + Message_StartTextbox(play, 0x2360, &this->actor); this->textId = 0x2360; break; default: - Message_StartTextbox(globalCtx, 0x2361, &this->actor); + Message_StartTextbox(play, 0x2361, &this->actor); this->textId = 0x2361; break; } } else { if (EnMaYto_HasSpokenToPlayer()) { - Message_StartTextbox(globalCtx, 0x3394, &this->actor); + Message_StartTextbox(play, 0x3394, &this->actor); this->textId = 0x3394; } else { EnMaYto_SetTalkedFlag(); // Asks the player if he came from town. - Message_StartTextbox(globalCtx, 0x3390, &this->actor); + Message_StartTextbox(play, 0x3390, &this->actor); this->textId = 0x3390; } } } else if (CURRENT_DAY == 3) { if (EnMaYto_HasSpokenToPlayerToday()) { EnMaYto_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x33C5, &this->actor); + Message_StartTextbox(play, 0x33C5, &this->actor); this->textId = 0x33C5; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); } else { EnMaYto_SetTalkedFlag(); EnMaYto_SetFaceExpression(this, 0, 3); - Message_StartTextbox(globalCtx, 0x33C4, &this->actor); + Message_StartTextbox(play, 0x33C4, &this->actor); this->textId = 0x33C4; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); } } } -void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play) { switch (CURRENT_DAY) { case 1: - if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - switch (Player_GetMask(globalCtx)) { + if (Player_GetMask(play) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: - Message_StartTextbox(globalCtx, 0x235D, &this->actor); + Message_StartTextbox(play, 0x235D, &this->actor); this->textId = 0x235D; break; case PLAYER_MASK_CIRCUS_LEADER: - Message_StartTextbox(globalCtx, 0x235E, &this->actor); + Message_StartTextbox(play, 0x235E, &this->actor); this->textId = 0x235E; break; case PLAYER_MASK_KAFEIS_MASK: - Message_StartTextbox(globalCtx, 0x235F, &this->actor); + Message_StartTextbox(play, 0x235F, &this->actor); this->textId = 0x235F; break; case PLAYER_MASK_COUPLE: - Message_StartTextbox(globalCtx, 0x2360, &this->actor); + Message_StartTextbox(play, 0x2360, &this->actor); this->textId = 0x2360; break; default: - Message_StartTextbox(globalCtx, 0x2361, &this->actor); + Message_StartTextbox(play, 0x2361, &this->actor); this->textId = 0x2361; break; } } else { if (EnMaYto_HasSpokenToPlayer()) { - Message_StartTextbox(globalCtx, 0x339F, &this->actor); + Message_StartTextbox(play, 0x339F, &this->actor); this->textId = 0x339F; } else { EnMaYto_SetTalkedFlag(); - Message_StartTextbox(globalCtx, 0x3397, &this->actor); + Message_StartTextbox(play, 0x3397, &this->actor); this->textId = 0x3397; } } @@ -1195,52 +1195,52 @@ void EnMaYto_DinnerStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { case 2: if (EnMaYto_HasSpokenToPlayer()) { - Message_StartTextbox(globalCtx, 0x33A6, &this->actor); + Message_StartTextbox(play, 0x33A6, &this->actor); this->textId = 0x33A6; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); } else { EnMaYto_SetTalkedFlag(); - Message_StartTextbox(globalCtx, 0x33A5, &this->actor); + Message_StartTextbox(play, 0x33A5, &this->actor); this->textId = 0x33A5; } break; case 3: if (EnMaYto_HasSpokenToPlayer()) { - Message_StartTextbox(globalCtx, 0x33A8, &this->actor); + Message_StartTextbox(play, 0x33A8, &this->actor); this->textId = 0x33A8; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); } else { EnMaYto_SetTalkedFlag(); - Message_StartTextbox(globalCtx, 0x33A7, &this->actor); + Message_StartTextbox(play, 0x33A7, &this->actor); this->textId = 0x33A7; } break; } } -void EnMaYto_BarnStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_BarnStartDialogue(EnMaYto* this, PlayState* play) { // if (AliensDefeated) if (gSaveContext.save.weekEventReg[22] & 1) { if (CURRENT_DAY == 2) { if (this->unk310 == 1) { - Message_StartTextbox(globalCtx, 0x33AE, &this->actor); + Message_StartTextbox(play, 0x33AE, &this->actor); this->textId = 0x33AE; } else { this->unk310 = 1; EnMaYto_SetTalkedFlag(); - Message_StartTextbox(globalCtx, 0x33A9, &this->actor); + Message_StartTextbox(play, 0x33A9, &this->actor); this->textId = 0x33A9; } } else if (CURRENT_DAY == 3) { if (this->unk310 == 1) { - Message_StartTextbox(globalCtx, 0x33CB, &this->actor); + Message_StartTextbox(play, 0x33CB, &this->actor); this->textId = 0x33CB; } else { this->unk310 = 1; EnMaYto_SetTalkedFlag(); EnMaYto_SetFaceExpression(this, 0, 1); - Message_StartTextbox(globalCtx, 0x33C6, &this->actor); + Message_StartTextbox(play, 0x33C6, &this->actor); this->textId = 0x33C6; } } @@ -1248,13 +1248,13 @@ void EnMaYto_BarnStartDialogue(EnMaYto* this, GlobalContext* globalCtx) { if (EnMaYto_HasSpokenToPlayer()) { this->unk31E = 2; EnMaYto_SetFaceExpression(this, 5, 3); - Message_StartTextbox(globalCtx, 0x33B3, &this->actor); + Message_StartTextbox(play, 0x33B3, &this->actor); this->textId = 0x33B3; - func_80151BB4(globalCtx, 6); + func_80151BB4(play, 6); } else { EnMaYto_SetTalkedFlag(); EnMaYto_SetFaceExpression(this, 5, 3); - Message_StartTextbox(globalCtx, 0x33B1, &this->actor); + Message_StartTextbox(play, 0x33B1, &this->actor); this->textId = 0x33B1; } } @@ -1266,8 +1266,8 @@ void EnMaYto_ChangeAnim(EnMaYto* this, s32 index) { sAnimationInfo[index].morphFrames); } -void func_80B90C78(EnMaYto* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B90C78(EnMaYto* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 flag; SkelAnime_Update(&this->skelAnime); @@ -1296,10 +1296,10 @@ void func_80B90C78(EnMaYto* this, GlobalContext* globalCtx) { EnMaYto_UpdateEyes(this); } -void EnMaYto_UpdateCollision(EnMaYto* this, GlobalContext* globalCtx) { +void EnMaYto_UpdateCollision(EnMaYto* this, PlayState* play) { if (this->actionFunc != EnMaYto_WarmFuzzyFeelingCs) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1413,16 +1413,15 @@ void EnMaYto_SetTalkedFlag(void) { } } -void EnMaYto_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYto_Update(Actor* thisx, PlayState* play) { EnMaYto* this = THIS; - this->actionFunc(this, globalCtx); - EnMaYto_UpdateCollision(this, globalCtx); - func_80B90C78(this, globalCtx); + this->actionFunc(this, play); + EnMaYto_UpdateCollision(this, play); + func_80B90C78(this, play); } -s32 EnMaYto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnMaYto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMaYto* this = THIS; Vec3s sp4; @@ -1447,7 +1446,7 @@ s32 EnMaYto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return 0; } -void EnMaYto_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMaYto_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMaYto* this = THIS; if (limbIndex == MA2_LIMB_HEAD) { @@ -1455,22 +1454,22 @@ void EnMaYto_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnMaYto_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYto_Draw(Actor* thisx, PlayState* play) { EnMaYto* this = THIS; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->type == MA_YTO_TYPE_BARN && (gSaveContext.save.weekEventReg[22] & 1)) { // Aliens defeated - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBox); } - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sMouthTextures[this->mouthTexIndex])); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyesTextures[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, EnMaYto_OverrideLimbDraw, EnMaYto_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h index 0feaea48a9..25eb2bed54 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h @@ -6,7 +6,7 @@ struct EnMaYto; -typedef void (*EnMaYtoActionFunc)(struct EnMaYto*, GlobalContext*); +typedef void (*EnMaYtoActionFunc)(struct EnMaYto*, PlayState*); typedef enum { /* 00 */ MA2_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index f5bf0625b3..bac7fc53bb 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -11,24 +11,24 @@ #define THIS ((EnMaYts*)thisx) -void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMaYts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMaYts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMaYts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMaYts_Init(Actor* thisx, PlayState* play); +void EnMaYts_Destroy(Actor* thisx, PlayState* play); +void EnMaYts_Update(Actor* thisx, PlayState* play); +void EnMaYts_Draw(Actor* thisx, PlayState* play); void EnMaYts_SetupDoNothing(EnMaYts* this); -void EnMaYts_DoNothing(EnMaYts* this, GlobalContext* globalCtx); +void EnMaYts_DoNothing(EnMaYts* this, PlayState* play); void EnMaYts_SetupStartDialogue(EnMaYts* this); -void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx); +void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play); void EnMaYts_SetupDialogueHandler(EnMaYts* this); -void EnMaYts_DialogueHandler(EnMaYts* this, GlobalContext* globalCtx); +void EnMaYts_DialogueHandler(EnMaYts* this, PlayState* play); void EnMaYts_SetupEndCreditsHandler(EnMaYts* this); -void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx); -void EnMaYts_ChooseNextDialogue(EnMaYts* this, GlobalContext* globalCtx); +void EnMaYts_EndCreditsHandler(EnMaYts* this, PlayState* play); +void EnMaYts_ChooseNextDialogue(EnMaYts* this, PlayState* play); void EnMaYts_SetFaceExpression(EnMaYts* this, s16 overrideEyeTexIndex, s16 mouthTexIndex); -void EnMaYts_DrawSleeping(Actor* thisx, GlobalContext* globalCtx); +void EnMaYts_DrawSleeping(Actor* thisx, PlayState* play); const ActorInit En_Ma_Yts_InitVars = { ACTOR_EN_MA_YTS, @@ -120,8 +120,8 @@ void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) { sAnimationInfo[index].morphFrames); } -void func_80B8D12C(EnMaYts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B8D12C(EnMaYts* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 flag = this->unk_32C == 2 ? true : false; if (this->unk_32C == 0 || this->actor.parent == NULL) { @@ -135,7 +135,7 @@ void func_80B8D12C(EnMaYts* this, GlobalContext* globalCtx) { func_800BD888(&this->actor, &this->unk_1D8, 0, flag); } -void EnMaYts_InitAnimation(EnMaYts* this, GlobalContext* globalCtx) { +void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { switch (this->type) { case MA_YTS_TYPE_BARN: this->actor.targetMode = 0; @@ -169,7 +169,7 @@ void EnMaYts_InitAnimation(EnMaYts* this, GlobalContext* globalCtx) { } } -s32 EnMaYts_CheckValidSpawn(EnMaYts* this, GlobalContext* globalCtx) { +s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { switch (this->type) { case MA_YTS_TYPE_SITTING: switch (CURRENT_DAY) { @@ -215,29 +215,29 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, GlobalContext* globalCtx) { return true; } -void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYts_Init(Actor* thisx, PlayState* play) { EnMaYts* this = THIS; s32 pad; this->type = EN_MA_YTS_PARSE_TYPE(thisx); - if (!EnMaYts_CheckValidSpawn(this, globalCtx)) { + if (!EnMaYts_CheckValidSpawn(this, play)) { Actor_MarkForDeath(&this->actor); } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, MA1_LIMB_MAX); - EnMaYts_InitAnimation(this, globalCtx); + EnMaYts_InitAnimation(this, play); - 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, DamageTable_Get(0x16), &sColChkInfoInit2); if (this->type == MA_YTS_TYPE_SLEEPING) { this->collider.dim.radius = 40; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); Actor_SetScale(&this->actor, 0.01f); this->unk_1D8.unk_00 = 0; @@ -275,17 +275,17 @@ void EnMaYts_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMaYts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYts_Destroy(Actor* thisx, PlayState* play) { EnMaYts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnMaYts_SetupDoNothing(EnMaYts* this) { this->actionFunc = EnMaYts_DoNothing; } -void EnMaYts_DoNothing(EnMaYts* this, GlobalContext* globalCtx) { +void EnMaYts_DoNothing(EnMaYts* this, PlayState* play) { } void EnMaYts_SetupStartDialogue(EnMaYts* this) { @@ -293,58 +293,58 @@ void EnMaYts_SetupStartDialogue(EnMaYts* this) { this->actionFunc = EnMaYts_StartDialogue; } -void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx) { +void EnMaYts_StartDialogue(EnMaYts* this, PlayState* play) { s16 sp26 = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (!(gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { if (!(gSaveContext.save.weekEventReg[65] & 0x80)) { // Saying to non-human Link: "Cremia went to town." gSaveContext.save.weekEventReg[65] |= 0x80; EnMaYts_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x335F, &this->actor); + Message_StartTextbox(play, 0x335F, &this->actor); this->textId = 0x335F; } else { // Saying to non-human Link: "Pretend you did not hear that." EnMaYts_SetFaceExpression(this, 4, 3); - Message_StartTextbox(globalCtx, 0x3362, &this->actor); + Message_StartTextbox(play, 0x3362, &this->actor); this->textId = 0x3362; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE) { + } else if (Player_GetMask(play) != PLAYER_MASK_NONE) { if (!(gSaveContext.save.weekEventReg[65] & 0x40)) { gSaveContext.save.weekEventReg[65] |= 0x40; EnMaYts_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x3363, &this->actor); + Message_StartTextbox(play, 0x3363, &this->actor); this->textId = 0x3363; } else { EnMaYts_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x3366, &this->actor); + Message_StartTextbox(play, 0x3366, &this->actor); this->textId = 0x3366; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } } else if (!(gSaveContext.save.weekEventReg[21] & 0x20)) { EnMaYts_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x3367, &this->actor); + Message_StartTextbox(play, 0x3367, &this->actor); this->textId = 0x3367; } else { if (!(gSaveContext.save.weekEventReg[65] & 0x20)) { // Saying to Grasshopper: "Cremia went to town." gSaveContext.save.weekEventReg[65] |= 0x20; EnMaYts_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x3369, &this->actor); + Message_StartTextbox(play, 0x3369, &this->actor); this->textId = 0x3369; } else { // Saying to Grasshopper: "You're our bodyguard." EnMaYts_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x336C, &this->actor); + Message_StartTextbox(play, 0x336C, &this->actor); this->textId = 0x336C; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); } } EnMaYts_SetupDialogueHandler(this); } else if (ABS_ALT(sp26) < 0x4000) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } @@ -352,14 +352,14 @@ void EnMaYts_SetupDialogueHandler(EnMaYts* this) { this->actionFunc = EnMaYts_DialogueHandler; } -void EnMaYts_DialogueHandler(EnMaYts* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMaYts_DialogueHandler(EnMaYts* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 5: // End message block - EnMaYts_ChooseNextDialogue(this, globalCtx); + EnMaYts_ChooseNextDialogue(this, play); break; case 6: // End conversation - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnMaYts_SetupStartDialogue(this); } break; @@ -380,15 +380,15 @@ void EnMaYts_SetupEndCreditsHandler(EnMaYts* this) { } static u16 D_80B8E32C = 99; -void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 120)) { - s32 actionIndex = Cutscene_GetActorActionIndex(globalCtx, 120); +void EnMaYts_EndCreditsHandler(EnMaYts* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 120)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 120); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - if (globalCtx->csCtx.actorActions[actionIndex]->action != D_80B8E32C) { - D_80B8E32C = globalCtx->csCtx.actorActions[actionIndex]->action; + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + if (play->csCtx.actorActions[actionIndex]->action != D_80B8E32C) { + D_80B8E32C = play->csCtx.actorActions[actionIndex]->action; this->endCreditsFlag = 0; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->hasBow = true; EnMaYts_ChangeAnim(this, 0); @@ -412,7 +412,7 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); if ((D_80B8E32C == 2) && (this->endCreditsFlag == 0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->endCreditsFlag++; @@ -425,53 +425,53 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx) { } // Select the following dialogue based on the current one, and an appropiate face expression -void EnMaYts_ChooseNextDialogue(EnMaYts* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnMaYts_ChooseNextDialogue(EnMaYts* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x335F: EnMaYts_SetFaceExpression(this, 0, 2); - Message_StartTextbox(globalCtx, 0x3360, &this->actor); + Message_StartTextbox(play, 0x3360, &this->actor); this->textId = 0x3360; break; case 0x3360: EnMaYts_SetFaceExpression(this, 4, 3); - Message_StartTextbox(globalCtx, 0x3361, &this->actor); + Message_StartTextbox(play, 0x3361, &this->actor); this->textId = 0x3361; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); break; case 0x3363: EnMaYts_SetFaceExpression(this, 1, 1); - Message_StartTextbox(globalCtx, 0x3364, &this->actor); + Message_StartTextbox(play, 0x3364, &this->actor); this->textId = 0x3364; break; case 0x3364: EnMaYts_SetFaceExpression(this, 4, 2); - Message_StartTextbox(globalCtx, 0x3365, &this->actor); + Message_StartTextbox(play, 0x3365, &this->actor); this->textId = 0x3365; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); break; case 0x3367: EnMaYts_SetFaceExpression(this, 4, 3); - Message_StartTextbox(globalCtx, 0x3368, &this->actor); + Message_StartTextbox(play, 0x3368, &this->actor); this->textId = 0x3368; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); break; case 0x3369: EnMaYts_SetFaceExpression(this, 0, 0); - Message_StartTextbox(globalCtx, 0x336A, &this->actor); + Message_StartTextbox(play, 0x336A, &this->actor); this->textId = 0x336A; break; case 0x336A: EnMaYts_SetFaceExpression(this, 3, 3); - Message_StartTextbox(globalCtx, 0x336B, &this->actor); + Message_StartTextbox(play, 0x336B, &this->actor); this->textId = 0x336B; - func_80151BB4(globalCtx, 5); + func_80151BB4(play, 5); break; default: @@ -488,21 +488,20 @@ void EnMaYts_SetFaceExpression(EnMaYts* this, s16 overrideEyeTexIndex, s16 mouth } } -void EnMaYts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYts_Update(Actor* thisx, PlayState* play) { EnMaYts* this = THIS; ColliderCylinder* collider; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); SkelAnime_Update(&this->skelAnime); EnMaYts_UpdateEyes(this); - func_80B8D12C(this, globalCtx); + func_80B8D12C(this, play); } -s32 EnMaYts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnMaYts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMaYts* this = THIS; Vec3s sp4; @@ -522,42 +521,42 @@ s32 EnMaYts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnMaYts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMaYts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMaYts* this = THIS; if (limbIndex == MA1_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); } else if (limbIndex == MA1_LIMB_HAND_LEFT) { if (this->hasBow == true) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void EnMaYts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMaYts_Draw(Actor* thisx, PlayState* play) { EnMaYts* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex])); 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, EnMaYts_OverrideLimbDraw, EnMaYts_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } // Alternative draw function -void EnMaYts_DrawSleeping(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void EnMaYts_DrawSleeping(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0043A0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h index 2fcc205092..a16a5e5d8a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h @@ -5,7 +5,7 @@ struct EnMaYts; -typedef void (*EnMaYtsActionFunc)(struct EnMaYts*, GlobalContext*); +typedef void (*EnMaYtsActionFunc)(struct EnMaYts*, PlayState*); typedef enum { /* 00 */ MA1_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 ae10224136..3d0b11f7be 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -11,10 +11,10 @@ #define THIS ((EnMag*)thisx) -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); /** * Steps `var` towards `target` linearly, so that it will arrive in `timeRemaining` seconds. Can be used from either @@ -97,7 +97,7 @@ const ActorInit En_Mag_InitVars = { (ActorFunc)EnMag_Draw, }; -void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Init(Actor* thisx, PlayState* play) { EnMag* this = THIS; u16 i; @@ -184,7 +184,7 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { sZeldaEffectColorTargetIndex = 0; } -void EnMag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Destroy(Actor* thisx, PlayState* play) { } void EnMag_UpdateDisplayEffectColors(Actor* thisx) { @@ -225,7 +225,7 @@ void EnMag_UpdateDisplayEffectColors(Actor* thisx) { * Controls the actions performed using a switch and the `state` struct variable rather than action functions. Most of * these are to do with fading various parts in and out. */ -void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMag_Update(Actor* thisx, PlayState* play) { static s16 sAppearEffectPrimGreenTargets[] = { 255, 155 }; static s16 sAppearEffectEnvRedTargets[] = { 255, 0 }; static s16 sAppearEffectEnvBlueTargets[] = { 0, 155 }; @@ -235,11 +235,11 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.fileNum != 0xFEDC) { if (this->state == MAG_STATE_INITIAL) { - if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { - if (!EnvFlags_Get(globalCtx, 4)) { + if (!EnvFlags_Get(play, 4)) { play_sound(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; this->unk11F00 = 0; @@ -378,10 +378,10 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { EnMag_UpdateDisplayEffectColors(&this->actor); if (sInputDelayTimer == 0) { - if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { - if (globalCtx->sceneLoadFlag != 0x14) { + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { + if (play->sceneLoadFlag != 0x14) { Audio_SetCutsceneFlag(false); D_801BB12C++; if (D_801BB12C >= 2) { @@ -389,9 +389,9 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { } play_sound(NA_SE_SY_PIECE_OF_HEART); gSaveContext.gameMode = 2; // Go to FileChoose - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; - globalCtx->nextEntranceIndex = 0x1C00; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 2; + play->nextEntranceIndex = 0x1C00; gSaveContext.save.cutscene = 0; gSaveContext.sceneSetupIndex = 0; } @@ -427,9 +427,9 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { // Appear fully immediately if called during fade-in states. if ((this->state > MAG_STATE_INITIAL) && (this->state < MAG_STATE_CALLED)) { - if (CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_START) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B)) { + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_START) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { play_sound(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; } @@ -438,12 +438,12 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->state == MAG_STATE_INITIAL) { - if (EnvFlags_Get(globalCtx, 3)) { + if (EnvFlags_Get(play, 3)) { this->unk11F02 = 40; this->state = MAG_STATE_FADE_IN_MASK_EFFECTS; } } else if (this->state < MAG_STATE_FADE_OUT) { - if (EnvFlags_Get(globalCtx, 4)) { + if (EnvFlags_Get(play, 4)) { this->state = MAG_STATE_FADE_OUT; } } @@ -675,7 +675,7 @@ void EnMag_DrawCharTexture(Gfx** gfxp, TexturePtr texture, s32 rectLeft, s32 rec * Loads title, PRESS START text, etc. graphics to gfxp, which is made to live on * POLY_OPA_DISP, but is used by OVERLAY_DISP. */ -void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { +void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { static u8 pressStartFontIndices[] = { 0x19, 0x1B, 0x0E, 0x1C, 0x1C, 0x1C, 0x1D, 0x0A, 0x1B, 0x1D, }; // Indices into this->font.fontBuf @@ -707,7 +707,7 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { s16 step; // Set segment 6 to the object, since this will be read by OVERLAY_DISP where it is not set by default. - gSPSegment(gfx++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment); func_8012C680(&gfx); @@ -953,22 +953,22 @@ void EnMag_DrawInner(Actor* thisx, GlobalContext* globalCtx, Gfx** gfxp) { * Jumps drawing to POLY_OPA_DISP to take advantage of the extra space available, but jmups back and actually draws * using OVERLAY_DISP. */ -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); + OPEN_DISPS(play->state.gfxCtx); 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); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c index cc56a5e5e3..c6d6780e43 100644 --- a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c +++ b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c @@ -12,29 +12,29 @@ #define THIS ((EnMaruta*)thisx) -void EnMaruta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMaruta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMaruta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMaruta_Init(Actor* thisx, PlayState* play); +void EnMaruta_Destroy(Actor* thisx, PlayState* play); +void EnMaruta_Update(Actor* thisx, PlayState* play); +void EnMaruta_Draw(Actor* thisx, PlayState* play); void func_80B372B8(EnMaruta* this); -void func_80B372CC(EnMaruta* this, GlobalContext* globalCtx); +void func_80B372CC(EnMaruta* this, PlayState* play); void func_80B37364(EnMaruta* this); -void func_80B3738C(EnMaruta* this, GlobalContext* globalCtx); +void func_80B3738C(EnMaruta* this, PlayState* play); void func_80B373F4(EnMaruta* this); -void func_80B37428(EnMaruta* this, GlobalContext* globalCtx); -void func_80B374FC(EnMaruta* this, GlobalContext* globalCtx); -void func_80B37590(EnMaruta* this, GlobalContext* globalCtx); -void func_80B37950(EnMaruta* this, GlobalContext* globalCtx); -void func_80B379C0(EnMaruta* this, GlobalContext* globalCtx); +void func_80B37428(EnMaruta* this, PlayState* play); +void func_80B374FC(EnMaruta* this, PlayState* play); +void func_80B37590(EnMaruta* this, PlayState* play); +void func_80B37950(EnMaruta* this, PlayState* play); +void func_80B379C0(EnMaruta* this, PlayState* play); void func_80B37A14(EnMaruta* this); -void func_80B37A64(EnMaruta* this, GlobalContext* globalCtx); -void func_80B37AA0(EnMaruta* this, GlobalContext* globalCtx); +void func_80B37A64(EnMaruta* this, PlayState* play); +void func_80B37AA0(EnMaruta* this, PlayState* play); void func_80B37C04(s16* arg0); -void func_80B37EC0(EnMaruta* this, GlobalContext* globalCtx); +void func_80B37EC0(EnMaruta* this, PlayState* play); void func_80B38060(EnMaruta* this, Vec3f* arg1); void func_80B3828C(Vec3f* arg0, Vec3f* arg1, s16 arg2, s16 arg3, s32 arg4); -void func_80B382E4(GlobalContext* globalCtx, Vec3f arg1); +void func_80B382E4(PlayState* play, Vec3f arg1); const ActorInit En_Maruta_InitVars = { ACTOR_EN_MARUTA, @@ -174,7 +174,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_HEAVY }; Vec3f D_80B38B54 = { 0.0f, 0.0f, 0.0f }; -void EnMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMaruta_Init(Actor* thisx, PlayState* play) { s32 pad; EnMaruta* this = THIS; s32 i; @@ -208,8 +208,8 @@ void EnMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_220 = 0; if (this->unk_210 == 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, &sDamageTable, &sColChkInfoInit); } @@ -220,15 +220,15 @@ void EnMaruta_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B37364(this); } } else { - func_80B37590(this, globalCtx); + func_80B37590(this, play); } } -void EnMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMaruta_Destroy(Actor* thisx, PlayState* play) { EnMaruta* this = THIS; if (this->unk_210 == 0) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -236,7 +236,7 @@ void func_80B372B8(EnMaruta* this) { this->actionFunc = func_80B372CC; } -void func_80B372CC(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B372CC(EnMaruta* this, PlayState* play) { s16 temp_v1 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); if (temp_v1 > 0x1555) { @@ -261,7 +261,7 @@ void func_80B37364(EnMaruta* this) { this->actionFunc = func_80B3738C; } -void func_80B3738C(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B3738C(EnMaruta* this, PlayState* play) { if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.4f, 100.0f, 10.0f) == 0.0f) { func_80B372B8(this); } @@ -274,7 +274,7 @@ void func_80B373F4(EnMaruta* this) { this->actionFunc = func_80B37428; } -void func_80B37428(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B37428(EnMaruta* this, PlayState* play) { if ((this->actor.floorHeight - 630.0f) < this->actor.world.pos.y) { this->actor.velocity.y += this->actor.gravity; this->actor.world.pos.y += this->actor.velocity.y; @@ -297,7 +297,7 @@ void func_80B374B8(EnMaruta* this) { } } -void func_80B374FC(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B374FC(EnMaruta* this, PlayState* play) { if (this->unk_21E == 40) { Actor_MarkForDeath(&this->actor); return; @@ -311,8 +311,8 @@ void func_80B374FC(EnMaruta* this, GlobalContext* globalCtx) { this->unk_21E++; } -void func_80B37590(EnMaruta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B37590(EnMaruta* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp48; s16 sp46; Vec3f sp38; @@ -393,10 +393,10 @@ void func_80B37590(EnMaruta* this, GlobalContext* globalCtx) { this->actionFunc = func_80B37950; } -void func_80B37950(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B37950(EnMaruta* this, PlayState* play) { this->unk_218 += this->unk_21A; this->actor.velocity.y += this->actor.gravity; - func_80B37EC0(this, globalCtx); + func_80B37EC0(this, play); Actor_UpdatePos(&this->actor); } @@ -408,7 +408,7 @@ void func_80B37998(EnMaruta* this) { this->actionFunc = func_80B379C0; } -void func_80B379C0(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B379C0(EnMaruta* this, PlayState* play) { if (this->unk_21E == 40) { func_80B37A14(this); } else { @@ -428,7 +428,7 @@ void func_80B37A14(EnMaruta* this) { this->actionFunc = func_80B37A64; } -void func_80B37A64(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B37A64(EnMaruta* this, PlayState* play) { if (this->unk_21E > 100) { this->actor.colChkInfo.health = 0; } else { @@ -440,7 +440,7 @@ void func_80B37A8C(EnMaruta* this) { this->actionFunc = func_80B37AA0; } -void func_80B37AA0(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B37AA0(EnMaruta* this, PlayState* play) { if (this->actor.scale.y == 0.0f) { if (this->actor.scale.x == 0.0f) { Actor_MarkForDeath(&this->actor); @@ -453,8 +453,8 @@ void func_80B37AA0(EnMaruta* this, GlobalContext* globalCtx) { } } -s32 func_80B37B78(EnMaruta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B37B78(EnMaruta* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v1 = BINANG_SUB(this->actor.yawTowardsPlayer, 0x8000); temp_v1 = BINANG_SUB(temp_v1, player->actor.shape.rot.y); @@ -482,8 +482,8 @@ void func_80B37C60(EnMaruta* this) { } } -void func_80B37CA0(EnMaruta* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B37CA0(EnMaruta* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actionFunc == func_80B372CC) || (this->actionFunc == func_80B3738C) || (this->actionFunc == func_80B374FC) || (this->actionFunc == func_80B37AA0) || @@ -497,12 +497,12 @@ void func_80B37CA0(EnMaruta* this, GlobalContext* globalCtx) { temp = (temp << 8) & 0xFF00; this->unk_210 = D_80B386CC[player->swordAnimation]; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_MARUTA, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - this->actor.shape.rot.y, 0, temp); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MARUTA, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, + temp); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->unk_210 == 5) || ((this->unk_210 == 7) && (player->swordAnimation == 0xC))) { - func_80B37590(this, globalCtx); + func_80B37590(this, play); } else { func_80B374B8(this); } @@ -518,15 +518,15 @@ void func_80B37CA0(EnMaruta* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (func_80B37B78(this, globalCtx) && (this->actionFunc == func_80B372CC)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + if (func_80B37B78(this, play) && (this->actionFunc == func_80B372CC)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void func_80B37EC0(EnMaruta* this, GlobalContext* globalCtx) { +void func_80B37EC0(EnMaruta* this, PlayState* play) { Vec3f sp34 = this->unk_204; s32 phi_a2 = -1; s32 i; @@ -550,7 +550,7 @@ void func_80B37EC0(EnMaruta* this, GlobalContext* globalCtx) { this->actor.world.pos.y += temp; if (this->actor.velocity.y < -this->actor.gravity) { - func_80B382E4(globalCtx, sp34); + func_80B382E4(play, sp34); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LOG_BOUND); this->actor.velocity.y *= -0.6f; func_80B38060(this, &sp34); @@ -627,7 +627,7 @@ void func_80B3828C(Vec3f* arg0, Vec3f* arg1, s16 arg2, s16 arg3, s32 arg4) { Matrix_Pop(); } -void func_80B382E4(GlobalContext* globalCtx, Vec3f arg1) { +void func_80B382E4(PlayState* play, Vec3f arg1) { Vec3f sp84 = arg1; Vec3f sp78; Vec3f sp6C; @@ -644,30 +644,30 @@ void func_80B382E4(GlobalContext* globalCtx, Vec3f arg1) { sp78.z = Rand_Centered() * 10.0f; sp6C.x = -0.2f * sp78.x; sp6C.z = -0.2f * sp78.z; - func_800B0EB0(globalCtx, &sp84, &sp78, &sp6C, &sp68, &sp64, 60, 20, 10); + func_800B0EB0(play, &sp84, &sp78, &sp6C, &sp68, &sp64, 60, 20, 10); } } -void EnMaruta_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMaruta_Update(Actor* thisx, PlayState* play) { EnMaruta* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80B37CA0(this, globalCtx); + func_80B37CA0(this, play); func_80B37C60(this); } -void EnMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMaruta_Draw(Actor* thisx, PlayState* play) { EnMaruta* this = THIS; Vec3f sp50; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_210 == 0) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_maruta_DL_002EC0); } else { sp50 = D_80B387E4[this->unk_210]; @@ -677,7 +677,7 @@ void EnMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateAxisS(this->unk_218, &this->unk_194, MTXMODE_APPLY); Matrix_Translate(-sp50.x, -sp50.y, -sp50.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0; i < 8; i++) { if (D_80B386C0[this->unk_210] & (1 << i)) { @@ -695,5 +695,5 @@ void EnMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h index 162618fc6a..2dce575b53 100644 --- a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h +++ b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.h @@ -5,7 +5,7 @@ struct EnMaruta; -typedef void (*EnMarutaActionFunc)(struct EnMaruta*, GlobalContext*); +typedef void (*EnMarutaActionFunc)(struct EnMaruta*, PlayState*); #define ENMARUTA_GET_FF(thisx) ((thisx)->params & 0xFF) #define ENMARUTA_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c index d5e15c04d1..7cc22b4f33 100644 --- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c +++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.c @@ -10,23 +10,23 @@ #define THIS ((EnMinideath*)thisx) -void EnMinideath_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMinideath_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMinideath_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMinideath_Init(Actor* thisx, PlayState* play); +void EnMinideath_Destroy(Actor* thisx, PlayState* play); +void EnMinideath_Update(Actor* thisx, PlayState* play); -void func_808CA860(EnMinideath* this, GlobalContext* globalCtx); -void func_808CA8F4(EnMinideath* this, GlobalContext* globalCtx); -void func_808CAAEC(EnMinideath* this, GlobalContext* globalCtx); -void func_808CABB0(EnMinideath* this, GlobalContext* globalCtx); -void func_808CACD8(EnMinideath* this, GlobalContext* globalCtx); -void func_808CAE18(EnMinideath* this, GlobalContext* globalCtx); -void func_808CAF68(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB094(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB22C(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB454(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB59C(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB6D4(EnMinideath* this, GlobalContext* globalCtx); -void func_808CB7CC(EnMinideath* this, GlobalContext* globalCtx); +void func_808CA860(EnMinideath* this, PlayState* play); +void func_808CA8F4(EnMinideath* this, PlayState* play); +void func_808CAAEC(EnMinideath* this, PlayState* play); +void func_808CABB0(EnMinideath* this, PlayState* play); +void func_808CACD8(EnMinideath* this, PlayState* play); +void func_808CAE18(EnMinideath* this, PlayState* play); +void func_808CAF68(EnMinideath* this, PlayState* play); +void func_808CB094(EnMinideath* this, PlayState* play); +void func_808CB22C(EnMinideath* this, PlayState* play); +void func_808CB454(EnMinideath* this, PlayState* play); +void func_808CB59C(EnMinideath* this, PlayState* play); +void func_808CB6D4(EnMinideath* this, PlayState* play); +void func_808CB7CC(EnMinideath* this, PlayState* play); #if 0 const ActorInit En_Minideath_InitVars = { diff --git a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h index 7ac4dee6cc..754b36d304 100644 --- a/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h +++ b/src/overlays/actors/ovl_En_Minideath/z_en_minideath.h @@ -5,7 +5,7 @@ struct EnMinideath; -typedef void (*EnMinideathActionFunc)(struct EnMinideath*, GlobalContext*); +typedef void (*EnMinideathActionFunc)(struct EnMinideath*, PlayState*); typedef struct EnMinideath { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index d8b4296cb9..2ab7f6233f 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -12,19 +12,19 @@ #define THIS ((EnMinifrog*)thisx) -void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMinifrog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMinifrog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMinifrog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMinifrog_Init(Actor* thisx, PlayState* play); +void EnMinifrog_Destroy(Actor* thisx, PlayState* play); +void EnMinifrog_Update(Actor* thisx, PlayState* play); +void EnMinifrog_Draw(Actor* thisx, PlayState* play); -EnMinifrog* EnMinifrog_GetFrog(GlobalContext* globalCtx); +EnMinifrog* EnMinifrog_GetFrog(PlayState* play); -void EnMinifrog_SpawnGrowAndShrink(EnMinifrog* this, GlobalContext* globalCtx); -void EnMinifrog_Idle(EnMinifrog* this, GlobalContext* globalCtx); -void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, GlobalContext* globalCtx); -void EnMinifrog_UpdateMissingFrog(Actor* thisx, GlobalContext* globalCtx); -void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx); -void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx); +void EnMinifrog_SpawnGrowAndShrink(EnMinifrog* this, PlayState* play); +void EnMinifrog_Idle(EnMinifrog* this, PlayState* play); +void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, PlayState* play); +void EnMinifrog_UpdateMissingFrog(Actor* thisx, PlayState* play); +void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play); +void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, PlayState* play); const ActorInit En_Minifrog_InitVars = { ACTOR_EN_MINIFROG, @@ -82,16 +82,16 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -800, ICHAIN_STOP), }; -void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMinifrog_Init(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; int i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_fr_Skel_00B538, &object_fr_Anim_001534, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, &object_fr_Anim_001534, this->jointTable, this->morphTable, 24); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); if (!isInitialized) { for (i = 0; i < 2; i++) { @@ -136,7 +136,7 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.x = this->actor.home.rot.z = 0; this->frog = NULL; } else { - this->frog = EnMinifrog_GetFrog(globalCtx); + this->frog = EnMinifrog_GetFrog(play); this->actor.flags &= ~ACTOR_FLAG_1; // Frog has been returned @@ -151,17 +151,17 @@ void EnMinifrog_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMinifrog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMinifrog_Destroy(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->flags & 0x100) { func_801A1F88(); } } -EnMinifrog* EnMinifrog_GetFrog(GlobalContext* globalCtx) { - EnMinifrog* frog = (EnMinifrog*)globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +EnMinifrog* EnMinifrog_GetFrog(PlayState* play) { + EnMinifrog* frog = (EnMinifrog*)play->actorCtx.actorLists[ACTORCAT_NPC].first; while (frog != NULL) { if ((frog->actor.id != ACTOR_EN_MINIFROG) || (frog->actor.params & 0xF)) { @@ -224,14 +224,14 @@ void EnMinifrog_TurnToMissingFrog(EnMinifrog* this) { static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; -void EnMinifrog_SpawnDust(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SpawnDust(EnMinifrog* this, PlayState* play) { Vec3f pos; Vec3f vec5; Vec3f vel; Vec3f accel; s16 yaw; s16 pitch; - Vec3f eye = GET_ACTIVE_CAM(globalCtx)->eye; + Vec3f eye = GET_ACTIVE_CAM(play)->eye; s32 i; yaw = Math_Vec3f_Yaw(&eye, &this->actor.world.pos); @@ -250,31 +250,31 @@ void EnMinifrog_SpawnDust(EnMinifrog* this, GlobalContext* globalCtx) { pos.x = vec5.x + vel.x; pos.y = vec5.y + vel.y; pos.z = vec5.z + vel.z; - func_800B0F80(globalCtx, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); + func_800B0F80(play, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); } } -void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { EnMinifrog_SetJumpState(this); - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0xD81: // "Ah! Don Gero! It has been so long." case 0xD83: // "Could it be... Has spring finally come to the mountains?" case 0xD84: // "That look...It is true! Winter was so long that I began to lose all hope." case 0xD86: // "Could it be... You came all this way looking for me?" case 0xD87: // "Ah! You need not say a thing. Upon seeing that face, I understand!" ... - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0xD82: // "What has brought you all this way?" if (gSaveContext.save.weekEventReg[33] & 0x80) { // Mountain village is unfrozen - func_80151938(globalCtx, 0xD83); // "Could it be... Has spring finally come to the mountains?" + func_80151938(play, 0xD83); // "Could it be... Has spring finally come to the mountains?" } else { - func_80151938(globalCtx, 0xD86); // "Could it be... You came all this way looking for me?" + func_80151938(play, 0xD86); // "Could it be... You came all this way looking for me?" } gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->frogIndex] >> 8] = @@ -284,9 +284,9 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { case 0xD85: // "I understand. I shall head for the mountains immediately." default: - func_801477B4(globalCtx); - EnMinifrog_SpawnDust(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); + func_801477B4(play); + EnMinifrog_SpawnDust(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); if (this->actor.cutscene != -1) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); @@ -312,7 +312,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { } // This can be seen when the Cyan and Pink frogs spawn after their respective minibosses -void EnMinifrog_SpawnGrowAndShrink(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SpawnGrowAndShrink(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); if (this->timer > 0) { Actor_SetScale(&this->actor, (0.01f + 0.0003f * this->timer * Math_SinS(0x1000 * (this->timer & 7)))); @@ -323,22 +323,22 @@ void EnMinifrog_SpawnGrowAndShrink(EnMinifrog* this, GlobalContext* globalCtx) { } } -void EnMinifrog_Idle(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_Idle(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); EnMinifrog_JumpTimer(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMinifrog_ReturnFrogCutscene; if (this->actor.cutscene != -1) { this->flags |= 1; } - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && - (Player_GetMask(globalCtx) == PLAYER_MASK_DON_GERO)) { - func_800B8614(&this->actor, globalCtx, 110.0f); + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && + (Player_GetMask(play) == PLAYER_MASK_DON_GERO)) { + func_800B8614(&this->actor, play, 110.0f); } } -void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, PlayState* play) { EnMinifrog* nextFrog; EnMinifrog* missingFrog; @@ -361,12 +361,12 @@ void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, GlobalContext* globalCtx) { } } -void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, PlayState* play) { this->actionFunc = EnMinifrog_YellowFrogDialog; if (this->frog != NULL) { - func_80151938(globalCtx, 0xD78); // "Unfortunately, it seems not all of our members have gathered." + func_80151938(play, 0xD78); // "Unfortunately, it seems not all of our members have gathered." } else { - func_80151938(globalCtx, + func_80151938(play, 0xD7C); // "The conducting was spectacular. And all of our members rose to the occasion!" } @@ -375,14 +375,14 @@ void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, GlobalContext* globalCtx) { this->actor.home.rot.z = 0; } -void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); if (ActorCutscene_GetCurrentIndex() == 0x7C) { - EnMinifrog_CheckChoirSuccess(this, globalCtx); + EnMinifrog_CheckChoirSuccess(this, play); return; // necessary to match } else if (ActorCutscene_GetCanPlayNext(0x7C)) { ActorCutscene_Start(0x7C, NULL); - EnMinifrog_CheckChoirSuccess(this, globalCtx); + EnMinifrog_CheckChoirSuccess(this, play); return; // necessary to match } else if (this->actor.cutscene != -1 && ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); @@ -393,7 +393,7 @@ void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx } } -void EnMinifrog_NextFrogMissing(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_NextFrogMissing(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToMissingFrog(this); EnMinifrog_Jump(this); if (this->timer > 0) { @@ -403,7 +403,7 @@ void EnMinifrog_NextFrogMissing(EnMinifrog* this, GlobalContext* globalCtx) { } } -void EnMinifrog_NextFrogReturned(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_NextFrogReturned(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); if (this->timer > 0) { this->timer--; @@ -411,11 +411,11 @@ void EnMinifrog_NextFrogReturned(EnMinifrog* this, GlobalContext* globalCtx) { this->actionFunc = EnMinifrog_ContinueChoirCutscene; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - globalCtx->setPlayerTalkAnim(globalCtx, &gameplay_keep_Linkanim_00DEA8, 0); + play->setPlayerTalkAnim(play, &gameplay_keep_Linkanim_00DEA8, 0); } } -void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { u8 frogIndex; EnMinifrog_Jump(this); @@ -442,14 +442,14 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, GlobalContext* globalCtx) { this->flags &= ~0x100; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - globalCtx->setPlayerTalkAnim(globalCtx, &gameplay_keep_Linkanim_00DEA8, 0); + play->setPlayerTalkAnim(play, &gameplay_keep_Linkanim_00DEA8, 0); } else if (this->timer <= 0) { this->actionFunc = EnMinifrog_NextFrogReturned; this->timer = 30; } } -void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); if (this->actor.cutscene == -1) { this->actionFunc = EnMinifrog_SetupNextFrogChoir; @@ -462,62 +462,62 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx) { this->timer = 5; func_801A1F00(3, NA_BGM_FROG_SONG); this->flags |= 0x100; - globalCtx->setPlayerTalkAnim(globalCtx, &gameplay_keep_Linkanim_00E2A8, 0); + play->setPlayerTalkAnim(play, &gameplay_keep_Linkanim_00E2A8, 0); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void EnMinifrog_EndChoir(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_EndChoir(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0xD7E, &this->actor); // "Let us do it again sometime." + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0xD7E, &this->actor); // "Let us do it again sometime." this->actionFunc = EnMinifrog_YellowFrogDialog; } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); } } -void EnMinifrog_GetFrogHP(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_GetFrogHP(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnMinifrog_EndChoir; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_NONE); } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } } -void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // Yes func_8019F208(); this->actionFunc = EnMinifrog_BeginChoirCutscene; - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; break; case 1: // No func_8019F230(); - func_80151938(globalCtx, 0xD7E); // "Let us do it again sometime." + func_80151938(play, 0xD7E); // "Let us do it again sometime." break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnMinifrog_SetJumpState(this); - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0xD76: // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, but it looks like // you've lost a little weight..." - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); this->actor.flags &= ~ACTOR_FLAG_10000; gSaveContext.save.weekEventReg[34] |= 1; // Spoken to MINIFROG_YELLOW break; @@ -526,29 +526,29 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { // has come to the mountains..." case 0xD7A: // "And when the great Don Gero has come for us, too...What a pity." case 0xD7F: // "Well, if it isn't the great Don Gero." - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0xD77: // "Let us begin our chorus" this->actionFunc = EnMinifrog_BeginChoirCutscene; - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; break; case 0xD7C: // "The conducting was spectacular. And all of our members rose to the occasion!" if (gSaveContext.save.weekEventReg[35] & 0x80) { // Obtained Heart Piece - func_80151938(globalCtx, 0xD7E); + func_80151938(play, 0xD7E); } else { - func_80151938(globalCtx, 0xD7D); // Get Heart Piece + func_80151938(play, 0xD7D); // Get Heart Piece gSaveContext.save.weekEventReg[35] |= 0x80; } break; case 0xD7D: // "This is how deeply we were moved by your spectacular conducting..." - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnMinifrog_GetFrogHP; - EnMinifrog_GetFrogHP(this, globalCtx); + EnMinifrog_GetFrogHP(this, play); break; case 0xD7B: // "Where in the world could the other members be, and what could they be doing?" case 0xD7E: // "Let us do it again sometime." default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnMinifrog_SetupYellowFrogDialog; this->actor.flags &= ~ACTOR_FLAG_10000; break; @@ -557,42 +557,42 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { } } -void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x180); this->actor.world.rot.y = this->actor.shape.rot.y; EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); EnMinifrog_JumpTimer(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMinifrog_YellowFrogDialog; if (!(gSaveContext.save.weekEventReg[34] & 1)) { // Not spoken with MINIFROG_YELLOW - Message_StartTextbox(globalCtx, 0xD76, + Message_StartTextbox(play, 0xD76, &this->actor); // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, // but it looks like you've lost a little weight..." } else { - Message_StartTextbox(globalCtx, 0xD7F, &this->actor); // "Well, if it isn't the great Don Gero." + Message_StartTextbox(play, 0xD7F, &this->actor); // "Well, if it isn't the great Don Gero." } } else if ((this->actor.xzDistToPlayer < 150.0f) && - (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) || + (Player_IsFacingActor(&this->actor, 0x3000, play) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_10000)) && - Player_GetMask(globalCtx) == PLAYER_MASK_DON_GERO) { - func_800B8614(&this->actor, globalCtx, 160.0f); + Player_GetMask(play) == PLAYER_MASK_DON_GERO) { + func_800B8614(&this->actor, play, 160.0f); } } -void EnMinifrog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMinifrog_Update(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 12.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 12.0f, 0.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); this->actor.focus.rot.y = this->actor.shape.rot.y; } -void EnMinifrog_UpdateMissingFrog(Actor* thisx, GlobalContext* globalCtx) { +void EnMinifrog_UpdateMissingFrog(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; EnMinifrog* missingFrog; @@ -602,8 +602,7 @@ void EnMinifrog_UpdateMissingFrog(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnMinifrog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnMinifrog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { if (limbIndex == 1) { pos->z -= 500.0f; } @@ -615,15 +614,15 @@ s32 EnMinifrog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnMinifrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMinifrog* this = THIS; if ((limbIndex == 7) || (limbIndex == 8)) { - OPEN_DISPS(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == 4) { @@ -635,17 +634,17 @@ static Color_RGBA8 sEnMinifrogColor[] = { { 200, 170, 0, 255 }, { 0, 170, 200, 255 }, { 210, 120, 100, 255 }, { 120, 130, 230, 255 }, { 190, 190, 190, 255 }, }; -void EnMinifrog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMinifrog_Draw(Actor* thisx, PlayState* play) { EnMinifrog* this = THIS; Color_RGBA8* envColor; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); envColor = &sEnMinifrogColor[this->frogIndex]; gSPSegment(POLY_OPA_DISP++, 0x08, D_808A4D74[0]); gSPSegment(POLY_OPA_DISP++, 0x09, D_808A4D74[0]); gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, envColor->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, EnMinifrog_OverrideLimbDraw, EnMinifrog_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h index 201ef5c477..8d63d77834 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.h @@ -5,7 +5,7 @@ struct EnMinifrog; -typedef void (*EnMinifrogActionFunc)(struct EnMinifrog*, GlobalContext*); +typedef void (*EnMinifrogActionFunc)(struct EnMinifrog*, PlayState*); #define EN_MINIFROG_IS_RETURNED(this) ((((this)->actor.params)&0xF0) >> 4) diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 2ffb3d0bad..cdf3ad957f 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -11,35 +11,35 @@ #define THIS ((EnMinislime*)thisx) -void EnMinislime_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMinislime_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMinislime_Init(Actor* thisx, PlayState* play); +void EnMinislime_Destroy(Actor* thisx, PlayState* play); +void EnMinislime_Update(Actor* thisx, PlayState* play); void EnMinislime_SetupDisappear(EnMinislime* this); -void EnMinislime_Disappear(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_SetupFall(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_Fall(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_Disappear(EnMinislime* this, PlayState* play); +void EnMinislime_SetupFall(EnMinislime* this, PlayState* play); +void EnMinislime_Fall(EnMinislime* this, PlayState* play); void EnMinislime_SetupBreakFromBigslime(EnMinislime* this); -void EnMinislime_BreakFromBigslime(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_IceArrowDamage(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_FireArrowDamage(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_BreakFromBigslime(EnMinislime* this, PlayState* play); +void EnMinislime_IceArrowDamage(EnMinislime* this, PlayState* play); +void EnMinislime_FireArrowDamage(EnMinislime* this, PlayState* play); void EnMinislime_SetupGrowAndShrink(EnMinislime* this); -void EnMinislime_GrowAndShrink(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play); void EnMinislime_SetupIdle(EnMinislime* this); void EnMinislime_SetupBounce(EnMinislime* this); -void EnMinislime_Idle(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_Bounce(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_Idle(EnMinislime* this, PlayState* play); +void EnMinislime_Bounce(EnMinislime* this, PlayState* play); void EnMinislime_SetupDespawn(EnMinislime* this); -void EnMinislime_Despawn(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_MoveToBigslime(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_Knockback(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_DefeatIdle(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_SetupDefeatMelt(EnMinislime* this, GlobalContext* globalCtx); -void EnMinislime_DefeatMelt(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_Despawn(EnMinislime* this, PlayState* play); +void EnMinislime_MoveToBigslime(EnMinislime* this, PlayState* play); +void EnMinislime_Knockback(EnMinislime* this, PlayState* play); +void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play); +void EnMinislime_SetupDefeatMelt(EnMinislime* this, PlayState* play); +void EnMinislime_DefeatMelt(EnMinislime* this, PlayState* play); void EnMinislime_SetupMoveToGekko(EnMinislime* this); -void EnMinislime_MoveToGekko(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_MoveToGekko(EnMinislime* this, PlayState* play); void EnMinislime_SetupGekkoThrow(EnMinislime* this); -void EnMinislime_GekkoThrow(EnMinislime* this, GlobalContext* globalCtx); +void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play); const ActorInit En_Minislime_InitVars = { ACTOR_EN_MINISLIME, @@ -118,21 +118,21 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, MINISLIME_DMGEFF_BREAK_ICE), }; -void EnMinislime_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMinislime_Init(Actor* thisx, PlayState* play) { EnMinislime* this = THIS; this->actor.flags &= ~ACTOR_FLAG_1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->id = this->actor.params; this->actor.shape.shadowAlpha = 255; EnMinislime_SetupDisappear(this); } -void EnMinislime_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMinislime_Destroy(Actor* thisx, PlayState* play) { EnMinislime* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnMinislime_CheckBackgroundCollision(EnMinislime* this) { @@ -205,7 +205,7 @@ void EnMinislime_AddIceShardEffect(EnMinislime* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); } -void EnMinislime_AddIceSmokeEffect(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_AddIceSmokeEffect(EnMinislime* this, PlayState* play) { Vec3f pos; Vec3f vel; @@ -215,7 +215,7 @@ void EnMinislime_AddIceSmokeEffect(EnMinislime* this, GlobalContext* globalCtx) vel.x = randPlusMinusPoint5Scaled(1.5f); vel.z = randPlusMinusPoint5Scaled(1.5f); vel.y = 2.0f; - EffectSsIceSmoke_Spawn(globalCtx, &pos, &vel, &gZeroVec3f, 500); + EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 500); } void EnMinislime_SetupDisappear(EnMinislime* this) { @@ -223,18 +223,18 @@ void EnMinislime_SetupDisappear(EnMinislime* this) { this->actionFunc = EnMinislime_Disappear; } -void EnMinislime_Disappear(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Disappear(EnMinislime* this, PlayState* play) { if (this->actor.params == MINISLIME_BREAK_BIGSLIME) { EnMinislime_SetupBreakFromBigslime(this); } else if (this->actor.params == MINISLIME_INIT_FALL) { - EnMinislime_SetupFall(this, globalCtx); + EnMinislime_SetupFall(this, play); } else if (this->actor.params == MINISLIME_DESPAWN) { EnMinislime_SetupDespawn(this); } } -void EnMinislime_SetupFall(EnMinislime* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMinislime_SetupFall(EnMinislime* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw; this->collider.base.atFlags |= AT_ON; @@ -255,7 +255,7 @@ void EnMinislime_SetupFall(EnMinislime* this, GlobalContext* globalCtx) { this->actionFunc = EnMinislime_Fall; } -void EnMinislime_Fall(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Fall(EnMinislime* this, PlayState* play) { Math_StepToF(&this->actor.scale.x, 0.17999999f, 0.003f); Math_StepToF(&this->actor.scale.y, 0.05f, 0.003f); this->actor.scale.z = this->actor.scale.x; @@ -285,7 +285,7 @@ void EnMinislime_SetupBreakFromBigslime(EnMinislime* this) { this->actionFunc = EnMinislime_BreakFromBigslime; } -void EnMinislime_BreakFromBigslime(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_BreakFromBigslime(EnMinislime* this, PlayState* play) { this->actor.shape.rot.x += this->actor.world.rot.x; if (this->actor.velocity.y < 0.0f) { this->collider.base.ocFlags1 |= OC1_ON; @@ -305,7 +305,7 @@ void EnMinislime_SetupIceArrowDamage(EnMinislime* this) { this->actionFunc = EnMinislime_IceArrowDamage; } -void EnMinislime_IceArrowDamage(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_IceArrowDamage(EnMinislime* this, PlayState* play) { f32 invFrozenTimer; s32 pad; f32 randFloat; @@ -358,10 +358,10 @@ void EnMinislime_SetupFireArrowDamage(EnMinislime* this) { this->actionFunc = EnMinislime_FireArrowDamage; } -void EnMinislime_FireArrowDamage(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_FireArrowDamage(EnMinislime* this, PlayState* play) { this->meltTimer--; if ((this->meltTimer % 25) == 0) { - EnMinislime_AddIceSmokeEffect(this, globalCtx); + EnMinislime_AddIceSmokeEffect(this, play); } this->frozenScale = this->meltTimer * 0.0025f; @@ -395,7 +395,7 @@ void EnMinislime_SetupGrowAndShrink(EnMinislime* this) { this->actionFunc = EnMinislime_GrowAndShrink; } -void EnMinislime_GrowAndShrink(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play) { f32 scaleFactor; this->growShrinkTimer--; @@ -420,7 +420,7 @@ void EnMinislime_SetupIdle(EnMinislime* this) { this->actionFunc = EnMinislime_Idle; } -void EnMinislime_Idle(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Idle(EnMinislime* this, PlayState* play) { f32 speedXZ; this->idleTimer--; @@ -457,7 +457,7 @@ void EnMinislime_SetupBounce(EnMinislime* this) { this->actionFunc = EnMinislime_Bounce; } -void EnMinislime_Bounce(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Bounce(EnMinislime* this, PlayState* play) { if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) { EnMinislime_SetupMoveToGekko(this); } else { @@ -512,7 +512,7 @@ void EnMinislime_SetupMoveToBigslime(EnMinislime* this) { this->actionFunc = EnMinislime_MoveToBigslime; } -void EnMinislime_MoveToBigslime(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_MoveToBigslime(EnMinislime* this, PlayState* play) { if (this->actor.params == MINISLIME_DISAPPEAR) { EnMinislime_SetupDisappear(this); } else if ((this->actor.scale.x > 0.0f) && (this->actor.world.pos.y > (GBT_ROOM_5_MAX_Y - 100.0f))) { @@ -531,7 +531,7 @@ void EnMinislime_SetupKnockback(EnMinislime* this) { this->actionFunc = EnMinislime_Knockback; } -void EnMinislime_Knockback(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Knockback(EnMinislime* this, PlayState* play) { f32 sqrtFrozenTimer; this->knockbackTimer--; @@ -571,7 +571,7 @@ void EnMinislime_SetupDefeatIdle(EnMinislime* this) { this->actionFunc = EnMinislime_DefeatIdle; } -void EnMinislime_DefeatIdle(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play) { f32 xzScale; this->idleTimer--; @@ -584,23 +584,23 @@ void EnMinislime_DefeatIdle(EnMinislime* this, GlobalContext* globalCtx) { } if (this->actor.params == MINISLIME_DEFEAT_MELT) { - EnMinislime_SetupDefeatMelt(this, globalCtx); + EnMinislime_SetupDefeatMelt(this, play); } } -void EnMinislime_SetupDefeatMelt(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_SetupDefeatMelt(EnMinislime* this, PlayState* play) { this->actor.gravity = 0.0f; this->actor.velocity.y = -50.0f; this->meltTimer = Rand_ZeroFloat(25.0f); - EnMinislime_AddIceSmokeEffect(this, globalCtx); + EnMinislime_AddIceSmokeEffect(this, play); this->actor.params = MINISLIME_DISAPPEAR; this->actionFunc = EnMinislime_DefeatMelt; } -void EnMinislime_DefeatMelt(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_DefeatMelt(EnMinislime* this, PlayState* play) { this->meltTimer++; if (((this->meltTimer % 25) == 0) && (this->actor.shape.shadowAlpha > 25)) { - EnMinislime_AddIceSmokeEffect(this, globalCtx); + EnMinislime_AddIceSmokeEffect(this, play); } func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); @@ -620,7 +620,7 @@ void EnMinislime_SetupDespawn(EnMinislime* this) { this->actionFunc = EnMinislime_Despawn; } -void EnMinislime_Despawn(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_Despawn(EnMinislime* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -637,7 +637,7 @@ void EnMinislime_SetupMoveToGekko(EnMinislime* this) { this->actionFunc = EnMinislime_MoveToGekko; } -void EnMinislime_MoveToGekko(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_MoveToGekko(EnMinislime* this, PlayState* play) { Math_StepToF(&this->actor.world.pos.x, this->actor.parent->world.pos.x, 10.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.parent->world.pos.z, 10.0f); Math_StepToF(&this->actor.world.pos.y, this->actor.parent->world.pos.y + 80.0f, 10.0f); @@ -647,7 +647,7 @@ void EnMinislime_MoveToGekko(EnMinislime* this, GlobalContext* globalCtx) { if (this->actor.params == MINISLIME_GEKKO_THROW) { EnMinislime_SetupGekkoThrow(this); } else if (this->actor.params == MINISLIME_IDLE) { - EnMinislime_SetupFall(this, globalCtx); + EnMinislime_SetupFall(this, play); } } @@ -666,7 +666,7 @@ void EnMinislime_SetupGekkoThrow(EnMinislime* this) { this->actionFunc = EnMinislime_GekkoThrow; } -void EnMinislime_GekkoThrow(EnMinislime* this, GlobalContext* globalCtx) { +void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) { f32 xzScale; this->throwTimer--; @@ -707,7 +707,7 @@ void EnMinislime_ApplyDamage(EnMinislime* this) { } } -void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMinislime_Update(Actor* thisx, PlayState* play) { EnMinislime* this = THIS; Player* player; s32 pad; @@ -716,7 +716,7 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.params == MINISLIME_DEFEAT_IDLE) && (this->actor.bgCheckFlags & 1)) { EnMinislime_SetupDefeatIdle(this); } else if (this->actor.params == MINISLIME_DEFEAT_MELT) { - EnMinislime_SetupDefeatMelt(this, globalCtx); + EnMinislime_SetupDefeatMelt(this, play); } else if ((this->actor.params == MINISLIME_FORM_BIGSLIME) && (this->actionFunc != EnMinislime_MoveToBigslime)) { EnMinislime_SetupMoveToBigslime(this); } else { @@ -732,7 +732,7 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != EnMinislime_Disappear) && (this->actionFunc != EnMinislime_Despawn)) { if (this->actionFunc == EnMinislime_MoveToBigslime) { @@ -748,13 +748,13 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.yShift = ((EnMinislime*)thisx)->actor.scale.y * -400.0f; if ((this->attackTimer == 0) && (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->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->attackTimer != 0) { @@ -762,11 +762,11 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 2) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); vec1.x = this->actor.world.pos.x; vec1.z = this->actor.world.pos.z; vec1.y = player->actor.world.pos.y + player->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &vec1, 500, 720, 0); + EffectSsGRipple_Spawn(play, &vec1, 500, 720, 0); } } } diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.h b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.h index e0b86e832d..28629f464d 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.h +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.h @@ -5,7 +5,7 @@ struct EnMinislime; -typedef void (*EnMinislimeActionFunc)(struct EnMinislime*, GlobalContext*); +typedef void (*EnMinislimeActionFunc)(struct EnMinislime*, PlayState*); #define MINISLIME_NUM_SPAWN 15 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 0071673b4d..89c1be02e9 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -10,18 +10,18 @@ #define THIS ((EnMk*)thisx) -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); -s32 func_80959524(GlobalContext* globalCtx); -void func_809596A0(EnMk* this, GlobalContext* globalCtx); -void func_80959774(EnMk* this, GlobalContext* globalCtx); -void func_80959A24(EnMk* this, GlobalContext* globalCtx); -void func_80959C94(EnMk* this, GlobalContext* globalCtx); -void func_80959D28(EnMk* this, GlobalContext* globalCtx); -void func_80959E18(EnMk* this, GlobalContext* globalCtx); +s32 func_80959524(PlayState* play); +void func_809596A0(EnMk* this, PlayState* play); +void func_80959774(EnMk* this, PlayState* play); +void func_80959A24(EnMk* this, PlayState* play); +void func_80959C94(EnMk* this, PlayState* play); +void func_80959D28(EnMk* this, PlayState* play); +void func_80959E18(EnMk* this, PlayState* play); const ActorInit En_Mk_InitVars = { ACTOR_EN_MK, @@ -74,7 +74,7 @@ s32 func_809592E0(EnMk* this, s16 index) { return true; } -void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Init(Actor* thisx, PlayState* play) { EnMk* this = THIS; s16 cs; s32 i; @@ -82,13 +82,13 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.terminalVelocity = -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_006CA0, &object_mk_Anim_001C38, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_006CA0, &object_mk_Anim_001C38, this->jointTable, this->morphTable, OBJECT_MK_LIMB_MAX); this->unk_27C = -1; func_809592E0(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); @@ -97,7 +97,7 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_27A = 0; this->actor.targetMode = 6; - if (func_80959524(globalCtx) < 7) { + if (func_80959524(play) < 7) { this->unk_27A |= 2; } @@ -113,28 +113,27 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.cutscene = this->unk_276[0]; } -void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Destroy(Actor* thisx, PlayState* play) { EnMk* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80959524(GlobalContext* globalCtx) { - return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; +s32 func_80959524(PlayState* play) { + return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; } -void func_8095954C(EnMk* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 0x7F)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 0x7F)); +void func_8095954C(EnMk* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x7F)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x7F)); - switch (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x7F)]->action) { + switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7F)]->action) { case 1: case 2: case 3: case 4: case 5: - func_809592E0(this, - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x7F)]->action - 1); + func_809592E0(this, play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7F)]->action - 1); break; } } else { @@ -142,7 +141,7 @@ void func_8095954C(EnMk* this, GlobalContext* globalCtx) { } } -void func_80959624(EnMk* this, GlobalContext* globalCtx) { +void func_80959624(EnMk* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -156,22 +155,22 @@ void func_80959624(EnMk* this, GlobalContext* globalCtx) { } else { textId = 0xFBA; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_809596A0(EnMk* this, GlobalContext* globalCtx) { +void func_809596A0(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((globalCtx->msgCtx.currentTextId == 0xFB9) || (globalCtx->msgCtx.currentTextId == 0xFBB) || - (globalCtx->msgCtx.currentTextId == 0xFBC)) { + if ((play->msgCtx.currentTextId == 0xFB9) || (play->msgCtx.currentTextId == 0xFBB) || + (play->msgCtx.currentTextId == 0xFBC)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x400, 0x80); this->actor.world.rot.y = this->actor.shape.rot.y; } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if (Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = func_80959774; } break; @@ -182,32 +181,32 @@ void func_809596A0(EnMk* this, GlobalContext* globalCtx) { } } -void func_80959774(EnMk* this, GlobalContext* globalCtx) { +void func_80959774(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 3, 0x400, 0x80); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80959624(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80959624(this, play); this->actionFunc = func_809596A0; - } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 130.0f); + } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&this->actor, play, 130.0f); } - func_8095954C(this, globalCtx); + func_8095954C(this, play); } -void func_80959844(EnMk* this, GlobalContext* globalCtx) { +void func_80959844(EnMk* this, PlayState* play) { u16 textId; - if ((this->unk_27A & 2) && (func_80959524(globalCtx) >= 7)) { + if ((this->unk_27A & 2) && (func_80959524(play) >= 7)) { textId = 0xFB3; } else if (gSaveContext.save.weekEventReg[20] & 0x40) { textId = 0xFB9; } else if (gSaveContext.save.weekEventReg[19] & 0x40) { textId = 0xFB5; - } else if (func_80959524(globalCtx) >= 7) { + } else if (func_80959524(play) >= 7) { textId = 0xFB3; } else { switch (gSaveContext.save.playerForm) { @@ -237,7 +236,7 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { case PLAYER_FORM_FIERCE_DEITY: case PLAYER_FORM_HUMAN: - if (func_80959524(globalCtx) > 0) { + if (func_80959524(play) > 0) { textId = 0xFA7; } else if (gSaveContext.save.weekEventReg[19] & 4) { if (gSaveContext.save.weekEventReg[55] & 0x80) { @@ -251,7 +250,7 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { break; default: - if (func_80959524(globalCtx) > 0) { + if (func_80959524(play) > 0) { textId = 0xFB0; } else if (gSaveContext.save.weekEventReg[19] & 0x20) { textId = 0xFB2; @@ -261,35 +260,35 @@ void func_80959844(EnMk* this, GlobalContext* globalCtx) { break; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80959A24(EnMk* this, GlobalContext* globalCtx) { +void func_80959A24(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_27A |= 1; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 2: break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0xFA1: case 0xFA3: case 0xFA4: case 0xFAA: case 0xFAE: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0xFA2: if (gSaveContext.save.weekEventReg[55] & 0x80) { - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; break; } - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0xFA5: @@ -304,53 +303,53 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { case 0xFBD: case 0xFBE: case 0xFBF: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; break; case 0xFA0: gSaveContext.save.weekEventReg[19] |= 4; - func_80151938(globalCtx, 0xFA1); + func_80151938(play, 0xFA1); break; case 0xFA8: gSaveContext.save.weekEventReg[19] |= 8; if (gSaveContext.save.weekEventReg[55] & 0x80) { - func_80151938(globalCtx, 0xFBD); + func_80151938(play, 0xFBD); break; } - func_80151938(globalCtx, 0xFA9); + func_80151938(play, 0xFA9); break; case 0xFAC: gSaveContext.save.weekEventReg[19] |= 0x10; if (gSaveContext.save.weekEventReg[55] & 0x80) { - func_80151938(globalCtx, 0xFBE); + func_80151938(play, 0xFBE); break; } - func_80151938(globalCtx, 0xFAD); + func_80151938(play, 0xFAD); break; case 0xFB1: gSaveContext.save.weekEventReg[19] |= 0x20; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; break; case 0xFB3: case 0xFB4: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; this->actor.flags &= ~ACTOR_FLAG_10000; break; case 0xFB5: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80959E18; break; } @@ -359,21 +358,21 @@ void func_80959A24(EnMk* this, GlobalContext* globalCtx) { } } -void func_80959C94(EnMk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80959C94(EnMk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80959A24; this->unk_27A &= ~2; - Message_StartTextbox(globalCtx, 0xFB3, &this->actor); + Message_StartTextbox(play, 0xFB3, &this->actor); } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 350.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 350.0f, 1000.0f, -1); } } -void func_80959D28(EnMk* this, GlobalContext* globalCtx) { +void func_80959D28(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((globalCtx->csCtx.state == 0) && (this->actor.cutscene == -1)) { + if ((play->csCtx.state == 0) && (this->actor.cutscene == -1)) { if (gSaveContext.save.weekEventReg[20] & 0x40) { this->unk_27A &= ~1; this->actionFunc = func_80959774; @@ -392,11 +391,11 @@ void func_80959D28(EnMk* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } - func_8095954C(this, globalCtx); + func_8095954C(this, play); } } -void func_80959E18(EnMk* this, GlobalContext* globalCtx) { +void func_80959E18(EnMk* this, PlayState* play) { s32 pad; s16 sp22 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -409,56 +408,56 @@ void func_80959E18(EnMk* this, GlobalContext* globalCtx) { return; } - if (func_800B8718(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.ocarinaMode = 4; + if (func_800B8718(&this->actor, &play->state)) { + play->msgCtx.ocarinaMode = 4; this->actionFunc = func_80959D28; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { this->actor.cutscene = this->unk_276[0]; gSaveContext.save.weekEventReg[20] |= 0x40; - Item_Give(globalCtx, ITEM_SONG_NOVA); + Item_Give(play, ITEM_SONG_NOVA); } else { this->actor.cutscene = this->unk_276[1]; } ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80959844(this, globalCtx); + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80959844(this, play); this->actionFunc = func_80959A24; this->unk_27A |= 1; - } else if ((this->unk_27A & 2) && (func_80959524(globalCtx) >= 7)) { + } else if ((this->unk_27A & 2) && (func_80959524(play) >= 7)) { this->actionFunc = func_80959C94; } else if ((this->actor.xzDistToPlayer < 120.0f) && (ABS_ALT(sp22) <= 0x4300)) { this->unk_27A |= 1; - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); if (!(gSaveContext.save.weekEventReg[20] & 0x40) && (gSaveContext.save.weekEventReg[19] & 0x40)) { - func_800B874C(&this->actor, globalCtx, 200.0f, 100.0f); + func_800B874C(&this->actor, play, 200.0f, 100.0f); } } else { this->unk_27A &= ~1; } - func_8095954C(this, globalCtx); + func_8095954C(this, play); } -void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMk_Update(Actor* thisx, PlayState* play) { s32 pad; EnMk* this = THIS; Vec3s sp38; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if ((this->unk_27A & 1) && !Cutscene_CheckActorAction(globalCtx, 0x7F)) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_270, &sp38, this->actor.focus.pos); + if ((this->unk_27A & 1) && !Cutscene_CheckActorAction(play, 0x7F)) { + Actor_TrackPlayer(play, &this->actor, &this->unk_270, &sp38, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_270.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unk_270.y, 0, 6, 0x1838, 0x64); } } -s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMk* this = THIS; if (limbIndex == OBJECT_MK_LIMB_0B) { @@ -470,7 +469,7 @@ s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f D_8095A2A0 = { 1000.0f, -100.0f, 0.0f }; -void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMk* this = THIS; if (limbIndex == OBJECT_MK_LIMB_0B) { @@ -478,10 +477,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 = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(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 fee132ccd4..9862f37610 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_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index 45eff8050b..c383a000c4 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -10,18 +10,18 @@ #define THIS ((EnMkk*)thisx) -void EnMkk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMkk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMkk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMkk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMkk_Init(Actor* thisx, PlayState* play); +void EnMkk_Destroy(Actor* thisx, PlayState* play); +void EnMkk_Update(Actor* thisx, PlayState* play); +void EnMkk_Draw(Actor* thisx, PlayState* play); -void func_80A4E100(EnMkk* this, GlobalContext* globalCtx); -void func_80A4E1F0(EnMkk* this, GlobalContext* globalCtx); -void func_80A4E2E8(EnMkk* this, GlobalContext* globalCtx); -void func_80A4E60C(EnMkk* this, GlobalContext* globalCtx); -void func_80A4E72C(EnMkk* this, GlobalContext* globalCtx); -void func_80A4EE48(EnMkk* this, GlobalContext* globalCtx); -void func_80A4EF74(EnMkk* this, GlobalContext* globalCtx); +void func_80A4E100(EnMkk* this, PlayState* play); +void func_80A4E1F0(EnMkk* this, PlayState* play); +void func_80A4E2E8(EnMkk* this, PlayState* play); +void func_80A4E60C(EnMkk* this, PlayState* play); +void func_80A4E72C(EnMkk* this, PlayState* play); +void func_80A4EE48(EnMkk* this, PlayState* play); +void func_80A4EF74(EnMkk* this, PlayState* play); #if 0 const ActorInit En_Mkk_InitVars = { diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h index c80fc7a20e..4dcc552be2 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h @@ -5,7 +5,7 @@ struct EnMkk; -typedef void (*EnMkkActionFunc)(struct EnMkk*, GlobalContext*); +typedef void (*EnMkkActionFunc)(struct EnMkk*, PlayState*); typedef struct EnMkk { /* 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 7cdddfcfdb..c24bf76010 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -11,14 +11,14 @@ #define THIS ((EnMm*)thisx) -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_80965D3C(EnMm* this, GlobalContext* globalCtx); -void func_80965DB4(EnMm* this, GlobalContext* globalCtx); -void func_8096611C(EnMm* this, GlobalContext* globalCtx); +void func_80965D3C(EnMm* this, PlayState* play); +void func_80965DB4(EnMm* this, PlayState* play); +void func_8096611C(EnMm* this, PlayState* play); void EnMm_SetupAction(EnMm* this, EnMmActionFunc actionFunc); const ActorInit En_Mm_InitVars = { @@ -70,7 +70,7 @@ void func_80965BBC(EnMm* this) { } } -void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Init(Actor* thisx, PlayState* play) { EnMm* this = THIS; EnMmActionFunc action; @@ -81,8 +81,8 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 50.0f, ActorShadow_DrawCircle, 1.2f); - 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->actor.parent != NULL) { func_80965BBC(this); return; @@ -95,13 +95,13 @@ void EnMm_Init(Actor* thisx, GlobalContext* globalCtx) { EnMm_SetupAction(this, action); } -void EnMm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Destroy(Actor* thisx, PlayState* play) { EnMm* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80965D3C(EnMm* this, GlobalContext* globalCtx) { +void func_80965D3C(EnMm* this, PlayState* play) { s16 cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); if (ActorCutscene_GetCanPlayNext(cutscene)) { @@ -112,7 +112,7 @@ void func_80965D3C(EnMm* this, GlobalContext* globalCtx) { } } -void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { +void func_80965DB4(EnMm* this, PlayState* play) { s16 direction; Vec3f sp50; s16 unused; @@ -122,7 +122,7 @@ void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { s32 angle; s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { func_80965BBC(this); Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PULL_UP_ROCK); } else { @@ -134,7 +134,7 @@ void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { angle = BINANG_SUB(this->actor.world.rot.y, BINANG_ROT180(this->actor.wallYaw)); this->actor.world.rot.y += BINANG_SUB(0x8000, (s16)(angle * 2)); this->actor.speedXZ *= 0.5f; - CollisionCheck_SpawnShieldParticles(globalCtx, &this->actor.world.pos); + CollisionCheck_SpawnShieldParticles(play, &this->actor.world.pos); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); } @@ -149,7 +149,7 @@ void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { temp_f2 = sqrtf(SQ(temp_f14) + SQ(temp_f12)); if ((temp_f2 < this->actor.speedXZ) || - (SurfaceType_GetSlope(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { + (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { this->actor.speedXZ = CLAMP_MAX(temp_f2, 16.0f); this->actor.world.rot.y = Math_FAtan2F(temp_f12, temp_f14); } @@ -171,7 +171,7 @@ void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); } else { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 50.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 50.0f, 30.0f); } } @@ -179,13 +179,13 @@ void func_80965DB4(EnMm* this, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_8096611C(EnMm* this, GlobalContext* globalCtx) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { +void func_8096611C(EnMm* this, PlayState* play) { + if (Actor_HasNoParent(&this->actor, play)) { EnMm_SetupAction(this, func_80965DB4); - this->actor.room = globalCtx->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.currRoom.num; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); gSaveContext.unk_1014 = 0; @@ -195,20 +195,20 @@ void func_8096611C(EnMm* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_190, 0, 2000); } -void EnMm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Update(Actor* thisx, PlayState* play) { EnMm* this = THIS; - Collider_ResetCylinderAC(globalCtx, &this->collider.base); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 10.0f, 20.0f, 31); + Collider_ResetCylinderAC(play, &this->collider.base); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 20.0f, 31); Actor_SetFocus(&this->actor, 20.0f); } -void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm_Draw(Actor* thisx, PlayState* play) { EnMm* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_190 != 0) { s16 rotY = this->actor.world.rot.y - this->actor.shape.rot.y; @@ -216,7 +216,7 @@ void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateXS(this->unk_190, MTXMODE_APPLY); Matrix_RotateYS(-rotY, MTXMODE_APPLY); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_055628); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 d83ebc961e..dc028a8729 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.h +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.h @@ -5,7 +5,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 79b4987e9a..46c53796bf 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -10,13 +10,13 @@ #define THIS ((EnMm2*)thisx) -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 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 EnMm2_Reading(EnMm2* this, GlobalContext* globalCtx); -void EnMm2_WaitForRead(EnMm2* this, GlobalContext* globalCtx); +void EnMm2_Reading(EnMm2* this, PlayState* play); +void EnMm2_WaitForRead(EnMm2* this, PlayState* play); const ActorInit En_Mm2_InitVars = { ACTOR_EN_MM2, @@ -32,25 +32,25 @@ const ActorInit En_Mm2_InitVars = { #include "overlays/ovl_En_Mm2/ovl_En_Mm2.c" -void EnMm2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Init(Actor* thisx, PlayState* play) { EnMm2* this = THIS; Actor_SetScale(&this->actor, 0.015f); this->actionFunc = EnMm2_WaitForRead; } -void EnMm2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Destroy(Actor* thisx, PlayState* play) { } /** * Action function whilst Link is reading the letter. */ -void EnMm2_Reading(EnMm2* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnMm2_Reading(EnMm2* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (talkState != 2) { - if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if (talkState == 5 && Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = EnMm2_WaitForRead; } } else { @@ -62,27 +62,27 @@ void EnMm2_Reading(EnMm2* this, GlobalContext* globalCtx) { * Action function that awaits Link to read the letter, changing the A button to "Check" when he is within range to do * so (and facing the letter). */ -void EnMm2_WaitForRead(EnMm2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x277B, &this->actor); +void EnMm2_WaitForRead(EnMm2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x277B, &this->actor); this->actionFunc = EnMm2_Reading; - } else if ((this->actor.xzDistToPlayer < 60.0f) && (Player_IsFacingActor(&this->actor, 0x3000, globalCtx))) { - func_800B8614(&this->actor, globalCtx, 110.0f); + } else if ((this->actor.xzDistToPlayer < 60.0f) && (Player_IsFacingActor(&this->actor, 0x3000, play))) { + func_800B8614(&this->actor, play, 110.0f); } } -void EnMm2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm2_Update(Actor* thisx, PlayState* play) { EnMm2* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnMm2_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnMm2_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sEnMm2DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 9da10240db..9816119439 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h @@ -5,7 +5,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_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 58f915f309..2931471e9b 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -11,23 +11,23 @@ #define THIS ((EnMm3*)thisx) -void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMm3_Init(Actor* thisx, PlayState* play); +void EnMm3_Destroy(Actor* thisx, PlayState* play); +void EnMm3_Update(Actor* thisx, PlayState* play); +void EnMm3_Draw(Actor* thisx, PlayState* play); void func_80A6F270(EnMm3* this); -void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx); +void func_80A6F2C8(EnMm3* this, PlayState* play); void func_80A6F9C8(EnMm3* this); -void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6F9DC(EnMm3* this, PlayState* play); void func_80A6FBA0(EnMm3* this); -void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FBFC(EnMm3* this, PlayState* play); void func_80A6FE1C(EnMm3* this); -void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FE30(EnMm3* this, PlayState* play); void func_80A6FED8(EnMm3* this); -void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx); -s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx); -void func_80A70084(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FEEC(EnMm3* this, PlayState* play); +s32 func_80A6FFAC(EnMm3* this, PlayState* play); +void func_80A70084(EnMm3* this, PlayState* play); const ActorInit En_Mm3_InitVars = { ACTOR_EN_MM3, @@ -76,19 +76,19 @@ Vec3f D_80A704F0 = { 0.0f, 0.0f, 0.0f }; TexturePtr D_80A704FC[] = { object_mm_Tex_002950, object_mm_Tex_002750 }; -void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMm3_Init(Actor* thisx, PlayState* play) { s32 pad; EnMm3* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, this->morphTable, 16); Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0), 0.0f, 2, 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); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.parent = NULL; this->actor.targetMode = 0; this->unk_1DC = 1; @@ -99,11 +99,11 @@ void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A6F270(this); } -void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMm3_Destroy(Actor* thisx, PlayState* play) { EnMm3* this = THIS; gSaveContext.save.weekEventReg[63] &= (u8)~1; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80A6F22C(EnMm3* this) { @@ -123,13 +123,13 @@ void func_80A6F270(EnMm3* this) { this->actionFunc = func_80A6F2C8; } -void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x278A, &this->actor); +void func_80A6F2C8(EnMm3* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x278A, &this->actor); this->unk_2B4 = 0x278A; func_80A6F9C8(this); } else if (func_80A6F22C(this)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->unk_2A0.x, 0, 5, 0x1000, 0x100); @@ -138,74 +138,74 @@ void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_2A6.y, 0, 5, 0x1000, 0x100); } -void func_80A6F3B4(EnMm3* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80A6F3B4(EnMm3* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_2B4) { case 0x278E: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { if (this->unk_2B2 & 0x20) { - if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { + if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x2790, &this->actor); + Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } else { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x279C, &this->actor); + Message_StartTextbox(play, 0x279C, &this->actor); this->unk_2B4 = 0x279C; - func_80151BB4(globalCtx, 0xB); + func_80151BB4(play, 0xB); } } else { func_8019F208(); - Message_StartTextbox(globalCtx, 0x2790, &this->actor); + Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; } } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x278F, &this->actor); + Message_StartTextbox(play, 0x278F, &this->actor); this->unk_2B4 = 0x278F; - func_80151BB4(globalCtx, 0xB); + func_80151BB4(play, 0xB); } break; case 0x279A: - if (globalCtx->msgCtx.choiceIndex == 0) { - if (gSaveContext.save.playerData.rupees >= globalCtx->msgCtx.unk1206C) { + if (play->msgCtx.choiceIndex == 0) { + if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x2790, &this->actor); + Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; - func_801159EC(-globalCtx->msgCtx.unk1206C); + func_801159EC(-play->msgCtx.unk1206C); } else { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0x279C, &this->actor); + Message_StartTextbox(play, 0x279C, &this->actor); this->unk_2B4 = 0x279C; - func_80151BB4(globalCtx, 0xB); + func_80151BB4(play, 0xB); } } else { func_8019F230(); - Message_StartTextbox(globalCtx, 0x279B, &this->actor); + Message_StartTextbox(play, 0x279B, &this->actor); this->unk_2B4 = 0x279B; - func_80151BB4(globalCtx, 0xB); + func_80151BB4(play, 0xB); } break; } } } -void func_80A6F5E4(EnMm3* this, GlobalContext* globalCtx) { - if (((this->unk_2B4 != 0x2791) || (this->unk_2AC == 0)) && Message_ShouldAdvance(globalCtx)) { +void func_80A6F5E4(EnMm3* this, PlayState* play) { + if (((this->unk_2B4 != 0x2791) || (this->unk_2AC == 0)) && Message_ShouldAdvance(play)) { switch (this->unk_2B4) { case 0x278A: - if (func_80A6FFAC(this, globalCtx)) { - Message_StartTextbox(globalCtx, 0x279D, &this->actor); + if (func_80A6FFAC(this, play)) { + Message_StartTextbox(play, 0x279D, &this->actor); this->unk_2B4 = 0x279D; } else { - func_80A70084(this, globalCtx); - if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { - Message_StartTextbox(globalCtx, 0x27A0, &this->actor); + func_80A70084(this, play); + if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { + Message_StartTextbox(play, 0x27A0, &this->actor); this->unk_2B4 = 0x27A0; } else { - Message_StartTextbox(globalCtx, 0x278B, &this->actor); + Message_StartTextbox(play, 0x278B, &this->actor); this->unk_2B4 = 0x278B; } } @@ -217,80 +217,80 @@ void func_80A6F5E4(EnMm3* this, GlobalContext* globalCtx) { case 0x278B: case 0x27A0: this->unk_2AE = 0; - Message_StartTextbox(globalCtx, 0x278C, &this->actor); + Message_StartTextbox(play, 0x278C, &this->actor); this->unk_2B4 = 0x278C; break; case 0x278C: - Message_StartTextbox(globalCtx, 0x278D, &this->actor); + Message_StartTextbox(play, 0x278D, &this->actor); this->unk_2B4 = 0x278D; break; case 0x279D: this->unk_2AE = 0; - Message_StartTextbox(globalCtx, 0x279E, &this->actor); + Message_StartTextbox(play, 0x279E, &this->actor); this->unk_2B4 = 0x279E; break; case 0x279E: this->unk_2B2 |= 0x20; - Message_StartTextbox(globalCtx, 0x279F, &this->actor); + Message_StartTextbox(play, 0x279F, &this->actor); this->unk_2B4 = 0x279F; break; case 0x278D: case 0x279F: - Message_StartTextbox(globalCtx, 0x278E, &this->actor); + Message_StartTextbox(play, 0x278E, &this->actor); this->unk_2B4 = 0x278E; break; case 0x2791: if (gSaveContext.unk_3DE0[0] == 1000) { - Message_StartTextbox(globalCtx, 0x2792, &this->actor); + Message_StartTextbox(play, 0x2792, &this->actor); this->unk_2B4 = 0x2792; } else if ((gSaveContext.unk_3DE0[0] >= 1500)) { - Message_StartTextbox(globalCtx, 0x2797, &this->actor); + Message_StartTextbox(play, 0x2797, &this->actor); this->unk_2B4 = 0x2797; } else if ((gSaveContext.unk_3DE0[0] <= 1050) && (gSaveContext.unk_3DE0[0] >= 950)) { - Message_StartTextbox(globalCtx, 0x2795, &this->actor); + Message_StartTextbox(play, 0x2795, &this->actor); this->unk_2B4 = 0x2795; } else { - Message_StartTextbox(globalCtx, 0x2796, &this->actor); + Message_StartTextbox(play, 0x2796, &this->actor); this->unk_2B4 = 0x2796; } break; case 0x2792: - Message_StartTextbox(globalCtx, 0x2793, &this->actor); + Message_StartTextbox(play, 0x2793, &this->actor); this->unk_2B4 = 0x2793; break; case 0x2793: - func_801477B4(globalCtx); + func_801477B4(play); func_80A6FE1C(this); - func_80A6FE30(this, globalCtx); + func_80A6FE30(this, play); break; case 0x2795: case 0x2796: case 0x2797: if (gSaveContext.save.weekEventReg[63] & 2) { - Message_StartTextbox(globalCtx, 0x279B, &this->actor); + Message_StartTextbox(play, 0x279B, &this->actor); this->unk_2B4 = 0x279B; - func_80151BB4(globalCtx, 0xB); + func_80151BB4(play, 0xB); } else { - Message_StartTextbox(globalCtx, 0x2798, &this->actor); + Message_StartTextbox(play, 0x2798, &this->actor); this->unk_2B4 = 0x2798; } break; case 0x2798: - Message_StartTextbox(globalCtx, 0x2799, &this->actor); + Message_StartTextbox(play, 0x2799, &this->actor); this->unk_2B4 = 0x2799; break; case 0x2799: - Message_StartTextbox(globalCtx, 0x279A, &this->actor); + Message_StartTextbox(play, 0x279A, &this->actor); this->unk_2B4 = 0x279A; break; } @@ -310,10 +310,10 @@ void func_80A6F9C8(EnMm3* this) { this->actionFunc = func_80A6F9DC; } -void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { +void func_80A6F9DC(EnMm3* this, PlayState* play) { this->unk_2B0 &= ~2; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -324,25 +324,25 @@ void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { break; case 4: - func_80A6F3B4(this, globalCtx); + func_80A6F3B4(this, play); break; case 5: - func_80A6F5E4(this, globalCtx); + func_80A6F5E4(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_2B4 == 0x2790) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; - if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { func_8010EA9C(0, 2); } else { func_8010EA9C(0, 0); } - func_801477B4(globalCtx); + func_801477B4(play); play_sound(NA_SE_SY_START_SHOT); func_80A6FBA0(this); } else { @@ -373,8 +373,8 @@ void func_80A6FBA0(EnMm3* this) { this->actionFunc = func_80A6FBFC; } -void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6FBFC(EnMm3* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (gSaveContext.unk_3DD0[0] == 0x10) { player->stateFlags1 &= ~0x20; @@ -390,10 +390,10 @@ void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) { gSaveContext.unk_3DC8 = osGetTime(); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_801A5BD0(0); func_801A0238(0x7F, 5); - Message_StartTextbox(globalCtx, 0x2791, &this->actor); + Message_StartTextbox(play, 0x2791, &this->actor); this->unk_2B4 = 0x2791; this->unk_2AC = 7; gSaveContext.unk_3DD0[0] = 0; @@ -401,9 +401,9 @@ void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) { play_sound(NA_SE_SY_START_SHOT); func_80A6F9C8(this); } else { - func_800B8614(&this->actor, globalCtx, this->actor.xzDistToPlayer + 10.0f); - func_80123E90(globalCtx, &this->actor); - if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + func_800B8614(&this->actor, play, this->actor.xzDistToPlayer + 10.0f); + func_80123E90(play, &this->actor); + if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { play_sound(NA_SE_SY_STOPWATCH_TIMER_INF - SFX_FLAG); } else { play_sound(NA_SE_SY_STOPWATCH_TIMER_3 - SFX_FLAG); @@ -415,17 +415,17 @@ void func_80A6FE1C(EnMm3* this) { this->actionFunc = func_80A6FE30; } -void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80A6FE30(EnMm3* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if (!(gSaveContext.save.weekEventReg[77] & 1)) { gSaveContext.save.weekEventReg[77] |= 1; } this->actor.parent = NULL; func_80A6FED8(this); } else if (gSaveContext.save.weekEventReg[77] & 1) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } } @@ -433,26 +433,26 @@ void func_80A6FED8(EnMm3* this) { this->actionFunc = func_80A6FEEC; } -void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A6FEEC(EnMm3* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->stateFlags1 &= ~0x20; - Message_StartTextbox(globalCtx, 0x2794, &this->actor); + Message_StartTextbox(play, 0x2794, &this->actor); this->unk_2B4 = 0x2794; - func_80151BB4(globalCtx, 0xB); - func_80151BB4(globalCtx, 0x2B); + func_80151BB4(play, 0xB); + func_80151BB4(play, 0x2B); this->actor.flags &= ~ACTOR_FLAG_10000; func_80A6F9C8(this); } else { - func_800B85E0(&this->actor, globalCtx, 200.0f, -1); + func_800B85E0(&this->actor, play, 200.0f, -1); } } -s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { +s32 func_80A6FFAC(EnMm3* this, PlayState* play) { switch (gSaveContext.save.playerForm) { case 4: - if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { if (this->unk_2B2 & 0x10) { return true; } @@ -483,10 +483,10 @@ s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { return false; } -void func_80A70084(EnMm3* this, GlobalContext* globalCtx) { +void func_80A70084(EnMm3* this, PlayState* play) { switch (gSaveContext.save.playerForm) { case 4: - if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { this->unk_2B2 |= 0x10; this->unk_2B2 |= 1; } else { @@ -508,23 +508,23 @@ void func_80A70084(EnMm3* this, GlobalContext* globalCtx) { } } -void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMm3_Update(Actor* thisx, PlayState* play) { s32 pad; EnMm3* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); if (this->unk_2B0 & 1) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2A0, &this->unk_2A6, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_2A0, &this->unk_2A6, this->actor.focus.pos); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnMm3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMm3* this = THIS; if (limbIndex == 8) { @@ -533,14 +533,14 @@ s32 EnMm3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } else if (limbIndex == 15) { rot->x += this->unk_2A0.y; rot->z += this->unk_2A0.x; - if ((this->unk_2B0 & 2) && ((globalCtx->gameplayFrames % 3) == 0)) { + if ((this->unk_2B0 & 2) && ((play->gameplayFrames % 3) == 0)) { Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); } } return false; } -void EnMm3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnMm3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMm3* this = THIS; if (limbIndex == 15) { @@ -548,18 +548,18 @@ void EnMm3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMm3_Draw(Actor* thisx, PlayState* play) { EnMm3* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A704FC[this->unk_1DC])); gSPSegment(POLY_OPA_DISP++, 0x0C, sEnMm3DL); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMm3_OverrideLimbDraw, EnMm3_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h index fe2e7ba06e..fe6fa69783 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h @@ -5,7 +5,7 @@ struct EnMm3; -typedef void (*EnMm3ActionFunc)(struct EnMm3*, GlobalContext*); +typedef void (*EnMm3ActionFunc)(struct EnMm3*, PlayState*); typedef struct EnMm3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c index 85996fe6c5..fb8be21f2d 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c @@ -10,10 +10,10 @@ #define THIS ((EnMnk*)thisx) -void EnMnk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMnk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMnk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMnk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMnk_Init(Actor* thisx, PlayState* play); +void EnMnk_Destroy(Actor* thisx, PlayState* play); +void EnMnk_Update(Actor* thisx, PlayState* play); +void EnMnk_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Mnk_InitVars = { diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h index 74afa66e6c..e61fa6921f 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h @@ -5,7 +5,7 @@ struct EnMnk; -typedef void (*EnMnkActionFunc)(struct EnMnk*, GlobalContext*); +typedef void (*EnMnkActionFunc)(struct EnMnk*, PlayState*); typedef struct EnMnk { /* 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 4135fe701c..3425e69231 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -11,15 +11,15 @@ #define THIS ((EnMs*)thisx) -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_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_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,14 +57,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Init(Actor* thisx, PlayState* play) { EnMs* this = THIS; Actor_ProcessInitChain(thisx, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ms_Skel_003DC0, &object_ms_Anim_0005EC, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ms_Skel_003DC0, &object_ms_Anim_0005EC, 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); this->actor.colChkInfo.mass = MASS_IMMOVABLE; // Eating Magic Beans all day will do that to you @@ -74,13 +74,13 @@ void EnMs_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void EnMs_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Destroy(Actor* thisx, PlayState* play) { EnMs* this = THIS; - 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 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (gSaveContext.save.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { @@ -89,44 +89,44 @@ void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMs_Talk; } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS_ALT(yawDiff) < 0x2000)) { - func_800B8614(&this->actor, globalCtx, 90.0f); + func_800B8614(&this->actor, play, 90.0f); } } -void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnMs_Talk(EnMs* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->actionFunc = EnMs_Wait; } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); - Actor_PickUp(&this->actor, globalCtx, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = EnMs_Sell; } break; case 4: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: // yes - func_801477B4(globalCtx); + func_801477B4(play); if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); - func_80151938(globalCtx, 0x935); // "[...] You don't have enough Rupees." + func_80151938(play, 0x935); // "[...] You don't have enough Rupees." } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { play_sound(NA_SE_SY_ERROR); - func_80151938(globalCtx, 0x937); // "[...] You can't carry anymore." + func_80151938(play, 0x937); // "[...] You can't carry anymore." } else { func_8019F208(); - Actor_PickUp(&this->actor, globalCtx, GI_MAGIC_BEANS, 90.0f, 10.0f); + Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); func_801159EC(-10); this->actionFunc = EnMs_Sell; } @@ -135,7 +135,7 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { case 1: // no default: func_8019F230(); - func_80151938(globalCtx, 0x934); // "[...] Well, if your mood changes [...]" + func_80151938(play, 0x934); // "[...] Well, if your mood changes [...]" break; } } @@ -145,26 +145,26 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { } } -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)) { this->actor.textId = 0; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = EnMs_TalkAfterPurchase; } else { - Actor_PickUp(&this->actor, globalCtx, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } -void EnMs_TalkAfterPurchase(EnMs* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80151938(globalCtx, 0x936); // "You can plant 'em whenever you want [...]" +void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80151938(play, 0x936); // "You can plant 'em whenever you want [...]" this->actionFunc = EnMs_Talk; } else { - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); } } -void EnMs_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMs_Update(Actor* thisx, PlayState* play) { s32 pad; EnMs* this = THIS; @@ -172,15 +172,15 @@ 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); 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 = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(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_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index 2efbdea458..dcff0cb58d 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -5,7 +5,7 @@ struct EnMs; -typedef void (*EnMsActionFunc)(struct EnMs*, GlobalContext*); +typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*); typedef struct EnMs { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index aa96b13c12..41b1712d27 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -10,17 +10,17 @@ #define THIS ((EnMttag*)thisx) -void EnMttag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMttag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMttag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnMttag_Init(Actor* thisx, PlayState* play); +void EnMttag_Destroy(Actor* thisx, PlayState* play); +void EnMttag_Update(Actor* thisx, PlayState* play); -void EnMttag_ShowIntroCutscene(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_RaceStart(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_Race(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_RaceFinish(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx); -void EnMttag_HandleCantWinChoice(EnMttag* this, GlobalContext* globalCtx); +void EnMttag_ShowIntroCutscene(EnMttag* this, PlayState* play); +void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, PlayState* play); +void EnMttag_RaceStart(EnMttag* this, PlayState* play); +void EnMttag_Race(EnMttag* this, PlayState* play); +void EnMttag_RaceFinish(EnMttag* this, PlayState* play); +void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play); +void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play); typedef enum { GORON_RACE_CHEAT_NO_CHEATING, @@ -98,13 +98,13 @@ s32 EnMttag_CheckPlayerCheatStatus(Vec3f* pos) { * If it finds them, it stores a pointer to each one in the actor's struct. * Returns true if all four Race Gorons are found. */ -s32 EnMttag_AreFourRaceGoronsPresent(EnMttag* this, GlobalContext* globalCtx) { +s32 EnMttag_AreFourRaceGoronsPresent(EnMttag* this, PlayState* play) { Actor* actor = NULL; s32 i = 0; s32 areGoronsPresent; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_RG); + actor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_RG); if (actor != NULL) { this->raceGorons[i] = (EnRg*)actor; i++; @@ -131,8 +131,8 @@ s32 EnMttag_AreFourRaceGoronsPresent(EnMttag* this, GlobalContext* globalCtx) { * The player can have a checkpoint number of -1 if they move far enough backwards * from the starting line. */ -s32 EnMttag_GetCurrentCheckpoint(Actor* actor, GlobalContext* globalCtx, s32* upcomingCheckpoint, - f32* outPerpendicularPointX, f32* outPerpendicularPointZ) { +s32 EnMttag_GetCurrentCheckpoint(Actor* actor, PlayState* play, s32* upcomingCheckpoint, f32* outPerpendicularPointX, + f32* outPerpendicularPointZ) { s32 curentCheckpoint = -1; s32 hasSetCurrentCheckpointOnce = false; f32 minLineLengthSq = 0.0f; @@ -144,7 +144,7 @@ s32 EnMttag_GetCurrentCheckpoint(Actor* actor, GlobalContext* globalCtx, s32* up // The Goron Racetrack is configured such that the sceneExitIndex for any given floor polygon // gradually increases as you move forward through the racetrack. - sceneExitIndex = SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, actor->floorPoly, actor->floorBgId); + sceneExitIndex = SurfaceType_GetSceneExitIndex(&play->colCtx, actor->floorPoly, actor->floorBgId); if ((sceneExitIndex < 4) || (sceneExitIndex >= 19)) { //! @bug - upcomingCheckpoint is not initialized here return -1; @@ -184,8 +184,8 @@ s32 EnMttag_GetCurrentCheckpoint(Actor* actor, GlobalContext* globalCtx, s32* up * This function also has the side effect of updating the number of checkpoints * ahead of the player each Race Goron is. */ -s32 EnMttag_UpdateCheckpoints(EnMttag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnRg* rg; s32 currentCheckpoints[5]; s32 upcomingCheckpoints[5]; @@ -196,11 +196,11 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, GlobalContext* globalCtx) { s32 playerIsLikelyToLose = false; highestCurrentCheckpoint = -1; - currentCheckpoints[0] = EnMttag_GetCurrentCheckpoint(&player->actor, globalCtx, &upcomingCheckpoints[0], + currentCheckpoints[0] = EnMttag_GetCurrentCheckpoint(&player->actor, play, &upcomingCheckpoints[0], &perpendicularPointsX[0], &perpendicularPointsZ[0]); for (i = 1; i < ARRAY_COUNT(this->raceGorons) + 1; i++) { currentCheckpoints[i] = - EnMttag_GetCurrentCheckpoint(&this->raceGorons[i - 1]->actor, globalCtx, &upcomingCheckpoints[i], + EnMttag_GetCurrentCheckpoint(&this->raceGorons[i - 1]->actor, play, &upcomingCheckpoints[i], &perpendicularPointsX[i], &perpendicularPointsZ[i]); if (highestCurrentCheckpoint < currentCheckpoints[i]) { highestCurrentCheckpoint = currentCheckpoints[i]; @@ -231,9 +231,9 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, GlobalContext* globalCtx) { * Exits the race and returns the player back to "normal" gameplay. * Whether the player won or lost the race is determined by arg1 and nextTransition. */ -s32 EnMttag_ExitRace(GlobalContext* globalCtx, s32 arg1, s32 nextTransition) { +s32 EnMttag_ExitRace(PlayState* play, s32 arg1, s32 nextTransition) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; - globalCtx->nextEntranceIndex = 0xD020; + play->nextEntranceIndex = 0xD020; if ((gSaveContext.save.weekEventReg[33] & 0x80)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -242,20 +242,20 @@ s32 EnMttag_ExitRace(GlobalContext* globalCtx, s32 arg1, s32 nextTransition) { gSaveContext.nextCutsceneIndex = 0; } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = arg1; + play->sceneLoadFlag = 0x14; + play->unk_1887F = arg1; gSaveContext.nextTransition = nextTransition; - func_801477B4(globalCtx); + func_801477B4(play); return 1; } /** * Displays the text which says that the player has made a false start. */ -void EnMttag_ShowFalseStartMessage(EnMttag* this, GlobalContext* globalCtx) { +void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { gSaveContext.unk_3DD0[4] = 0; - Message_StartTextbox(globalCtx, 0xE95, NULL); // An entrant made a false start - func_800B7298(globalCtx, &this->actor, 7); + Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start + func_800B7298(play, &this->actor, 7); Audio_QueueSeqCmd(0x101400FF); this->actionFunc = EnMttag_PotentiallyRestartRace; } @@ -264,16 +264,16 @@ void EnMttag_ShowFalseStartMessage(EnMttag* this, GlobalContext* globalCtx) { * Displays the text from the Goron Elder's child which tells the player that * they probably can't win the race. */ -void EnMttag_ShowCantWinMessage(EnMttag* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, 0xE97, NULL); // You can't win now... - func_800B7298(globalCtx, &this->actor, 7); +void EnMttag_ShowCantWinMessage(EnMttag* this, PlayState* play) { + Message_StartTextbox(play, 0xE97, NULL); // You can't win now... + func_800B7298(play, &this->actor, 7); this->actionFunc = EnMttag_HandleCantWinChoice; } /** * Shows the cutscene that pans over the race track and shows all five race entrants. */ -void EnMttag_ShowIntroCutscene(EnMttag* this, GlobalContext* globalCtx) { +void EnMttag_ShowIntroCutscene(EnMttag* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = EnMttag_WaitForIntroCutsceneToEnd; @@ -286,7 +286,7 @@ void EnMttag_ShowIntroCutscene(EnMttag* this, GlobalContext* globalCtx) { * When the intro cutscene concludes, this sets the weekEventReg to prevent it * from showing again and starts the race. */ -void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, GlobalContext* globalCtx) { +void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { gSaveContext.save.weekEventReg[12] |= 2; this->actionFunc = EnMttag_RaceStart; @@ -297,8 +297,8 @@ void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, GlobalContext* globalCtx) * Handles the race from when the Gorons are first lined up at the * starting block to when the countdown finishes. */ -void EnMttag_RaceStart(EnMttag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMttag_RaceStart(EnMttag* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 playerCheatStatus; if (this->raceInitialized == true) { @@ -310,23 +310,23 @@ void EnMttag_RaceStart(EnMttag* this, GlobalContext* globalCtx) { this->shouldRestartRace = false; } - EnMttag_ShowFalseStartMessage(this, globalCtx); + EnMttag_ShowFalseStartMessage(this, play); gSaveContext.eventInf[1] |= 8; } else { if (DECR(this->timer) == 60) { func_8010E9F0(4, 0); - globalCtx->interfaceCtx.unk_280 = 1; + play->interfaceCtx.unk_280 = 1; Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); - globalCtx->envCtx.unk_E4 = 0xFE; + play->envCtx.unk_E4 = 0xFE; player->stateFlags1 &= ~0x20; - } else if ((this->timer < 60) && (globalCtx->interfaceCtx.unk_280 == 8)) { + } else if ((this->timer < 60) && (play->interfaceCtx.unk_280 == 8)) { this->timer = 0; gSaveContext.eventInf[1] |= 1; this->actionFunc = EnMttag_Race; } } } else { - if (EnMttag_AreFourRaceGoronsPresent(this, globalCtx)) { + if (EnMttag_AreFourRaceGoronsPresent(this, play)) { this->raceInitialized = true; } } @@ -353,8 +353,8 @@ s32 EnMttag_IsAnyRaceGoronOverFinishLine(EnMttag* this) { * Handles the race from when the countdown finishes to when * any race entrant crosses the finish line. */ -void EnMttag_Race(EnMttag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnMttag_Race(EnMttag* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s32 playerCheatStatus; @@ -381,10 +381,10 @@ void EnMttag_Race(EnMttag* this, GlobalContext* globalCtx) { this->shouldRestartRace = false; } - EnMttag_ShowFalseStartMessage(this, globalCtx); + EnMttag_ShowFalseStartMessage(this, play); gSaveContext.eventInf[1] |= 8; - } else if ((EnMttag_UpdateCheckpoints(this, globalCtx)) && (this->timer == 0)) { - EnMttag_ShowCantWinMessage(this, globalCtx); + } else if ((EnMttag_UpdateCheckpoints(this, play)) && (this->timer == 0)) { + EnMttag_ShowCantWinMessage(this, play); gSaveContext.eventInf[1] |= 8; } } @@ -394,14 +394,14 @@ void EnMttag_Race(EnMttag* this, GlobalContext* globalCtx) { * Handles the race after any race entrant crosses the finish line. * This function simply waits for a bit before exiting the race. */ -void EnMttag_RaceFinish(EnMttag* this, GlobalContext* globalCtx) { +void EnMttag_RaceFinish(EnMttag* this, PlayState* play) { if (DECR(this->timer) == 0) { if ((gSaveContext.eventInf[1] & 2)) { // Player won - EnMttag_ExitRace(globalCtx, 3, 3); + EnMttag_ExitRace(play, 3, 3); } else { // A non-player Goron won - EnMttag_ExitRace(globalCtx, 2, 2); + EnMttag_ExitRace(play, 2, 2); } Actor_MarkForDeath(&this->actor); @@ -413,12 +413,12 @@ void EnMttag_RaceFinish(EnMttag* this, GlobalContext* globalCtx) { * In practice, the only time this exits the race is if the player tries to cheat by * reaching the goal from behind. */ -void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if (((talkState == 5 && Message_ShouldAdvance(globalCtx)) || talkState == 2)) { + if (((talkState == 5 && Message_ShouldAdvance(play)) || talkState == 2)) { if (this->shouldRestartRace) { - globalCtx->nextEntranceIndex = 0xD010; + play->nextEntranceIndex = 0xD010; if (gSaveContext.save.weekEventReg[33] & 0x80) { // Spring @@ -428,12 +428,12 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { gSaveContext.nextCutsceneIndex = 0; } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 2; gSaveContext.nextTransition = 2; - func_801477B4(globalCtx); - func_800B7298(globalCtx, &this->actor, 7); - Parameter_AddMagic(globalCtx, + func_801477B4(play); + func_800B7298(play, &this->actor, 7); + Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 48) + 48); gSaveContext.eventInf[1] &= (u8)~1; @@ -442,7 +442,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { gSaveContext.eventInf[1] &= (u8)~8; gSaveContext.eventInf[2] = ((gSaveContext.eventInf[2] & 0xF) + 1) | (gSaveContext.eventInf[2] & 0xF0); } else { - EnMttag_ExitRace(globalCtx, 2, 2); + EnMttag_ExitRace(play, 2, 2); } Actor_MarkForDeath(&this->actor); } @@ -452,21 +452,21 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, GlobalContext* globalCtx) { * This function either exits the race or resumes it based on how the player * responded to the Goron Elder's son's question. */ -void EnMttag_HandleCantWinChoice(EnMttag* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex != 0) { +void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex != 0) { // Exit the race func_8019F230(); gSaveContext.unk_3DD0[4] = 0; - EnMttag_ExitRace(globalCtx, 2, 2); + EnMttag_ExitRace(play, 2, 2); gSaveContext.eventInf[1] &= (u8)~8; gSaveContext.eventInf[1] |= 4; Actor_MarkForDeath(&this->actor); } else { // Keep racing func_8019F208(); - func_801477B4(globalCtx); - func_800B7298(globalCtx, &this->actor, 6); + func_801477B4(play); + func_800B7298(play, &this->actor, 6); gSaveContext.eventInf[1] &= (u8)~8; this->timer = 100; this->actionFunc = EnMttag_Race; @@ -474,12 +474,12 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, GlobalContext* globalCtx) { } } -void EnMttag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMttag_Init(Actor* thisx, PlayState* play) { Player* player; EnMttag* this = THIS; if (gSaveContext.save.entranceIndex == 0xD010) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); player->stateFlags1 |= 0x20; this->raceInitialized = false; this->timer = 100; @@ -501,14 +501,14 @@ void EnMttag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnMttag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMttag_Destroy(Actor* thisx, PlayState* play) { EnMttag* this = THIS; if (gSaveContext.unk_3DD0[4] != 6) { gSaveContext.unk_3DD0[4] = 5; } } -void EnMttag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMttag_Update(Actor* thisx, PlayState* play) { EnMttag* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h index 796dff17a6..34f86048cc 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.h @@ -6,7 +6,7 @@ struct EnMttag; -typedef void (*EnMttagActionFunc)(struct EnMttag*, GlobalContext*); +typedef void (*EnMttagActionFunc)(struct EnMttag*, PlayState*); typedef struct EnMttag { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index e08969c6be..c47b7ba5b0 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -12,25 +12,25 @@ #define THIS ((EnMushi2*)thisx) -void EnMushi2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMushi2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMushi2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMushi2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMushi2_Init(Actor* thisx, PlayState* play); +void EnMushi2_Destroy(Actor* thisx, PlayState* play); +void EnMushi2_Update(Actor* thisx, PlayState* play); +void EnMushi2_Draw(Actor* thisx, PlayState* play); void func_80A6A300(EnMushi2* this); -void func_80A6A36C(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6A36C(EnMushi2* this, PlayState* play); void func_80A6A508(Actor* thisx); -void func_80A6A5C0(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6A5C0(EnMushi2* this, PlayState* play); void func_80A6A794(EnMushi2* this); -void func_80A6A824(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6A824(EnMushi2* this, PlayState* play); void func_80A6A984(EnMushi2* this); -void func_80A6A9E4(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6A9E4(EnMushi2* this, PlayState* play); void func_80A6AAA4(EnMushi2* this); -void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6AB08(EnMushi2* this, PlayState* play); void func_80A6AE14(EnMushi2* this); -void func_80A6AE7C(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6AE7C(EnMushi2* this, PlayState* play); void func_80A6B078(EnMushi2* this); -void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx); +void func_80A6B0D8(EnMushi2* this, PlayState* play); const ActorInit En_Mushi2_InitVars = { ACTOR_EN_MUSHI2, @@ -120,11 +120,11 @@ void func_80A68808(EnMushi2* this) { Collider_UpdateSpheres(0, &this->collider); } -s32 func_80A68860(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A68860(EnMushi2* this, PlayState* play) { s32 pad; s32 sp40; CollisionPoly* sp3C; - f32 temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp3C, &sp40, &this->actor, &this->actor.world.pos); + f32 temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp3C, &sp40, &this->actor, &this->actor.world.pos); WaterBox* sp34; f32 sp30; @@ -132,12 +132,11 @@ s32 func_80A68860(EnMushi2* this, GlobalContext* globalCtx) { return true; } - return WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &sp30, &sp34); + return WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp34); } -s32 func_80A68910(EnMushi2* this, GlobalContext* globalCtx) { - Actor* bean = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +s32 func_80A68910(EnMushi2* this, PlayState* play) { + Actor* bean = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; f32 minDistSq = SQ(100.0f); s32 ret = false; f32 temp_f0; @@ -172,11 +171,11 @@ s32 func_80A68910(EnMushi2* this, GlobalContext* globalCtx) { return ret; } -void func_80A68A78(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A68A78(EnMushi2* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_80A6B998); i++) { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MUSHI2, this->actor.world.pos.x, + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MUSHI2, 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 + (D_80A6B998 + i)->unk_02, this->actor.shape.rot.z, (D_80A6B998 + i)->unk_00, this->actor.cutscene, this->actor.unk20, NULL); @@ -254,7 +253,7 @@ s32 func_80A68CE4(Vec3f* arg0, Vec3f* arg1, f32 arg2) { return -1; } -s32 func_80A68DD4(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A68DD4(EnMushi2* this, PlayState* play) { s32 pad; Player* player; s16 sp2E; @@ -263,7 +262,7 @@ s32 func_80A68DD4(EnMushi2* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 32.0f) && (this->actor.playerHeightRel > -10.0f) && (this->actor.playerHeightRel < 31.0f)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); sp2E = BINANG_ROT180(this->actor.yawTowardsPlayer); sp24 = Math_SinS(sp2E); if (Math3D_XZDistanceSquared((sp24 * 16.0f) + player->actor.world.pos.x, @@ -439,11 +438,11 @@ void func_80A69388(EnMushi2* this) { this->actor.shape.rot = this->actor.world.rot; } -void func_80A69424(EnMushi2* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 8.0f, 9.0f, 0.0f, 0x45); +void func_80A69424(EnMushi2* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 9.0f, 0.0f, 0x45); } -s32 func_80A69468(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A69468(EnMushi2* this, PlayState* play) { s32 pad; Vec3f sp68; Vec3f posB; @@ -466,15 +465,15 @@ s32 func_80A69468(EnMushi2* this, GlobalContext* globalCtx) { posB.y = (y + sp50.y) + this->actor.world.pos.y; posB.z = (z + sp50.z) + this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &posB, &this->unk_33C, &this->poly, true, - true, true, true, &this->polyBgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &posB, &this->unk_33C, &this->poly, true, true, + true, true, &this->polyBgId)) { this->unk_30C |= 6; return true; } return false; } -s32 func_80A6958C(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A6958C(EnMushi2* this, PlayState* play) { s32 pad; Vec3f posA; Vec3f posB; @@ -487,7 +486,7 @@ s32 func_80A6958C(EnMushi2* this, GlobalContext* globalCtx) { posB.y = (this->unk_31C.y * -4.0f) + this->actor.world.pos.y; posB.z = (this->unk_31C.z * -4.0f) + this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &this->unk_33C, &this->poly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &this->unk_33C, &this->poly, true, true, true, true, &this->polyBgId)) { this->unk_30C |= 0xA; return true; @@ -495,7 +494,7 @@ s32 func_80A6958C(EnMushi2* this, GlobalContext* globalCtx) { return false; } -s32 func_80A6969C(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A6969C(EnMushi2* this, PlayState* play) { s32 pad; Vec3f posA; Vec3f posB; @@ -511,7 +510,7 @@ s32 func_80A6969C(EnMushi2* this, GlobalContext* globalCtx) { posB.y = this->actor.prevPos.y + sp38.y + (this->unk_328.y * -4.0f); posB.z = this->actor.prevPos.z + sp38.z + (this->unk_328.z * -4.0f); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &this->unk_33C, &this->poly, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, &this->unk_33C, &this->poly, true, true, true, true, &this->polyBgId)) { this->unk_30C |= (0x10 | 0x2); return true; @@ -519,7 +518,7 @@ s32 func_80A6969C(EnMushi2* this, GlobalContext* globalCtx) { return false; } -void func_80A697C4(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A697C4(EnMushi2* this, PlayState* play) { s32 pad; CollisionPoly* poly = this->poly; s32 bgId = this->polyBgId; @@ -529,12 +528,12 @@ void func_80A697C4(EnMushi2* this, GlobalContext* globalCtx) { f32 sp2C; this->unk_30C &= ~(0x40 | 0x8 | 0x2); - if (!func_80A69468(this, globalCtx) && !func_80A6958C(this, globalCtx)) { - func_80A6969C(this, globalCtx); + if (!func_80A69468(this, play) && !func_80A6958C(this, play)) { + func_80A6969C(this, play); } - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &sp2C, &sp30)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, + &sp30)) { this->actor.depthInWater = sp2C - this->actor.world.pos.y; if (this->actor.depthInWater >= 1.0f) { this->unk_30C |= 0x20; @@ -572,7 +571,7 @@ void func_80A697C4(EnMushi2* this, GlobalContext* globalCtx) { } } -s32 func_80A699E4(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A699E4(EnMushi2* this, PlayState* play) { s32 pad; WaterBox* sp40; f32 sp3C; @@ -582,7 +581,7 @@ s32 func_80A699E4(EnMushi2* this, GlobalContext* globalCtx) { f32 y = (2.0f * this->unk_328.y) + this->actor.world.pos.y; f32 z = (2.0f * this->unk_328.z) + this->actor.world.pos.z; - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, x, z, &sp3C, &sp40) && (y <= sp3C)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, x, z, &sp3C, &sp40) && (y <= sp3C)) { return true; } } @@ -676,26 +675,26 @@ void func_80A69D3C(EnMushi2* this) { } } -s32 func_80A69EE4(EnMushi2* this, GlobalContext* globalCtx) { +s32 func_80A69EE4(EnMushi2* this, PlayState* play) { s32 pad; WaterBox* waterBox; f32 waterSurface; s32 bgId; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &waterSurface, &waterBox, &bgId) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox, &bgId) && (this->actor.world.pos.y < waterSurface)) { return true; } return false; } -void func_80A69F5C(Actor* thisx, GlobalContext* globalCtx) { +void func_80A69F5C(Actor* thisx, PlayState* play) { EnMushi2* this = THIS; s32 i; for (i = 0; i < 7; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.09f) + 0.05f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.09f) + 0.05f); } } @@ -737,30 +736,29 @@ void func_80A6A0D8(EnMushi2* this) { } } -void EnMushi2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMushi2_Init(Actor* thisx, PlayState* play) { EnMushi2* this = THIS; s32 pad; s32 sp3C; Actor_ProcessInitChain(&this->actor, sInitChain); if (!ENMUSHI2_GET_3(&this->actor)) { - func_80A68A78(this, globalCtx); + func_80A68A78(this, play); } this->actor.shape.rot.y += Rand_S16Offset(-2000, 4000); this->actor.home.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; func_80A68F24(this); - SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, - this->jointTable, this->morphTable, 24); + SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable, + this->morphTable, 24); Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, 1, 0.0f); - 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); func_80A68808(this); this->actor.colChkInfo.mass = 30; - sp3C = func_80A69EE4(this, globalCtx); + sp3C = func_80A69EE4(this, play); - if ((sp3C == 0) && func_80A68860(this, globalCtx) && func_80A68910(this, globalCtx) && - !ENMUSHI2_GET_3(&this->actor)) { + if ((sp3C == 0) && func_80A68860(this, play) && func_80A68910(this, play) && !ENMUSHI2_GET_3(&this->actor)) { func_80A6A024(this); } @@ -769,7 +767,7 @@ void EnMushi2_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_30C = 1; if (sp3C != 0) { - func_80A69F5C(&this->actor, globalCtx); + func_80A69F5C(&this->actor, play); this->actor.world.rot.y = Rand_Next() >> 0x10; func_80A6AE14(this); } else { @@ -779,10 +777,10 @@ void EnMushi2_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A68B3C(this); } -void EnMushi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMushi2_Destroy(Actor* thisx, PlayState* play) { EnMushi2* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); func_80A68B6C(this); } @@ -795,14 +793,14 @@ void func_80A6A300(EnMushi2* this) { this->actionFunc = func_80A6A36C; } -void func_80A6A36C(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6A36C(EnMushi2* this, PlayState* play) { s32 pad; s32 sp20 = false; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); this->actor.velocity.y -= this->actor.velocity.y * D_80A6BA14[ENMUSHI2_GET_3(&this->actor)]; Actor_MoveWithGravity(&this->actor); - func_80A69424(this, globalCtx); + func_80A69424(this, play); this->actor.shape.rot.y += this->unk_370; this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.floorHeight < this->actor.world.pos.y) && @@ -848,7 +846,7 @@ void func_80A6A508(Actor* thisx) { this->actionFunc = func_80A6A5C0; } -void func_80A6A5C0(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6A5C0(EnMushi2* this, PlayState* play) { EnMushi2* this2 = this; func_80A69D3C(this); @@ -860,7 +858,7 @@ void func_80A6A5C0(EnMushi2* this, GlobalContext* globalCtx) { } func_80A68ED8(this); - func_80A697C4(this, globalCtx); + func_80A697C4(this, play); if (this->unk_30C & 0x40) { func_80A69388(this); } @@ -876,7 +874,7 @@ void func_80A6A5C0(EnMushi2* this, GlobalContext* globalCtx) { func_80A6AAA4(this); } else if (this->unk_368 <= 0) { func_80A6A794(this); - } else if (((globalCtx->gameplayFrames % 2) != 0) && func_80A699E4(this, globalCtx)) { + } else if (((play->gameplayFrames % 2) != 0) && func_80A699E4(this, play)) { func_80A6A984(this); } } @@ -892,12 +890,12 @@ void func_80A6A794(EnMushi2* this) { this->actionFunc = func_80A6A824; } -void func_80A6A824(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6A824(EnMushi2* this, PlayState* play) { EnMushi2* this2 = this; Math_SmoothStepToF(&this->actor.speedXZ, this->unk_35C, 0.1f, 0.5f, 0.0f); func_80A68ED8(this); - func_80A697C4(this, globalCtx); + func_80A697C4(this, play); if (this->unk_30C & 0x40) { func_80A69388(this); @@ -928,13 +926,13 @@ void func_80A6A984(EnMushi2* this) { this->actionFunc = func_80A6A9E4; } -void func_80A6A9E4(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6A9E4(EnMushi2* this, PlayState* play) { func_80A68F9C(this, this->unk_370); func_80A69388(this); if ((this->unk_36A <= 0) || func_80A68BA0(this)) { func_80A6B078(this); } else if (this->unk_368 <= 0) { - func_80A697C4(this, globalCtx); + func_80A697C4(this, play); if (this->unk_30C & 0x40) { func_80A69388(this); } @@ -957,7 +955,7 @@ void func_80A6AAA4(EnMushi2* this) { this->actionFunc = func_80A6AB08; } -void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6AB08(EnMushi2* this, PlayState* play) { s32 pad; s16 temp; @@ -968,7 +966,7 @@ void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - func_80A69424(this, globalCtx); + func_80A69424(this, play); Math_StepToF(&this->actor.world.pos.y, this->actor.world.pos.y + this->actor.depthInWater, 2.8f); this->skelAnime.playSpeed = this->unk_368 * 0.018f; this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, 0.1f, 1.9f); @@ -997,7 +995,7 @@ void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y + this->actor.depthInWater; sp3C.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp3C, 40, 200, 4); + EffectSsGRipple_Spawn(play, &sp3C, 40, 200, 4); } if ((this->unk_368 <= 0) || (this->unk_36A <= 0) || func_80A68BA0(this)) { @@ -1019,7 +1017,7 @@ void func_80A6AE14(EnMushi2* this) { this->actionFunc = func_80A6AE7C; } -void func_80A6AE7C(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6AE7C(EnMushi2* this, PlayState* play) { f32 temp_f2; this->actor.shape.rot.x -= 0x1F4; @@ -1030,12 +1028,12 @@ void func_80A6AE7C(EnMushi2* this, GlobalContext* globalCtx) { this->actor.gravity = -0.04f - (Rand_ZeroOne() * 0.02f); this->actor.velocity.y *= 0.95f; Actor_MoveWithGravity(&this->actor); - func_80A69424(this, globalCtx); + func_80A69424(this, play); temp_f2 = this->actor.scale.x - (1.0f / 20000.0f); Actor_SetScale(&this->actor, CLAMP_MIN(temp_f2, 0.001f)); if ((this->actor.flags & ACTOR_FLAG_40) && (this->actor.depthInWater > 5.0f) && (this->actor.depthInWater < 30.0f) && ((s32)(Rand_Next() & 0x1FF) < this->unk_368)) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, + EffectSsBubble_Spawn(play, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, ((Rand_ZeroOne() * 4.0f) + 2.0f) * this->actor.scale.x); } @@ -1053,7 +1051,7 @@ void func_80A6B078(EnMushi2* this) { this->actionFunc = func_80A6B0D8; } -void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx) { +void func_80A6B0D8(EnMushi2* this, PlayState* play) { s32 pad[2]; f32 temp_f2; @@ -1069,7 +1067,7 @@ void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx) { func_80A69388(this); } - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { temp_f2 = 0.6f; } else { temp_f2 = -0.6f; @@ -1087,7 +1085,7 @@ void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx) { s32 sp44 = 0; if (this->poly != NULL) { - u32 temp_v0 = func_800C99D4(&globalCtx->colCtx, this->poly, this->polyBgId); + u32 temp_v0 = func_800C99D4(&play->colCtx, this->poly, this->polyBgId); if ((temp_v0 == 5) || (temp_v0 == 14) || (temp_v0 == 15)) { sp44 = 1; } @@ -1095,7 +1093,7 @@ void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx) { sp48.x = (this->unk_328.x * -0.6f) + (this->unk_31C.x * 0.1f); sp48.y = (this->unk_328.y * -0.6f) + (this->unk_31C.y * 0.1f); sp48.z = (this->unk_328.z * -0.6f) + (this->unk_31C.z * 0.1f); - func_800B0E48(globalCtx, &this->actor.world.pos, &sp48, &gZeroVec3f, &D_80A6B984[sp44], &D_80A6B98C[sp44], + func_800B0E48(play, &this->actor.world.pos, &sp48, &gZeroVec3f, &D_80A6B984[sp44], &D_80A6B98C[sp44], (Rand_ZeroOne() * 5.0f) + 8.0f, (Rand_ZeroOne() * 5.0f) + 8.0f); } @@ -1111,7 +1109,7 @@ void func_80A6B0D8(EnMushi2* this, GlobalContext* globalCtx) { } } -void EnMushi2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnMushi2_Update(Actor* thisx, PlayState* play) { EnMushi2* this = THIS; s32 pad; f32 sp4C; @@ -1122,7 +1120,7 @@ void EnMushi2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_34C = NULL; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { func_80A6A094(this); func_80A6A0D8(this); Actor_MarkForDeath(&this->actor); @@ -1158,11 +1156,11 @@ void EnMushi2_Update(Actor* thisx, GlobalContext* globalCtx) { if ((temp != BGCHECK_SCENE) && ((this->actionFunc == func_80A6A5C0) || (this->actionFunc == func_80A6A824) || (this->actionFunc == func_80A6A9E4) || (this->actionFunc == func_80A6B0D8)) && - BgCheck2_UpdateActorAttachedToMesh(&globalCtx->colCtx, temp, &this->actor)) { + BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, temp, &this->actor)) { func_80A68F24(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { if ((this->actionFunc == func_80A6AB08) || (this->actionFunc == func_80A6AE7C)) { @@ -1218,21 +1216,21 @@ void EnMushi2_Update(Actor* thisx, GlobalContext* globalCtx) { element->dim.worldSphere.center.x = this->actor.world.pos.x; element->dim.worldSphere.center.y = this->actor.world.pos.y; element->dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } - if ((this->unk_30C & 1) && func_80A68DD4(this, globalCtx)) { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 60.0f, 30.0f); + if ((this->unk_30C & 1) && func_80A68DD4(this, play)) { + Actor_PickUp(&this->actor, play, GI_MAX, 60.0f, 30.0f); } } } -void EnMushi2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMushi2_Draw(Actor* thisx, PlayState* play) { EnMushi2* this = THIS; func_80A687A0(this); - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); } diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h index f773cd7460..d36d385b08 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.h @@ -5,7 +5,7 @@ struct EnMushi2; -typedef void (*EnMushi2ActionFunc)(struct EnMushi2*, GlobalContext*); +typedef void (*EnMushi2ActionFunc)(struct EnMushi2*, PlayState*); #define ENMUSHI2_GET_3(thisx) ((thisx)->params & 3) diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index c4b2beffcc..1a77cc3883 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -11,18 +11,18 @@ #define THIS ((EnMuto*)thisx) -void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx); -void EnMuto_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx); -void EnMuto_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnMuto_Init(Actor* thisx, PlayState* play); +void EnMuto_Destroy(Actor* thisx, PlayState* play); +void EnMuto_Update(Actor* thisx, PlayState* play); +void EnMuto_Draw(Actor* thisx, PlayState* play); void EnMuto_ChangeAnim(EnMuto* this, s32 arg1); void EnMuto_SetHeadRotation(EnMuto* this); void EnMuto_SetupIdle(EnMuto* this); -void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx); -void EnMuto_SetupDialogue(EnMuto* this, GlobalContext* globalCtx); -void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx); -s32 EnMuto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnMuto_Idle(EnMuto* this, PlayState* play); +void EnMuto_SetupDialogue(EnMuto* this, PlayState* play); +void EnMuto_InDialogue(EnMuto* this, PlayState* play); +s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); const ActorInit En_Muto_InitVars = { ACTOR_EN_MUTO, @@ -58,13 +58,13 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnMuto_Init(Actor* thisx, PlayState* play) { EnMuto* this = THIS; this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, - this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable, + this->morphTable, 17); this->isInMayorsRoom = this->actor.params; if (!this->isInMayorsRoom) { @@ -89,14 +89,14 @@ void EnMuto_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; this->actor.gravity = -3.0f; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); EnMuto_SetupIdle(this); } -void EnMuto_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnMuto_Destroy(Actor* thisx, PlayState* play) { EnMuto* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) { @@ -129,12 +129,12 @@ void EnMuto_SetupIdle(EnMuto* this) { this->actionFunc = EnMuto_Idle; } -void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { +void EnMuto_Idle(EnMuto* this, PlayState* play) { Player* player; this->actor.textId = sTextIds[this->textIdIndex]; if (!this->isInMayorsRoom) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { if (!(gSaveContext.save.weekEventReg[88] & 8)) { this->actor.textId = 0x62C; @@ -146,12 +146,12 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { if (1) {} // Needed to match - if (!this->isInMayorsRoom && Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (!this->isInMayorsRoom && Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->actor.textId = 0x2363; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - EnMuto_SetupDialogue(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + EnMuto_SetupDialogue(this, play); return; } @@ -167,20 +167,20 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) { if (gSaveContext.save.weekEventReg[60] & 8) { this->textIdIndex = 1; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_COUPLE) { + if (Player_GetMask(play) == PLAYER_MASK_COUPLE) { this->textIdIndex = 4; } if (this->cutsceneState == 1) { - EnMuto_SetupDialogue(this, globalCtx); + EnMuto_SetupDialogue(this, play); return; } } - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } -void EnMuto_SetupDialogue(EnMuto* this, GlobalContext* globalCtx) { +void EnMuto_SetupDialogue(EnMuto* this, PlayState* play) { if (!this->isInMayorsRoom) { this->yawTowardsTarget = 0; } @@ -188,18 +188,18 @@ void EnMuto_SetupDialogue(EnMuto* this, GlobalContext* globalCtx) { if (this->targetActor != NULL) { this->shouldSetHeadRotation = true; this->cutsceneState = 1; - Actor_ChangeFocus(this->targetActor, globalCtx, this->targetActor); + Actor_ChangeFocus(this->targetActor, play, this->targetActor); } this->isInDialogue = true; this->actionFunc = EnMuto_InDialogue; } -void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx) { +void EnMuto_InDialogue(EnMuto* this, PlayState* play) { if (!this->isInMayorsRoom) { this->yawTowardsTarget = this->actor.yawTowardsPlayer; - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + func_801477B4(play); if (this->actor.textId == 0x62C) { gSaveContext.save.weekEventReg[88] |= 8; @@ -229,13 +229,13 @@ void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx) { } } - if (globalCtx->msgCtx.currentTextId == 0x2AC6 || globalCtx->msgCtx.currentTextId == 0x2AC7 || - globalCtx->msgCtx.currentTextId == 0x2AC8) { + if (play->msgCtx.currentTextId == 0x2AC6 || play->msgCtx.currentTextId == 0x2AC7 || + play->msgCtx.currentTextId == 0x2AC8) { this->skelAnime.playSpeed = 0.0f; this->yawTowardsTarget = this->actor.yawTowardsPlayer; this->skelAnime.curFrame = 30.0f; } - if (globalCtx->msgCtx.currentTextId == 0x2ACF) { + if (play->msgCtx.currentTextId == 0x2ACF) { this->skelAnime.playSpeed = 0.0f; } @@ -244,8 +244,8 @@ void EnMuto_InDialogue(EnMuto* this, GlobalContext* globalCtx) { } } -void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnMuto_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnMuto* this = THIS; SkelAnime_Update(&this->skelAnime); @@ -259,7 +259,7 @@ void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx2) { return; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); DECR(this->unusedCounter); @@ -272,16 +272,15 @@ void EnMuto_Update(Actor* thisx, GlobalContext* globalCtx2) { Math_SmoothStepToS(&this->headRot.x, this->headRotTarget.x, 1, 0x3E8, 0); Math_SmoothStepToS(&this->waistRot.y, this->waistRotTarget.y, 1, 0xBB8, 0); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1DU); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1DU); this->actor.uncullZoneForward = 500.0f; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnMuto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMuto* this = THIS; if (limbIndex == 1) { @@ -296,10 +295,10 @@ s32 EnMuto_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnMuto_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnMuto_Draw(Actor* thisx, PlayState* play) { EnMuto* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnMuto_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.h b/src/overlays/actors/ovl_En_Muto/z_en_muto.h index 29af0d624f..12517f1e30 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.h +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.h @@ -5,7 +5,7 @@ struct EnMuto; -typedef void (*EnMutoActionFunc)(struct EnMuto*, GlobalContext*); +typedef void (*EnMutoActionFunc)(struct EnMuto*, PlayState*); typedef struct EnMuto { /* 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 5f24e5b018..9e27fe6055 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -10,13 +10,13 @@ #define THIS ((EnNb*)thisx) -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); -void func_80BC0D84(EnNb* this, GlobalContext* globalCtx); -void func_80BC0EAC(EnNb* this, GlobalContext* globalCtx); +void func_80BC0D84(EnNb* this, PlayState* play); +void func_80BC0EAC(EnNb* this, PlayState* play); #if 0 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 f3b5fd0262..1fab2e6493 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -5,7 +5,7 @@ struct EnNb; -typedef void (*EnNbActionFunc)(struct EnNb*, GlobalContext*); +typedef void (*EnNbActionFunc)(struct EnNb*, PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 591d4ddcbb..bd56373e57 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -11,30 +11,30 @@ #define THIS ((EnNeoReeba*)thisx) -void EnNeoReeba_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNeoReeba_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNeoReeba_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNeoReeba_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNeoReeba_Init(Actor* thisx, PlayState* play); +void EnNeoReeba_Destroy(Actor* thisx, PlayState* play); +void EnNeoReeba_Update(Actor* thisx, PlayState* play); +void EnNeoReeba_Draw(Actor* thisx, PlayState* play); void EnNeoReeba_SetupWaitUnderground(EnNeoReeba* this); -void EnNeoReeba_WaitUnderground(EnNeoReeba* this, GlobalContext* globalCtx); -void EnNeoReeba_ChooseAction(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_WaitUnderground(EnNeoReeba* this, PlayState* play); +void EnNeoReeba_ChooseAction(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupSink(EnNeoReeba* this); -void EnNeoReeba_Sink(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_Sink(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupRise(EnNeoReeba* this); -void EnNeoReeba_RiseOutOfGround(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_RiseOutOfGround(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupMove(EnNeoReeba* this); -void EnNeoReeba_Move(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_Move(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupReturnHome(EnNeoReeba* this); -void EnNeoReeba_ReturnHome(EnNeoReeba* this, GlobalContext* globalCtx); -void EnNeoReeba_Bounce(EnNeoReeba* this, GlobalContext* globalCtx); -void EnNeoReeba_Stunned(EnNeoReeba* this, GlobalContext* globalCtx); -void EnNeoReeba_Frozen(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_ReturnHome(EnNeoReeba* this, PlayState* play); +void EnNeoReeba_Bounce(EnNeoReeba* this, PlayState* play); +void EnNeoReeba_Stunned(EnNeoReeba* this, PlayState* play); +void EnNeoReeba_Frozen(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupDamageAnim(EnNeoReeba* this); -void EnNeoReeba_DamageAnim(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_DamageAnim(EnNeoReeba* this, PlayState* play); void EnNeoReeba_SetupDeathEffects(EnNeoReeba* this); -void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, GlobalContext* globalCtx); -void EnNeoReeba_SpawnIce(EnNeoReeba* this, GlobalContext* globalCtx); +void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, PlayState* play); +void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play); const ActorInit En_Neo_Reeba_InitVars = { ACTOR_EN_NEO_REEBA, @@ -115,11 +115,11 @@ static ColliderCylinderInit sCylinderInit = { { 18, 30, 0, { 0, 0, 0 } }, }; -void EnNeoReeba_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNeoReeba_Init(Actor* thisx, PlayState* play) { EnNeoReeba* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gLeeverSkel, &gLeeverSpinAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gLeeverSkel, &gLeeverSpinAnim, this->jointTable, this->morphTable, LEEVER_LIMB_MAX); if (!EN_NEO_REEBA_IS_LARGE(&this->actor)) { @@ -147,16 +147,16 @@ void EnNeoReeba_Init(Actor* thisx, GlobalContext* globalCtx) { this->sinkRiseRate = 0.0f; this->rotationSpeed = 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); EnNeoReeba_SetupWaitUnderground(this); } -void EnNeoReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNeoReeba_Destroy(Actor* thisx, PlayState* play) { EnNeoReeba* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnNeoReeba_SetupWaitUnderground(EnNeoReeba* this) { @@ -167,12 +167,12 @@ void EnNeoReeba_SetupWaitUnderground(EnNeoReeba* this) { this->actor.shape.yOffset = -2000.0f; } -void EnNeoReeba_WaitUnderground(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_WaitUnderground(EnNeoReeba* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos) < 200.0f) && - (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { + (Player_GetMask(play) != PLAYER_MASK_STONE) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { EnNeoReeba_SetupRise(this); } @@ -197,8 +197,8 @@ void EnNeoReeba_SetupChooseAction(EnNeoReeba* this) { this->skelAnime.playSpeed = 1.0f; } -void EnNeoReeba_ChooseAction(EnNeoReeba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnNeoReeba_ChooseAction(EnNeoReeba* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distToPlayer = Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos); if ((distToPlayer > 200.0f) || (fabsf(this->actor.playerHeightRel) > 100.0f)) { @@ -228,12 +228,12 @@ void EnNeoReeba_SetupSink(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_Sink; } -void EnNeoReeba_Sink(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_Sink(EnNeoReeba* this, PlayState* play) { if (Math_SmoothStepToF(&this->actor.shape.yOffset, -2000.0f, 0.5f, this->sinkRiseRate, 10.0f) == 0.0f) { EnNeoReeba_SetupWaitUnderground(this); - } else if (globalCtx->gameplayFrames % 4 == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, 1); + } else if (play->gameplayFrames % 4 == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, + 500, 10, 1); } if (this->sinkRiseRate < 300.0f) { @@ -252,12 +252,12 @@ void EnNeoReeba_SetupRise(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_RiseOutOfGround; } -void EnNeoReeba_RiseOutOfGround(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_RiseOutOfGround(EnNeoReeba* this, PlayState* play) { if (Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, this->sinkRiseRate, 10.0f) == 0.0f) { EnNeoReeba_SetupChooseAction(this); - } else if (globalCtx->gameplayFrames % 4 == 0) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 8.0f, 500, 10, 1); + } else if (play->gameplayFrames % 4 == 0) { + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, + 500, 10, 1); } if (this->sinkRiseRate > 20.0f) { @@ -276,11 +276,11 @@ void EnNeoReeba_SetupMove(EnNeoReeba* this) { this->actor.speedXZ = 14.0f; } -void EnNeoReeba_Move(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_Move(EnNeoReeba* this, PlayState* play) { f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speedXZ); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 4.0f, - 0xFA, 0xA, 1); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 4.0f, 0xFA, + 0xA, 1); if (remainingDist < 2.0f) { EnNeoReeba_SetupChooseAction(this); @@ -307,8 +307,8 @@ void EnNeoReeba_SetupReturnHome(EnNeoReeba* this) { this->actor.speedXZ = 6.0f; } -void EnNeoReeba_ReturnHome(EnNeoReeba* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnNeoReeba_ReturnHome(EnNeoReeba* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->actor.home.pos, this->actor.speedXZ); @@ -332,7 +332,7 @@ void EnNeoReeba_SetupBounce(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_Bounce; } -void EnNeoReeba_Bounce(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_Bounce(EnNeoReeba* this, PlayState* play) { if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speedXZ) < 2.0f) { EnNeoReeba_SetupChooseAction(this); } @@ -349,7 +349,7 @@ void EnNeoReeba_SetupStun(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_Stunned; } -void EnNeoReeba_Stunned(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_Stunned(EnNeoReeba* this, PlayState* play) { if (this->stunTimer > 0) { this->stunTimer--; } else { @@ -382,7 +382,7 @@ void EnNeoReeba_SetupFrozen(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_Frozen; } -void EnNeoReeba_Frozen(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_Frozen(EnNeoReeba* this, PlayState* play) { if (this->stunTimer == 0) { this->stunTimer = 0; this->drawEffectScale = 0.0f; @@ -395,7 +395,7 @@ void EnNeoReeba_Frozen(EnNeoReeba* this, GlobalContext* globalCtx) { } } else if (this->stunTimer == 1) { this->stunTimer--; - EnNeoReeba_SpawnIce(this, globalCtx); + EnNeoReeba_SpawnIce(this, play); } else { this->stunTimer--; } @@ -415,7 +415,7 @@ void EnNeoReeba_SetupDamageAnim(EnNeoReeba* this) { static f32 sDamageAnimXZScales[] = { 0.04, 0.04, 0.039, 0.042, 0.045, 0.043, 0.04, 0.035, 0.03, 0.033, 0.04 }; static f32 sDamageAnimYScales[] = { 0.04f, 0.04f, 0.041f, 0.038f, 0.035f, 0.037f, 0.04f, 0.045f, 0.05f, 0.047f, 0.04f }; -void EnNeoReeba_DamageAnim(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_DamageAnim(EnNeoReeba* this, PlayState* play) { if (this->actionTimer == 0) { this->rotationSpeed = 0.0f; EnNeoReeba_SetupChooseAction(this); @@ -431,8 +431,8 @@ void EnNeoReeba_DamageAnim(EnNeoReeba* this, GlobalContext* globalCtx) { this->actor.scale.z *= 1.5f; } - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, - 4.0f, 250, 10, 1); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 4.0f, + 250, 10, 1); this->actionTimer--; } } @@ -452,7 +452,7 @@ void EnNeoReeba_SetupDeathEffects(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_PlayDeathEffects; } -void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, PlayState* play) { static Vec3f sDeadDbVel = { 0.0f, 0.0f, 0.0f }; static Vec3f sDeadDbAccel = { 0.0f, 4.0f, 0.0f }; @@ -464,8 +464,8 @@ void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->drawEffectScale, 0.1f, 0.1f); if (this->actor.scale.x < 0.01f) { - func_800B3030(globalCtx, &this->actor.world.pos, &sDeadDbAccel, &sDeadDbVel, 120, 0, 0); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + func_800B3030(play, &this->actor.world.pos, &sDeadDbAccel, &sDeadDbVel, 120, 0, 0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); Actor_MarkForDeath(&this->actor); } } else { @@ -502,7 +502,7 @@ void EnNeoReeba_PlayDeathEffects(EnNeoReeba* this, GlobalContext* globalCtx) { } } -void EnNeoReeba_HandleHit(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_HandleHit(EnNeoReeba* this, PlayState* play) { Actor_SetFocus(&this->actor, 20.0f); if (this->collider.base.acFlags & AC_HIT) { @@ -518,7 +518,7 @@ void EnNeoReeba_HandleHit(EnNeoReeba* this, GlobalContext* globalCtx) { return; default: if (this->stunTimer >= 2) { - EnNeoReeba_SpawnIce(this, globalCtx); + EnNeoReeba_SpawnIce(this, play); } this->stunTimer = 0; } @@ -552,7 +552,7 @@ void EnNeoReeba_HandleHit(EnNeoReeba* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health > 0) { EnNeoReeba_SetupDamageAnim(this); } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); EnNeoReeba_SetupDeathEffects(this); } break; @@ -581,16 +581,16 @@ void EnNeoReeba_HandleHit(EnNeoReeba* this, GlobalContext* globalCtx) { (this->actionFunc != EnNeoReeba_RiseOutOfGround) && (this->actionFunc != EnNeoReeba_DamageAnim) && (this->actionFunc != EnNeoReeba_PlayDeathEffects)) { Collider_UpdateCylinder(&this->actor, &this->collider); - 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); if (this->actionFunc != EnNeoReeba_Stunned) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -void EnNeoReeba_UpdatePosition(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_UpdatePosition(EnNeoReeba* this, PlayState* play) { if ((this->actionFunc != EnNeoReeba_WaitUnderground) && (this->actionFunc != EnNeoReeba_Sink) && (this->actionFunc != EnNeoReeba_RiseOutOfGround)) { this->actor.velocity.y += this->actor.gravity; @@ -604,11 +604,11 @@ void EnNeoReeba_UpdatePosition(EnNeoReeba* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->velToTarget.x, 1.0f, 2.0f); Math_ApproachZeroF(&this->velToTarget.z, 1.0f, 2.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 40.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 5); } } -void EnNeoReeba_DrawFrozenEffects(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_DrawFrozenEffects(EnNeoReeba* this, PlayState* play) { s32 i; f32 limbPosScale = 10.0f; f32 phi_f2 = 20.0f; @@ -632,11 +632,11 @@ void EnNeoReeba_DrawFrozenEffects(EnNeoReeba* this, GlobalContext* globalCtx) { this->limbPos[ARRAY_COUNT(this->limbPos) - 1].y += phi_f2; this->drawEffectScale = drawEffectScale; - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), drawEffectScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } -void EnNeoReeba_DrawEffects(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_DrawEffects(EnNeoReeba* this, PlayState* play) { s32 i; f32 scale = 15.0f; @@ -654,12 +654,12 @@ void EnNeoReeba_DrawEffects(EnNeoReeba* this, GlobalContext* globalCtx) { } this->limbPos[ARRAY_COUNT(this->limbPos) - 1] = this->actor.world.pos; - Actor_DrawDamageEffects(globalCtx, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawEffectScale, 0.5f, + Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawEffectScale, 0.5f, this->drawEffectAlpha, this->drawEffectType); } } -void EnNeoReeba_SpawnIce(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_SpawnIce(EnNeoReeba* this, PlayState* play) { static Color_RGBA8 sIcePrimColor = { 170, 255, 255, 255 }; static Color_RGBA8 sIceEnvColor = { 200, 200, 255, 255 }; static Vec3f sIceAccel = { 0.0f, -1.0f, 0.0f }; @@ -670,7 +670,7 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, GlobalContext* globalCtx) { s16 yaw; s32 j; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); @@ -681,22 +681,21 @@ void EnNeoReeba_SpawnIce(EnNeoReeba* this, GlobalContext* globalCtx) { iceVel.x = (Rand_Centered() * 3.0f) + xVel; iceVel.z = (Rand_Centered() * 3.0f) + zVel; iceVel.y = (Rand_ZeroOne() * 6.0f) + 4.0f; - EffectSsEnIce_Spawn(globalCtx, &this->limbPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, - 30); + EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.7f, &iceVel, &sIceAccel, &sIcePrimColor, &sIceEnvColor, 30); } } } -void EnNeoReeba_SinkIfStoneMask(EnNeoReeba* this, GlobalContext* globalCtx) { +void EnNeoReeba_SinkIfStoneMask(EnNeoReeba* this, PlayState* play) { if ((this->actionFunc == EnNeoReeba_ChooseAction) || (this->actionFunc == EnNeoReeba_Move) || (this->actionFunc == EnNeoReeba_ReturnHome)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) { + if (Player_GetMask(play) == PLAYER_MASK_STONE) { EnNeoReeba_SetupSink(this); } } } -void EnNeoReeba_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNeoReeba_Update(Actor* thisx, PlayState* play) { EnNeoReeba* this = THIS; if (EN_NEO_REEBA_IS_LARGE(&this->actor)) { @@ -704,20 +703,19 @@ void EnNeoReeba_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.height = 45; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != EnNeoReeba_WaitUnderground) && (this->actionFunc != EnNeoReeba_Stunned) && (this->actionFunc != EnNeoReeba_Frozen)) { SkelAnime_Update(&this->skelAnime); } - EnNeoReeba_HandleHit(this, globalCtx); - EnNeoReeba_UpdatePosition(this, globalCtx); - EnNeoReeba_SinkIfStoneMask(this, globalCtx); + EnNeoReeba_HandleHit(this, play); + EnNeoReeba_UpdatePosition(this, play); + EnNeoReeba_SinkIfStoneMask(this, play); } -s32 EnNeoReeba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnNeoReeba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnNeoReeba* this = THIS; if ((limbIndex == OBJECT_RB_LIMB_03) && (this->rotationSpeed != 0.0f)) { @@ -728,21 +726,21 @@ s32 EnNeoReeba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnNeoReeba_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNeoReeba_Draw(Actor* thisx, PlayState* play) { EnNeoReeba* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x01, 255, 255, 255, 255); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnNeoReeba_OverrideLimbDraw, - NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnNeoReeba_OverrideLimbDraw, NULL, + &this->actor); + CLOSE_DISPS(play->state.gfxCtx); if (this->stunTimer > 0) { if (this->drawEffectType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { - EnNeoReeba_DrawFrozenEffects(this, globalCtx); + EnNeoReeba_DrawFrozenEffects(this, play); } else { - EnNeoReeba_DrawEffects(this, globalCtx); + EnNeoReeba_DrawEffects(this, play); } } } diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h index df6aaab1d0..a739d96db7 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.h @@ -8,7 +8,7 @@ struct EnNeoReeba; -typedef void (*EnNeoReebaActionFunc)(struct EnNeoReeba*, GlobalContext*); +typedef void (*EnNeoReebaActionFunc)(struct EnNeoReeba*, PlayState*); typedef struct EnNeoReeba { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c index 779de0b8ac..966f3671bc 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c @@ -10,10 +10,10 @@ #define THIS ((EnNimotsu*)thisx) -void EnNimotsu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNimotsu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNimotsu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNimotsu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNimotsu_Init(Actor* thisx, PlayState* play); +void EnNimotsu_Destroy(Actor* thisx, PlayState* play); +void EnNimotsu_Update(Actor* thisx, PlayState* play); +void EnNimotsu_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Nimotsu_InitVars = { 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 493666856b..09b617c3e3 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -11,26 +11,26 @@ #define THIS ((EnNiw*)thisx) -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_SetupIdle(EnNiw* this); -void EnNiw_Idle(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_Thrown(EnNiw* this, GlobalContext* globalCtx); +void EnNiw_Idle(EnNiw* this, PlayState* play); +void EnNiw_Thrown(EnNiw* this, PlayState* play); void EnNiw_SetupRunAway(EnNiw* this); -void EnNiw_RunAway(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_Swimming(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_Trigger(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_Upset(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_SetupCuccoStorm(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_CuccoStorm(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_SpawnAttackNiw(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_Held(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_UpdateFeather(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_CheckRage(EnNiw* this, GlobalContext* globalCtx); -void EnNiw_AnimateWingHead(EnNiw* this, GlobalContext* globalCtx, s16 animationState); +void EnNiw_RunAway(EnNiw* this, PlayState* play); +void EnNiw_Swimming(EnNiw* this, PlayState* play); +void EnNiw_Trigger(EnNiw* this, PlayState* play); +void EnNiw_Upset(EnNiw* this, PlayState* play); +void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play); +void EnNiw_CuccoStorm(EnNiw* this, PlayState* play); +void EnNiw_SpawnAttackNiw(EnNiw* this, PlayState* play); +void EnNiw_Held(EnNiw* this, PlayState* play); +void EnNiw_UpdateFeather(EnNiw* this, PlayState* play); +void EnNiw_DrawFeathers(EnNiw* this, PlayState* play); +void EnNiw_CheckRage(EnNiw* this, PlayState* play); +void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState); void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale); s16 sCuccoStormActive = false; @@ -112,7 +112,7 @@ static Vec3f D_808934E8 = { static s32 pad = 0; -void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Init(Actor* thisx, PlayState* play) { EnNiw* this = THIS; Vec3f dTemp = D_808934C4; @@ -129,7 +129,7 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(globalCtx, &this->skelanime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelanime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Math_Vec3f_Copy(&this->unk2A4, &this->actor.world.pos); Math_Vec3f_Copy(&this->unk2B0, &this->actor.world.pos); @@ -150,7 +150,7 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; if (this->niwType == NIW_TYPE_REGULAR) { - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); } if (this->niwType == NIW_TYPE_HELD) { @@ -169,11 +169,11 @@ void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Destroy(Actor* thisx, PlayState* play) { EnNiw* this = THIS; if (this->niwType == NIW_TYPE_REGULAR) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } @@ -182,7 +182,7 @@ void EnNiw_Destroy(Actor* thisx, GlobalContext* globalCtx) { * * AttackNiw has a copy of this function that it barely uses */ -void EnNiw_AnimateWingHead(EnNiw* this, GlobalContext* globalCtx, s16 animationState) { +void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { f32 tempOne = 1.0f; // hopefully fake match, but no luck if (this->unkTimer24C == 0) { @@ -288,7 +288,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, GlobalContext* globalCtx, s16 animationS } } -void EnNiw_SpawnAttackNiw(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_SpawnAttackNiw(EnNiw* this, PlayState* play) { f32 xView; f32 yView; f32 zView; @@ -296,13 +296,13 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, GlobalContext* globalCtx) { Actor* attackNiw; if (this->attackNiwSpawnTimer == 0 && this->attackNiwCount < 7) { - xView = globalCtx->view.at.x - globalCtx->view.eye.x; - yView = globalCtx->view.at.y - globalCtx->view.eye.y; - zView = globalCtx->view.at.z - globalCtx->view.eye.z; - newNiwPos.x = ((Rand_ZeroOne() - 0.5f) * xView) + globalCtx->view.eye.x; - newNiwPos.y = randPlusMinusPoint5Scaled(0.3f) + (globalCtx->view.eye.y + 50.0f + (yView * 0.5f)); - newNiwPos.z = ((Rand_ZeroOne() - 0.5f) * zView) + globalCtx->view.eye.z; - attackNiw = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ATTACK_NIW, newNiwPos.x, + xView = play->view.at.x - play->view.eye.x; + yView = play->view.at.y - play->view.eye.y; + zView = play->view.at.z - play->view.eye.z; + newNiwPos.x = ((Rand_ZeroOne() - 0.5f) * xView) + play->view.eye.x; + newNiwPos.y = randPlusMinusPoint5Scaled(0.3f) + (play->view.eye.y + 50.0f + (yView * 0.5f)); + newNiwPos.z = ((Rand_ZeroOne() - 0.5f) * zView) + play->view.eye.z; + attackNiw = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, newNiwPos.x, newNiwPos.y, newNiwPos.z, 0, 0, 0, ATTACK_NIW_REGULAR); if (attackNiw != NULL) { @@ -312,7 +312,7 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_UpdateRunning(EnNiw* this, GlobalContext* globalCtx, s32 isStormCucco) { +void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { f32 runningDirection; f32 targetRotY; f32* runningAngles = sRunningAngles; @@ -348,7 +348,7 @@ void EnNiw_UpdateRunning(EnNiw* this, GlobalContext* globalCtx, s32 isStormCucco targetRotY = this->yawTowardsPlayer + runningDirection; Math_SmoothStepToS(&this->actor.world.rot.y, targetRotY, 3, this->unk300, 0); Math_ApproachF(&this->unk300, 3000.0f, 1.0f, 500.0f); - EnNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); + EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); } void EnNiw_SetupIdle(EnNiw* this) { @@ -357,7 +357,7 @@ void EnNiw_SetupIdle(EnNiw* this) { this->actionFunc = EnNiw_Idle; } -void EnNiw_Idle(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Idle(EnNiw* this, PlayState* play) { f32 posX2; f32 posZ2; f32 posX1 = randPlusMinusPoint5Scaled(100.0f); @@ -365,7 +365,7 @@ void EnNiw_Idle(EnNiw* this, GlobalContext* globalCtx) { s16 nextAnimation; if (this->niwType == NIW_TYPE_REGULAR) { - if (Actor_HasParent(&this->actor, globalCtx)) { // picked up + if (Actor_HasParent(&this->actor, play)) { // picked up Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->sfxTimer1 = 30; this->heldTimer = 30; @@ -375,7 +375,7 @@ void EnNiw_Idle(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = EnNiw_Held; return; } else { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } else { // NIW_TYPE_UNK1 || NIW_TYPE_HELD this->unkIdleTimer2 = 10; @@ -446,10 +446,10 @@ void EnNiw_Idle(EnNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk304, 10000.0f, 1.0f, 1000.0f); } - EnNiw_AnimateWingHead(this, globalCtx, nextAnimation); + EnNiw_AnimateWingHead(this, play, nextAnimation); } -void EnNiw_Held(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Held(EnNiw* this, PlayState* play) { Vec3f vec3fcopy = D_808934DC; s16 rotZ; @@ -462,7 +462,7 @@ void EnNiw_Held(EnNiw* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.y; this->actor.shape.rot.z = (s16)randPlusMinusPoint5Scaled(5000.0f) + this->actor.world.rot.z; if (this->niwType == NIW_TYPE_REGULAR) { - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { this->actor.shape.rot.z = 0; rotZ = this->actor.shape.rot.z; this->niwState = NIW_STATE_FALLING; @@ -482,16 +482,16 @@ void EnNiw_Held(EnNiw* this, GlobalContext* globalCtx) { this->niwType = NIW_TYPE_REGULAR; this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Math_Vec3f_Copy(&this->unk2BC, &vec3fcopy); this->actor.flags |= ACTOR_FLAG_1; // targetable ON this->actionFunc = EnNiw_Thrown; } - EnNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } -void EnNiw_Thrown(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Thrown(EnNiw* this, PlayState* play) { if (this->unk2EC == 0) { if (this->actor.bgCheckFlags & 1) { // hit floor this->unk2EC = 1; @@ -516,7 +516,7 @@ void EnNiw_Thrown(EnNiw* this, GlobalContext* globalCtx) { } } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { // picked up again before could run off Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->sfxTimer1 = 30; @@ -528,19 +528,19 @@ void EnNiw_Thrown(EnNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } else { if (this->hoppingTimer > 5) { - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } - EnNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } } -void EnNiw_Swimming(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Swimming(EnNiw* this, PlayState* play) { Vec3f ripplePos; // even if hitting water, keep calling for reinforcements // this should just be in update if (this->isStormActive) { - EnNiw_SpawnAttackNiw(this, globalCtx); // spawn attack niw + EnNiw_SpawnAttackNiw(this, play); // spawn attack niw } this->actor.speedXZ = 2.0f; @@ -554,7 +554,7 @@ void EnNiw_Swimming(EnNiw* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&ripplePos, &this->actor.world.pos); ripplePos.y += this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 30); + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 30); } if (this->actor.bgCheckFlags & 8) { // hit a wall this->actor.velocity.y = 10.0f; // fly up in straight line @@ -584,10 +584,10 @@ void EnNiw_Swimming(EnNiw* this, GlobalContext* globalCtx) { } } - EnNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } -void EnNiw_Trigger(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Trigger(EnNiw* this, PlayState* play) { s32 state; // Possible Fake Match: the weird way this state is set @@ -600,7 +600,7 @@ void EnNiw_Trigger(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = EnNiw_Upset; } -void EnNiw_Upset(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_Upset(EnNiw* this, PlayState* play) { // assumption: CuccoStorm is split into smaller parts because it used to be a cutscene in OOT this->sfxTimer1 = 100; if (this->cuccoStormTimer == 0) { @@ -611,11 +611,11 @@ void EnNiw_Upset(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = EnNiw_SetupCuccoStorm; } - EnNiw_AnimateWingHead(this, globalCtx, this->nextAnimation); + EnNiw_AnimateWingHead(this, play, this->nextAnimation); } // the long crow with head back before they descend -void EnNiw_SetupCuccoStorm(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play) { f32 viewY; this->sfxTimer1 = 100; @@ -639,11 +639,11 @@ void EnNiw_SetupCuccoStorm(EnNiw* this, GlobalContext* globalCtx) { this->actionFunc = EnNiw_CuccoStorm; } - EnNiw_AnimateWingHead(this, globalCtx, this->nextAnimation); + EnNiw_AnimateWingHead(this, play, this->nextAnimation); } -void EnNiw_CuccoStorm(EnNiw* this, GlobalContext* globalCtx) { - EnNiw_SpawnAttackNiw(this, globalCtx); +void EnNiw_CuccoStorm(EnNiw* this, PlayState* play) { + EnNiw_SpawnAttackNiw(this, play); if (this->cuccoStormTimer == 1) { // not countdown to 0? mistype? this->actor.speedXZ = 3.0f; this->isRunningRight = Rand_ZeroFloat(1.99f); @@ -651,7 +651,7 @@ void EnNiw_CuccoStorm(EnNiw* this, GlobalContext* globalCtx) { this->unkTimer24E = this->generalTimer1; this->unkTimer24C = this->generalTimer1; } else { - EnNiw_UpdateRunning(this, globalCtx, true); + EnNiw_UpdateRunning(this, play, true); } } @@ -663,8 +663,8 @@ void EnNiw_SetupRunAway(EnNiw* this) { this->actor.speedXZ = 4.0f; } -void EnNiw_RunAway(EnNiw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnNiw_RunAway(EnNiw* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f tempVec3f = D_808934E8; s16 temp298; f32 dX; @@ -694,18 +694,18 @@ void EnNiw_RunAway(EnNiw* this, GlobalContext* globalCtx) { dZ = this->actor.world.pos.z - player->actor.world.pos.z; } this->yawTowardsPlayer = Math_Atan2S(dX, dZ); - EnNiw_UpdateRunning(this, globalCtx, false); - EnNiw_AnimateWingHead(this, globalCtx, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_UpdateRunning(this, play, false); + EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); } } -void EnNiw_LandBeforeIdle(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_LandBeforeIdle(EnNiw* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { // hit floor EnNiw_SetupIdle(this); } } -void EnNiw_CheckRage(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_CheckRage(EnNiw* this, PlayState* play) { if (!this->isStormActive && this->iframeTimer == 0 && this->niwType == NIW_TYPE_REGULAR) { // is this used? this is before we even know if we've been hit @@ -759,11 +759,11 @@ void EnNiw_CheckRage(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNiw_Update(Actor* thisx, PlayState* play) { EnNiw* this = THIS; s8 pad0; s16 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 pad1; s16 featherCount; Vec3f pos; @@ -815,7 +815,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk29E = 0; } - EnNiw_UpdateFeather(this, globalCtx); + EnNiw_UpdateFeather(this, play); DECR(this->unkTimer24C); DECR(this->unkTimer24E); @@ -831,25 +831,25 @@ void EnNiw_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_SetFocus(&this->actor, this->unk308); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1F); // if cucco is off the map if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= BGCHECK_Y_MAX) { Vec3f viewAtToEye; // Direction vector for the direction the camera is facing - viewAtToEye.x = globalCtx->view.at.x - globalCtx->view.eye.x; - viewAtToEye.y = globalCtx->view.at.y - globalCtx->view.eye.y; - viewAtToEye.z = globalCtx->view.at.z - globalCtx->view.eye.z; + viewAtToEye.x = play->view.at.x - play->view.eye.x; + viewAtToEye.y = play->view.at.y - play->view.eye.y; + viewAtToEye.z = play->view.at.z - play->view.eye.z; viewAtToEyeNormY = viewAtToEye.y / sqrtf(SQXYZ(viewAtToEye)); this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = this->actor.home.pos.y + globalCtx->view.eye.y + (viewAtToEyeNormY * 160.0f); + this->actor.world.pos.y = this->actor.home.pos.y + play->view.eye.y + (viewAtToEyeNormY * 160.0f); if (this->actor.world.pos.y < this->actor.home.pos.y) { this->actor.world.pos.y = this->actor.home.pos.y + 300.0f; @@ -895,7 +895,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&pos, &this->actor.world.pos); pos.y += this->actor.depthInWater; this->swimRippleTimer = 30; - EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); + EffectSsGSplash_Spawn(play, &pos, 0, 0, 0, 400); this->generalTimer2 = 0; this->niwState = NIW_STATE_SWIMMING; this->actionFunc = EnNiw_Swimming; @@ -903,10 +903,10 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->isStormActive && (this->actor.xyzDistToPlayerSq < SQ(dist)) && player->invincibilityTimer == 0) { - func_800B8D50(globalCtx, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); + func_800B8D50(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); } - EnNiw_CheckRage(this, globalCtx); + EnNiw_CheckRage(this, play); if (this->flutterSfxTimer == 0 && this->niwState == NIW_STATE_HELD) { this->flutterSfxTimer = 7; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); @@ -924,17 +924,17 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if (!this->isStormActive && this->niwType == NIW_TYPE_REGULAR) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if (globalCtx) {} + if (play) {} if (this->niwState != NIW_STATE_HELD && this->niwState != NIW_STATE_FALLING) { - 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, Actor* thisx) { +s32 EnNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnNiw* this = THIS; if (limbIndex == NIW_LIMB_UPPER_BODY) { @@ -956,13 +956,13 @@ 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 = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, EnNiw_OverrideLimbDraw, NULL, &this->actor); - EnNiw_DrawFeathers(this, globalCtx); + EnNiw_DrawFeathers(this, play); } void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale) { @@ -984,7 +984,7 @@ void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s } } -void EnNiw_UpdateFeather(EnNiw* this, GlobalContext* globalCtx) { +void EnNiw_UpdateFeather(EnNiw* this, PlayState* play) { EnNiwFeather* feather = &this->feathers[0]; f32 featherVelocityGoal = 0.05f; s16 i; @@ -1016,14 +1016,14 @@ void EnNiw_UpdateFeather(EnNiw* this, GlobalContext* globalCtx) { } } -void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnNiw_DrawFeathers(EnNiw* this, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; u8 isMaterialApplied = false; EnNiwFeather* feather = &this->feathers[0]; s16 i; OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->isEnabled == true) { @@ -1034,7 +1034,7 @@ void EnNiw_DrawFeathers(EnNiw* this, GlobalContext* globalCtx) { } Matrix_Translate(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(feather->scale, feather->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZF(feather->zRot, 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 7c8b3e07e8..aaa3c0fe68 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 isEnabled; diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c index 1400e3c067..7f1fe790fb 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c @@ -11,15 +11,15 @@ #define THIS ((EnNnh*)thisx) -void EnNnh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnNnh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnNnh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnNnh_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnNnh_Init(Actor* thisx, PlayState* play); +void EnNnh_Destroy(Actor* thisx, PlayState* play); +void EnNnh_Update(Actor* thisx, PlayState* play); +void EnNnh_Draw(Actor* thisx, PlayState* play); void func_80C08828(EnNnh* this); -void func_80C0883C(EnNnh* this, GlobalContext* globalCtx); +void func_80C0883C(EnNnh* this, PlayState* play); void func_80C088A4(EnNnh* this); -void func_80C088B8(EnNnh* this, GlobalContext* globalCtx); +void func_80C088B8(EnNnh* this, PlayState* play); const ActorInit En_Nnh_InitVars = { ACTOR_EN_NNH, @@ -53,61 +53,61 @@ static ColliderCylinderInit sCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -void EnNnh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNnh_Init(Actor* thisx, PlayState* play) { EnNnh* this = THIS; 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); this->actor.targetMode = 1; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; func_80C08828(this); } -void EnNnh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNnh_Destroy(Actor* thisx, PlayState* play) { EnNnh* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80C08828(EnNnh* this) { this->actionFunc = func_80C0883C; } -void func_80C0883C(EnNnh* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x228U, &this->actor); +void func_80C0883C(EnNnh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x228U, &this->actor); func_80C088A4(this); return; } - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } void func_80C088A4(EnNnh* this) { this->actionFunc = func_80C088B8; } -void func_80C088B8(EnNnh* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80C088B8(EnNnh* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { func_80C08828(this); } } -void EnNnh_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNnh_Update(Actor* thisx, PlayState* play) { EnNnh* this = THIS; s32 pad; - 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); } -void EnNnh_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnNnh_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; func_8012C28C(gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfxCtx->polyOpa.p++, object_nnh_DL_001510); } diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.h b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.h index a006f10246..344ccb3459 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.h +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.h @@ -5,7 +5,7 @@ struct EnNnh; -typedef void (*EnNnhActionFunc)(struct EnNnh*, GlobalContext*); +typedef void (*EnNnhActionFunc)(struct EnNnh*, PlayState*); typedef struct EnNnh { /* 0x000 */ 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 87100d17f2..36fea369b0 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -12,10 +12,10 @@ #define THIS ((EnNutsball*)thisx) -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 EnNutsball_InitColliderParams(EnNutsball* this); @@ -51,11 +51,11 @@ static ColliderCylinderInit sCylinderInit = { { 13, 13, 0, { 0, 0, 0 } }, }; -void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Init(Actor* thisx, PlayState* play) { EnNutsball* this = THIS; ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.shape.rot.y = 0; this->actor.speedXZ = 10.0f; if (this->actor.params == 2) { @@ -74,9 +74,9 @@ void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNutsball_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Destroy(Actor* thisx, PlayState* play) { EnNutsball* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnNutsball_InitColliderParams(EnNutsball* this) { @@ -86,10 +86,10 @@ void EnNutsball_InitColliderParams(EnNutsball* this) { this->collider.info.toucher.damage = 2; } -void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnNutsball_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnNutsball* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f worldPos; Vec3s worldRot; Vec3f spawnBurstPos; @@ -119,11 +119,11 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx2) { spawnBurstPos.x = this->actor.world.pos.x; spawnBurstPos.y = this->actor.world.pos.y + 4.0f; spawnBurstPos.z = this->actor.world.pos.z; - EffectSsHahen_SpawnBurst(globalCtx, &spawnBurstPos, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &spawnBurstPos, 6.0f, 0, 7, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); if (this->actor.params == 1) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_NUTS_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_NUTS_BROKEN); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK); } Actor_MarkForDeath(&this->actor); } @@ -135,14 +135,14 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_MoveWithoutGravity(&this->actor); Math_Vec3f_Copy(&worldPos, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 5.0f, 10.0f, 0x7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 5.0f, 10.0f, 0x7); if (this->actor.bgCheckFlags & 8) { - if (func_800C9A4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) { + if (func_800C9A4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) { this->actor.bgCheckFlags &= ~8; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.prevPos, &worldPos, &this->actor.world.pos, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &worldPos, &this->actor.world.pos, &poly, true, false, false, true, &bgId)) { - if (func_800C9A4C(&globalCtx->colCtx, poly, bgId) & 0x30) { + if (func_800C9A4C(&play->colCtx, poly, bgId) & 0x30) { this->actor.world.pos.x += this->actor.velocity.x * 0.01f; this->actor.world.pos.z += this->actor.velocity.z * 0.01f; } else { @@ -157,23 +157,23 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.flags |= ACTOR_FLAG_1000000; - 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); if (this->timer < this->timerThreshold) { - CollisionCheck_SetOC(globalCtx, &globalCtx2->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play2->colChkCtx, &this->collider.base); } } } -void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNutsball_Draw(Actor* thisx, PlayState* play) { EnNutsball* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(this->actor.home.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_058BA0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 8d254b7287..2bfb7da1d1 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -15,22 +15,22 @@ #define THIS ((EnNwc*)thisx) -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_LoadNiwSkeleton(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_CrowAtTheEnd(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_Follow(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_HopForward(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_RunAway(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_Turn(EnNwc* this, GlobalContext* globalCtx); -void EnNwc_CheckForBreman(EnNwc* this, GlobalContext* globalCtx); +void EnNwc_LoadNiwSkeleton(EnNwc* this, PlayState* play); +void EnNwc_CrowAtTheEnd(EnNwc* this, PlayState* play); +void EnNwc_Follow(EnNwc* this, PlayState* play); +void EnNwc_HopForward(EnNwc* this, PlayState* play); +void EnNwc_RunAway(EnNwc* this, PlayState* play); +void EnNwc_Turn(EnNwc* this, PlayState* play); +void EnNwc_CheckForBreman(EnNwc* this, PlayState* play); -void EnNwc_DrawAdultBody(Actor* thisx, GlobalContext* globalCtx); -s32 EnNwc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -EnHs* EnNwc_FindGrog(GlobalContext* globalCtx); +void EnNwc_DrawAdultBody(Actor* thisx, PlayState* play); +s32 EnNwc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +EnHs* EnNwc_FindGrog(PlayState* play); enum EnNiwState { /* -1 */ NWC_STATE_NIW_LOADED = -1, // set after loading object_niw @@ -57,11 +57,11 @@ Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; -void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Init(Actor* thisx, PlayState* play) { s32 niwObjectIndex; EnNwc* this = THIS; - niwObjectIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_NIW); + niwObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_NIW); if (niwObjectIndex < 0) { // niw object does not exist, we need it for tranformation, despawn Actor_MarkForDeath(&this->actor); @@ -70,7 +70,7 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { if (gSaveContext.save.weekEventReg[25] & 8) { // if breman mask was already used, replace with adult EnNiw - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, NIW_TYPE_REGULAR); Actor_MarkForDeath(&this->actor); return; @@ -78,7 +78,7 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { this->niwObjectIndex = niwObjectIndex; this->nwcObjectIndex = this->actor.objBankIndex; - this->grog = EnNwc_FindGrog(globalCtx); + this->grog = EnNwc_FindGrog(play); this->footRotY = this->footRotZ = 0; Actor_SetScale(&this->actor, 0.01f); @@ -90,18 +90,18 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } -void EnNwc_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Destroy(Actor* thisx, PlayState* play) { EnNwc* this = THIS; } -void EnNwc_SpawnDust(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_SpawnDust(EnNwc* this, PlayState* play) { Vec3f pos; Vec3f vec5; Vec3f vel; Vec3f accel; s16 yaw; s16 pitch; - Vec3f eye = GET_ACTIVE_CAM(globalCtx)->eye; + Vec3f eye = GET_ACTIVE_CAM(play)->eye; s32 i; yaw = Math_Vec3f_Yaw(&eye, &this->actor.world.pos); @@ -121,12 +121,12 @@ void EnNwc_SpawnDust(EnNwc* this, GlobalContext* globalCtx) { pos.y = vec5.y + vel.y; pos.z = vec5.z + vel.z; - func_800B0F80(globalCtx, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); + func_800B0F80(play, &pos, &vel, &accel, &sPrimColor, &sEnvColor, 300, 30, 10); } } -EnHs* EnNwc_FindGrog(GlobalContext* globalCtx) { - Actor* grogSearch = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +EnHs* EnNwc_FindGrog(PlayState* play) { + Actor* grogSearch = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (grogSearch != NULL) { if (grogSearch->id == ACTOR_EN_HS) { @@ -138,8 +138,8 @@ EnHs* EnNwc_FindGrog(GlobalContext* globalCtx) { return NULL; } -s32 EnNwc_PlayerReleasedBremanMarch(EnNwc* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnNwc_PlayerReleasedBremanMarch(EnNwc* this, PlayState* play) { + Player* player = GET_PLAYER(play); // Weird: home.rot.x holds count of chicks having transformed into adult. // Weird: Its incremented by 1 unlike chicks following, so it should max at 10. @@ -158,8 +158,8 @@ s32 EnNwc_PlayerReleasedBremanMarch(EnNwc* this, GlobalContext* globalCtx) { * Summary: Checks 1) if grog exists, 2) player is using breman mask, 3) and within range. * Used to identify if the chick should be captured by breman mask. */ -s32 EnNwc_IsFound(EnNwc* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnNwc_IsFound(EnNwc* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->grog == NULL) { return false; @@ -219,8 +219,8 @@ void EnNwc_ToggleState(EnNwc* this) { } } -void EnNwc_CheckFound(EnNwc* this, GlobalContext* globalCtx) { - if (EnNwc_IsFound(this, globalCtx)) { +void EnNwc_CheckFound(EnNwc* this, PlayState* play) { + if (EnNwc_IsFound(this, play)) { u8 currentChickCount = (this->grog->actor.home.rot.z / 2); if (currentChickCount > 9) { @@ -240,21 +240,21 @@ void EnNwc_CheckFound(EnNwc* this, GlobalContext* globalCtx) { } } -void EnNwc_LoadNiwSkeleton(EnNwc* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->niwObjectIndex)) { - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->niwObjectIndex].segment); +void EnNwc_LoadNiwSkeleton(EnNwc* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->niwObjectIndex)) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->niwObjectIndex].segment); - SkelAnime_InitFlex(globalCtx, &this->niwSkeleton, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, - this->morphTable, NIW_LIMB_MAX); + SkelAnime_InitFlex(play, &this->niwSkeleton, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + NIW_LIMB_MAX); Animation_Change(&this->niwSkeleton, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), 0, 0.0f); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->nwcObjectIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->nwcObjectIndex].segment); this->state = NWC_STATE_NIW_LOADED; EnNwc_ToggleState(this); } } -void EnNwc_CrowAtTheEnd(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_CrowAtTheEnd(EnNwc* this, PlayState* play) { // I guess grog handles the scene transit? Math_SmoothStepToS(&this->upperBodyRotY, 0x2710, 2, 0x1B58, 0x3E8); Math_SmoothStepToS(&this->footRotZ, 0, 2, 0x1B58, 0x3E8); @@ -266,7 +266,7 @@ void EnNwc_CrowAtTheEnd(EnNwc* this, GlobalContext* globalCtx) { * * ActionFunc for NWC Type: NWC_STATE_FOLLOWING */ -void EnNwc_Follow(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_Follow(EnNwc* this, PlayState* play) { Vec3f* chickCoords = this->grog->nwcPos; Vec3f targetVector; s32 pad; @@ -305,7 +305,7 @@ void EnNwc_Follow(EnNwc* this, GlobalContext* globalCtx) { // it is our turn to transform this->hasGrownUp |= 1; this->grog->actor.home.rot.x += 2; // increment grog's adult tranformation counter - EnNwc_SpawnDust(this, globalCtx); + EnNwc_SpawnDust(this, play); Actor_SetScale(&this->actor, 0.002f); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_TO_CHICKEN); } @@ -337,14 +337,14 @@ void EnNwc_Follow(EnNwc* this, GlobalContext* globalCtx) { this->actor.world.rot.y = newRotY; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 0xBB8, 0xC8); - if (EnNwc_PlayerReleasedBremanMarch(this, globalCtx)) { + if (EnNwc_PlayerReleasedBremanMarch(this, play)) { this->grog->actor.home.rot.x = 0; // reset adult count this->grog->actor.home.rot.z = 0; // reset chick follow count EnNwc_ChangeState(this, NWC_STATE_RUNNING); if (this->hasGrownUp & 1) { - EnNwc_SpawnDust(this, globalCtx); + EnNwc_SpawnDust(this, play); } this->hasGrownUp &= ~1; @@ -369,7 +369,7 @@ void EnNwc_Follow(EnNwc* this, GlobalContext* globalCtx) { * * ActionFunc for NWC Type: NWC_STATE_HOPPING_FORWARD */ -void EnNwc_HopForward(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_HopForward(EnNwc* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { EnNwc_ToggleState(this); return; @@ -395,7 +395,7 @@ void EnNwc_HopForward(EnNwc* this, GlobalContext* globalCtx) { * * ActionFunc for NWC Type: NWC_STATE_RUNNING */ -void EnNwc_RunAway(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_RunAway(EnNwc* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { EnNwc_ToggleState(this); return; @@ -419,7 +419,7 @@ void EnNwc_RunAway(EnNwc* this, GlobalContext* globalCtx) { * * ActionFunc for NWC Type: NWC_STATE_TURNING */ -void EnNwc_Turn(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_Turn(EnNwc* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { EnNwc_ToggleState(this); return; @@ -446,20 +446,20 @@ void EnNwc_Turn(EnNwc* this, GlobalContext* globalCtx) { * * ActionFunc for NWC Type: NWC_STATE_CHECK_BREMAN */ -void EnNwc_CheckForBreman(EnNwc* this, GlobalContext* globalCtx) { +void EnNwc_CheckForBreman(EnNwc* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { EnNwc_ToggleState(this); } - EnNwc_CheckFound(this, globalCtx); + EnNwc_CheckFound(this, play); } -void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Update(Actor* thisx, PlayState* play) { EnNwc* this = THIS; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 5); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 5); + this->actionFunc(this, play); if (this->hasGrownUp & 1) { this->actor.objBankIndex = this->niwObjectIndex; this->actor.draw = EnNwc_DrawAdultBody; @@ -481,29 +481,29 @@ void EnNwc_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnNwc_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_Draw(Actor* thisx, PlayState* play) { TexturePtr eyeTextures[] = { gNwcEyeOpenTex, gNwcEyeClosedTex }; EnNwc* this = THIS; Gfx* dispHead; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); dispHead = POLY_OPA_DISP; gSPSegment(&dispHead[0], 0x08, Lib_SegmentedToVirtual(eyeTextures[this->blinkState])); - gSPMatrix(&dispHead[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&dispHead[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&dispHead[2], &gNwcBodyDL); POLY_OPA_DISP = &dispHead[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnNwc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnNwc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnNwc* this = THIS; if (limbIndex == NIW_LIMB_UPPER_BODY) { @@ -517,10 +517,10 @@ s32 EnNwc_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnNwc_DrawAdultBody(Actor* thisx, GlobalContext* globalCtx) { +void EnNwc_DrawAdultBody(Actor* thisx, PlayState* play) { EnNwc* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->niwSkeleton.skeleton, this->niwSkeleton.jointTable, - this->niwSkeleton.dListCount, EnNwc_OverrideLimbDraw, NULL, &this->actor); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->niwSkeleton.skeleton, this->niwSkeleton.jointTable, this->niwSkeleton.dListCount, + EnNwc_OverrideLimbDraw, NULL, &this->actor); } 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 3815852af4..8d2d34c6a7 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -8,7 +8,7 @@ struct EnNwc; -typedef void (*EnNwcActionFunc)(struct EnNwc*, GlobalContext*); +typedef void (*EnNwcActionFunc)(struct EnNwc*, PlayState*); typedef struct EnNwc { /* 0x000 */ 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 c87e30329f..426951a9c2 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 @@ -10,13 +10,13 @@ #define THIS ((EnOkarinaEffect*)thisx) -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 func_8096B104(EnOkarinaEffect* this, GlobalContext* globalCtx); -void func_8096B174(EnOkarinaEffect* this, GlobalContext* globalCtx); -void func_8096B1FC(EnOkarinaEffect* this, GlobalContext* globalCtx); +void func_8096B104(EnOkarinaEffect* this, PlayState* play); +void func_8096B174(EnOkarinaEffect* this, PlayState* play); +void func_8096B1FC(EnOkarinaEffect* this, PlayState* play); const ActorInit En_Okarina_Effect_InitVars = { ACTOR_EN_OKARINA_EFFECT, @@ -34,41 +34,41 @@ void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, EnOkarinaEffectActionFun this->actionFunc = actionFunc; } -void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play) { } -void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Init(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = THIS; - if (globalCtx->envCtx.unk_F2[1]) { + if (play->envCtx.unk_F2[1]) { Actor_MarkForDeath(&this->actor); } EnOkarinaEffect_SetupAction(this, func_8096B104); } -void func_8096B104(EnOkarinaEffect* this, GlobalContext* globalCtx) { +void func_8096B104(EnOkarinaEffect* this, PlayState* play) { this->unk144 = 0x50; - globalCtx->envCtx.unk_F2[4] = 0x3C; + play->envCtx.unk_F2[4] = 0x3C; D_801F4E70 = 501.0f; - globalCtx->envCtx.unk_E3 = 2; - func_800FD78C(globalCtx); + play->envCtx.unk_E3 = 2; + func_800FD78C(play); EnOkarinaEffect_SetupAction(this, func_8096B174); } -void func_8096B174(EnOkarinaEffect* this, GlobalContext* globalCtx) { +void func_8096B174(EnOkarinaEffect* this, PlayState* play) { DECR(this->unk144); - if (!globalCtx->pauseCtx.state && !globalCtx->gameOverCtx.state && !globalCtx->msgCtx.unk11F10 && - !FrameAdvance_IsEnabled(&globalCtx->state) && this->unk144 == 0) { + if (!play->pauseCtx.state && !play->gameOverCtx.state && !play->msgCtx.unk11F10 && + !FrameAdvance_IsEnabled(&play->state) && this->unk144 == 0) { EnOkarinaEffect_SetupAction(this, func_8096B1FC); } } -void func_8096B1FC(EnOkarinaEffect* this, GlobalContext* globalCtx) { - if (globalCtx->envCtx.unk_F2[4]) { - if ((globalCtx->state.frames & 3) == 0) { - --globalCtx->envCtx.unk_F2[4]; - if (globalCtx->envCtx.unk_F2[4] == 8) { - func_800FD858(globalCtx); +void func_8096B1FC(EnOkarinaEffect* this, PlayState* play) { + if (play->envCtx.unk_F2[4]) { + if ((play->state.frames & 3) == 0) { + --play->envCtx.unk_F2[4]; + if (play->envCtx.unk_F2[4] == 8) { + func_800FD858(play); } } } else { @@ -76,8 +76,8 @@ void func_8096B1FC(EnOkarinaEffect* this, GlobalContext* globalCtx) { } } -void EnOkarinaEffect_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } 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 36413efc78..67fa74b2c9 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 @@ -5,7 +5,7 @@ struct EnOkarinaEffect; -typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, GlobalContext*); +typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, PlayState*); typedef struct EnOkarinaEffect { /* 0x000 */ 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 5a54da7b12..23f7640a25 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 @@ -10,12 +10,12 @@ #define THIS ((EnOkarinaTag*)thisx) -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_8093E518(EnOkarinaTag* this, GlobalContext* globalCtx); -void func_8093E68C(EnOkarinaTag* this, GlobalContext* globalCtx); +void func_8093E518(EnOkarinaTag* this, PlayState* play); +void func_8093E68C(EnOkarinaTag* this, PlayState* play); #if 0 const ActorInit En_Okarina_Tag_InitVars = { 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 53b63236e1..38f19a6b14 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 @@ -5,7 +5,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 b11997b822..a0de8cc484 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -10,22 +10,22 @@ #define THIS ((EnOkuta*)thisx) -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 func_8086E52C(EnOkuta* this, GlobalContext* globalCtx); -void func_8086E658(EnOkuta* this, GlobalContext* globalCtx); -void func_8086E7E8(EnOkuta* this, GlobalContext* globalCtx); -void func_8086E948(EnOkuta* this, GlobalContext* globalCtx); -void func_8086EC00(EnOkuta* this, GlobalContext* globalCtx); -void func_8086EF14(EnOkuta* this, GlobalContext* globalCtx); -void func_8086EFE8(EnOkuta* this, GlobalContext* globalCtx); -void func_8086F434(EnOkuta* this, GlobalContext* globalCtx); -void func_8086F4B0(EnOkuta* this, GlobalContext* globalCtx); -void func_8086F57C(EnOkuta* this, GlobalContext* globalCtx); -void func_8086F694(EnOkuta* this, GlobalContext* globalCtx); +void func_8086E52C(EnOkuta* this, PlayState* play); +void func_8086E658(EnOkuta* this, PlayState* play); +void func_8086E7E8(EnOkuta* this, PlayState* play); +void func_8086E948(EnOkuta* this, PlayState* play); +void func_8086EC00(EnOkuta* this, PlayState* play); +void func_8086EF14(EnOkuta* this, PlayState* play); +void func_8086EFE8(EnOkuta* this, PlayState* play); +void func_8086F434(EnOkuta* this, PlayState* play); +void func_8086F4B0(EnOkuta* this, PlayState* play); +void func_8086F57C(EnOkuta* this, PlayState* play); +void func_8086F694(EnOkuta* this, PlayState* play); #if 0 const ActorInit En_Okuta_InitVars = { 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 1e2cfdd7d7..a4b30069a7 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h @@ -5,7 +5,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_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index c904cdd420..25b9c51606 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -10,9 +10,9 @@ #define THIS ((EnOnpuman*)thisx) -void EnOnpuman_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOnpuman_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOnpuman_Update(Actor* thisx, GlobalContext* globalCtx); +void EnOnpuman_Init(Actor* thisx, PlayState* play); +void EnOnpuman_Destroy(Actor* thisx, PlayState* play); +void EnOnpuman_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Onpuman_InitVars = { diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h index d38dc75f3f..fe20760bb2 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.h @@ -5,7 +5,7 @@ struct EnOnpuman; -typedef void (*EnOnpumanActionFunc)(struct EnOnpuman*, GlobalContext*); +typedef void (*EnOnpumanActionFunc)(struct EnOnpuman*, PlayState*); typedef struct EnOnpuman { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.c b/src/overlays/actors/ovl_En_Osk/z_en_osk.c index 20c0dd19d6..0180a2e671 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.c +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.c @@ -12,15 +12,15 @@ #define THIS ((EnOsk*)thisx) -void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOsk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOsk_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOsk_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOsk_Init(Actor* thisx, PlayState* play); +void EnOsk_Destroy(Actor* thisx, PlayState* play); +void EnOsk_Update(Actor* thisx, PlayState* play); +void EnOsk_Draw(Actor* thisx, PlayState* play); -void func_80BF5F60(EnOsk* this, GlobalContext* globalCtx); -void func_80BF61EC(EnOsk* this, GlobalContext* globalCtx); -void func_80BF656C(EnOsk* this, GlobalContext* globalCtx); -void func_80BF6A20(EnOsk* this, GlobalContext* globalCtx); +void func_80BF5F60(EnOsk* this, PlayState* play); +void func_80BF61EC(EnOsk* this, PlayState* play); +void func_80BF656C(EnOsk* this, PlayState* play); +void func_80BF6A20(EnOsk* this, PlayState* play); const ActorInit En_Osk_InitVars = { ACTOR_EN_OSK, @@ -58,7 +58,7 @@ Vec3f D_80BF7018 = { 0.0f, 0.5f, 0.0f }; Vec3f D_80BF7024 = { 0.0f, 0.0f, 0.0f }; -void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOsk_Init(Actor* thisx, PlayState* play) { EnOsk* this = THIS; Actor_SetScale(&this->actor, 0.013f); @@ -71,7 +71,7 @@ void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENOSK_GET_F(&this->actor)) { case ENOSK_1: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ikn_demo_Skel_007B48, &object_ikn_demo_Anim_006808, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ikn_demo_Skel_007B48, &object_ikn_demo_Anim_006808, this->jointTable, this->morphTable, 7); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_006808); this->actionFunc = func_80BF656C; @@ -79,7 +79,7 @@ void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENOSK_2: - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ikn_demo_Skel_00B490, &object_ikn_demo_Anim_009F00, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ikn_demo_Skel_00B490, &object_ikn_demo_Anim_009F00, this->jointTable, this->morphTable, 7); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_006808); this->actionFunc = func_80BF6A20; @@ -88,7 +88,7 @@ void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx) { default: Actor_SetScale(&this->actor, 0.017f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ikn_demo_Skel_0038F0, &object_ikn_demo_Anim_0000B8, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ikn_demo_Skel_0038F0, &object_ikn_demo_Anim_0000B8, this->jointTable, this->morphTable, 17); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_0000B8); this->actionFunc = func_80BF61EC; @@ -99,7 +99,7 @@ void EnOsk_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOsk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOsk_Destroy(Actor* thisx, PlayState* play) { } void func_80BF5E00(EnOsk* this, AnimationHeader** animations, s16 index, f32 morphFrame) { @@ -115,17 +115,17 @@ void func_80BF5E68(EnOsk* this, AnimationHeader** animations, s16 index, f32 pla this->unk_254 = index; } -void func_80BF5EBC(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF5EBC(EnOsk* this, PlayState* play) { Vec3f sp2C; sp2C.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x; sp2C.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z; sp2C.y = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.y; - func_800B3030(globalCtx, &sp2C, &D_80BF7018, &D_80BF7018, 100, 0, 2); + func_800B3030(play, &sp2C, &D_80BF7018, &D_80BF7018, 100, 0, 2); } -void func_80BF5F60(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF5F60(EnOsk* this, PlayState* play) { } void func_80BF5F70(EnOsk* this) { @@ -166,10 +166,10 @@ void func_80BF5F70(EnOsk* this) { } } -void func_80BF609C(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF609C(EnOsk* this, PlayState* play) { if (this->actor.draw != NULL) { if (this->actor.home.rot.z != 0) { - if (globalCtx->msgCtx.currentTextId == 0x1531) { + if (play->msgCtx.currentTextId == 0x1531) { this->actor.home.rot.z = 0; } } else { @@ -202,18 +202,16 @@ void func_80BF609C(EnOsk* this, GlobalContext* globalCtx) { } } -void func_80BF61EC(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF61EC(EnOsk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(globalCtx, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, this->unk_258)); - if (this->unk_256 != - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action) { - this->unk_256 = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action; + if (Cutscene_CheckActorAction(play, this->unk_258)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); + if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { + this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; func_80BF5F70(this); } - func_80BF609C(this, globalCtx); + func_80BF609C(this, play); } else { this->actor.draw = NULL; } @@ -222,7 +220,7 @@ void func_80BF61EC(EnOsk* this, GlobalContext* globalCtx) { if (this->actor.scale.x > 0.85f * 0.001f) { this->actor.scale.x -= 0.85f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); - func_80BF5EBC(this, globalCtx); + func_80BF5EBC(this, play); func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; @@ -306,7 +304,7 @@ void func_80BF6478(EnOsk* this) { } } -void func_80BF656C(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF656C(EnOsk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { switch (this->unk_254) { case 2: @@ -331,12 +329,10 @@ void func_80BF656C(EnOsk* this, GlobalContext* globalCtx) { } } - if (Cutscene_CheckActorAction(globalCtx, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, this->unk_258)); - if (this->unk_256 != - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action) { - this->unk_256 = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action; + if (Cutscene_CheckActorAction(play, this->unk_258)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); + if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { + this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; func_80BF6314(this); } func_80BF6478(this); @@ -353,7 +349,7 @@ void func_80BF656C(EnOsk* this, GlobalContext* globalCtx) { if (this->actor.scale.x > 0.65f * 0.001f) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); - func_80BF5EBC(this, globalCtx); + func_80BF5EBC(this, play); func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; @@ -441,7 +437,7 @@ void func_80BF68E0(EnOsk* this) { } } -void func_80BF6A20(EnOsk* this, GlobalContext* globalCtx) { +void func_80BF6A20(EnOsk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { switch (this->unk_254) { case 2: @@ -470,12 +466,10 @@ void func_80BF6A20(EnOsk* this, GlobalContext* globalCtx) { } } - if (Cutscene_CheckActorAction(globalCtx, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, this->unk_258)); - if (this->unk_256 != - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action) { - this->unk_256 = - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->unk_258)]->action; + if (Cutscene_CheckActorAction(play, this->unk_258)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); + if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { + this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; func_80BF67A8(this); } func_80BF68E0(this); @@ -487,7 +481,7 @@ void func_80BF6A20(EnOsk* this, GlobalContext* globalCtx) { if (this->actor.scale.x > 0.65f * 0.001f) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); - func_80BF5EBC(this, globalCtx); + func_80BF5EBC(this, play); func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { this->actor.draw = NULL; @@ -495,13 +489,13 @@ void func_80BF6A20(EnOsk* this, GlobalContext* globalCtx) { } } -void EnOsk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOsk_Update(Actor* thisx, PlayState* play) { EnOsk* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_80BF6C54(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80BF6C54(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnOsk* this = THIS; if (limbIndex == 1) { @@ -509,28 +503,28 @@ void func_80BF6C54(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnOsk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOsk_Draw(Actor* thisx, PlayState* play) { s32 pad; EnOsk* this = THIS; Gfx* gfx; Vec3f sp80; s32 pad2[4]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_PrimColor(globalCtx->state.gfxCtx, 0x80, 255, 255, 255, 255)); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_PrimColor(play->state.gfxCtx, 0x80, 255, 255, 255, 255)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, func_80BF6C54, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + func_80BF6C54, &this->actor); { s16 sp62; s16 sp60; Vec3f sp54; - sp54 = GET_ACTIVE_CAM(globalCtx)->eye; + sp54 = GET_ACTIVE_CAM(play)->eye; sp62 = Math_Vec3f_Yaw(&sp54, &this->actor.focus.pos); sp60 = -Math_Vec3f_Pitch(&sp54, &this->actor.focus.pos); @@ -542,7 +536,7 @@ void EnOsk_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.focus.pos.x + sp80.x, this->actor.focus.pos.y + sp80.y, sp80.z = this->actor.focus.pos.z + sp80.z, MTXMODE_NEW); - sp80.z = Math_SinS(globalCtx->gameplayFrames << 0xE); + sp80.z = Math_SinS(play->gameplayFrames << 0xE); sp80.z = ((sp80.z + 1.0f) * 0.1f) + 2.0f; Matrix_Scale(this->actor.scale.x * sp80.z, this->actor.scale.y * sp80.z, this->actor.scale.z * sp80.z, MTXMODE_APPLY); @@ -557,10 +551,10 @@ void EnOsk_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); gDPSetPrimColor(gfx++, 0, 0, 130, 0, 255, 100); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); POLY_XLU_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.h b/src/overlays/actors/ovl_En_Osk/z_en_osk.h index 9515e97059..32c27d29ff 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.h +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.h @@ -5,7 +5,7 @@ struct EnOsk; -typedef void (*EnOskActionFunc)(struct EnOsk*, GlobalContext*); +typedef void (*EnOskActionFunc)(struct EnOsk*, PlayState*); #define ENOSK_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index a214bd72f2..5a46d37f60 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -11,10 +11,10 @@ #define THIS ((EnOsn*)thisx) -void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOsn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOsn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOsn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOsn_Init(Actor* thisx, PlayState* play); +void EnOsn_Destroy(Actor* thisx, PlayState* play); +void EnOsn_Update(Actor* thisx, PlayState* play); +void EnOsn_Draw(Actor* thisx, PlayState* play); const ActorInit En_Osn_InitVars = { ACTOR_EN_OSN, @@ -105,21 +105,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 0, ICHAIN_STOP), }; -void func_80AD1634(EnOsn*, GlobalContext*); -void func_80AD16A8(EnOsn*, GlobalContext*); -void func_80AD14C8(EnOsn*, GlobalContext*); -void func_80AD19A0(EnOsn* this, GlobalContext* globalCtx); +void func_80AD1634(EnOsn*, PlayState*); +void func_80AD16A8(EnOsn*, PlayState*); +void func_80AD14C8(EnOsn*, PlayState*); +void func_80AD19A0(EnOsn* this, PlayState* play); -void func_80AD0830(EnOsn* this, GlobalContext* globalCtx) { +void func_80AD0830(EnOsn* this, PlayState* play) { 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; - 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 func_80AD08B0(GlobalContext* globalCtx) { - switch (Player_GetMask(globalCtx)) { +s32 func_80AD08B0(PlayState* play) { + switch (Player_GetMask(play)) { case PLAYER_MASK_GREAT_FAIRY: return 0x1FD6; case PLAYER_MASK_GIBDO: @@ -198,8 +198,8 @@ void func_80AD0AB0(EnOsn* this) { } } -s32 func_80AD0B38(EnOsn* this, GlobalContext* globalCtx) { - switch (Player_GetMask(globalCtx)) { +s32 func_80AD0B38(EnOsn* this, PlayState* play) { + switch (Player_GetMask(play)) { case PLAYER_MASK_GREAT_FAIRY: if (!(this->unk_1F6 & 1)) { this->unk_1F6 |= 1; @@ -331,8 +331,8 @@ s32 func_80AD0B38(EnOsn* this, GlobalContext* globalCtx) { return 0x1FCD; } -s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AD0E10(EnOsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (this->unk_1EA & 1) { @@ -396,7 +396,7 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { return 0x1FD0; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_NONE) { + if (Player_GetMask(play) == PLAYER_MASK_NONE) { if (this->unk_1EA & 2) { this->unk_1EA |= 0x20; if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && @@ -409,7 +409,7 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { return 0x1FC8; } - return func_80AD0B38(this, globalCtx); + return func_80AD0B38(this, play); } this->unk_1EA |= 0x20; @@ -421,7 +421,7 @@ s32 func_80AD0E10(EnOsn* this, GlobalContext* globalCtx) { return 0x1FAE; } -void func_80AD10FC(EnOsn* this, GlobalContext* globalCtx) { +void func_80AD10FC(EnOsn* this, PlayState* play) { switch (this->unk_1F4) { case 0x1FC8: this->unk_1F4 = 0x1FC9; @@ -457,7 +457,7 @@ void func_80AD10FC(EnOsn* this, GlobalContext* globalCtx) { case 0x1FD1: case 0x1FD2: - this->unk_1F4 = func_80AD08B0(globalCtx); + this->unk_1F4 = func_80AD08B0(play); break; case 0x1FD6: @@ -576,7 +576,7 @@ void func_80AD10FC(EnOsn* this, GlobalContext* globalCtx) { this->unk_1EA |= 0x20; } - Message_StartTextbox(globalCtx, this->unk_1F4, &this->actor); + Message_StartTextbox(play, this->unk_1F4, &this->actor); } void func_80AD1398(EnOsn* this) { @@ -592,8 +592,8 @@ void func_80AD1398(EnOsn* this) { } } -void func_80AD144C(EnOsn* this, GlobalContext* globalCtx) { - u32 sp1C = Flags_GetSwitch(globalCtx, 0); +void func_80AD144C(EnOsn* this, PlayState* play) { + u32 sp1C = Flags_GetSwitch(play, 0); this->cutscene = this->actor.cutscene; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); @@ -604,30 +604,30 @@ void func_80AD144C(EnOsn* this, GlobalContext* globalCtx) { } } -void func_80AD14C8(EnOsn* this, GlobalContext* globalCtx) { +void func_80AD14C8(EnOsn* this, PlayState* play) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE && !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80AD1634; } else if ((((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (temp_v1 < 0x4000)) && (temp_v1 > -0x4000)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); this->actor.textId = 0xFFFF; } } else { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - this->unk_1F4 = func_80AD0E10(this, globalCtx); - Message_StartTextbox(globalCtx, this->unk_1F4, &this->actor); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->unk_1F4 = func_80AD0E10(this, play); + Message_StartTextbox(play, this->unk_1F4, &this->actor); this->actionFunc = func_80AD19A0; } else if ((((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (temp_v1 < 0x4000)) && (temp_v1 > -0x4000)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } } -void func_80AD1634(EnOsn* this, GlobalContext* globalCtx) { +void func_80AD1634(EnOsn* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); this->actionFunc = func_80AD16A8; @@ -639,16 +639,16 @@ void func_80AD1634(EnOsn* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } -void func_80AD16A8(EnOsn* this, GlobalContext* globalCtx) { +void func_80AD16A8(EnOsn* this, PlayState* play) { u8 pad; s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 130)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 130); + if (Cutscene_CheckActorAction(play, 130)) { + actionIndex = Cutscene_GetActorActionIndex(play, 130); this->unk_1F0 = 0; - if (this->unk_1ED != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->unk_1ED = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (this->unk_1ED != play->csCtx.actorActions[actionIndex]->action) { + this->unk_1ED = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_1EC = 2; break; @@ -719,8 +719,8 @@ void func_80AD16A8(EnOsn* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_1EC); } - if ((this->unk_1EC == 5) && (globalCtx->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && - (globalCtx->csCtx.frames == 400)) { + if ((this->unk_1EC == 5) && (play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && + (play->csCtx.frames == 400)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_OMVO00); } if (this->unk_1EC == 0x12) { @@ -738,41 +738,41 @@ void func_80AD16A8(EnOsn* this, GlobalContext* globalCtx) { (Animation_OnFrame(&this->skelAnime, 57.0f)) || (Animation_OnFrame(&this->skelAnime, 67.0f)))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OMENYA_WALK); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } else { this->unk_1F0 = 1; this->unk_1ED = 0x63; - func_80AD144C(this, globalCtx); + func_80AD144C(this, play); } } -void func_80AD19A0(EnOsn* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80AD19A0(EnOsn* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); - if ((temp_v0 == 6 || temp_v0 == 5) && Message_ShouldAdvance(globalCtx)) { + if ((temp_v0 == 6 || temp_v0 == 5) && Message_ShouldAdvance(play)) { if (this->unk_1EA & 0x20) { this->unk_1EA &= ~0x20; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80AD14C8; } else { - func_80AD10FC(this, globalCtx); + func_80AD10FC(this, play); } } } -void EnOsn_Idle(EnOsn* this, GlobalContext* globalCtx) { +void EnOsn_Idle(EnOsn* this, PlayState* play) { } -void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOsn_Init(Actor* thisx, PlayState* play) { s32 pad; EnOsn* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_osn_Skel_0202F0, &object_osn_Anim_0201BC, 0, 0, 0); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_osn_Skel_0202F0, &object_osn_Anim_0201BC, 0, 0, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_1FA = 255; switch (ENOSN_GET_3(&this->actor)) { @@ -782,7 +782,7 @@ void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1EA |= 1; } this->unk_1F0 = 1; - if (globalCtx->sceneNum == SCENE_INSIDETOWER) { + if (play->sceneNum == SCENE_INSIDETOWER) { if ((gSaveContext.save.entranceIndex == 0xC020) || (gSaveContext.save.entranceIndex == 0xC060)) { this->actionFunc = func_80AD16A8; return; @@ -792,10 +792,10 @@ void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80AD1634; return; } - func_80AD144C(this, globalCtx); + func_80AD144C(this, play); return; } - func_80AD144C(this, globalCtx); + func_80AD144C(this, play); break; case 1: @@ -820,36 +820,36 @@ void EnOsn_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOsn_Destroy(Actor* thisx, PlayState* play) { EnOsn* this = THIS; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnOsn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOsn_Update(Actor* thisx, PlayState* play) { s32 pad; EnOsn* this = THIS; u32 sp34; - sp34 = Flags_GetSwitch(globalCtx, 0); - this->actionFunc(this, globalCtx); + sp34 = Flags_GetSwitch(play, 0); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); SkelAnime_Update(&this->skelAnime); if (!(ENOSN_GET_3(&this->actor))) { if (sp34 != 0) { this->actor.flags |= ACTOR_FLAG_1; - func_80AD0830(this, globalCtx); + func_80AD0830(this, play); this->actor.draw = EnOsn_Draw; } else { this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; } } - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos); } -s32 EnOsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnOsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnOsn* this = (EnOsn*)thisx; @@ -862,7 +862,7 @@ s32 EnOsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnOsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnOsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnOsn* this = (EnOsn*)thisx; Vec3f sp30 = { 0.0f, 0.0f, 0.0f }; Vec3s sp28 = { 0x9920, -0x384, -0x320 }; @@ -877,13 +877,13 @@ void EnOsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Matrix_RotateYS(sp28.y, MTXMODE_APPLY); Matrix_RotateZS(sp28.z, MTXMODE_APPLY); - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, &object_osn_DL_0192A0); Matrix_Pop(); } } -void EnOsn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOsn_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80AD2588 = object_osn_Tex_0166F8; static TexturePtr D_80AD258C = object_osn_Tex_016EF8; static TexturePtr D_80AD2590 = object_osn_Tex_0176F8; @@ -892,12 +892,12 @@ void EnOsn_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnOsn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_1FA == 0xFF) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if ((this->unk_1EC == 0xB) || (this->unk_1EC == 0xC) || (this->unk_1EC == 0x17) || - (globalCtx->msgCtx.currentTextId == 0x1FCA)) { + (play->msgCtx.currentTextId == 0x1FCA)) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AD258C)); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80AD2594)); } else if ((this->unk_1EC == 7) || (this->unk_1EC == 3) || (this->unk_1EC == 0xD)) { @@ -908,20 +908,20 @@ void EnOsn_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80AD2594)); } gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnOsn_OverrideLimbDraw, EnOsn_PostLimbDraw, - &this->actor, POLY_OPA_DISP); + Scene_SetRenderModeXlu(play, 0, 1); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnOsn_OverrideLimbDraw, EnOsn_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AD2588)); gSPSegment(POLY_XLU_DISP++, 0x09, Lib_SegmentedToVirtual(D_80AD2594)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->unk_1FA); - Scene_SetRenderModeXlu(globalCtx, 1, 2); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnOsn_OverrideLimbDraw, EnOsn_PostLimbDraw, - &this->actor, POLY_XLU_DISP); + Scene_SetRenderModeXlu(play, 1, 2); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnOsn_OverrideLimbDraw, EnOsn_PostLimbDraw, &this->actor, POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.h b/src/overlays/actors/ovl_En_Osn/z_en_osn.h index 4cb99b9250..4cfacae8bc 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.h +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.h @@ -5,7 +5,7 @@ struct EnOsn; -typedef void (*EnOsnActionFunc)(struct EnOsn*, GlobalContext*); +typedef void (*EnOsnActionFunc)(struct EnOsn*, PlayState*); typedef struct EnOsn { /* 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 95c75b24bf..796f6e0181 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -14,41 +14,41 @@ #define LOOKED_AT_PLAYER (1 << 0) #define END_INTERACTION (1 << 1) -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_Update(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_CuriosityShopMan_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnOssan_PartTimeWorker_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play); +void EnOssan_PartTimeWorker_Draw(Actor* thisx, PlayState* play); -void EnOssan_CuriosityShopMan_Init(EnOssan* this, GlobalContext* globalCtx); -u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_CuriosityShopMan_Init(EnOssan* this, PlayState* play); +u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play); -void EnOssan_PartTimeWorker_Init(EnOssan* this, GlobalContext* globalCtx); -u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_PartTimeWorker_Init(EnOssan* this, PlayState* play); +u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, PlayState* play); -void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_InitShop(EnOssan* this, PlayState* play); +void EnOssan_Idle(EnOssan* this, PlayState* play); +void EnOssan_BeginInteraction(EnOssan* this, PlayState* play); +void EnOssan_Hello(EnOssan* this, PlayState* play); void EnOssan_SetHaveMet(EnOssan* this); -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this); -void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_TalkToShopkeeper(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_SelectItem(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_BuyItemWithFanfare(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_CannotBuy(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_CanBuy(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_SetupItemPurchased(EnOssan* this, GlobalContext* globalCtx); -void EnOssan_ItemPurchased(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_StartShopping(PlayState* play, EnOssan* this); +void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play); +void EnOssan_TalkToShopkeeper(EnOssan* this, PlayState* play); +void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play); +void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play); +void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play); +void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play); +void EnOssan_SelectItem(EnOssan* this, PlayState* play); +void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play); +void EnOssan_CannotBuy(EnOssan* this, PlayState* play); +void EnOssan_CanBuy(EnOssan* this, PlayState* play); +void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play); +void EnOssan_ItemPurchased(EnOssan* this, PlayState* play); void EnOssan_ResetItemPosition(EnOssan* this); void EnOssan_Blink(EnOssan* this); -void EnOssan_GetCutscenes(EnOssan* this, GlobalContext* globalCtx); +void EnOssan_GetCutscenes(EnOssan* this, PlayState* play); s32 EnOssan_ReturnItemToShelf(EnOssan* this); s32 EnOssan_TakeItemOffShelf(EnOssan* this); @@ -195,15 +195,15 @@ void EnOssan_SetupAction(EnOssan* this, EnOssanActionFunc action) { this->actionFunc = action; } -s32 EnOssan_TestItemSelected(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 EnOssan_TestItemSelected(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CUP); } void EnOssan_CheckValidSpawn(EnOssan* this) { @@ -231,8 +231,8 @@ void EnOssan_CheckValidSpawn(EnOssan* this) { } } -void EnOssan_RotateHead(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_RotateHead(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.params == ENOSSAN_PART_TIME_WORKER) { if (player->transformation == PLAYER_FORM_ZORA) { @@ -248,20 +248,20 @@ void EnOssan_RotateHead(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_SpawnShopItems(EnOssan* this, GlobalContext* globalCtx, ShopItem* shop) { +void EnOssan_SpawnShopItems(EnOssan* this, PlayState* play, ShopItem* shop) { s32 i; for (i = 0; i < ARRAY_COUNT(this->items); i++, shop++) { if (shop->shopItemId < 0) { this->items[i] = NULL; } else { - this->items[i] = (EnGirlA*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, shop->spawnPos.x, + this->items[i] = (EnGirlA*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GIRLA, shop->spawnPos.x, shop->spawnPos.y, shop->spawnPos.z, 0, 0, 0, shop->shopItemId); } } } -void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = THIS; s16 id; @@ -271,7 +271,7 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { return; } id = sObjectIds[this->actor.params]; - this->objIndex = Object_GetIndex(&globalCtx->objectCtx, id); + this->objIndex = Object_GetIndex(&play->objectCtx, id); if (this->objIndex < 0) { Actor_MarkForDeath(&this->actor); return; @@ -281,34 +281,34 @@ void EnOssan_Init(Actor* thisx, GlobalContext* globalCtx) { EnOssan_SetupAction(this, EnOssan_InitShop); } -void EnOssan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Destroy(Actor* thisx, PlayState* play) { EnOssan* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + 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->items[this->cursorIdx]->actor, &x, &y); + Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y); this->cursorPos.x = x; this->cursorPos.y = 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); - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_ProcessTalkRequest(&this->actor, &play->state); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; player->stateFlags2 &= ~0x20000000; - globalCtx->interfaceCtx.unk_222 = 0; - globalCtx->interfaceCtx.unk_224 = 0; + play->interfaceCtx.unk_222 = 0; + play->interfaceCtx.unk_224 = 0; if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; @@ -321,51 +321,51 @@ void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) { } } -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; } 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->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); return true; } return false; } -void EnOssan_SetupStartShopping(GlobalContext* globalCtx, EnOssan* this, u8 skipHello) { - func_8011552C(globalCtx, 0x10); +void EnOssan_SetupStartShopping(PlayState* play, EnOssan* this, u8 skipHello) { + func_8011552C(play, 0x10); if (!skipHello) { EnOssan_SetupAction(this, EnOssan_Hello); } else { - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_StartShopping(PlayState* play, EnOssan* this) { EnOssan_SetupAction(this, EnOssan_FaceShopkeeper); - func_80151938(globalCtx, 0x640); - func_8011552C(globalCtx, 6); + func_80151938(play, 0x640); + func_8011552C(play, 6); this->stickRightPrompt.isEnabled = true; this->stickLeftPrompt.isEnabled = true; } -void EnOssan_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_SetupLookToShopkeeperFromShelf(PlayState* play, EnOssan* this) { play_sound(NA_SE_SY_CURSOR); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_LookToShopkeeperFromShelf); } -void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_Idle(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - SubS_FillLimbRotTables(globalCtx, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->stateFlags2 |= 0x20000000; EnOssan_SetupAction(this, EnOssan_BeginInteraction); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { @@ -380,7 +380,7 @@ void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 100.0f && (player->actor.world.pos.x >= -40.0f && player->actor.world.pos.x <= 40.0f) && (player->actor.world.pos.z >= -91.0f && player->actor.world.pos.z <= -60.0f)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } if (this->actor.params == ENOSSAN_PART_TIME_WORKER) { Math_SmoothStepToS(&this->headRotPartTimeWorker.y, 8000, 3, 2000, 0); @@ -388,7 +388,7 @@ void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { AnimationInfoS* animations = sAnimations[this->actor.params]; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(animations[this->animationIndex].animation); @@ -413,7 +413,7 @@ void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) { break; case FSN_ANIMATION_TURN_AROUND_FORWARD: EnOssan_SetHaveMet(this); - this->textId = EnOssan_CuriosityShopMan_GetWelcome(this, globalCtx); + this->textId = EnOssan_CuriosityShopMan_GetWelcome(this, play); SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, this->animationIndex); break; case FSN_ANIMATION_HANDS_ON_COUNTER_START: @@ -422,8 +422,8 @@ void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) { case FSN_ANIMATION_SLAM_COUNTER_START: this->animationIndex++; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, this->animationIndex); - Message_StartTextbox(globalCtx, this->textId, &this->actor); - EnOssan_SetupStartShopping(globalCtx, this, false); + Message_StartTextbox(play, this->textId, &this->actor); + EnOssan_SetupStartShopping(play, this, false); break; case FSN_ANIMATION_HANDS_ON_COUNTER_LOOP: case FSN_ANIMATION_HAND_ON_FACE_LOOP: @@ -446,15 +446,15 @@ void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx) { } } else { EnOssan_SetHaveMet(this); - this->textId = EnOssan_PartTimerWorker_GetWelcome(this, globalCtx); - Message_StartTextbox(globalCtx, this->textId, &this->actor); - EnOssan_SetupStartShopping(globalCtx, this, false); + this->textId = EnOssan_PartTimerWorker_GetWelcome(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + EnOssan_SetupStartShopping(play, this, false); } } -void EnOssan_UpdateJoystickInputState(GlobalContext* globalCtx, EnOssan* this) { - s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; - s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; +void EnOssan_UpdateJoystickInputState(PlayState* play, EnOssan* this) { + s8 stickX = CONTROLLER1(&play->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&play->state)->rel.stick_y; this->moveHorizontal = this->moveVertical = false; @@ -556,32 +556,32 @@ u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIdx, u8 shelfSlotMax) { return CURSOR_INVALID; } -void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_Hello(EnOssan* this, PlayState* play) { AnimationInfoS* animations = sAnimations[this->actor.params]; - u8 talkState = Message_GetState(&globalCtx->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - EnOssan_RotateHead(this, globalCtx); - if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + EnOssan_RotateHead(this, play); + if (talkState == 5 && Message_ShouldAdvance(play)) { if ((this->animationIndex == ANI_ANIMATION_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { this->animationIndex = ANI_ANIMATION_STANDING_NORMAL_LOOP_2; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 1); } this->flags &= ~LOOKED_AT_PLAYER; if (player->transformation == PLAYER_FORM_DEKU) { - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); } else if (this->flags & END_INTERACTION) { this->flags &= ~END_INTERACTION; - EnOssan_EndInteraction(globalCtx, this); - } else if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - EnOssan_StartShopping(globalCtx, this); + EnOssan_EndInteraction(play, this); + } else if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + EnOssan_StartShopping(play, this); } else { return; } } if ((talkState == 10) && (this->actor.params == ENOSSAN_PART_TIME_WORKER) && - (player->transformation == PLAYER_FORM_ZORA) && Message_ShouldAdvance(globalCtx)) { + (player->transformation == PLAYER_FORM_ZORA) && Message_ShouldAdvance(play)) { this->animationIndex = ANI_ANIMATION_APOLOGY_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, ANI_ANIMATION_APOLOGY_LOOP); } @@ -590,11 +590,11 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) { } } -s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx) { +s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { AnimationInfoS* animations = sAnimations[this->actor.params]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); if ((this->actor.params == ENOSSAN_PART_TIME_WORKER) && (player->transformation == PLAYER_FORM_ZORA)) { @@ -602,23 +602,23 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 9); } EnOssan_SetupAction(this, EnOssan_TalkToShopkeeper); - func_80151938(globalCtx, sTalkOptionTextIds[this->actor.params]); - func_8011552C(globalCtx, 6); + func_80151938(play, sTalkOptionTextIds[this->actor.params]); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; return true; case 1: func_8019F230(); - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); return true; } return false; } -void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); u8 cursorIdx; if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { @@ -630,15 +630,15 @@ void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - (!Message_ShouldAdvance(globalCtx) || !EnOssan_FacingShopkeeperDialogResult(this, globalCtx))) { + func_8011552C(play, 6); + if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && + (!Message_ShouldAdvance(play) || !EnOssan_FacingShopkeeperDialogResult(this, play))) { if (this->stickAccumX < 0) { cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 4); if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; EnOssan_SetupAction(this, EnOssan_LookToLeftShelf); - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -647,7 +647,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; EnOssan_SetupAction(this, EnOssan_LookToRightShelf); - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -662,19 +662,19 @@ void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_TalkToShopkeeper(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_TalkToShopkeeper(EnOssan* this, PlayState* play) { AnimationInfoS* animations = sAnimations[this->actor.params]; - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if ((this->animationIndex == ANI_ANIMATION_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { this->animationIndex = ANI_ANIMATION_STANDING_NORMAL_LOOP_2; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 1); } - EnOssan_StartShopping(globalCtx, this); + EnOssan_StartShopping(play, this); } } -void EnOssan_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; @@ -691,9 +691,9 @@ void EnOssan_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseLeftShelf); - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -702,7 +702,7 @@ void EnOssan_LookToLeftShelf(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; @@ -719,9 +719,9 @@ void EnOssan_LookToRightShelf(EnOssan* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseRightShelf); - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -815,16 +815,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* item = this->items[this->cursorIdx]; - if (EnOssan_TestEndInteraction(this, globalCtx, input)) { + if (EnOssan_TestEndInteraction(this, play, input)) { return true; } - if (EnOssan_TestItemSelected(globalCtx)) { + if (EnOssan_TestItemSelected(play)) { if (!item->isOutOfStock) { this->tmpActionFunc = this->actionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->choiceTextId); + func_80151938(play, this->items[this->cursorIdx]->choiceTextId); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_DECIDE); @@ -838,8 +838,8 @@ s32 EnOssan_HasPlayerSelectedItem(GlobalContext* globalCtx, EnOssan* this, Input return false; } -void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; u8 prevCursorIndex = this->cursorIdx; u8 cursorIdx; @@ -851,17 +851,17 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { } else { this->drawCursor = 0xFF; this->stickRightPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCursorPos(play, this); if (talkState == 5) { - func_8011552C(globalCtx, 6); - if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { + func_8011552C(play, 6); + if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal) { if (this->stickAccumX > 0) { cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4); if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; } else { - EnOssan_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetupLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX < 0) { @@ -876,7 +876,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; } else { - EnOssan_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetupLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX < 0 && this->stickAccumX < -500) { @@ -888,7 +888,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { } EnOssan_CursorUpDown(this); if (this->cursorIdx != prevCursorIndex) { - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -896,8 +896,8 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; u8 prevCursorIndex = this->cursorIdx; u8 cursorIdx; @@ -909,17 +909,17 @@ void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { } else { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnOssan_UpdateCursorPos(globalCtx, this); + EnOssan_UpdateCursorPos(play, this); if (talkState == 5) { - func_8011552C(globalCtx, 6); - if (!EnOssan_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { + func_8011552C(play, 6); + if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal != 0) { if (this->stickAccumX < 0) { cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0); if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; } else { - EnOssan_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetupLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX > 0) { @@ -934,7 +934,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; } else { - EnOssan_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnOssan_SetupLookToShopkeeperFromShelf(play, this); return; } } else if (this->stickAccumX > 0 && this->stickAccumX > 500) { @@ -946,7 +946,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { } EnOssan_CursorUpDown(this); if (this->cursorIdx != prevCursorIndex) { - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -954,7 +954,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; @@ -970,138 +970,137 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, GlobalContext* globalCtx) if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; - EnOssan_UpdateCursorPos(globalCtx, this); - EnOssan_StartShopping(globalCtx, this); + EnOssan_UpdateCursorPos(play, this); + EnOssan_StartShopping(play, this); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnOssan_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { + Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeAlpha(50); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_BuyItemWithFanfare); } -void EnOssan_SetupCannotBuy(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnOssan_SetupCannotBuy(PlayState* play, EnOssan* this, u16 textId) { + func_80151938(play, textId); EnOssan_SetupAction(this, EnOssan_CannotBuy); } -void EnOssan_SetupBuy(GlobalContext* globalCtx, EnOssan* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnOssan_SetupBuy(PlayState* play, EnOssan* this, u16 textId) { + func_80151938(play, textId); EnOssan_SetupAction(this, EnOssan_CanBuy); } -void EnOssan_HandleCanBuyItem(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { EnGirlA* item = this->items[this->cursorIdx]; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } func_8019F208(); - item->buyFanfareFunc(globalCtx, item); - EnOssan_SetupBuyItemWithFanfare(globalCtx, this); + item->buyFanfareFunc(play, item); + EnOssan_SetupBuyItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_SUCCESS_2: func_8019F208(); - item->buyFunc(globalCtx, item); - EnOssan_SetupBuy(globalCtx, this, sBuySuccessTextIds[this->actor.params]); + item->buyFunc(play, item); + EnOssan_SetupBuy(play, this, sBuySuccessTextIds[this->actor.params]); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_NO_ROOM: case CANBUY_RESULT_NO_ROOM_2: play_sound(NA_SE_SY_ERROR); - EnOssan_SetupCannotBuy(globalCtx, this, sNoRoomTextIds[this->actor.params]); + EnOssan_SetupCannotBuy(play, this, sNoRoomTextIds[this->actor.params]); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: play_sound(NA_SE_SY_ERROR); - EnOssan_SetupCannotBuy(globalCtx, this, sNeedEmptyBottleTextIds[this->actor.params]); + EnOssan_SetupCannotBuy(play, this, sNeedEmptyBottleTextIds[this->actor.params]); break; case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); - EnOssan_SetupCannotBuy(globalCtx, this, sNeedRupeesTextIds[this->actor.params]); + EnOssan_SetupCannotBuy(play, this, sNeedRupeesTextIds[this->actor.params]); break; case CANBUY_RESULT_CANNOT_GET_NOW_2: play_sound(NA_SE_SY_ERROR); - EnOssan_SetupCannotBuy(globalCtx, this, sCannotGetNowTextIds[this->actor.params]); + EnOssan_SetupCannotBuy(play, this, sCannotGetNowTextIds[this->actor.params]); break; case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); - EnOssan_SetupCannotBuy(globalCtx, this, sNoRoomTextIds[this->actor.params]); + EnOssan_SetupCannotBuy(play, this, sNoRoomTextIds[this->actor.params]); break; } } -void EnOssan_SelectItem(EnOssan* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnOssan_SelectItem(EnOssan* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (EnOssan_TakeItemOffShelf(this) && talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnOssan_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + func_8011552C(play, 6); + if (!EnOssan_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnOssan_HandleCanBuyItem(globalCtx, this); + EnOssan_HandleCanBuyItem(play, this); break; case 1: func_8019F230(); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); break; } } } } -void EnOssan_CannotBuy(EnOssan* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnOssan_CannotBuy(EnOssan* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } } -void EnOssan_CanBuy(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_CanBuy(EnOssan* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); + item->restockFunc(play, item); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIdx]->actor.textId); + func_80151938(play, this->items[this->cursorIdx]->actor.textId); } } -void EnOssan_BuyItemWithFanfare(EnOssan* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnOssan_SetupAction(this, EnOssan_SetupItemPurchased); } else { - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); } } -void EnOssan_SetupItemPurchased(EnOssan* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; EnOssan_SetupAction(this, EnOssan_ItemPurchased); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1110,53 +1109,53 @@ void EnOssan_SetupItemPurchased(EnOssan* this, GlobalContext* globalCtx) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); EnGirlA* item; if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (Message_ShouldAdvance(globalCtx)) { + func_8011552C(play, 6); + if (Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); - if (!EnOssan_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - switch (globalCtx->msgCtx.choiceIndex) { + item->restockFunc(play, item); + if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y); player->stateFlags2 |= 0x20000000; - Message_StartTextbox(globalCtx, this->textId, &this->actor); - EnOssan_SetupStartShopping(globalCtx, this, true); - func_800B85E0(&this->actor, globalCtx, 100.0f, EXCH_ITEM_MINUS1); + Message_StartTextbox(play, this->textId, &this->actor); + EnOssan_SetupStartShopping(play, this, true); + func_800B85E0(&this->actor, play, 100.0f, EXCH_ITEM_MINUS1); break; case 1: default: func_8019F230(); - EnOssan_EndInteraction(globalCtx, this); + EnOssan_EndInteraction(play, this); break; } } } - } else if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == 5 && Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); + item->restockFunc(play, item); player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y); player->stateFlags2 |= 0x20000000; - Message_StartTextbox(globalCtx, this->textId, &this->actor); - EnOssan_SetupStartShopping(globalCtx, this, true); - func_800B85E0(&this->actor, globalCtx, 100.0f, EXCH_ITEM_MINUS1); + Message_StartTextbox(play, this->textId, &this->actor); + EnOssan_SetupStartShopping(play, this, true); + func_800B85E0(&this->actor, play, 100.0f, EXCH_ITEM_MINUS1); } } -void EnOssan_ItemPurchased(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnOssan_ItemPurchased(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -1172,10 +1171,10 @@ void EnOssan_ItemPurchased(EnOssan* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80151938(globalCtx, 0x642); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80151938(play, 0x642); } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } @@ -1363,21 +1362,21 @@ void EnOssan_Blink(EnOssan* this) { } } -void EnOssan_CuriosityShopMan_Init(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable, +void EnOssan_CuriosityShopMan_Init(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable, ENOSSAN_LIMB_MAX); this->actor.draw = EnOssan_CuriosityShopMan_Draw; } -void EnOssan_PartTimeWorker_Init(EnOssan* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gAniSkeleton, &gAniStandingNormalAnim, this->jointTable, +void EnOssan_PartTimeWorker_Init(EnOssan* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gAniSkeleton, &gAniStandingNormalAnim, this->jointTable, this->morphTable, 16); this->actor.draw = EnOssan_PartTimeWorker_Draw; } -u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 textId = Text_GetFaceReaction(globalCtx, 0x2F); +u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 textId = Text_GetFaceReaction(play, 0x2F); if (textId != 0) { this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_START; @@ -1408,9 +1407,9 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, GlobalContext* globalCtx) return sWelcomeHumanTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } -u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 textId = Text_GetFaceReaction(globalCtx, 0x36); +u16 EnOssan_PartTimerWorker_GetWelcome(EnOssan* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 textId = Text_GetFaceReaction(play, 0x36); if (textId != 0) { this->flags |= END_INTERACTION; @@ -1459,19 +1458,19 @@ void EnOssan_SetHaveMet(EnOssan* this) { } } -void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_InitShop(EnOssan* this, PlayState* play) { static EnOssanActionFunc sInitFuncs[] = { EnOssan_CuriosityShopMan_Init, EnOssan_PartTimeWorker_Init }; ShopItem* shopItems; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.objBankIndex = this->objIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); shopItems = sShops[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->textId = sWelcomeHumanTextIds[this->actor.params]; - EnOssan_GetCutscenes(this, globalCtx); + EnOssan_GetCutscenes(this, play); this->cursorPos.y = this->cursorPos.x = 100.0f; this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; @@ -1529,7 +1528,7 @@ void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, sActorScales[this->actor.params]); this->animationIndex = 1; // FSN_ANIMATION_SCRATCH_BACK and ANI_ANIMATION_STANDING_NORMAL_LOOP_2 SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations[this->actor.params], 1); - EnOssan_SpawnShopItems(this, globalCtx, shopItems); + EnOssan_SpawnShopItems(this, play, shopItems); this->blinkTimer = 20; this->eyeTexIndex = 0; this->blinkFunc = EnOssan_WaitForBlink; @@ -1538,32 +1537,32 @@ void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx) { } } -void EnOssan_GetCutscenes(EnOssan* this, GlobalContext* globalCtx) { +void EnOssan_GetCutscenes(EnOssan* this, PlayState* play) { this->lookToShopkeeperCutscene = this->actor.cutscene; this->lookToLeftShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperCutscene); this->lookToRightShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToLeftShelfCutscene); this->lookToShopKeeperFromShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToRightShelfCutscene); } -void EnOssan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_Update(Actor* thisx, PlayState* play) { EnOssan* this = THIS; if (this->actionFunc != EnOssan_InitShop) { this->blinkFunc(this); - EnOssan_UpdateJoystickInputState(globalCtx, this); + EnOssan_UpdateJoystickInputState(play, this); EnOssan_UpdateItemSelectedProperty(this); EnOssan_UpdateStickDirectionPromptAnim(this); EnOssan_UpdateCursorAnim(this); - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRot, &this->unk2CC, this->actor.focus.pos); - this->actionFunc(this, globalCtx); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk2CC, this->actor.focus.pos); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 90.0f); SkelAnime_Update(&this->skelAnime); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -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; s32 uly; s32 lrx; @@ -1573,9 +1572,9 @@ void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f (void)"../z_en_oB1.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawCursor != 0) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b, this->cursorColor.a); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -1588,11 +1587,11 @@ 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); + CLOSE_DISPS(play->state.gfxCtx); } -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; s32 uly; @@ -1605,7 +1604,7 @@ void EnOssan_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f (void)"../z_en_oB1.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -1622,30 +1621,30 @@ void EnOssan_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f dtdy = dy * unk; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this) { +void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) { s32 drawStickRightPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled; (void)"../z_en_oB1.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawStickRightPrompt || drawStickLeftPrompt) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(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 (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, + EnOssan_DrawTextRec(play, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); @@ -1654,23 +1653,23 @@ 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 (drawStickRightPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, + EnOssan_DrawTextRec(play, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, + EnOssan_DrawTextRec(play, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnOssan_CuriosityShopMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, Actor* thisx) { +s32 EnOssan_CuriosityShopMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { EnOssan* this = THIS; if (limbIndex == FSN_LIMB_HEAD) { @@ -1679,8 +1678,8 @@ s32 EnOssan_CuriosityShopMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb return false; } -s32 EnOssan_PartTimeWorker_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, - Vec3s* rot, Actor* thisx) { +s32 EnOssan_PartTimeWorker_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { EnOssan* this = THIS; if (limbIndex == ANI_LIMB_HEAD) { @@ -1690,8 +1689,7 @@ s32 EnOssan_PartTimeWorker_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIn return false; } -void EnOssan_CuriosityShopMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, - Actor* thisx) { +void EnOssan_CuriosityShopMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnOssan* this = THIS; if (limbIndex == FSN_LIMB_PELVIS || limbIndex == FSN_LIMB_LEFT_UPPER_ARM || limbIndex == FSN_LIMB_RIGHT_UPPER_ARM) { @@ -1700,8 +1698,7 @@ void EnOssan_CuriosityShopMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbInd } } -void EnOssan_PartTimeWorker_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, - Actor* thisx) { +void EnOssan_PartTimeWorker_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f sPartTimeWorkerFocusOffset = { 800.0f, 500.0f, 0.0f }; EnOssan* this = THIS; @@ -1710,33 +1707,33 @@ void EnOssan_PartTimeWorker_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex } } -void EnOssan_CuriosityShopMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { gFsnEyeOpenTex, gFsnEyeHalfTex, gFsnEyeClosedTex }; s32 pad; EnOssan* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(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, EnOssan_CuriosityShopMan_OverrideLimbDraw, EnOssan_CuriosityShopMan_PostLimbDraw, &this->actor); - EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOssan_PartTimeWorker_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOssan_PartTimeWorker_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { gAniOpenEyeTex, gAniClosingEyeTex, gAniClosedEyeTex }; s32 pad; EnOssan* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(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, EnOssan_PartTimeWorker_OverrideLimbDraw, EnOssan_PartTimeWorker_PostLimbDraw, &this->actor); - EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnOssan_DrawStickDirectionPrompts(globalCtx, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnOssan_DrawStickDirectionPrompts(play, this); + CLOSE_DISPS(play->state.gfxCtx); } 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 00ed6814a5..5ef81ebf28 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -11,7 +11,7 @@ struct EnOssan; -typedef void (*EnOssanActionFunc)(struct EnOssan*, GlobalContext*); +typedef void (*EnOssanActionFunc)(struct EnOssan*, PlayState*); typedef void (*EnOssanBlinkFunc)(struct EnOssan*); typedef struct EnOssan { diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 8ef3e1bfca..e708b22af4 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -13,51 +13,51 @@ #define THIS ((EnOt*)thisx) -void EnOt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnOt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnOt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnOt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnOt_Init(Actor* thisx, PlayState* play); +void EnOt_Destroy(Actor* thisx, PlayState* play); +void EnOt_Update(Actor* thisx, PlayState* play); +void EnOt_Draw(Actor* thisx, PlayState* play); -void func_80B5BDA8(EnOt* this, GlobalContext* globalCtx); -void func_80B5BE04(EnOt* this, GlobalContext* globalCtx); -void func_80B5BE88(EnOt* this, GlobalContext* globalCtx); -void func_80B5BED4(EnOt* this, GlobalContext* globalCtx); -void func_80B5BF60(EnOt* this, GlobalContext* globalCtx); -void func_80B5BFB8(EnOt* this, GlobalContext* globalCtx); -void func_80B5C1CC(EnOt* this, GlobalContext* globalCtx); -void func_80B5C244(EnOt* this, GlobalContext* globalCtx); -void func_80B5C25C(EnOt* this, GlobalContext* globalCtx); -void func_80B5C3B8(EnOt* this, GlobalContext* globalCtx); -void func_80B5C3D8(EnOt* this, GlobalContext* globalCtx); -void func_80B5C634(EnOt* this, GlobalContext* globalCtx); -void func_80B5C64C(EnOt* this, GlobalContext* globalCtx); -void func_80B5C684(EnOt* this, GlobalContext* globalCtx); -void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx); -void func_80B5C910(EnOt* this, GlobalContext* globalCtx); -void func_80B5C950(EnOt* this, GlobalContext* globalCtx); -void func_80B5C9A8(EnOt* this, GlobalContext* globalCtx); -void func_80B5C9C0(EnOt* this, GlobalContext* globalCtx); -void func_80B5C9D0(EnOt* this, GlobalContext* globalCtx); -void func_80B5CA30(EnOt* this, GlobalContext* globalCtx); -void func_80B5CAD0(EnOt* this, GlobalContext* globalCtx); -void func_80B5CB0C(EnOt* this, GlobalContext* globalCtx); -void func_80B5CBEC(EnOt* this, GlobalContext* globalCtx); -void func_80B5CC88(EnOt* this, GlobalContext* globalCtx); -void func_80B5CCA0(EnOt* this, GlobalContext* globalCtx); -void func_80B5CCF4(EnOt* this, GlobalContext* globalCtx); -void func_80B5CD40(EnOt* this, GlobalContext* globalCtx); -void func_80B5CE6C(EnOt* this, GlobalContext* globalCtx); -void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx); -void func_80B5D114(EnOt* this, GlobalContext* globalCtx); -void func_80B5D160(EnOt* this, GlobalContext* globalCtx); -void func_80B5D648(EnOt* this, GlobalContext* globalCtx); -void func_80B5D750(EnOt* this, GlobalContext* globalCtx); -void func_80B5DAEC(Actor* thisx, GlobalContext* globalCtx); -void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx); -void EnOt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); +void func_80B5BDA8(EnOt* this, PlayState* play); +void func_80B5BE04(EnOt* this, PlayState* play); +void func_80B5BE88(EnOt* this, PlayState* play); +void func_80B5BED4(EnOt* this, PlayState* play); +void func_80B5BF60(EnOt* this, PlayState* play); +void func_80B5BFB8(EnOt* this, PlayState* play); +void func_80B5C1CC(EnOt* this, PlayState* play); +void func_80B5C244(EnOt* this, PlayState* play); +void func_80B5C25C(EnOt* this, PlayState* play); +void func_80B5C3B8(EnOt* this, PlayState* play); +void func_80B5C3D8(EnOt* this, PlayState* play); +void func_80B5C634(EnOt* this, PlayState* play); +void func_80B5C64C(EnOt* this, PlayState* play); +void func_80B5C684(EnOt* this, PlayState* play); +void func_80B5C6DC(EnOt* this, PlayState* play); +void func_80B5C910(EnOt* this, PlayState* play); +void func_80B5C950(EnOt* this, PlayState* play); +void func_80B5C9A8(EnOt* this, PlayState* play); +void func_80B5C9C0(EnOt* this, PlayState* play); +void func_80B5C9D0(EnOt* this, PlayState* play); +void func_80B5CA30(EnOt* this, PlayState* play); +void func_80B5CAD0(EnOt* this, PlayState* play); +void func_80B5CB0C(EnOt* this, PlayState* play); +void func_80B5CBEC(EnOt* this, PlayState* play); +void func_80B5CC88(EnOt* this, PlayState* play); +void func_80B5CCA0(EnOt* this, PlayState* play); +void func_80B5CCF4(EnOt* this, PlayState* play); +void func_80B5CD40(EnOt* this, PlayState* play); +void func_80B5CE6C(EnOt* this, PlayState* play); +void func_80B5CEC8(EnOt* this, PlayState* play); +void func_80B5D114(EnOt* this, PlayState* play); +void func_80B5D160(EnOt* this, PlayState* play); +void func_80B5D648(EnOt* this, PlayState* play); +void func_80B5D750(EnOt* this, PlayState* play); +void func_80B5DAEC(Actor* thisx, PlayState* play); +void func_80B5DB6C(Actor* thisx, PlayState* play); +void EnOt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); EnOtUnkStruct* func_80B5DF58(EnOtUnkStruct* arg0, u8 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4); -void func_80B5E078(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2); -void func_80B5E1D8(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2); +void func_80B5E078(PlayState* play, EnOtUnkStruct* arg1, s32 arg2); +void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2); static EnOt* D_80B5E880; static EnOt* D_80B5E884; @@ -107,9 +107,9 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_STOP), }; -void func_80B5B2E0(GlobalContext* globalCtx, Vec3f* pos, s16 params, Vec3f* vec, s32* index) { +void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 params, Vec3f* vec, s32* index) { s32 i; - Path* path = &globalCtx->setupPathList[params]; + Path* path = &play->setupPathList[params]; f32 dist; Vec3f sp58; Vec3f sp4C; @@ -128,7 +128,7 @@ void func_80B5B2E0(GlobalContext* globalCtx, Vec3f* pos, s16 params, Vec3f* vec, Math_Vec3f_Copy(vec, &sp4C); } -void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOt_Init(Actor* thisx, PlayState* play) { s32 pad; EnOt* this = THIS; s32 bgId; @@ -149,9 +149,9 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ot_Skel_004800, &object_ot_Anim_0008D8, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ot_Skel_004800, &object_ot_Anim_0008D8, this->jointTable, this->morphTable, 19); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Animation_Change(&this->skelAnime, sAnimations[0].animation, 1.0f, Animation_GetLastFrame(&sAnimations[0].animation->common) * Rand_ZeroOne(), Animation_GetLastFrame(&sAnimations[0].animation->common), sAnimations[0].mode, @@ -165,7 +165,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->skelAnime.curFrame = Rand_ZeroOne() * this->skelAnime.endFrame; - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_744.r = 255; this->unk_744.g = 200; this->unk_744.b = 80; @@ -177,15 +177,15 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->unk_344) { case 0: - this->actor.world.pos.y = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &this->actor.floorPoly, - &bgId, &this->actor.world.pos) + + this->actor.world.pos.y = BgCheck_EntityRaycastFloor3(&play->colCtx, &this->actor.floorPoly, &bgId, + &this->actor.world.pos) + 50.0f; if (gSaveContext.save.weekEventReg[84] & 0x10) { Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_MultVecZ(52.519997f, &sp64); Math_Vec3f_Sum(&this->actor.world.pos, &sp64, &sp64); - this->unk_360 = (EnOt*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OT, sp64.x, sp64.y, - sp64.z, 0, BINANG_ROT180(this->actor.shape.rot.y), 1, + this->unk_360 = (EnOt*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, sp64.x, sp64.y, sp64.z, + 0, BINANG_ROT180(this->actor.shape.rot.y), 1, ENOT_GET_3FFF(&this->actor) | 0x8000); if (this->unk_360 != NULL) { this->unk_360->unk_360 = this; @@ -196,9 +196,9 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_394.z = (this->actor.world.pos.z + this->unk_360->actor.world.pos.z) * 0.5f; Math_Vec3f_Copy(&this->unk_360->unk_394, &this->unk_394); if (gSaveContext.save.weekEventReg[32] & 1) { - func_80B5C244(this, globalCtx); + func_80B5C244(this, play); } else { - func_80B5C684(this, globalCtx); + func_80B5C684(this, play); } } else { Actor_MarkForDeath(&this->actor); @@ -211,10 +211,10 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->actor.world.pos, &sp58, &sp58); Math_Vec3f_Copy(&this->unk_360->actor.world.pos, &sp58); Math_Vec3f_Copy(&this->unk_360->actor.prevPos, &sp58); - func_80B5BDA8(this, globalCtx); - func_80B5BE88(this->unk_360, globalCtx); + func_80B5BDA8(this, play); + func_80B5BE88(this->unk_360, play); } else { - func_80B5CE6C(this, globalCtx); + func_80B5CE6C(this, play); } break; @@ -232,18 +232,18 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0f); if (!(gSaveContext.save.weekEventReg[13] & 1)) { Actor_SetScale(&this->actor, 0.0f); - func_80B5C910(this, globalCtx); + func_80B5C910(this, play); } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (SurfaceType_IsHorseBlocked(&globalCtx->colCtx, player->actor.floorPoly, + if (SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { Actor_SetScale(&this->actor, 0.0f); - func_80B5C910(this, globalCtx); + func_80B5C910(this, play); } else { this->unk_360 = D_80B5E884; this->unk_360->unk_360 = this; - func_80B5C9D0(this, globalCtx); + func_80B5C9D0(this, play); } } break; @@ -252,12 +252,12 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.012999999f); if (gSaveContext.save.weekEventReg[84] & 0x10) { if (gSaveContext.save.weekEventReg[32] & 1) { - func_80B5C244(this, globalCtx); + func_80B5C244(this, play); } else { - func_80B5C684(this, globalCtx); + func_80B5C684(this, play); } } else { - func_80B5CE6C(this, globalCtx); + func_80B5CE6C(this, play); } break; } @@ -272,7 +272,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.height *= 0.5f; this->collider.dim.yShift *= 0.5f; this->actor.update = func_80B5DAEC; - func_80B5C634(this, globalCtx); + func_80B5C634(this, play); } else { Actor_MarkForDeath(&this->actor); } @@ -280,11 +280,11 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOt_Destroy(Actor* thisx, PlayState* play) { EnOt* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->collider); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } void func_80B5BAAC(LightInfo* lightInfo, Vec3f* arg1, Color_RGB8* arg2, s16 radius) { @@ -299,34 +299,34 @@ void func_80B5BB38(Color_RGB8* arg0, Color_RGB8* arg1, f32 arg2) { arg0->b = (arg1->b * arg2) + (arg1->b * (1.0f - arg2) * rand); } -void func_80B5BDA8(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BDA8(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->actionFunc = func_80B5BE04; } -void func_80B5BE04(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BE04(EnOt* this, PlayState* play) { switch (this->unk_388) { case 0: if (SubS_StartActorCutscene(&this->actor, this->cutscenes[2], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - func_80B5BF60(this, globalCtx); + func_80B5BF60(this, play); } break; case 1: if (SubS_StartActorCutscene(&this->actor, this->cutscenes[3], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - func_80B5BF60(this, globalCtx); + func_80B5BF60(this, play); } break; } } -void func_80B5BE88(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BE88(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); this->actionFunc = func_80B5BED4; } -void func_80B5BED4(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BED4(EnOt* this, PlayState* play) { func_800BE33C(&this->actor.world.pos, &this->unk_360->actor.world.pos, &this->actor.world.rot, 0); Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, &this->unk_360->actor), 3, 0xE38, 0x38E); @@ -335,13 +335,13 @@ void func_80B5BED4(EnOt* this, GlobalContext* globalCtx) { Actor_MoveWithoutGravityReverse(&this->actor); } -void func_80B5BF60(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BF60(EnOt* this, PlayState* play) { this->unk_32C |= 0x40; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->actionFunc = func_80B5BFB8; } -void func_80B5BFB8(EnOt* this, GlobalContext* globalCtx) { +void func_80B5BFB8(EnOt* this, PlayState* play) { Vec3f sp34; f32 temp_f0 = this->actor.floorHeight + 50.0f; @@ -368,39 +368,39 @@ void func_80B5BFB8(EnOt* this, GlobalContext* globalCtx) { this->unk_360->unk_394.y = this->unk_394.y; this->unk_360->unk_394.z = this->unk_394.z; - func_80B5C684(this->unk_360, globalCtx); - func_80B5C684(this, globalCtx); + func_80B5C684(this->unk_360, play); + func_80B5C684(this, play); } else { Actor_MoveWithoutGravityReverse(&this->actor); } } -void func_80B5C154(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C154(EnOt* this, PlayState* play) { if (gSaveContext.save.weekEventReg[32] & 1) { this->unk_38C = GI_RUPEE_RED; } else { this->unk_38C = GI_HEART_PIECE; gSaveContext.save.weekEventReg[32] |= 1; } - Actor_PickUp(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; } -void func_80B5C1CC(EnOt* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B5C1CC(EnOt* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - func_80B5C244(this, globalCtx); - func_80B5C244(this->unk_360, globalCtx); + func_80B5C244(this, play); + func_80B5C244(this->unk_360, play); } else { - Actor_PickUp(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } -void func_80B5C244(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C244(EnOt* this, PlayState* play) { this->actionFunc = func_80B5C25C; } -void func_80B5C25C(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C25C(EnOt* this, PlayState* play) { this->unk_390 = Actor_YawBetweenActors(&this->actor, &this->unk_360->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_390, 3, 0xE38, 0x38E); if (BINANG_SUB(BINANG_ROT180(this->unk_360->actor.shape.rot.y), this->actor.shape.rot.y) < 0x38E) { @@ -416,17 +416,17 @@ void func_80B5C25C(EnOt* this, GlobalContext* globalCtx) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->unk_360->actor.flags |= ACTOR_FLAG_8000000; this->unk_360->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80B5C9A8(this->unk_360, globalCtx); - func_80B5C3B8(this, globalCtx); + func_80B5C9A8(this->unk_360, play); + func_80B5C3B8(this, play); } } -void func_80B5C3B8(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C3B8(EnOt* this, PlayState* play) { this->unk_740 = 0.0f; this->actionFunc = func_80B5C3D8; } -void func_80B5C3D8(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C3D8(EnOt* this, PlayState* play) { static Color_RGB8 D_80B5E408 = { 255, 200, 80 }; static Color_RGB8 D_80B5E40C = { 255, 60, 200 }; s16 temp; @@ -461,7 +461,7 @@ void func_80B5C3D8(EnOt* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, 12.0f)) { - Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_NEW); + Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)), MTXMODE_NEW); sp38.x = 1.0f; sp38.y = 8.1f; sp38.z = 0.0f; @@ -477,24 +477,24 @@ void func_80B5C3D8(EnOt* this, GlobalContext* globalCtx) { } } -void func_80B5C634(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C634(EnOt* this, PlayState* play) { this->actionFunc = func_80B5C64C; } -void func_80B5C64C(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C64C(EnOt* this, PlayState* play) { if (gSaveContext.save.weekEventReg[26] & 8) { Actor_MarkForDeath(&this->actor); } } -void func_80B5C684(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C684(EnOt* this, PlayState* play) { this->actor.speedXZ = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->actionFunc = func_80B5C6DC; } -void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5C6DC(EnOt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 sp3E; Vec3f sp30; @@ -530,19 +530,19 @@ void func_80B5C6DC(EnOt* this, GlobalContext* globalCtx) { if ((gSaveContext.save.weekEventReg[84] & 0x10) && (this->unk_33C == 1)) { this->actor.textId = 0; this->unk_384 = 1; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3A0 = BINANG_ADD(sp3E, 0x4000); this->unk_360->unk_3A0 = this->unk_3A0; - func_80B5C9A8(this, globalCtx); - func_80B5D114(this, globalCtx); + func_80B5C9A8(this, play); + func_80B5D114(this, play); } else if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { - func_800B8614(&this->actor, globalCtx, 130.0f); + func_800B8614(&this->actor, play, 130.0f); } } } -void func_80B5C910(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C910(EnOt* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -553,22 +553,22 @@ void func_80B5C910(EnOt* this, GlobalContext* globalCtx) { this->actionFunc = func_80B5C950; } -void func_80B5C950(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C950(EnOt* this, PlayState* play) { if (this->unk_32C & 8) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); gSaveContext.save.weekEventReg[25] |= 4; - func_80B5CAD0(this, globalCtx); + func_80B5CAD0(this, play); } } -void func_80B5C9A8(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C9A8(EnOt* this, PlayState* play) { this->actionFunc = func_80B5C9C0; } -void func_80B5C9C0(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C9C0(EnOt* this, PlayState* play) { } -void func_80B5C9D0(EnOt* this, GlobalContext* globalCtx) { +void func_80B5C9D0(EnOt* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -580,78 +580,78 @@ void func_80B5C9D0(EnOt* this, GlobalContext* globalCtx) { this->actionFunc = func_80B5CA30; } -void func_80B5CA30(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CA30(EnOt* this, PlayState* play) { Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); if (this->actor.scale.x == 0.012999999f) { this->unk_360->unk_32C |= 0x1000; this->unk_360->unk_360 = this; - func_80B5C9A8(this, globalCtx); + func_80B5C9A8(this, play); } } -void func_80B5CAD0(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CAD0(EnOt* this, PlayState* play) { SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes) / 2); this->actionFunc = func_80B5CB0C; } -void func_80B5CB0C(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CB0C(EnOt* this, PlayState* play) { Math_SmoothStepToF(&this->actor.scale.x, 0.012999999f, 0.7f, 0.0001f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); if (this->actor.scale.x == 0.012999999f) { this->unk_32C |= 0x800; - func_80B5CE6C(this, globalCtx); + func_80B5CE6C(this, play); } } -void func_80B5CBA0(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CBA0(EnOt* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80B5CBEC; } -void func_80B5CBEC(EnOt* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B5CBEC(EnOt* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80B5CC88(this, globalCtx); + func_80B5CC88(this, play); } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); } } -void func_80B5CC88(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CC88(EnOt* this, PlayState* play) { this->actionFunc = func_80B5CCA0; } -void func_80B5CCA0(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CCA0(EnOt* this, PlayState* play) { if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_NORMAL)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags2 |= 0x20000000; - func_80B5CCF4(this, globalCtx); + func_80B5CCF4(this, play); } } -void func_80B5CCF4(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CCF4(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->actionFunc = func_80B5CD40; } -void func_80B5CD40(EnOt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5CD40(EnOt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 temp; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: temp = Math_SmoothStepToS(&this->actor.shape.rot.y, - BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), 3, 0xE38, 0x38E); + BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; if (1) {} if (!temp) { gSaveContext.save.weekEventReg[23] |= 0x10; - Message_StartTextbox(globalCtx, 0x1069, NULL); + Message_StartTextbox(play, 0x1069, NULL); } break; @@ -663,41 +663,41 @@ void func_80B5CD40(EnOt* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.currentTextId == 0x1069)) { + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1069)) { this->unk_32C |= 4; ActorCutscene_Stop(this->cutscenes[0]); player->stateFlags2 &= ~0x20000000; - func_80B5CE6C(this, globalCtx); + func_80B5CE6C(this, play); } break; } } -void func_80B5CE6C(EnOt* this, GlobalContext* globalCtx) { +void func_80B5CE6C(EnOt* this, PlayState* play) { this->unk_384 = 0; this->unk_32C |= 0x20; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->actionFunc = func_80B5CEC8; } -void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B5CEC8(EnOt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; this->actor.textId = 0; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80B5D114(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80B5D114(this, play); return; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); if (this->unk_32C & 0x800) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); } else { this->actor.flags &= ~ACTOR_FLAG_10000; if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { - func_800B8614(&this->actor, globalCtx, 130.0f); + func_800B8614(&this->actor, play, 130.0f); } } @@ -717,29 +717,29 @@ void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_360->actor.prevPos, &this->unk_360->actor.world.pos); this->unk_32C &= ~0x800; this->unk_360->unk_32C &= ~0x800; - func_80B5BDA8(this, globalCtx); - func_80B5BE88(this->unk_360, globalCtx); + func_80B5BDA8(this, play); + func_80B5BE88(this->unk_360, play); return; } } if (this->unk_32C & 0x1000) { this->unk_388 = 1; - func_80B5BDA8(this, globalCtx); - func_80B5BE88(this->unk_360, globalCtx); + func_80B5BDA8(this, play); + func_80B5BE88(this->unk_360, play); } } -void func_80B5D114(EnOt* this, GlobalContext* globalCtx) { +void func_80B5D114(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->actionFunc = func_80B5D160; } -void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { +void func_80B5D160(EnOt* this, PlayState* play) { u16 phi_a1; s32 temp; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: temp = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -753,7 +753,7 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { } else { phi_a1 = 0x1069; } - } else if (Flags_GetSwitch(globalCtx, ENOT_GET_3F80(&this->actor))) { + } else if (Flags_GetSwitch(play, ENOT_GET_3F80(&this->actor))) { if (gSaveContext.save.weekEventReg[23] & 0x10) { phi_a1 = 0x106C; } else { @@ -765,13 +765,13 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { } else { phi_a1 = 0x10A5; } - Message_StartTextbox(globalCtx, phi_a1, &this->actor); - func_80B5D114(this, globalCtx); + Message_StartTextbox(play, phi_a1, &this->actor); + func_80B5D114(this, play); break; case 1: - Message_StartTextbox(globalCtx, 0x106D, &this->actor); - func_80B5D114(this, globalCtx); + Message_StartTextbox(play, 0x106D, &this->actor); + func_80B5D114(this, play); break; } break; @@ -786,30 +786,30 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { default: case 0x1068: case 0x106B: case 0x106C: - func_80B5D648(this, globalCtx); + func_80B5D648(this, play); break; case 0x1069: this->unk_32C |= 4; case 0x106A: - func_80B5CE6C(this, globalCtx); + func_80B5CE6C(this, play); break; case 0x10A5: - func_801477B4(globalCtx); - func_80B5CE6C(this, globalCtx); + func_801477B4(play); + func_80B5CE6C(this, play); break; case 0x106D: - func_801477B4(globalCtx); - func_80B5C154(this, globalCtx); + func_801477B4(play); + func_80B5C154(this, play); break; } } @@ -817,7 +817,7 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) { } } -s32 EnOt_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 EnOt_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; EnOt* this = (EnOt*)thisx; f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ; @@ -834,7 +834,7 @@ s32 EnOt_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) { return false; } -s32 EnOt_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* actorPath) { +s32 EnOt_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; s32 ret = false; s32 pad; @@ -875,11 +875,11 @@ s32 EnOt_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* ac return ret; } -void func_80B5D648(EnOt* this, GlobalContext* globalCtx) { - func_80B5B2E0(globalCtx, &this->actor.world.pos, this->unk_346, &this->unk_348, &this->unk_340); +void func_80B5D648(EnOt* this, PlayState* play) { + func_80B5B2E0(play, &this->actor.world.pos, this->unk_346, &this->unk_348, &this->unk_340); Math_Vec3f_Copy(&this->unk_330, &this->actor.world.pos); - SubS_ActorPathing_Init(globalCtx, &this->unk_330, &this->actor, &this->actorPath, globalCtx->setupPathList, - this->unk_346, 0, 0, this->unk_340, 0); + SubS_ActorPathing_Init(play, &this->unk_330, &this->actor, &this->actorPath, play->setupPathList, this->unk_346, 0, + 0, this->unk_340, 0); this->unk_32C = 0; this->actorPath.pointOffset.x = 0.0f; this->actorPath.pointOffset.y = 0.0f; @@ -889,13 +889,13 @@ void func_80B5D648(EnOt* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - Flags_SetSwitch(globalCtx, ENOT_GET_3F80(&this->actor)); + Flags_SetSwitch(play, ENOT_GET_3F80(&this->actor)); this->actionFunc = func_80B5D750; } -void func_80B5D750(EnOt* this, GlobalContext* globalCtx) { +void func_80B5D750(EnOt* this, PlayState* play) { if (!(this->unk_32C & 1) && !(this->unk_32C & 2)) { - SubS_ActorPathing_Update(globalCtx, &this->actorPath, SubS_ActorPathing_ComputePointInfo, + SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, EnOt_ActorPathing_UpdateActorInfo, EnOt_ActorPathing_Move, SubS_ActorPathing_SetNextPoint); } @@ -918,14 +918,14 @@ void func_80B5D750(EnOt* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_8000000; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); if (D_80B5E884 != 0) { - func_80B5C9A8(this, globalCtx); + func_80B5C9A8(this, play); } else { - func_80B5CBA0(this, globalCtx); + func_80B5CBA0(this, play); } } } -void EnOt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOt_Update(Actor* thisx, PlayState* play) { s32 pad; EnOt* this = THIS; @@ -933,21 +933,21 @@ void EnOt_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_SWIM); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.bgCheckFlags & 0x20) { if (DECR(this->unk_354) == 0) { if (this->actor.flags & ACTOR_FLAG_40) { s32 i; for (i = 0; i < 2; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 20.0f, 5.0f, 0.1f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 20.0f, 5.0f, 0.1f); } this->unk_354 = (Rand_ZeroOne() * 10.0f) + 10.0f; } } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 10.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 0.0f, 4); if (this->actor.world.pos.y <= this->actor.floorHeight + 50.0f) { this->actor.world.pos.y = this->actor.floorHeight + 50.0f; @@ -957,21 +957,21 @@ void EnOt_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 12.0f); SkelAnime_Update(&this->skelAnime); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_80B5BB38(&this->unk_747, &this->unk_744, 0.7f); if (this->unk_32C & 0x400) { func_80B5BAAC(&this->lightInfo, &this->unk_378, &this->unk_747, 0xD2); } - func_80B5E078(globalCtx, this->unk_3A4, 10); + func_80B5E078(play, this->unk_3A4, 10); } -void func_80B5DAEC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B5DAEC(Actor* thisx, PlayState* play) { s32 pad; EnOt* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 12.0f); SkelAnime_Update(&this->skelAnime); func_80B5BB38(&this->unk_747, &this->unk_744, 0.7f); @@ -980,17 +980,17 @@ void func_80B5DAEC(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B5DB6C(Actor* thisx, PlayState* play) { s32 pad; EnOt* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(gSaveContext.save.weekEventReg[84] & 0x10) && !(this->unk_32C & 8)) { if (gSaveContext.save.weekEventReg[25] & 4) { Vec3f sp50; - func_80B5B2E0(globalCtx, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); - if (Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, + func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); + if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, this->actor.shape.rot.y, 1, ENOT_GET_3FFF(&this->actor) | 0x8000, this->actor.cutscene, this->actor.unk20, NULL) != NULL) { this->unk_32C |= 8; @@ -999,7 +999,7 @@ void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx) { s32 sp4C = false; if (gSaveContext.save.weekEventReg[13] & 1) { - if (!SurfaceType_IsHorseBlocked(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { + if (!SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { sp4C = true; } } @@ -1013,35 +1013,35 @@ void func_80B5DB6C(Actor* thisx, GlobalContext* globalCtx) { temp->actor.cutscene = this->actor.cutscene; this->unk_32C |= 8; } - } else if (SurfaceType_IsHorseBlocked(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { + } else if (SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { player->unk_B2B = 29; } } } -void EnOt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOt_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; EnOt* this = THIS; Gfx* gfx; Matrix_Push(); - func_80B5E1D8(globalCtx, this->unk_3A4, 10); + func_80B5E1D8(play, this->unk_3A4, 10); Matrix_Pop(); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 25); POLY_XLU_DISP = func_8012C2B4(POLY_XLU_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_ot_Matanimheader_0005F8)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnOt_PostLimbDraw, &this->actor); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_ot_Matanimheader_0005F8)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnOt_PostLimbDraw, &this->actor); Matrix_Translate(this->unk_378.x, this->unk_378.y, this->unk_378.z, MTXMODE_NEW); Matrix_Scale(0.0882f, 0.0882f, 0.0882f, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = func_8012C7FC(POLY_XLU_DISP); @@ -1050,27 +1050,27 @@ void EnOt_Draw(Actor* thisx, GlobalContext* globalCtx) { 0); gSPDisplayList(&gfx[2], gameplay_keep_DL_029CB0); gDPSetPrimColor(&gfx[3], 0, 0, this->unk_747.r, this->unk_747.g, this->unk_747.b, 50); - gSPMatrix(&gfx[4], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[4], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[5], gameplay_keep_DL_029CF0); POLY_XLU_DISP = &gfx[6]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnOt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnOt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80B5E410 = { 400.0f, 600.0f, 0.0f }; EnOt* this = THIS; if (limbIndex == 4) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Gfx* gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], object_ot_DL_0004A0); POLY_OPA_DISP = &gfx[1]; Matrix_MultVec3f(&D_80B5E410, &this->unk_74C); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 1) { Matrix_MultZero(&this->unk_378); this->unk_32C |= 0x400; @@ -1106,10 +1106,10 @@ EnOtUnkStruct* func_80B5DF58(EnOtUnkStruct* arg0, u8 arg1, Vec3f* arg2, Vec3s* a return arg0; } -void func_80B5E078(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { +void func_80B5E078(PlayState* play, EnOtUnkStruct* arg1, s32 arg2) { Vec3f sp54; s32 i; - s16 temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); + s16 temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); for (i = 0; i < arg2; i++, arg1++) { if ((arg1->unk_00 == 1) || (arg1->unk_00 == 2)) { @@ -1131,13 +1131,13 @@ void func_80B5E078(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { } } -void func_80B5E1D8(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { +void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2) { s32 i; s32 flag = 0; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); for (i = 0; i < arg2; i++, arg1++) { @@ -1145,19 +1145,18 @@ void func_80B5E1D8(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { if (!flag) { gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000040); flag = true; - if (globalCtx) {} + if (play) {} } Matrix_Translate(arg1->unk_0C.x, arg1->unk_0C.y, arg1->unk_0C.z, MTXMODE_NEW); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); Matrix_Scale(arg1->unk_04, arg1->unk_04, arg1->unk_04, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000078); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.h b/src/overlays/actors/ovl_En_Ot/z_en_ot.h index 902cbecd7c..4f940fda82 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -5,7 +5,7 @@ struct EnOt; -typedef void (*EnOtActionFunc)(struct EnOt*, GlobalContext*); +typedef void (*EnOtActionFunc)(struct EnOt*, PlayState*); #define ENOT_GET_7F(thisx) ((thisx)->params & 0x7F) #define ENOT_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) 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 d324c8d92e..521624025e 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -11,35 +11,35 @@ #define THIS ((EnOwl*)thisx) -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 func_8095AB1C(EnOwl* this, GlobalContext* globalCtx); -void func_8095ABF0(EnOwl* this, GlobalContext* globalCtx); -void func_8095AD54(EnOwl* this, GlobalContext* globalCtx); -void func_8095AE00(EnOwl* this, GlobalContext* globalCtx); -void func_8095AE60(EnOwl* this, GlobalContext* globalCtx); -void func_8095AEC0(EnOwl* this, GlobalContext* globalCtx); -void func_8095AF2C(EnOwl* this, GlobalContext* globalCtx); -void func_8095AFEC(EnOwl* this, GlobalContext* globalCtx); -void func_8095B254(EnOwl* this, GlobalContext* globalCtx); -void func_8095B2F8(EnOwl* this, GlobalContext* globalCtx); -void func_8095B650(EnOwl* this, GlobalContext* globalCtx); -void func_8095B6C8(EnOwl* this, GlobalContext* globalCtx); -void func_8095B76C(EnOwl* this, GlobalContext* globalCtx); -void func_8095B960(EnOwl* this, GlobalContext* globalCtx); -void func_8095BA84(EnOwl* this, GlobalContext* globalCtx); -void func_8095BE0C(EnOwl* this, GlobalContext* globalCtx); -void func_8095BF20(EnOwl* this, GlobalContext* globalCtx); -void func_8095BF58(EnOwl* this, GlobalContext* globalCtx); -void func_8095C1C8(EnOwl* this, GlobalContext* globalCtx); +void func_8095AB1C(EnOwl* this, PlayState* play); +void func_8095ABF0(EnOwl* this, PlayState* play); +void func_8095AD54(EnOwl* this, PlayState* play); +void func_8095AE00(EnOwl* this, PlayState* play); +void func_8095AE60(EnOwl* this, PlayState* play); +void func_8095AEC0(EnOwl* this, PlayState* play); +void func_8095AF2C(EnOwl* this, PlayState* play); +void func_8095AFEC(EnOwl* this, PlayState* play); +void func_8095B254(EnOwl* this, PlayState* play); +void func_8095B2F8(EnOwl* this, PlayState* play); +void func_8095B650(EnOwl* this, PlayState* play); +void func_8095B6C8(EnOwl* this, PlayState* play); +void func_8095B76C(EnOwl* this, PlayState* play); +void func_8095B960(EnOwl* this, PlayState* play); +void func_8095BA84(EnOwl* this, PlayState* play); +void func_8095BE0C(EnOwl* this, PlayState* play); +void func_8095BF20(EnOwl* this, PlayState* play); +void func_8095BF58(EnOwl* this, PlayState* play); +void func_8095C1C8(EnOwl* this, PlayState* play); void func_8095C328(EnOwl* this); void func_8095C408(EnOwl* this); void func_8095C484(EnOwl* this); -void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx); -void func_8095D074(Actor* thisx, GlobalContext* globalCtx); +void func_8095CCF4(Actor* thisx, PlayState* play); +void func_8095D074(Actor* thisx, PlayState* play); void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, EnOwlFunc unkFunc, SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames); @@ -87,18 +87,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2400, ICHAIN_STOP), }; -void func_8095A510(EnOwl* this, GlobalContext* globalCtx) { +void func_8095A510(EnOwl* this, PlayState* play) { this->unk_3FC = ENOWL_GET_F000(&this->actor); if (this->unk_3FC == 15) { this->unk_3FC = -1; this->path = NULL; } else { this->unk_3F8 = 0; - this->path = &globalCtx->setupPathList[this->unk_3FC]; + this->path = &play->setupPathList[this->unk_3FC]; } } -void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Init(Actor* thisx, PlayState* play) { s32 pad; EnOwl* this = THIS; s32 i; @@ -128,11 +128,11 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime1, &object_owl_Skel_00C5F8, &object_owl_Anim_001ADC, - this->jointTable1, this->morphTable1, 21); - SkelAnime_InitFlex(globalCtx, &this->skelAnime2, &object_owl_Skel_0105C0, &object_owl_Anim_00CDB0, - this->jointTable2, this->morphTable2, 16); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime1, &object_owl_Skel_00C5F8, &object_owl_Anim_001ADC, this->jointTable1, + this->morphTable1, 21); + SkelAnime_InitFlex(play, &this->skelAnime2, &object_owl_Skel_0105C0, &object_owl_Anim_00CDB0, this->jointTable2, + this->morphTable2, 16); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.terminalVelocity = -10.0f; this->actor.targetArrowOffset = 500.0f; @@ -150,7 +150,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { switch (owlType) { case ENOWL_GET_TYPE_1: - if ((switchFlag < 0x7F) && Flags_GetSwitch(globalCtx, switchFlag)) { + if ((switchFlag < 0x7F) && Flags_GetSwitch(play, switchFlag)) { Actor_MarkForDeath(&this->actor); return; } @@ -174,7 +174,7 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_3DA = 0; this->unk_3F0 = this->actor.home.pos.y; this->unk_3EC = this->actor.home.rot.y; - func_8095A510(this, globalCtx); + func_8095A510(this, play); switch (owlType) { case ENOWL_GET_TYPE_1: @@ -206,43 +206,43 @@ void EnOwl_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Destroy(Actor* thisx, PlayState* play) { EnOwl* this = THIS; if (ENOWL_GET_TYPE(&this->actor) != ENOWL_GET_TYPE_30) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_8095A920(EnOwl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8095A920(EnOwl* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 6, 0x3E8, 0xC8); } -s32 func_8095A978(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 targetDist, f32 arg4) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +s32 func_8095A978(EnOwl* this, PlayState* play, u16 textId, f32 targetDist, f32 arg4) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { return true; } this->actor.textId = textId; if (this->actor.xzDistToPlayer < targetDist) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, targetDist, arg4, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, targetDist, arg4, EXCH_ITEM_NONE); } return false; } -s32 func_8095A9FC(EnOwl* this, GlobalContext* globalCtx, u16 textId) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +s32 func_8095A9FC(EnOwl* this, PlayState* play, u16 textId) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { return true; } this->actor.textId = textId; if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8500(&this->actor, globalCtx, 350.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 350.0f, 1000.0f, EXCH_ITEM_NONE); } return false; @@ -254,19 +254,19 @@ void func_8095AA70(EnOwl* this) { this->blinkTimer = Rand_S16Offset(60, 60); } -void func_8095AAD0(EnOwl* this, GlobalContext* globalCtx) { +void func_8095AAD0(EnOwl* this, PlayState* play) { s32 switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor); if (switchFlag < 0x7F) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } func_8095AA70(this); } -void func_8095AB1C(EnOwl* this, GlobalContext* globalCtx) { +void func_8095AB1C(EnOwl* this, PlayState* play) { if ((this->unk_3DA % 64) == 0) { - func_8095AAD0(this, globalCtx); + func_8095AAD0(this, play); } } @@ -290,20 +290,20 @@ void func_8095ABA8(EnOwl* this) { this->unk_409 = 4; } -void func_8095ABF0(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_8095ABF0(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x110000FF); - func_8095AAD0(this, globalCtx); + func_8095AAD0(this, play); this->actor.flags &= ~ACTOR_FLAG_10000; } } // Unused? -void func_8095AC50(EnOwl* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_8095AC50(EnOwl* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { Audio_QueueSeqCmd(0x110000FF); if ((this->unk_3DA % 64) == 0) { - func_8095AAD0(this, globalCtx); + func_8095AAD0(this, play); } else { this->actionFlags &= ~2; func_8095ABA8(this); @@ -323,54 +323,54 @@ void func_8095ACEC(EnOwl* this) { } } -void func_8095AD54(EnOwl* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { +void func_8095AD54(EnOwl* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - func_80151938(globalCtx, 0x7D1); + func_80151938(play, 0x7D1); this->actionFunc = func_8095AE00; break; case OWL_OK: - func_80151938(globalCtx, 0x7D3); + func_80151938(play, 0x7D3); this->actionFunc = func_8095ABF0; break; } } } -void func_8095AE00(EnOwl* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x7D2); +void func_8095AE00(EnOwl* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_80151938(play, 0x7D2); this->actionFunc = func_8095AD54; } } -void func_8095AE60(EnOwl* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_80151938(globalCtx, 0x7D1); +void func_8095AE60(EnOwl* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_80151938(play, 0x7D1); this->actionFunc = func_8095AE00; } } -void func_8095AEC0(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); - if (func_8095A978(this, globalCtx, 0x7D0, 360.0f, 200.0f)) { +void func_8095AEC0(EnOwl* this, PlayState* play) { + func_8095A920(this, play); + if (func_8095A978(this, play, 0x7D0, 360.0f, 200.0f)) { func_801A3098(NA_BGM_OWL); this->actionFunc = func_8095AE60; } } -void func_8095AF2C(EnOwl* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_8095AF2C(EnOwl* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.currentTextId == 0xBFE) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.currentTextId == 0xBFE) { func_8095ACEC(this); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_8095ABF0; } else { - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); } } break; @@ -382,9 +382,9 @@ void func_8095AF2C(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095AFEC(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); - if (func_8095A978(this, globalCtx, 0xBF6, 200.0f, 100.0f)) { +void func_8095AFEC(EnOwl* this, PlayState* play) { + func_8095A920(this, play); + if (func_8095A978(this, play, 0xBF6, 200.0f, 100.0f)) { func_801A3098(NA_BGM_OWL); this->actionFunc = func_8095AF2C; this->unk_406 = 0; @@ -423,7 +423,7 @@ void func_8095B158(EnOwl* this) { } } -void func_8095B1E4(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B1E4(EnOwl* this, PlayState* play) { if (this->actor.speedXZ < 6.0f) { this->actor.speedXZ += 1.0f; } @@ -433,7 +433,7 @@ void func_8095B1E4(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095B254(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B254(EnOwl* this, PlayState* play) { if (this->actor.speedXZ < 6.0f) { this->actor.speedXZ += 1.0f; } @@ -447,7 +447,7 @@ void func_8095B254(EnOwl* this, GlobalContext* globalCtx) { func_8095B158(this); } -void func_8095B2F8(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B2F8(EnOwl* this, PlayState* play) { func_8095B06C(this); if (this->skelAnime1.curFrame >= 18.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x200, 0x80); @@ -464,7 +464,7 @@ void func_8095B2F8(EnOwl* this, GlobalContext* globalCtx) { func_8095B158(this); } -void func_8095B3DC(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B3DC(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->actionFunc = func_8095B2F8; Animation_Change(this->skelAnime3, &object_owl_Anim_001168, 1.0f, 0.0f, 35.0f, 2, 0.0f); @@ -475,8 +475,8 @@ void func_8095B3DC(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095B480(EnOwl* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8095B480(EnOwl* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags3 & 0x10000000) { this->actor.textId = 0xBF1; @@ -490,38 +490,38 @@ void func_8095B480(EnOwl* this, GlobalContext* globalCtx) { this->unk_3F0 = this->actor.home.pos.y; this->unk_3EC = this->actor.home.rot.y; this->actor.world.pos = this->actor.home.pos; - func_8095A510(this, globalCtx); + func_8095A510(this, play); this->actor.speedXZ = 0.0f; this->actionFunc = func_8095BE0C; } } -void func_8095B574(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_8095B574(EnOwl* this, PlayState* play) { + func_8095A920(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; func_801A3098(NA_BGM_OWL); this->actionFlags |= 0x40; this->unk_406 = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 200.0f, 400.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 400.0f, EXCH_ITEM_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } - func_8095B480(this, globalCtx); + func_8095B480(this, play); } -void func_8095B650(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B650(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { EnOwl_ChangeMode(this, func_8095B574, func_8095C484, &this->skelAnime2, &object_owl_Anim_00CDB0, 0.0f); this->actor.textId = 0xBF5; this->actionFlags &= ~8; } - func_8095B480(this, globalCtx); + func_8095B480(this, play); } -void func_8095B6C8(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B6C8(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { Animation_Change(this->skelAnime3, &object_owl_Anim_00CB94, -1.0f, Animation_GetLastFrame(&object_owl_Anim_00CB94), 0.0f, 2, 0.0f); @@ -529,10 +529,10 @@ void func_8095B6C8(EnOwl* this, GlobalContext* globalCtx) { this->actionFunc = func_8095B650; } func_8095B158(this); - func_8095B480(this, globalCtx); + func_8095B480(this, play); } -void func_8095B76C(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B76C(EnOwl* this, PlayState* play) { s32 pad; s16 sp4A; f32 sp44 = Path_OrientAndGetDistSq(&this->actor, this->path, this->unk_3F8, &sp4A); @@ -556,7 +556,7 @@ void func_8095B76C(EnOwl* this, GlobalContext* globalCtx) { return; } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OWL, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OWL, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xF00); this->actor.home.rot.x++; if (this->actor.home.rot.x >= 3) { @@ -575,10 +575,10 @@ void func_8095B76C(EnOwl* this, GlobalContext* globalCtx) { func_8095B06C(this); func_8095B158(this); - func_8095B480(this, globalCtx); + func_8095B480(this, play); } -void func_8095B960(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B960(EnOwl* this, PlayState* play) { if (this->skelAnime1.curFrame >= 18.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x200, 0x80); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -590,10 +590,10 @@ void func_8095B960(EnOwl* this, GlobalContext* globalCtx) { } func_8095B158(this); - func_8095B480(this, globalCtx); + func_8095B480(this, play); } -void func_8095B9FC(EnOwl* this, GlobalContext* globalCtx) { +void func_8095B9FC(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->actionFunc = func_8095B960; Animation_Change(this->skelAnime3, &object_owl_Anim_001168, 1.0f, 0.0f, 35.0f, 2, 0.0f); @@ -602,42 +602,42 @@ void func_8095B9FC(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); +void func_8095BA84(EnOwl* this, PlayState* play) { + func_8095A920(this, play); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0xBEC: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); if (gSaveContext.save.weekEventReg[9] & 0x40) { - func_80151938(globalCtx, 0xBF4); + func_80151938(play, 0xBF4); } else { gSaveContext.save.weekEventReg[9] |= 0x40; - func_80151938(globalCtx, 0xBED); + func_80151938(play, 0xBED); } break; case 1: func_8019F230(); - func_80151938(globalCtx, 0xBEF); + func_80151938(play, 0xBEF); break; } break; case 0xBF2: - switch (globalCtx->msgCtx.choiceIndex) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(globalCtx, 0xBF4); + func_80151938(play, 0xBF4); return; case 1: func_8019F230(); - func_80151938(globalCtx, 0xBF3); + func_80151938(play, 0xBF3); return; } break; @@ -646,25 +646,25 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0xBEA: gSaveContext.save.weekEventReg[9] |= 0x20; - func_80151938(globalCtx, 0xBEB); + func_80151938(play, 0xBEB); break; case 0xBEB: case 0xBF0: - func_80151938(globalCtx, 0xBEC); + func_80151938(play, 0xBEC); break; case 0xBED: case 0xBF4: - func_80151938(globalCtx, 0xBEE); + func_80151938(play, 0xBEE); break; case 0xBEE: - func_801477B4(globalCtx); + func_801477B4(play); Audio_QueueSeqCmd(0x110000FF); EnOwl_ChangeMode(this, func_8095B9FC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, 0.0f); @@ -680,7 +680,7 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { case 0xBEF: case 0xBF3: - func_801477B4(globalCtx); + func_801477B4(play); Audio_QueueSeqCmd(0x110000FF); func_8095ACEC(this); this->actor.flags &= ~ACTOR_FLAG_10000; @@ -689,11 +689,11 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { break; case 0xBF1: - func_80151938(globalCtx, 0xBF2); + func_80151938(play, 0xBF2); break; case 0xBF5: - func_801477B4(globalCtx); + func_801477B4(play); Audio_QueueSeqCmd(0x110000FF); this->actor.flags &= ~ACTOR_FLAG_10000; EnOwl_ChangeMode(this, func_8095B3DC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, @@ -709,35 +709,35 @@ void func_8095BA84(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095BE0C(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_8095BE0C(EnOwl* this, PlayState* play) { + func_8095A920(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; func_801A3098(NA_BGM_OWL); this->unk_406 = 1; this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { if (this->actor.isTargeted) { - func_800B8500(&this->actor, globalCtx, 200.0f, 200.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 200.0f, EXCH_ITEM_NONE); } } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 200.0f, 200.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 200.0f, EXCH_ITEM_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } } -void func_8095BF20(EnOwl* this, GlobalContext* globalCtx) { - func_8095A9FC(this, globalCtx, 0x7D0); +void func_8095BF20(EnOwl* this, PlayState* play) { + func_8095A9FC(this, play, 0x7D0); this->actionFunc = func_8095ABF0; } -void func_8095BF58(EnOwl* this, GlobalContext* globalCtx) { - func_8095A920(this, globalCtx); +void func_8095BF58(EnOwl* this, PlayState* play) { + func_8095A920(this, play); } -void func_8095BF78(EnOwl* this, GlobalContext* globalCtx) { +void func_8095BF78(EnOwl* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_20; if (this->actor.xzDistToPlayer > 6000.0f) { Actor_MarkForDeath(&this->actor); @@ -758,7 +758,7 @@ void func_8095BF78(EnOwl* this, GlobalContext* globalCtx) { } } -void func_8095C09C(EnOwl* this, GlobalContext* globalCtx) { +void func_8095C09C(EnOwl* this, PlayState* play) { if (this->skelAnime1.curFrame > 10.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x400, 0x40); this->actor.shape.rot.y = this->actor.world.rot.y; @@ -783,7 +783,7 @@ void func_8095C09C(EnOwl* this, GlobalContext* globalCtx) { func_8095B158(this); } -void func_8095C1C8(EnOwl* this, GlobalContext* globalCtx) { +void func_8095C1C8(EnOwl* this, PlayState* play) { if (this->actionFlags & 1) { this->unk_3EA = 3; EnOwl_ChangeMode(this, func_8095C09C, func_8095C484, &this->skelAnime1, &object_owl_Anim_001168, 0.0f); @@ -879,7 +879,7 @@ void func_8095C568(EnOwl* this) { } } -void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Update(Actor* thisx, PlayState* play) { s32 pad; EnOwl* this = THIS; s16 sp36; @@ -892,11 +892,11 @@ void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_414(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_8095C568(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.update != NULL) { if ((this->skelAnime1.animation == &object_owl_Anim_001ADC) && Animation_OnFrame(&this->skelAnime1, 4.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OWL_FLUTTER); @@ -1062,9 +1062,9 @@ void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx) { +void func_8095CCF4(Actor* thisx, PlayState* play) { EnOwl* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (player->stateFlags3 & 0x10000000) { Actor_MarkForDeath(&this->actor); @@ -1077,7 +1077,7 @@ void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx) { } this->actor.world.pos.y -= 1.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); if (this->actor.bgCheckFlags & 1) { this->unk_3DA = (this->unk_3DA >> 3) * 7; if (this->unk_3DC > 0) { @@ -1092,7 +1092,7 @@ void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx) { this->unk_3DA -= (s16)(this->unk_3D8 >> 6); } -s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnOwl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnOwl* this = THIS; switch (limbIndex) { @@ -1122,7 +1122,7 @@ s32 EnOwl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnOwl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnOwl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnOwl* this = THIS; Vec3f sp18; @@ -1140,7 +1140,7 @@ void EnOwl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnOwl_Draw(Actor* thisx, PlayState* play) { static TexturePtr eyeTextures[] = { object_owl_Tex_008EB8, object_owl_Tex_0092B8, @@ -1149,45 +1149,45 @@ void EnOwl_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnOwl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeTexIndex])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime3->skeleton, this->skelAnime3->jointTable, - this->skelAnime3->dListCount, EnOwl_OverrideLimbDraw, EnOwl_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime3->skeleton, this->skelAnime3->jointTable, this->skelAnime3->dListCount, + EnOwl_OverrideLimbDraw, EnOwl_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_8095D074(Actor* thisx, GlobalContext* globalCtx) { +void func_8095D074(Actor* thisx, PlayState* play) { EnOwl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, 500.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->unk_3D8 - 0x4000, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -500.0f, MTXMODE_APPLY); if (this->unk_3DC >= 0x20) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPDisplayList(POLY_OPA_DISP++, object_owl_DL_001200); } else { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_XLU_SURF2); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)(this->unk_3DC * 8)); gSPDisplayList(POLY_XLU_DISP++, object_owl_DL_001200); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnOwl_ChangeMode(EnOwl* this, EnOwlActionFunc actionFunc, EnOwlFunc unkFunc, SkelAnime* skelAnime, 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 ee9e1fdd82..9da8ed9d72 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -5,7 +5,7 @@ struct EnOwl; -typedef void (*EnOwlActionFunc)(struct EnOwl*, GlobalContext*); +typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*); typedef void (*EnOwlFunc)(struct EnOwl*); #define ENOWL_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC) diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 7ca549ca43..8bd89fe6b6 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -13,62 +13,62 @@ #define THIS ((EnPamera*)thisx) -void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPamera_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPamera_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPamera_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPamera_Init(Actor* thisx, PlayState* play); +void EnPamera_Destroy(Actor* thisx, PlayState* play); +void EnPamera_Update(Actor* thisx, PlayState* play); +void EnPamera_Draw(Actor* thisx, PlayState* play); -s32 func_80BD84F0(EnPamera* this, GlobalContext* globalCtx); -void func_80BD8588(EnPamera* this, GlobalContext* globalCtx); +s32 func_80BD84F0(EnPamera* this, PlayState* play); +void func_80BD8588(EnPamera* this, PlayState* play); void func_80BD8658(EnPamera* this); void func_80BD8700(EnPamera* this); -void func_80BD8758(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8758(EnPamera* this, PlayState* play); void func_80BD8908(EnPamera* this); -void func_80BD8964(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8964(EnPamera* this, PlayState* play); void func_80BD8A38(EnPamera* this); -void func_80BD8A7C(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8A7C(EnPamera* this, PlayState* play); void func_80BD8B50(EnPamera* this); -void func_80BD8B70(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8B70(EnPamera* this, PlayState* play); void func_80BD8CCC(EnPamera* this); -void func_80BD8D1C(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8D1C(EnPamera* this, PlayState* play); void func_80BD8D80(EnPamera* this); -void func_80BD8DB0(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8DB0(EnPamera* this, PlayState* play); void EnPamera_LookDownWell(EnPamera* this); -void func_80BD8F60(EnPamera* this, GlobalContext* globalCtx); +void func_80BD8F60(EnPamera* this, PlayState* play); void func_80BD8FF0(EnPamera* this); -void func_80BD909C(EnPamera* this, GlobalContext* globalCtx); -s32 func_80BD9234(EnPamera* this, GlobalContext* globalCtx); -void func_80BD92D0(EnPamera* this, GlobalContext* globalCtx); -void func_80BD9338(EnPamera* this, GlobalContext* globalCtx); -void func_80BD9384(EnPamera* this, GlobalContext* globalCtx); +void func_80BD909C(EnPamera* this, PlayState* play); +s32 func_80BD9234(EnPamera* this, PlayState* play); +void func_80BD92D0(EnPamera* this, PlayState* play); +void func_80BD9338(EnPamera* this, PlayState* play); +void func_80BD9384(EnPamera* this, PlayState* play); void func_80BD93CC(EnPamera* this, s16 arg1, s16 arg2); -void func_80BD93F4(EnPamera* this, GlobalContext* globalCtx); -void func_80BD94E0(EnPamera* this, GlobalContext* globalCtx); -void func_80BD9840(EnPamera* this, GlobalContext* globalCtx); +void func_80BD93F4(EnPamera* this, PlayState* play); +void func_80BD94E0(EnPamera* this, PlayState* play); +void func_80BD9840(EnPamera* this, PlayState* play); void func_80BD9904(EnPamera* this); -void func_80BD9928(EnPamera* this, GlobalContext* globalCtx); +void func_80BD9928(EnPamera* this, PlayState* play); void func_80BD9938(EnPamera* this); -void func_80BD994C(EnPamera* this, GlobalContext* globalCtx); +void func_80BD994C(EnPamera* this, PlayState* play); void func_80BD9A9C(EnPamera* this); -void EnPamera_HandleDialogue(EnPamera* this, GlobalContext* globalCtx); -void func_80BD9B4C(EnPamera* this, GlobalContext* globalCtx); -void func_80BD9C70(EnPamera* this, GlobalContext* globalCtx); -s32 func_80BD9CB8(EnPamera* this, GlobalContext* globalCtx); +void EnPamera_HandleDialogue(EnPamera* this, PlayState* play); +void func_80BD9B4C(EnPamera* this, PlayState* play); +void func_80BD9C70(EnPamera* this, PlayState* play); +s32 func_80BD9CB8(EnPamera* this, PlayState* play); void func_80BD9E60(EnPamera* this); -void func_80BD9E78(EnPamera* this, GlobalContext* globalCtx); +void func_80BD9E78(EnPamera* this, PlayState* play); void func_80BD9E88(EnPamera* this); -void func_80BD9ED0(EnPamera* this, GlobalContext* globalCtx); +void func_80BD9ED0(EnPamera* this, PlayState* play); void func_80BD9EE0(EnPamera* this); -void func_80BD9F3C(EnPamera* this, GlobalContext* globalCtx); +void func_80BD9F3C(EnPamera* this, PlayState* play); void func_80BDA038(EnPamera* this); -void func_80BDA090(EnPamera* this, GlobalContext* globalCtx); +void func_80BDA090(EnPamera* this, PlayState* play); void func_80BDA0A0(EnPamera* this); -void func_80BDA0FC(EnPamera* this, GlobalContext* globalCtx); +void func_80BDA0FC(EnPamera* this, PlayState* play); void func_80BDA170(EnPamera* this); -void func_80BDA1C8(EnPamera* this, GlobalContext* globalCtx); +void func_80BDA1C8(EnPamera* this, PlayState* play); void func_80BDA288(EnPamera* this); -void func_80BDA2E0(EnPamera* this, GlobalContext* globalCtx); -void func_80BDA344(Actor* thisx, GlobalContext* globalCtx); +void func_80BDA2E0(EnPamera* this, PlayState* play); +void func_80BDA344(Actor* thisx, PlayState* play); const ActorInit En_Pamera_InitVars = { ACTOR_EN_PAMERA, @@ -130,16 +130,16 @@ static TexturePtr D_80BDA604[] = { object_pamera_Tex_0066E8, object_pamera_Tex_0 static TexturePtr D_80BDA610[] = { object_pamera_Tex_0072E8, object_pamera_Tex_0073E8 }; -void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPamera_Init(Actor* thisx, PlayState* play) { s32 pad; EnPamera* this = THIS; Vec3f sp44; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_pamera_Skel_008448, &object_pamera_Anim_0005BC, - this->jointTable, this->morphTable, PAMERA_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_pamera_Skel_008448, &object_pamera_Anim_0005BC, this->jointTable, + this->morphTable, PAMERA_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit2); this->actor.targetMode = 6; this->unk_312 = 0; @@ -150,9 +150,9 @@ void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_322 = 0; this->unk_324 = 0; if ((this->actor.params & 0xF000) >> 0xC) { - func_80BD9840(this, globalCtx); + func_80BD9840(this, play); } else { - func_80BD8588(this, globalCtx); + func_80BD8588(this, play); func_80BD8658(this); if (1) {} if (!(gSaveContext.save.weekEventReg[14] & 4) || (gSaveContext.save.weekEventReg[52] & 0x20) || @@ -179,8 +179,8 @@ void EnPamera_Init(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80BD84F0(EnPamera* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_DOOR].first; +s32 func_80BD84F0(EnPamera* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_DOOR].first; while (actor != NULL) { if ((actor->id == ACTOR_EN_DOOR) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &actor->world.pos) < 200.0f)) { @@ -193,15 +193,15 @@ s32 func_80BD84F0(EnPamera* this, GlobalContext* globalCtx) { return false; } -void func_80BD8588(EnPamera* this, GlobalContext* globalCtx) { - Path* path = &globalCtx->setupPathList[((this->actor.params & 0xFF0) >> 4)]; +void func_80BD8588(EnPamera* this, PlayState* play) { + Path* path = &play->setupPathList[((this->actor.params & 0xFF0) >> 4)]; Vec3f sp28; if (path == NULL) { Actor_MarkForDeath(&this->actor); } if (gSaveContext.save.weekEventReg[61] & 4) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathIndex = 0; @@ -224,10 +224,10 @@ void func_80BD8658(EnPamera* this) { } } -void EnPamera_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPamera_Destroy(Actor* thisx, PlayState* play) { EnPamera* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BD8700(EnPamera* this) { @@ -237,17 +237,17 @@ void func_80BD8700(EnPamera* this) { this->actionFunc = func_80BD8758; } -void func_80BD8758(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8758(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 1800) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0]) && (this->cutscenes[0] != -1)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[0])), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->cutscenes[0])), &this->actor); this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; - func_80BD9338(this, globalCtx); + func_80BD9338(this, play); func_80BD8908(this); } else if ((this->cutscenes[0] != -1) && (this->actor.xzDistToPlayer < 1000.0f)) { ActorCutscene_SetIntentToPlay(this->cutscenes[0]); @@ -256,7 +256,7 @@ void func_80BD8758(EnPamera* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; - func_80BD9338(this, globalCtx); + func_80BD9338(this, play); func_80BD8908(this); } } @@ -266,7 +266,7 @@ void func_80BD8758(EnPamera* this, GlobalContext* globalCtx) { this->actor.draw = NULL; } } - if (func_80BD9234(this, globalCtx)) { + if (func_80BD9234(this, play)) { // this is 1760 frames, which is ~90sec this->hideInisdeTimer = 88 * 20; } @@ -279,7 +279,7 @@ void func_80BD8908(EnPamera* this) { this->actionFunc = func_80BD8964; } -void func_80BD8964(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8964(EnPamera* this, PlayState* play) { Vec3f vec; vec.x = this->pathPoints->x; @@ -299,14 +299,14 @@ void func_80BD8A38(EnPamera* this) { this->actionFunc = func_80BD8A7C; } -void func_80BD8A7C(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8A7C(EnPamera* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 0xA, 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, 1.5f) < 10.0f) { gSaveContext.save.weekEventReg[59] &= (u8)~1; if (!(gSaveContext.save.weekEventReg[61] & 4)) { - func_80BD92D0(this, globalCtx); + func_80BD92D0(this, play); gSaveContext.save.weekEventReg[61] |= 4; } func_80BD8700(this); @@ -318,7 +318,7 @@ void func_80BD8B50(EnPamera* this) { this->actor.gravity = -2.0f; } -void func_80BD8B70(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8B70(EnPamera* this, PlayState* play) { Vec3f vec; s16 sp32; @@ -335,7 +335,7 @@ void func_80BD8B70(EnPamera* this, GlobalContext* globalCtx) { func_80BD8CCC(this); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.world.pos.y += this->actor.gravity; } @@ -346,7 +346,7 @@ void func_80BD8CCC(EnPamera* this) { this->actionFunc = func_80BD8D1C; } -void func_80BD8D1C(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8D1C(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 200) { this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); @@ -362,7 +362,7 @@ void func_80BD8D80(EnPamera* this) { this->actionFunc = func_80BD8DB0; } -void func_80BD8DB0(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8DB0(EnPamera* this, PlayState* play) { Vec3f vec; s16 sp32; @@ -376,10 +376,10 @@ void func_80BD8DB0(EnPamera* this, GlobalContext* globalCtx) { } else if (this->pathIndex > 0) { this->pathIndex--; } else { - func_80BD9338(this, globalCtx); + func_80BD9338(this, play); func_80BD8A38(this); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actor.world.pos.y += this->actor.gravity; } @@ -389,7 +389,7 @@ void EnPamera_LookDownWell(EnPamera* this) { this->actionFunc = func_80BD8F60; } -void func_80BD8F60(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD8F60(EnPamera* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x3000, 0x1000); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); @@ -413,13 +413,13 @@ void func_80BD8FF0(EnPamera* this) { this->actionFunc = func_80BD909C; } -void func_80BD909C(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD909C(EnPamera* this, PlayState* play) { } -void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BD90AC(EnPamera* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE && (this->actionFunc != func_80BD8758) && + if (Player_GetMask(play) != PLAYER_MASK_STONE && (this->actionFunc != func_80BD8758) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) && (this->actionFunc != func_80BD8F60) && ((this->actionFunc != func_80BD8B70) || (this->pathIndex != 0)) && ((this->actionFunc != func_80BD8DB0) || (this->actor.speedXZ != 3.0f)) && @@ -428,7 +428,7 @@ void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) { (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { if ((ActorCutscene_GetCanPlayNext(this->cutscenes[1])) && ((this->cutscenes[1] != -1))) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[1])), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->cutscenes[1])), &this->actor); EnPamera_LookDownWell(this); } else if (this->cutscenes[1] != -1) { @@ -439,8 +439,8 @@ void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) { } } -s32 func_80BD9234(EnPamera* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; +s32 func_80BD9234(EnPamera* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (actor != NULL) { if ((actor->id == ACTOR_EN_BOM) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &actor->world.pos) < 500.0f) && @@ -453,11 +453,11 @@ s32 func_80BD9234(EnPamera* this, GlobalContext* globalCtx) { return 0; } -void func_80BD92D0(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD92D0(EnPamera* this, PlayState* play) { Path* path; s32 pathId = this->pathId; - path = &globalCtx->setupPathList[pathId]; + path = &play->setupPathList[pathId]; if (pathId >= 0) { this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathIndex = 0; @@ -466,17 +466,17 @@ void func_80BD92D0(EnPamera* this, GlobalContext* globalCtx) { } } -void func_80BD9338(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9338(EnPamera* this, PlayState* play) { Actor* actor; - func_80BD84F0(this, globalCtx); + func_80BD84F0(this, play); actor = this->actor.child; if ((actor != NULL) && (actor->id == ACTOR_EN_DOOR)) { ((EnDoor*)actor)->unk_1A7 = -0x32; } } -void func_80BD9384(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9384(EnPamera* this, PlayState* play) { if (this->unk_316 < 40) { this->unk_316++; } else { @@ -493,7 +493,7 @@ void func_80BD93CC(EnPamera* this, s16 arg1, s16 arg2) { this->unk_314 = arg2; } -void func_80BD93F4(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD93F4(EnPamera* this, PlayState* play) { if ((this->actionFunc == func_80BD8B70) || (this->actionFunc == func_80BD8DB0) || (this->actionFunc == func_80BD8964) || (this->actionFunc == func_80BD8A7C)) { if (this->skelAnime.animation == &object_pamera_Anim_008AE0) { @@ -507,32 +507,31 @@ void func_80BD93F4(EnPamera* this, GlobalContext* globalCtx) { } } -void func_80BD94E0(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD94E0(EnPamera* this, PlayState* play) { if ((this->actionFunc != func_80BD8B70) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD909C) && (this->actionFunc != func_80BD8D1C) && ((this->actionFunc != func_80BD8DB0) || (this->actor.speedXZ == 3.0f))) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->limb9Rot, &this->limb8Rot, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->limb9Rot, &this->limb8Rot, this->actor.focus.pos); } else { Actor_TrackNone(&this->limb9Rot, &this->limb8Rot); } } -void EnPamera_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPamera_Update(Actor* thisx, PlayState* play) { s32 pad; EnPamera* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - func_80BD90AC(this, globalCtx); - func_80BD9384(this, globalCtx); - func_80BD94E0(this, globalCtx); + func_80BD90AC(this, play); + func_80BD9384(this, play); + func_80BD94E0(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_80BD93F4(this, globalCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_80BD93F4(this, play); } -s32 EnPamera_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnPamera_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPamera* this = THIS; if (limbIndex == PAMERA_LIMB_HAIR) { @@ -542,7 +541,7 @@ s32 EnPamera_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi return false; } -void EnPamera_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnPamera_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPamera* this = THIS; if (limbIndex == PAMERA_LIMB_HAIR) { @@ -550,20 +549,20 @@ void EnPamera_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnPamera_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPamera_Draw(Actor* thisx, PlayState* play) { EnPamera* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BDA604[this->unk_312])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80BDA610[this->unk_314])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80BDA5FC[this->unk_310])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPamera_OverrideLimbDraw, EnPamera_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80BD9840(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9840(EnPamera* this, PlayState* play) { this->actor.update = func_80BDA344; this->actor.flags |= ACTOR_FLAG_2000000; this->actor.flags |= ACTOR_FLAG_100000; @@ -587,39 +586,39 @@ void func_80BD9904(EnPamera* this) { this->actionFunc = &func_80BD9928; } -void func_80BD9928(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9928(EnPamera* this, PlayState* play) { } void func_80BD9938(EnPamera* this) { this->actionFunc = func_80BD994C; } -void func_80BD994C(EnPamera* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) { +void func_80BD994C(EnPamera* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { if (1) {} func_80BD93CC(this, 0, 1); - Message_StartTextbox(globalCtx, 0x15A8, &this->actor); + Message_StartTextbox(play, 0x15A8, &this->actor); this->unk_324 = 0x15A8; } else if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || ((gSaveContext.save.weekEventReg[52] & 0x20) && (!(gSaveContext.save.weekEventReg[75] & 0x20)))) { func_80BD93CC(this, 1, 0); - Message_StartTextbox(globalCtx, 0x158E, &this->actor); + Message_StartTextbox(play, 0x158E, &this->actor); this->unk_324 = 0x158E; } else { if (!(this->unk_322 & 1)) { this->unk_322 |= 1; - Message_StartTextbox(globalCtx, 0x1587, &this->actor); + Message_StartTextbox(play, 0x1587, &this->actor); this->unk_324 = 0x1587; } else { - Message_StartTextbox(globalCtx, 0x158C, &this->actor); + Message_StartTextbox(play, 0x158C, &this->actor); this->unk_324 = 0x158C; } } func_80BD9A9C(this); } else { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -627,8 +626,8 @@ void func_80BD9A9C(EnPamera* this) { this->actionFunc = EnPamera_HandleDialogue; } -void EnPamera_HandleDialogue(EnPamera* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void EnPamera_HandleDialogue(EnPamera* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -636,10 +635,10 @@ void EnPamera_HandleDialogue(EnPamera* this, GlobalContext* globalCtx) { case 4: break; case 5: - func_80BD9B4C(this, globalCtx); + func_80BD9B4C(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80BD9938(this); } break; @@ -650,54 +649,54 @@ void EnPamera_HandleDialogue(EnPamera* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80BD9B4C(EnPamera* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80BD9B4C(EnPamera* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->unk_324) { case 0x1587: - Message_StartTextbox(globalCtx, 0x1588, &this->actor); + Message_StartTextbox(play, 0x1588, &this->actor); this->unk_324 = 0x1588; break; case 0x1588: - Message_StartTextbox(globalCtx, 0x1589, &this->actor); + Message_StartTextbox(play, 0x1589, &this->actor); this->unk_324 = 0x1589; break; case 0x1589: - Message_StartTextbox(globalCtx, 0x158A, &this->actor); + Message_StartTextbox(play, 0x158A, &this->actor); this->unk_324 = 0x158A; break; case 0x158A: - Message_StartTextbox(globalCtx, 0x158B, &this->actor); + Message_StartTextbox(play, 0x158B, &this->actor); this->unk_324 = 0x158B; break; case 0x158C: - Message_StartTextbox(globalCtx, 0x158D, &this->actor); + Message_StartTextbox(play, 0x158D, &this->actor); this->unk_324 = 0x158D; break; case 0x158E: case 0x15A8: - func_801477B4(globalCtx); - func_80BD9C70(this, globalCtx); + func_801477B4(play); + func_80BD9C70(this, play); break; } } } -void func_80BD9C70(EnPamera* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x2020; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 0x46; +void func_80BD9C70(EnPamera* this, PlayState* play) { + play->nextEntranceIndex = 0x2020; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 0x46; gSaveContext.nextTransition = 2; } -s32 func_80BD9CB8(EnPamera* this, GlobalContext* globalCtx) { +s32 func_80BD9CB8(EnPamera* this, PlayState* play) { s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 0x1E5)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 0x1E5); - if (this->unk_326 != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->unk_326 = globalCtx->csCtx.actorActions[actionIndex]->action; + if (Cutscene_CheckActorAction(play, 0x1E5)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x1E5); + if (this->unk_326 != play->csCtx.actorActions[actionIndex]->action) { + this->unk_326 = play->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: func_80BD9E88(this); break; @@ -722,11 +721,11 @@ s32 func_80BD9CB8(EnPamera* this, GlobalContext* globalCtx) { break; } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); - this->setupFunc(this, globalCtx); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + this->setupFunc(this, play); return 1; } - if ((globalCtx->csCtx.state == 0) && (gSaveContext.save.weekEventReg[75] & 0x20)) { + if ((play->csCtx.state == 0) && (gSaveContext.save.weekEventReg[75] & 0x20)) { if ((this->actionFunc != func_80BD994C) && (this->actionFunc != EnPamera_HandleDialogue)) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80BD9904(this); @@ -742,7 +741,7 @@ void func_80BD9E60(EnPamera* this) { this->setupFunc = func_80BD9E78; } -void func_80BD9E78(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9E78(EnPamera* this, PlayState* play) { } void func_80BD9E88(EnPamera* this) { @@ -751,7 +750,7 @@ void func_80BD9E88(EnPamera* this) { this->setupFunc = func_80BD9ED0; } -void func_80BD9ED0(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9ED0(EnPamera* this, PlayState* play) { } void func_80BD9EE0(EnPamera* this) { @@ -761,7 +760,7 @@ void func_80BD9EE0(EnPamera* this) { this->setupFunc = func_80BD9F3C; } -void func_80BD9F3C(EnPamera* this, GlobalContext* globalCtx) { +void func_80BD9F3C(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f) || @@ -784,7 +783,7 @@ void func_80BDA038(EnPamera* this) { this->setupFunc = func_80BDA090; } -void func_80BDA090(EnPamera* this, GlobalContext* globalCtx) { +void func_80BDA090(EnPamera* this, PlayState* play) { } void func_80BDA0A0(EnPamera* this) { @@ -794,7 +793,7 @@ void func_80BDA0A0(EnPamera* this) { this->setupFunc = func_80BDA0FC; } -void func_80BDA0FC(EnPamera* this, GlobalContext* globalCtx) { +void func_80BDA0FC(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; @@ -811,7 +810,7 @@ void func_80BDA170(EnPamera* this) { this->setupFunc = func_80BDA1C8; } -void func_80BDA1C8(EnPamera* this, GlobalContext* globalCtx) { +void func_80BDA1C8(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f)) { @@ -832,7 +831,7 @@ void func_80BDA288(EnPamera* this) { this->setupFunc = func_80BDA2E0; } -void func_80BDA2E0(EnPamera* this, GlobalContext* globalCtx) { +void func_80BDA2E0(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; @@ -841,14 +840,14 @@ void func_80BDA2E0(EnPamera* this, GlobalContext* globalCtx) { } } -void func_80BDA344(Actor* thisx, GlobalContext* globalCtx) { +void func_80BDA344(Actor* thisx, PlayState* play) { s32 pad; EnPamera* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - func_80BD9384(this, globalCtx); - if (func_80BD9CB8(this, globalCtx)) { + func_80BD9384(this, play); + if (func_80BD9CB8(this, play)) { // Pamela is outside if (gSaveContext.save.weekEventReg[59] & 1) { gSaveContext.save.weekEventReg[59] &= (u8)~1; @@ -858,13 +857,13 @@ void func_80BDA344(Actor* thisx, GlobalContext* globalCtx) { } Actor_TrackNone(&this->limb9Rot, &this->limb8Rot); } else { - func_80BD94E0(this, globalCtx); + func_80BD94E0(this, play); if (this->actionFunc == func_80BD994C) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (gSaveContext.save.weekEventReg[14] & 4) { - globalCtx->roomCtx.unk7A[0]++; + play->roomCtx.unk7A[0]++; } } } diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h index d19030aae7..0cebc213f7 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h @@ -32,8 +32,8 @@ typedef enum { /* 23 */ PAMERA_LIMB_MAX } ObjectPameraLimbs; -typedef void (*EnPameraActionFunc)(struct EnPamera*, GlobalContext*); -typedef void (*EnPameraSetupFunc)(struct EnPamera*, GlobalContext*); +typedef void (*EnPameraActionFunc)(struct EnPamera*, PlayState*); +typedef void (*EnPameraSetupFunc)(struct EnPamera*, PlayState*); typedef struct EnPamera { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 86b2eb6711..49847ef54e 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -13,58 +13,58 @@ #define THIS ((EnPametfrog*)thisx) -void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPametfrog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPametfrog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPametfrog_Init(Actor* thisx, PlayState* play); +void EnPametfrog_Destroy(Actor* thisx, PlayState* play); +void EnPametfrog_Update(Actor* thisx, PlayState* play); +void EnPametfrog_Draw(Actor* thisx, PlayState* play); -void EnPametfrog_JumpWaterEffects(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_RearOnSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_JumpWaterEffects(EnPametfrog* this, PlayState* play); +void EnPametfrog_RearOnSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupRearOnSnapperWave(EnPametfrog* this); -void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupRearOnSnapperRise(EnPametfrog* this); -void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_FallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, PlayState* play); +void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupJumpToWall(EnPametfrog* this); -void EnPametfrog_JumpToWall(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_JumpToWall(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupWallCrawl(EnPametfrog* this); -void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_WallCrawl(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupWallPause(EnPametfrog* this); -void EnPametfrog_WallPause(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_WallPause(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupClimbDownWall(EnPametfrog* this); -void EnPametfrog_ClimbDownWall(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_ClimbDownWall(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupRunToSnapper(EnPametfrog* this); -void EnPametfrog_RunToSnapper(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_RunToSnapper(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this); -void EnPametfrog_JumpOnSnapper(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_JumpOnSnapper(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupLandOnSnapper(EnPametfrog* this); -void EnPametfrog_LandOnSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_FallOnGround(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupFallOnGround(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_DefeatGekko(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_DefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SpawnFrog(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_PlayCutscene(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_LandOnSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play); +void EnPametfrog_FallOnGround(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupFallOnGround(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play); +void EnPametfrog_DefeatGekko(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_DefeatSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play); +void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play); +void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupLookAround(EnPametfrog* this); -void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_LookAround(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupJumpToLink(EnPametfrog* this); -void EnPametfrog_JumpToLink(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupMeleeAttack(EnPametfrog* this); -void EnPametfrog_MeleeAttack(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_MeleeAttack(EnPametfrog* this, PlayState* play); void EnPametfrog_SetupCutscene(EnPametfrog* this); -void EnPametfrog_Damage(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_Stun(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_CallSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx); -void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx); +void EnPametfrog_Damage(EnPametfrog* this, PlayState* play); +void EnPametfrog_Stun(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_CallSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play); +void EnPametfrog_SnapperSpawn(EnPametfrog* this, PlayState* play); +void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play); +void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, PlayState* play); const ActorInit En_Pametfrog_InitVars = { ACTOR_EN_PAMETFROG, @@ -179,32 +179,31 @@ static s32 isFrogReturnedFlags[] = { (33 << 8) | 0x02, // Laundry Pool Frog Returned }; -void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPametfrog_Init(Actor* thisx, PlayState* play) { EnPametfrog* this = THIS; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 55.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGekkoSkel, &gGekkoBoxingStanceAnim, this->jointTable, - this->morphTable, GEKKO_LIMB_MAX); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colElement); + SkelAnime_InitFlex(play, &this->skelAnime, &gGekkoSkel, &gGekkoBoxingStanceAnim, this->jointTable, this->morphTable, + GEKKO_LIMB_MAX); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colElement); this->params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(globalCtx, globalCtx->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->params); } } else { for (i = 0; i < 2; i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BIGPAMET, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - 0) == NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BIGPAMET, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0) == NULL) { Actor_MarkForDeath(&this->actor); } else { this->actor.params = GEKKO_PRE_SNAPPER; @@ -213,10 +212,10 @@ void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPametfrog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPametfrog_Destroy(Actor* thisx, PlayState* play) { EnPametfrog* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } u8 EnPametfrog_Vec3fNormalize(Vec3f* vec) { @@ -239,38 +238,38 @@ void EnPametfrog_Freeze(EnPametfrog* this) { this->drawDmgEffAlpha = 1.0f; } -void EnPametfrog_Thaw(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_Thaw(EnPametfrog* this, PlayState* play) { this->freezeTimer = 0; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->collider.elements->info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); } } -void EnPametfrog_JumpWaterEffects(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_JumpWaterEffects(EnPametfrog* this, PlayState* play) { Vec3f pos; if (this->actor.depthInWater > 0.0f) { pos.x = this->actor.world.pos.x; pos.z = this->actor.world.pos.z; pos.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &pos, 150, 550, 0); + EffectSsGRipple_Spawn(play, &pos, 150, 550, 0); pos.y += 8.0f; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 550); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 550); } } -void EnPametfrog_IdleWaterEffects(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_IdleWaterEffects(EnPametfrog* this, PlayState* play) { Vec3f pos; - if ((this->actor.depthInWater > 0.0f) && ((globalCtx->gameplayFrames % 14) == 0)) { + if ((this->actor.depthInWater > 0.0f) && ((play->gameplayFrames % 14) == 0)) { pos.x = this->actor.world.pos.x; pos.z = this->actor.world.pos.z; pos.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &pos, 150, 550, 0); + EffectSsGRipple_Spawn(play, &pos, 150, 550, 0); } } @@ -324,8 +323,8 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) { return true; } -void EnPametfrog_ShakeCamera(EnPametfrog* this, GlobalContext* globalCtx, f32 magShakeXZ, f32 magShakeY) { - Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); +void EnPametfrog_ShakeCamera(EnPametfrog* this, PlayState* play, f32 magShakeXZ, f32 magShakeY) { + Camera* subCam = Play_GetCamera(play, this->subCamId); s16 subCamYaw; Vec3f subCamEye; @@ -333,22 +332,22 @@ void EnPametfrog_ShakeCamera(EnPametfrog* this, GlobalContext* globalCtx, f32 ma subCamEye.x = (Math_SinS(subCamYaw) * magShakeXZ) + subCam->at.x; subCamEye.y = subCam->at.y + magShakeY; subCamEye.z = (Math_CosS(subCamYaw) * magShakeXZ) + subCam->at.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); } -void EnPametfrog_StopCutscene(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { Camera* subCam; if (this->subCamId != CAM_ID_MAIN) { - subCam = Play_GetCamera(globalCtx, this->subCamId); - Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + subCam = Play_GetCamera(play, this->subCamId); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->cutscene); - func_800B724C(globalCtx, &this->actor, 6); + func_800B724C(play, &this->actor, 6); } } -void EnPametfrog_PlaceSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_PlaceSnapper(EnPametfrog* this, PlayState* play) { CollisionPoly* poly; s32 bgId; Vec3f vec1; @@ -366,7 +365,7 @@ void EnPametfrog_PlaceSnapper(EnPametfrog* this, GlobalContext* globalCtx) { vec3.x = this->actor.child->world.pos.x; vec3.y = this->actor.child->world.pos.y - 150.0f; vec3.z = this->actor.child->world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &vec2, &vec3, &vec1, &poly, false, true, false, true, &bgId)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &vec2, &vec3, &vec1, &poly, false, true, false, true, &bgId)) { this->actor.child->floorHeight = vec1.y; } else { this->actor.child->floorHeight = this->actor.home.pos.y; @@ -376,16 +375,16 @@ void EnPametfrog_PlaceSnapper(EnPametfrog* this, GlobalContext* globalCtx) { child->world.pos.y = child->floorHeight - 60.0f; } -void EnPametfrog_JumpOnGround(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_JumpOnGround(EnPametfrog* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_JUMP); } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) { - EnPametfrog_JumpWaterEffects(this, globalCtx); + EnPametfrog_JumpWaterEffects(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER); } } -void EnPametfrog_ApplyMagicArrowEffects(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_ApplyMagicArrowEffects(EnPametfrog* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 3.0f; @@ -394,9 +393,9 @@ void EnPametfrog_ApplyMagicArrowEffects(EnPametfrog* this, GlobalContext* global this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 3.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.elements[0].info.bumper.hitPos.x, this->collider.elements[0].info.bumper.hitPos.y, - this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements[0].info.bumper.hitPos.x, + this->collider.elements[0].info.bumper.hitPos.y, this->collider.elements[0].info.bumper.hitPos.z, 0, + 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ICE) { EnPametfrog_Freeze(this); } @@ -431,7 +430,7 @@ void EnPametfrog_SetupRearOnSnapper(EnPametfrog* this) { this->actionFunc = EnPametfrog_RearOnSnapper; } -void EnPametfrog_RearOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_RearOnSnapper(EnPametfrog* this, PlayState* play) { Actor* actor; Vec3f rearingPoint; s32 pad; @@ -444,7 +443,7 @@ void EnPametfrog_RearOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) { } } - actor = func_800BC270(globalCtx, &this->actor, 60.0f, 0x138B0); + actor = func_800BC270(play, &this->actor, 60.0f, 0x138B0); if (actor != NULL) { rearingPoint.x = this->actor.world.pos.x; rearingPoint.y = this->actor.world.pos.y + 10.0f; @@ -463,7 +462,7 @@ void EnPametfrog_SetupRearOnSnapperWave(EnPametfrog* this) { this->actionFunc = EnPametfrog_RearOnSnapperWave; } -void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && this->timer > 0) { this->timer--; if (this->timer == 0) { @@ -482,7 +481,7 @@ void EnPametfrog_SetupRearOnSnapperRise(EnPametfrog* this) { this->actionFunc = EnPametfrog_RearOnSnapperRise; } -void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->timer--; if (this->timer == 0) { @@ -493,7 +492,7 @@ void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, GlobalContext* globalCtx) } } -void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; s16 yaw; @@ -510,12 +509,12 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx subCamEye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 100.0f; subCamEye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); this->actionFunc = EnPametfrog_FallOffSnapper; } -void EnPametfrog_FallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) { f32 sin; SkelAnime_Update(&this->skelAnime); @@ -526,9 +525,9 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) { } sin = sin_rad(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; - EnPametfrog_ShakeCamera(this, globalCtx, 300.0f * sin, 100.0f * sin); + EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin); if (this->actor.bgCheckFlags & 1) { - EnPametfrog_StopCutscene(this, globalCtx); + EnPametfrog_StopCutscene(this, play); EnPametfrog_SetupJumpToWall(this); } } @@ -542,9 +541,9 @@ void EnPametfrog_SetupJumpToWall(EnPametfrog* this) { this->actionFunc = EnPametfrog_JumpToWall; } -void EnPametfrog_JumpToWall(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_JumpToWall(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - EnPametfrog_JumpOnGround(this, globalCtx); + EnPametfrog_JumpOnGround(this, play); if ((this->actor.bgCheckFlags & 1) && (this->actor.bgCheckFlags & 8) && (this->actor.wallBgId == BGCHECK_SCENE) && (COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.y) < 0.5f)) { EnPametfrog_SetupWallCrawl(this); @@ -587,7 +586,7 @@ void EnPametfrog_SetupWallCrawl(EnPametfrog* this) { this->actionFunc = EnPametfrog_WallCrawl; } -void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_WallCrawl(EnPametfrog* this, PlayState* play) { CollisionPoly* poly1 = NULL; CollisionPoly* poly2 = NULL; Vec3f vec1; @@ -612,12 +611,11 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx) { vec2.x = this->actor.world.pos.x - this->unk_2DC.x * 25.0f; vec2.y = this->actor.world.pos.y - this->unk_2DC.y * 25.0f; vec2.z = this->actor.world.pos.z - this->unk_2DC.z * 25.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &vec1, &vec2, &worldPos2, &poly2, true, true, true, true, - &bgId2)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &vec1, &vec2, &worldPos2, &poly2, true, true, true, true, &bgId2)) { vec2.x = this->unk_2D0.x * doubleSpeedXZ + vec1.x; vec2.y = this->unk_2D0.y * doubleSpeedXZ + vec1.y; vec2.z = this->unk_2D0.z * doubleSpeedXZ + vec1.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &vec1, &vec2, &worldPos1, &poly1, true, true, true, true, + if (BgCheck_EntityLineTest1(&play->colCtx, &vec1, &vec2, &worldPos1, &poly1, true, true, true, true, &bgId1)) { isSuccess = func_8086A2CC(this, poly1); Math_Vec3f_Copy(&this->actor.world.pos, &worldPos1); @@ -642,7 +640,7 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); } - if (((globalCtx->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { + if (((play->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_REAL); } @@ -675,7 +673,7 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) { this->actionFunc = EnPametfrog_WallPause; } -void EnPametfrog_WallPause(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_WallPause(EnPametfrog* this, PlayState* play) { Vec3f vec; if (this->freezeTimer > 0) { @@ -688,7 +686,7 @@ void EnPametfrog_WallPause(EnPametfrog* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_2D0, &vec); Math3D_CrossProduct(&this->unk_2DC, &this->unk_2D0, &this->unk_2E8); func_8086A238(this); - if (((globalCtx->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { + if (((play->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_REAL); } @@ -720,7 +718,7 @@ void EnPametfrog_SetupClimbDownWall(EnPametfrog* this) { this->actionFunc = EnPametfrog_ClimbDownWall; } -void EnPametfrog_ClimbDownWall(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_ClimbDownWall(EnPametfrog* this, PlayState* play) { s16 yaw; if (this->actor.bgCheckFlags & 1) { @@ -741,9 +739,9 @@ void EnPametfrog_SetupRunToSnapper(EnPametfrog* this) { this->actionFunc = EnPametfrog_RunToSnapper; } -void EnPametfrog_RunToSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_RunToSnapper(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - EnPametfrog_JumpOnGround(this, globalCtx); + EnPametfrog_JumpOnGround(this, play); this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child); this->actor.world.rot.y = this->actor.shape.rot.y; if (!(this->actor.bgCheckFlags & 1) || ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { @@ -772,7 +770,7 @@ void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this) { this->actionFunc = EnPametfrog_JumpOnSnapper; } -void EnPametfrog_JumpOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_JumpOnSnapper(EnPametfrog* this, PlayState* play) { f32 temp_f0; EnBigpamet* bigpamet; @@ -797,14 +795,14 @@ void EnPametfrog_SetupLandOnSnapper(EnPametfrog* this) { this->actionFunc = EnPametfrog_LandOnSnapper; } -void EnPametfrog_LandOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_LandOnSnapper(EnPametfrog* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - EnPametfrog_StopCutscene(this, globalCtx); + EnPametfrog_StopCutscene(this, play); EnPametfrog_SetupRearOnSnapper(this); } } -void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { s16 yaw; Vec3f subCamEye; f32 xzDist; @@ -841,13 +839,13 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { subCamEye.x = this->actor.world.pos.x + (xzDist * this->unk_2DC.x); subCamEye.y = (this->actor.world.pos.y + this->actor.home.pos.y) * 0.5f; subCamEye.z = this->actor.world.pos.z + (xzDist * this->unk_2DC.z); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); } this->actionFunc = EnPametfrog_FallInAir; } -void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.colorFilterTimer = 0x10; if (this->timer > 0) { @@ -859,36 +857,36 @@ void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx) { } else { this->spinYaw += 0xF00; if (this->subCamId != CAM_ID_MAIN) { - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, - &Play_GetCamera(globalCtx, this->subCamId)->eye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, + &Play_GetCamera(play, this->subCamId)->eye); } if (this->actor.bgCheckFlags & 1) { - EnPametfrog_SetupFallOnGround(this, globalCtx); + EnPametfrog_SetupFallOnGround(this, play); } } } -void EnPametfrog_SetupFallOnGround(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupFallOnGround(EnPametfrog* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gGekkoFallOnGroundAnim); this->actor.shape.rot.x = 0; this->actor.shape.rot.y += this->spinYaw; this->actor.shape.rot.z = 0; this->spinYaw = 0; this->timer = 5; - EnPametfrog_Thaw(this, globalCtx); - EnPametfrog_JumpWaterEffects(this, globalCtx); + EnPametfrog_Thaw(this, play); + EnPametfrog_JumpWaterEffects(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER); this->actionFunc = EnPametfrog_FallOnGround; } -void EnPametfrog_FallOnGround(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_FallOnGround(EnPametfrog* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->skelAnime.animation == &gGekkoFallOnGroundAnim) { if (this->actor.colChkInfo.health == 0) { this->timer--; if (this->timer == 0) { - EnPametfrog_SetupDefeatGekko(this, globalCtx); + EnPametfrog_SetupDefeatGekko(this, play); } } else { Animation_PlayOnce(&this->skelAnime, &gGekkoRecoverAnim); @@ -899,7 +897,7 @@ void EnPametfrog_FallOnGround(EnPametfrog* this, GlobalContext* globalCtx) { } } -void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; s16 yaw = Actor_YawToPoint(this->actor.child, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; @@ -908,23 +906,23 @@ void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, GlobalContext* globalCtx) { subCamEye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); subCamEye.y = this->actor.child->focus.pos.y + 20.0f; subCamEye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.child->focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.child->focus.pos, &subCamEye); this->actor.params = GEKKO_DEFEAT; this->timer = 38; this->actionFunc = EnPametfrog_DefeatGekko; } -void EnPametfrog_DefeatGekko(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_DefeatGekko(EnPametfrog* this, PlayState* play) { this->actor.colorFilterTimer = 16; if (this->timer > 0) { this->timer--; if (this->timer == 0) { - EnPametfrog_SetupDefeatSnapper(this, globalCtx); + EnPametfrog_SetupDefeatSnapper(this, play); } } } -void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; s16 yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; @@ -933,60 +931,60 @@ void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx) subCamEye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; subCamEye.y = this->actor.world.pos.y + 20.0f; subCamEye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; - Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); this->timer = 20; this->actionFunc = EnPametfrog_DefeatSnapper; } -void EnPametfrog_DefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_DefeatSnapper(EnPametfrog* this, PlayState* play) { this->timer--; Actor_SetScale(&this->actor, this->timer * 0.00035000002f); this->actor.colorFilterTimer = 16; - EnPametfrog_ShakeCamera(this, globalCtx, (this->timer * 3.75f) + 75.0f, (this->timer * 0.5f) + 10.0f); + EnPametfrog_ShakeCamera(this, play, (this->timer * 3.75f) + 75.0f, (this->timer * 0.5f) + 10.0f); if (this->timer == 0) { - EnPametfrog_SetupSpawnFrog(this, globalCtx); + EnPametfrog_SetupSpawnFrog(this, play); } } -void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { static Vec3f sAccel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 primColor = { 250, 250, 250, 255 }; static Color_RGBA8 envColor = { 180, 180, 180, 255 }; - s16 yaw = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + s16 yaw = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Vec3f vec1; Vec3f vel; s32 i; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, yaw, 0, this->params); vec1.x = (Math_SinS(yaw) * 20.0f) + this->actor.world.pos.x; vec1.y = this->actor.world.pos.y + 25.0f; vec1.z = (Math_CosS(yaw) * 20.0f) + this->actor.world.pos.z; this->collider.base.ocFlags1 &= ~OC1_ON; - func_800B0DE0(globalCtx, &vec1, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 800, 50); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); - Flags_SetClearTemp(globalCtx, globalCtx->roomCtx.currRoom.num); + func_800B0DE0(play, &vec1, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 800, 50); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); + Flags_SetClearTemp(play, play->roomCtx.currRoom.num); for (i = 0; i < 25; i++) { vel.x = randPlusMinusPoint5Scaled(5.0f); vel.y = Rand_ZeroFloat(3.0f) + 4.0f; vel.z = randPlusMinusPoint5Scaled(5.0f); - EffectSsHahen_Spawn(globalCtx, &this->actor.world.pos, &vel, &sAccel, 0, Rand_S16Offset(12, 3), - HAHEN_OBJECT_DEFAULT, 10, 0); + EffectSsHahen_Spawn(play, &this->actor.world.pos, &vel, &sAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, + 10, 0); } this->timer = 40; this->actionFunc = EnPametfrog_SpawnFrog; } -void EnPametfrog_SpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) { f32 magShake; this->timer--; magShake = (sin_rad(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f; - EnPametfrog_ShakeCamera(this, globalCtx, 75.0f * magShake, 10.0f * magShake); + EnPametfrog_ShakeCamera(this, play, 75.0f * magShake, 10.0f * magShake); if (this->timer == 0) { - EnPametfrog_StopCutscene(this, globalCtx); + EnPametfrog_StopCutscene(this, play); Actor_MarkForDeath(&this->actor); } } @@ -1004,19 +1002,19 @@ void EnPametfrog_SetupCutscene(EnPametfrog* this) { this->actor.velocity.y = 0.0f; } -void EnPametfrog_PlayCutscene(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); this->subCamId = ActorCutscene_GetCurrentCamera(this->cutscene); - func_800B724C(globalCtx, &this->actor, 7); + func_800B724C(play, &this->actor, 7); if (this->actor.colChkInfo.health == 0) { if (this->actor.params == GEKKO_PRE_SNAPPER) { - EnPametfrog_SetupCallSnapper(this, globalCtx); + EnPametfrog_SetupCallSnapper(this, play); } else { - EnPametfrog_SetupFallInAir(this, globalCtx); + EnPametfrog_SetupFallInAir(this, play); } } else { - EnPametfrog_SetupFallOffSnapper(this, globalCtx); + EnPametfrog_SetupFallOffSnapper(this, play); } } else { ActorCutscene_SetIntentToPlay(this->cutscene); @@ -1031,11 +1029,11 @@ void EnPametfrog_SetupLookAround(EnPametfrog* this) { this->actionFunc = EnPametfrog_LookAround; } -void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx) { - EnPametfrog_IdleWaterEffects(this, globalCtx); +void EnPametfrog_LookAround(EnPametfrog* this, PlayState* play) { + EnPametfrog_IdleWaterEffects(this, play); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x400, 0x80); this->actor.shape.rot.y = this->actor.world.rot.y; - if (SkelAnime_Update(&this->skelAnime) && !Play_InCsMode(globalCtx)) { + if (SkelAnime_Update(&this->skelAnime) && !Play_InCsMode(play)) { if (!this->unk_2AE) { func_801A2E54(NA_BGM_MINI_BOSS); this->unk_2AE = true; @@ -1051,11 +1049,11 @@ void EnPametfrog_SetupJumpToLink(EnPametfrog* this) { this->actionFunc = EnPametfrog_JumpToLink; } -void EnPametfrog_JumpToLink(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x80); this->actor.shape.rot.y = this->actor.world.rot.y; SkelAnime_Update(&this->skelAnime); - EnPametfrog_JumpOnGround(this, globalCtx); + EnPametfrog_JumpOnGround(this, play); if (!(this->actor.bgCheckFlags & 1) || (this->skelAnime.curFrame > 1.0f && this->skelAnime.curFrame < 12.0f)) { this->actor.speedXZ = 8.0f; } else { @@ -1083,8 +1081,8 @@ static AnimationHeader* sAttackAnimations[] = { &gGekkoWindupPunchAnim, }; -void EnPametfrog_MeleeAttack(EnPametfrog* this, GlobalContext* globalCtx) { - EnPametfrog_IdleWaterEffects(this, globalCtx); +void EnPametfrog_MeleeAttack(EnPametfrog* this, PlayState* play) { + EnPametfrog_IdleWaterEffects(this, play); if (SkelAnime_Update(&this->skelAnime)) { this->timer--; if (this->timer == 0) { @@ -1124,7 +1122,7 @@ void EnPametfrog_SetupDamage(EnPametfrog* this) { this->actionFunc = EnPametfrog_Damage; } -void EnPametfrog_Damage(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_Damage(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->timer--; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); @@ -1153,19 +1151,19 @@ void EnPametfrog_SetupStun(EnPametfrog* this) { this->actionFunc = EnPametfrog_Stun; } -void EnPametfrog_Stun(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_Stun(EnPametfrog* this, PlayState* play) { this->freezeTimer--; if (this->freezeTimer == 0) { - EnPametfrog_Thaw(this, globalCtx); + EnPametfrog_Thaw(this, play); EnPametfrog_SetupJumpToLink(this); } else if (this->freezeTimer == 78) { - EnPametfrog_Thaw(this, globalCtx); + EnPametfrog_Thaw(this, play); this->actor.colorFilterTimer = 0; EnPametfrog_SetupCutscene(this); } } -void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; s16 yawDiff; @@ -1191,24 +1189,24 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { subCamEye.y = subCamAt.y + 4.0f; // Zooms in on Gekko - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->timer = 0; this->actor.hintId = 0x5F; this->actionFunc = EnPametfrog_CallSnapper; } -void EnPametfrog_CallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_CallSnapper(EnPametfrog* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - EnPametfrog_SetupSnapperSpawn(this, globalCtx); + EnPametfrog_SetupSnapperSpawn(this, play); } } -void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { Vec3f subCamAt; Vec3f subCamEye; s16 yaw; - EnPametfrog_PlaceSnapper(this, globalCtx); + EnPametfrog_PlaceSnapper(this, play); subCamAt.x = this->actor.child->world.pos.x; subCamAt.z = this->actor.child->world.pos.z; subCamAt.y = this->actor.child->floorHeight + 50.0f; @@ -1223,8 +1221,8 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) subCamEye.z = (Math_CosS(yaw) * 500.0f) + subCamAt.z; // Zooms in on Snapper spawn point - Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); - this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + this->quake = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(this->quake, 18000); Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); Quake_SetCountdown(this->quake, 15); @@ -1233,21 +1231,21 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) this->actionFunc = EnPametfrog_SnapperSpawn; } -void EnPametfrog_SnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SnapperSpawn(EnPametfrog* this, PlayState* play) { this->timer--; - EnPametfrog_ShakeCamera(this, globalCtx, (f32)(this->timer * 7.5f) + 200.0f, + EnPametfrog_ShakeCamera(this, play, (f32)(this->timer * 7.5f) + 200.0f, ((f32)(this->timer * 2) * (15.0f / 16.0f)) + -20.0f); if (this->timer != 0) { func_8013ECE0(this->actor.xyzDistToPlayerSq, 120, 20, 10); } else { - EnPametfrog_SetupTransitionGekkoSnapper(this, globalCtx); + EnPametfrog_SetupTransitionGekkoSnapper(this, play); } } -void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { this->actor.params = GEKKO_GET_SNAPPER; Quake_RemoveFromIdx(this->quake); - this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + this->quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(this->quake, 20000); Quake_SetQuakeValues(this->quake, 17, 0, 0, 0); Quake_SetCountdown(this->quake, 12); @@ -1255,14 +1253,14 @@ void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* g this->actionFunc = EnPametfrog_TransitionGekkoSnapper; } -void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { if (this->actor.params == GEKKO_INIT_SNAPPER) { func_801A2E54(NA_BGM_MINI_BOSS); EnPametfrog_SetupRunToSnapper(this); } } -void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, GlobalContext* globalCtx) { +void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || @@ -1284,7 +1282,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, GlobalContext* globalCtx) Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x50); EnPametfrog_SetupStun(this); } else { - EnPametfrog_Thaw(this, globalCtx); + EnPametfrog_Thaw(this, play); if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffScale = 0.75f; @@ -1293,18 +1291,17 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, GlobalContext* globalCtx) this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.elements[0].info.bumper.hitPos.x, - this->collider.elements[0].info.bumper.hitPos.y, - this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, - CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn( + &play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements[0].info.bumper.hitPos.x, + this->collider.elements[0].info.bumper.hitPos.y, + this->collider.elements[0].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } EnPametfrog_SetupDamage(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { this->collider.base.acFlags &= ~AC_ON; - EnPametfrog_ApplyMagicArrowEffects(this, globalCtx); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + EnPametfrog_ApplyMagicArrowEffects(this, play); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; func_801A2ED8(); EnPametfrog_SetupCutscene(this); @@ -1313,14 +1310,14 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, GlobalContext* globalCtx) } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_STUN) { EnPametfrog_ApplyStun(this); } else { - EnPametfrog_ApplyMagicArrowEffects(this, globalCtx); - EnPametfrog_SetupFallInAir(this, globalCtx); + EnPametfrog_ApplyMagicArrowEffects(this, play); + EnPametfrog_SetupFallInAir(this, play); } } } } -void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPametfrog_Update(Actor* thisx, PlayState* play) { EnPametfrog* this = THIS; f32 unk2C4; f32 arg3; @@ -1328,17 +1325,17 @@ void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == GEKKO_CUTSCENE) { EnPametfrog_SetupCutscene(this); } else if (this->actionFunc != EnPametfrog_PlayCutscene) { - EnPametfrog_ApplyDamageEffect(this, globalCtx); + EnPametfrog_ApplyDamageEffect(this, play); } else { this->collider.base.acFlags &= ~AC_HIT; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != EnPametfrog_JumpOnSnapper) && (this->actionFunc != EnPametfrog_RearOnSnapperRise)) { if (this->actor.gravity < -0.1f) { Actor_MoveWithGravity(&this->actor); arg3 = this->actionFunc == EnPametfrog_FallInAir ? 3.0f : 15.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, arg3, 3.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, arg3, 3.0f, 0x1F); } else if (this->freezeTimer == 0) { Actor_MoveWithoutGravity(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; @@ -1346,15 +1343,15 @@ void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { } 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->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -1388,7 +1385,7 @@ static s8 limbPosIndex[] = { -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, 6, -1, 7, 8, 9, -1, 10, -1, 11, -1, -1, }; -void EnPametfrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPametfrog* this = THIS; Vec3f vec; Vec3s* center; @@ -1414,13 +1411,13 @@ void EnPametfrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnPametfrog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPametfrog_Draw(Actor* thisx, PlayState* play) { EnPametfrog* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_RotateYS(this->spinYaw, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnPametfrog_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnPametfrog_PostLimbDraw, &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 1a10575cf9..2b56261099 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -5,7 +5,7 @@ struct EnPametfrog; -typedef void (*EnPametfrogActionFunc)(struct EnPametfrog*, GlobalContext*); +typedef void (*EnPametfrogActionFunc)(struct EnPametfrog*, PlayState*); typedef enum { /* 0x0 */ GEKKO_PRE_SNAPPER, diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.c b/src/overlays/actors/ovl_En_Paper/z_en_paper.c index 50e3645296..5554c9182f 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.c +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.c @@ -10,13 +10,13 @@ #define THIS ((EnPaper*)thisx) -void EnPaper_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPaper_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPaper_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPaper_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPaper_Init(Actor* thisx, PlayState* play); +void EnPaper_Destroy(Actor* thisx, PlayState* play); +void EnPaper_Update(Actor* thisx, PlayState* play); +void EnPaper_Draw(Actor* thisx, PlayState* play); -void func_80C1F480(EnPaper* this, GlobalContext* globalCtx); -void func_80C1F4FC(EnPaper* this, GlobalContext* globalCtx); +void func_80C1F480(EnPaper* this, PlayState* play); +void func_80C1F4FC(EnPaper* this, PlayState* play); #if 0 const ActorInit En_Paper_InitVars = { diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.h b/src/overlays/actors/ovl_En_Paper/z_en_paper.h index 0147442a92..292358e4a7 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.h +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.h @@ -5,7 +5,7 @@ struct EnPaper; -typedef void (*EnPaperActionFunc)(struct EnPaper*, GlobalContext*); +typedef void (*EnPaperActionFunc)(struct EnPaper*, PlayState*); typedef struct EnPaper { /* 0x0000 */ Actor actor; 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 bbf098c923..2967f36451 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 THIS ((EnPart*)thisx) -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); #if 0 const ActorInit En_Part_InitVars = { 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 4f65a541c6..a19b484fd0 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -12,30 +12,30 @@ #define THIS ((EnPeehat*)thisx) -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 func_80897498(EnPeehat* this); -void func_80897520(EnPeehat* this, GlobalContext* globalCtx); +void func_80897520(EnPeehat* this, PlayState* play); void func_80897648(EnPeehat* this); -void func_808976DC(EnPeehat* this, GlobalContext* globalCtx); -void func_80897910(EnPeehat* this, GlobalContext* globalCtx); +void func_808976DC(EnPeehat* this, PlayState* play); +void func_80897910(EnPeehat* this, PlayState* play); void func_80897A34(EnPeehat* this); -void func_80897A94(EnPeehat* this, GlobalContext* globalCtx); -void func_80897D48(EnPeehat* this, GlobalContext* globalCtx); +void func_80897A94(EnPeehat* this, PlayState* play); +void func_80897D48(EnPeehat* this, PlayState* play); void func_80897EAC(EnPeehat* this); -void func_80897F44(EnPeehat* this, GlobalContext* globalCtx); +void func_80897F44(EnPeehat* this, PlayState* play); void func_80898124(EnPeehat* this); -void func_80898144(EnPeehat* this, GlobalContext* globalCtx); +void func_80898144(EnPeehat* this, PlayState* play); void func_808982E0(EnPeehat* this); -void func_80898338(EnPeehat* this, GlobalContext* globalCtx); -void func_80898454(EnPeehat* this, GlobalContext* globalCtx); +void func_80898338(EnPeehat* this, PlayState* play); +void func_80898454(EnPeehat* this, PlayState* play); void func_808984E0(EnPeehat* this); -void func_80898594(EnPeehat* this, GlobalContext* globalCtx); +void func_80898594(EnPeehat* this, PlayState* play); void func_80898654(EnPeehat* this); -void func_808986A4(EnPeehat* this, GlobalContext* globalCtx); +void func_808986A4(EnPeehat* this, PlayState* play); const ActorInit En_Peehat_InitVars = { ACTOR_EN_PEEHAT, @@ -173,19 +173,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 700, ICHAIN_STOP), }; -void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Init(Actor* thisx, PlayState* play) { EnPeehat* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_ph_Skel_001C80, &object_ph_Anim_0009C4, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_ph_Skel_001C80, &object_ph_Anim_0009C4, this->jointTable, this->morphTable, 24); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->unk_2B0 = 0; Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos); this->actor.floorHeight = this->actor.world.pos.y; - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitAndSetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); - Collider_InitAndSetTris(globalCtx, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTriElements); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); + Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTriElements); if (this->actor.params == 0) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit1); @@ -211,12 +211,12 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Destroy(Actor* thisx, PlayState* play) { EnPeehat* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroySphere(globalCtx, &this->colliderSphere); - Collider_DestroyTris(globalCtx, &this->colliderTris); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroySphere(play, &this->colliderSphere); + Collider_DestroyTris(play, &this->colliderTris); if (this->actor.params != 0) { EnPeehat* parent = (EnPeehat*)this->actor.parent; @@ -236,16 +236,16 @@ void func_80897170(EnPeehat* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_808971DC(EnPeehat* this, GlobalContext* globalCtx) { +void func_808971DC(EnPeehat* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->colliderSphere.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); } } -void func_80897258(GlobalContext* globalCtx, EnPeehat* this, Vec3f* arg2, f32 arg3, f32 arg4) { +void func_80897258(PlayState* play, EnPeehat* this, Vec3f* arg2, f32 arg3, f32 arg4) { static Vec3f D_80899558 = { 0.0f, 8.0f, 0.0f }; static Vec3f D_80899564 = { 0.0f, -1.5f, 0.0f }; Vec3f sp44; @@ -260,11 +260,10 @@ void func_80897258(GlobalContext* globalCtx, EnPeehat* this, Vec3f* arg2, f32 ar D_80899564.z = randPlusMinusPoint5Scaled(1.05f); D_80899558.y = randPlusMinusPoint5Scaled(4.0f) + 8.0f; - EffectSsHahen_Spawn(globalCtx, &sp44, &D_80899558, &D_80899564, 0, (Rand_ZeroFloat(5.0f) + 12.0f) * arg4, -1, 10, - NULL); + EffectSsHahen_Spawn(play, &sp44, &D_80899558, &D_80899564, 0, (Rand_ZeroFloat(5.0f) + 12.0f) * arg4, -1, 10, NULL); } -void func_80897390(EnPeehat* this, GlobalContext* globalCtx) { +void func_80897390(EnPeehat* this, PlayState* play) { s32 i; s16 phi_s2 = BINANG_ROT180(this->actor.yawTowardsPlayer); Actor* actor; @@ -272,9 +271,8 @@ void func_80897390(EnPeehat* this, GlobalContext* globalCtx) { this->colliderCylinder.base.acFlags &= ~AC_HIT; for (i = 3 - this->unk_2AC; i > 0; i--) { - actor = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT, this->actor.world.pos.x, - this->actor.world.pos.y + 50.0f, this->actor.world.pos.z, 0, phi_s2, 0, 1); + actor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, this->actor.world.pos.x, + this->actor.world.pos.y + 50.0f, this->actor.world.pos.z, 0, phi_s2, 0, 1); phi_s2 += 0x5555; if (actor != NULL) { @@ -295,7 +293,7 @@ void func_80897498(EnPeehat* this) { this->actionFunc = func_80897520; } -void func_80897520(EnPeehat* this, GlobalContext* globalCtx) { +void func_80897520(EnPeehat* this, PlayState* play) { if (!gSaveContext.save.isNight) { this->actor.flags |= ACTOR_FLAG_1; this->colliderSphere.base.acFlags |= AC_ON; @@ -316,7 +314,7 @@ void func_80897520(EnPeehat* this, GlobalContext* globalCtx) { Math_StepToF(&this->unk_2C4, 0.0f, 0.005f); } } else if (this->colliderCylinder.base.acFlags & AC_HIT) { - func_80897390(this, globalCtx); + func_80897390(this, play); } } } @@ -331,7 +329,7 @@ void func_80897648(EnPeehat* this) { this->actionFunc = func_808976DC; } -void func_808976DC(EnPeehat* this, GlobalContext* globalCtx) { +void func_808976DC(EnPeehat* this, PlayState* play) { Vec3f sp34; Math_StepToF(&this->actor.shape.yOffset, 0.0f, 50.0f); @@ -354,11 +352,11 @@ void func_808976DC(EnPeehat* this, GlobalContext* globalCtx) { if ((this->actor.world.pos.y - this->actor.floorHeight) < 80.0f) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); sp34.y = this->actor.floorHeight; - func_800BBFB0(globalCtx, &sp34, 90.0f, 1, 150, 100, 1); + func_800BBFB0(play, &sp34, 90.0f, 1, 150, 100, 1); } } - func_80897258(globalCtx, this, &this->actor.world.pos, 75.0f, 2.0f); + func_80897258(play, this, &this->actor.world.pos, 75.0f, 2.0f); Math_StepToF(&this->unk_2C4, 0.075f, 0.005f); this->unk_2B4 += this->unk_2B2; } @@ -375,8 +373,8 @@ void func_80897864(EnPeehat* this) { this->actionFunc = func_80897910; } -void func_80897910(EnPeehat* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80897910(EnPeehat* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->actor.speedXZ, 3.0f, 0.25f); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 3.0f); @@ -401,7 +399,7 @@ void func_80897A34(EnPeehat* this) { this->actionFunc = func_80897A94; } -void func_80897A94(EnPeehat* this, GlobalContext* globalCtx) { +void func_80897A94(EnPeehat* this, PlayState* play) { s32 pad; if ((this->actor.parent != NULL) && (this->actor.parent->update == NULL)) { @@ -433,10 +431,10 @@ void func_80897A94(EnPeehat* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 0; func_808982E0(this); } else if ((this->colliderCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { - func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); if (!(this->actor.bgCheckFlags & 1)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); } Actor_MarkForDeath(&this->actor); } else if (this->colliderTris.base.atFlags & AT_HIT) { @@ -465,7 +463,7 @@ void func_80897D00(EnPeehat* this) { this->actionFunc = func_80897D48; } -void func_80897D48(EnPeehat* this, GlobalContext* globalCtx) { +void func_80897D48(EnPeehat* this, PlayState* play) { Vec3f sp34; Math_StepToF(&this->actor.shape.yOffset, -1000.0f, 50.0f); @@ -480,8 +478,8 @@ void func_80897D48(EnPeehat* this, GlobalContext* globalCtx) { if ((this->actor.world.pos.y - this->actor.floorHeight) < 60.0f) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); sp34.y = this->actor.floorHeight; - func_800BBFB0(globalCtx, &sp34, 80.0f, 1, 150, 100, 1); - func_80897258(globalCtx, this, &sp34, 75.0f, 2.0f); + func_800BBFB0(play, &sp34, 80.0f, 1, 150, 100, 1); + func_80897258(play, this, &sp34, 75.0f, 2.0f); } } Math_ScaledStepToS(&this->unk_2B2, 0, 100); @@ -497,10 +495,10 @@ void func_80897EAC(EnPeehat* this) { this->actionFunc = func_80897F44; } -void func_80897F44(EnPeehat* this, GlobalContext* globalCtx) { +void func_80897F44(EnPeehat* this, PlayState* play) { s32 pad; f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->actor.world.pos.y - this->actor.floorHeight) > 75.0f) { this->actor.world.pos.y -= 1.0f; @@ -539,10 +537,10 @@ void func_80898124(EnPeehat* this) { this->actor.speedXZ = 2.5f; } -void func_80898144(EnPeehat* this, GlobalContext* globalCtx) { +void func_80898144(EnPeehat* this, PlayState* play) { s32 step; f32 cos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->actor.world.pos.y - this->actor.floorHeight) > 75.0f) { this->actor.world.pos.y -= 1.0f; @@ -579,15 +577,15 @@ void func_808982E0(EnPeehat* this) { this->actionFunc = func_80898338; } -void func_80898338(EnPeehat* this, GlobalContext* globalCtx) { +void func_80898338(EnPeehat* this, PlayState* play) { this->unk_2B4 += this->unk_2B2; SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f)) { if (this->actor.params != 0) { - func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); Actor_MarkForDeath(&this->actor); } else { func_80897864(this); @@ -603,7 +601,7 @@ void func_80898414(EnPeehat* this) { this->actionFunc = func_80898454; } -void func_80898454(EnPeehat* this, GlobalContext* globalCtx) { +void func_80898454(EnPeehat* this, PlayState* play) { if (this->unk_2B0 != 0) { this->unk_2B0--; } @@ -611,7 +609,7 @@ void func_80898454(EnPeehat* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, 8.0f); if (this->unk_2B0 == 0) { - func_808971DC(this, globalCtx); + func_808971DC(this, play); if (this->actor.colChkInfo.health == 0) { func_808984E0(this); } else { @@ -635,7 +633,7 @@ void func_808984E0(EnPeehat* this) { this->actionFunc = func_80898594; } -void func_80898594(EnPeehat* this, GlobalContext* globalCtx) { +void func_80898594(EnPeehat* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->unk_2B4 += this->unk_2B2; Math_ScaledStepToS(&this->unk_2B2, 4000, 250); @@ -658,9 +656,9 @@ void func_80898654(EnPeehat* this) { this->actionFunc = func_808986A4; } -void func_808986A4(EnPeehat* this, GlobalContext* globalCtx) { +void func_808986A4(EnPeehat* this, PlayState* play) { if (this->unk_2B0 == 5) { - EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + EnBom* 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) { @@ -671,12 +669,12 @@ void func_808986A4(EnPeehat* this, GlobalContext* globalCtx) { this->unk_2B0--; if (this->unk_2B0 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xE0); Actor_MarkForDeath(&this->actor); } } -void func_8089874C(EnPeehat* this, GlobalContext* globalCtx) { +void func_8089874C(EnPeehat* this, PlayState* play) { if (this->colliderTris.base.acFlags & AC_BOUNCED) { this->colliderTris.base.acFlags &= ~AC_BOUNCED; this->colliderSphere.base.acFlags &= ~AC_HIT; @@ -688,12 +686,12 @@ void func_8089874C(EnPeehat* this, GlobalContext* globalCtx) { if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->colliderSphere.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } this->colliderTris.base.atFlags &= ~(AT_HIT | AT_ON); Actor_SetDropFlag(&this->actor, &this->colliderSphere.info); - func_808971DC(this, globalCtx); + func_808971DC(this, play); if (this->actor.colChkInfo.damageEffect == 5) { this->unk_2B0 = 40; @@ -724,9 +722,9 @@ void func_8089874C(EnPeehat* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 1.1f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->colliderSphere.info.bumper.hitPos.x, this->colliderSphere.info.bumper.hitPos.y, - this->colliderSphere.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderSphere.info.bumper.hitPos.x, + this->colliderSphere.info.bumper.hitPos.y, this->colliderSphere.info.bumper.hitPos.z, 0, + 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } func_800BE568(&this->actor, &this->colliderSphere); func_808984E0(this); @@ -736,25 +734,25 @@ void func_8089874C(EnPeehat* this, GlobalContext* globalCtx) { (this->colliderCylinder.base.acFlags & AC_HIT) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { - func_808971DC(this, globalCtx); + func_808971DC(this, play); this->actor.colorFilterTimer = 0; func_80897648(this); } } -void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnPeehat_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnPeehat* this = THIS; if (thisx->params == 0) { - func_8089874C(this, globalCtx); + func_8089874C(this, play); } Actor_MoveWithGravity(thisx); - Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 30.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 30.0f, 30.0f, 5); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if ((globalCtx->gameplayFrames % 128) == 0) { + if ((play->gameplayFrames % 128) == 0) { this->unk_2C0 = Rand_ZeroFloat(0.25f) + 0.5f; } @@ -772,13 +770,13 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { Collider_UpdateCylinder(thisx, &this->colliderCylinder); this->colliderCylinder.dim.pos.y += (s16)(thisx->shape.yOffset * thisx->scale.y); if (this->colliderCylinder.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } if (thisx->params == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); if (this->colliderSphere.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); } } @@ -789,7 +787,7 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->colliderTris.base.atFlags & AT_ON) { thisx->flags |= 0x1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderTris.base); if (thisx->params == 0) { Vec3f sp74; CollisionPoly* sp70; @@ -797,19 +795,19 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { s32 i; sp70 = NULL; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); for (i = 1; i >= 0; i--) { - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &sp70, - true, true, false, true, &sp6C)) { - func_800BBFB0(globalCtx, &sp74, 0.0f, 1, 300, 150, 1); - func_80897258(globalCtx, this, &sp74, 0.0f, 1.5f); + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &sp70, true, + true, false, true, &sp6C)) { + func_800BBFB0(play, &sp74, 0.0f, 1, 300, 150, 1); + func_80897258(play, this, &sp74, 0.0f, 1.5f); } } } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); if (this->actionFunc != func_80898454) { Math_StepToF(&this->unk_2C4, 0.0f, 0.001f); @@ -831,8 +829,7 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPeehat* this = THIS; s32 pad; @@ -840,7 +837,7 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi rot->x = -this->unk_2B4; } else if ((limbIndex == 3) || ((limbIndex == 23) && ((this->actionFunc == func_80898594) || (this->actionFunc == func_80897520)))) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Gfx* gfx = POLY_OPA_DISP; Matrix_Push(); @@ -852,20 +849,20 @@ s32 EnPeehat_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Matrix_RotateYF(-(this->unk_2BC * 0.13f), MTXMODE_APPLY); Matrix_RotateXFApply(-(this->unk_2BC * 0.115f)); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], *dList); Matrix_Pop(); POLY_OPA_DISP = &gfx[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return true; } return false; } -void EnPeehat_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80899570[] = { { 1300.0f, 1200.0f, 0.0f }, { 1300.0f, -1200.0f, 0.0f }, @@ -875,7 +872,7 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList static s8 D_808995A0[] = { -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 2, -1, -1, 4, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnPeehat* this = THIS; s32 i; s32 index = D_808995A0[limbIndex]; @@ -900,7 +897,7 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList Matrix_MultVecX(3000.0f, vec2++); Matrix_MultVecX(-400.0f, vec2); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; Matrix_Translate(-1000.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -909,26 +906,26 @@ void EnPeehat_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList Matrix_RotateYF(3.2f, MTXMODE_APPLY); Matrix_Scale(0.3f, 0.2f, 0.2f, MTXMODE_APPLY); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], *dList); POLY_OPA_DISP = &gfx[2]; Math_Vec3s_ToVec3f(&this->actor.focus.pos, &this->colliderSphere.dim.worldSphere.center); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPeehat_Draw(Actor* thisx, PlayState* play) { EnPeehat* this = THIS; Vec3f sp58; Vec3f sp4C; Vec3f sp40; s32 i; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, (this->actor.params == 0) ? EnPeehat_PostLimbDraw : NULL, &this->actor); if ((this->actor.speedXZ != 0.0f) || (this->actor.velocity.y != 0.0f)) { @@ -946,6 +943,6 @@ void EnPeehat_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } 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 a7bda3577a..182dd9175f 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -5,7 +5,7 @@ struct EnPeehat; -typedef void (*EnPeehatActionFunc)(struct EnPeehat*, GlobalContext*); +typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); typedef struct EnPeehat { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 43fb03da40..b5e4f95a61 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -12,13 +12,13 @@ #define THIS ((EnPm*)thisx) -void EnPm_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPm_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPm_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPm_Init(Actor* thisx, PlayState* play); +void EnPm_Destroy(Actor* thisx, PlayState* play); +void EnPm_Update(Actor* thisx, PlayState* play); +void EnPm_Draw(Actor* thisx, PlayState* play); -void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx); -void func_80AFA5FC(EnPm* this, GlobalContext* globalCtx); +void func_80AFA4D0(EnPm* this, PlayState* play); +void func_80AFA5FC(EnPm* this, PlayState* play); static u8 D_80AFAD80[] = { /* 0x000 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_L(1, 0x240 - 0x005), @@ -597,12 +597,12 @@ s32 func_80AF7BAC(EnPm* this) { return true; } -Actor* func_80AF7CB0(EnPm* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +Actor* func_80AF7CB0(EnPm* this, PlayState* play, u8 actorCat, s16 actorId) { Actor* phi_s0 = NULL; Actor* actor; while (true) { - actor = SubS_FindActor(globalCtx, phi_s0, actorCat, actorId); + actor = SubS_FindActor(play, phi_s0, actorCat, actorId); phi_s0 = actor; if (actor == NULL) { @@ -625,7 +625,7 @@ Actor* func_80AF7CB0(EnPm* this, GlobalContext* globalCtx, u8 actorCat, s16 acto return phi_s0; } -EnDoor* func_80AF7D60(GlobalContext* globalCtx, s32 arg1) { +EnDoor* func_80AF7D60(PlayState* play, s32 arg1) { s32 phi_a1; switch (arg1) { @@ -654,15 +654,15 @@ EnDoor* func_80AF7D60(GlobalContext* globalCtx, s32 arg1) { return NULL; } - return SubS_FindDoor(globalCtx, phi_a1); + return SubS_FindDoor(play, phi_a1); } -Actor* func_80AF7DC4(EnPm* this, GlobalContext* globalCtx, s32 arg2) { +Actor* func_80AF7DC4(EnPm* this, PlayState* play, s32 arg2) { Actor* phi_s0 = NULL; Actor* actor; while (true) { - actor = SubS_FindActor(globalCtx, phi_s0, ACTORCAT_PROP, ACTOR_EN_PST); + actor = SubS_FindActor(play, phi_s0, ACTORCAT_PROP, ACTOR_EN_PST); phi_s0 = actor; if (actor == NULL) { @@ -725,7 +725,7 @@ s32 func_80AF7E98(EnPm* this, s32 arg1) { return ret; } -void func_80AF7F68(EnPm* this, GlobalContext* globalCtx) { +void func_80AF7F68(EnPm* this, PlayState* play) { f32 temp; s32 pad; @@ -737,32 +737,32 @@ void func_80AF7F68(EnPm* this, GlobalContext* globalCtx) { case 24: temp = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; this->colliderSphere.dim.worldSphere.radius = temp; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); break; default: Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); temp = this->actor.focus.pos.y - this->actor.world.pos.y; this->colliderCylinder.dim.height = temp; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); break; } } -Actor* func_80AF8040(EnPm* this, GlobalContext* globalCtx) { +Actor* func_80AF8040(EnPm* this, PlayState* play) { Actor* actor; switch (this->unk_258) { case 16: - actor = func_80AF7CB0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AN); + actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_AN); break; case 17: - actor = func_80AF7CB0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_TEST3); + actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_TEST3); break; case 28: - actor = func_80AF7CB0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); + actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); break; case 3: @@ -770,19 +770,19 @@ Actor* func_80AF8040(EnPm* this, GlobalContext* globalCtx) { case 5: case 6: case 7: - actor = func_80AF7DC4(this, globalCtx, this->unk_258 - 3); + actor = func_80AF7DC4(this, play, this->unk_258 - 3); break; case 19: - actor = func_80AF7DC4(this, globalCtx, 4); + actor = func_80AF7DC4(this, play, 4); break; case 18: - actor = func_80AF7DC4(this, globalCtx, 4); + actor = func_80AF7DC4(this, play, 4); break; default: - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; break; } @@ -818,7 +818,7 @@ s16 func_80AF8170(EnPm* this, s32 arg1) { return cs; } -s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF81E8(EnPm* this, PlayState* play) { s32 pad; s16 sp2A = func_80AF8170(this, 0); s32 ret = false; @@ -833,8 +833,7 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { case 4: case 6: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), - this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); } this->unk_378++; ret = true; @@ -846,7 +845,7 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { if ((gSaveContext.save.weekEventReg[86] & 8) && (this->unk_378 == 3)) { ActorCutscene_Stop(sp2A); } else { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_378++; ret = true; @@ -861,7 +860,7 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { return ret; } -s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF8348(EnPm* this, PlayState* play) { s32 pad; s16 sp2A = func_80AF8170(this, 0); s32 ret = false; @@ -876,7 +875,7 @@ s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { case 4: case 6: case 8: - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); this->unk_378++; ret = true; break; @@ -886,8 +885,7 @@ s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), - this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); } this->unk_378++; ret = true; @@ -903,7 +901,7 @@ s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { return ret; } -s32 func_80AF8478(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF8478(EnPm* this, PlayState* play) { s32 pad; s32 ret = false; @@ -928,7 +926,7 @@ s32 func_80AF8478(EnPm* this, GlobalContext* globalCtx) { return ret; } -UNK_TYPE* func_80AF8540(EnPm* this, GlobalContext* globalCtx) { +UNK_TYPE* func_80AF8540(EnPm* this, PlayState* play) { switch (this->unk_258) { case 28: this->unk_37C = func_80AF8348; @@ -960,7 +958,7 @@ UNK_TYPE* func_80AF8540(EnPm* this, GlobalContext* globalCtx) { return D_80AFB650; default: - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { return D_80AFB744; } @@ -996,16 +994,16 @@ UNK_TYPE* func_80AF8540(EnPm* this, GlobalContext* globalCtx) { } } -s32 func_80AF86F0(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF86F0(EnPm* this, PlayState* play) { s32 ret = false; - if ((this->unk_356 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if ((this->unk_356 & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_356, 0, 7); this->unk_398 = 0; this->unk_378 = 0; this->unk_37C = NULL; this->actor.child = this->unk_268; - this->unk_25C = func_80AF8540(this, globalCtx); + this->unk_25C = func_80AF8540(this, play); if ((this->unk_258 != 24) && (this->unk_258 != 9) && (this->unk_258 != 20) && (this->unk_258 != 21) && (this->unk_258 != 22)) { this->unk_356 |= 0x20; @@ -1016,11 +1014,11 @@ s32 func_80AF86F0(EnPm* this, GlobalContext* globalCtx) { return ret; } -s32 func_80AF87C4(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF87C4(EnPm* this, PlayState* play) { s32 ret = false; - if ((globalCtx->csCtx.state != 0) && (globalCtx->sceneNum == SCENE_00KEIKOKU) && - (gSaveContext.sceneSetupIndex == 9) && (globalCtx->curSpawn == 1)) { + if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 9) && + (play->curSpawn == 1)) { if (!this->unk_380) { func_80AF7E98(this, 0); this->unk_258 = 255; @@ -1132,14 +1130,14 @@ void func_80AF8BA8(s32 arg0) { ((void)0, gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8]) | (u8)D_80AFB8E0[arg0]; } -void func_80AF8C68(EnPm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 sp28 = Message_GetState(&globalCtx->msgCtx); - u16 temp_a0 = globalCtx->msgCtx.currentTextId; +void func_80AF8C68(EnPm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp28 = Message_GetState(&play->msgCtx); + u16 temp_a0 = play->msgCtx.currentTextId; if ((player->targetActor == &this->actor) && ((temp_a0 < 255) || (temp_a0 > 512)) && (sp28 == 3) && (this->unk_388 == 3)) { - if ((globalCtx->state.frames % 3) == 0) { + if ((play->state.frames % 3) == 0) { if (this->unk_360 == 120.0f) { this->unk_360 = 0.0f; } else { @@ -1154,7 +1152,7 @@ void func_80AF8C68(EnPm* this, GlobalContext* globalCtx) { this->unk_388 = sp28; } -s32 func_80AF8D84(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF8D84(EnPm* this, PlayState* play) { switch (this->unk_384) { case 10: func_80AF7E98(this, 9); @@ -1167,9 +1165,9 @@ s32 func_80AF8D84(EnPm* this, GlobalContext* globalCtx) { return true; } -s32 func_80AF8DD4(EnPm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp = globalCtx->msgCtx.currentTextId; +s32 func_80AF8DD4(EnPm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp = play->msgCtx.currentTextId; s32 pad; if (player->stateFlags1 & (0x400 | 0x40)) { @@ -1187,18 +1185,18 @@ s32 func_80AF8DD4(EnPm* this, GlobalContext* globalCtx) { if (this->unk_356 & 0x400) { this->unk_358 = 0; this->unk_356 &= ~0x400; - func_80AF8D84(this, globalCtx); + func_80AF8D84(this, play); } } if (this->unk_18C != NULL) { - this->unk_18C(this, globalCtx); + this->unk_18C(this, play); } return 0; } -s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 actorCat, s16 actorId) { +s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat, s16 actorId) { u8 sp4F = this->actor.params & 0xFF; Vec3s* sp48; Vec3f sp3C; @@ -1208,9 +1206,9 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 s32 ret = false; this->timePath = NULL; - sp2C = func_80AF7CB0(this, globalCtx, actorCat, actorId); + sp2C = func_80AF7CB0(this, play, actorCat, actorId); if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80AFB430[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -1228,7 +1226,7 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2, u8 return ret; } -s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = this->actor.params & 0xFF; EnDoor* door; @@ -1239,9 +1237,9 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_80AF7D60(globalCtx, arg2->result); + door = func_80AF7D60(play, arg2->result); if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp55, D_80AFB430[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[arg2->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -1276,7 +1274,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = this->actor.params & 0xFF; @@ -1286,7 +1284,7 @@ s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp2B, D_80AFB430[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[arg2->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1315,7 +1313,7 @@ s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->unk_356 &= ~0x10; if (this->unk_258 == 27) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); - Flags_UnsetSwitch(globalCtx, 0); + Flags_UnsetSwitch(play, 0); } switch (arg2->result) { @@ -1357,7 +1355,7 @@ s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) { u8 sp4F = this->actor.params & 0xFF; Vec3f sp40; Vec3f sp34; @@ -1367,7 +1365,7 @@ s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { this->timePath = NULL; if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, D_80AFB430[arg2->result]); + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -1379,8 +1377,8 @@ s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { Math_Vec3f_Copy(&this->actor.world.pos, &sp40); Math_Vec3f_Copy(&this->actor.prevPos, &sp40); if (arg2->result == 24) { - Flags_UnsetSwitch(globalCtx, 0); - Flags_UnsetSwitch(globalCtx, 1); + Flags_UnsetSwitch(play, 0); + Flags_UnsetSwitch(play, 1); this->unk_394 = EXCH_ITEM_NONE; this->unk_368 = 60.0f; func_80AF7E98(this, 9); @@ -1390,7 +1388,7 @@ s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { u8 sp4F = this->actor.params & 0xFF; Vec3f sp40; Vec3f sp34; @@ -1413,14 +1411,14 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { break; } - if ((phi_a3 >= 0) && !func_80AF7DC4(this, globalCtx, phi_a3)) { + if ((phi_a3 >= 0) && !func_80AF7DC4(this, play, phi_a3)) { return ret; } this->timePath = NULL; phi_a3 = D_80AFB430[arg2->result]; if (phi_a3 >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp4F, phi_a3); + this->timePath = SubS_GetAdditionalPath(play, sp4F, phi_a3); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -1435,7 +1433,7 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { switch (arg2->result) { case 27: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); - Flags_SetSwitch(globalCtx, 0); + Flags_SetSwitch(play, 0); this->unk_36C = 20; SubS_UpdateFlags(&this->unk_356, 3, 7); func_80AF7E98(this, 3); @@ -1477,18 +1475,18 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF98A0(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_MM3, 116.0f, 26.0f, -219.0f, 0, - -0x3F46, 0, 0) != NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MM3, 116.0f, 26.0f, -219.0f, 0, -0x3F46, 0, + 0) != NULL) { Actor_MarkForDeath(&this->actor); ret = true; } return ret; } -s32 func_80AF992C(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) { static Vec3f D_80AFB8EC = { 116.0f, 26.0f, -219.0f }; static Vec3s D_80AFB8F8 = { 0x0000, 0xC0BA, 0x0000 }; s32 pad; @@ -1510,10 +1508,10 @@ s32 func_80AF992C(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -s32 func_80AF9A0C(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { + if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; @@ -1528,10 +1526,10 @@ s32 func_80AF9A0C(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF9AB0(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TEST3)) { + if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TEST3)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; @@ -1546,10 +1544,10 @@ s32 func_80AF9AB0(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF9B54(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AL)) { + if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AL)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x9000; this->unk_356 |= 0x20; @@ -1564,7 +1562,7 @@ s32 func_80AF9B54(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret; this->actor.flags |= ACTOR_FLAG_1; @@ -1575,23 +1573,23 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { switch (arg2->result) { case 16: - ret = func_80AF9A0C(this, globalCtx, arg2); + ret = func_80AF9A0C(this, play, arg2); break; case 17: - ret = func_80AF9AB0(this, globalCtx, arg2); + ret = func_80AF9AB0(this, play, arg2); break; case 28: - ret = func_80AF9B54(this, globalCtx, arg2); + ret = func_80AF9B54(this, play, arg2); break; case 24: - ret = func_80AF94AC(this, globalCtx, arg2); + ret = func_80AF94AC(this, play, arg2); break; case 29: - ret = func_80AF95E8(this, globalCtx, arg2); + ret = func_80AF95E8(this, play, arg2); break; case 1: @@ -1606,7 +1604,7 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 35: case 36: case 37: - ret = func_80AF9008(this, globalCtx, arg2); + ret = func_80AF9008(this, play, arg2); break; case 3: @@ -1619,11 +1617,11 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 23: case 25: case 27: - ret = func_80AF95E8(this, globalCtx, arg2); + ret = func_80AF95E8(this, play, arg2); break; case 8: - ret = func_80AF98A0(this, globalCtx, arg2); + ret = func_80AF98A0(this, play, arg2); break; case 9: @@ -1631,7 +1629,7 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 20: case 21: case 22: - ret = func_80AF992C(this, globalCtx, arg2); + ret = func_80AF992C(this, play, arg2); break; case 38: @@ -1688,7 +1686,7 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { case 89: case 90: case 91: - ret = func_80AF91E8(this, globalCtx, arg2); + ret = func_80AF91E8(this, play, arg2); break; default: @@ -1698,13 +1696,13 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80AF9D04(EnPm* this, GlobalContext* globalCtx) { - EnDoor* door = (EnDoor*)func_80AF7D60(globalCtx, this->unk_258); +s32 func_80AF9D04(EnPm* this, PlayState* play) { + EnDoor* door = (EnDoor*)func_80AF7D60(play, this->unk_258); Vec3f sp38; Vec3f* sp28; f32 temp; - if (!SubS_InCsMode(globalCtx) && (this->timePathTimeSpeed != 0)) { + if (!SubS_InCsMode(play) && (this->timePathTimeSpeed != 0)) { if ((door != NULL) && (door->dyna.actor.update != NULL)) { if (((f32)this->unk_36E / this->unk_36C) <= 0.9f) { door->unk_1A7 = this->unk_260; @@ -1726,7 +1724,7 @@ s32 func_80AF9D04(EnPm* this, GlobalContext* globalCtx) { return false; } -s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AF9E7C(EnPm* this, PlayState* play) { f32 knots[265]; Vec3f sp70; Vec3f sp64; @@ -1743,7 +1741,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; this->unk_356 |= 8; } else { @@ -1753,7 +1751,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { this->actor.world.pos.x = timePathTargetPos.x; this->actor.world.pos.z = timePathTargetPos.z; - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { sp54 = this->timePathElapsedTime; sp50 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -1771,7 +1769,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); } - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; @@ -1792,7 +1790,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) { return false; } -s32 func_80AFA170(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AFA170(EnPm* this, PlayState* play) { Vec3f sp34; Vec3f sp28; @@ -1845,7 +1843,7 @@ s32 func_80AFA170(EnPm* this, GlobalContext* globalCtx) { return true; } -s32 func_80AFA334(EnPm* this, GlobalContext* globalCtx) { +s32 func_80AFA334(EnPm* this, PlayState* play) { s16 temp_v0; switch (this->unk_258) { @@ -1861,7 +1859,7 @@ s32 func_80AFA334(EnPm* this, GlobalContext* globalCtx) { case 27: if (DECR(this->unk_36C) == 0) { - Flags_SetSwitch(globalCtx, 1); + Flags_SetSwitch(play, 1); } break; @@ -1881,7 +1879,7 @@ s32 func_80AFA334(EnPm* this, GlobalContext* globalCtx) { return false; } -void func_80AFA438(EnPm* this, GlobalContext* globalCtx) { +void func_80AFA438(EnPm* this, PlayState* play) { switch (this->unk_258) { case 3: case 4: @@ -1892,7 +1890,7 @@ void func_80AFA438(EnPm* this, GlobalContext* globalCtx) { case 17: case 18: case 28: - func_80AFA170(this, globalCtx); + func_80AFA170(this, play); break; case 1: @@ -1907,7 +1905,7 @@ void func_80AFA438(EnPm* this, GlobalContext* globalCtx) { case 35: case 36: case 37: - func_80AF9D04(this, globalCtx); + func_80AF9D04(this, play); break; case 9: @@ -1920,7 +1918,7 @@ void func_80AFA438(EnPm* this, GlobalContext* globalCtx) { case 25: case 27: case 29: - func_80AFA334(this, globalCtx); + func_80AFA334(this, play); break; case 38: @@ -1977,14 +1975,14 @@ void func_80AFA438(EnPm* this, GlobalContext* globalCtx) { case 89: case 90: case 91: - func_80AF9E7C(this, globalCtx); + func_80AF9E7C(this, play); break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx) { +void func_80AFA4D0(EnPm* this, PlayState* play) { static u8* D_80AFB900[] = { D_80AFAD80, D_80AFB30C, D_80AFB3C0, D_80AFB3FC, D_80AFB41C, }; @@ -1999,8 +1997,8 @@ void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx) { gSaveContext.save.time = time; } - if (!Schedule_RunScript(globalCtx, D_80AFB900[this->unk_38C], &sp2C) || - ((this->unk_258 != sp2C.result) && !func_80AF9BF8(this, globalCtx, &sp2C))) { + if (!Schedule_RunScript(play, D_80AFB900[this->unk_38C], &sp2C) || + ((this->unk_258 != sp2C.result) && !func_80AF9BF8(this, play, &sp2C))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp2C.result = 0; @@ -2010,19 +2008,19 @@ void func_80AFA4D0(EnPm* this, GlobalContext* globalCtx) { } this->unk_258 = sp2C.result; - this->unk_268 = func_80AF8040(this, globalCtx); - func_80AFA438(this, globalCtx); + this->unk_268 = func_80AF8040(this, play); + func_80AFA438(this, play); if (this->unk_38C != 0) { gSaveContext.save.time = sp3C; } } -void func_80AFA5FC(EnPm* this, GlobalContext* globalCtx) { +void func_80AFA5FC(EnPm* this, PlayState* play) { s16 yaw; Vec3f sp38; Vec3f sp2C; - if (func_8010BF58(&this->actor, globalCtx, this->unk_25C, this->unk_37C, &this->unk_264)) { + if (func_8010BF58(&this->actor, play, this->unk_25C, this->unk_37C, &this->unk_264)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 &= ~0x20; this->unk_356 |= 0x200; @@ -2045,73 +2043,72 @@ void func_80AFA5FC(EnPm* this, GlobalContext* globalCtx) { } } -void func_80AFA724(EnPm* this, GlobalContext* globalCtx) { +void func_80AFA724(EnPm* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK); } } -void EnPm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPm_Init(Actor* thisx, PlayState* play) { EnPm* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 14.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mm_Skel_0096E8, NULL, this->jointTable, this->morphTable, - 16); + SkelAnime_InitFlex(play, &this->skelAnime, &object_mm_Skel_0096E8, NULL, this->jointTable, this->morphTable, 16); this->unk_384 = -1; func_80AF7E98(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitAndSetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->unk_38C = func_80AF7B40(); this->unk_258 = 0; this->unk_356 = 0; this->actionFunc = func_80AFA4D0; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnPm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPm_Destroy(Actor* thisx, PlayState* play) { EnPm* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroySphere(globalCtx, &this->colliderSphere); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroySphere(play, &this->colliderSphere); } -void EnPm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPm_Update(Actor* thisx, PlayState* play) { EnPm* this = THIS; - if (!func_80AF86F0(this, globalCtx) && func_80AF87C4(this, globalCtx)) { - func_80AFA724(this, globalCtx); + if (!func_80AF86F0(this, play) && func_80AF87C4(this, play)) { + func_80AFA724(this, play); func_80AF7E6C(this); func_80AF8AC8(this); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80AF7BAC(this); if (this->unk_258 != 0) { - func_80AF8DD4(this, globalCtx); + func_80AF8DD4(this, play); func_80AF7E6C(this); func_80AF8AC8(this); - func_8013C964(&this->actor, globalCtx, this->unk_368, 30.0f, this->unk_394, this->unk_356 & 7); + func_8013C964(&this->actor, play, this->unk_368, 30.0f, this->unk_394, this->unk_356 & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); - func_80AF7F68(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + func_80AF7F68(this, play); } } } -s32 EnPm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnPm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnPm* this = THIS; if (limbIndex == 15) { - func_80AF8C68(this, globalCtx); + func_80AF8C68(this, play); } return false; } -void EnPm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnPm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnPm* this = THIS; s32 pad; Vec3f sp2C; @@ -2146,7 +2143,7 @@ void EnPm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnPm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx, Gfx** gfx) { +void EnPm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx** gfx) { EnPm* this = THIS; s32 stepRot; s32 overrideRot; @@ -2176,7 +2173,7 @@ void EnPm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this } } -void EnPm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPm_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80AFB914[] = { object_mm_Tex_002950, object_mm_Tex_002750, @@ -2185,18 +2182,18 @@ void EnPm_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; if (this->unk_258 != 0) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AFB914[0])); - POLY_OPA_DISP = SubS_DrawTransformFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + POLY_OPA_DISP = SubS_DrawTransformFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnPm_OverrideLimbDraw, EnPm_PostLimbDraw, EnPm_TransformLimbDraw, &this->actor, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.h b/src/overlays/actors/ovl_En_Pm/z_en_pm.h index 7a8c2be772..1a16ece453 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.h +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.h @@ -5,9 +5,9 @@ struct EnPm; -typedef void (*EnPmActionFunc)(struct EnPm*, GlobalContext*); -typedef s32 (*EnPmFunc)(struct EnPm*, GlobalContext*); -typedef s32 (*EnPmFunc2)(struct EnPm*, GlobalContext*); +typedef void (*EnPmActionFunc)(struct EnPm*, PlayState*); +typedef s32 (*EnPmFunc)(struct EnPm*, PlayState*); +typedef s32 (*EnPmFunc2)(struct EnPm*, PlayState*); typedef struct EnPm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c index 744644e58f..b828bfc90b 100644 --- a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c +++ b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.c @@ -10,22 +10,22 @@ #define THIS ((EnPoComposer*)thisx) -void EnPoComposer_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoComposer_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoComposer_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoComposer_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoComposer_Init(Actor* thisx, PlayState* play); +void EnPoComposer_Destroy(Actor* thisx, PlayState* play); +void EnPoComposer_Update(Actor* thisx, PlayState* play); +void EnPoComposer_Draw(Actor* thisx, PlayState* play); -void func_80BC5294(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC52F0(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC53A0(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC5404(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC5570(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC55E0(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC5670(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC56D0(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC5780(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC5830(EnPoComposer* this, GlobalContext* globalCtx); -void func_80BC58E0(EnPoComposer* this, GlobalContext* globalCtx); +void func_80BC5294(EnPoComposer* this, PlayState* play); +void func_80BC52F0(EnPoComposer* this, PlayState* play); +void func_80BC53A0(EnPoComposer* this, PlayState* play); +void func_80BC5404(EnPoComposer* this, PlayState* play); +void func_80BC5570(EnPoComposer* this, PlayState* play); +void func_80BC55E0(EnPoComposer* this, PlayState* play); +void func_80BC5670(EnPoComposer* this, PlayState* play); +void func_80BC56D0(EnPoComposer* this, PlayState* play); +void func_80BC5780(EnPoComposer* this, PlayState* play); +void func_80BC5830(EnPoComposer* this, PlayState* play); +void func_80BC58E0(EnPoComposer* this, PlayState* play); #if 0 const ActorInit En_Po_Composer_InitVars = { diff --git a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.h b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.h index 965e9cc6c7..88d240c588 100644 --- a/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.h +++ b/src/overlays/actors/ovl_En_Po_Composer/z_en_po_composer.h @@ -5,7 +5,7 @@ struct EnPoComposer; -typedef void (*EnPoComposerActionFunc)(struct EnPoComposer*, GlobalContext*); +typedef void (*EnPoComposerActionFunc)(struct EnPoComposer*, PlayState*); typedef struct EnPoComposer { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 42fd2b418d..2a7ba2d9b9 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -15,19 +15,18 @@ #define GET_FUSE_LEN_PARAM(this) (((Actor*)(this))->params & 0x3FF) #define GET_IS_FUSE_TYPE_PARAM(this) (((Actor*)(this))->params & 0x8000) -void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoFusen_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoFusen_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoFusen_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPoFusen_Init(Actor* thisx, PlayState* play); +void EnPoFusen_Destroy(Actor* thisx, PlayState* play); +void EnPoFusen_Update(Actor* thisx, PlayState* play); +void EnPoFusen_Draw(Actor* thisx, PlayState* play); -u16 EnPoFusen_CheckParent(EnPoFusen* this, GlobalContext* globalCtx); +u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); void EnPoFusen_InitNoFuse(EnPoFusen* this); void EnPoFusen_InitFuse(EnPoFusen* this); -void EnPoFusen_Pop(EnPoFusen* this, GlobalContext* globalCtx); -void EnPoFusen_Idle(EnPoFusen* this, GlobalContext* globalCtx); -void EnPoFusen_IdleFuse(EnPoFusen* this, GlobalContext* globalCtx); -s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx); +void EnPoFusen_Pop(EnPoFusen* this, PlayState* play); +void EnPoFusen_Idle(EnPoFusen* this, PlayState* play); +void EnPoFusen_IdleFuse(EnPoFusen* this, PlayState* play); +s32 EnPoFusen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); const ActorInit En_Po_Fusen_InitVars = { ACTOR_EN_PO_FUSEN, @@ -96,7 +95,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoFusen_Init(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; f32 heightTemp; @@ -104,17 +103,17 @@ void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; this->actor.colChkInfo.damageTable = &sDamageTable; - Collider_InitSphere(globalCtx, &this->collider); - Collider_SetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); if (0) {} this->collider.dim.worldSphere.radius = 40; - SkelAnime_InitFlex(globalCtx, &this->anime, &object_po_fusen_Skel_0024F0, &object_po_fusen_Anim_000040, - this->jointTable, this->morphTable, 10); + SkelAnime_InitFlex(play, &this->anime, &object_po_fusen_Skel_0024F0, &object_po_fusen_Anim_000040, this->jointTable, + this->morphTable, 10); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); - if (EnPoFusen_CheckParent(this, globalCtx) == 0) { + if (EnPoFusen_CheckParent(this, play) == 0) { Actor_MarkForDeath(&this->actor); } @@ -141,15 +140,15 @@ void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) { EnPoFusen_InitNoFuse(this); } -void EnPoFusen_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -u16 EnPoFusen_CheckParent(EnPoFusen* this, GlobalContext* globalCtx) { +u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { Actor* actorPtr; - actorPtr = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; + actorPtr = play->actorCtx.actorLists[ACTORCAT_NPC].first; if (GET_IS_FUSE_TYPE_PARAM(this)) { return 1; } @@ -167,7 +166,7 @@ u16 EnPoFusen_CheckParent(EnPoFusen* this, GlobalContext* globalCtx) { return 0; } -u16 EnPoFusen_CheckCollision(EnPoFusen* this, GlobalContext* globalCtx) { +u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { if (this->actionFunc == EnPoFusen_IdleFuse) { return 0; } @@ -181,8 +180,8 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, GlobalContext* globalCtx) { return 1; } - 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); return 0; } @@ -192,7 +191,7 @@ void EnPoFusen_InitNoFuse(EnPoFusen* this) { this->actionFunc = EnPoFusen_Idle; } -void EnPoFusen_Idle(EnPoFusen* this, GlobalContext* globalCtx) { +void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { f32 shadowScaleTmp; f32 shadowAlphaTmp; f32 heightOffset; @@ -239,9 +238,9 @@ void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { this->actionFunc = EnPoFusen_Pop; } -void EnPoFusen_Pop(EnPoFusen* this, GlobalContext* globalCtx) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 255, 255, 200, CLEAR_TAG_POP); +void EnPoFusen_Pop(EnPoFusen* this, PlayState* play) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, + this->actor.world.pos.z, 255, 255, 200, CLEAR_TAG_POP); Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_MarkForDeath(&this->actor); } @@ -254,23 +253,22 @@ void EnPoFusen_InitFuse(EnPoFusen* this) { this->actionFunc = EnPoFusen_IdleFuse; } -void EnPoFusen_IdleFuse(EnPoFusen* this, GlobalContext* globalCtx) { - EnPoFusen_Idle(this, globalCtx); +void EnPoFusen_IdleFuse(EnPoFusen* this, PlayState* play) { + EnPoFusen_Idle(this, play); if (this->fuse-- == 0) { EnPoFusen_IncrementRomaniPop(this); } } -void EnPoFusen_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoFusen_Update(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; - this->actionFunc(this, globalCtx); - if (EnPoFusen_CheckCollision(this, globalCtx) != 0) { + this->actionFunc(this, play); + if (EnPoFusen_CheckCollision(this, play) != 0) { EnPoFusen_IncrementRomaniPop(this); } } -s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnPoFusen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPoFusen* this = THIS; f32 zScale; f32 yScale; @@ -309,16 +307,16 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnPoFusen_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnPoFusen_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnPoFusen_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnPoFusen_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnPoFusen_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoFusen_Draw(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->anime.skeleton, this->anime.jointTable, this->anime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->anime.skeleton, this->anime.jointTable, this->anime.dListCount, EnPoFusen_OverrideLimbDraw, EnPoFusen_PostLimbDraw, EnPoFusen_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h index 5a879ddb10..ea07ce18a9 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h @@ -5,7 +5,7 @@ struct EnPoFusen; -typedef void (*EnPoFusenActionFunc)(struct EnPoFusen*, GlobalContext*); +typedef void (*EnPoFusenActionFunc)(struct EnPoFusen*, PlayState*); typedef struct EnPoFusen { /* 0x000 */ 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 bb128935d5..7a2f56299c 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 @@ -12,41 +12,41 @@ #define THIS ((EnPoSisters*)thisx) -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_80B1AA88(EnPoSisters* this); -void func_80B1AAE8(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1ABB8(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1AAE8(EnPoSisters* this, PlayState* play); +void func_80B1ABB8(EnPoSisters* this, PlayState* play); void func_80B1AC40(EnPoSisters* this); -void func_80B1ACB8(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1ACB8(EnPoSisters* this, PlayState* play); void func_80B1AE28(EnPoSisters* this); -void func_80B1AE3C(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1AE3C(EnPoSisters* this, PlayState* play); void func_80B1AF8C(EnPoSisters* this); -void func_80B1B020(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B020(EnPoSisters* this, PlayState* play); void func_80B1B0E0(EnPoSisters* this); -void func_80B1B168(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1B2F0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B168(EnPoSisters* this, PlayState* play); +void func_80B1B2F0(EnPoSisters* this, PlayState* play); +void func_80B1B444(EnPoSisters* this, PlayState* play); void func_80B1B5B4(EnPoSisters* this); -void func_80B1B628(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B628(EnPoSisters* this, PlayState* play); void func_80B1B70C(EnPoSisters* this); -void func_80B1B7BC(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1B860(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1B940(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1B7BC(EnPoSisters* this, PlayState* play); +void func_80B1B860(EnPoSisters* this, PlayState* play); +void func_80B1B940(EnPoSisters* this, PlayState* play); void func_80B1BA3C(EnPoSisters* this); -void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1BC4C(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1BCA0(EnPoSisters* this, GlobalContext* globalCtx); -void func_80B1BCF0(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BA90(EnPoSisters* this, PlayState* play); +void func_80B1BC4C(EnPoSisters* this, PlayState* play); +void func_80B1BCA0(EnPoSisters* this, PlayState* play); +void func_80B1BCF0(EnPoSisters* this, PlayState* play); void func_80B1BE4C(EnPoSisters* this, s32 arg1); -void func_80B1BF2C(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1BF2C(EnPoSisters* this, PlayState* play); void func_80B1C030(EnPoSisters* this); -void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1C0A4(EnPoSisters* this, PlayState* play); void func_80B1C2E8(EnPoSisters* this); -void func_80B1C340(EnPoSisters* this, GlobalContext* globalCtx); +void func_80B1C340(EnPoSisters* this, PlayState* play); static Color_RGBA8 D_80B1DA30[] = { { 255, 170, 255, 255 }, @@ -136,22 +136,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_STOP), }; -void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Init(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_po_sisters_Skel_0065C8, &object_po_sisters_Anim_0014CC, + SkelAnime_Init(play, &this->skelAnime, &object_po_sisters_Skel_0065C8, &object_po_sisters_Anim_0014CC, this->jointTable, this->morphTable, 12); this->unk_226 = 255; this->unk_227 = 255; this->unk_228 = 210; this->unk_229 = 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_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_18C = ENPOSISTERS_GET_300(thisx); this->actor.hintId = this->unk_18C + 80; @@ -170,7 +170,7 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 8; this->collider.info.toucher.damage = 16; this->collider.base.ocFlags1 = (OC1_TYPE_PLAYER | OC1_ON); - func_80B1BCF0(this, globalCtx); + func_80B1BCF0(this, play); func_80B1C2E8(this); } else { this->actor.flags &= ~(ACTOR_FLAG_200 | ACTOR_FLAG_4000); @@ -185,11 +185,11 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.params &= 0xFF; } -void EnPoSisters_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Destroy(Actor* thisx, PlayState* play) { EnPoSisters* this = THIS; - 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 func_80B1A648(EnPoSisters* this, s32 arg1, Vec3f* pos) { @@ -207,8 +207,8 @@ void func_80B1A648(EnPoSisters* this, s32 arg1, Vec3f* pos) { } } -void func_80B1A768(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B1A768(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 sp20; if ((this->unk_18D == 0) || (this->actionFunc != func_80B1B444)) { @@ -227,8 +227,8 @@ void func_80B1A768(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.world.pos.z = (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * sp20) + player->actor.world.pos.z; } -void func_80B1A894(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B1A894(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + 5.0f, 0.5f, 3.0f); @@ -251,7 +251,7 @@ void func_80B1A894(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80B1A9B0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1A9B0(EnPoSisters* this, PlayState* play) { if (this->actor.isTargeted && (this->unk_229 == 255)) { if (this->unk_18F != 0) { this->unk_18F--; @@ -271,7 +271,7 @@ void func_80B1A9B0(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_18F == 0) { func_80B1B70C(this); } else if ((this->unk_194 == 0) && (this->unk_229 == 0)) { - func_80B1B860(this, globalCtx); + func_80B1B860(this, play); } } } @@ -283,7 +283,7 @@ void func_80B1AA88(EnPoSisters* this) { this->actionFunc = func_80B1AAE8; } -void func_80B1AAE8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1AAE8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (DECR(this->unk_192) == 0) { this->unk_192 = Rand_S16Offset(100, 50); @@ -298,7 +298,7 @@ void func_80B1AB5C(EnPoSisters* this) { this->actionFunc = func_80B1ABB8; } -void func_80B1ABB8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1ABB8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->unk_192 != 0) { @@ -320,7 +320,7 @@ void func_80B1AC40(EnPoSisters* this) { this->actionFunc = func_80B1ACB8; } -void func_80B1ACB8(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1ACB8(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -346,8 +346,8 @@ void func_80B1AE28(EnPoSisters* this) { this->actionFunc = func_80B1AE3C; } -void func_80B1AE3C(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B1AE3C(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp22; SkelAnime_Update(&this->skelAnime); @@ -382,7 +382,7 @@ void func_80B1AF8C(EnPoSisters* this) { this->actionFunc = func_80B1B020; } -void func_80B1B020(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B020(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_192 != 0) { this->unk_192--; @@ -410,7 +410,7 @@ void func_80B1B0E0(EnPoSisters* this) { this->actionFunc = func_80B1B168; } -void func_80B1B168(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B168(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->unk_192 != 0) { @@ -430,7 +430,7 @@ void func_80B1B168(EnPoSisters* this, GlobalContext* globalCtx) { func_80B1AC40(this); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); } } } @@ -449,7 +449,7 @@ void func_80B1B280(EnPoSisters* this) { this->actionFunc = func_80B1B2F0; } -void func_80B1B2F0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B2F0(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y -= (s16)(this->actor.speedXZ * 10.0f * 128.0f); if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f)) { @@ -458,7 +458,7 @@ void func_80B1B2F0(EnPoSisters* this, GlobalContext* globalCtx) { func_80B1AC40(this); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); } } } @@ -478,7 +478,7 @@ void func_80B1B3A8(EnPoSisters* this) { this->actionFunc = func_80B1B444; } -void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B444(EnPoSisters* this, PlayState* play) { s32 temp_f18; if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_8000)) { @@ -488,7 +488,7 @@ void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->unk_18D != 0) { func_80B1BE4C(this, 0); } else { - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); } } else { func_80B1BA3C(this); @@ -501,7 +501,7 @@ void func_80B1B444(EnPoSisters* this, GlobalContext* globalCtx) { temp_f18 = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; this->unk_229 = CLAMP(temp_f18, 0, 255); this->actor.world.pos.y = this->actor.parent->world.pos.y; - func_80B1A768(this, globalCtx); + func_80B1A768(this, play); } else if (this->unk_18C != 0) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); } @@ -516,7 +516,7 @@ void func_80B1B5B4(EnPoSisters* this) { this->actionFunc = func_80B1B628; } -void func_80B1B628(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B628(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -547,7 +547,7 @@ void func_80B1B70C(EnPoSisters* this) { this->actionFunc = func_80B1B7BC; } -void func_80B1B7BC(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B7BC(EnPoSisters* this, PlayState* play) { s32 temp_f18; if (SkelAnime_Update(&this->skelAnime)) { @@ -560,12 +560,12 @@ void func_80B1B7BC(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80B1B860(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B860(EnPoSisters* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_po_sisters_Anim_00119C, 1.5f, 0.0f, Animation_GetLastFrame(&object_po_sisters_Anim_00119C.common), 2, -3.0f); if (this->unk_18C == 0) { this->unk_2EC = 110.0f; - func_80B1A768(this, globalCtx); + func_80B1A768(this, play); this->unk_229 = 0; this->actor.draw = EnPoSisters_Draw; } else { @@ -579,7 +579,7 @@ void func_80B1B860(EnPoSisters* this, GlobalContext* globalCtx) { this->actionFunc = func_80B1B940; } -void func_80B1B940(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1B940(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { this->unk_229 = 255; if (this->unk_18C != 0) { @@ -601,7 +601,7 @@ void func_80B1B940(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_229 = CLAMP(temp_f18, 0, 255); if (this->unk_18C == 0) { - func_80B1A768(this, globalCtx); + func_80B1A768(this, play); } } } @@ -616,7 +616,7 @@ void func_80B1BA3C(EnPoSisters* this) { this->actionFunc = func_80B1BA90; } -void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1BA90(EnPoSisters* this, PlayState* play) { s32 i; s32 end = this->unk_190; @@ -644,7 +644,7 @@ void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_22C[0].y = this->unk_22C[1].y + 2.0f; if (this->unk_192 >= 16) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f)) { - func_80B1BC4C(this, globalCtx); + func_80B1BC4C(this, play); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; @@ -656,14 +656,14 @@ void func_80B1BA90(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80B1BC4C(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1BC4C(EnPoSisters* this, PlayState* play) { this->unk_192 = 0; this->actor.world.pos.y = this->unk_22C[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_80B1BCA0; } -void func_80B1BCA0(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1BCA0(EnPoSisters* this, PlayState* play) { this->unk_192++; if (this->unk_192 == 32) { Actor_MarkForDeath(&this->actor); @@ -672,16 +672,13 @@ void func_80B1BCA0(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80B1BCF0(EnPoSisters* this, GlobalContext* globalCtx) { - Actor* sp4C = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); - Actor* sp48 = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); - Actor* sp44 = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); +void func_80B1BCF0(EnPoSisters* this, PlayState* play) { + Actor* sp4C = Actor_SpawnAsChild(&play->actorCtx, &this->actor, 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* sp48 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, 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* sp44 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); if ((sp4C == NULL) || (sp48 == NULL) || (sp44 == NULL)) { if (sp4C != NULL) { @@ -718,8 +715,8 @@ void func_80B1BE4C(EnPoSisters* this, s32 arg1) { this->actionFunc = func_80B1BF2C; } -void func_80B1BF2C(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B1BF2C(EnPoSisters* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnPoSisters* parent = (EnPoSisters*)this->actor.parent; if (this->unk_18D == 0) { @@ -732,12 +729,12 @@ void func_80B1BF2C(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = (rand * 0x4000) + this->actor.yawTowardsPlayer; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80B1B860(this, globalCtx); + func_80B1B860(this, play); } } else if (parent->actionFunc == func_80B1B940) { this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->unk_18D * 0x4000); this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80B1B860(this, globalCtx); + func_80B1B860(this, play); } else if (parent->actionFunc == func_80B1BA90) { Actor_MarkForDeath(&this->actor); } @@ -753,7 +750,7 @@ void func_80B1C030(EnPoSisters* this) { this->actionFunc = func_80B1C0A4; } -void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1C0A4(EnPoSisters* this, PlayState* play) { EnPoSisters* parent; if (this->unk_192 != 0) { @@ -792,7 +789,7 @@ void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_18D == 0) { func_80B1B0E0(this); } else { - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); } } else if (this->unk_18D != 0) { parent = (EnPoSisters*)this->actor.parent; @@ -807,7 +804,7 @@ void func_80B1C0A4(EnPoSisters* this, GlobalContext* globalCtx) { func_80B1B0E0(this); } } - func_80B1A768(this, globalCtx); + func_80B1A768(this, play); } void func_80B1C2E8(EnPoSisters* this) { @@ -818,13 +815,13 @@ void func_80B1C2E8(EnPoSisters* this) { this->actionFunc = func_80B1C340; } -void func_80B1C340(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1C340(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_229 = 255; this->actor.flags |= ACTOR_FLAG_1; this->unk_191 |= (0x10 | 0x8); if (this->unk_18C == 0) { - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); } else { func_80B1AC40(this); } @@ -836,7 +833,7 @@ void func_80B1C340(EnPoSisters* this, GlobalContext* globalCtx) { } } -void func_80B1C408(EnPoSisters* this, GlobalContext* globalCtx) { +void func_80B1C408(EnPoSisters* this, PlayState* play) { Vec3f sp3C; if (this->collider.base.acFlags & AC_HIT) { @@ -846,18 +843,18 @@ void func_80B1C408(EnPoSisters* this, GlobalContext* globalCtx) { if (this->unk_18D != 0) { ((EnPoSisters*)this->actor.parent)->unk_194--; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, globalCtx); + func_80B1BE4C(this, play); if (Rand_ZeroOne() < 0.2f) { sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; - Item_DropCollectible(globalCtx, &sp3C, ITEM00_ARROWS_10); + Item_DropCollectible(play, &sp3C, ITEM00_ARROWS_10); } } else if (this->collider.base.colType != 9) { if (this->actor.colChkInfo.damageEffect == 0xF) { this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_191 |= 2; - func_80B1B860(this, globalCtx); + func_80B1B860(this, play); } else if ((this->unk_18C == 0) && (this->actor.colChkInfo.damageEffect == 0xE) && (this->actionFunc == func_80B1C0A4)) { if (this->unk_194 == 0) { @@ -867,16 +864,16 @@ void func_80B1C408(EnPoSisters* this, GlobalContext* globalCtx) { if (Actor_ApplyDamage(&this->actor)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); } else { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } if (this->actor.colChkInfo.damageEffect == 4) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.5f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); } func_80B1B3A8(this); } @@ -884,7 +881,7 @@ void func_80B1C408(EnPoSisters* this, GlobalContext* globalCtx) { } } -void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPoSisters_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = THIS; f32 temp_f2; @@ -896,27 +893,27 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B1B280(this); } - func_80B1C408(this, globalCtx); + func_80B1C408(this, play); if (this->unk_191 & 0x4) { - func_80B1A9B0(this, globalCtx); + func_80B1A9B0(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_191 & 0x8) { - func_80B1A894(this, globalCtx); + func_80B1A894(this, play); } Actor_MoveWithGravity(&this->actor); if (this->unk_191 & 0x10) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); } else { checkPos.x = this->actor.world.pos.x; checkPos.y = this->actor.world.pos.y + 10.0f; checkPos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &checkPos); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &checkPos); } this->actor.shape.shadowAlpha = this->unk_229; @@ -946,15 +943,15 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc == func_80B1B168) { this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_191 & 0x1) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80B1BF2C) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc == func_80B1B628) { @@ -997,8 +994,8 @@ void func_80B1C974(EnPoSisters* this) { } } -s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { static Gfx* D_80B1DACC[] = { object_po_sisters_DL_001DE0, object_po_sisters_DL_002F88, @@ -1046,8 +1043,7 @@ s32 EnPoSisters_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; static s8 D_80B1DB08[] = { -1, -1, 0, 1, 2, -1, 3, -1, -1, -1, -1, -1, @@ -1068,7 +1064,7 @@ void EnPoSisters_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } if ((this->actionFunc == func_80B1BA90) && (this->unk_192 >= 8) && (limbIndex == 9)) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, object_po_sisters_DL_0046E0); } @@ -1105,7 +1101,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 = THIS; Color_RGBA8* temp_s1 = &D_80B1DA40[this->unk_18C]; Color_RGBA8* temp_s7 = &D_80B1DA30[this->unk_18C]; @@ -1115,36 +1111,36 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 phi_f20; s32 pad2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_80B1C974(this); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if ((this->unk_229 == 255) || (this->unk_229 == 0)) { gDPSetEnvColor(POLY_OPA_DISP++, this->unk_226, this->unk_227, this->unk_228, this->unk_229); gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); 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_229); gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); 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_191 & 0x80)) { Matrix_Put(&this->unk_358); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_po_sisters_DL_0027B0); } - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (globalCtx->gameplayFrames * -20) % 512, - 32, 128)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) % 512, 32, 128)); gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); if (this->actionFunc == func_80B1BCA0) { @@ -1164,7 +1160,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_22C[i].x, this->unk_22C[i].y, this->unk_22C[i].z, MTXMODE_NEW); - Matrix_RotateZYX(0, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), 0, MTXMODE_APPLY); if (this->actionFunc == func_80B1BA90) { f32 phi_f0; @@ -1175,13 +1171,13 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(phi_f20, phi_f20, phi_f20, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); } - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->actor.scale.x * 142.857131958f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 3350f8f03b..8923a70991 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 @@ -5,7 +5,7 @@ struct EnPoSisters; -typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, GlobalContext*); +typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); #define ENPOSISTERS_GET_300(thisx) (((thisx)->params >> 8) & 3) #define ENPOSISTERS_GET_C00(thisx) (((thisx)->params >> 0xA) & 3) 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 478c306b0d..31e86b8c88 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -11,40 +11,40 @@ #define THIS ((EnPoh*)thisx) -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPoh_Draw(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_Draw(Actor* thisx, PlayState* play); -void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CAA4(EnPoh* this, PlayState* play); void func_80B2CB60(EnPoh* this); -void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CBBC(EnPoh* this, PlayState* play); void func_80B2CD14(EnPoh* this); -void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CD64(EnPoh* this, PlayState* play); void func_80B2CEC8(EnPoh* this); -void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx); -void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx); +void func_80B2CF28(EnPoh* this, PlayState* play); +void func_80B2D07C(EnPoh* this, PlayState* play); void func_80B2D0E8(EnPoh* this); -void func_80B2D140(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D140(EnPoh* this, PlayState* play); void func_80B2D2C0(EnPoh* this); -void func_80B2D300(EnPoh* this, GlobalContext* globalCtx); -void func_80B2D628(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D300(EnPoh* this, PlayState* play); +void func_80B2D628(EnPoh* this, PlayState* play); void func_80B2D694(EnPoh* this); -void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx); -void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx); -void func_80B2D980(EnPoh* this, GlobalContext* globalCtx); +void func_80B2D6EC(EnPoh* this, PlayState* play); +void func_80B2D7D4(EnPoh* this, PlayState* play); +void func_80B2D980(EnPoh* this, PlayState* play); void func_80B2DAD0(EnPoh* this); -void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx); -void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx); -void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx); +void func_80B2DB44(EnPoh* this, PlayState* play); +void func_80B2DC50(EnPoh* this, PlayState* play); +void func_80B2DD2C(EnPoh* this, PlayState* play); void func_80B2E0B0(EnPoh* this); -void func_80B2E180(EnPoh* this, GlobalContext* globalCtx); +void func_80B2E180(EnPoh* this, PlayState* play); void func_80B2E1D8(EnPoh* this); -void func_80B2E230(EnPoh* this, GlobalContext* globalCtx); +void func_80B2E230(EnPoh* this, PlayState* play); void func_80B2E3B0(EnPoh* this); -void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx); -void func_80B2F328(Actor* thisx, GlobalContext* globalCtx); -void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx); +void func_80B2E3F8(EnPoh* this, PlayState* play); +void func_80B2F328(Actor* thisx, PlayState* play); +void func_80B2F37C(Actor* thisx, PlayState* play); const ActorInit En_Poh_InitVars = { ACTOR_EN_POH, @@ -147,40 +147,40 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP), }; -void EnPoh_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Init(Actor* thisx, PlayState* play) { EnPoh* this = THIS; s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - Collider_InitAndSetJntSph(globalCtx, &this->colliderSph, &this->actor, &sJntSphInit, this->colliderSphElements); + Collider_InitAndSetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, this->colliderSphElements); 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_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_18D = 32; this->unk_190 = 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); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_po_Skel_0050D0, &object_po_Anim_000A60, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_po_Skel_0050D0, &object_po_Anim_000A60, this->jointTable, this->morphTable, 21); this->actor.bgCheckFlags |= 0x400; func_80B2D0E8(this); } -void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Destroy(Actor* thisx, PlayState* play) { EnPoh* this = THIS; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); - Collider_DestroyJntSph(globalCtx, &this->colliderSph); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); } -void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) { - Camera* activeCam = GET_ACTIVE_CAM(globalCtx); +void func_80B2C910(Vec3f* vec, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); Vec3f sp20; f32 temp_f0; @@ -198,8 +198,8 @@ void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) { } } -void func_80B2C9B8(EnPoh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B2C9B8(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_18D * 0x800); @@ -219,13 +219,13 @@ void func_80B2CA4C(EnPoh* this) { this->actor.speedXZ = 0.0f; } -void func_80B2CAA4(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2CAA4(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) { this->unk_18E--; } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); if (this->actor.xzDistToPlayer < 200.0f) { func_80B2CD14(this); @@ -245,7 +245,7 @@ void func_80B2CB60(EnPoh* this) { this->actionFunc = func_80B2CBBC; } -void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2CBBC(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_18E != 0)) { @@ -257,7 +257,7 @@ void func_80B2CBBC(EnPoh* this, GlobalContext* globalCtx) { } Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C); - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); if ((this->actor.xzDistToPlayer < 200.0f) && (this->unk_18E < 19)) { func_80B2CD14(this); } else if (this->unk_18E == 0) { @@ -280,8 +280,8 @@ void func_80B2CD14(EnPoh* this) { this->actor.speedXZ = 2.0f; } -void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B2CD64(EnPoh* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yawDiff; SkelAnime_Update(&this->skelAnime); @@ -298,12 +298,12 @@ void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); if (this->actor.xzDistToPlayer > 280.0f) { func_80B2CB60(this); } else if ((this->unk_18E == 0) && (this->actor.xzDistToPlayer < 140.0f) && - !Player_IsFacingActor(&this->actor, 0x2AAA, globalCtx)) { + !Player_IsFacingActor(&this->actor, 0x2AAA, play)) { func_80B2CEC8(this); } @@ -320,7 +320,7 @@ void func_80B2CEC8(EnPoh* this) { this->actionFunc = func_80B2CF28; } -void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2CF28(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_KANTERA); @@ -329,7 +329,7 @@ void func_80B2CF28(EnPoh* this, GlobalContext* globalCtx) { } } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); if (this->unk_18E >= 10) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xAAA); } else if (this->unk_18E == 9) { @@ -350,7 +350,7 @@ void func_80B2CFF8(EnPoh* this) { this->actionFunc = func_80B2D07C; } -void func_80B2D07C(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D07C(EnPoh* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { @@ -368,7 +368,7 @@ void func_80B2D0E8(EnPoh* this) { this->actionFunc = func_80B2D140; } -void func_80B2D140(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D140(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_197 = 255; this->unk_190 = Rand_S16Offset(700, 300); @@ -393,7 +393,7 @@ void func_80B2D2C0(EnPoh* this) { this->actionFunc = func_80B2D300; } -void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D300(EnPoh* this, PlayState* play) { static Vec3f D_80B2F710 = { 0.0f, 3.0f, 0.0f }; Vec3f sp44; f32 sp40; @@ -404,7 +404,7 @@ void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { this->unk_18E++; if (this->unk_18E < 8) { - sp38 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800; + sp38 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800; if (this->unk_18E < 5) { sp3A = (this->unk_18E * 0x1000) - 0x4000; sp44.y = (Math_SinS(sp3A) * 23.0f) + (this->actor.world.pos.y + 40.0f); @@ -417,15 +417,15 @@ void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { sp44.z = (Math_CosS(sp38) * 23.0f) + this->actor.world.pos.z; } sp36 = (this->unk_18E * 10) + 80; - func_800B3030(globalCtx, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); + func_800B3030(play, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); sp44.x = (2.0f * this->actor.world.pos.x) - sp44.x; sp44.z = (2.0f * this->actor.world.pos.z) - sp44.z; - func_800B3030(globalCtx, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); + func_800B3030(play, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); sp44.x = this->actor.world.pos.x; sp44.z = this->actor.world.pos.z; - func_800B3030(globalCtx, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); + func_800B3030(play, &sp44, &D_80B2F710, &gZeroVec3f, sp36, 0, 2); } else if (this->unk_18E == 28) { - func_80B2DC50(this, globalCtx); + func_80B2DC50(this, play); } else if (this->unk_18E > 18) { this->actor.scale.x = (28 - this->unk_18E) * 0.001f; this->actor.scale.y = (28 - this->unk_18E) * 0.001f; @@ -448,7 +448,7 @@ void func_80B2D5DC(EnPoh* this) { this->actor.speedXZ = -5.0f; } -void func_80B2D628(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D628(EnPoh* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80B2CB60(this); @@ -466,7 +466,7 @@ void func_80B2D694(EnPoh* this) { this->actor.speedXZ = 0.0f; } -void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D6EC(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C)) { func_80B2CB60(this); @@ -476,7 +476,7 @@ void func_80B2D6EC(EnPoh* this, GlobalContext* globalCtx) { func_80B2CD14(this); } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); } void func_80B2D76C(EnPoh* this) { @@ -490,7 +490,7 @@ void func_80B2D76C(EnPoh* this) { this->actionFunc = func_80B2D7D4; } -void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D7D4(EnPoh* this, PlayState* play) { if (this->unk_18C != 0) { this->unk_18C--; } @@ -501,7 +501,7 @@ void func_80B2D7D4(EnPoh* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->unk_192, 0, 0x200); } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); this->unk_197 = this->unk_18C * (255.0f / 32.0f); if (this->unk_18C == 0) { this->unk_190 = Rand_S16Offset(100, 50); @@ -520,14 +520,14 @@ void func_80B2D924(EnPoh* this) { this->actionFunc = func_80B2D980; } -void func_80B2D980(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2D980(EnPoh* this, PlayState* play) { this->unk_18C++; this->actor.world.rot.y -= this->unk_192; if (this->unk_18C > 15) { Math_ScaledStepToS(&this->unk_192, 0, 0x200); } - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); this->unk_197 = this->unk_18C * (255.0f / 32.0f); if (this->unk_18C == 32) { this->unk_190 = Rand_S16Offset(700, 300); @@ -546,7 +546,7 @@ void func_80B2DAD0(EnPoh* this) { this->actionFunc = func_80B2DB44; } -void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2DB44(EnPoh* this, PlayState* play) { f32 sp24; SkelAnime_Update(&this->skelAnime); @@ -554,7 +554,7 @@ void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx) { this->actor.world.pos.x -= sp24 * Math_CosS(this->actor.shape.rot.y); this->actor.world.pos.z += sp24 * Math_SinS(this->actor.shape.rot.y); Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C); - func_80B2C9B8(this, globalCtx); + func_80B2C9B8(this, play); this->unk_18E--; if ((this->unk_18E == 0) || (this->actor.xzDistToPlayer > 250.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -563,7 +563,7 @@ void func_80B2DB44(EnPoh* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } -void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2DC50(EnPoh* this, PlayState* play) { this->actor.update = func_80B2F328; this->actor.draw = func_80B2F37C; this->actor.shape.shadowDraw = NULL; @@ -576,20 +576,19 @@ void func_80B2DC50(EnPoh* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = 1500.0f; this->actor.world.pos.y -= 15.0f; this->actor.shape.rot.x = -0x8000; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 8); + func_800BC154(play, &play->actorCtx, &this->actor, 8); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actionFunc = func_80B2DD2C; } -void func_80B2DD2C(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2DD2C(EnPoh* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight <= BGCHECK_Y_MIN)) { - EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO, 10, - object_po_DL_002D28); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO, 10, object_po_DL_002D28); func_80B2E0B0(this); } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); } void func_80B2DDF8(EnPoh* this, s32 arg1) { @@ -634,7 +633,7 @@ void func_80B2E0B0(EnPoh* this) { this->actionFunc = func_80B2E180; } -void func_80B2E180(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2E180(EnPoh* this, PlayState* play) { this->actor.home.pos.y += 2.0f; func_80B2DDF8(this, 20); if (this->unk_197 == 255) { @@ -651,9 +650,9 @@ void func_80B2E1D8(EnPoh* this) { this->actionFunc = func_80B2E230; } -void func_80B2E230(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2E230(EnPoh* this, PlayState* play) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { Actor_MarkForDeath(&this->actor); return; } @@ -664,7 +663,7 @@ void func_80B2E230(EnPoh* this, GlobalContext* globalCtx) { return; } - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 35.0f, 60.0f); + Actor_PickUp(&this->actor, play, GI_MAX, 35.0f, 60.0f); this->actor.world.pos.y = (Math_SinS(this->unk_18D * 0x800) * 5.0f) + this->actor.home.pos.y; if (this->unk_18D) { this->unk_18D--; @@ -685,18 +684,18 @@ void func_80B2E3B0(EnPoh* this) { this->actionFunc = func_80B2E3F8; } -void func_80B2E3F8(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2E3F8(EnPoh* this, PlayState* play) { func_80B2DDF8(this, -13); if (this->unk_197 == 0) { Actor_MarkForDeath(&this->actor); } } -void func_80B2E438(EnPoh* this, GlobalContext* globalCtx) { +void func_80B2E438(EnPoh* this, PlayState* play) { if (this->colliderCylinder.base.acFlags & AC_HIT) { this->colliderCylinder.base.acFlags &= ~AC_HIT; if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); } else if (this->actor.colChkInfo.damage != 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); @@ -709,8 +708,7 @@ void func_80B2E438(EnPoh* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect == 4) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.45f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->colliderCylinder.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderCylinder.info.bumper.hitPos.x, this->colliderCylinder.info.bumper.hitPos.y, this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } @@ -796,8 +794,8 @@ void func_80B2E8E0(EnPoh* this) { } } -void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnPoh_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnPoh* this = THIS; s32 pad; @@ -806,22 +804,22 @@ void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx2) { func_80B2D5DC(this); } - func_80B2E438(this, globalCtx); + func_80B2E438(this, play); func_80B2E55C(this); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); if ((this->actionFunc == func_80B2CF28) && (this->unk_18E < 10)) { this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); } Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); if (this->colliderCylinder.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSph.base); Actor_SetFocus(&this->actor, 42.0f); if ((this->actionFunc != func_80B2D07C) && (this->actionFunc != func_80B2D628)) { @@ -847,7 +845,7 @@ void EnPoh_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnPoh* this = THIS; @@ -863,7 +861,7 @@ s32 EnPoh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static s8 D_80B2F71C[] = { -1, -1, -1, -1, 4, 5, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, 2, -1, -1, 3, -1, }; @@ -879,7 +877,7 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Collider_UpdateSpheres(limbIndex, &this->colliderSph); if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2) && (limbIndex == 5)) { - gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, object_po_DL_002608); } @@ -889,7 +887,7 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve MTXMODE_APPLY); } Matrix_Get(&this->unk_3D8); - func_80B2C910(&sp60, globalCtx); + func_80B2C910(&sp60, play); Lights_PointGlowSetInfo(&this->lightInfo, this->colliderSph.elements[0].dim.worldSphere.center.x + (s32)sp60.x, this->colliderSph.elements[0].dim.worldSphere.center.y + (s32)sp60.y, this->colliderSph.elements[0].dim.worldSphere.center.z + (s32)sp60.z, this->unk_198, @@ -917,11 +915,11 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPoh_Draw(Actor* thisx, PlayState* play) { EnPoh* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); func_80B2E6C0(this); if ((this->unk_197 == 255) || (this->unk_197 == 0)) { @@ -931,7 +929,7 @@ void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(&gfx[1], this->unk_194, this->unk_195, this->unk_196, this->unk_197); gSPSegment(&gfx[2], 0x08, D_801AEFA0); - gfx = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, + gfx = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoh_OverrideLimbDraw, EnPoh_PostLimbDraw, &this->actor, &gfx[3]); POLY_OPA_DISP = gfx; @@ -942,7 +940,7 @@ void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(&gfx[1], 255, 255, 255, this->unk_197); gSPSegment(&gfx[2], 0x08, D_801AEF88); - 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, &gfx[3]); gfx = POLY_OPA_DISP; @@ -954,21 +952,21 @@ void EnPoh_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Put(&this->unk_3D8); - gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[3], object_po_DL_002D28); POLY_OPA_DISP = &gfx[4]; - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->actor.scale.x * 100.0f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B2F328(Actor* thisx, GlobalContext* globalCtx) { +void func_80B2F328(Actor* thisx, PlayState* play) { EnPoh* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_80B2DD2C) { this->unk_190++; } @@ -976,13 +974,13 @@ void func_80B2F328(Actor* thisx, GlobalContext* globalCtx) { func_80B2E8E0(this); } -void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B2F37C(Actor* thisx, PlayState* play) { EnPoh* this = THIS; s32 pad; Vec3f sp7C; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == func_80B2DD2C) { gfx = POLY_OPA_DISP; @@ -990,28 +988,28 @@ void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); gDPSetEnvColor(&gfx[1], this->unk_198, this->unk_199, this->unk_19A, 255); - func_80B2C910(&sp7C, globalCtx); + func_80B2C910(&sp7C, play); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.world.pos.x + sp7C.x, this->actor.world.pos.y + sp7C.y, this->actor.world.pos.z + sp7C.z, this->unk_198, this->unk_199, this->unk_19A, 200); - gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[3], object_po_DL_002D28); POLY_OPA_DISP = &gfx[4]; } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_190 * -8) & 0x1FF, - 0x20, 0x80)); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_190 * -8) & 0x1FF, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197); gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255); - Matrix_RotateYF((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); + Matrix_RotateYF((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_po_DL_003850); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 f4787b3577..fc0e7db74b 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -5,7 +5,7 @@ struct EnPoh; -typedef void (*EnPohActionFunc)(struct EnPoh*, GlobalContext*); +typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); typedef struct EnPoh { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index 67f9512997..bd94fbc4aa 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -10,10 +10,10 @@ #define THIS ((EnPp*)thisx) -void EnPp_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPp_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPp_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPp_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPp_Init(Actor* thisx, PlayState* play); +void EnPp_Destroy(Actor* thisx, PlayState* play); +void EnPp_Update(Actor* thisx, PlayState* play); +void EnPp_Draw(Actor* thisx, PlayState* play); #if 0 // static DamageTable sDamageTable = { diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 7a5bf2c337..bf70acb8d7 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -5,7 +5,7 @@ struct EnPp; -typedef void (*EnPpActionFunc)(struct EnPp*, GlobalContext*); +typedef void (*EnPpActionFunc)(struct EnPp*, PlayState*); typedef struct EnPp { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 8f3a30d752..d2fd48ad39 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -12,24 +12,24 @@ #define THIS ((EnPr*)thisx) -void EnPr_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPr_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPr_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPr_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPr_Init(Actor* thisx, PlayState* play); +void EnPr_Destroy(Actor* thisx, PlayState* play); +void EnPr_Update(Actor* thisx, PlayState* play); +void EnPr_Draw(Actor* thisx, PlayState* play); void func_80A326F0(EnPr* this); -void func_80A32740(EnPr* this, GlobalContext* globalCtx); +void func_80A32740(EnPr* this, PlayState* play); void func_80A32854(EnPr* this); -void func_80A3289C(EnPr* this, GlobalContext* globalCtx); +void func_80A3289C(EnPr* this, PlayState* play); void func_80A3295C(EnPr* this); -void func_80A32984(EnPr* this, GlobalContext* globalCtx); -void func_80A32A40(EnPr* this, GlobalContext* globalCtx); +void func_80A32984(EnPr* this, PlayState* play); +void func_80A32A40(EnPr* this, PlayState* play); void func_80A32AF8(EnPr* this); -void func_80A32B20(EnPr* this, GlobalContext* globalCtx); +void func_80A32B20(EnPr* this, PlayState* play); void func_80A32CDC(EnPr* this); -void func_80A32D28(EnPr* this, GlobalContext* globalCtx); -void func_80A32EA4(EnPr* this, GlobalContext* globalCtx); -void func_80A32F48(EnPr* this, GlobalContext* globalCtx); +void func_80A32D28(EnPr* this, PlayState* play); +void func_80A32EA4(EnPr* this, PlayState* play); +void func_80A32F48(EnPr* this, PlayState* play); static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), @@ -109,8 +109,8 @@ u8 D_80A33934[] = { 0, 2, 0, 0, 2, }; -void EnPr_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnPr_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnPr* this = THIS; EnPrz* prz; s32 i; @@ -120,7 +120,7 @@ void EnPr_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.mass = 50; this->actor.hintId = 0x5C; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_208 = 255; this->unk_2CC = 0.01f; @@ -132,7 +132,7 @@ void EnPr_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.yOffset = 1500.0f; this->actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_pr_Skel_0038B8, &object_pr_Anim_0021E8, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_0038B8, &object_pr_Anim_0021E8, this->jointTable, this->morphTable, 10); this->unk_2C8 = this->actor.world.rot.z * 20.0f; @@ -151,9 +151,9 @@ void EnPr_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2F8 = &this->actor; for (i = 0; i < temp_s4; i++) { - prz = (EnPrz*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PRZ, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - this->actor.world.rot.y, 0, i + 1); + prz = (EnPrz*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PRZ, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, + 0, i + 1); if (prz != NULL) { prz->unk_220 = this->unk_2F8; this->unk_2F8 = &prz->actor; @@ -169,10 +169,10 @@ void EnPr_Init(Actor* thisx, GlobalContext* globalCtx2) { func_80A326F0(this); } -void EnPr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPr_Destroy(Actor* thisx, PlayState* play) { EnPr* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80A3242C(EnPr* this, s32 arg0) { @@ -190,19 +190,19 @@ void func_80A3242C(EnPr* this, s32 arg0) { -2.0f); } -s32 func_80A324E0(EnPr* this, GlobalContext* globalCtx) { +s32 func_80A324E0(EnPr* this, PlayState* play) { CollisionPoly* sp54; Vec3f sp48; s32 sp44; WaterBox* sp40; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &this->unk_2E0, &sp48, &sp54, 1, 0, 0, 1, + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_2E0, &sp48, &sp54, 1, 0, 0, 1, &sp44)) { return 1; } - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_2B4, &sp40)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, + &sp40)) { if ((this->unk_2B4 - 30.0f) < this->actor.world.pos.y) { this->unk_2B8 = this->unk_2B4 - 30.0f; return 2; @@ -245,10 +245,10 @@ void func_80A326F0(EnPr* this) { this->actionFunc = func_80A32740; } -void func_80A32740(EnPr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A32740(EnPr* this, PlayState* play) { + Player* player = GET_PLAYER(play); - switch (func_80A324E0(this, globalCtx)) { + switch (func_80A324E0(this, play)) { case 1: func_80A3295C(this); return; @@ -278,7 +278,7 @@ void func_80A32854(EnPr* this) { this->actionFunc = func_80A3289C; } -void func_80A3289C(EnPr* this, GlobalContext* globalCtx) { +void func_80A3289C(EnPr* this, PlayState* play) { this->unk_22C = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); func_80A325E4(this); @@ -295,14 +295,14 @@ void func_80A3295C(EnPr* this) { this->actionFunc = func_80A32984; } -void func_80A32984(EnPr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A32984(EnPr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & 0x8000000) && (this->unk_20E == 0)) { this->unk_22C = this->actor.world.rot.y; func_80A32AF8(this); } else if (!func_80A325E4(this)) { - if (func_80A324E0(this, globalCtx)) { + if (func_80A324E0(this, play)) { this->unk_22C += 0x1000; } else { if (this->unk_21C != 0) { @@ -314,15 +314,15 @@ void func_80A32984(EnPr* this, GlobalContext* globalCtx) { } } -void func_80A32A40(EnPr* this, GlobalContext* globalCtx) { +void func_80A32A40(EnPr* this, PlayState* play) { Vec3f sp34; WaterBox* sp30; Math_Vec3f_Copy(&sp34, &this->actor.world.pos); sp34.y = randPlusMinusPoint5Scaled(50.0f) + this->actor.home.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_2B4, &sp30)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, + &sp30)) { if (sp34.y < (this->unk_2B4 - 30.0f)) { this->unk_2B8 = sp34.y; } else { @@ -340,13 +340,13 @@ void func_80A32AF8(EnPr* this) { this->actionFunc = func_80A32B20; } -void func_80A32B20(EnPr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A32B20(EnPr* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.speedXZ = BREG(57) + 3.0f; Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.save.playerForm] + player->actor.world.pos.y; - func_80A324E0(this, globalCtx); + func_80A324E0(this, play); if (!(player->stateFlags1 & 0x8000000)) { this->skelAnime.playSpeed = 1.0f; @@ -372,8 +372,8 @@ void func_80A32CDC(EnPr* this) { this->actionFunc = func_80A32D28; } -void func_80A32D28(EnPr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A32D28(EnPr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x8000000)) { this->skelAnime.playSpeed = 1.0f; @@ -383,7 +383,7 @@ void func_80A32D28(EnPr* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); func_80A325E4(this); this->unk_2B8 = D_80A338C0[(void)0, gSaveContext.save.playerForm] + player->actor.world.pos.y; - func_80A324E0(this, globalCtx); + func_80A324E0(this, play); if (this->unk_2C8 < sqrtf(SQ(player->actor.world.pos.x - this->actor.home.pos.x) + SQ(player->actor.world.pos.z - this->actor.home.pos.z))) { this->skelAnime.playSpeed = 1.0f; @@ -400,7 +400,7 @@ void func_80A32E60(EnPr* this) { this->actionFunc = func_80A32EA4; } -void func_80A32EA4(EnPr* this, GlobalContext* globalCtx) { +void func_80A32EA4(EnPr* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->unk_2BC <= curFrame) { @@ -409,7 +409,7 @@ void func_80A32EA4(EnPr* this, GlobalContext* globalCtx) { this->unk_20A = 50; this->actor.flags |= ACTOR_FLAG_8000000; this->unk_2C4 = 0.0f; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); this->unk_216 = 0; this->actionFunc = func_80A32F48; @@ -419,7 +419,7 @@ void func_80A32EA4(EnPr* this, GlobalContext* globalCtx) { } } -void func_80A32F48(EnPr* this, GlobalContext* globalCtx) { +void func_80A32F48(EnPr* this, PlayState* play) { WaterBox* sp2C; if (this->unk_208 > 0) { @@ -428,8 +428,8 @@ void func_80A32F48(EnPr* this, GlobalContext* globalCtx) { this->unk_208 = 0; } - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_2B4, &sp2C)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, + &sp2C)) { if ((this->unk_2B4 - 100.0f) < this->actor.world.pos.y) { this->unk_212 += 0xBB8; this->unk_2C4 = 2.0f * Math_SinS(this->unk_212); @@ -450,8 +450,8 @@ void func_80A32F48(EnPr* this, GlobalContext* globalCtx) { } } -void func_80A33098(EnPr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A33098(EnPr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->unk_206 != 7) && (this->unk_206 != 6)) { if (this->collider.base.acFlags & AC_HIT) { @@ -459,8 +459,8 @@ void func_80A33098(EnPr* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect == 4) { this->drawDmgEffAlpha = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, - this->actor.focus.pos.y, this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, + this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } if ((player->stateFlags1 & 0x8000000) && (this->actor.colChkInfo.damageEffect == 5)) { @@ -478,7 +478,7 @@ void func_80A33098(EnPr* this, GlobalContext* globalCtx) { } } -void EnPr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPr_Update(Actor* thisx, PlayState* play) { s32 pad; EnPr* this = THIS; s32 i; @@ -501,10 +501,10 @@ void EnPr_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_210--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 20.0f); - func_80A33098(this, globalCtx); + func_80A33098(this, play); Math_Vec3f_Copy(&this->unk_2E0, &this->actor.world.pos); this->unk_2E0.x += (Math_SinS(this->actor.world.rot.y) * 70.0f); @@ -536,13 +536,13 @@ void EnPr_Update(Actor* thisx, GlobalContext* globalCtx) { } } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 30.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 20.0f, 0x1D); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); if (this->unk_206 != 7) { 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->unk_204 != 0) { Vec3f sp40; @@ -554,13 +554,13 @@ void EnPr_Update(Actor* thisx, GlobalContext* globalCtx) { sp40.z += randPlusMinusPoint5Scaled(20.0f); for (i = 0; i < (s32)Rand_ZeroFloat(5.0f) + 5; i++) { - EffectSsBubble_Spawn(globalCtx, &sp40, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + EffectSsBubble_Spawn(play, &sp40, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } } } } -s32 EnPr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnPr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPr* this = THIS; if (limbIndex == 2) { @@ -569,7 +569,7 @@ s32 EnPr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnPr_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnPr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { Vec3f sp24 = { 0.0f, 0.0f, 0.0f }; EnPr* this = THIS; @@ -588,28 +588,28 @@ void EnPr_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnPr_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPr_Draw(Actor* thisx, PlayState* play) { EnPr* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (this->unk_2D2 == 0) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_208, this->unk_208, this->unk_208, this->unk_2D0); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_2D0); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnPr_OverrideLimbDraw, EnPr_PostLimbDraw, &this->actor); + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPr_OverrideLimbDraw, EnPr_PostLimbDraw, &this->actor); } else { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_2D0); - Scene_SetRenderModeXlu(globalCtx, 1, 2); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + Scene_SetRenderModeXlu(play, 1, 2); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor, POLY_XLU_DISP); } @@ -618,9 +618,9 @@ void EnPr_Draw(Actor* thisx, GlobalContext* globalCtx) { this->unk_238 = 0.8f; this->unk_234 = 0.8f; - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0.8f, 0.8f, drawDmgEffAlpha, this->drawDmgEffType); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.h b/src/overlays/actors/ovl_En_Pr/z_en_pr.h index 18123e1191..4b36fee9c9 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.h +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.h @@ -5,7 +5,7 @@ struct EnPr; -typedef void (*EnPrActionFunc)(struct EnPr*, GlobalContext*); +typedef void (*EnPrActionFunc)(struct EnPr*, PlayState*); #define ENPR_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 7974338921..76fd61744f 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -12,19 +12,19 @@ #define THIS ((EnPr2*)thisx) -void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPr2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPr2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPr2_Init(Actor* thisx, PlayState* play); +void EnPr2_Destroy(Actor* thisx, PlayState* play); +void EnPr2_Update(Actor* thisx, PlayState* play); +void EnPr2_Draw(Actor* thisx, PlayState* play); void func_80A745C4(EnPr2* this); -void func_80A745FC(EnPr2* this, GlobalContext* globalCtx); +void func_80A745FC(EnPr2* this, PlayState* play); void func_80A74888(EnPr2* this); -void func_80A748E8(EnPr2* this, GlobalContext* globalCtx); -void func_80A74DEC(EnPr2* this, GlobalContext* globalCtx); -void func_80A74E90(EnPr2* this, GlobalContext* globalCtx); +void func_80A748E8(EnPr2* this, PlayState* play); +void func_80A74DEC(EnPr2* this, PlayState* play); +void func_80A74E90(EnPr2* this, PlayState* play); void func_80A751B4(EnPr2* this); -void func_80A75310(EnPr2* this, GlobalContext* globalCtx); +void func_80A75310(EnPr2* this, PlayState* play); static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), @@ -105,7 +105,7 @@ s16 D_80A75C3C[] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, }; -void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPr2_Init(Actor* thisx, PlayState* play) { EnPr2* this = THIS; this->actor.targetMode = 3; @@ -114,7 +114,7 @@ void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.health = 1; this->actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, this->morphtable, 5); this->unk_1E0 = ENPR2_GET_F(&this->actor); this->actor.colChkInfo.mass = 10; @@ -129,7 +129,7 @@ void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1E0 < 10) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_218 = -1; this->unk_204 = 0.0f; @@ -152,7 +152,7 @@ void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx) { if (parent->update != NULL) { this->unk_1C8 = ((EnEncount1*)parent)->unk_15A; - this->path = SubS_GetPathByIndex(globalCtx, this->unk_1C8, 0x3F); + this->path = SubS_GetPathByIndex(play, this->unk_1C8, 0x3F); this->unk_208 = parent->world.rot.z * 20.0f; if (this->unk_208 < 20.0f) { this->unk_208 = 20.0f; @@ -171,18 +171,18 @@ void EnPr2_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A751B4(this); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 20.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, 0x1D); if (!(this->actor.bgCheckFlags & 0x60)) { Actor_MarkForDeath(&this->actor); } } -void EnPr2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPr2_Destroy(Actor* thisx, PlayState* play) { EnPr2* this = THIS; if (this->unk_1E0 < 10) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } if (this->actor.parent != NULL) { @@ -194,12 +194,12 @@ void EnPr2_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80A7429C(EnPr2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A7429C(EnPr2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp1A; s16 sp18; - Actor_GetScreenPos(globalCtx, &this->actor, &sp1A, &sp18); + Actor_GetScreenPos(play, &this->actor, &sp1A, &sp18); if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 160.0f) || (this->actor.projectedPos.z < -40.0f) || (sp1A < 0) || (sp1A > 320) || (sp18 < 0) || (sp18 > 240)) { @@ -257,7 +257,7 @@ void func_80A745C4(EnPr2* this) { this->actionFunc = func_80A745FC; } -void func_80A745FC(EnPr2* this, GlobalContext* globalCtx) { +void func_80A745FC(EnPr2* this, PlayState* play) { f32 x; f32 y; f32 z; @@ -316,8 +316,8 @@ void func_80A74888(EnPr2* this) { this->actionFunc = func_80A748E8; } -void func_80A748E8(EnPr2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A748E8(EnPr2* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f12; f32 temp_f2; f32 sqrtXZ; @@ -344,8 +344,8 @@ void func_80A748E8(EnPr2* this, GlobalContext* globalCtx) { case 1: if (this->unk_1DC == 0) { sp4C = true; - func_80A74DEC(this, globalCtx); - } else if (!func_80A7429C(this, globalCtx) && (this->unk_1F4 == 255)) { + func_80A74DEC(this, play); + } else if (!func_80A7429C(this, play) && (this->unk_1F4 == 255)) { this->unk_1F4 = 254; } break; @@ -358,7 +358,7 @@ void func_80A748E8(EnPr2* this, GlobalContext* globalCtx) { if (sp48 && (player->stateFlags1 & 0x8000000) && (sqrtXZ < this->unk_208)) { sp4C = true; - func_80A74DEC(this, globalCtx); + func_80A74DEC(this, play); } } else { temp_f2 = this->actor.world.pos.x - this->unk_228.x; @@ -398,7 +398,7 @@ void func_80A748E8(EnPr2* this, GlobalContext* globalCtx) { sp3C.x += Math_SinS(this->actor.world.rot.y) * 20.0f; sp3C.z += Math_CosS(this->actor.world.rot.y) * 20.0f; if (fabsf(this->actor.world.rot.y - this->unk_1EE) < 100.0f) { - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sp3C, 20.0f) || (this->actor.bgCheckFlags & 8)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &sp3C, 20.0f) || (this->actor.bgCheckFlags & 8)) { this->unk_1DC = 0; this->unk_1F2++; Math_Vec3f_Copy(&this->unk_21C, &this->unk_228); @@ -425,8 +425,8 @@ void func_80A748E8(EnPr2* this, GlobalContext* globalCtx) { } } -void func_80A74DEC(EnPr2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A74DEC(EnPr2* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1F0 = 0; func_80A74510(this, 1); @@ -441,8 +441,8 @@ void func_80A74DEC(EnPr2* this, GlobalContext* globalCtx) { this->actionFunc = func_80A74E90; } -void func_80A74E90(EnPr2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A74E90(EnPr2* this, PlayState* play) { + Player* player = GET_PLAYER(play); WaterBox* sp40; Math_ApproachF(&this->unk_204, 0.02f, 0.1f, 0.005f); @@ -487,14 +487,14 @@ void func_80A74E90(EnPr2* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&this->unk_228, &this->actor.world.pos); } - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_200, &sp40)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_200, + &sp40)) { if ((this->unk_200 - 40.0f) < this->unk_21C.y) { this->unk_21C.y = this->unk_200 - 40.0f; } } - if ((this->unk_1E0 == 1) && !func_80A7429C(this, globalCtx)) { + if ((this->unk_1E0 == 1) && !func_80A7429C(this, play)) { if (this->unk_1F4 == 255) { this->unk_1F4 = 254; } @@ -539,7 +539,7 @@ void func_80A751B4(EnPr2* this) { this->actionFunc = func_80A75310; } -void func_80A75310(EnPr2* this, GlobalContext* globalCtx) { +void func_80A75310(EnPr2* this, PlayState* play) { s32 temp; f32 frame; WaterBox* sp74; @@ -552,7 +552,7 @@ void func_80A75310(EnPr2* this, GlobalContext* globalCtx) { if (this->unk_1F8 <= frame) { for (i = 0; i < ARRAY_COUNT(this->unk_234); i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PR2, this->unk_234[i].x, this->unk_234[i].y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PR2, this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, i + 10); } @@ -572,8 +572,8 @@ void func_80A75310(EnPr2* this, GlobalContext* globalCtx) { this->unk_1D6 = true; } - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_200, &sp74)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_200, + &sp74)) { frame = this->unk_200 - 15.0f; if (frame <= this->actor.world.pos.y) { @@ -597,7 +597,7 @@ void func_80A75310(EnPr2* this, GlobalContext* globalCtx) { sp64.z += randPlusMinusPoint5Scaled(20.0f); frame = Rand_ZeroFloat(0.03f) + 0.07f; - EffectSsBubble_Spawn(globalCtx, &sp64, 0.0f, 5.0f, 5.0f, frame); + EffectSsBubble_Spawn(play, &sp64, 0.0f, 5.0f, 5.0f, frame); } Actor_MarkForDeath(&this->actor); @@ -606,18 +606,18 @@ void func_80A75310(EnPr2* this, GlobalContext* globalCtx) { } } -void func_80A755D8(EnPr2* this, GlobalContext* globalCtx) { +void func_80A755D8(EnPr2* this, PlayState* play) { s32 temp_v0; if (this->collider.base.acFlags & AC_HIT) { Actor_ApplyDamage(&this->actor); if ((this->actor.colChkInfo.health <= 0) && (this->unk_1D4 != 3)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.speedXZ = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_DEAD); if (this->unk_218 >= 0) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, D_80A75C3C[this->unk_218]); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, D_80A75C3C[this->unk_218]); } this->actor.colChkInfo.health = 0; @@ -630,7 +630,7 @@ void func_80A755D8(EnPr2* this, GlobalContext* globalCtx) { } } -void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPr2_Update(Actor* thisx, PlayState* play) { EnPr2* this = THIS; f32 rand; @@ -638,7 +638,7 @@ void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->unk_204); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1DA != 0) { this->unk_1DA--; @@ -657,9 +657,9 @@ void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 10.0f); - func_80A755D8(this, globalCtx); + func_80A755D8(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0, 10.0f, 20.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 0, 10.0f, 20.0f, 0x1F); if (this->unk_1D6) { s32 i; @@ -675,7 +675,7 @@ void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 2; i++) { rand = Rand_ZeroFloat(0.03f) + 0.07f; - EffectSsBubble_Spawn(globalCtx, &sp58, 0, 5.0f, 5.0f, rand); + EffectSsBubble_Spawn(play, &sp58, 0, 5.0f, 5.0f, rand); } } @@ -685,14 +685,14 @@ void EnPr2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = this->actor.world.rot.z; if (this->unk_1D4 != 3) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -s32 func_80A758E8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80A758E8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPr2* this = THIS; if (this->unk_1E0 < 10) { @@ -705,7 +705,7 @@ s32 func_80A758E8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80A75950(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80A75950(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPr2* this = THIS; if (this->unk_1E0 < 10) { @@ -717,8 +717,7 @@ void func_80A75950(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -s32 func_80A759D8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +s32 func_80A759D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnPr2* this = THIS; if (this->unk_1E0 < 10) { @@ -731,30 +730,30 @@ s32 func_80A759D8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnPr2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPr2_Draw(Actor* thisx, PlayState* play) { EnPr2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_1F4 == 255) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1EC, this->unk_1EC, this->unk_1EC, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_1F4); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80A758E8, func_80A75950, &this->actor); + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80A758E8, func_80A75950, &this->actor); } else { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_1F4); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80A759D8, NULL, &this->actor, POLY_XLU_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80A759D8, NULL, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h index 4ae14db77a..3721a98cc4 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h @@ -5,7 +5,7 @@ struct EnPr2; -typedef void (*EnPr2ActionFunc)(struct EnPr2*, GlobalContext*); +typedef void (*EnPr2ActionFunc)(struct EnPr2*, PlayState*); #define ENPR2_GET_F(thisx) ((thisx)->params & 0xF) #define ENPR2_GET_FF0(thisx) (((thisx)->params >> 4) & 0xFF) diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index 99cc24158e..98593e85d6 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -12,18 +12,18 @@ #define THIS ((EnPrz*)thisx) -void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPrz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPrz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPrz_Init(Actor* thisx, PlayState* play); +void EnPrz_Destroy(Actor* thisx, PlayState* play); +void EnPrz_Update(Actor* thisx, PlayState* play); +void EnPrz_Draw(Actor* thisx, PlayState* play); void func_80A76388(EnPrz* this); -void func_80A763E8(EnPrz* this, GlobalContext* globalCtx); -void func_80A76604(EnPrz* this, GlobalContext* globalCtx); -void func_80A76634(EnPrz* this, GlobalContext* globalCtx); +void func_80A763E8(EnPrz* this, PlayState* play); +void func_80A76604(EnPrz* this, PlayState* play); +void func_80A76634(EnPrz* this, PlayState* play); void func_80A76748(EnPrz* this); -void func_80A767A8(EnPrz* this, GlobalContext* globalCtx); -void func_80A76B14(EnPrz* this, GlobalContext* globalCtx); +void func_80A767A8(EnPrz* this, PlayState* play); +void func_80A76B14(EnPrz* this, PlayState* play); static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), @@ -100,7 +100,7 @@ u8 D_80A77248[] = { 0, 0 }; Vec3f D_80A7724C = { 0.0f, 0.0f, 0.0f }; -void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnPrz_Init(Actor* thisx, PlayState* play) { EnPrz* this = THIS; this->unk_20C = 0.01f; @@ -114,7 +114,7 @@ void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 1; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, this->morphTable, 5); this->unk_1E6 = ENPRZ_GET(&this->actor); @@ -122,7 +122,7 @@ void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~ACTOR_FLAG_1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Math_Vec3f_Copy(&this->unk_1D8, &this->actor.world.pos); this->unk_220 = &this->actor; @@ -132,7 +132,7 @@ void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A76388(this); } -void EnPrz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnPrz_Destroy(Actor* thisx, PlayState* play) { } void func_80A75F18(EnPrz* this, s32 arg1) { @@ -141,12 +141,12 @@ void func_80A75F18(EnPrz* this, s32 arg1) { D_80A77248[arg1], -2.0f); } -s32 func_80A75FA4(EnPrz* this, GlobalContext* globalCtx) { +s32 func_80A75FA4(EnPrz* this, PlayState* play) { WaterBox* sp2C; f32 temp_f0; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_210, &sp2C)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_210, + &sp2C)) { temp_f0 = BREG(10) + (this->unk_210 - 10.0f); if (temp_f0 < this->actor.world.pos.y) { this->unk_1D8.y = temp_f0; @@ -163,7 +163,7 @@ s32 func_80A75FA4(EnPrz* this, GlobalContext* globalCtx) { return 0; } -void func_80A76070(EnPrz* this, s16 arg1, GlobalContext* globalCtx) { +void func_80A76070(EnPrz* this, s16 arg1, PlayState* play) { s16 temp_s0 = arg1 - this->actor.world.rot.y; temp_s0 *= 0.01f; @@ -188,7 +188,7 @@ void func_80A76070(EnPrz* this, s16 arg1, GlobalContext* globalCtx) { } Math_SmoothStepToS(&this->actor.world.rot.y, arg1, temp_s0, this->unk_202 + 0x1388, 0); - func_80A75FA4(this, globalCtx); + func_80A75FA4(this, play); Math_ApproachF(&this->actor.world.pos.y, this->unk_1D8.y, 0.5f, 1.0f); temp_s0 = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_1D8) * 0.5f; @@ -199,7 +199,7 @@ void func_80A76070(EnPrz* this, s16 arg1, GlobalContext* globalCtx) { } } -s32 func_80A762C0(EnPrz* this, GlobalContext* globalCtx) { +s32 func_80A762C0(EnPrz* this, PlayState* play) { CollisionPoly* sp54; Vec3f sp48; s32 sp44; @@ -210,8 +210,8 @@ s32 func_80A762C0(EnPrz* this, GlobalContext* globalCtx) { sp38.x += Math_SinS(this->actor.world.rot.y) * 40.0f; sp38.z += Math_CosS(this->actor.world.rot.y) * 40.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp38, &sp48, &sp54, true, false, false, - true, &sp44)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp38, &sp48, &sp54, true, false, false, true, + &sp44)) { return true; } return false; @@ -224,9 +224,9 @@ void func_80A76388(EnPrz* this) { this->actionFunc = func_80A763E8; } -void func_80A763E8(EnPrz* this, GlobalContext* globalCtx) { +void func_80A763E8(EnPrz* this, PlayState* play) { Actor* sp3C = this->actor.parent; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 yaw; s32 pad; @@ -239,8 +239,8 @@ void func_80A763E8(EnPrz* this, GlobalContext* globalCtx) { return; } - if (func_80A762C0(this, globalCtx)) { - func_80A76604(this, globalCtx); + if (func_80A762C0(this, play)) { + func_80A76604(this, play); return; } @@ -272,23 +272,23 @@ void func_80A763E8(EnPrz* this, GlobalContext* globalCtx) { } yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8); - func_80A76070(this, yaw, globalCtx); + func_80A76070(this, yaw, play); } -void func_80A76604(EnPrz* this, GlobalContext* globalCtx) { +void func_80A76604(EnPrz* this, PlayState* play) { this->unk_1EE = 0; this->unk_1E4 = BINANG_ADD(this->actor.world.rot.y, 0x4000); this->unk_1EA = 2; this->actionFunc = func_80A76634; } -void func_80A76634(EnPrz* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A76634(EnPrz* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_80A76070(this, this->unk_1E4, globalCtx); + func_80A76070(this, this->unk_1E4, play); if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, this->unk_1E4)) < 0x100) { - if (func_80A762C0(this, globalCtx) != 0) { + if (func_80A762C0(this, play) != 0) { this->unk_1E4 += 0x1500; this->unk_1E4 += (s16)Rand_ZeroFloat(5000.0f); } else if ((player->stateFlags1 & 0x8000000) && (player->actor.floorHeight < 30.0f)) { @@ -309,16 +309,16 @@ void func_80A76748(EnPrz* this) { this->actionFunc = func_80A767A8; } -void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A767A8(EnPrz* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnPr* pr = (EnPr*)this->actor.parent; f32 distXZ; s32 pad[2]; - if (func_80A762C0(this, globalCtx)) { + if (func_80A762C0(this, play)) { func_80A75F18(this, 0); this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 4.0f; - func_80A76604(this, globalCtx); + func_80A76604(this, play); return; } @@ -355,7 +355,7 @@ void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) { this->unk_1D8.y = (player->actor.world.pos.y + D_80A771E0[((void)0, gSaveContext.save.playerForm)]) + randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f); - func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), globalCtx); + func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), play); } void func_80A76A1C(EnPrz* this) { @@ -383,7 +383,7 @@ void func_80A76A1C(EnPrz* this) { this->actionFunc = func_80A76B14; } -void func_80A76B14(EnPrz* this, GlobalContext* globalCtx) { +void func_80A76B14(EnPrz* this, PlayState* play) { WaterBox* sp7C; s32 i; Vec3f sp6C; @@ -393,8 +393,8 @@ void func_80A76B14(EnPrz* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, this->unk_1FC, 5, 0x2710, 0x3E8); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_1FE, 5, 0x2710, 0x3E8); - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_210, &sp7C)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_210, + &sp7C)) { if ((this->unk_210 - 15.0f) <= this->actor.world.pos.y) { phi_s0 = true; } else { @@ -413,14 +413,14 @@ void func_80A76B14(EnPrz* this, GlobalContext* globalCtx) { sp6C.y += randPlusMinusPoint5Scaled(5.0f); sp6C.z += randPlusMinusPoint5Scaled(20.0f); - EffectSsBubble_Spawn(globalCtx, &sp6C, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + EffectSsBubble_Spawn(play, &sp6C, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } Actor_MarkForDeath(&this->actor); } } } -void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnPrz_Update(Actor* thisx, PlayState* play) { s32 pad; EnPrz* this = THIS; s32 sp44 = false; @@ -430,7 +430,7 @@ void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1EE != 0) { this->unk_1EE--; @@ -441,7 +441,7 @@ void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 10.0f, 10.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 10.0f, 0x1D); if (this->unk_1EA != 7) { Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); @@ -464,8 +464,8 @@ void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { } 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); if (this->unk_1C8 != 0) { Math_Vec3f_Copy(&sp38, &this->unk_1CC); @@ -475,12 +475,12 @@ void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { sp38.y += randPlusMinusPoint5Scaled(5.0f); sp38.z += randPlusMinusPoint5Scaled(20.0f); - EffectSsBubble_Spawn(globalCtx, &sp38, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + EffectSsBubble_Spawn(play, &sp38, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } } } -s32 func_80A76F70(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80A76F70(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPrz* this = THIS; if (limbIndex == 2) { @@ -489,7 +489,7 @@ s32 func_80A76F70(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80A76FCC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80A76FCC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { Vec3f sp1C = D_80A7724C; EnPrz* this = THIS; @@ -499,29 +499,29 @@ void func_80A76FCC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnPrz_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnPrz_Draw(Actor* thisx, PlayState* play) { EnPrz* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_1EC == 255) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1E8, this->unk_1E8, this->unk_1E8, this->unk_1EC); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_1EC); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80A76F70, func_80A76FCC, &this->actor); + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80A76F70, func_80A76FCC, &this->actor); } else { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_1EC); - Scene_SetRenderModeXlu(globalCtx, 1, 2); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + Scene_SetRenderModeXlu(play, 1, 2); + POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor, POLY_XLU_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.h b/src/overlays/actors/ovl_En_Prz/z_en_prz.h index 28f8152a83..3d9e740d12 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.h +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.h @@ -5,7 +5,7 @@ struct EnPrz; -typedef void (*EnPrzActionFunc)(struct EnPrz*, GlobalContext*); +typedef void (*EnPrzActionFunc)(struct EnPrz*, PlayState*); #define ENPRZ_GET(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index 02a9ea7437..e26ac6bede 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -10,13 +10,13 @@ #define THIS ((EnPst*)thisx) -void EnPst_Init(Actor* thisx, GlobalContext* globalCtx); -void EnPst_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnPst_Update(Actor* thisx, GlobalContext* globalCtx); -void EnPst_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnPst_Init(Actor* thisx, PlayState* play); +void EnPst_Destroy(Actor* thisx, PlayState* play); +void EnPst_Update(Actor* thisx, PlayState* play); +void EnPst_Draw(Actor* thisx, PlayState* play); -void func_80B2BD98(EnPst* this, GlobalContext* globalCtx); -void func_80B2BE54(EnPst* this, GlobalContext* globalCtx); +void func_80B2BD98(EnPst* this, PlayState* play); +void func_80B2BE54(EnPst* this, PlayState* play); #if 0 const ActorInit En_Pst_InitVars = { diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.h b/src/overlays/actors/ovl_En_Pst/z_en_pst.h index 4a4fdd6476..cba584667c 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.h +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.h @@ -5,7 +5,7 @@ struct EnPst; -typedef void (*EnPstActionFunc)(struct EnPst*, GlobalContext*); +typedef void (*EnPstActionFunc)(struct EnPst*, PlayState*); typedef struct EnPst { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index cf6b1d63f4..7b7d7a76bb 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -15,13 +15,13 @@ #define THIS ((EnRacedog*)thisx) -void EnRacedog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRacedog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRacedog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRacedog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRacedog_Init(Actor* thisx, PlayState* play); +void EnRacedog_Destroy(Actor* thisx, PlayState* play); +void EnRacedog_Update(Actor* thisx, PlayState* play); +void EnRacedog_Draw(Actor* thisx, PlayState* play); -void EnRacedog_RaceStart(EnRacedog* this, GlobalContext* globalCtx); -void EnRacedog_Race(EnRacedog* this, GlobalContext* globalCtx); +void EnRacedog_RaceStart(EnRacedog* this, PlayState* play); +void EnRacedog_Race(EnRacedog* this, PlayState* play); void EnRacedog_UpdateTextId(EnRacedog* this); void EnRacedog_UpdateSpeed(EnRacedog* this); void EnRacedog_CalculateFinalStretchTargetSpeed(EnRacedog* this); @@ -29,7 +29,7 @@ void EnRacedog_UpdateRaceVariables(EnRacedog* this); void EnRacedog_CheckForFinish(EnRacedog* this); void EnRacedog_UpdateRunAnimationPlaySpeed(EnRacedog* this); s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* arg1); -void EnRacedog_SpawnFloorDustRing(EnRacedog* this, GlobalContext* globalCtx); +void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play); void EnRacedog_PlayWalkSfx(EnRacedog* this); /** @@ -241,12 +241,12 @@ void EnRacedog_ChangeAnimation(SkelAnime* skelAnime, AnimationInfoS* animationIn animationInfo->startFrame, frameCount, animationInfo->mode, animationInfo->morphFrames); } -void EnRacedog_UpdateCollision(EnRacedog* this, GlobalContext* globalCtx) { +void EnRacedog_UpdateCollision(EnRacedog* this, PlayState* play) { 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; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } /** @@ -290,18 +290,18 @@ void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) { } } -void EnRacedog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRacedog_Init(Actor* thisx, PlayState* play) { EnRacedog* this = THIS; ColliderCylinder* collider = &this->collider; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, DOG_LIMB_MAX); - Collider_InitCylinder(globalCtx, collider); - Collider_SetCylinder(globalCtx, collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, NULL, this->jointTable, this->morphTable, DOG_LIMB_MAX); + Collider_InitCylinder(play, collider); + Collider_SetCylinder(play, collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); - this->path = SubS_GetPathByIndex(globalCtx, ENRACEDOG_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENRACEDOG_GET_PATH(&this->actor), 0x3F); Actor_SetScale(&this->actor, 0.0075f); this->actor.gravity = -3.0f; if (ENRACEDOG_GET_INDEX(&this->actor) < 14) { @@ -348,17 +348,17 @@ void EnRacedog_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnRacedog_RaceStart; } -void EnRacedog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRacedog_Destroy(Actor* thisx, PlayState* play) { EnRacedog* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * This function makes the dog wait at the starting line until the race actually begins. * It's also responsible for playing the starting shot sound once the race begins. */ -void EnRacedog_RaceStart(EnRacedog* this, GlobalContext* globalCtx) { +void EnRacedog_RaceStart(EnRacedog* this, PlayState* play) { if (DECR(this->raceStartTimer) == 0) { this->raceStartTimer = Rand_S16Offset(50, 50); if (this->extraTimeBeforeRaceStart == 0) { @@ -373,7 +373,7 @@ void EnRacedog_RaceStart(EnRacedog* this, GlobalContext* globalCtx) { /** * This function handles the dog's behavior and state for the entire time the race is going. */ -void EnRacedog_Race(EnRacedog* this, GlobalContext* globalCtx) { +void EnRacedog_Race(EnRacedog* this, PlayState* play) { s16 yRotation; f32 distSq; @@ -410,7 +410,7 @@ void EnRacedog_Race(EnRacedog* this, GlobalContext* globalCtx) { EnRacedog_UpdateRunAnimationPlaySpeed(this); EnRacedog_PlayWalkSfx(this); - EnRacedog_SpawnFloorDustRing(this, globalCtx); + EnRacedog_SpawnFloorDustRing(this, play); } /** @@ -637,7 +637,7 @@ s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* finishLineCoordinates) { return true; } -void EnRacedog_SpawnFloorDustRing(EnRacedog* this, GlobalContext* globalCtx) { +void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; Vec3f pos; @@ -646,7 +646,7 @@ void EnRacedog_SpawnFloorDustRing(EnRacedog* this, GlobalContext* globalCtx) { pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f); pos.y = this->actor.world.pos.y; pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f); - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true); + Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true); } } @@ -658,16 +658,16 @@ void EnRacedog_PlayWalkSfx(EnRacedog* this) { } } -void EnRacedog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRacedog_Update(Actor* thisx, PlayState* play) { s32 pad; EnRacedog* this = THIS; Vec3f floorRot = { 0.0f, 0.0f, 0.0f }; this->selectedDogIndex = sSelectedDogInfo.index; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnRacedog_UpdateCollision(this, globalCtx); + EnRacedog_UpdateCollision(this, play); EnRacedog_GetFloorRot(this, &floorRot); Math_ApproachF(&this->curRot.x, floorRot.x, 0.2f, 0.1f); @@ -704,14 +704,14 @@ void EnRacedog_UpdateSelectionArrow(EnRacedog* this) { } } -void EnRacedog_DrawSelectionArrow(EnRacedog* this, GlobalContext* globalCtx) { +void EnRacedog_DrawSelectionArrow(EnRacedog* this, PlayState* play) { Vec3s rotation = gZeroVec3s; s32 shouldDrawSelectionArrow = (this->index == this->selectedDogIndex) ? true : false; if (shouldDrawSelectionArrow) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); EnRacedog_UpdateSelectionArrow(this); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, &rotation); @@ -721,20 +721,19 @@ void EnRacedog_DrawSelectionArrow(EnRacedog* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_OPA_DISP++, 255, this->selectionArrowGreenEnvColor, 0, 255); Matrix_Scale(this->selectionArrowScale * 2.0f, this->selectionArrowScale * 2.0f, this->selectionArrowScale * 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDogSelectionArrowEmptyDL); gSPDisplayList(POLY_OPA_DISP++, gDogSelectionArrowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -s32 EnRacedog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnRacedog_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnRacedog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnRacedog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnRacedog* this = THIS; Vec3f focusOffset = { 0.0f, 20.0f, 0.0f }; @@ -744,16 +743,16 @@ void EnRacedog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } if (limbIndex == DOG_LIMB_TAIL) { - EnRacedog_DrawSelectionArrow(this, globalCtx); + EnRacedog_DrawSelectionArrow(this, play); } } -void EnRacedog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRacedog_Draw(Actor* thisx, PlayState* play) { EnRacedog* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); @@ -792,8 +791,8 @@ void EnRacedog_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRacedog_OverrideLimbDraw, EnRacedog_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h index a4406b04cd..b0b40be64a 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h @@ -20,7 +20,7 @@ typedef enum { struct EnRacedog; -typedef void (*EnRacedogActionFunc)(struct EnRacedog*, GlobalContext*); +typedef void (*EnRacedogActionFunc)(struct EnRacedog*, PlayState*); typedef struct EnRacedog { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index 225feec706..edd4079218 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -10,29 +10,29 @@ #define THIS ((EnRaf*)thisx) -void EnRaf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRaf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRaf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRaf_Init(Actor* thisx, PlayState* play); +void EnRaf_Destroy(Actor* thisx, PlayState* play); +void EnRaf_Update(Actor* thisx, PlayState* play); +void EnRaf_Draw(Actor* thisx, PlayState* play); void EnRaf_SetupIdle(EnRaf* this); -void EnRaf_Idle(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_Idle(EnRaf* this, PlayState* play); void EnRaf_SetupGrab(EnRaf* this); -void EnRaf_Grab(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_Grab(EnRaf* this, PlayState* play); void EnRaf_SetupChew(EnRaf* this); -void EnRaf_Chew(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_SetupThrow(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_Throw(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_PostDetonation(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_Convulse(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_Chew(EnRaf* this, PlayState* play); +void EnRaf_SetupThrow(EnRaf* this, PlayState* play); +void EnRaf_Throw(EnRaf* this, PlayState* play); +void EnRaf_Explode(EnRaf* this, PlayState* play); +void EnRaf_PostDetonation(EnRaf* this, PlayState* play); +void EnRaf_Convulse(EnRaf* this, PlayState* play); void EnRaf_SetupDissolve(EnRaf* this); -void EnRaf_Dissolve(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_Dissolve(EnRaf* this, PlayState* play); void EnRaf_SetupDormant(EnRaf* this); -void EnRaf_Dormant(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_Dormant(EnRaf* this, PlayState* play); void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer); -void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_DrawEffects(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_UpdateEffects(EnRaf* this, PlayState* play); +void EnRaf_DrawEffects(EnRaf* this, PlayState* play); typedef enum { /* 0 */ EN_RAF_ANIMATION_IDLE, @@ -198,7 +198,7 @@ void EnRaf_ClearPixelPetal(u16* texture, u8* clearPixelTable, s32 index) { } } -void EnRaf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRaf_Init(Actor* thisx, PlayState* play) { EnRaf* this = THIS; Vec3f limbScale = { 1.0f, 1.0f, 1.0f }; s32 pad; @@ -207,12 +207,12 @@ void EnRaf_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gCarnivorousLilyPadCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.targetMode = 3; this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCarnivorousLilyPadSkel, &gCarnivorousLilyPadSpitAnim, - this->jointTable, this->morphTable, CARNIVOROUS_LILY_PAD_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gCarnivorousLilyPadSkel, &gCarnivorousLilyPadSpitAnim, this->jointTable, + this->morphTable, CARNIVOROUS_LILY_PAD_LIMB_MAX); for (i = 0; i < ARRAY_COUNT(this->limbScale); i++) { Math_Vec3f_Copy(&this->targetLimbScale[i], &limbScale); @@ -236,7 +236,7 @@ void EnRaf_Init(Actor* thisx, GlobalContext* globalCtx) { if (((this->switchFlag >= 0) || (this->mainType == EN_RAF_TYPE_DORMANT) || (gSaveContext.save.weekEventReg[12] & 1)) && - ((Flags_GetSwitch(globalCtx, this->switchFlag)) || (this->mainType == EN_RAF_TYPE_DORMANT))) { + ((Flags_GetSwitch(play, this->switchFlag)) || (this->mainType == EN_RAF_TYPE_DORMANT))) { s32 i; for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; @@ -253,11 +253,11 @@ void EnRaf_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRaf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRaf_Destroy(Actor* thisx, PlayState* play) { EnRaf* this = THIS; - 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 EnRaf_ChangeAnimation(EnRaf* this, s32 index) { @@ -300,8 +300,8 @@ void EnRaf_SetupIdle(EnRaf* this) { /** * Sits around waiting for the player or an explosive to get near in order to grab them. */ -void EnRaf_Idle(EnRaf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRaf_Idle(EnRaf* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* explosive; f32 xDiff; f32 yDiff; @@ -311,7 +311,7 @@ void EnRaf_Idle(EnRaf* this, GlobalContext* globalCtx) { if ((player->transformation != PLAYER_FORM_DEKU) && (this->dyna.actor.xzDistToPlayer < (BREG(48) + 80.0f) && (player->invincibilityTimer == 0) && DynaPolyActor_IsInRidingMovingState(&this->dyna) && !(player->stateFlags1 & 0x8000000) && - globalCtx->grabPlayer(globalCtx, player))) { + play->grabPlayer(play, player))) { player->actor.parent = &this->dyna.actor; this->grabTarget = EN_RAF_GRAB_TARGET_PLAYER; @@ -326,11 +326,11 @@ void EnRaf_Idle(EnRaf* this, GlobalContext* globalCtx) { return; } - if ((globalCtx->gameplayFrames % 2) == 0) { + if ((play->gameplayFrames % 2) == 0) { return; } - explosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { // This check is pointless, since EnRaf is never in the explosive category. if ((EnRaf*)explosive == this) { @@ -368,8 +368,8 @@ void EnRaf_SetupGrab(EnRaf* this) { /** * Grabs the player or explosive that entered its range. */ -void EnRaf_Grab(EnRaf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRaf_Grab(EnRaf* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; if ((this->grabTarget != EN_RAF_GRAB_TARGET_EXPLOSIVE) && (player->stateFlags2 & 0x80) && @@ -405,10 +405,10 @@ void EnRaf_SetupChew(EnRaf* this) { * damage to them and eventually throw them. If it grabbed a Goron player or explosive, it will * instead explode after chewing them a bit. */ -void EnRaf_Chew(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_Chew(EnRaf* this, PlayState* play) { f32 targetChewScale; f32 curFrame; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); curFrame = this->skelAnime.curFrame; targetChewScale = (BREG(51) / 100.0f) + 0.2f; @@ -429,12 +429,12 @@ void EnRaf_Chew(EnRaf* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_EAT); switch (this->grabTarget) { case EN_RAF_GRAB_TARGET_PLAYER: - globalCtx->damagePlayer(globalCtx, -2); + play->damagePlayer(play, -2); func_800B8E58((Player*)this, player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S); - CollisionCheck_GreenBlood(globalCtx, NULL, &player->actor.world.pos); + CollisionCheck_GreenBlood(play, NULL, &player->actor.world.pos); if ((this->chewCount > (BREG(53) + 5)) || !(player->stateFlags2 & 0x80)) { player->actor.freezeTimer = 10; - EnRaf_SetupThrow(this, globalCtx); + EnRaf_SetupThrow(this, play); return; } break; @@ -442,7 +442,7 @@ void EnRaf_Chew(EnRaf* this, GlobalContext* globalCtx) { case EN_RAF_GRAB_TARGET_EXPLOSIVE: Actor_ApplyDamage(&this->dyna.actor); if (this->chewCount > (BREG(54) + 4)) { - EnRaf_Explode(this, globalCtx); + EnRaf_Explode(this, play); return; } break; @@ -451,15 +451,15 @@ void EnRaf_Chew(EnRaf* this, GlobalContext* globalCtx) { if (this->chewCount > (BREG(54) + 4)) { player->actor.parent = NULL; player->unk_AE8 = 1000; - EnRaf_Explode(this, globalCtx); + EnRaf_Explode(this, play); } break; } } } -void EnRaf_SetupThrow(EnRaf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRaf_SetupThrow(EnRaf* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_SPIT); player->actor.freezeTimer = 10; @@ -471,16 +471,16 @@ void EnRaf_SetupThrow(EnRaf* this, GlobalContext* globalCtx) { /** * Spits out the grabbed player. */ -void EnRaf_Throw(EnRaf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRaf_Throw(EnRaf* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; if (Animation_OnFrame(&this->skelAnime, 10.0f)) { player->actor.freezeTimer = 0; player->actor.parent = NULL; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_THROW); - func_800B8D50(globalCtx, &this->dyna.actor, BREG(55) + 3.0f, this->playerRotYWhenGrabbed + 0x8000, - BREG(56) + 10.0f, 0); + func_800B8D50(play, &this->dyna.actor, BREG(55) + 3.0f, this->playerRotYWhenGrabbed + 0x8000, BREG(56) + 10.0f, + 0); } else if (curFrame < 10.0f) { player->actor.freezeTimer = 10; } @@ -496,7 +496,7 @@ void EnRaf_Throw(EnRaf* this, GlobalContext* globalCtx) { /** * Creates an explosion effect/sound and spawns effects. */ -void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_Explode(EnRaf* this, PlayState* play) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f explosionPos; @@ -506,12 +506,12 @@ void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { this->action = EN_RAF_ACTION_EXPLODE; Math_Vec3f_Copy(&explosionPos, &this->dyna.actor.world.pos); explosionPos.y += 10.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, - 0, 0, CLEAR_TAG_SMALL_EXPLOSION); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, 0, 0, + CLEAR_TAG_SMALL_EXPLOSION); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_DEAD); if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; @@ -532,7 +532,7 @@ void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { this->timer = 5; if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, 5); + func_800BC154(play, &play->actorCtx, &this->dyna.actor, 5); this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); } @@ -542,17 +542,17 @@ void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { /** * Switches the lily pad to the "dead" state once the timer reaches 0. */ -void EnRaf_PostDetonation(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_PostDetonation(EnRaf* this, PlayState* play) { if (this->timer == 0) { this->collider.dim.radius = 50; this->collider.dim.height = 10; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, 6); + func_800BC154(play, &play->actorCtx, &this->dyna.actor, 6); this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); EnRaf_SetupDormant(this); } else if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { this->collider.dim.radius = 80; this->collider.dim.height = 50; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -568,14 +568,14 @@ void EnRaf_SetupConvulse(EnRaf* this) { * ever coming back to life. When the water in Woodfall Temple is purified, this function * and EnRaf_Dissolve are jointly responsible for controlling the lily pad's death. */ -void EnRaf_Convulse(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_Convulse(EnRaf* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->endFrame <= curFrame) { this->chewCount++; if (this->chewCount > (BREG(2) + 2)) { if (this->switchFlag >= 0) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } EnRaf_SetupDissolve(this); @@ -595,7 +595,7 @@ void EnRaf_SetupDissolve(EnRaf* this) { * When the water in Woodfall Temple is purified, this function and EnRaf_Convulse are jointly * responsible for controlling the lily pad's death. */ -void EnRaf_Dissolve(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_Dissolve(EnRaf* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; s32 i; @@ -659,7 +659,7 @@ void EnRaf_SetupDormant(EnRaf* this) { * Simply sits around doing nothing. If the revive timer is non-zero, then this function * will decrement the revive timer and revive the trap petals once it reaches 0. */ -void EnRaf_Dormant(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_Dormant(EnRaf* this, PlayState* play) { Vec3f targetLimbScale = { 1.0f, 1.0f, 1.0f }; s32 i; @@ -687,7 +687,7 @@ void EnRaf_Dormant(EnRaf* this, GlobalContext* globalCtx) { } } -void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRaf_Update(Actor* thisx, PlayState* play) { s32 pad; EnRaf* this = THIS; WaterBox* waterBox; @@ -698,7 +698,7 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); DECR(this->rippleTimer); DECR(this->timer); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->action == EN_RAF_ACTION_IDLE) && (gSaveContext.save.weekEventReg[12] & 1)) { this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; @@ -720,8 +720,8 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { this->bobOffset = 2.0f * Math_SinS(this->bobPhase); if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) { ySurface = BREG(60) + (this->dyna.actor.world.pos.y - 60.0f); - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.z, &ySurface, &waterBox)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, + &ySurface, &waterBox)) { ySurface -= this->bobOffset + BREG(59); Math_ApproachF(&this->dyna.actor.world.pos.y, this->heightDiffFromPlayer + ySurface, 0.5f, 40.0f); if (this->rippleTimer == 0) { @@ -732,7 +732,7 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&ripplePos, &this->dyna.actor.world.pos); ripplePos.y = ySurface; - EffectSsGRipple_Spawn(globalCtx, &ripplePos, 650, 3150, 0); + EffectSsGRipple_Spawn(play, &ripplePos, 650, 3150, 0); } } } else { @@ -742,7 +742,7 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->heightDiffFromPlayer, 0.3f, 2.0f); if (this->action == EN_RAF_ACTION_EXPLODE) { - EnRaf_UpdateEffects(this, globalCtx); + EnRaf_UpdateEffects(this, play); } for (i = 0; i < ARRAY_COUNT(this->limbScale); i++) { @@ -759,7 +759,7 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); if (this->action < EN_RAF_ACTION_EXPLODE) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -787,8 +787,8 @@ static Vec3f sUpperSegmentTargetScaleDuringSpit[] = { { 1.5f, 1.5f, 1.7f }, { 1.5f, 1.5f, 1.3f }, { 3.0f, 1.0f, 0.5f }, { 1.0f, 1.0f, 0.5f }, { 1.0f, 1.0f, 1.0f }, }; -void EnRaf_TransformLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Actor* thisx) { - GlobalContext* globalCtx = globalCtx2; +void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) { + PlayState* play = play2; EnRaf* this = THIS; s32 i; @@ -829,13 +829,13 @@ void EnRaf_TransformLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Actor* th // These matrix operations make the trap petals look a bit more "wobbly" as it chews // by stretching the limbs in various random directions. if ((limbIndex > CARNIVOROUS_LILY_PAD_LIMB_FLOWER) && (limbIndex < CARNIVOROUS_LILY_PAD_LIMB_ROOTS)) { - Matrix_RotateYS((this->chewLimbRot[limbIndex].y * globalCtx->gameplayFrames), MTXMODE_APPLY); - Matrix_RotateXS((this->chewLimbRot[limbIndex].x * globalCtx->gameplayFrames), MTXMODE_APPLY); - Matrix_RotateZS((this->chewLimbRot[limbIndex].z * globalCtx->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateYS((this->chewLimbRot[limbIndex].y * play->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateXS((this->chewLimbRot[limbIndex].x * play->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateZS((this->chewLimbRot[limbIndex].z * play->gameplayFrames), MTXMODE_APPLY); Matrix_Scale(this->chewScale + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZS(-(this->chewLimbRot[limbIndex].z * globalCtx->gameplayFrames), MTXMODE_APPLY); - Matrix_RotateXS(-(this->chewLimbRot[limbIndex].x * globalCtx->gameplayFrames), MTXMODE_APPLY); - Matrix_RotateYS(-(this->chewLimbRot[limbIndex].y * globalCtx->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateZS(-(this->chewLimbRot[limbIndex].z * play->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateXS(-(this->chewLimbRot[limbIndex].x * play->gameplayFrames), MTXMODE_APPLY); + Matrix_RotateYS(-(this->chewLimbRot[limbIndex].y * play->gameplayFrames), MTXMODE_APPLY); } break; @@ -866,16 +866,16 @@ void EnRaf_TransformLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Actor* th MTXMODE_APPLY); } -void EnRaf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRaf_Draw(Actor* thisx, PlayState* play) { EnRaf* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, EnRaf_TransformLimbDraw, &this->dyna.actor); if (this->action == EN_RAF_ACTION_EXPLODE) { - EnRaf_DrawEffects(this, globalCtx); + EnRaf_DrawEffects(this, play); } } @@ -899,7 +899,7 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc } } -void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { s32 i; EnRafEffect* effect = this->effects; @@ -917,8 +917,8 @@ void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx) { if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) { if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) { - EffectSsGSplash_Spawn(globalCtx, &effect->pos, NULL, NULL, 0, effect->scale * 200000.0f); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &effect->pos, 50, NA_SE_EV_BOMB_DROP_WATER); + EffectSsGSplash_Spawn(play, &effect->pos, NULL, NULL, 0, effect->scale * 200000.0f); + SoundSource_PlaySfxAtFixedWorldPos(play, &effect->pos, 50, NA_SE_EV_BOMB_DROP_WATER); effect->isEnabled = false; } } else if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) { @@ -937,14 +937,14 @@ void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx) { } } -void EnRaf_DrawEffects(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_DrawEffects(EnRaf* this, PlayState* play) { s16 i; EnRafEffect* effect = this->effects; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.h b/src/overlays/actors/ovl_En_Raf/z_en_raf.h index 2fc92fb2bd..831346d38c 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.h +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.h @@ -16,7 +16,7 @@ typedef enum { struct EnRaf; -typedef void (*EnRafActionFunc)(struct EnRaf*, GlobalContext*); +typedef void (*EnRafActionFunc)(struct EnRaf*, PlayState*); typedef struct { /* 0x00 */ u8 isEnabled; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 99d30f14c1..6365bac8b0 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -12,41 +12,41 @@ #define THIS ((EnRailSkb*)thisx) -void EnRailSkb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRailSkb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRailSkb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRailSkb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRailSkb_Init(Actor* thisx, PlayState* play); +void EnRailSkb_Destroy(Actor* thisx, PlayState* play); +void EnRailSkb_Update(Actor* thisx, PlayState* play); +void EnRailSkb_Draw(Actor* thisx, PlayState* play); void func_80B70FA0(EnRailSkb* this); -void func_80B70FF8(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B710E4(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B7114C(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B7123C(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B70FF8(EnRailSkb* this, PlayState* play); +void func_80B710E4(EnRailSkb* this, PlayState* play); +void func_80B7114C(EnRailSkb* this, PlayState* play); +void func_80B7123C(EnRailSkb* this, PlayState* play); void func_80B712FC(EnRailSkb* this); -void func_80B71314(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B71314(EnRailSkb* this, PlayState* play); void func_80B71354(EnRailSkb* this); -void func_80B713A4(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B713A4(EnRailSkb* this, PlayState* play); void func_80B71488(EnRailSkb* this); -void func_80B714D8(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B714D8(EnRailSkb* this, PlayState* play); void func_80B7151C(EnRailSkb* this); -void func_80B715AC(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B716A8(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B715AC(EnRailSkb* this, PlayState* play); +void func_80B716A8(EnRailSkb* this, PlayState* play); void func_80B717C8(EnRailSkb* this); -void func_80B717E0(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B718C4(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B717E0(EnRailSkb* this, PlayState* play); +void func_80B718C4(EnRailSkb* this, PlayState* play); void func_80B71910(EnRailSkb* this); -void func_80B71954(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B71954(EnRailSkb* this, PlayState* play); void func_80B71A08(EnRailSkb* this); -void func_80B71A58(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B71A58(EnRailSkb* this, PlayState* play); void func_80B71B6C(EnRailSkb* this); -void func_80B71BB8(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B71D8C(EnRailSkb* this, GlobalContext* globalCtx, EnRailSkbUnkFunc unkFunc); -void func_80B71EA8(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B71F3C(EnRailSkb* this, GlobalContext* globalCtx); -void func_80B72100(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B71BB8(EnRailSkb* this, PlayState* play); +void func_80B71D8C(EnRailSkb* this, PlayState* play, EnRailSkbUnkFunc unkFunc); +void func_80B71EA8(EnRailSkb* this, PlayState* play); +void func_80B71F3C(EnRailSkb* this, PlayState* play); +void func_80B72100(EnRailSkb* this, PlayState* play); void func_80B723F8(EnRailSkb* this); -void func_80B72430(EnRailSkb* this, GlobalContext* globalCtx, s32 arg2); -void func_80B726B4(EnRailSkb* this, GlobalContext* globalCtx); +void func_80B72430(EnRailSkb* this, PlayState* play, s32 arg2); +void func_80B726B4(EnRailSkb* this, PlayState* play); void func_80B72830(EnRailSkb* this, s16 arg1); s32 func_80B7285C(EnRailSkb* this); @@ -153,9 +153,9 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -void func_80B708C0(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B708C0(EnRailSkb* this, PlayState* play) { static s32 D_80B7348C = 0; - Path* path = &globalCtx->setupPathList[ENRAILSKB_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENRAILSKB_GET_FF00(&this->actor)]; Vec3f sp70; s32 phi_a3; @@ -168,8 +168,8 @@ void func_80B708C0(EnRailSkb* this, GlobalContext* globalCtx) { for (i = 1; (i < this->unk_2E8) && (i < 10); i++) { D_80B7348C++; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_RAIL_SKB, 0.0f, 0.0f, 0.0f, 0, 0, - 0, this->actor.params); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_RAIL_SKB, 0.0f, 0.0f, 0.0f, 0, 0, 0, + this->actor.params); } D_80B7348C = 0; } @@ -242,12 +242,12 @@ s32 func_80B70B04(EnRailSkb* this, Vec3f pos) { return ret; } -void func_80B70D24(EnRailSkb* this, GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void func_80B70D24(EnRailSkb* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (actor != NULL) { if ((actor->id == ACTOR_OBJ_HAKAISI) && func_80B70B04(this, actor->world.pos)) { - if (Flags_GetSwitch(globalCtx, (actor->params & 0xFF00) >> 8)) { + if (Flags_GetSwitch(play, (actor->params & 0xFF00) >> 8)) { Actor_MarkForDeath(&this->actor); return; } @@ -264,19 +264,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -void EnRailSkb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRailSkb_Init(Actor* thisx, PlayState* play) { s32 pad; EnRailSkb* this = THIS; - func_80B708C0(this, globalCtx); + func_80B708C0(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_0064E0, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_0064E0, this->jointTable, this->morphTable, 20); - 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (Flags_GetSwitch(globalCtx, ENRAILSKB_GET_FF(&this->actor))) { + if (Flags_GetSwitch(play, ENRAILSKB_GET_FF(&this->actor))) { Actor_MarkForDeath(&this->actor); } @@ -296,18 +296,17 @@ void EnRailSkb_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_3F8 = 0; } - if ((globalCtx->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.currentCsIndex == 0)) { + if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } func_80B70FA0(this); } -void EnRailSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRailSkb_Destroy(Actor* thisx, PlayState* play) { EnRailSkb* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80B70FA0(EnRailSkb* this) { @@ -318,7 +317,7 @@ void func_80B70FA0(EnRailSkb* this) { this->actionFunc = func_80B70FF8; } -void func_80B70FF8(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B70FF8(EnRailSkb* this, PlayState* play) { s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 65.0f) { @@ -339,7 +338,7 @@ void func_80B710AC(EnRailSkb* this) { this->actionFunc = func_80B710E4; } -void func_80B710E4(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B710E4(EnRailSkb* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { func_80B70FA0(this); } @@ -350,7 +349,7 @@ void func_80B71114(EnRailSkb* this) { this->actionFunc = func_80B7114C; } -void func_80B7114C(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B7114C(EnRailSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -362,11 +361,11 @@ void func_80B7114C(EnRailSkb* this, GlobalContext* globalCtx) { this->unk_402 |= 1; func_80B712FC(this); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); } } else if (this->drawDmgEffTimer == 1) { - func_80B726B4(this, globalCtx); + func_80B726B4(this, play); } } @@ -374,7 +373,7 @@ void func_80B71228(EnRailSkb* this) { this->actionFunc = func_80B7123C; } -void func_80B7123C(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B7123C(EnRailSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -386,7 +385,7 @@ void func_80B7123C(EnRailSkb* this, GlobalContext* globalCtx) { this->unk_402 |= 1; func_80B712FC(this); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); } } @@ -397,7 +396,7 @@ void func_80B712FC(EnRailSkb* this) { this->actionFunc = func_80B71314; } -void func_80B71314(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71314(EnRailSkb* this, PlayState* play) { if (this->unk_3F2 >= 6) { func_80B70FA0(this); } else { @@ -411,9 +410,9 @@ void func_80B71354(EnRailSkb* this) { this->actionFunc = func_80B713A4; } -void func_80B713A4(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B713A4(EnRailSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if ((this->actor.xzDistToPlayer > 65.0f) || (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN)) { + if ((this->actor.xzDistToPlayer > 65.0f) || (Player_GetMask(play) == PLAYER_MASK_CAPTAIN)) { func_80B70FA0(this); } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); @@ -438,7 +437,7 @@ void func_80B71488(EnRailSkb* this) { this->actionFunc = func_80B714D8; } -void func_80B714D8(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B714D8(EnRailSkb* this, PlayState* play) { if (this->actor.draw != NULL) { this->actor.draw = NULL; } @@ -461,11 +460,11 @@ void func_80B7151C(EnRailSkb* this) { this->actionFunc = func_80B715AC; } -void func_80B715AC(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B715AC(EnRailSkb* this, PlayState* play) { if (Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 500.0f, 10.0f) == 0.0f) { func_80B70FA0(this); } else { - func_80B72430(this, globalCtx, 1); + func_80B72430(this, play, 1); } if (this->actor.shape.shadowAlpha != 255) { @@ -485,22 +484,22 @@ void func_80B71650(EnRailSkb* this) { this->actionFunc = func_80B716A8; } -void func_80B716A8(EnRailSkb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B716A8(EnRailSkb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3FE = 1; - func_80B71D8C(this, globalCtx, func_80B723F8); + func_80B71D8C(this, play, func_80B723F8); if (!func_80B7285C(this)) { - Message_StartTextbox(globalCtx, 0x13EC, &this->actor); + Message_StartTextbox(play, 0x13EC, &this->actor); this->unk_400 = 0x13EC; func_80B72830(this, 1); } else { - Message_StartTextbox(globalCtx, 0x13F5, &this->actor); + Message_StartTextbox(play, 0x13F5, &this->actor); this->unk_400 = 0x13F5; } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); func_80B717C8(this); } else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x71C, 0xB6); } @@ -510,31 +509,31 @@ void func_80B717C8(EnRailSkb* this) { this->actionFunc = func_80B717E0; } -void func_80B717E0(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B717E0(EnRailSkb* this, PlayState* play) { this->unk_3FA = 0; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: break; case 3: - if ((globalCtx->gameplayFrames % 2) != 0) { + if ((play->gameplayFrames % 2) != 0) { this->unk_3FA = 1; } break; case 4: - func_80B72100(this, globalCtx); + func_80B72100(this, play); break; case 5: - func_80B71F3C(this, globalCtx); + func_80B71F3C(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80B71650(this); } break; @@ -546,8 +545,8 @@ void func_80B718B0(EnRailSkb* this) { this->actionFunc = func_80B718C4; } -void func_80B718C4(EnRailSkb* this, GlobalContext* globalCtx) { - func_80B70D24(this, globalCtx); +void func_80B718C4(EnRailSkb* this, PlayState* play) { + func_80B70D24(this, play); if (this->actor.parent == NULL) { if (this->unk_22C != NULL) { ObjHakaisi* hakasi = this->unk_22C; @@ -563,7 +562,7 @@ void func_80B71910(EnRailSkb* this) { this->actionFunc = func_80B71954; } -void func_80B71954(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71954(EnRailSkb* this, PlayState* play) { s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); f32 sp30 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); @@ -581,7 +580,7 @@ void func_80B71A08(EnRailSkb* this) { this->actionFunc = func_80B71A58; } -void func_80B71A58(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71A58(EnRailSkb* this, PlayState* play) { s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -613,7 +612,7 @@ void func_80B71B6C(EnRailSkb* this) { this->actionFunc = func_80B71BB8; } -void func_80B71BB8(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71BB8(EnRailSkb* this, PlayState* play) { s32 pad; s32 i; f32 sp34 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); @@ -646,13 +645,13 @@ void func_80B71BB8(EnRailSkb* this, GlobalContext* globalCtx) { this->actor.velocity.y = 10.0f; for (i = 0; i < 4; i++) { - func_80B72430(this, globalCtx, 0); + func_80B72430(this, play, 0); } } } -void func_80B71D8C(EnRailSkb* this, GlobalContext* globalCtx, EnRailSkbUnkFunc unkFunc) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; +void func_80B71D8C(EnRailSkb* this, PlayState* play, EnRailSkbUnkFunc unkFunc) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; while (actor != NULL) { if (actor->id == ACTOR_EN_RAIL_SKB) { @@ -679,9 +678,9 @@ void func_80B71DF0(EnRailSkb* this) { this->actionFunc = func_80B71EA8; } -void func_80B71EA8(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71EA8(EnRailSkb* this, PlayState* play) { if (Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 0.5f, 500.0f, 10.0f) != 0.0f) { - func_80B72430(this, globalCtx, 1); + func_80B72430(this, play, 1); } if (this->actor.shape.shadowAlpha != 255) { @@ -693,80 +692,80 @@ void func_80B71EA8(EnRailSkb* this, GlobalContext* globalCtx) { } } -void func_80B71F3C(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B71F3C(EnRailSkb* this, PlayState* play) { if (((this->unk_400 == 0x13ED) || (this->unk_400 == 0x13F5)) && (this->unk_3F2 != 1)) { - func_80B71D8C(this, globalCtx, func_80B71DF0); + func_80B71D8C(this, play, func_80B71DF0); func_80B717C8(this); this->unk_3F2 = 1; } - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->unk_400) { case 0x13EC: - Message_StartTextbox(globalCtx, 0x13ED, &this->actor); + Message_StartTextbox(play, 0x13ED, &this->actor); this->unk_400 = 0x13ED; break; case 0x13ED: - Message_StartTextbox(globalCtx, 0x13EE, &this->actor); + Message_StartTextbox(play, 0x13EE, &this->actor); this->unk_400 = 0x13EE; break; case 0x13EE: - Message_StartTextbox(globalCtx, 0x13EF, &this->actor); + Message_StartTextbox(play, 0x13EF, &this->actor); this->unk_400 = 0x13EF; break; case 0x13EF: case 0x13F5: - Message_StartTextbox(globalCtx, 0x13F0, &this->actor); + Message_StartTextbox(play, 0x13F0, &this->actor); this->unk_400 = 0x13F0; break; case 0x13F1: - Message_StartTextbox(globalCtx, 0x13F2, &this->actor); + Message_StartTextbox(play, 0x13F2, &this->actor); this->unk_400 = 0x13F2; break; case 0x13F2: if (this->unk_3FC == 1) { - Message_StartTextbox(globalCtx, 0x13F4, &this->actor); + Message_StartTextbox(play, 0x13F4, &this->actor); this->unk_400 = 0x13F4; } else { - func_801477B4(globalCtx); - func_80B71D8C(this, globalCtx, func_80B71650); + func_801477B4(play); + func_80B71D8C(this, play, func_80B71650); } break; case 0x13F3: - Message_StartTextbox(globalCtx, 0x13F2, &this->actor); + Message_StartTextbox(play, 0x13F2, &this->actor); this->unk_400 = 0x13F2; this->unk_3FC = 1; break; case 0x13F4: - func_801477B4(globalCtx); - func_80B71D8C(this, globalCtx, func_80B718B0); + func_801477B4(play); + func_80B71D8C(this, play, func_80B718B0); break; } } } -void func_80B72100(EnRailSkb* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { +void func_80B72100(EnRailSkb* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - Message_StartTextbox(globalCtx, 0x13F1, &this->actor); + Message_StartTextbox(play, 0x13F1, &this->actor); this->unk_400 = 0x13F1; } else { func_8019F208(); - Message_StartTextbox(globalCtx, 0x13F3, &this->actor); + Message_StartTextbox(play, 0x13F3, &this->actor); this->unk_400 = 0x13F3; } } } -void func_80B72190(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B72190(EnRailSkb* this, PlayState* play) { EnRailSkb* parent; Vec3f sp38; s32 pad; @@ -830,14 +829,14 @@ void func_80B723F8(EnRailSkb* this) { this->actor.textId = 0; } -void func_80B72430(EnRailSkb* this, GlobalContext* globalCtx, s32 arg2) { +void func_80B72430(EnRailSkb* this, PlayState* play, s32 arg2) { Vec3f sp5C = this->actor.world.pos; Vec3f sp50 = { 0.0f, 8.0f, 0.0f }; Vec3f sp44 = { 0.0f, -1.5f, 0.0f }; s16 sp42; s32 pad; - if ((globalCtx->gameplayFrames & arg2) == 0) { + if ((play->gameplayFrames & arg2) == 0) { sp42 = Rand_Next(); sp5C.x += 15.0f * Math_SinS(sp42); @@ -849,12 +848,12 @@ void func_80B72430(EnRailSkb* this, GlobalContext* globalCtx, s32 arg2) { sp50.y += Rand_Centered() * 4.0f; - EffectSsHahen_Spawn(globalCtx, &sp5C, &sp50, &sp44, 0, (Rand_Next() & 7) + 10, -1, 10, NULL); - func_800BBFB0(globalCtx, &sp5C, 10.0f, 1, 150, 0, 1); + EffectSsHahen_Spawn(play, &sp5C, &sp50, &sp44, 0, (Rand_Next() & 7) + 10, -1, 10, NULL); + func_800BBFB0(play, &sp5C, 10.0f, 1, 150, 0, 1); } } -void func_80B725C0(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B725C0(EnRailSkb* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -873,7 +872,7 @@ void func_80B725C0(EnRailSkb* this, GlobalContext* globalCtx) { } } -void func_80B726B4(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B726B4(EnRailSkb* this, PlayState* play) { static Color_RGBA8 D_80B734B0 = { 170, 255, 255, 255 }; static Color_RGBA8 D_80B734B4 = { 200, 200, 255, 255 }; static Vec3f D_80B734B8 = { 0.0f, -1.0f, 0.0f }; @@ -888,7 +887,7 @@ void func_80B726B4(EnRailSkb* this, GlobalContext* globalCtx) { end = ARRAY_COUNT(this->limbPos); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < end; i++) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); @@ -897,7 +896,7 @@ void func_80B726B4(EnRailSkb* this, GlobalContext* globalCtx) { sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(globalCtx, &this->limbPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); + EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80B734B8, &D_80B734B0, &D_80B734B4, 30); } } @@ -920,10 +919,10 @@ s32 func_80B7285C(EnRailSkb* this) { return phi_v1; } -void func_80B72880(EnRailSkb* this, GlobalContext* globalCtx) { +void func_80B72880(EnRailSkb* this, PlayState* play) { if ((this->actionFunc == func_80B70FF8) || (this->actionFunc == func_80B716A8)) { if (this->actionFunc != func_80B716A8) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.flags |= ACTOR_FLAG_100000; @@ -931,7 +930,7 @@ void func_80B72880(EnRailSkb* this, GlobalContext* globalCtx) { this->actor.textId = 0; func_80B71650(this); } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CAPTAIN) { + } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); @@ -942,8 +941,8 @@ void func_80B72880(EnRailSkb* this, GlobalContext* globalCtx) { } } -void func_80B72970(EnRailSkb* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B72970(EnRailSkb* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if ((this->actionFunc == func_80B714D8) || (this->actionFunc == func_80B7123C) || @@ -965,7 +964,7 @@ void func_80B72970(EnRailSkb* this, GlobalContext* globalCtx) { default: if (this->drawDmgEffTimer >= 2) { - func_80B726B4(this, globalCtx); + func_80B726B4(this, play); } this->drawDmgEffTimer = 0; break; @@ -974,7 +973,7 @@ void func_80B72970(EnRailSkb* this, GlobalContext* globalCtx) { if ((Actor_ApplyDamage(&this->actor) == 0) && (this->actor.colChkInfo.damageEffect != 3) && (this->actor.colChkInfo.damageEffect != 4)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80B71488(this); return; } @@ -1054,48 +1053,47 @@ void func_80B72970(EnRailSkb* this, GlobalContext* globalCtx) { } if (this->actionFunc == func_80B713A4) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actionFunc != func_80B71314) { - 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 EnRailSkb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRailSkb_Update(Actor* thisx, PlayState* play) { EnRailSkb* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80B72190(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 5); - func_80B72970(this, globalCtx); + func_80B72190(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 5); + func_80B72970(this, play); if ((this->actionFunc != func_80B710E4) && (this->actionFunc != func_80B7114C) && (this->actionFunc != func_80B7123C)) { SkelAnime_Update(&this->skelAnime); } - func_80B72880(this, globalCtx); - func_80B725C0(this, globalCtx); + func_80B72880(this, play); + func_80B725C0(this, play); } -s32 EnRailSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnRailSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRailSkb* this = THIS; s16 abs; if (limbIndex == 11) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - abs = fabsf(Math_SinS(globalCtx->state.frames * 6000) * 95.0f) + 160.0f; + abs = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f; gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, abs, abs, abs, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 10) { Vec3f sp24 = { 0.0f, 1000.0f, 0.0f }; @@ -1111,7 +1109,7 @@ s32 EnRailSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnRailSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80B734D0 = { 800.0f, 1200.0f, 0.0f }; EnRailSkb* this = THIS; @@ -1119,10 +1117,10 @@ void EnRailSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Collider_UpdateSpheres(limbIndex, &this->collider); if ((limbIndex == 11) && (this->unk_402 & 1) && !(this->unk_402 & 2)) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); this->unk_402 |= 2; } else if ((this->unk_402 & 0x40) && ((limbIndex != 11) || !(this->unk_402 & 1)) && (limbIndex != 12)) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); } if (this->drawDmgEffTimer != 0) { @@ -1139,15 +1137,15 @@ void EnRailSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnRailSkb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRailSkb_Draw(Actor* thisx, PlayState* play) { EnRailSkb* this = THIS; this->limbCount = 0; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnRailSkb_OverrideLimbDraw, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnRailSkb_OverrideLimbDraw, EnRailSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h index 6346eebe20..db170806cf 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h @@ -5,7 +5,7 @@ struct EnRailSkb; -typedef void (*EnRailSkbActionFunc)(struct EnRailSkb*, GlobalContext*); +typedef void (*EnRailSkbActionFunc)(struct EnRailSkb*, PlayState*); typedef void (*EnRailSkbUnkFunc)(struct EnRailSkb*); #define ENRAILSKB_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index ba6043f52a..7da4776d82 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -11,42 +11,42 @@ #define THIS ((EnRailgibud*)thisx) -void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRailgibud_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRailgibud_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRailgibud_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRailgibud_Init(Actor* thisx, PlayState* play); +void EnRailgibud_Destroy(Actor* thisx, PlayState* play); +void EnRailgibud_Update(Actor* thisx, PlayState* play); +void EnRailgibud_Draw(Actor* thisx, PlayState* play); void EnRailgibud_SetupWalkInCircles(EnRailgibud* this); -void EnRailgibud_WalkInCircles(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupAttemptPlayerFreeze(EnRailgibud* this); -void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupWalkToPlayer(EnRailgibud* this); -void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupGrab(EnRailgibud* this); -void EnRailgibud_Grab(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_Grab(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupGrabFail(EnRailgibud* this); -void EnRailgibud_GrabFail(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_GrabFail(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupTurnAwayAndShakeHead(EnRailgibud* this); -void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupWalkToHome(EnRailgibud* this); -void EnRailgibud_WalkToHome(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_Damage(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_Stunned(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play); +void EnRailgibud_Damage(EnRailgibud* this, PlayState* play); +void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play); void EnRailgibud_SetupDead(EnRailgibud* this); -void EnRailgibud_Dead(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_SpawnDust(GlobalContext* globalCtx, Vec3f* vec, f32 arg2, s32 arg3, s16 arg4, s16 arg5); -void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, GlobalContext* globalCtx); -s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, GlobalContext* globalCtx); -s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, GlobalContext* globalCtx); -s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_MainGibdo_DeadUpdate(Actor* thisx, GlobalContext* globalCtx); -void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, GlobalContext* globalCtx); +void EnRailgibud_Dead(EnRailgibud* this, PlayState* play); +void EnRailgibud_SpawnDust(PlayState* play, Vec3f* vec, f32 arg2, s32 arg3, s16 arg4, s16 arg5); +void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, PlayState* play); +s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play); +s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, PlayState* play); +s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, PlayState* play); +void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play); +void EnRailgibud_MainGibdo_DeadUpdate(Actor* thisx, PlayState* play); +void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play); void EnRailgibud_InitActorActionCommand(EnRailgibud* this); void EnRailgibud_SetupDoNothing(EnRailgibud* this); -void EnRailgibud_DoNothing(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_SinkIntoGround(EnRailgibud* this, GlobalContext* globalCtx); -void EnRailgibud_Cutscene_Update(Actor* thisx, GlobalContext* globalCtx); +void EnRailgibud_DoNothing(EnRailgibud* this, PlayState* play); +void EnRailgibud_SinkIntoGround(EnRailgibud* this, PlayState* play); +void EnRailgibud_Cutscene_Update(Actor* thisx, PlayState* play); typedef enum { /* 0 */ EN_RAILGIBUD_ANIMATION_GRAB_ATTACK, @@ -190,11 +190,11 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_IMMOVABLE }; * who then spawns all the other Gibdos. It spawns enough Gibdos for one to exist on every * point along the path up to a maximum of nine additional Gibdos (not counting itself). */ -void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, PlayState* play) { static s32 currentGibdoIndex = 0; s32 nextPoint; Vec3f targetPos; - Path* path = &globalCtx->setupPathList[ENRAILGIBUD_GET_PATH(&this->actor)]; + Path* path = &play->setupPathList[ENRAILGIBUD_GET_PATH(&this->actor)]; this->points = Lib_SegmentedToVirtual(path->points); this->currentPoint = currentGibdoIndex; @@ -209,8 +209,8 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Gl for (i = 1; i < this->pathCount && i < 10; i++) { currentGibdoIndex++; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_RAILGIBUD, 0.0f, 0.0f, 0.0f, 0, - 0, 0, this->actor.params); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_RAILGIBUD, 0.0f, 0.0f, 0.0f, 0, 0, 0, + this->actor.params); } currentGibdoIndex = 0; @@ -239,7 +239,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), }; -void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_Init(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; s32 pad; @@ -248,11 +248,11 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.hintId = 0x2D; this->actor.textId = 0; if (ENRAILGIBUD_IS_CUTSCENE_TYPE(&this->actor)) { - EnRailgibud_InitCutsceneGibdo(this, globalCtx); + EnRailgibud_InitCutsceneGibdo(this, play); return; } - EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(this, globalCtx); + EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(this, play); this->playerStunWaitTimer = 0; this->timeInitialized = gSaveContext.save.time; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; @@ -265,10 +265,10 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, - this->morphTable, GIBDO_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, + GIBDO_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (gSaveContext.save.weekEventReg[14] & 4) { Actor_MarkForDeath(&this->actor); @@ -277,10 +277,10 @@ void EnRailgibud_Init(Actor* thisx, GlobalContext* globalCtx) { EnRailgibud_SetupWalkInCircles(this); } -void EnRailgibud_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_Destroy(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnRailgibud_SetupWalkInCircles(EnRailgibud* this) { @@ -289,7 +289,7 @@ void EnRailgibud_SetupWalkInCircles(EnRailgibud* this) { this->actionFunc = EnRailgibud_WalkInCircles; } -void EnRailgibud_WalkInCircles(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) { Vec3f targetPos; s32 pad; s16 yRotation; @@ -298,8 +298,7 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, GlobalContext* globalCtx) { targetPos.y = this->points[this->currentPoint].y; targetPos.z = this->points[this->currentPoint].z; - if ((this->actor.xzDistToPlayer <= 100.0f) && func_800B715C(globalCtx) && - (Player_GetMask(globalCtx) != PLAYER_MASK_GIBDO)) { + if ((this->actor.xzDistToPlayer <= 100.0f) && func_800B715C(play) && (Player_GetMask(play) != PLAYER_MASK_GIBDO)) { this->actor.home = this->actor.world; EnRailgibud_SetupAttemptPlayerFreeze(this); } @@ -340,20 +339,20 @@ void EnRailgibud_SetupAttemptPlayerFreeze(EnRailgibud* this) { this->actionFunc = EnRailgibud_AttemptPlayerFreeze; } -void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rot = this->actor.shape.rot.y + this->headRotation.y + this->upperBodyRotation.y; s16 yaw = BINANG_SUB(this->actor.yawTowardsPlayer, rot); if (ABS_ALT(yaw) < 0x2008) { player->actor.freezeTimer = 60; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); EnRailgibud_SetupWalkToPlayer(this); } - EnRailgibud_TurnTowardsPlayer(this, globalCtx); + EnRailgibud_TurnTowardsPlayer(this, play); } void EnRailgibud_SetupWalkToPlayer(EnRailgibud* this) { @@ -369,8 +368,8 @@ void EnRailgibud_SetupWalkToPlayer(EnRailgibud* this) { this->actionFunc = EnRailgibud_WalkToPlayer; } -void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xFA); @@ -378,7 +377,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 0x64, 0); - if (EnRailgibud_PlayerInRangeWithCorrectState(this, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { + if (EnRailgibud_PlayerInRangeWithCorrectState(this, play) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) || @@ -386,7 +385,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnRailgibud_SetupGrabFail(this); - } else if (globalCtx->grabPlayer(globalCtx, player)) { + } else if (play->grabPlayer(play, player)) { EnRailgibud_SetupGrab(this); } } else { @@ -394,7 +393,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 40; this->playerStunWaitTimer = 60; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); } else { this->playerStunWaitTimer--; @@ -402,7 +401,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { } } else if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { EnRailgibud_SetupWalkToHome(this); - } else if (EnRailgibud_PlayerOutOfRange(this, globalCtx)) { + } else if (EnRailgibud_PlayerOutOfRange(this, play)) { EnRailgibud_SetupWalkToHome(this); } @@ -412,7 +411,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); - } else if (!(globalCtx->gameplayFrames & 95)) { + } else if (!(play->gameplayFrames & 95)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -425,15 +424,15 @@ void EnRailgibud_SetupGrab(EnRailgibud* this) { this->actionFunc = EnRailgibud_Grab; } -void EnRailgibud_Grab(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player2 = GET_PLAYER(globalCtx); +void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { + Player* player2 = GET_PLAYER(play); Player* player = player2; s32 inPositionToAttack; u16 damageSfxId; switch (this->grabState) { case EN_RAILGIBUD_GRAB_START: - inPositionToAttack = EnRailgibud_MoveToIdealGrabPositionAndRotation(this, globalCtx); + inPositionToAttack = EnRailgibud_MoveToIdealGrabPositionAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (inPositionToAttack == true)) { this->grabState = EN_RAILGIBUD_GRAB_ATTACK; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_GRAB_ATTACK); @@ -450,7 +449,7 @@ void EnRailgibud_Grab(EnRailgibud* this, GlobalContext* globalCtx) { s16 requiredScopeTemp; damageSfxId = player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800B8E58(player, damageSfxId); func_8013ECE0(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 0; @@ -494,7 +493,7 @@ void EnRailgibud_SetupGrabFail(EnRailgibud* this) { this->actionFunc = EnRailgibud_GrabFail; } -void EnRailgibud_GrabFail(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_GrabFail(EnRailgibud* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -514,7 +513,7 @@ void EnRailgibud_SetupTurnAwayAndShakeHead(EnRailgibud* this) { this->actionFunc = EnRailgibud_TurnAwayAndShakeHead; } -void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 5, 3500, 200); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->headShakeTimer > 60) { @@ -533,7 +532,7 @@ void EnRailgibud_SetupWalkToHome(EnRailgibud* this) { this->actionFunc = EnRailgibud_WalkToHome; } -void EnRailgibud_WalkToHome(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { @@ -552,7 +551,7 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 450); this->actor.world.rot = this->actor.shape.rot; } - if (EnRailgibud_PlayerInRangeWithCorrectState(this, globalCtx)) { + if (EnRailgibud_PlayerInRangeWithCorrectState(this, play)) { if ((gSaveContext.save.playerForm != PLAYER_FORM_GORON) && (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnRailgibud_SetupWalkToPlayer(this); @@ -570,7 +569,7 @@ void EnRailgibud_SetupDamage(EnRailgibud* this) { this->actionFunc = EnRailgibud_Damage; } -void EnRailgibud_Damage(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_Damage(EnRailgibud* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -581,7 +580,7 @@ void EnRailgibud_Damage(EnRailgibud* this, GlobalContext* globalCtx) { if ((this->drawDmgEffTimer > 0) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) && (this->type == EN_RAILGIBUD_TYPE_GIBDO)) { this->actor.hintId = 0x2A; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, GIBDO_LIMB_MAX); this->type = EN_RAILGIBUD_TYPE_REDEAD; } @@ -603,7 +602,7 @@ void EnRailgibud_SetupStunned(EnRailgibud* this) { this->actionFunc = EnRailgibud_Stunned; } -void EnRailgibud_Stunned(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { EnRailgibud_SetupDead(this); @@ -625,7 +624,7 @@ void EnRailgibud_SetupDead(EnRailgibud* this) { this->actionFunc = EnRailgibud_Dead; } -void EnRailgibud_Dead(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_Dead(EnRailgibud* this, PlayState* play) { if (this->deathTimer > 300) { if (this->actor.shape.shadowAlpha == 0) { if (this->actor.parent != NULL) { @@ -653,33 +652,33 @@ void EnRailgibud_Dead(EnRailgibud* this, GlobalContext* globalCtx) { if ((this->deathTimer == 20) && (this->drawDmgEffTimer > 0) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) && (this->type == EN_RAILGIBUD_TYPE_GIBDO)) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, GIBDO_LIMB_MAX); this->type = EN_RAILGIBUD_TYPE_REDEAD; } } -void EnRailgibud_SpawnEffectsForSinkingIntoTheGround(EnRailgibud* this, GlobalContext* globalCtx, s32 arg2) { +void EnRailgibud_SpawnEffectsForSinkingIntoTheGround(EnRailgibud* this, PlayState* play, s32 arg2) { Vec3f rockFragmentPos = this->actor.world.pos; Vec3f rockFragmentVelocity = { 0.0f, 8.0f, 0.0f }; Vec3f rockFragmentAccel = { 0.0f, -1.5f, 0.0f }; s16 rand; s32 pad; - if ((globalCtx->gameplayFrames & arg2) == 0) { + if ((play->gameplayFrames & arg2) == 0) { rand = Rand_Next(); rockFragmentPos.x += 15.0f * Math_SinS(rand); rockFragmentPos.z += 15.0f * Math_CosS(rand); rockFragmentAccel.x = Rand_Centered(); rockFragmentAccel.z = Rand_Centered(); rockFragmentVelocity.y += Rand_Centered() * 4.0f; - EffectSsHahen_Spawn(globalCtx, &rockFragmentPos, &rockFragmentVelocity, &rockFragmentAccel, 0, + EffectSsHahen_Spawn(play, &rockFragmentPos, &rockFragmentVelocity, &rockFragmentAccel, 0, (Rand_Next() & 7) + 10, -1, 10, NULL); - EnRailgibud_SpawnDust(globalCtx, &rockFragmentPos, 10.0f, 10, 150, 0); + EnRailgibud_SpawnDust(play, &rockFragmentPos, 10.0f, 10, 150, 0); } } -void EnRailgibud_SpawnDust(GlobalContext* globalCtx, Vec3f* basePos, f32 randomnessScale, s32 dustCount, s16 dustScale, +void EnRailgibud_SpawnDust(PlayState* play, Vec3f* basePos, f32 randomnessScale, s32 dustCount, s16 dustScale, s16 scaleStep) { Vec3f dustPos; Vec3f dustAccel = { 0.0f, 0.3f, 0.0f }; @@ -699,8 +698,8 @@ void EnRailgibud_SpawnDust(GlobalContext* globalCtx, Vec3f* basePos, f32 randomn dustVelocity.x *= 0.5f; dustVelocity.z *= 0.5f; - func_800B1210(globalCtx, &dustPos, &dustVelocity, &dustAccel, - (s16)(Rand_ZeroOne() * dustScale * 0.2f) + dustScale, scaleStep); + func_800B1210(play, &dustPos, &dustVelocity, &dustAccel, (s16)(Rand_ZeroOne() * dustScale * 0.2f) + dustScale, + scaleStep); } } @@ -723,7 +722,7 @@ void EnRailgibud_UpdateWalkForwardState(EnRailgibud* this) { } } -void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, PlayState* play) { s16 headAngle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->upperBodyRotation.y; s16 upperBodyAngle = CLAMP(headAngle, -500, 500); @@ -742,10 +741,10 @@ void EnRailgibud_TurnTowardsPlayer(EnRailgibud* this, GlobalContext* globalCtx) this->headRotation.y = CLAMP(this->headRotation.y, -0x256F, 0x256F); } -s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) { + if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { return false; } @@ -763,8 +762,8 @@ s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, GlobalContext* * engage with the player. If the player is out of this range, they will simply * walk back to their home. */ -s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 100.0f) { return true; @@ -773,8 +772,8 @@ s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, GlobalContext* globalCtx) { return false; } -void EnRailgibud_UpdateDamage(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->isInvincible != true) && (this->collider.base.acFlags & AC_HIT)) { if (this->actionFunc == EnRailgibud_WalkInCircles) { @@ -853,8 +852,8 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, GlobalContext* globalCtx) { * performing its grab attack. Regardless of what this returns, the Gibdo is * moved closer to this ideal position and rotation. */ -s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f targetPos; f32 distanceFromTargetPos; f32 distanceFromTargetYOffset = 0.0f; @@ -878,7 +877,7 @@ s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, GlobalCont return false; } -void EnRailgibud_MoveWithGravity(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_MoveWithGravity(EnRailgibud* this, PlayState* play) { if ((this->actionFunc == EnRailgibud_WalkToPlayer) || (this->actionFunc == EnRailgibud_WalkToHome) || (this->actionFunc == EnRailgibud_Damage)) { Actor_MoveWithGravity(&this->actor); @@ -893,14 +892,14 @@ void EnRailgibud_MoveWithGravity(EnRailgibud* this, GlobalContext* globalCtx) { * the player like this will help prevent the Gibdo from looking like it's * clipping into the wall as it grabs onto the player. */ -void EnRailgibud_MoveGrabbedPlayerAwayFromWall(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRailgibud_MoveGrabbedPlayerAwayFromWall(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f targetPos; if ((this->actionFunc == EnRailgibud_Grab) && (this->grabState != EN_RAILGIBUD_GRAB_RELEASE)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 1); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); } if ((this->actionFunc == EnRailgibud_Grab) && (this->grabState == EN_RAILGIBUD_GRAB_START) && @@ -912,7 +911,7 @@ void EnRailgibud_MoveGrabbedPlayerAwayFromWall(EnRailgibud* this, GlobalContext* } } -void EnRailgibud_UpdateEffect(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_UpdateEffect(EnRailgibud* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -925,12 +924,12 @@ void EnRailgibud_UpdateEffect(EnRailgibud* this, GlobalContext* globalCtx) { } } -void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, PlayState* play) { if ((this->actionFunc != EnRailgibud_Grab) && (this->actionFunc != EnRailgibud_Damage) && (this->actionFunc != EnRailgibud_GrabFail) && (this->actionFunc != EnRailgibud_TurnAwayAndShakeHead) && (this->actionFunc != EnRailgibud_Dead)) { if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_1 | ACTOR_FLAG_4))) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) { + if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { this->actor.flags &= ~(ACTOR_FLAG_4 | ACTOR_FLAG_1); this->actor.flags |= (ACTOR_FLAG_8 | ACTOR_FLAG_1); this->actor.hintId = 0xFF; @@ -939,7 +938,7 @@ void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, GlobalContext* globalCtx) EnRailgibud_SetupWalkToHome(this); } } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_GIBDO) { + } else if (Player_GetMask(play) != PLAYER_MASK_GIBDO) { this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); if (this->type == EN_RAILGIBUD_TYPE_REDEAD) { @@ -950,33 +949,33 @@ void EnRailgibud_CheckForGibdoMask(EnRailgibud* this, GlobalContext* globalCtx) this->actor.textId = 0; } - EnRailgibud_CheckIfTalkingToPlayer(this, globalCtx); + EnRailgibud_CheckIfTalkingToPlayer(this, play); } } -void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { if ((this->textId == 0) && (this->type == EN_RAILGIBUD_TYPE_GIBDO)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->isInvincible = true; - Message_StartTextbox(globalCtx, 0x13B2, &this->actor); + Message_StartTextbox(play, 0x13B2, &this->actor); this->textId = 0x13B2; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); this->actor.speedXZ = 0.0f; } else if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_1 | ACTOR_FLAG_8)) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } else { - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x13B3, &this->actor); + if (Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x13B3, &this->actor); this->textId = 0x13B3; } break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->textId = 0; this->isInvincible = false; this->actor.speedXZ = 0.6f; @@ -993,50 +992,50 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, GlobalContext* global } } -void EnRailgibud_UpdateCollision(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRailgibud_UpdateCollision(EnRailgibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actionFunc != EnRailgibud_Dead) && ((this->actionFunc != EnRailgibud_Grab) || (this->grabState == EN_RAILGIBUD_GRAB_RELEASE))) { 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 != EnRailgibud_Damage) || ((player->unk_ADC != 0) && (player->unk_ADD != this->unk_405))) && ((this->actionFunc != EnRailgibud_Stunned) || (this->stunTimer == 0))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void EnRailgibud_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_Update(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; EnRailgibud_UpdateWalkForwardState(this); - EnRailgibud_CheckForGibdoMask(this, globalCtx); - EnRailgibud_UpdateDamage(this, globalCtx); + EnRailgibud_CheckForGibdoMask(this, play); + EnRailgibud_UpdateDamage(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != EnRailgibud_Stunned) { SkelAnime_Update(&this->skelAnime); } - EnRailgibud_MoveWithGravity(this, globalCtx); - EnRailgibud_UpdateCollision(this, globalCtx); - EnRailgibud_MoveGrabbedPlayerAwayFromWall(this, globalCtx); - EnRailgibud_UpdateEffect(this, globalCtx); + EnRailgibud_MoveWithGravity(this, play); + EnRailgibud_UpdateCollision(this, play); + EnRailgibud_MoveGrabbedPlayerAwayFromWall(this, play); + EnRailgibud_UpdateEffect(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 50.0f; } -void EnRailgibud_MainGibdo_DeadUpdate(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_MainGibdo_DeadUpdate(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; EnRailgibud_UpdateWalkForwardState(this); } -s32 EnRailgibud_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnRailgibud_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { EnRailgibud* this = THIS; if (limbIndex == GIBDO_LIMB_UPPER_BODY_ROOT) { @@ -1048,8 +1047,7 @@ s32 EnRailgibud_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnRailgibud_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnRailgibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnRailgibud* this = THIS; if ((this->drawDmgEffTimer != 0) && @@ -1065,41 +1063,41 @@ void EnRailgibud_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnRailgibud_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_Draw(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->limbIndex = 0; if (this->actor.shape.shadowAlpha == 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw, - EnRailgibud_PostLimbDraw, &this->actor, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRailgibud_OverrideLimbDraw, EnRailgibud_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRailgibud_OverrideLimbDraw, - EnRailgibud_PostLimbDraw, &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRailgibud_OverrideLimbDraw, EnRailgibud_PostLimbDraw, &this->actor, POLY_XLU_DISP); } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play) { s32 pad[2]; EnRailgibud_InitActorActionCommand(this); @@ -1108,10 +1106,10 @@ void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, GlobalContext* globalCtx) this->actor.flags |= ACTOR_FLAG_10; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, - this->morphTable, GIBDO_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, + GIBDO_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (gSaveContext.save.entranceIndex != 0x2090) { // NOT Cutscene: Music Box House Opens Actor_MarkForDeath(&this->actor); @@ -1153,7 +1151,7 @@ void EnRailgibud_SetupDoNothing(EnRailgibud* this) { this->actionFunc = EnRailgibud_DoNothing; } -void EnRailgibud_DoNothing(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_DoNothing(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupSinkIntoGround(EnRailgibud* this) { @@ -1161,24 +1159,24 @@ void EnRailgibud_SetupSinkIntoGround(EnRailgibud* this) { this->actionFunc = EnRailgibud_SinkIntoGround; } -void EnRailgibud_SinkIntoGround(EnRailgibud* this, GlobalContext* globalCtx) { +void EnRailgibud_SinkIntoGround(EnRailgibud* this, PlayState* play) { if (this->sinkTimer != 0) { this->sinkTimer--; } else if (Math_SmoothStepToF(&this->actor.shape.yOffset, -9500.0f, 0.5f, 200.0f, 10.0f) < 10.0f) { Actor_MarkForDeath(&this->actor); } else { - EnRailgibud_SpawnEffectsForSinkingIntoTheGround(this, globalCtx, 0); + EnRailgibud_SpawnEffectsForSinkingIntoTheGround(this, play, 0); } } -s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, GlobalContext* globalCtx) { +s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCommand)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, this->actorActionCommand); - if (this->csAction != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->csAction = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { + actionIndex = Cutscene_GetActorActionIndex(play, this->actorActionCommand); + if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { + this->csAction = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_IDLE); @@ -1228,7 +1226,7 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, GlobalContext* globalC case 5: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (globalCtx->csCtx.frames < 280) { + if (play->csCtx.frames < 280) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_WEAKENED1); @@ -1237,7 +1235,7 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, GlobalContext* globalC break; } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); return true; } @@ -1245,10 +1243,10 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, GlobalContext* globalC return false; } -void EnRailgibud_Cutscene_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRailgibud_Cutscene_Update(Actor* thisx, PlayState* play) { EnRailgibud* this = THIS; - this->actionFunc(this, globalCtx); - EnRailgibud_PerformCutsceneActions(this, globalCtx); + this->actionFunc(this, play); + EnRailgibud_PerformCutsceneActions(this, play); SkelAnime_Update(&this->skelAnime); } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index a51fd37d4b..9ff585d6b3 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -6,7 +6,7 @@ struct EnRailgibud; -typedef void (*EnRailgibudActionFunc)(struct EnRailgibud*, GlobalContext*); +typedef void (*EnRailgibudActionFunc)(struct EnRailgibud*, PlayState*); #define ENRAILGIBUD_GET_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x7F) #define ENRAILGIBUD_IS_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x80) diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 583d3637cb..207cf73233 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -10,10 +10,10 @@ #define THIS ((EnRat*)thisx) -void EnRat_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRat_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRat_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRat_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRat_Init(Actor* thisx, PlayState* play); +void EnRat_Destroy(Actor* thisx, PlayState* play); +void EnRat_Update(Actor* thisx, PlayState* play); +void EnRat_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Rat_InitVars = { 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 c24a5e5a9c..8e8f850049 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -29,44 +29,44 @@ #define THIS ((EnRd*)thisx) -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); -s32 EnRd_ShouldNotDance(GlobalContext* globalCtx); +s32 EnRd_ShouldNotDance(PlayState* play); void EnRd_SetupIdle(EnRd* this); -void EnRd_Idle(EnRd* this, GlobalContext* globalCtx); +void EnRd_Idle(EnRd* this, PlayState* play); void EnRd_SetupSquattingDance(EnRd* this); -void EnRd_SquattingDance(EnRd* this, GlobalContext* globalCtx); +void EnRd_SquattingDance(EnRd* this, PlayState* play); void EnRd_SetupClappingDance(EnRd* this); -void EnRd_ClappingDance(EnRd* this, GlobalContext* globalCtx); -void EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose(EnRd* this, GlobalContext* globalCtx); +void EnRd_ClappingDance(EnRd* this, PlayState* play); +void EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose(EnRd* this, PlayState* play); void EnRd_SetupPirouette(EnRd* this); -void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx); -void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, GlobalContext* globalCtx); +void EnRd_Pirouette(EnRd* this, PlayState* play); +void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, PlayState* play); void EnRd_SetupRiseFromCoffin(EnRd* this); -void EnRd_RiseFromCoffin(EnRd* this, GlobalContext* globalCtx); -void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx); -void EnRd_SetupWalkToHome(EnRd* this, GlobalContext* globalCtx); -void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx); +void EnRd_RiseFromCoffin(EnRd* this, PlayState* play); +void EnRd_WalkToPlayer(EnRd* this, PlayState* play); +void EnRd_SetupWalkToHome(EnRd* this, PlayState* play); +void EnRd_WalkToHome(EnRd* this, PlayState* play); void EnRd_SetupWalkToParent(EnRd* this); -void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx); +void EnRd_WalkToParent(EnRd* this, PlayState* play); void EnRd_SetupGrab(EnRd* this); -void EnRd_Grab(EnRd* this, GlobalContext* globalCtx); +void EnRd_Grab(EnRd* this, PlayState* play); void EnRd_SetupAttemptPlayerFreeze(EnRd* this); -void EnRd_AttemptPlayerFreeze(EnRd* this, GlobalContext* globalCtx); +void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play); void EnRd_SetupGrabFail(EnRd* this); -void EnRd_GrabFail(EnRd* this, GlobalContext* globalCtx); +void EnRd_GrabFail(EnRd* this, PlayState* play); void EnRd_SetupTurnAwayAndShakeHead(EnRd* this); -void EnRd_TurnAwayAndShakeHead(EnRd* this, GlobalContext* globalCtx); +void EnRd_TurnAwayAndShakeHead(EnRd* this, PlayState* play); void EnRd_SetupStandUp(EnRd* this); -void EnRd_StandUp(EnRd* this, GlobalContext* globalCtx); +void EnRd_StandUp(EnRd* this, PlayState* play); void EnRd_SetupCrouch(EnRd* this); -void EnRd_Crouch(EnRd* this, GlobalContext* globalCtx); -void EnRd_Damage(EnRd* this, GlobalContext* globalCtx); -void EnRd_Dead(EnRd* this, GlobalContext* globalCtx); -void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx); +void EnRd_Crouch(EnRd* this, PlayState* play); +void EnRd_Damage(EnRd* this, PlayState* play); +void EnRd_Dead(EnRd* this, PlayState* play); +void EnRd_Stunned(EnRd* this, PlayState* play); typedef enum { /* 0 */ EN_RD_ACTION_IDLE, @@ -182,7 +182,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), }; -void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Init(Actor* thisx, PlayState* play) { EnRd* this = THIS; s32 pad; @@ -206,20 +206,20 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { } if (EN_RD_GET_TYPE(&this->actor) > EN_RD_TYPE_GIBDO) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, REDEAD_LIMB_MAX); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, REDEAD_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); if (EN_RD_GET_TYPE(&this->actor) >= EN_RD_TYPE_GIBDO) { switch (EN_RD_GET_TYPE(&this->actor)) { case EN_RD_TYPE_SQUATTING_DANCE: - if (!EnRd_ShouldNotDance(globalCtx)) { + if (!EnRd_ShouldNotDance(play)) { EnRd_SetupSquattingDance(this); } else { this->actor.hintId = 0x2A; @@ -229,7 +229,7 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { break; case EN_RD_TYPE_CLAPPING_DANCE: - if (!EnRd_ShouldNotDance(globalCtx)) { + if (!EnRd_ShouldNotDance(play)) { EnRd_SetupClappingDance(this); } else { this->actor.hintId = 0x2A; @@ -239,7 +239,7 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { break; case EN_RD_TYPE_PIROUETTE: - if (!EnRd_ShouldNotDance(globalCtx)) { + if (!EnRd_ShouldNotDance(play)) { EnRd_SetupPirouette(this); } else { this->actor.hintId = 0x2A; @@ -271,19 +271,19 @@ void EnRd_Init(Actor* thisx, GlobalContext* globalCtx) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_FROZEN) { s32 requiredScopeTemp; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_ICE_POLY, 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, 0xFF4B); } } -void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Destroy(Actor* thisx, PlayState* play) { EnRd* this = THIS; if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** @@ -295,8 +295,8 @@ void EnRd_Destroy(Actor* thisx, GlobalContext* globalCtx) { * are whose parents is thisx. This is used when thisx is fading away to make the * other Redeads stop mourning over it. */ -void EnRd_UpdateParentForOtherRedeads(GlobalContext* globalCtx, Actor* thisx, s32 setParent) { - Actor* enemyIterator = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; +void EnRd_UpdateParentForOtherRedeads(PlayState* play, Actor* thisx, s32 setParent) { + Actor* enemyIterator = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; while (enemyIterator != NULL) { if ((enemyIterator->id != ACTOR_EN_RD) || (enemyIterator == thisx) || @@ -321,9 +321,9 @@ void EnRd_UpdateParentForOtherRedeads(GlobalContext* globalCtx, Actor* thisx, s3 * do not call this function in the final game and thus don't care about * what mask the player has equipped. */ -s32 EnRd_ShouldNotDance(GlobalContext* globalCtx) { - if ((Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) || (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) || - (Player_GetMask(globalCtx) == PLAYER_MASK_GARO)) { +s32 EnRd_ShouldNotDance(PlayState* play) { + if ((Player_GetMask(play) == PLAYER_MASK_GIBDO) || (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) || + (Player_GetMask(play) == PLAYER_MASK_GARO)) { return false; } @@ -335,12 +335,12 @@ s32 EnRd_ShouldNotDance(GlobalContext* globalCtx) { * taking damage, dead, or currently grabbing the player; and if the player is wearing the * appropriate mask, this function will make the Redead start dancing. */ -void EnRd_SetupDanceIfConditionsMet(EnRd* this, GlobalContext* globalCtx) { +void EnRd_SetupDanceIfConditionsMet(EnRd* this, PlayState* play) { if ((EN_RD_GET_TYPE(&this->actor) >= EN_RD_TYPE_SQUATTING_DANCE) && (this->actionFunc != EnRd_SquattingDance) && (this->actionFunc != EnRd_ClappingDance) && (this->actionFunc != EnRd_Pirouette) && (this->actionFunc != EnRd_Stunned) && (this->actionFunc != EnRd_Grab) && (this->actionFunc != EnRd_Damage) && (this->actionFunc != EnRd_Dead)) { - if (!EnRd_ShouldNotDance(globalCtx)) { + if (!EnRd_ShouldNotDance(play)) { this->setupDanceFunc(this); } } @@ -360,7 +360,7 @@ void EnRd_SetupIdle(EnRd* this) { this->actionFunc = 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, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); @@ -399,7 +399,7 @@ void EnRd_Idle(EnRd* this, GlobalContext* globalCtx) { } this->isMourning = false; - if ((this->actor.xzDistToPlayer <= 150.0f) && func_800B715C(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && func_800B715C(play)) { if ((EN_RD_GET_TYPE(&this->actor) != EN_RD_TYPE_CRYING) && (!this->isMourning)) { EnRd_SetupAttemptPlayerFreeze(this); } else { @@ -408,7 +408,7 @@ void EnRd_Idle(EnRd* this, GlobalContext* globalCtx) { } } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -423,7 +423,7 @@ void EnRd_SetupSquattingDance(EnRd* this) { this->actionFunc = EnRd_SquattingDance; } -void EnRd_SquattingDance(EnRd* this, GlobalContext* globalCtx) { +void EnRd_SquattingDance(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->headYRotation, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); @@ -433,7 +433,7 @@ void EnRd_SquattingDance(EnRd* this, GlobalContext* globalCtx) { } this->isMourning = false; - if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(globalCtx) && func_800B715C(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(play) && func_800B715C(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -443,7 +443,7 @@ void EnRd_SquattingDance(EnRd* this, GlobalContext* globalCtx) { this->actionFunc = EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose; } - if (EnRd_ShouldNotDance(globalCtx)) { + if (EnRd_ShouldNotDance(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -452,7 +452,7 @@ void EnRd_SquattingDance(EnRd* this, GlobalContext* globalCtx) { EnRd_SetupIdle(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -467,7 +467,7 @@ void EnRd_SetupClappingDance(EnRd* this) { this->actionFunc = EnRd_ClappingDance; } -void EnRd_ClappingDance(EnRd* this, GlobalContext* globalCtx) { +void EnRd_ClappingDance(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->headYRotation, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); @@ -477,7 +477,7 @@ void EnRd_ClappingDance(EnRd* this, GlobalContext* globalCtx) { } this->isMourning = false; - if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(globalCtx) && func_800B715C(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(play) && func_800B715C(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -487,7 +487,7 @@ void EnRd_ClappingDance(EnRd* this, GlobalContext* globalCtx) { this->actionFunc = EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose; } - if (EnRd_ShouldNotDance(globalCtx)) { + if (EnRd_ShouldNotDance(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -496,14 +496,14 @@ void EnRd_ClappingDance(EnRd* this, GlobalContext* globalCtx) { EnRd_SetupIdle(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } -void EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose(EnRd* this, GlobalContext* globalCtx) { +void EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } @@ -528,7 +528,7 @@ void EnRd_SetupPirouette(EnRd* this) { this->actionFunc = EnRd_Pirouette; } -void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Pirouette(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->headYRotation, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); @@ -538,7 +538,7 @@ void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx) { } this->isMourning = false; - if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(globalCtx) && func_800B715C(globalCtx)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && EnRd_ShouldNotDance(play) && func_800B715C(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -547,7 +547,7 @@ void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx) { this->actionFunc = EnRd_EndPirouetteWhenPlayerIsClose; } - if (EnRd_ShouldNotDance(globalCtx)) { + if (EnRd_ShouldNotDance(play)) { if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_GIBDO) { this->actor.hintId = 0x2D; } else { @@ -556,7 +556,7 @@ void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx) { EnRd_SetupIdle(this); } - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } @@ -570,9 +570,9 @@ void EnRd_Pirouette(EnRd* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, GlobalContext* globalCtx) { +void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((globalCtx->gameplayFrames & 0x5F) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } @@ -603,7 +603,7 @@ void EnRd_SetupRiseFromCoffin(EnRd* this) { this->actionFunc = 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) { @@ -626,7 +626,7 @@ void EnRd_RiseFromCoffin(EnRd* this, GlobalContext* globalCtx) { } } -void EnRd_SetupWalkToPlayer(EnRd* this, GlobalContext* globalCtx) { +void EnRd_SetupWalkToPlayer(EnRd* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gGibdoRedeadWalkAnim); Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 1.0f, 4.0f, frameCount, 1, -4.0f); @@ -635,8 +635,8 @@ void EnRd_SetupWalkToPlayer(EnRd* this, GlobalContext* globalCtx) { this->actionFunc = EnRd_WalkToPlayer; } -void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; s16 yaw = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->headYRotation) - this->upperBodyYRotation; @@ -649,7 +649,7 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } if ((ABS_ALT(yaw) < 0x1554) && (Actor_DistanceBetweenActors(&this->actor, &player->actor) <= 150.0f)) { @@ -658,15 +658,15 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { if (this->playerStunWaitTimer == 0) { if (!(this->flags & EN_RD_FLAG_CANNOT_FREEZE_PLAYER)) { player->actor.freezeTimer = 40; - func_80123E90(globalCtx, &this->actor); - GET_PLAYER(globalCtx)->unk_A78 = &this->actor; + func_80123E90(play, &this->actor); + GET_PLAYER(play)->unk_A78 = &this->actor; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); } this->playerStunWaitTimer = 60; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); } } else { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } } @@ -683,9 +683,9 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { // do so. It will appear to take damage and shake its head side-to-side. EnRd_SetupGrabFail(this); } else { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); } - } else if (globalCtx->grabPlayer(globalCtx, player)) { + } else if (play->grabPlayer(play, player)) { this->actor.flags &= ~ACTOR_FLAG_1; EnRd_SetupGrab(this); } @@ -699,20 +699,20 @@ void EnRd_WalkToPlayer(EnRd* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&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.0f, Animation_GetLastFrame(&gGibdoRedeadWalkAnim), 1, -4.0f); this->action = EN_RD_ACTION_WALKING_TO_HOME; this->actionFunc = 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 sp36 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); @@ -739,7 +739,7 @@ void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx) { (player->transformation != PLAYER_FORM_DEKU) && (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = 0; - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } else if (EN_RD_GET_TYPE(&this->actor) > EN_RD_TYPE_DOES_NOT_MOURN_IF_WALKING) { if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); @@ -750,7 +750,7 @@ void EnRd_WalkToHome(EnRd* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -770,7 +770,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) { s32 pad; s16 yaw; Vec3f parentPos; @@ -793,7 +793,7 @@ void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headYRotation, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); } else { - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } this->actor.world.rot.y = this->actor.shape.rot.y; @@ -801,7 +801,7 @@ void EnRd_WalkToParent(EnRd* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); - } else if ((globalCtx->gameplayFrames & 0x5F) == 0) { + } else if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -816,8 +816,8 @@ void EnRd_SetupGrab(EnRd* this) { this->actionFunc = EnRd_Grab; } -void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_Grab(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -828,7 +828,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { case EN_RD_GRAB_INITIAL_DAMAGE: Animation_PlayLoop(&this->skelAnime, &gGibdoRedeadGrabAttackAnim); this->grabState++; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_8013ECE0(this->actor.xzDistToPlayer, 255, 1, 12); this->grabDamageTimer = 20; @@ -876,7 +876,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { this->grabDamageTimer--; if (this->grabDamageTimer == 0) { - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_8013ECE0(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 20; func_800B8E58(player, player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S); @@ -897,7 +897,7 @@ void EnRd_Grab(EnRd* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; this->playerStunWaitTimer = 10; this->grabWaitTimer = 15; - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); break; } } @@ -909,8 +909,8 @@ void EnRd_SetupAttemptPlayerFreeze(EnRd* this) { this->actionFunc = EnRd_AttemptPlayerFreeze; } -void EnRd_AttemptPlayerFreeze(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 yaw = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->headYRotation) - this->upperBodyYRotation; @@ -918,10 +918,10 @@ void EnRd_AttemptPlayerFreeze(EnRd* this, GlobalContext* globalCtx) { if (!(this->flags & EN_RD_FLAG_CANNOT_FREEZE_PLAYER)) { player->actor.freezeTimer = 60; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); - EnRd_SetupWalkToPlayer(this, globalCtx); + EnRd_SetupWalkToPlayer(this, play); } } @@ -934,7 +934,7 @@ void EnRd_SetupGrabFail(EnRd* this) { this->actionFunc = EnRd_GrabFail; } -void EnRd_GrabFail(EnRd* this, GlobalContext* globalCtx) { +void EnRd_GrabFail(EnRd* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -957,11 +957,11 @@ void EnRd_SetupTurnAwayAndShakeHead(EnRd* this) { this->actionFunc = EnRd_TurnAwayAndShakeHead; } -void EnRd_TurnAwayAndShakeHead(EnRd* this, GlobalContext* globalCtx) { +void EnRd_TurnAwayAndShakeHead(EnRd* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 5, 3500, 200); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->headShakeTimer > 60) { - EnRd_SetupWalkToHome(this, globalCtx); + EnRd_SetupWalkToHome(this, play); this->headShakeTimer = 0; } else { this->headYRotation = Math_SinS(this->headShakeTimer * 4000) * (0x256F * ((60 - this->headShakeTimer) / 60.0f)); @@ -976,7 +976,7 @@ void EnRd_SetupStandUp(EnRd* this) { this->actionFunc = 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); @@ -993,7 +993,7 @@ void EnRd_SetupCrouch(EnRd* this) { this->actionFunc = EnRd_Crouch; } -void EnRd_Crouch(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Crouch(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnRd_SetupIdle(this); } @@ -1012,8 +1012,8 @@ void EnRd_SetupDamage(EnRd* this) { this->actionFunc = EnRd_Damage; } -void EnRd_Damage(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_Damage(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; @@ -1028,9 +1028,9 @@ void EnRd_Damage(EnRd* this, GlobalContext* globalCtx) { if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); } else if (Actor_DistanceToPoint(&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_3F1 = -1; } @@ -1046,9 +1046,9 @@ void EnRd_SetupDead(EnRd* this) { this->actionFunc = EnRd_Dead; } -void EnRd_Dead(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Dead(EnRd* this, PlayState* play) { if (this->actor.category != ACTORCAT_PROP) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } Math_SmoothStepToS(&this->headYRotation, 0, 1, 2000, 0); @@ -1056,13 +1056,13 @@ void EnRd_Dead(EnRd* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->deathTimer == 0) { - if (!Flags_GetSwitch(globalCtx, EN_RD_GET_SWITCH_FLAG(this))) { - Flags_SetSwitch(globalCtx, EN_RD_GET_SWITCH_FLAG(this)); + if (!Flags_GetSwitch(play, EN_RD_GET_SWITCH_FLAG(this))) { + Flags_SetSwitch(play, EN_RD_GET_SWITCH_FLAG(this)); } if (this->alpha != 0) { if (this->alpha == 180) { - EnRd_UpdateParentForOtherRedeads(globalCtx, &this->actor, false); + EnRd_UpdateParentForOtherRedeads(play, &this->actor, false); } this->actor.scale.y -= (75.0f / 1000000.0f); this->alpha -= 5; @@ -1095,7 +1095,7 @@ void EnRd_SetupStunned(EnRd* this) { this->actionFunc = EnRd_Stunned; } -void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx) { +void EnRd_Stunned(EnRd* this, PlayState* play) { if (this->stunTimer > 0) { this->stunTimer--; } @@ -1116,16 +1116,16 @@ void EnRd_Stunned(EnRd* this, GlobalContext* globalCtx) { if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { - EnRd_UpdateParentForOtherRedeads(globalCtx, &this->actor, true); + EnRd_UpdateParentForOtherRedeads(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_SetupDamage(this); } } } -void EnRd_TurnTowardsPlayer(EnRd* this, GlobalContext* globalCtx) { +void EnRd_TurnTowardsPlayer(EnRd* this, PlayState* play) { s16 headAngle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->upperBodyYRotation; s16 upperBodyAngle = CLAMP(headAngle, -500, 500); @@ -1144,9 +1144,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 != EN_RD_ACTION_DAMAGE) && (this->action != EN_RD_ACTION_DEAD) && @@ -1220,29 +1220,29 @@ void EnRd_UpdateDamage(EnRd* this, GlobalContext* globalCtx) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { - EnRd_UpdateParentForOtherRedeads(globalCtx, &this->actor, true); + EnRd_UpdateParentForOtherRedeads(play, &this->actor, true); EnRd_SetupDead(this); - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x90); } else { EnRd_SetupDamage(this); } } } -void EnRd_UpdateCollision(EnRd* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRd_UpdateCollision(EnRd* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actor.colChkInfo.health > 0) && (this->action != EN_RD_ACTION_GRABBING)) { 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 != EN_RD_ACTION_DAMAGE) || ((player->unk_ADC != 0) && (player->unk_ADD != this->unk_3F1))) && ((this->actionFunc != EnRd_Stunned) || (this->stunTimer == 0))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } -void EnRd_UpdateEffect(EnRd* this, GlobalContext* globalCtx) { +void EnRd_UpdateEffect(EnRd* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -1255,10 +1255,10 @@ void EnRd_UpdateEffect(EnRd* this, GlobalContext* globalCtx) { } } -void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRd_Update(Actor* thisx, PlayState* play) { EnRd* this = THIS; - EnRd_UpdateDamage(this, globalCtx); + EnRd_UpdateDamage(this, play); if ((gSaveContext.sunsSongState != SUNSSONG_INACTIVE) && (!this->stunnedBySunsSong)) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; } @@ -1269,7 +1269,7 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { this->playerStunWaitTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->action != EN_RD_ACTION_GRABBING) && (this->actor.speedXZ != 0.0f)) { Actor_MoveWithGravity(&this->actor); @@ -1277,23 +1277,23 @@ void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.shape.rot.x == 0) && (this->action != EN_RD_ACTION_GRABBING) && (this->actor.speedXZ != 0.0f)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); } if (this->action == EN_RD_ACTION_ATTEMPTING_PLAYER_STUN) { - EnRd_TurnTowardsPlayer(this, globalCtx); + EnRd_TurnTowardsPlayer(this, play); } } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 50.0f; - EnRd_UpdateCollision(this, globalCtx); - EnRd_SetupDanceIfConditionsMet(this, globalCtx); - EnRd_UpdateEffect(this, globalCtx); + EnRd_UpdateCollision(this, play); + EnRd_SetupDanceIfConditionsMet(this, play); + EnRd_UpdateEffect(this, play); } -s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnRd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnRd* this = THIS; @@ -1305,7 +1305,7 @@ s32 EnRd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnRd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnRd* this = THIS; if ((this->drawDmgEffTimer != 0) && @@ -1322,43 +1322,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_808D7138 = { 0.25f, 0.25f, 0.25f }; s32 pad; EnRd* this = THIS; Vec3f sp54 = this->actor.world.pos; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->limbIndex = 0; if (this->alpha == 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, - &this->actor, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, &this->actor, POLY_OPA_DISP); - func_800BC620(&sp54, &D_808D7138, 255, globalCtx); + func_800BC620(&sp54, &D_808D7138, 255, play); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); - func_800BC620(&sp54, &D_808D7138, this->alpha, globalCtx); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRd_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); + func_800BC620(&sp54, &D_808D7138, this->alpha, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } } 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 7bf5a6ddc7..94076046af 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*); typedef void (*EnRdSetupDanceFunc)(struct EnRd*); #define EN_RD_GET_80(thisx) ((thisx)->params & 0x80) diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index 94f6976012..8e2f06ff40 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -11,15 +11,15 @@ #define THIS ((EnRecepgirl*)thisx) -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRecepgirl_Init(Actor* thisx, PlayState* play); +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play); +void EnRecepgirl_Update(Actor* thisx, PlayState* play); +void EnRecepgirl_Draw(Actor* thisx, PlayState* play); void EnRecepgirl_SetupWait(EnRecepgirl* this); -void EnRecepgirl_Wait(EnRecepgirl* this, GlobalContext* globalCtx); +void EnRecepgirl_Wait(EnRecepgirl* this, PlayState* play); void EnRecepgirl_SetupTalk(EnRecepgirl* this); -void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx); +void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play); const ActorInit En_Recepgirl_InitVars = { ACTOR_EN_RECEPGIRL, @@ -43,13 +43,13 @@ static InitChainEntry sInitChain[] = { static s32 texturesDesegmented = false; -void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Init(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bg_Skel_011B60, &object_bg_Anim_009890, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bg_Skel_011B60, &object_bg_Anim_009890, this->jointTable, this->morphTable, 24); if (!texturesDesegmented) { @@ -61,7 +61,7 @@ void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeTexIndex = 2; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; // hear directions again? } else { this->actor.textId = 0x2AD9; // "Welcome..." @@ -70,7 +70,7 @@ void EnRecepgirl_Init(Actor* thisx, GlobalContext* globalCtx) { EnRecepgirl_SetupWait(this); } -void EnRecepgirl_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Destroy(Actor* thisx, PlayState* play) { } void EnRecepgirl_UpdateEyes(EnRecepgirl* this) { @@ -91,7 +91,7 @@ void EnRecepgirl_SetupWait(EnRecepgirl* this) { this->actionFunc = EnRecepgirl_Wait; } -void EnRecepgirl_Wait(EnRecepgirl* this, GlobalContext* globalCtx) { +void EnRecepgirl_Wait(EnRecepgirl* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->skelAnime.animation == &object_bg_Anim_00A280) { Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f); @@ -100,13 +100,13 @@ void EnRecepgirl_Wait(EnRecepgirl* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnRecepgirl_SetupTalk(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_800B8614(&this->actor, globalCtx, 60.0f); - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + func_800B8614(&this->actor, play, 60.0f); + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { this->actor.textId = 0x2367; // "... doesn't Kafei want to break off his engagement ... ?" - } else if (Flags_GetSwitch(globalCtx, this->actor.params)) { + } else if (Flags_GetSwitch(play, this->actor.params)) { this->actor.textId = 0x2ADC; // hear directions again? } else { this->actor.textId = 0x2AD9; // "Welcome..." @@ -119,7 +119,7 @@ void EnRecepgirl_SetupTalk(EnRecepgirl* this) { this->actionFunc = EnRecepgirl_Talk; } -void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx) { +void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { u8 talkState; if (SkelAnime_Update(&this->skelAnime)) { @@ -140,13 +140,13 @@ void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx) { } } - talkState = Message_GetState(&globalCtx->msgCtx); + talkState = Message_GetState(&play->msgCtx); if (talkState == 2) { this->actor.textId = 0x2ADC; // hear directions again? EnRecepgirl_SetupWait(this); - } else if ((talkState == 5) && Message_ShouldAdvance(globalCtx)) { + } else if ((talkState == 5) && Message_ShouldAdvance(play)) { if (this->actor.textId == 0x2AD9) { // "Welcome..." - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting @@ -168,22 +168,21 @@ void EnRecepgirl_Talk(EnRecepgirl* this, GlobalContext* globalCtx) { this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment } } - func_80151938(globalCtx, this->actor.textId); + func_80151938(play, this->actor.textId); } } -void EnRecepgirl_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Update(Actor* thisx, PlayState* play) { s32 pad; EnRecepgirl* this = THIS; Vec3s sp30; - this->actionFunc(this, globalCtx); - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRot, &sp30, this->actor.focus.pos); + this->actionFunc(this, play); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &sp30, this->actor.focus.pos); EnRecepgirl_UpdateEyes(this); } -s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnRecepgirl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -192,7 +191,7 @@ s32 EnRecepgirl_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnRecepgirl_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnRecepgirl_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnRecepgirl* this = THIS; if (limbIndex == 5) { @@ -201,17 +200,17 @@ void EnRecepgirl_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Acto } } -void EnRecepgirl_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRecepgirl_Draw(Actor* thisx, PlayState* play) { EnRecepgirl* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->eyeTexIndex]); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRecepgirl_OverrideLimbDraw, NULL, EnRecepgirl_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h index a6b858192b..b6684fc9e7 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.h @@ -5,7 +5,7 @@ struct EnRecepgirl; -typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, GlobalContext*); +typedef void (*EnRecepgirlActionFunc)(struct EnRecepgirl*, PlayState*); typedef struct EnRecepgirl { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 43042ccd05..2415993b1c 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -12,13 +12,13 @@ #define THIS ((EnRg*)thisx) -void EnRg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRg_Init(Actor* thisx, PlayState* play); +void EnRg_Destroy(Actor* thisx, PlayState* play); +void EnRg_Update(Actor* thisx, PlayState* play); +void EnRg_Draw(Actor* thisx, PlayState* play); -void func_80BF4EBC(EnRg* this, GlobalContext* globalCtx); -void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx); +void func_80BF4EBC(EnRg* this, PlayState* play); +void func_80BF4FC4(EnRg* this, PlayState* play); s32 D_80BF5C10; @@ -156,15 +156,15 @@ TexturePtr D_80BF59F8[] = { gGoronEyeOpenTex, gGoronEyeHalfTex, gGoronEyeClosedTex, gGoronEyeHalfTex, gGoronEyeClosed2Tex, }; -void func_80BF3920(EnRgStruct* ptr, GlobalContext* globalCtx) { +void func_80BF3920(EnRgStruct* ptr, PlayState* play) { f32 temp_f20; u8 phi_fp = false; s32 i; s32 idx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 32; i++, ptr++) { if ((ptr->unk_00 >= 4) && (ptr->unk_00 < 7)) { @@ -176,7 +176,7 @@ void func_80BF3920(EnRgStruct* ptr, GlobalContext* globalCtx) { Matrix_Push(); - if (globalCtx) {} + if (play) {} temp_f20 = (f32)ptr->unk_02 / ptr->unk_01; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, D_80BF5954[ptr->unk_00 - 4].r, D_80BF5954[ptr->unk_00 - 4].g, @@ -186,10 +186,9 @@ void func_80BF3920(EnRgStruct* ptr, GlobalContext* globalCtx) { Matrix_Translate(ptr->unk_10.x, ptr->unk_10.y, ptr->unk_10.z, MTXMODE_NEW); Matrix_Scale(ptr->unk_34, ptr->unk_34, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = temp_f20 * 7.0f; gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BF5934[idx])); gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL); @@ -198,7 +197,7 @@ void func_80BF3920(EnRgStruct* ptr, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80BF3C64(EnRg* this) { @@ -223,36 +222,36 @@ void func_80BF3C64(EnRg* this) { } } -void func_80BF3DA0(EnRg* this, GlobalContext* globalCtx) { - func_80BF3920(this->unk_34C, globalCtx); +void func_80BF3DA0(EnRg* this, PlayState* play) { + func_80BF3920(this->unk_34C, play); } -void func_80BF3DC4(EnRg* this, GlobalContext* globalCtx) { +void func_80BF3DC4(EnRg* this, PlayState* play) { this->collider2.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider2.dim.worldSphere.center.y = this->actor.world.pos.y + this->actor.shape.yOffset; this->collider2.dim.worldSphere.center.z = this->actor.world.pos.z; if (this->actor.speedXZ >= 10.0f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } -void func_80BF3E88(EnRg* this, GlobalContext* globalCtx) { +void func_80BF3E88(EnRg* this, PlayState* play) { Math_Vec3f_ToVec3s(&this->collider1.dim.pos, &this->actor.world.pos); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } -void func_80BF3ED4(EnRg* this, GlobalContext* globalCtx) { +void func_80BF3ED4(EnRg* this, PlayState* play) { if (this->unk_310 & 0x10) { - func_80BF3DC4(this, globalCtx); + func_80BF3DC4(this, play); } else { - func_80BF3E88(this, globalCtx); + func_80BF3E88(this, play); } } -s32 func_80BF3F14(EnRg* this, GlobalContext* globalCtx) { +s32 func_80BF3F14(EnRg* this, PlayState* play) { this->unk_310 &= ~0x20; this->unk_310 &= ~0x40; this->unk_310 &= ~0x80; @@ -283,8 +282,8 @@ void func_80BF3FF8(EnRg* this) { SkelAnime_Update(&this->skelAnime); } -s32 func_80BF4024(EnRg* this, GlobalContext* globalCtx) { - if ((globalCtx->csCtx.state == 0) && (this->unk_334 == 1)) { +s32 func_80BF4024(EnRg* this, PlayState* play) { + if ((play->csCtx.state == 0) && (this->unk_334 == 1)) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_CIRCLE); } @@ -318,10 +317,10 @@ void func_80BF40F4(EnRg* this) { } } -s32 func_80BF416C(EnRg* this, GlobalContext* globalCtx) { +s32 func_80BF416C(EnRg* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ >= 0.01f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_ROLLING - SFX_FLAG); - func_800AE930(&globalCtx->colCtx, Effect_GetByIndex(this->unk_340), &this->actor.world.pos, 18.0f, + func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_340), &this->actor.world.pos, 18.0f, this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } else { func_800AEF44(Effect_GetByIndex(this->unk_340)); @@ -329,14 +328,14 @@ s32 func_80BF416C(EnRg* this, GlobalContext* globalCtx) { return false; } -s32 func_80BF4220(EnRg* this, GlobalContext* globalCtx, Actor* arg2) { +s32 func_80BF4220(EnRg* this, PlayState* play, Actor* arg2) { CollisionPoly* sp44 = NULL; s32 sp40; Vec3f sp34; if (Actor_ActorAIsFacingAndNearActorB(&this->actor, arg2, 400.0f, 0x2000) && - !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &arg2->world.pos, &sp34, &sp44, true, - false, false, true, &sp40)) { + !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &arg2->world.pos, &sp34, &sp44, true, false, + false, true, &sp40)) { return true; } return false; @@ -396,8 +395,8 @@ s32 func_80BF43FC(EnRg* this) { return phi_s4; } -s32 func_80BF4560(EnRg* this, GlobalContext* globalCtx) { - s32 temp_v0 = SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); +s32 func_80BF4560(EnRg* this, PlayState* play) { + s32 temp_v0 = SurfaceType_GetSceneExitIndex(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((temp_v0 < 4) || (temp_v0 >= 19)) { temp_v0 = -1; @@ -456,8 +455,8 @@ s32 func_80BF45B4(EnRg* this) { return ret; } -s32 func_80BF47AC(EnRg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BF47AC(EnRg* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 phi_f0; f32 phi_f2; @@ -545,17 +544,17 @@ void func_80BF4964(EnRg* this) { } } -void func_80BF4AB8(EnRg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BF4AB8(EnRg* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* phi_s0; phi_s0 = NULL; if (!(this->unk_310 & 0x800)) { if (this->unk_320 == 0) { do { - phi_s0 = SubS_FindActor(globalCtx, phi_s0, 6, ACTOR_OBJ_TSUBO); + phi_s0 = SubS_FindActor(play, phi_s0, 6, ACTOR_OBJ_TSUBO); if (phi_s0 != NULL) { - if (func_80BF4220(this, globalCtx, phi_s0) && (phi_s0->update != NULL)) { + if (func_80BF4220(this, play, phi_s0) && (phi_s0->update != NULL)) { this->unk_18C = phi_s0; this->unk_310 |= 0x800; break; @@ -566,12 +565,12 @@ void func_80BF4AB8(EnRg* this, GlobalContext* globalCtx) { } if ((phi_s0 == NULL) && (D_80BF5C10 == 0) && (this->unk_326 == 0) && (player->stateFlags3 & 0x80000) && - (player->invincibilityTimer == 0) && func_80BF4220(this, globalCtx, &player->actor)) { + (player->invincibilityTimer == 0) && func_80BF4220(this, play, &player->actor)) { this->unk_18C = &player->actor; this->unk_310 |= 0x800; D_80BF5C10 = 1; } - } else if ((this->unk_18C != NULL) && !func_80BF4220(this, globalCtx, this->unk_18C)) { + } else if ((this->unk_18C != NULL) && !func_80BF4220(this, play, this->unk_18C)) { if (this->unk_18C->id == ACTOR_PLAYER) { D_80BF5C10 = 0; } @@ -650,7 +649,7 @@ s32 func_80BF4DA8(EnRg* this) { return ret; } -void func_80BF4EBC(EnRg* this, GlobalContext* globalCtx) { +void func_80BF4EBC(EnRg* this, PlayState* play) { if (this->unk_310 & 0x100) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_310 &= ~0x100; @@ -669,13 +668,13 @@ void func_80BF4EBC(EnRg* this, GlobalContext* globalCtx) { this->unk_318 = Rand_S16Offset(0, 20); } } - SubS_FillLimbRotTables(globalCtx, this->unk_32E, this->unk_328, ARRAY_COUNT(this->unk_328)); + SubS_FillLimbRotTables(play, this->unk_32E, this->unk_328, ARRAY_COUNT(this->unk_328)); } -void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx) { - this->unk_344 = func_80BF4560(this, globalCtx); +void func_80BF4FC4(EnRg* this, PlayState* play) { + this->unk_344 = func_80BF4560(this, play); - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { if (this->actor.bgCheckFlags & 2) { if (this->unk_310 & 0x400) { this->unk_310 &= ~0x400; @@ -700,10 +699,10 @@ void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx) { if (gSaveContext.eventInf[1] & 1) { if (DECR(this->unk_318) == 0) { - func_80BF47AC(this, globalCtx); + func_80BF47AC(this, play); if ((this->unk_324 == 0) && !func_80BF4DA8(this)) { - func_80BF4AB8(this, globalCtx); + func_80BF4AB8(this, play); } if (func_80BF45B4(this)) { @@ -714,7 +713,7 @@ void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx) { func_80BF4964(this); Actor_UpdateVelocityWithGravity(&this->actor); Actor_UpdatePos(&this->actor); - func_80BF416C(this, globalCtx); + func_80BF416C(this, play); return; } } @@ -722,26 +721,26 @@ void func_80BF4FC4(EnRg* this, GlobalContext* globalCtx) { } } -void EnRg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRg_Init(Actor* thisx, PlayState* play) { EnRg* this = THIS; if (gSaveContext.save.entranceIndex == 0xD010) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); this->unk_334 = -1; func_80BF409C(this, 0); this->skelAnime.curFrame = this->skelAnime.endFrame; - Collider_InitAndSetSphere(globalCtx, &this->collider2, &this->actor, &sSphereInit); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit); + Collider_InitAndSetSphere(play, &this->collider2, &this->actor, &sSphereInit); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); this->collider2.dim.worldSphere.radius = this->collider2.dim.modelSphere.radius; CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Effect_Add(globalCtx, &this->unk_340, EFFECT_TIRE_MARK, 0, 0, &D_80BF59F0); + Effect_Add(play, &this->unk_340, EFFECT_TIRE_MARK, 0, 0, &D_80BF59F0); - this->path = SubS_GetDayDependentPath(globalCtx, ENRG_GET_7F80(&this->actor), 255, &this->unk_33C); + this->path = SubS_GetDayDependentPath(play, ENRG_GET_7F80(&this->actor), 255, &this->unk_33C); if (this->path != NULL) { this->unk_33C = 1; } @@ -763,46 +762,46 @@ void EnRg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRg_Destroy(Actor* thisx, PlayState* play) { EnRg* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroySphere(globalCtx, &this->collider2); - Effect_Destroy(globalCtx, this->unk_340); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroySphere(play, &this->collider2); + Effect_Destroy(play, this->unk_340); } -void EnRg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRg_Update(Actor* thisx, PlayState* play) { EnRg* this = THIS; - func_80BF3F14(this, globalCtx); + func_80BF3F14(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.rot.y = this->actor.world.rot.y; if (!(this->unk_310 & 0x10)) { func_80BF40F4(this); func_80BF3FF8(this); - func_80BF4024(this, globalCtx); + func_80BF4024(this, play); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 0.0f, 0x1D); if (this->actor.floorHeight <= BGCHECK_Y_MIN) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); } - func_80BF3ED4(this, globalCtx); + func_80BF3ED4(this, play); - if (!Play_InCsMode(globalCtx)) { + if (!Play_InCsMode(play)) { func_80BF3C64(this); } } -void func_80BF547C(EnRg* this, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80BF547C(EnRg* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + this->actor.shape.yOffset, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); @@ -812,13 +811,13 @@ void func_80BF547C(EnRg* this, GlobalContext* globalCtx) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronRolledUpDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 func_80BF5588(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80BF5588(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRg* this = THIS; s32 phi_v0; @@ -848,22 +847,22 @@ s32 func_80BF5588(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void EnRg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRg_Draw(Actor* thisx, PlayState* play) { EnRg* this = THIS; if (!(this->unk_310 & 0x10)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BF59F8[this->unk_31E])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80BF5588, NULL, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80BF5588, NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - func_80BF547C(this, globalCtx); + func_80BF547C(this, play); } - func_80BF3DA0(this, globalCtx); + func_80BF3DA0(this, play); } diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.h b/src/overlays/actors/ovl_En_Rg/z_en_rg.h index 9f7e60ba48..f3a7bd54dc 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.h +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.h @@ -5,7 +5,7 @@ struct EnRg; -typedef void (*EnRgActionFunc)(struct EnRg*, GlobalContext*); +typedef void (*EnRgActionFunc)(struct EnRg*, PlayState*); #define ENRG_GET_7F80(thisx) ((((thisx)->params & 0x7F80) >> 7) & 0xFF) 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 2084130cec..b164e6aaba 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 @@ -10,9 +10,9 @@ #define THIS ((EnRiverSound*)thisx) -void EnRiverSound_Init(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_Update(Actor* thisx, PlayState* play); +void EnRiverSound_Draw(Actor* thisx, PlayState* play); const ActorInit En_River_Sound_InitVars = { ACTOR_EN_RIVER_SOUND, @@ -26,7 +26,7 @@ const ActorInit En_River_Sound_InitVars = { (ActorFunc)EnRiverSound_Draw, }; -void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Init(Actor* thisx, PlayState* play) { s32 pad; EnRiverSound* this = THIS; Path* path; @@ -40,18 +40,18 @@ void EnRiverSound_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - path = &globalCtx->setupPathList[pathIndex]; + path = &play->setupPathList[pathIndex]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->numPoints = path->count; } -void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Update(Actor* thisx, PlayState* play) { EnRiverSound* this = THIS; Vec3f* worldPos = &this->actor.world.pos; Vec3f eye; s32 bgId; - Math_Vec3f_Copy(&eye, &globalCtx->view.eye); + Math_Vec3f_Copy(&eye, &play->view.eye); if (this->actor.params < RS_RIVER_DEFAULT_LOW_FREQ) { // All sfx from river_sound that accesses gAudioEnvironmentalSfx is associated with a closed-loop @@ -59,9 +59,9 @@ void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_GetClosestPosOnPath(this->pathPoints, this->numPoints, &eye, worldPos, true); } else { Actor_GetClosestPosOnPath(this->pathPoints, this->numPoints, &eye, worldPos, false); - if (BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, worldPos) != + if (BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, worldPos) != BGCHECK_Y_MIN) { - this->soundFreqIndex = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, this->actor.floorPoly, bgId); + this->soundFreqIndex = SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, bgId); } else { this->soundFreqIndex = 0; } @@ -76,7 +76,7 @@ void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRiverSound_Draw(Actor* thisx, PlayState* play) { static f32 freqScale[] = { 0.7f, // 1 / sqrt(2) 1.0f, // 1 diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 2ad27aab5c..91b48f7d4b 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -11,21 +11,21 @@ #define THIS ((EnRr*)thisx) -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 func_808FAF94(EnRr* this, GlobalContext* globalCtx); -void func_808FB088(EnRr* this, GlobalContext* globalCtx); -void func_808FB1C0(EnRr* this, GlobalContext* globalCtx); -void func_808FB2C0(EnRr* this, GlobalContext* globalCtx); -void func_808FB42C(EnRr* this, GlobalContext* globalCtx); -void func_808FB680(EnRr* this, GlobalContext* globalCtx); -void func_808FB710(EnRr* this, GlobalContext* globalCtx); +void func_808FAF94(EnRr* this, PlayState* play); +void func_808FB088(EnRr* this, PlayState* play); +void func_808FB1C0(EnRr* this, PlayState* play); +void func_808FB2C0(EnRr* this, PlayState* play); +void func_808FB42C(EnRr* this, PlayState* play); +void func_808FB680(EnRr* this, PlayState* play); +void func_808FB710(EnRr* this, PlayState* play); -void func_808FAD1C(EnRr* this, GlobalContext* globalCtx); -void func_808FB398(EnRr* this, GlobalContext* globalCtx); +void func_808FAD1C(EnRr* this, PlayState* play); +void func_808FB398(EnRr* this, PlayState* play); const ActorInit En_Rr_InitVars = { ACTOR_EN_RR, @@ -124,13 +124,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void EnRr_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Init(Actor* thisx, PlayState* play) { s32 pad; EnRr* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); if (this->actor.params != ENRR_3) { this->actor.scale.y = 0.015f; this->actor.scale.x = 0.019f; @@ -158,17 +158,17 @@ void EnRr_Init(Actor* thisx, GlobalContext* globalCtx) { } this->actionFunc = func_808FAF94; - func_808FAD1C(this, globalCtx); + func_808FAD1C(this, play); } -void EnRr_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Destroy(Actor* thisx, PlayState* play) { EnRr* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void func_808FA01C(EnRr* this, GlobalContext* globalCtx, ColliderCylinder* collider) { +void func_808FA01C(EnRr* this, PlayState* play, ColliderCylinder* collider) { if (this->actor.colChkInfo.damageEffect == 2) { this->drawDmgEffScale = 0.85f; this->drawDmgEffAlpha = 4.0f; @@ -177,7 +177,7 @@ void func_808FA01C(EnRr* this, GlobalContext* globalCtx, ColliderCylinder* colli this->drawDmgEffScale = 0.85f; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, collider->info.bumper.hitPos.y, collider->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } else if (this->actor.colChkInfo.damageEffect == 5) { @@ -199,14 +199,14 @@ void func_808FA11C(EnRr* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_808FA19C(EnRr* this, GlobalContext* globalCtx) { +void func_808FA19C(EnRr* this, PlayState* play) { this->unk_1EE = 0; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider1.base.colType = COLTYPE_HIT0; this->collider1.info.elemType = ELEMTYPE_UNK1; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 20, 2, this->actor.scale.y * 23.333334f, + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 20, 2, this->actor.scale.y * 23.333334f, this->actor.scale.y * 20.000002f); this->actor.flags |= ACTOR_FLAG_400; } @@ -288,8 +288,8 @@ void func_808FA3F8(EnRr* this, Player* player) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SUISEN_DRINK); } -void func_808FA4F4(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808FA4F4(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); u32 sp38; s32 sp34; f32 sp30; @@ -307,13 +307,13 @@ void func_808FA4F4(EnRr* this, GlobalContext* globalCtx) { if (((this->unk_1E2 == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) && (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) == 1)) { sp34 = true; - this->unk_1E2 = Inventory_DeleteEquipment(globalCtx, 1); + this->unk_1E2 = Inventory_DeleteEquipment(play, 1); } else { sp34 = false; } - if (sp34 && (Message_GetState(&globalCtx->msgCtx) == 0)) { - Message_StartTextbox(globalCtx, 0xF6, NULL); + if (sp34 && (Message_GetState(&play->msgCtx) == 0)) { + Message_StartTextbox(play, 0xF6, NULL); } if (this->actor.params == ENRR_0) { @@ -329,7 +329,7 @@ void func_808FA4F4(EnRr* this, GlobalContext* globalCtx) { player->actor.world.pos.y += sp2C; player->actor.world.pos.z += sp30 * Math_CosS(this->actor.shape.rot.y); - func_800B8D50(globalCtx, &this->actor, sp30, this->actor.shape.rot.y, sp2C, sp38); + func_800B8D50(play, &this->actor, sp30, this->actor.shape.rot.y, sp2C, sp38); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SUISEN_THROW); } } @@ -442,7 +442,7 @@ void func_808FA9CC(EnRr* this) { this->actionFunc = func_808FB710; } -s32 func_808FAA94(EnRr* this, GlobalContext* globalCtx) { +s32 func_808FAA94(EnRr* this, PlayState* play) { ColliderCylinder* sp2C; s32 flag = (this->collider1.base.acFlags & AC_HIT) != 0; @@ -466,18 +466,18 @@ s32 func_808FAA94(EnRr* this, GlobalContext* globalCtx) { } Actor_SetDropFlag(&this->actor, &sp2C->info); - func_808FA4F4(this, globalCtx); - func_808FA19C(this, globalCtx); + func_808FA4F4(this, play); + func_808FA19C(this, play); if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.colChkInfo.damageEffect == 3) { func_808FA11C(this); this->collider1.base.acFlags &= ~AC_ON; this->collider2.base.acFlags &= ~AC_ON; func_808FA9CC(this); } else { - func_808FA01C(this, globalCtx, sp2C); + func_808FA01C(this, play, sp2C); func_808FA910(this); } } else if (this->actor.colChkInfo.damageEffect == 1) { @@ -489,7 +489,7 @@ s32 func_808FAA94(EnRr* this, GlobalContext* globalCtx) { func_808FA11C(this); func_808FA9CC(this); } else { - func_808FA01C(this, globalCtx, sp2C); + func_808FA01C(this, play, sp2C); func_808FA6B8(this); } return true; @@ -497,20 +497,20 @@ s32 func_808FAA94(EnRr* this, GlobalContext* globalCtx) { return false; } -void func_808FAC80(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808FAC80(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->unk_1F0 == 0) && ((this->collider2.base.atFlags & AT_HIT) || (this->collider1.base.atFlags & AT_HIT))) { this->collider1.base.atFlags &= ~AT_HIT; this->collider2.base.atFlags &= ~AT_HIT; - if (globalCtx->grabPlayer(globalCtx, player)) { + if (play->grabPlayer(play, player)) { player->actor.parent = &this->actor; func_808FA3F8(this, player); } } } -void func_808FAD1C(EnRr* this, GlobalContext* globalCtx) { +void func_808FAD1C(EnRr* this, PlayState* play) { s32 i; EnRrStruct* ptr; @@ -541,7 +541,7 @@ void func_808FAD1C(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FAE50(EnRr* this, GlobalContext* globalCtx) { +void func_808FAE50(EnRr* this, PlayState* play) { s32 i; EnRrStruct* ptr; @@ -565,12 +565,12 @@ void func_808FAE50(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FAF94(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808FAF94(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 10, 500, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->unk_1E6 == 0) && !(player->stateFlags2 & 0x80) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && + if ((this->unk_1E6 == 0) && !(player->stateFlags2 & 0x80) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < (8421.053f * this->actor.scale.x))) { func_808FA260(this); } else if ((this->actor.xzDistToPlayer < 400.0f) && (this->actor.speedXZ == 0.0f)) { @@ -578,10 +578,10 @@ void func_808FAF94(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB088(EnRr* this, GlobalContext* globalCtx) { +void func_808FB088(EnRr* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 10, 500, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) { + if (Player_GetMask(play) == PLAYER_MASK_STONE) { func_808FA344(this); return; } @@ -625,8 +625,8 @@ void func_808FB088(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB1C0(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808FB1C0(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_8013ECE0(this->actor.xyzDistToPlayerSq, 120, 2, 120); if (!(this->unk_1E4 & 7)) { @@ -647,8 +647,8 @@ void func_808FB1C0(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB2C0(EnRr* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808FB2C0(EnRr* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1E6--; player->unk_AE8 = 0; @@ -658,12 +658,12 @@ void func_808FB2C0(EnRr* this, GlobalContext* globalCtx) { Math_StepToF(&this->unk_218, -(f32)this->collider1.dim.height, 5.0f); if (this->unk_1E6 == 0) { this->unk_1E1 = 0; - func_808FA4F4(this, globalCtx); + func_808FA4F4(this, play); func_808FA344(this); } } -void func_808FB398(EnRr* this, GlobalContext* globalCtx) { +void func_808FB398(EnRr* this, PlayState* play) { s32 i; s16 phi_v1; @@ -692,7 +692,7 @@ void func_808FB398(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB42C(EnRr* this, GlobalContext* globalCtx) { +void func_808FB42C(EnRr* this, PlayState* play) { s32 pad; s32 i; EnRrStruct* ptr; @@ -710,9 +710,9 @@ void func_808FB42C(EnRr* this, GlobalContext* globalCtx) { if (this->unk_1E4 >= 95) { if (this->unk_1E2 != 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SHIELD_HERO); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SHIELD_HERO); } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); Actor_MarkForDeath(&this->actor); } else if (this->unk_1E4 == 88) { Vec3f sp74; @@ -720,8 +720,8 @@ void func_808FB42C(EnRr* this, GlobalContext* globalCtx) { sp74.x = this->actor.world.pos.x; sp74.y = this->actor.world.pos.y + 20.0f; sp74.z = this->actor.world.pos.z; - func_800B3030(globalCtx, &sp74, &gZeroVec3f, &gZeroVec3f, 100, 0, 0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp74, 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &sp74, &gZeroVec3f, &gZeroVec3f, 100, 0, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &sp74, 11, NA_SE_EN_EXTINCT); } else { temp_f20 = this->actor.scale.y * 66.66667f; @@ -731,7 +731,7 @@ void func_808FB42C(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB680(EnRr* this, GlobalContext* globalCtx) { +void func_808FB680(EnRr* this, PlayState* play) { if (this->unk_1E6 == 0) { this->actionFunc = func_808FAF94; } else { @@ -743,31 +743,31 @@ void func_808FB680(EnRr* this, GlobalContext* globalCtx) { } } -void func_808FB710(EnRr* this, GlobalContext* globalCtx) { +void func_808FB710(EnRr* this, PlayState* play) { this->unk_1EE--; if (this->unk_1EE == 0) { - func_808FA19C(this, globalCtx); + func_808FA19C(this, play); func_808FA870(this); this->actionFunc = func_808FAF94; } else if ((this->actor.colChkInfo.health == 0) && (this->unk_1EE == 77)) { - func_808FA19C(this, globalCtx); + func_808FA19C(this, play); func_808FA910(this); } } -void func_808FB794(EnRr* this, GlobalContext* globalCtx) { +void func_808FB794(EnRr* this, PlayState* play) { Vec3f sp2C; if ((this->actor.depthInWater < this->collider1.dim.height) && (this->actor.depthInWater > 1.0f) && - ((globalCtx->gameplayFrames % 9) == 0)) { + ((play->gameplayFrames % 9) == 0)) { sp2C.x = this->actor.world.pos.x; sp2C.y = this->actor.world.pos.y + this->actor.depthInWater; sp2C.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp2C, this->actor.scale.x * 34210.527f, this->actor.scale.x * 60526.316f, 0); + EffectSsGRipple_Spawn(play, &sp2C, this->actor.scale.x * 34210.527f, this->actor.scale.x * 60526.316f, 0); } } -void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRr_Update(Actor* thisx, PlayState* play) { EnRr* this = THIS; EnRrStruct* ptr; s32 i; @@ -787,13 +787,13 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, this->actor.scale.y * 2000.0f); - func_808FAE50(this, globalCtx); + func_808FAE50(this, play); - if (!func_808FAA94(this, globalCtx)) { - func_808FAC80(this, globalCtx); + if (!func_808FAA94(this, play)) { + func_808FAC80(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.params == ENRR_2) { this->actor.speedXZ = 0.0f; @@ -802,11 +802,11 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, this->collider1.dim.radius, 0.0f, 0x5D); - func_808FB794(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider1.dim.radius, 0.0f, 0x5D); + func_808FB794(this, play); if (this->unk_1FC > 0) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags2 & 0x80)) { this->unk_1FC--; @@ -819,11 +819,11 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider1); if ((this->actionFunc != func_808FB42C) && (this->actionFunc != func_808FB398)) { - 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->unk_1F0 == 0) && (this->actionFunc == func_808FB088) && (this->unk_1EE == 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } else { this->collider2.base.atFlags &= ~AT_HIT; this->collider1.base.atFlags &= ~AT_HIT; @@ -835,7 +835,7 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider1.base.acFlags &= ~AC_HIT; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->unk_1EE == 0) { Math_ScaledStepToS(&this->unk_1F4, this->unk_1F6, 50); @@ -866,8 +866,8 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnRr_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnRr* this = THIS; Mtx* matrix; Vec3f* vecPtr; @@ -876,16 +876,16 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx2) { Vec3f spA4; f32 temp_f20; - matrix = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Mtx) * 4); + matrix = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 4); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x0C, matrix); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (this->unk_1E8 * 0) & 0x7F, (this->unk_1E8 * 0) & 0x3F, - 0x20, 0x10, 1, (this->unk_1E8 * 0) & 0x3F, (this->unk_1E8 * -6) & 0x7F, 0x20, 0x10)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (this->unk_1E8 * 0) & 0x7F, (this->unk_1E8 * 0) & 0x3F, 0x20, + 0x10, 1, (this->unk_1E8 * 0) & 0x3F, (this->unk_1E8 * -6) & 0x7F, 0x20, 0x10)); Matrix_Push(); Matrix_Scale((1.0f + this->unk_324[0].unk_10) * this->unk_324[0].unk_08, 1.0f, @@ -893,7 +893,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx2) { vecPtr = &this->limbPos[0]; - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Matrix_MultVecZ(1842.1053f, vecPtr++); Matrix_MultVecZ(-1842.1053f, vecPtr++); @@ -933,9 +933,9 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_OPA_DISP++, object_rr_DL_000470); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->actor.scale.y * 66.66667f * this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 e2c935b47a..072e78105d 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -5,7 +5,7 @@ struct EnRr; -typedef void (*EnRrActionFunc)(struct EnRr*, GlobalContext*); +typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); enum { /* 0 */ ENRR_0, diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c index 3681deadda..dd25ce9b9d 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c @@ -11,12 +11,12 @@ #define THIS ((EnRsn*)thisx) -void EnRsn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRsn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRsn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRsn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRsn_Init(Actor* thisx, PlayState* play); +void EnRsn_Destroy(Actor* thisx, PlayState* play); +void EnRsn_Update(Actor* thisx, PlayState* play); +void EnRsn_Draw(Actor* thisx, PlayState* play); -void func_80C25D84(EnRsn* this, GlobalContext* globalCtx); +void func_80C25D84(EnRsn* this, PlayState* play); const ActorInit En_Rsn_InitVars = { ACTOR_EN_RSN, @@ -37,34 +37,34 @@ void func_80C25D40(EnRsn* this) { this->actionFunc = func_80C25D84; } -void func_80C25D84(EnRsn* this, GlobalContext* globalCtx) { +void func_80C25D84(EnRsn* this, PlayState* play) { } -void EnRsn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnRsn_Init(Actor* thisx, PlayState* play) { EnRsn* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBombShopkeeperSkel, &gBombShopkeeperWalkAnim, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &gBombShopkeeperSkel, &gBombShopkeeperWalkAnim, NULL, NULL, 0); this->actor.flags &= ~ACTOR_FLAG_1; func_80C25D40(this); } -void EnRsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRsn_Destroy(Actor* thisx, PlayState* play) { EnRsn* this = THIS; - SkelAnime_Free(&this->skelAnime, globalCtx); + SkelAnime_Free(&this->skelAnime, play); } -void EnRsn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRsn_Update(Actor* thisx, PlayState* play) { EnRsn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk1D8, &this->unk1DE, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk1D8, &this->unk1DE, this->actor.focus.pos); } -s32 EnRsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnRsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnRsn* this = THIS; if (limbIndex == BOMB_SHOPKEEPER_LIMB_RIGHT_HAND) { @@ -73,7 +73,7 @@ s32 EnRsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnRsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnRsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnRsn* this = THIS; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -82,13 +82,13 @@ void EnRsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnRsn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRsn_Draw(Actor* thisx, PlayState* play) { EnRsn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBombShopkeeperEyeTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRsn_OverrideLimbDraw, EnRsn_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.h b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.h index 926bc6d324..b540144381 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.h +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.h @@ -5,7 +5,7 @@ struct EnRsn; -typedef void (*EnRsnActionFunc)(struct EnRsn*, GlobalContext*); +typedef void (*EnRsnActionFunc)(struct EnRsn*, PlayState*); typedef struct EnRsn { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 3e9538f61b..0333cb011c 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -10,12 +10,12 @@ #define THIS ((EnRu*)thisx) -void EnRu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRu_Init(Actor* thisx, PlayState* play); +void EnRu_Destroy(Actor* thisx, PlayState* play); +void EnRu_Update(Actor* thisx, PlayState* play); +void EnRu_Draw(Actor* thisx, PlayState* play); -void func_80A38DF4(EnRu* this, GlobalContext* globalCtx); +void func_80A38DF4(EnRu* this, PlayState* play); #if 0 const ActorInit En_Ru_InitVars = { diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index b368fb584f..319c6a1bc7 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -5,7 +5,7 @@ struct EnRu; -typedef void (*EnRuActionFunc)(struct EnRu*, GlobalContext*); +typedef void (*EnRuActionFunc)(struct EnRu*, PlayState*); typedef struct EnRu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 2b4026858a..9a49375f94 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -17,28 +17,28 @@ enum { ENRUPPECROW_EFFECT_LIGHT = 20, }; -void EnRuppecrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRuppecrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRuppecrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRuppecrow_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnRuppecrow_HandleSong(EnRuppecrow*, GlobalContext*); -s32 EnRuppecrow_UpdateCollision(EnRuppecrow*, GlobalContext*); +void EnRuppecrow_Init(Actor* thisx, PlayState* play); +void EnRuppecrow_Destroy(Actor* thisx, PlayState* play); +void EnRuppecrow_Update(Actor* thisx, PlayState* play); +void EnRuppecrow_Draw(Actor* thisx, PlayState* play); +void EnRuppecrow_HandleSong(EnRuppecrow*, PlayState*); +s32 EnRuppecrow_UpdateCollision(EnRuppecrow*, PlayState*); void EnRuppecrow_UpdateRupees(EnRuppecrow*); -void EnRuppecrow_UpdateDamage(EnRuppecrow*, GlobalContext*); +void EnRuppecrow_UpdateDamage(EnRuppecrow*, PlayState*); void EnRuppecrow_HandleDeath(EnRuppecrow*); -void EnRuppecrow_FallToDespawn(EnRuppecrow*, GlobalContext*); -void EnRuppecrow_ShatterIce(EnRuppecrow*, GlobalContext*); -void EnRuppecrow_UpdatePosition(EnRuppecrow*, GlobalContext*); -s32 EnRuppecrow_CheckPlayedMatchingSong(GlobalContext*); -void EnRuppecrow_HandleSongCutscene(EnRuppecrow*, GlobalContext*); +void EnRuppecrow_FallToDespawn(EnRuppecrow*, PlayState*); +void EnRuppecrow_ShatterIce(EnRuppecrow*, PlayState*); +void EnRuppecrow_UpdatePosition(EnRuppecrow*, PlayState*); +s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState*); +void EnRuppecrow_HandleSongCutscene(EnRuppecrow*, PlayState*); s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow*, Path*, s32); s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow*, Path*, s32); f32 EnRuppecrow_GetPointDirection(Path*, s32, PosRot*, Vec3s*); -s32 EnRuppecrow_CanSpawnBlueRupees(GlobalContext*); -void EnRuppecrow_SpawnRupee(EnRuppecrow*, GlobalContext*); -void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow*, GlobalContext*); -void EnRuppecrow_UpdateSpeed(EnRuppecrow*, GlobalContext*); -void EnRuppecrow_FlyToDespawn(EnRuppecrow*, GlobalContext*); +s32 EnRuppecrow_CanSpawnBlueRupees(PlayState*); +void EnRuppecrow_SpawnRupee(EnRuppecrow*, PlayState*); +void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow*, PlayState*); +void EnRuppecrow_UpdateSpeed(EnRuppecrow*, PlayState*); +void EnRuppecrow_FlyToDespawn(EnRuppecrow*, PlayState*); const ActorInit En_Ruppecrow_InitVars = { ACTOR_EN_RUPPECROW, @@ -121,7 +121,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, GlobalContext* globalCtx) { +s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, PlayState* play) { s32 pad; this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; @@ -129,8 +129,8 @@ s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, GlobalContext* globalCtx) { sJntSphInit.elements->dim.modelSphere.center.y + this->actor.world.pos.y; this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f, 25.0f, 50.0f, 0x07); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 25.0f, 50.0f, 0x07); return true; } @@ -221,16 +221,16 @@ f32 EnRuppecrow_GetPointDirection(Path* path, s32 pointIndex, PosRot* world, Vec return point.y - world->pos.y; } -void EnRuppecrow_ShatterIce(EnRuppecrow* this, GlobalContext* globalCtx) { +void EnRuppecrow_ShatterIce(EnRuppecrow* this, PlayState* play) { if (this->currentEffect == ENRUPPECROW_EFFECT_ICE) { this->currentEffect = ENRUPPECROW_EFFECT_NONE; this->unk_2C8 = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0x2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 0x2, 0.2f, 0.2f); } } -s32 EnRuppecrow_CanSpawnBlueRupees(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnRuppecrow_CanSpawnBlueRupees(PlayState* play) { + Player* player = GET_PLAYER(play); switch (player->transformation) { case PLAYER_FORM_DEKU: @@ -262,8 +262,8 @@ void EnRuppecrow_UpdateRupees(EnRuppecrow* this) { } } -void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRuppecrow_SpawnRupee(EnRuppecrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 xOffset; EnItem00* rupee; s16 rupeeIndex = this->rupeeIndex; @@ -274,11 +274,11 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { xOffset = 0.0f; } - if (EnRuppecrow_CanSpawnBlueRupees(globalCtx) && (this->rupeeIndex % 5) == 4) { + if (EnRuppecrow_CanSpawnBlueRupees(play) && (this->rupeeIndex % 5) == 4) { if (this->rupeeIndex == 19) { - rupee = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - this->actor.world.pos.x + xOffset, this->actor.world.pos.y, - this->actor.world.pos.z, 0x0, 0x0, 0x0, ITEM00_RUPEE_RED); + rupee = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, + this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, + ITEM00_RUPEE_RED); this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; @@ -287,9 +287,9 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { rupee->unk152 = 60; this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; } else { - rupee = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - this->actor.world.pos.x + xOffset, this->actor.world.pos.y, - this->actor.world.pos.z, 0x0, 0x0, 0x0, ITEM00_RUPEE_BLUE); + rupee = (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, + this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, + ITEM00_RUPEE_BLUE); this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; @@ -300,7 +300,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { } } else if (this->rupeeIndex == 19) { rupee = - (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, + (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, ITEM00_RUPEE_RED); this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; @@ -311,7 +311,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; } else { rupee = - (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, + (EnItem00*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, this->actor.world.pos.x + xOffset, this->actor.world.pos.y, this->actor.world.pos.z, 0x0, 0x0, 0x0, ITEM00_RUPEE_GREEN); this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; @@ -325,7 +325,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, GlobalContext* globalCtx) { this->rupeeIndex++; } -void EnRuppecrow_UpdatePosition(EnRuppecrow* this, GlobalContext* globalCtx) { +void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) { Vec3s nextPointDirection; EnRuppecrow_GetPointDirection(this->path, this->currentPoint, &this->actor.world, &nextPointDirection); @@ -346,8 +346,8 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, GlobalContext* globalCtx) { } if (this->actionFunc == EnRuppecrow_FlyWhileDroppingRupees && - (!EnRuppecrow_CanSpawnBlueRupees(globalCtx) || (this->currentPoint % -2) == 0)) { - EnRuppecrow_SpawnRupee(this, globalCtx); + (!EnRuppecrow_CanSpawnBlueRupees(play) || (this->currentPoint % -2) == 0)) { + EnRuppecrow_SpawnRupee(this, play); } } } else if (EnRuppecrow_ReachedPointClockwise(this, this->path, this->currentPoint)) { @@ -358,38 +358,38 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, GlobalContext* globalCtx) { } if (this->actionFunc == EnRuppecrow_FlyWhileDroppingRupees && - (!EnRuppecrow_CanSpawnBlueRupees(globalCtx) || (this->currentPoint % -2) == 0)) { - EnRuppecrow_SpawnRupee(this, globalCtx); + (!EnRuppecrow_CanSpawnBlueRupees(play) || (this->currentPoint % -2) == 0)) { + EnRuppecrow_SpawnRupee(this, play); } } } -s32 EnRuppecrow_CheckPlayedMatchingSong(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState* play) { + Player* player = GET_PLAYER(play); - if (globalCtx->msgCtx.ocarinaMode == 0x3) { + if (play->msgCtx.ocarinaMode == 0x3) { switch (player->transformation) { case PLAYER_FORM_DEKU: - if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_SONATA) { + if (play->msgCtx.unk1202E == OCARINA_SONG_SONATA) { return true; } break; case PLAYER_FORM_GORON: - if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_GORON_LULLABY) { + if (play->msgCtx.unk1202E == OCARINA_SONG_GORON_LULLABY) { return true; } break; case PLAYER_FORM_ZORA: - if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_NEW_WAVE) { + if (play->msgCtx.unk1202E == OCARINA_SONG_NEW_WAVE) { return true; } break; case PLAYER_FORM_HUMAN: - if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_SONATA) { + if (play->msgCtx.unk1202E == OCARINA_SONG_SONATA) { return true; - } else if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_GORON_LULLABY) { + } else if (play->msgCtx.unk1202E == OCARINA_SONG_GORON_LULLABY) { return true; - } else if (globalCtx->msgCtx.unk1202E == OCARINA_SONG_NEW_WAVE) { + } else if (play->msgCtx.unk1202E == OCARINA_SONG_NEW_WAVE) { return true; } break; @@ -399,8 +399,8 @@ s32 EnRuppecrow_CheckPlayedMatchingSong(GlobalContext* globalCtx) { return false; } -void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); switch (player->transformation) { case PLAYER_FORM_DEKU: @@ -474,7 +474,7 @@ void EnRuppecrow_HandleDeath(EnRuppecrow* this) { this->actionFunc = EnRuppecrow_FallToDespawn; } -void EnRuppecrow_UpdateDamage(EnRuppecrow* this, GlobalContext* globalCtx) { +void EnRuppecrow_UpdateDamage(EnRuppecrow* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements->info); @@ -482,17 +482,17 @@ void EnRuppecrow_UpdateDamage(EnRuppecrow* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect != 0x1) { this->actor.colChkInfo.health = 0; this->actor.flags &= ~ACTOR_FLAG_1; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); EnRuppecrow_HandleDeath(this); } } } -void EnRuppecrow_HandleSong(EnRuppecrow* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { + Player* player = GET_PLAYER(play); - EnRuppecrow_UpdatePosition(this, globalCtx); - if (this->actor.xzDistToPlayer < 1000.0f && EnRuppecrow_CheckPlayedMatchingSong(globalCtx)) { + EnRuppecrow_UpdatePosition(this, play); + if (this->actor.xzDistToPlayer < 1000.0f && EnRuppecrow_CheckPlayedMatchingSong(play)) { // If Link is in front, the guay will turn around and go the other way if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { this->isGoingCounterClockwise |= 1; @@ -517,17 +517,17 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, GlobalContext* globalCtx) { this->yOffset += 0x1000; this->actor.shape.yOffset = Math_SinS(this->yOffset) * 500.0f; - if ((globalCtx->state.frames % 43) == 0) { + if ((play->state.frames % 43) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); } } -void EnRuppecrow_HandleSongCutscene(EnRuppecrow* this, GlobalContext* globalCtx) { - EnRuppecrow_UpdatePosition(this, globalCtx); +void EnRuppecrow_HandleSongCutscene(EnRuppecrow* this, PlayState* play) { + EnRuppecrow_UpdatePosition(this, play); if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); - EnRuppecrow_UpdateSpeed(this, globalCtx); + EnRuppecrow_UpdateSpeed(this, play); this->actionFunc = EnRuppecrow_FlyWhileDroppingRupees; } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -536,8 +536,8 @@ void EnRuppecrow_HandleSongCutscene(EnRuppecrow* this, GlobalContext* globalCtx) Actor_MoveWithoutGravity(&this->actor); } -void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, GlobalContext* globalCtx) { - EnRuppecrow_UpdatePosition(this, globalCtx); +void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, PlayState* play) { + EnRuppecrow_UpdatePosition(this, play); if (this->rupeeIndex >= ENRUPPECROW_RUPEE_COUNT) { // Finished spawning rupees; fly up and then despawn @@ -554,7 +554,7 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, GlobalContext* global Actor_MoveWithGravity(&this->actor); } else { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { - EnRuppecrow_UpdateSpeed(this, globalCtx); + EnRuppecrow_UpdateSpeed(this, play); Math_ApproachF(&this->actor.speedXZ, this->speedModifier, 0.2f, 0.5f); } @@ -562,13 +562,13 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, GlobalContext* global this->yOffset += 0x1000; this->actor.shape.yOffset = Math_SinS(this->yOffset) * 500.0f; - if ((globalCtx->state.frames % 43) == 0) { + if ((play->state.frames % 43) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); } } } -void EnRuppecrow_FlyToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { +void EnRuppecrow_FlyToDespawn(EnRuppecrow* this, PlayState* play) { if (this->actor.bgCheckFlags & 0x8) { this->actor.world.rot.y *= -0x1; } @@ -584,13 +584,13 @@ void EnRuppecrow_FlyToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); - if ((globalCtx->state.frames % 43) == 0) { + if ((play->state.frames % 43) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); } } } -void EnRuppecrow_FallToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { +void EnRuppecrow_FallToDespawn(EnRuppecrow* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); if (this->currentEffect != ENRUPPECROW_EFFECT_ICE) { @@ -609,11 +609,11 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 0x1 || this->actor.floorHeight == BGCHECK_Y_MIN) { - EnRuppecrow_ShatterIce(this, globalCtx); - func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, (this->actor.scale.x * 10000.0f), - 0x0, 0x0); + EnRuppecrow_ShatterIce(this, play); + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, (this->actor.scale.x * 10000.0f), 0x0, + 0x0); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0xB, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 0xB, NA_SE_EN_EXTINCT); Actor_MarkForDeath(&this->actor); return; } @@ -622,24 +622,24 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void EnRuppecrow_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnRuppecrow_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnRuppecrow* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->joinTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->joinTable, this->morphTable, OBJECT_CROW_LIMB_MAX); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_InitJntSph(play, &this->collider); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->actor.flags |= ACTOR_FLAG_2000000; - this->path = SubS_GetPathByIndex(globalCtx, ENRUPPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENRUPPECROW_GET_PATH(&this->actor), 0x3F); if (this->path != NULL) { this->actionFunc = EnRuppecrow_HandleSong; } else { @@ -647,27 +647,27 @@ void EnRuppecrow_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnRuppecrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnRuppecrow_Destroy(Actor* thisx, PlayState* play) { EnRuppecrow* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnRuppecrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnRuppecrow_Update(Actor* thisx, PlayState* play) { EnRuppecrow* this = THIS; - EnRuppecrow_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnRuppecrow_UpdateDamage(this, play); + this->actionFunc(this, play); EnRuppecrow_UpdateRupees(this); this->actor.focus.pos = this->actor.world.pos; SkelAnime_Update(&this->skelAnime); - EnRuppecrow_UpdateCollision(this, globalCtx); + EnRuppecrow_UpdateCollision(this, play); } -void EnRuppecrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnRuppecrow_Draw(Actor* thisx, PlayState* play) { EnRuppecrow* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(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_Ruppecrow/z_en_ruppecrow.h b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h index de9fceac91..620e4b9ac7 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h @@ -11,7 +11,7 @@ struct EnRuppecrow; -typedef void (*EnRuppecrowActionFunc)(struct EnRuppecrow*, GlobalContext*); +typedef void (*EnRuppecrowActionFunc)(struct EnRuppecrow*, PlayState*); typedef struct EnRuppecrow { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index 57f6798035..902e604190 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -10,24 +10,24 @@ #define THIS ((EnRz*)thisx) -void EnRz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnRz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnRz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnRz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnRz_Init(Actor* thisx, PlayState* play); +void EnRz_Destroy(Actor* thisx, PlayState* play); +void EnRz_Update(Actor* thisx, PlayState* play); +void EnRz_Draw(Actor* thisx, PlayState* play); -void func_80BFC058(EnRz* this, GlobalContext* globalCtx); -void func_80BFC078(EnRz* this, GlobalContext* globalCtx); -void func_80BFC19C(EnRz* this, GlobalContext* globalCtx); -void func_80BFC214(EnRz* this, GlobalContext* globalCtx); -void func_80BFC270(EnRz* this, GlobalContext* globalCtx); -void func_80BFC2F4(EnRz* this, GlobalContext* globalCtx); -void func_80BFC36C(EnRz* this, GlobalContext* globalCtx); -void func_80BFC3F8(EnRz* this, GlobalContext* globalCtx); -void func_80BFC608(EnRz* this, GlobalContext* globalCtx); -void func_80BFC674(EnRz* this, GlobalContext* globalCtx); -void func_80BFC728(EnRz* this, GlobalContext* globalCtx); -void func_80BFC7E0(EnRz* this, GlobalContext* globalCtx); -void func_80BFC8F8(EnRz* this, GlobalContext* globalCtx); +void func_80BFC058(EnRz* this, PlayState* play); +void func_80BFC078(EnRz* this, PlayState* play); +void func_80BFC19C(EnRz* this, PlayState* play); +void func_80BFC214(EnRz* this, PlayState* play); +void func_80BFC270(EnRz* this, PlayState* play); +void func_80BFC2F4(EnRz* this, PlayState* play); +void func_80BFC36C(EnRz* this, PlayState* play); +void func_80BFC3F8(EnRz* this, PlayState* play); +void func_80BFC608(EnRz* this, PlayState* play); +void func_80BFC674(EnRz* this, PlayState* play); +void func_80BFC728(EnRz* this, PlayState* play); +void func_80BFC7E0(EnRz* this, PlayState* play); +void func_80BFC8F8(EnRz* this, PlayState* play); #if 0 const ActorInit En_Rz_InitVars = { diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.h b/src/overlays/actors/ovl_En_Rz/z_en_rz.h index df78ac04ce..c65985904a 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.h +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.h @@ -5,7 +5,7 @@ struct EnRz; -typedef void (*EnRzActionFunc)(struct EnRz*, GlobalContext*); +typedef void (*EnRzActionFunc)(struct EnRz*, PlayState*); typedef struct EnRz { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index 99e92b0179..00637ba257 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -10,10 +10,10 @@ #define THIS ((EnSGoro*)thisx) -void EnSGoro_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSGoro_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSGoro_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSGoro_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSGoro_Init(Actor* thisx, PlayState* play); +void EnSGoro_Destroy(Actor* thisx, PlayState* play); +void EnSGoro_Update(Actor* thisx, PlayState* play); +void EnSGoro_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_S_Goro_InitVars = { diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h index 99c35127a3..cd9d8e0c97 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h @@ -7,7 +7,7 @@ struct EnSGoro; -typedef void (*EnSGoroActionFunc)(struct EnSGoro*, GlobalContext*); +typedef void (*EnSGoroActionFunc)(struct EnSGoro*, PlayState*); typedef struct EnSGoro { /* 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 7ffeb543b8..4c7fe5d0dc 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -11,19 +11,19 @@ #define THIS ((EnSb*)thisx) -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_Idle(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_ReturnToIdle(EnSb* this, GlobalContext* globalCtx); +void EnSb_Idle(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_ReturnToIdle(EnSb* this, PlayState* play); const ActorInit En_Sb_InitVars = { ACTOR_EN_SB, @@ -104,17 +104,17 @@ static Vec3f sFlamePosOffsets[] = { { 0.0f, 0.0f, -5.0f }, }; -void EnSb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Init(Actor* thisx, PlayState* play) { EnSb* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.mass = 10; this->actor.colChkInfo.health = 2; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, 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); this->isDead = false; this->actor.colChkInfo.mass = 90; this->actor.shape.rot.y = 0; @@ -127,18 +127,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 = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) { +void EnSb_SpawnBubbles(PlayState* play, EnSb* this) { s32 bubbleCount; if (this->actor.depthInWater > 0.0f) { for (bubbleCount = 0; bubbleCount < 10; bubbleCount++) { - 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); } } } @@ -206,14 +206,14 @@ void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) { this->actionFunc = EnSb_ReturnToIdle; } -void EnSb_Idle(EnSb* this, GlobalContext* globalCtx) { +void EnSb_Idle(EnSb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0); if (this->actor.xzDistToPlayer <= 240.0f && this->actor.xzDistToPlayer > 0.0f) { EnSb_SetupOpen(this); } } -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) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0); if (this->actor.xzDistToPlayer > 240.0f || this->actor.xzDistToPlayer <= 40.0f) { @@ -245,7 +245,7 @@ void EnSb_WaitOpen(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { +void EnSb_TurnAround(EnSb* this, PlayState* play) { s16 invertedYaw = BINANG_ROT180(this->yawAngle); Math_SmoothStepToS(&this->actor.shape.rot.y, invertedYaw, 1, 0x1F40, 0xA); @@ -260,13 +260,13 @@ 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->bounceCounter = 3; EnSb_SetupLunge(this); } } -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 & 2) { if (!(this->actor.depthInWater > 0.0f)) { @@ -277,7 +277,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 = currentFrame = this->skelAnime.curFrame; f32 frameCount = frameCount = Animation_GetLastFrame(&object_sb_Anim_0000B4); @@ -296,7 +296,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 & 1) { this->actor.bgCheckFlags &= ~2; @@ -307,7 +307,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_ReturnToIdle(EnSb* this, GlobalContext* globalCtx) { +void EnSb_ReturnToIdle(EnSb* this, PlayState* play) { if (this->attackTimer != 0) { this->attackTimer--; if (this->actor.bgCheckFlags & 1) { @@ -321,7 +321,7 @@ void EnSb_ReturnToIdle(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { +void EnSb_UpdateDamage(EnSb* this, PlayState* play) { Vec3f hitPoint; if (this->collider.base.acFlags & AC_HIT) { @@ -341,14 +341,14 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { this->isDrawn = true; } this->isDead = true; - Enemy_StartFinishingBlow(globalCtx, &this->actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EN_BEE_FLY); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 0x28, NA_SE_EN_BEE_FLY); return; } 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; } if (this->collider.base.atFlags & AT_HIT) { @@ -356,10 +356,10 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { } } -void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Update(Actor* thisx, PlayState* play) { s32 pad; EnSb* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (this->isDead) { if (this->actor.depthInWater > 0.0f) { @@ -367,33 +367,33 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.params = 1; } - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); Actor_MarkForDeath(&this->actor); } else { Actor_SetFocus(&this->actor, 20.0f); Actor_MoveWithGravity(&this->actor); - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 25.0f, 20.0f, 5); - EnSb_UpdateDamage(this, globalCtx); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 20.0f, 5); + EnSb_UpdateDamage(this, play); if (player->stateFlags1 & 0x8000000) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->vulnerableTimer == 0) { - 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_SetAC(play, &play->colChkCtx, &this->collider.base); } SkelAnime_Update(&this->skelAnime); } } -void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s8 phi_a2; EnSb* this = THIS; if (this->isDrawn != false) { if (limbIndex < 7) { phi_a2 = (this->actor.depthInWater > 0) ? 4 : 1; - Actor_SpawnBodyParts(thisx, globalCtx, phi_a2, dList); + Actor_SpawnBodyParts(thisx, play, phi_a2, dList); } if (limbIndex == 6) { this->isDrawn = false; @@ -402,15 +402,15 @@ void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSb_Draw(Actor* thisx, PlayState* play) { EnSb* this = THIS; Vec3f flamePos; Vec3f* offset; s16 fireDecr; - func_800B8050(&this->actor, globalCtx, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnSb_PostLimbDraw, &this->actor); + func_800B8050(&this->actor, play, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnSb_PostLimbDraw, &this->actor); if (this->fireCount != 0) { this->actor.colorFilterTimer++; fireDecr = this->fireCount - 1; @@ -419,7 +419,7 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { flamePos.x = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.x + offset->x); flamePos.y = randPlusMinusPoint5Scaled(5.0f) + (this->actor.world.pos.y + offset->y); flamePos.z = randPlusMinusPoint5Scaled(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 167a0c5c81..df9bd68011 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.h +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.h @@ -5,7 +5,7 @@ struct EnSb; -typedef void (*EnSbActionFunc)(struct EnSb*, GlobalContext*); +typedef void (*EnSbActionFunc)(struct EnSb*, PlayState*); typedef enum { /* 0x00 */ SHELLBLADE_OPEN, diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c index f568b1c418..11b9095c6e 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c @@ -11,12 +11,12 @@ #define THIS ((EnScRuppe*)thisx) -void EnScRuppe_Init(Actor* thisx, GlobalContext* globalCtx); -void EnScRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnScRuppe_Update(Actor* thisx, GlobalContext* globalCtx); -void EnScRuppe_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnScRuppe_Init(Actor* thisx, PlayState* play); +void EnScRuppe_Destroy(Actor* thisx, PlayState* play); +void EnScRuppe_Update(Actor* thisx, PlayState* play); +void EnScRuppe_Draw(Actor* thisx, PlayState* play); -void func_80BD6B18(EnScRuppe* this, GlobalContext* globalCtx); +void func_80BD6B18(EnScRuppe* this, PlayState* play); typedef struct { /* 0x0 */ TexturePtr tex; @@ -64,10 +64,10 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -void EnScRuppe_UpdateCollision(EnScRuppe* this, GlobalContext* globalCtx) { +void EnScRuppe_UpdateCollision(EnScRuppe* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 0.0f, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); } s32 func_80BD697C(s16 ruppeIndex) { @@ -112,7 +112,7 @@ s32 func_80BD697C(s16 ruppeIndex) { return false; } -void func_80BD6A8C(EnScRuppe* this, GlobalContext* globalCtx) { +void func_80BD6A8C(EnScRuppe* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { this->ruppeDisplayTime = 0; this->actor.gravity = 0.0f; @@ -124,8 +124,8 @@ void func_80BD6A8C(EnScRuppe* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80BD6B18(EnScRuppe* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BD6B18(EnScRuppe* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->ruppeDisplayTime > 30) { if (func_80BD697C(this->ruppeIndex)) { @@ -144,12 +144,12 @@ void func_80BD6B18(EnScRuppe* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void EnScRuppe_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnScRuppe_Init(Actor* thisx, PlayState* play) { EnScRuppe* this = THIS; ColliderCylinder* collider = &this->collider; - Collider_InitCylinder(globalCtx, collider); - Collider_InitAndSetCylinder(globalCtx, collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, collider); + Collider_InitAndSetCylinder(play, collider, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.03f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); this->ruppeIndex = SCRUPPE_GET_TYPE(thisx); @@ -162,30 +162,30 @@ void EnScRuppe_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.yOffset = 700.0f; } -void EnScRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnScRuppe_Destroy(Actor* thisx, PlayState* play) { EnScRuppe* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnScRuppe_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnScRuppe_Update(Actor* thisx, PlayState* play) { EnScRuppe* this = THIS; - this->actionFunc(this, globalCtx); - EnScRuppe_UpdateCollision(this, globalCtx); + this->actionFunc(this, play); + EnScRuppe_UpdateCollision(this, play); } -void EnScRuppe_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnScRuppe_Draw(Actor* thisx, PlayState* play) { s32* pad; EnScRuppe* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeInfo[this->ruppeIndex].tex)); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.h b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.h index 13140be434..c48d628bec 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.h +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.h @@ -7,7 +7,7 @@ struct EnScRuppe; -typedef void (*EnScRuppeActionFunc)(struct EnScRuppe*, GlobalContext*); +typedef void (*EnScRuppeActionFunc)(struct EnScRuppe*, PlayState*); typedef struct EnScRuppe { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c index dd64537730..2265fd22ed 100644 --- a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c +++ b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c @@ -11,13 +11,13 @@ #define THIS ((EnScopecoin*)thisx) -void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx); -void EnScopecoin_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnScopecoin_Update(Actor* thisx, GlobalContext* globalCtx); -void EnScopecoin_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnScopecoin_Init(Actor* thisx, PlayState* play); +void EnScopecoin_Destroy(Actor* thisx, PlayState* play); +void EnScopecoin_Update(Actor* thisx, PlayState* play); +void EnScopecoin_Draw(Actor* thisx, PlayState* play); -void func_80BFCFA0(EnScopecoin* this, GlobalContext* globalCtx); -void func_80BFCFB8(EnScopecoin* this, GlobalContext* globalCtx); +void func_80BFCFA0(EnScopecoin* this, PlayState* play); +void func_80BFCFB8(EnScopecoin* this, PlayState* play); const ActorInit En_Scopecoin_InitVars = { ACTOR_EN_SCOPECOIN, @@ -31,18 +31,18 @@ const ActorInit En_Scopecoin_InitVars = { (ActorFunc)EnScopecoin_Draw, }; -void func_80BFCFA0(EnScopecoin* this, GlobalContext* globalCtx) { +void func_80BFCFA0(EnScopecoin* this, PlayState* play) { this->actor.shape.rot.y += 500; } -void func_80BFCFB8(EnScopecoin* this, GlobalContext* globalCtx) { - if (Flags_GetCollectible(globalCtx, (this->actor.params & 0x7F0) >> 4)) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); +void func_80BFCFB8(EnScopecoin* this, PlayState* play) { + if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); Actor_MarkForDeath(&this->actor); } } -void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecoin_Init(Actor* thisx, PlayState* play) { EnScopecoin* this = THIS; Actor_SetScale(&this->actor, 0.01f); @@ -52,9 +52,9 @@ void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk148 = 0; } - if (globalCtx->actorCtx.unk5 & 2) { + if (play->actorCtx.unk5 & 2) { if (this->unk148 == 2 || this->unk148 == 6) { - if (Flags_GetCollectible(globalCtx, (this->actor.params & 0x7F0) >> 4)) { + if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) { Actor_MarkForDeath(&this->actor); return; } @@ -64,7 +64,7 @@ void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) { return; } if (this->unk148 == 2 || this->unk148 == 6) { - if (Flags_GetCollectible(globalCtx, (this->actor.params & 0x7F0) >> 4)) { + if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) { Actor_MarkForDeath(&this->actor); } else { this->actor.draw = NULL; @@ -75,13 +75,13 @@ void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnScopecoin_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecoin_Destroy(Actor* thisx, PlayState* play) { } -void EnScopecoin_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecoin_Update(Actor* thisx, PlayState* play) { EnScopecoin* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } static TexturePtr D_80BFD280[] = { @@ -89,15 +89,15 @@ static TexturePtr D_80BFD280[] = { gameplay_keep_Tex_062020, gameplay_keep_Tex_062060, gameplay_keep_Tex_062000, }; -void EnScopecoin_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecoin_Draw(Actor* thisx, PlayState* play) { EnScopecoin* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - func_8012C28C(globalCtx->state.gfxCtx); - func_800B8050(&this->actor, globalCtx, 0); + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); OPEN_DISPS(gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BFD280[this->unk148])); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); diff --git a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h index d810e6ad4f..37a6bbf8eb 100644 --- a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h +++ b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h @@ -5,7 +5,7 @@ struct EnScopecoin; -typedef void (*EnScopecoinActionFunc)(struct EnScopecoin*, GlobalContext*); +typedef void (*EnScopecoinActionFunc)(struct EnScopecoin*, PlayState*); typedef struct EnScopecoin { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index 5743f4a48e..b7a417531b 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -10,13 +10,13 @@ #define THIS ((EnScopecrow*)thisx) -void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnScopecrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnScopecrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnScopecrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnScopecrow_Init(Actor* thisx, PlayState* play); +void EnScopecrow_Destroy(Actor* thisx, PlayState* play); +void EnScopecrow_Update(Actor* thisx, PlayState* play); +void EnScopecrow_Draw(Actor* thisx, PlayState* play); -void func_80BCD590(EnScopecrow* this, GlobalContext* globalCtx); -void func_80BCD640(EnScopecrow* this, GlobalContext* globalCtx); +void func_80BCD590(EnScopecrow* this, PlayState* play); +void func_80BCD640(EnScopecrow* this, PlayState* play); const ActorInit En_Scopecrow_InitVars = { ACTOR_EN_SCOPECROW, @@ -57,13 +57,13 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -void func_80BCD000(EnScopecrow* this, GlobalContext* globalCtx) { +void func_80BCD000(EnScopecrow* this, PlayState* play) { this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.elements->dim.worldSphere.center.y = sJntSphInit.elements[0].dim.modelSphere.center.y + this->actor.world.pos.y; this->collider.elements->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); } s32 func_80BCD09C(s16 arg0) { @@ -156,8 +156,8 @@ s32 func_80BCD1AC(s16 arg0) { return false; } -void func_80BCD2BC(EnScopecrow* this, GlobalContext* globalCtx) { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SC_RUPPE, this->actor.world.pos.x, +void func_80BCD2BC(EnScopecrow* this, PlayState* play) { + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SC_RUPPE, 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, this->actor.cutscene, this->actor.unk20, NULL); @@ -213,10 +213,10 @@ f32 func_80BCD4D0(Path* path, s32 count, Vec3f* arg2, Vec3s* arg3) { return sp20.y - arg2->y; } -void func_80BCD590(EnScopecrow* this, GlobalContext* globalCtx) { +void func_80BCD590(EnScopecrow* this, PlayState* play) { Vec3f sp1C; - func_80169474(globalCtx, &this->actor.world.pos, &sp1C); + func_80169474(play, &this->actor.world.pos, &sp1C); if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f) && (sp1C.y < 150.0f)) { this->actor.draw = EnScopecrow_Draw; @@ -224,7 +224,7 @@ void func_80BCD590(EnScopecrow* this, GlobalContext* globalCtx) { } } -void func_80BCD640(EnScopecrow* this, GlobalContext* globalCtx) { +void func_80BCD640(EnScopecrow* this, PlayState* play) { Vec3s sp30; if (this->path != NULL) { @@ -239,7 +239,7 @@ void func_80BCD640(EnScopecrow* this, GlobalContext* globalCtx) { if (func_80BCD334(this, this->path, this->unk_1FC)) { if ((this->unk_1FC == this->unk_262) && func_80BCD1AC(this->unk_260)) { - func_80BCD2BC(this, globalCtx); + func_80BCD2BC(this, play); } if (this->unk_1FC >= (this->path->count - 1)) { @@ -256,7 +256,7 @@ void func_80BCD640(EnScopecrow* this, GlobalContext* globalCtx) { this->actor.shape.yOffset = Math_SinS(this->unk_264) * 500.0f; } -void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecrow_Init(Actor* thisx, PlayState* play) { EnScopecrow* this = THIS; Vec3s* temp; CollisionPoly* sp4C; @@ -269,7 +269,7 @@ void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx) { } if (func_80BCD09C(this->unk_260)) { - this->path = SubS_GetPathByIndex(globalCtx, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); this->unk_262 = ENSCOPECROW_GET_3E0(&this->actor); if (this->path != NULL) { @@ -285,12 +285,12 @@ void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx) { sp3C.z = points->z; this->actor.world.pos = sp3C; - this->actor.world.pos.y = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp4C, &sp3C); + this->actor.world.pos.y = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp4C, &sp3C); if (this->actor.world.pos.y == BGCHECK_Y_MIN) { Actor_MarkForDeath(&this->actor); } - func_80BCD2BC(this, globalCtx); + func_80BCD2BC(this, play); Actor_MarkForDeath(&this->actor); return; } @@ -299,17 +299,17 @@ void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (globalCtx->actorCtx.unk5 & 2) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, + if (play->actorCtx.unk5 & 2) { + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - Collider_InitJntSph(globalCtx, &this->collider); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->collider); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; Actor_SetScale(&this->actor, 0.03f); - this->path = SubS_GetPathByIndex(globalCtx, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); this->unk_262 = ENSCOPECROW_GET_3E0(&this->actor); if (this->path != NULL) { @@ -329,25 +329,25 @@ void EnScopecrow_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } -void EnScopecrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecrow_Destroy(Actor* thisx, PlayState* play) { EnScopecrow* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void EnScopecrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecrow_Update(Actor* thisx, PlayState* play) { EnScopecrow* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - func_80BCD000(this, globalCtx); + func_80BCD000(this, play); } -void EnScopecrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnScopecrow_Draw(Actor* thisx, PlayState* play) { EnScopecrow* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + func_8012C28C(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_Scopecrow/z_en_scopecrow.h b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h index 72469bd755..60775383e9 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h @@ -6,7 +6,7 @@ struct EnScopecrow; -typedef void (*EnScopecrowActionFunc)(struct EnScopecrow*, GlobalContext*); +typedef void (*EnScopecrowActionFunc)(struct EnScopecrow*, PlayState*); #define ENSCOPECROW_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENSCOPECROW_GET_3E0(thisx) (((thisx)->params & 0x3E0) >> 5) diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 3f0ae61548..4c119e341f 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -12,24 +12,24 @@ #define THIS ((EnScopenuts*)thisx) -void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnScopenuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnScopenuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnScopenuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnScopenuts_Init(Actor* thisx, PlayState* play); +void EnScopenuts_Destroy(Actor* thisx, PlayState* play); +void EnScopenuts_Update(Actor* thisx, PlayState* play); +void EnScopenuts_Draw(Actor* thisx, PlayState* play); -void func_80BCB078(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB1C8(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB4DC(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB52C(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB90C(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCB980(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCBA00(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCBC60(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCBD28(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCBF0C(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCBFFC(EnScopenuts* this, GlobalContext* globalCtx); -void func_80BCC288(EnScopenuts* this, GlobalContext* globalCtx); +void func_80BCB078(EnScopenuts* this, PlayState* play); +void func_80BCB1C8(EnScopenuts* this, PlayState* play); +void func_80BCB4DC(EnScopenuts* this, PlayState* play); +void func_80BCB52C(EnScopenuts* this, PlayState* play); +void func_80BCB6D0(EnScopenuts* this, PlayState* play); +void func_80BCB90C(EnScopenuts* this, PlayState* play); +void func_80BCB980(EnScopenuts* this, PlayState* play); +void func_80BCBA00(EnScopenuts* this, PlayState* play); +void func_80BCBC60(EnScopenuts* this, PlayState* play); +void func_80BCBD28(EnScopenuts* this, PlayState* play); +void func_80BCBF0C(EnScopenuts* this, PlayState* play); +void func_80BCBFFC(EnScopenuts* this, PlayState* play); +void func_80BCC288(EnScopenuts* this, PlayState* play); s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_); f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); @@ -109,7 +109,7 @@ s16 func_80BCABF0(Path* path) { return Math_Vec3f_Yaw(&sp28, &sp1C); } -void func_80BCAC40(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCAC40(EnScopenuts* this, PlayState* play) { s16 i; Vec3f sp60; Vec3f sp54; @@ -121,7 +121,7 @@ void func_80BCAC40(EnScopenuts* this, GlobalContext* globalCtx) { sp54.x = Rand_Centered() * 10.0f; sp54.y = 2.0f * Rand_Centered(); sp54.z = Rand_Centered() * 10.0f; - EffectSsHahen_Spawn(globalCtx, &sp60, &sp54, &D_80BCCCE4, 0, 0x96, 1, 0x10, D_80BCCCDC[i & 1]); + EffectSsHahen_Spawn(play, &sp60, &sp54, &D_80BCCCE4, 0, 0x96, 1, 0x10, D_80BCCCDC[i & 1]); } } @@ -156,14 +156,14 @@ void func_80BCAD64(EnScopenuts* this, s16 arg1) { Actor_UpdatePos(&this->actor); } -void func_80BCAE78(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCAE78(EnScopenuts* this, PlayState* play) { if (this->unk_328 & 4) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->unk_328 & 2) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); } } @@ -189,10 +189,10 @@ s16 func_80BCAF0C(EnScopenuts* this) { return 0; } -void func_80BCAFA8(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCAFA8(EnScopenuts* this, PlayState* play) { Vec3f sp1C; - func_80169474(globalCtx, &this->actor.world.pos, &sp1C); + func_80169474(play, &this->actor.world.pos, &sp1C); if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f)) { if (sp1C.y < 150.0f) { this->actor.draw = EnScopenuts_Draw; @@ -203,7 +203,7 @@ void func_80BCAFA8(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCB078(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCB078(EnScopenuts* this, PlayState* play) { Vec3s sp30; if (this->path != NULL) { @@ -235,7 +235,7 @@ void func_80BCB078(EnScopenuts* this, GlobalContext* globalCtx) { Actor_MoveWithoutGravity(&this->actor); } -void func_80BCB1C8(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCB1C8(EnScopenuts* this, PlayState* play) { this->unk_350 *= 0.92f; Actor_SetScale(&this->actor, this->unk_350); if (this->actor.bgCheckFlags & 1) { @@ -244,7 +244,7 @@ void func_80BCB1C8(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCB230(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCB230(EnScopenuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 sp24 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); @@ -256,7 +256,7 @@ void func_80BCB230(EnScopenuts* this, GlobalContext* globalCtx) { this->actionFunc = func_80BCB4DC; this->unk_348 = 3; this->collider.dim.height = 64; - func_80BCAC40(this, globalCtx); + func_80BCAC40(this, play); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); } else if (sp26 == sp24) { if ((this->unk_348 == 4) || (this->unk_348 == 18)) { @@ -285,24 +285,24 @@ void func_80BCB230(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCB4DC(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCB4DC(EnScopenuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80BCB52C; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); } } -void func_80BCB52C(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCB52C(EnScopenuts* 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->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_33C = func_80BCAF0C(this); - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); this->actionFunc = func_80BCB6D0; } else if (((this->actor.xzDistToPlayer < 100.0f) && (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } else if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_348 = 4; @@ -311,15 +311,15 @@ void func_80BCB52C(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80BCB6D0(EnScopenuts* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->unk_328 & 1) { this->unk_328 &= ~1; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_328 &= ~4; this->unk_348 = 8; @@ -327,22 +327,22 @@ void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx) { this->actionFunc = func_80BCBA00; } else { this->unk_33C = func_80BCAF0C(this); - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } } } else if (temp_v0 == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees < this->unk_358) { play_sound(NA_SE_SY_ERROR); this->unk_33C = 0x1636; this->unk_328 |= 1; - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); } else { func_8019F208(); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; func_801159EC(this->unk_358 * -1); this->actionFunc = func_80BCB90C; } @@ -355,38 +355,38 @@ void func_80BCB6D0(EnScopenuts* this, GlobalContext* globalCtx) { this->unk_33C = 0x1635; this->unk_328 |= 1; } - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); break; } } } else if (temp_v0 == 6) { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); this->actionFunc = func_80BCB980; } } -void func_80BCB90C(EnScopenuts* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80BCB90C(EnScopenuts* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; gSaveContext.save.weekEventReg[53] |= 2; this->actionFunc = func_80BCB6D0; } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); } } -void func_80BCB980(EnScopenuts* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BCB980(EnScopenuts* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_33C = 0x1637; this->unk_328 |= 1; - Message_StartTextbox(globalCtx, this->unk_33C, &this->actor); + Message_StartTextbox(play, this->unk_33C, &this->actor); this->actionFunc = func_80BCB6D0; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80BCBA00(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCBA00(EnScopenuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; s16 sp24 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); @@ -473,7 +473,7 @@ void func_80BCBA00(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCBC60(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCBC60(EnScopenuts* this, PlayState* play) { f32 sp24; Vec3f sp18; @@ -484,7 +484,7 @@ void func_80BCBC60(EnScopenuts* this, GlobalContext* globalCtx) { sp18.x = this->actor.world.pos.x; sp18.y = this->unk_32C; sp18.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp18); + func_800B14D4(play, 20.0f, &sp18); } if (sp24 > 5.0f) { @@ -495,7 +495,7 @@ void func_80BCBC60(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCBD28(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCBD28(EnScopenuts* this, PlayState* play) { Vec3f sp44; s16 sp42 = this->skelAnime.curFrame; s16 sp40 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); @@ -514,14 +514,14 @@ void func_80BCBD28(EnScopenuts* this, GlobalContext* globalCtx) { if (DECR(this->unk_34E) == 0) { if (!(this->unk_370 & 3)) { sp44 = this->actor.world.pos; - func_800B14D4(globalCtx, 20.0f, &sp44); + func_800B14D4(play, 20.0f, &sp44); } this->actor.velocity.y = 5.0f; } else if (!(this->unk_370 & 3)) { sp44.x = this->actor.world.pos.x; sp44.y = this->unk_32C; sp44.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp44); + func_800B14D4(play, 20.0f, &sp44); } if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { @@ -529,12 +529,12 @@ void func_80BCBD28(EnScopenuts* this, GlobalContext* globalCtx) { this->unk_348 = 9; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 9); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - func_80BCAC40(this, globalCtx); + func_80BCAC40(this, play); this->actionFunc = func_80BCBF0C; } } -void func_80BCBF0C(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCBF0C(EnScopenuts* this, PlayState* play) { this->unk_340 += this->unk_34C; if (this->unk_368 >= 1.0f) { this->unk_368 = 1.0f; @@ -554,7 +554,7 @@ void func_80BCBF0C(EnScopenuts* this, GlobalContext* globalCtx) { } } -void func_80BCBFFC(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCBFFC(EnScopenuts* this, PlayState* play) { Vec3s sp38; f32 sp34; s16 sp32 = 0; @@ -625,7 +625,7 @@ void func_80BCBFFC(EnScopenuts* this, GlobalContext* globalCtx) { this->unk_36E++; } -void func_80BCC288(EnScopenuts* this, GlobalContext* globalCtx) { +void func_80BCC288(EnScopenuts* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -680,7 +680,7 @@ f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { return sp20.y - arg2->y; } -void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnScopenuts_Init(Actor* thisx, PlayState* play) { s32 pad; EnScopenuts* this = THIS; @@ -691,10 +691,10 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, this->morphTable, 28); - 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->unk_350 = 0.01f; Actor_SetScale(&this->actor, 0.01f); @@ -707,8 +707,8 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) { if (gSaveContext.save.weekEventReg[52] & 0x40) { Actor_MarkForDeath(&this->actor); - } else if (globalCtx->actorCtx.unk5 & 2) { - this->path = SubS_GetPathByIndex(globalCtx, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); + } else if (play->actorCtx.unk5 & 2) { + this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); this->actor.draw = NULL; this->actionFunc = func_80BCAFA8; this->actor.gravity = 0.0f; @@ -717,7 +717,7 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { } } else if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_1) { if (gSaveContext.save.weekEventReg[52] & 0x40) { - this->path = SubS_GetPathByIndex(globalCtx, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); if (this->path == NULL) { Actor_MarkForDeath(&this->actor); } else { @@ -739,29 +739,28 @@ void EnScopenuts_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnScopenuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnScopenuts_Destroy(Actor* thisx, PlayState* play) { EnScopenuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnScopenuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnScopenuts_Update(Actor* thisx, PlayState* play) { EnScopenuts* this = THIS; Actor_SetFocus(&this->actor, 60.0f); SkelAnime_Update(&this->skelAnime); Actor_MoveWithGravity(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_328 & 8) { func_800B9010(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); } - func_80BCAE78(this, globalCtx); + func_80BCAE78(this, play); } -s32 EnScopenuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnScopenuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnScopenuts* this = THIS; if (((this->unk_348 == 4) && (this->unk_35A == 0)) || ((this->unk_348 == 8) && (this->unk_35A == 0)) || @@ -802,10 +801,10 @@ s32 EnScopenuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnScopenuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnScopenuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnScopenuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnScopenuts_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnScopenuts* this = THIS; if (((this->unk_35A == 1) || (this->unk_35A == 2)) && ((limbIndex == 23) || (limbIndex == 24))) { @@ -821,11 +820,11 @@ void EnScopenuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Acto } } -void EnScopenuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnScopenuts_Draw(Actor* thisx, PlayState* play) { EnScopenuts* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnScopenuts_OverrideLimbDraw, EnScopenuts_PostLimbDraw, EnScopenuts_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h index c4a00f84a4..c3f66a6cee 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h @@ -5,7 +5,7 @@ struct EnScopenuts; -typedef void (*EnScopenutsActionFunc)(struct EnScopenuts*, GlobalContext*); +typedef void (*EnScopenutsActionFunc)(struct EnScopenuts*, PlayState*); #define ENSCOPENUTS_GET_3E0(thisx) (((thisx)->params & 0x3E0) >> 5) #define ENSCOPENUTS_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) 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 fc4f913082..19fac24a82 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -10,13 +10,13 @@ #define THIS ((EnSda*)thisx) -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_8094702C(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx); -void func_80947668(u8* shadowTexture, Player* player, GlobalContext* globalCtx); +void func_8094702C(EnSda* this, u8* shadowTexture, Player* player, PlayState* play); +void func_80947668(u8* shadowTexture, Player* player, PlayState* play); Vec3f D_80947EA0[16]; @@ -72,40 +72,40 @@ static s32 sPad[2] = { 0, 0 }; #include "overlays/ovl_En_Sda/ovl_En_Sda.c" -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) { EnSda* this = THIS; Player* player; if (this->actor.params == ENSDA_1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } this->actor.world.pos = player->actor.world.pos; } -void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSda_Draw(Actor* thisx, PlayState* play) { EnSda* this = THIS; Player* player; - u8* shadowTexture = GRAPH_ALLOC(globalCtx->state.gfxCtx, 64 * 64); + u8* shadowTexture = GRAPH_ALLOC(play->state.gfxCtx, 64 * 64); if (this->actor.params == ENSDA_1) { player = (Player*)this->actor.parent; } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); } player->actor.shape.shadowAlpha = 0; - func_8094702C(this, shadowTexture, player, globalCtx); + func_8094702C(this, shadowTexture, player, play); if (KREG(0) < 5) { - func_80947668(shadowTexture, player, globalCtx); + func_80947668(shadowTexture, player, play); } } @@ -209,7 +209,7 @@ void func_809469C0(Player* player, u8* shadowTexture, f32 arg2) { } } -void func_8094702C(EnSda* this, u8* shadowTexture, Player* player, GlobalContext* globalCtx) { +void func_8094702C(EnSda* this, u8* shadowTexture, Player* player, PlayState* play) { s16 temp_t0; s16 temp_t1; s16 temp_v0; @@ -315,15 +315,15 @@ void func_8094702C(EnSda* this, u8* shadowTexture, Player* player, GlobalContext } } -void func_80947668(u8* shadowTexture, Player* player, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void func_80947668(u8* shadowTexture, Player* player, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 tempx; f32 tempz; s16 i; OPEN_DISPS(gfxCtx); - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 0, (BREG(52) + 50)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); @@ -339,7 +339,7 @@ void func_80947668(u8* shadowTexture, Player* player, GlobalContext* globalCtx) 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_En_Sda_DL_1498); gDPLoadTextureBlock(POLY_XLU_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); @@ -347,7 +347,7 @@ void func_80947668(u8* shadowTexture, Player* player, GlobalContext* globalCtx) for (i = 0; i < KREG(78); i++) { 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_En_Sda_DL_14B8); } diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index 5ce4184a6f..e33da10737 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -10,14 +10,14 @@ #define THIS ((EnSekihi*)thisx) -void EnSekihi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSekihi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSekihi_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSekihi_Init(Actor* thisx, PlayState* play); +void EnSekihi_Destroy(Actor* thisx, PlayState* play); +void EnSekihi_Update(Actor* thisx, PlayState* play); -void func_80A44DE8(EnSekihi* this, GlobalContext* globalCtx); -void func_80A44F40(EnSekihi* this, GlobalContext* globalCtx); -void func_80A450B0(EnSekihi* this, GlobalContext* globalCtx); -void func_80A45130(EnSekihi* this, GlobalContext* globalCtx); +void func_80A44DE8(EnSekihi* this, PlayState* play); +void func_80A44F40(EnSekihi* this, PlayState* play); +void func_80A450B0(EnSekihi* this, PlayState* play); +void func_80A45130(EnSekihi* this, PlayState* play); #if 0 const ActorInit En_Sekihi_InitVars = { diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h index ab7d3bfb33..0835f61356 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h @@ -5,7 +5,7 @@ struct EnSekihi; -typedef void (*EnSekihiActionFunc)(struct EnSekihi*, GlobalContext*); +typedef void (*EnSekihiActionFunc)(struct EnSekihi*, PlayState*); typedef struct EnSekihi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 0d53b127e4..3faeedd7ed 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -11,27 +11,27 @@ #define THIS ((EnSellnuts*)thisx) -void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSellnuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSellnuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSellnuts_Init(Actor* thisx, PlayState* play); +void EnSellnuts_Destroy(Actor* thisx, PlayState* play); +void EnSellnuts_Update(Actor* thisx, PlayState* play); +void EnSellnuts_Draw(Actor* thisx, PlayState* play); -void func_80ADB4F4(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBAB8(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBBEC(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBCE4(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBE80(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADBFA0(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC2CC(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC37C(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC580(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC7B4(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADC8C4(EnSellnuts* this, GlobalContext* globalCtx); -void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx); +void func_80ADB4F4(EnSellnuts* this, PlayState* play); +void func_80ADB544(EnSellnuts* this, PlayState* play); +void func_80ADB924(EnSellnuts* this, PlayState* play); +void func_80ADBAB8(EnSellnuts* this, PlayState* play); +void func_80ADBBEC(EnSellnuts* this, PlayState* play); +void func_80ADBCE4(EnSellnuts* this, PlayState* play); +void func_80ADBD64(EnSellnuts* this, PlayState* play); +void func_80ADBE80(EnSellnuts* this, PlayState* play); +void func_80ADBFA0(EnSellnuts* this, PlayState* play); +void func_80ADC2CC(EnSellnuts* this, PlayState* play); +void func_80ADC37C(EnSellnuts* this, PlayState* play); +void func_80ADC580(EnSellnuts* this, PlayState* play); +void func_80ADC6D0(EnSellnuts* this, PlayState* play); +void func_80ADC7B4(EnSellnuts* this, PlayState* play); +void func_80ADC8C4(EnSellnuts* this, PlayState* play); +void func_80ADCA64(EnSellnuts* this, PlayState* play); s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2); f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3); @@ -111,14 +111,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 30, ICHAIN_STOP), }; -void func_80ADADD0(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADADD0(EnSellnuts* this, PlayState* play) { if (this->unk_338 & 2) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->unk_338 & 1) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); } } @@ -208,8 +208,8 @@ void func_80ADAFC0(EnSellnuts* this) { } } -Actor* func_80ADB040(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +Actor* func_80ADB040(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { if ((actor->id == ACTOR_EN_SELLNUTS) && !ENSELLNUTS_GET_1(actor)) { @@ -221,10 +221,10 @@ Actor* func_80ADB040(GlobalContext* globalCtx) { return NULL; } -f32 func_80ADB08C(GlobalContext* globalCtx) { +f32 func_80ADB08C(PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); - Actor* sp18 = func_80ADB040(globalCtx); + Player* player = GET_PLAYER(play); + Actor* sp18 = func_80ADB040(play); if (sp18 != NULL) { return Math_Vec3f_DistXZ(&player->actor.world.pos, &sp18->home.pos); @@ -233,7 +233,7 @@ f32 func_80ADB08C(GlobalContext* globalCtx) { return 80.0f; } -void func_80ADB0D8(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADB0D8(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -287,7 +287,7 @@ void func_80ADB0D8(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADB254(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADB254(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -328,20 +328,20 @@ void func_80ADB254(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADB4F4(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADB4F4(EnSellnuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80ADB544; SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); } } -void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADB544(EnSellnuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - if (Player_GetExchangeItemId(globalCtx) == EXCH_ITEM_2A) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_2A) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; this->actionFunc = func_80ADBAB8; @@ -350,27 +350,27 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { case 0x60E: gSaveContext.save.weekEventReg[17] |= 0x20; gSaveContext.save.weekEventReg[86] |= 4; - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); + Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x628: gSaveContext.save.weekEventReg[77] |= 0x40; gSaveContext.save.weekEventReg[86] |= 4; - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); + Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x614: gSaveContext.save.weekEventReg[17] |= 0x40; - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); + Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; case 0x610: case 0x616: case 0x629: - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); + Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; break; @@ -382,7 +382,7 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } else if (((this->actor.xzDistToPlayer < 80.0f) && (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || this->actor.isTargeted) { - func_800B85E0(&this->actor, globalCtx, 80.0f, EXCH_ITEM_2A); + func_800B85E0(&this->actor, play, 80.0f, EXCH_ITEM_2A); if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -414,13 +414,13 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u8 msgState = Message_GetState(&globalCtx->msgCtx); +void func_80ADB924(EnSellnuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u8 msgState = Message_GetState(&play->msgCtx); s32 item; if (msgState == 0x10) { - item = func_80123810(globalCtx); + item = func_80123810(play); if (item > EXCH_ITEM_NONE) { if (item == EXCH_ITEM_2A) { player->actor.textId = D_80ADD928[this->unk_33A]; @@ -432,27 +432,27 @@ void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx) { this->unk_340 = player->actor.textId; this->actionFunc = func_80ADB0D8; } - func_801477B4(globalCtx); + func_801477B4(play); } else if (item < EXCH_ITEM_NONE) { this->unk_340 = D_80ADD920[this->unk_33A]; - func_80151938(globalCtx, this->unk_340); + func_80151938(play, this->unk_340); this->actionFunc = func_80ADB0D8; } - } else if ((msgState == 5) && Message_ShouldAdvance(globalCtx)) { + } else if ((msgState == 5) && Message_ShouldAdvance(play)) { if (this->unk_340 == D_80ADD910[this->unk_33A]) { this->unk_340 = D_80ADD938[this->unk_33A]; - func_80151938(globalCtx, this->unk_340); + func_80151938(play, this->unk_340); this->actionFunc = func_80ADB0D8; } else { this->unk_340 = 0xFF; - func_80151938(globalCtx, this->unk_340); + func_80151938(play, this->unk_340); this->actionFunc = func_80ADB0D8; } } } -void func_80ADBAB8(EnSellnuts* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_80ADBAB8(EnSellnuts* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -468,44 +468,44 @@ void func_80ADBAB8(EnSellnuts* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 6); } - if ((sp27 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((sp27 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = func_80ADBBEC; - func_800B7298(globalCtx, NULL, 0x13); + func_800B7298(play, NULL, 0x13); } } -void func_80ADBBEC(EnSellnuts* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80ADBBEC(EnSellnuts* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; gSaveContext.save.weekEventReg[17] |= 0x80; this->actionFunc = func_80ADBCE4; } else { - Actor_PickUp(&this->actor, globalCtx, GI_DEED_LAND, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_DEED_LAND, 300.0f, 300.0f); } } -void func_80ADBC60(EnSellnuts* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); +void func_80ADBC60(EnSellnuts* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; } } -void func_80ADBCE4(EnSellnuts* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); +void func_80ADBCE4(EnSellnuts* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; this->actionFunc = func_80ADBC60; } } -void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_80ADBD64(EnSellnuts* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -514,9 +514,9 @@ void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx) { SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); } - if ((sp27 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((sp27 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_338 &= ~2; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_34C = 8; @@ -525,7 +525,7 @@ void func_80ADBD64(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADBE80(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADBE80(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -555,10 +555,10 @@ void func_80ADBE80(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADBFA0(EnSellnuts* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void func_80ADBFA0(EnSellnuts* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (this->unk_34C == 0) { this->actionFunc = func_80ADB544; } else { @@ -567,7 +567,7 @@ void func_80ADBFA0(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC034(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC034(EnSellnuts* this, PlayState* play) { this->unk_344 += this->unk_364; if (this->unk_360 >= 1.0f) { this->unk_360 = 1.0f; @@ -586,7 +586,7 @@ void func_80ADC034(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC118(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC118(EnSellnuts* this, PlayState* play) { Vec3f sp34; s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -602,14 +602,14 @@ void func_80ADC118(EnSellnuts* this, GlobalContext* globalCtx) { if (DECR(this->unk_34A) == 0) { if (!(this->unk_328 & 3)) { sp34 = this->actor.world.pos; - func_800B14D4(globalCtx, 20.0f, &sp34); + func_800B14D4(play, 20.0f, &sp34); } this->actor.velocity.y = 5.0f; } else if (!(this->unk_328 & 3)) { sp34.x = this->actor.world.pos.x; sp34.y = this->unk_32C; sp34.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp34); + func_800B14D4(play, 20.0f, &sp34); } if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { @@ -621,7 +621,7 @@ void func_80ADC118(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC2CC(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC2CC(EnSellnuts* this, PlayState* play) { f32 sp24 = this->unk_32C - this->actor.world.pos.y; Vec3f sp18; @@ -630,7 +630,7 @@ void func_80ADC2CC(EnSellnuts* this, GlobalContext* globalCtx) { sp18.x = this->actor.world.pos.x; sp18.y = this->unk_32C; sp18.z = this->actor.world.pos.z; - func_800B14D4(globalCtx, 20.0f, &sp18); + func_800B14D4(play, 20.0f, &sp18); } if (sp24 > 5.0f) { @@ -640,7 +640,7 @@ void func_80ADC2CC(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC37C(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC37C(EnSellnuts* this, PlayState* play) { Vec3s sp30; f32 sp2C; @@ -689,17 +689,17 @@ void func_80ADC37C(EnSellnuts* this, GlobalContext* globalCtx) { this->unk_368++; } -void func_80ADC580(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC580(EnSellnuts* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } -void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADC5A4(EnSellnuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->linearVelocity = 0.0f; this->actor.flags &= ~ACTOR_FLAG_10000; - Message_StartTextbox(globalCtx, this->unk_340, &this->actor); + Message_StartTextbox(play, this->unk_340, &this->actor); if (this->unk_340 == 0x625) { this->unk_338 |= 1; this->actor.draw = EnSellnuts_Draw; @@ -710,18 +710,18 @@ void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~0x20; this->actionFunc = func_80ADC6D0; } - } else if (func_80ADB08C(globalCtx) < 80.0f) { + } else if (func_80ADB08C(play) < 80.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, this->actor.xzDistToPlayer); + func_800B8614(&this->actor, play, this->actor.xzDistToPlayer); } } -void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80ADC6D0(EnSellnuts* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -736,8 +736,8 @@ void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC7B4(EnSellnuts* this, GlobalContext* globalCtx) { - s32 temp = Message_GetState(&globalCtx->msgCtx); +void func_80ADC7B4(EnSellnuts* this, PlayState* play) { + s32 temp = Message_GetState(&play->msgCtx); if (this->unk_366 == 0) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -749,9 +749,9 @@ void func_80ADC7B4(EnSellnuts* this, GlobalContext* globalCtx) { } ActorCutscene_SetIntentToPlay(this->cutscene); } - } else if ((this->unk_366 == 1) && (temp == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + } else if ((this->unk_366 == 1) && (temp == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_366 = 0; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); @@ -761,7 +761,7 @@ void func_80ADC7B4(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADC8C4(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADC8C4(EnSellnuts* this, PlayState* play) { Vec3s sp30; if (this->unk_366 == 0) { @@ -806,7 +806,7 @@ void func_80ADC8C4(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADCA64(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -841,7 +841,7 @@ void func_80ADCA64(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADCC04(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADCC04(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -857,9 +857,9 @@ void func_80ADCC04(EnSellnuts* this, GlobalContext* globalCtx) { } else if (this->unk_34C == 21) { func_80ADAFC0(this); if (currentFrame == 0) { - if (func_80ADB08C(globalCtx) < 9999.0f) { + if (func_80ADB08C(play) < 9999.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 9999.0f); + func_800B8614(&this->actor, play, 9999.0f); } this->unk_340 = 0x626; this->unk_34C = 0; @@ -869,7 +869,7 @@ void func_80ADCC04(EnSellnuts* this, GlobalContext* globalCtx) { } } -void func_80ADCD3C(EnSellnuts* this, GlobalContext* globalCtx) { +void func_80ADCD3C(EnSellnuts* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); if (gSaveContext.save.weekEventReg[73] & 4) { this->unk_338 |= 2; @@ -941,10 +941,10 @@ f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { return sp20.y - pos->y; } -void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSellnuts_Init(Actor* thisx, PlayState* play) { EnSellnuts* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; if ((gSaveContext.save.weekEventReg[17] & 0x80) || (gSaveContext.save.weekEventReg[61] & 0x10)) { @@ -952,12 +952,12 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnt_Skel_00AC70, &object_dnt_Anim_005488, this->jointTable, this->morphTable, 28); - 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->path = SubS_GetPathByIndex(globalCtx, ENSELLNUTS_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSELLNUTS_GET_FC00(&this->actor), 0x3F); this->cutscene = this->actor.cutscene; Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.cylRadius = 0; @@ -1023,15 +1023,15 @@ void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSellnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSellnuts_Destroy(Actor* thisx, PlayState* play) { EnSellnuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSellnuts_Update(Actor* thisx, PlayState* play) { EnSellnuts* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_328++; if (player->transformation == PLAYER_FORM_DEKU) { @@ -1048,15 +1048,14 @@ void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); SkelAnime_Update(&this->skelAnime); Actor_MoveWithGravity(&this->actor); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_338 & 8) { func_800B9010(&this->actor, NA_SE_EN_AKINDO_FLY - SFX_FLAG); } - func_80ADADD0(this, globalCtx); + func_80ADADD0(this, play); } -s32 EnSellnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSellnuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSellnuts* this = THIS; if (((this->unk_34C == 4) && (this->unk_350 == 0)) || ((this->unk_34C == 8) && (this->unk_350 == 0)) || @@ -1115,10 +1114,10 @@ s32 EnSellnuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d return false; } -void EnSellnuts_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSellnuts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { } -void EnSellnuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnSellnuts_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnSellnuts* this = THIS; if (((this->unk_350 == 1) || (this->unk_350 == 3)) && ((limbIndex == 23) || (limbIndex == 24))) { @@ -1135,11 +1134,11 @@ void EnSellnuts_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor } } -void EnSellnuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSellnuts_Draw(Actor* thisx, PlayState* play) { EnSellnuts* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSellnuts_OverrideLimbDraw, EnSellnuts_PostLimbDraw, EnSellnuts_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h index 24dfbbf9e3..bce0273c60 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h @@ -5,7 +5,7 @@ struct EnSellnuts; -typedef void (*EnSellnutsActionFunc)(struct EnSellnuts*, GlobalContext*); +typedef void (*EnSellnutsActionFunc)(struct EnSellnuts*, PlayState*); #define ENSELLNUTS_GET_1(thisx) ((thisx)->params & 1) #define ENSELLNUTS_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 0b9905ba52..720a94c807 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -11,13 +11,13 @@ #define THIS ((EnShn*)thisx) -void EnShn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnShn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnShn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnShn_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80AE69E8(EnShn* this, GlobalContext* globalCtx); -void func_80AE6A64(EnShn* this, GlobalContext* globalCtx); -s32 func_80AE6704(EnShn* this, GlobalContext* globalCtx); +void EnShn_Init(Actor* thisx, PlayState* play); +void EnShn_Destroy(Actor* thisx, PlayState* play); +void EnShn_Update(Actor* thisx, PlayState* play); +void EnShn_Draw(Actor* thisx, PlayState* play); +void func_80AE69E8(EnShn* this, PlayState* play); +void func_80AE6A64(EnShn* this, PlayState* play); +s32 func_80AE6704(EnShn* this, PlayState* play); // Could be something related to text/dialogue? static UNK_TYPE D_80AE6F00[] = { @@ -114,8 +114,8 @@ s32 EnShn_IsFacingPlayer(EnShn* this) { return Actor_IsFacingAndNearPlayer(&this->actor, range, 0x238C); } -Player* EnShn_GetPlayer(EnShn* this, GlobalContext* globalCtx) { - return GET_PLAYER(globalCtx); +Player* EnShn_GetPlayer(EnShn* this, PlayState* play) { + return GET_PLAYER(play); } void func_80AE626C(EnShn* this) { @@ -138,11 +138,11 @@ void func_80AE626C(EnShn* this) { this->unk_2BA = CLAMP(this->unk_2BA, -0x1554, 0x1554); } -void func_80AE63A8(EnShn* this, GlobalContext* globalCtx) { +void func_80AE63A8(EnShn* this, PlayState* play) { s16 phi_v1; s16 phi_v1_2; - this->shnPlayerRef = EnShn_GetPlayer(this, globalCtx); + this->shnPlayerRef = EnShn_GetPlayer(this, play); if ((this->unk_1D8 & 8) && (this->shnPlayerRef != NULL)) { if (this->unk_2CA == 0) { phi_v1 = 0; @@ -175,20 +175,20 @@ void func_80AE63A8(EnShn* this, GlobalContext* globalCtx) { } } -void func_80AE6488(EnShn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE6488(EnShn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 tempMsgState; f32 phi_f0_2; f32 phi_f0; - tempMsgState = Message_GetState(&globalCtx->msgCtx); + tempMsgState = Message_GetState(&play->msgCtx); this->unk_2D4 += (this->unk_2D0 != 0.0f) ? 40.0f : -40.0f; this->unk_2D4 = CLAMP(this->unk_2D4, 0.0f, 80.0f); Matrix_Translate(this->unk_2D4, 0.0f, 0.0f, MTXMODE_APPLY); if ((&this->actor == player->targetActor) && - ((globalCtx->msgCtx.currentTextId < 0xFF) || (globalCtx->msgCtx.currentTextId >= 0x201)) && - (tempMsgState == 3) && (this->msgState == 3)) { - if (globalCtx->state.frames % 2 == 0) { + ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId >= 0x201)) && (tempMsgState == 3) && + (this->msgState == 3)) { + if (play->state.frames % 2 == 0) { if (this->unk_2D0 != 0.0f) { this->unk_2D0 = 0.0f; } else { @@ -201,9 +201,9 @@ void func_80AE6488(EnShn* this, GlobalContext* globalCtx) { this->msgState = tempMsgState; } -s32 func_80AE65F4(EnShn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u16 temp = globalCtx->msgCtx.currentTextId; +s32 func_80AE65F4(EnShn* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 temp = play->msgCtx.currentTextId; if (player->stateFlags1 & 0x40) { if (this->unk_1DA != temp) { @@ -229,7 +229,7 @@ s32 func_80AE65F4(EnShn* this, GlobalContext* globalCtx) { return false; } -s32 func_80AE6704(EnShn* thisx, GlobalContext* globalCtx) { +s32 func_80AE6704(EnShn* thisx, PlayState* play) { EnShn* this = THIS; s32 ret = 0; @@ -257,11 +257,11 @@ s32 func_80AE6704(EnShn* thisx, GlobalContext* globalCtx) { break; case 6: gSaveContext.save.weekEventReg[90] &= (u8)~0x40; - func_800B7298(globalCtx, &this->actor, 7); - globalCtx->nextEntranceIndex = 0x8460; + func_800B7298(play, &this->actor, 7); + play->nextEntranceIndex = 0x8460; gSaveContext.nextCutsceneIndex = 0; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 3; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 3; gSaveContext.nextTransition = 7; this->unk_2C6++; break; @@ -269,7 +269,7 @@ s32 func_80AE6704(EnShn* thisx, GlobalContext* globalCtx) { return ret; } -UNK_TYPE* func_80AE6880(EnShn* this, GlobalContext* globalCtx) { +UNK_TYPE* func_80AE6880(EnShn* this, PlayState* play) { if (this->unk_2BE != 0) { return D_80AE70B0; } @@ -284,12 +284,12 @@ UNK_TYPE* func_80AE6880(EnShn* this, GlobalContext* globalCtx) { return D_80AE6F00; } -s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AE68F0(EnShn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = 0; if (this->unk_1D8 & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1D8 &= ~0x180; if (player->exchangeItemId == EXCH_ITEM_13) { this->unk_1D8 |= 0x80; @@ -299,7 +299,7 @@ s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { this->unk_2E4 = player->exchangeItemId; } SubS_UpdateFlags(&this->unk_1D8, 0, 7); - this->unk_1DC = func_80AE6880(this, globalCtx); + this->unk_1DC = func_80AE6880(this, play); this->unk_2C6 = 0; if (gSaveContext.save.weekEventReg[23] & 8) { this->unk_1D8 |= 8; @@ -311,7 +311,7 @@ s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { return ret; } -void func_80AE69E8(EnShn* this, GlobalContext* globalCtx) { +void func_80AE69E8(EnShn* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); if ((gSaveContext.save.weekEventReg[23] & 8) && EnShn_IsFacingPlayer(this)) { this->unk_1D8 |= 8; @@ -320,12 +320,12 @@ void func_80AE69E8(EnShn* this, GlobalContext* globalCtx) { } } -void func_80AE6A64(EnShn* this, GlobalContext* globalCtx) { +void func_80AE6A64(EnShn* this, PlayState* play) { s16 yawBetweenActors; Vec3f playerPos; Vec3f shnPos; - if (func_8010BF58(&this->actor, globalCtx, this->unk_1DC, this->unk_2D8, &this->unk_1E0)) { + if (func_8010BF58(&this->actor, play, this->unk_1DC, this->unk_2D8, &this->unk_1E0)) { SubS_UpdateFlags(&this->unk_1D8, 3, 7); this->unk_1D8 &= ~8; this->unk_1D8 |= 0x20; @@ -341,11 +341,11 @@ void func_80AE6A64(EnShn* this, GlobalContext* globalCtx) { } } -void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnShn_Init(Actor* thisx, PlayState* play) { EnShn* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, NULL, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); this->unk_2E8 = -1; if (gSaveContext.save.weekEventReg[23] & 8) { @@ -368,40 +368,40 @@ void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80AE69E8; } -void EnShn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnShn_Destroy(Actor* thisx, PlayState* play) { } -void EnShn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnShn_Update(Actor* thisx, PlayState* play) { EnShn* this = THIS; - func_80AE68F0(this, globalCtx); - this->actionFunc(this, globalCtx); - func_80AE65F4(this, globalCtx); + func_80AE68F0(this, play); + this->actionFunc(this, play); + func_80AE65F4(this, play); func_80AE6130(this); - func_80AE63A8(this, globalCtx); + func_80AE63A8(this, play); this->unk_2E0 = 0; - func_8013C964(&this->actor, globalCtx, 120.0f, 40.0f, EXCH_ITEM_NONE, this->unk_1D8 & 7); + func_8013C964(&this->actor, play, 120.0f, 40.0f, EXCH_ITEM_NONE, this->unk_1D8 & 7); } -s32 EnShn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnShn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnShn* this = THIS; if (limbIndex == BURLY_GUY_LIMB_HEAD) { - func_80AE6488(this, globalCtx); + func_80AE6488(this, play); *dList = gSwampGuideHeadDL; } return false; } Vec3f D_80AE7270 = { 1200.0f, 0.0f, 0.0f }; -void EnShn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnShn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { if (limbIndex == BURLY_GUY_LIMB_HEAD) { Matrix_MultVec3f(&D_80AE7270, &thisx->focus.pos); Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot); } } -void EnShn_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnShn_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnShn* this = THIS; s32 stepRot; s32 overrideRot; @@ -431,11 +431,11 @@ void EnShn_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void EnShn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnShn_Draw(Actor* thisx, PlayState* play) { EnShn* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnShn_OverrideLimbDraw, EnShn_PostLimbDraw, EnShn_TransformLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.h b/src/overlays/actors/ovl_En_Shn/z_en_shn.h index 22e10ca329..eb0e46ee7e 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.h +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.h @@ -6,7 +6,7 @@ struct EnShn; -typedef void (*EnShnActionFunc)(struct EnShn*, GlobalContext*); +typedef void (*EnShnActionFunc)(struct EnShn*, PlayState*); typedef struct EnShn { /* 0x000 */ 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 8933d53057..eccfc5f1ef 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -10,13 +10,13 @@ #define THIS ((EnSi*)thisx) -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); -void func_8098CB70(EnSi* this, GlobalContext* globalCtx); -void func_8098CBDC(EnSi* this, GlobalContext* globalCtx); +void func_8098CB70(EnSi* this, PlayState* play); +void func_8098CBDC(EnSi* this, PlayState* play); #if 0 const ActorInit En_Si_InitVars = { 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 26e33e728a..03e7763737 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -5,7 +5,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_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index c98c279cec..0c79b6a4e3 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -13,41 +13,41 @@ #define THIS ((EnSkb*)thisx) -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_80994E2C(EnSkb* this); -void func_80994E94(EnSkb* this, GlobalContext* globalCtx); -void func_80995068(EnSkb* this, GlobalContext* globalCtx); -void func_80995190(EnSkb* this, GlobalContext* globalCtx); -void func_80995244(EnSkb* this, GlobalContext* globalCtx); +void func_80994E94(EnSkb* this, PlayState* play); +void func_80995068(EnSkb* this, PlayState* play); +void func_80995190(EnSkb* this, PlayState* play); +void func_80995244(EnSkb* this, PlayState* play); void func_809952D8(EnSkb* this); -void func_8099533C(EnSkb* this, GlobalContext* globalCtx); +void func_8099533C(EnSkb* this, PlayState* play); void func_809953E8(EnSkb* this); -void func_8099544C(EnSkb* this, GlobalContext* globalCtx); +void func_8099544C(EnSkb* this, PlayState* play); void func_809954F8(EnSkb* this); -void func_8099556C(EnSkb* this, GlobalContext* globalCtx); +void func_8099556C(EnSkb* this, PlayState* play); void func_8099571C(EnSkb* this); -void func_80995818(EnSkb* this, GlobalContext* globalCtx); -void func_8099599C(EnSkb* this, GlobalContext* globalCtx); +void func_80995818(EnSkb* this, PlayState* play); +void func_8099599C(EnSkb* this, PlayState* play); void func_80995A30(EnSkb* this); -void func_80995A8C(EnSkb* this, GlobalContext* globalCtx); +void func_80995A8C(EnSkb* this, PlayState* play); void func_80995C24(EnSkb* this); -void func_80995C84(EnSkb* this, GlobalContext* globalCtx); +void func_80995C84(EnSkb* this, PlayState* play); void func_80995D3C(EnSkb* this); -void func_80995DC4(EnSkb* this, GlobalContext* globalCtx); -void func_80995E64(EnSkb* this, GlobalContext* globalCtx); -void func_809960AC(EnSkb* this, GlobalContext* globalCtx); -void func_809961E4(EnSkb* this, GlobalContext* globalCtx); -void func_80996284(EnSkb* this, GlobalContext* globalCtx); -void func_8099630C(EnSkb* this, GlobalContext* globalCtx); -void func_809963D8(EnSkb* this, GlobalContext* globalCtx); +void func_80995DC4(EnSkb* this, PlayState* play); +void func_80995E64(EnSkb* this, PlayState* play); +void func_809960AC(EnSkb* this, PlayState* play); +void func_809961E4(EnSkb* this, PlayState* play); +void func_80996284(EnSkb* this, PlayState* play); +void func_8099630C(EnSkb* this, PlayState* play); +void func_809963D8(EnSkb* this, PlayState* play); void func_80996474(EnSkb* this); -void func_809964A0(EnSkb* this, GlobalContext* globalCtx); -s32 func_80996594(EnSkb* this, GlobalContext* globalCtx); -void func_80996BEC(EnSkb* this, GlobalContext* globalCtx); +void func_809964A0(EnSkb* this, PlayState* play); +s32 func_80996594(EnSkb* this, PlayState* play); +void func_80996BEC(EnSkb* this, PlayState* play); static AnimationInfo sAnimations[] = { { &object_skb_Anim_0064E0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, @@ -157,7 +157,7 @@ const ActorInit En_Skb_InitVars = { (ActorFunc)EnSkb_Draw, }; -void func_809947B0(GlobalContext* globalCtx, EnSkb* this, Vec3f* inPos) { +void func_809947B0(PlayState* play, EnSkb* this, Vec3f* inPos) { Vec3f pos; Vec3f velocity = { 0.0f, 8.0f, 0.0f }; Vec3f accel = { 0.0f, -1.5f, 0.0f }; @@ -170,34 +170,34 @@ void func_809947B0(GlobalContext* globalCtx, EnSkb* this, Vec3f* inPos) { accel.x = randPlusMinusPoint5Scaled(1.0f); accel.z = randPlusMinusPoint5Scaled(1.0f); velocity.y += (Rand_ZeroOne() - 0.5f) * 4.0f; - EffectSsHahen_Spawn(globalCtx, &pos, &velocity, &accel, 0, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, + EffectSsHahen_Spawn(play, &pos, &velocity, &accel, 0, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, HAHEN_OBJECT_DEFAULT, 10, NULL); - func_800BBFB0(globalCtx, &pos, 10.0f, 1, 150, 0, 1); + func_800BBFB0(play, &pos, 10.0f, 1, 150, 0, 1); } -void func_8099495C(EnSkb* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_003584, this->jointTable, +void func_8099495C(EnSkb* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_003584, this->jointTable, this->morphTable, 20); this->unk_3DC = 0; func_80994E2C(this); } -void func_809949C4(EnSkb* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, +void func_809949C4(EnSkb* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_00697C, this->jointTable, this->morphTable, 20); this->unk_3DC = 1; func_809952D8(this); } -void func_80994A30(EnSkb* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_006D90, this->jointTable, +void func_80994A30(EnSkb* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_006D90, this->jointTable, this->morphTable, 20); this->unk_3DC = 1; func_809953E8(this); } -void func_80994A9C(EnSkb* this, GlobalContext* globalCtx) { - SkelAnime_Init(globalCtx, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_001D1C, this->jointTable, +void func_80994A9C(EnSkb* this, PlayState* play) { + SkelAnime_Init(play, &this->skelAnime, &object_skb_Skel_005EF8, &object_skb_Anim_001D1C, this->jointTable, this->morphTable, 20); this->unk_3DC = 1; func_809954F8(this); @@ -208,7 +208,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 = THIS; s32 pad; @@ -222,41 +222,40 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = 70; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - 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.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = 10; this->collider.elements[1].dim.modelSphere.radius = this->collider.elements[1].dim.worldSphere.radius = 20; this->actor.home.pos = this->actor.world.pos; this->unk_3D6 = ENSKB_GET_F0(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; - if ((globalCtx->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && - (globalCtx->csCtx.currentCsIndex == 0)) { + if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } switch (this->unk_3D6) { case 2: - func_809949C4(this, globalCtx); + func_809949C4(this, play); break; case 3: - func_80994A30(this, globalCtx); + func_80994A30(this, play); break; case 4: - func_80994A9C(this, globalCtx); + func_80994A9C(this, play); break; default: this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.hintId = 0x55; - func_8099495C(this, globalCtx); + func_8099495C(this, play); break; } } -void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Destroy(Actor* thisx, PlayState* play) { EnSkb* this = THIS; if ((this->actor.parent != NULL) && (this->actor.parent->update != NULL) && @@ -275,12 +274,12 @@ void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void func_80994DA8(EnSkb* this, GlobalContext* globalCtx) { +void func_80994DA8(EnSkb* this, PlayState* play) { if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < 60.0f) && - (Player_GetMask(globalCtx) != PLAYER_MASK_CAPTAIN)) { + (Player_GetMask(play) != PLAYER_MASK_CAPTAIN)) { func_80995C24(this); } else { func_80995A30(this); @@ -296,7 +295,7 @@ void func_80994E2C(EnSkb* this) { this->actionFunc = func_80994E94; } -void func_80994E94(EnSkb* this, GlobalContext* globalCtx) { +void func_80994E94(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; @@ -306,8 +305,8 @@ void func_80994E94(EnSkb* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.shape.yOffset, 1.0f, 800.0f); Math_ApproachF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f); - if ((globalCtx->gameplayFrames % 2) == 0) { - func_809947B0(globalCtx, this, &this->actor.world.pos); + if ((play->gameplayFrames % 2) == 0) { + func_809947B0(play, this, &this->actor.world.pos); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.shape.yOffset == 0.0f)) { @@ -316,19 +315,19 @@ void func_80994E94(EnSkb* this, GlobalContext* globalCtx) { this->unk_3D0++; } -void func_80994F7C(EnSkb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80994F7C(EnSkb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3E2 = 1; if (this->unk_3E0 == 1) { - Message_StartTextbox(globalCtx, 0x13F8, &this->actor); + Message_StartTextbox(play, 0x13F8, &this->actor); } else { - Message_StartTextbox(globalCtx, 0x13F6, &this->actor); + Message_StartTextbox(play, 0x13F6, &this->actor); this->unk_3E0 = 1; } this->actionFunc = func_80995190; this->actor.speedXZ = 0.0f; } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && !(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } @@ -337,33 +336,33 @@ void func_8099504C(EnSkb* this) { this->actor.speedXZ = 0.0f; } -void func_80995068(EnSkb* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80995068(EnSkb* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3E2 = 1; if (this->unk_3E0 == 1) { - Message_StartTextbox(globalCtx, 0x13F8, &this->actor); + Message_StartTextbox(play, 0x13F8, &this->actor); if (this->unk_3DE == 2) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); } } else { - Message_StartTextbox(globalCtx, 0x13F6, &this->actor); + Message_StartTextbox(play, 0x13F6, &this->actor); this->unk_3E0 = 1; } this->actionFunc = func_80995190; this->actor.speedXZ = 0.0f; - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CAPTAIN) { + } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.hintId = 0x55; this->actor.colChkInfo.mass = MASS_HEAVY; func_80995A30(this); } else if (!(this->collider.base.acFlags & AC_HIT)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void func_80995190(EnSkb* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80995190(EnSkb* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -372,8 +371,8 @@ void func_80995190(EnSkb* this, GlobalContext* globalCtx) { break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - Message_StartTextbox(globalCtx, 0x13F7, &this->actor); + if (Message_ShouldAdvance(play)) { + Message_StartTextbox(play, 0x13F7, &this->actor); if (this->unk_3DE == 2) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); } @@ -381,14 +380,14 @@ void func_80995190(EnSkb* this, GlobalContext* globalCtx) { break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { this->actionFunc = func_80995244; } break; } } -void func_80995244(EnSkb* this, GlobalContext* globalCtx) { +void func_80995244(EnSkb* this, PlayState* play) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); this->unk_3E2 = 0; @@ -422,11 +421,11 @@ void func_809952D8(EnSkb* this) { this->actor.shape.yOffset = 0.0f; } -void func_8099533C(EnSkb* this, GlobalContext* globalCtx) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { +void func_8099533C(EnSkb* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80994F7C(this, globalCtx); + func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f)) { this->actor.hintId = 0x55; this->actor.colChkInfo.mass = MASS_HEAVY; @@ -444,11 +443,11 @@ void func_809953E8(EnSkb* this) { this->actor.shape.yOffset = 0.0f; } -void func_8099544C(EnSkb* this, GlobalContext* globalCtx) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { +void func_8099544C(EnSkb* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80994F7C(this, globalCtx); + func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f)) { this->actor.hintId = 0x55; this->actor.colChkInfo.mass = MASS_HEAVY; @@ -468,7 +467,7 @@ void func_809954F8(EnSkb* this) { this->actor.targetArrowOffset = 4000.0f; } -void func_8099556C(EnSkb* this, GlobalContext* globalCtx) { +void func_8099556C(EnSkb* this, PlayState* play) { s16 sp26; if (this->skelAnime.curFrame < 15.0f) { @@ -482,10 +481,10 @@ void func_8099556C(EnSkb* this, GlobalContext* globalCtx) { } this->actor.shape.rot.x = Math_SinS(this->unk_3D4 * sp26) * 20000.0f; - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80994F7C(this, globalCtx); + func_80994F7C(this, play); } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && (this->actor.xzDistToPlayer < 200.0f) && (this->skelAnime.curFrame > 24.0f) && (this->skelAnime.curFrame < 28.0f)) { this->actor.hintId = 0x55; @@ -516,7 +515,7 @@ void func_8099571C(EnSkb* this) { this->actionFunc = func_80995818; } -void func_80995818(EnSkb* this, GlobalContext* globalCtx) { +void func_80995818(EnSkb* this, PlayState* play) { s32 i; Math_ApproachF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f); @@ -530,7 +529,7 @@ void func_80995818(EnSkb* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; for (i = 0; i < 10; i++) { - func_809947B0(globalCtx, this, &this->actor.world.pos); + func_809947B0(play, this, &this->actor.world.pos); } } } @@ -546,11 +545,11 @@ void func_809958F4(EnSkb* this) { this->actionFunc = func_8099599C; } -void func_8099599C(EnSkb* this, GlobalContext* globalCtx) { +void func_8099599C(EnSkb* this, PlayState* play) { Math_ApproachF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f); - if ((globalCtx->gameplayFrames % 2) != 0) { - func_809947B0(globalCtx, this, &this->actor.world.pos); + if ((play->gameplayFrames % 2) != 0) { + func_809947B0(play, this, &this->actor.world.pos); } Math_ApproachF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f); @@ -568,8 +567,8 @@ void func_80995A30(EnSkb* this) { this->actionFunc = func_80995A8C; } -void func_80995A8C(EnSkb* this, GlobalContext* globalCtx) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { +void func_80995A8C(EnSkb* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.hintId = 0xFF; @@ -579,7 +578,7 @@ void func_80995A8C(EnSkb* this, GlobalContext* globalCtx) { return; } - if ((this->unk_3D8 != 0) && ((globalCtx->gameplayFrames % 16) == 0)) { + if ((this->unk_3D8 != 0) && ((play->gameplayFrames % 16) == 0)) { this->unk_3DA = randPlusMinusPoint5Scaled(50000.0f); } @@ -589,7 +588,7 @@ void func_80995A8C(EnSkb* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_WALK); } - if ((this->actor.xzDistToPlayer > 800.0f) || func_80996594(this, globalCtx)) { + if ((this->actor.xzDistToPlayer > 800.0f) || func_80996594(this, play)) { func_809958F4(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < 60.0f)) { func_80995C24(this); @@ -604,7 +603,7 @@ void func_80995C24(EnSkb* this) { this->actionFunc = func_80995C84; } -void func_80995C84(EnSkb* this, GlobalContext* globalCtx) { +void func_80995C84(EnSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 3.0f) && (this->unk_3E4 == 0)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_3E4 = 1; @@ -616,7 +615,7 @@ void func_80995C84(EnSkb* this, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); func_80995D3C(this); } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80994DA8(this, globalCtx); + func_80994DA8(this, play); } } @@ -628,9 +627,9 @@ void func_80995D3C(EnSkb* this) { this->actionFunc = func_80995DC4; } -void func_80995DC4(EnSkb* this, GlobalContext* globalCtx) { +void func_80995DC4(EnSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80994DA8(this, globalCtx); + func_80994DA8(this, play); } } @@ -644,7 +643,7 @@ void func_80995E08(EnSkb* this) { this->actionFunc = func_80995E64; } -void func_80995E64(EnSkb* this, GlobalContext* globalCtx) { +void func_80995E64(EnSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { this->actor.speedXZ = 0.0f; } @@ -658,9 +657,9 @@ void func_80995E64(EnSkb* this, GlobalContext* globalCtx) { if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { if (this->unk_3DC == 0) { if (this->actor.colChkInfo.health == 0) { - func_809961E4(this, globalCtx); + func_809961E4(this, play); } else { - func_80994DA8(this, globalCtx); + func_80994DA8(this, play); } } else { switch (this->unk_3D6) { @@ -702,12 +701,12 @@ void func_80995F98(EnSkb* this) { this->actionFunc = func_809960AC; } -void func_809960AC(EnSkb* this, GlobalContext* globalCtx) { +void func_809960AC(EnSkb* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { s32 i; for (i = 0; i < 10; i++) { - func_809947B0(globalCtx, this, &this->actor.world.pos); + func_809947B0(play, this, &this->actor.world.pos); } this->actor.speedXZ = 0.0f; } @@ -723,11 +722,11 @@ void func_809960AC(EnSkb* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.bgCheckFlags & 1)) { this->actor.shape.rot.x = 0; this->actor.world.rot = this->actor.shape.rot; - func_80994DA8(this, globalCtx); + func_80994DA8(this, play); } } -void func_809961E4(EnSkb* this, GlobalContext* globalCtx) { +void func_809961E4(EnSkb* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); this->unk_3D8 |= 0x40; if (this->actor.bgCheckFlags & 1) { @@ -735,15 +734,15 @@ void func_809961E4(EnSkb* this, GlobalContext* globalCtx) { } this->unk_3E4 = 0; this->actor.flags &= ~ACTOR_FLAG_1; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); this->unk_3DE = 7; this->actionFunc = func_80996284; } -void func_80996284(EnSkb* this, GlobalContext* globalCtx) { +void func_80996284(EnSkb* this, PlayState* play) { if (this->unk_3D8 & 0x80) { if (1) {} - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x10); func_80996474(this); } } @@ -753,7 +752,7 @@ void func_809962D4(EnSkb* this) { this->actionFunc = func_8099630C; } -void func_8099630C(EnSkb* this, GlobalContext* globalCtx) { +void func_8099630C(EnSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -764,10 +763,10 @@ void func_8099630C(EnSkb* this, GlobalContext* globalCtx) { this->unk_3D8 |= 1; func_80995F98(this); } else { - func_809961E4(this, globalCtx); + func_809961E4(this, play); } } else if (this->drawDmgEffTimer == 1) { - func_80996BEC(this, globalCtx); + func_80996BEC(this, play); } } @@ -775,7 +774,7 @@ void func_809963C4(EnSkb* this) { this->actionFunc = func_809963D8; } -void func_809963D8(EnSkb* this, GlobalContext* globalCtx) { +void func_809963D8(EnSkb* this, PlayState* play) { if (this->drawDmgEffTimer == 0) { this->drawDmgEffTimer = 0; this->drawDmgEffScale = 0.0f; @@ -786,7 +785,7 @@ void func_809963D8(EnSkb* this, GlobalContext* globalCtx) { this->unk_3D8 |= 1; func_80995F98(this); } else { - func_809961E4(this, globalCtx); + func_809961E4(this, play); } } } @@ -798,18 +797,18 @@ void func_80996474(EnSkb* this) { this->actionFunc = func_809964A0; } -void func_809964A0(EnSkb* this, GlobalContext* globalCtx) { +void func_809964A0(EnSkb* this, PlayState* play) { if ((this->unk_3D0++ < 19) ^ 1) { Actor_MarkForDeath(&this->actor); } } -void func_809964DC(EnSkb* this, GlobalContext* globalCtx) { +void func_809964DC(EnSkb* this, PlayState* play) { if (this->unk_3D6 == 0) { if ((this->actionFunc != func_80994E94) && (this->actionFunc != func_80996284) && (this->actionFunc != func_809964A0) && (gSaveContext.save.weekEventReg[85] & 0x40)) { this->actor.colChkInfo.health = 0; - func_809961E4(this, globalCtx); + func_809961E4(this, play); } } } @@ -826,7 +825,7 @@ s32 func_80996544(Vec2f arg0, Vec2f arg1) { return ret; } -s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { +s32 func_80996594(EnSkb* this, PlayState* play) { s32 temp_s2; s32 j; Vec2f sp60; @@ -868,15 +867,15 @@ s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { return sp54; } -void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { +void func_8099672C(EnSkb* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_3DE != 6) && (this->unk_3DE != 7)) { if ((this->actor.bgCheckFlags & 0x60) && (this->actor.depthInWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_3E4 = 0; - func_809961E4(this, globalCtx); + func_809961E4(this, play); return; } @@ -886,7 +885,7 @@ void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { switch (this->actor.colChkInfo.damageEffect) { default: if (this->drawDmgEffTimer > 1) { - func_80996BEC(this, globalCtx); + func_80996BEC(this, play); } this->drawDmgEffTimer = 0; break; @@ -903,7 +902,7 @@ void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { if (!Actor_ApplyDamage(&this->actor) && (this->actor.colChkInfo.damageEffect != 3) && (this->actor.colChkInfo.damageEffect != 4)) { this->unk_3D8 |= 0x40; - func_809961E4(this, globalCtx); + func_809961E4(this, play); return; } @@ -977,27 +976,27 @@ void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { } } -void func_80996AD0(EnSkb* this, GlobalContext* globalCtx) { +void func_80996AD0(EnSkb* this, PlayState* play) { if (1) {} if ((this->actionFunc != func_80996284) && (this->unk_3E2 != 1)) { if (this->unk_3E4 != 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (((this->unk_3DE != 0) || (this->unk_3D0 >= 11)) && (this->unk_3DE != 1) && (this->unk_3DE != 4) && (this->unk_3DE != 6) && (this->unk_3DE != 7) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if ((this->actionFunc != func_80996284) && (this->actionFunc != func_809964A0)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void func_80996BEC(EnSkb* this, GlobalContext* globalCtx) { +void func_80996BEC(EnSkb* this, PlayState* play) { static Color_RGBA8 D_80997550 = { 170, 255, 255, 255 }; static Color_RGBA8 D_80997554 = { 200, 200, 255, 255 }; static Vec3f D_80997558 = { 0.0f, -1.0, 0.0f }; @@ -1012,18 +1011,18 @@ void func_80996BEC(EnSkb* this, GlobalContext* globalCtx) { end = 14; } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < end; i++) { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->limbPos[i]); sp84.x = Math_SinS(yaw) * 3.0f; sp84.z = Math_CosS(yaw) * 3.0f; sp84.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - EffectSsEnIce_Spawn(globalCtx, &this->limbPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); + EffectSsEnIce_Spawn(play, &this->limbPos[i], 0.6f, &sp84, &D_80997558, &D_80997550, &D_80997554, 30); } } -void func_80996D68(EnSkb* this, GlobalContext* globalCtx) { +void func_80996D68(EnSkb* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -1042,43 +1041,43 @@ void func_80996D68(EnSkb* this, GlobalContext* globalCtx) { } } -void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSkb_Update(Actor* thisx, PlayState* play) { s32 pad; EnSkb* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != func_80995E64) && (this->actionFunc != func_80996284) && (this->actionFunc != func_8099630C) && (this->actionFunc != func_809963D8)) { SkelAnime_Update(&this->skelAnime); } - func_8099672C(this, globalCtx); + func_8099672C(this, play); if ((this->actionFunc != func_8099630C) && (this->actionFunc != func_809963D8) && (this->actionFunc != func_80995E64)) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); - func_809964DC(this, globalCtx); - func_80996AD0(this, globalCtx); - func_80996D68(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + func_809964DC(this, play); + func_80996AD0(this, play); + func_80996D68(this, play); } -s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSkb* this = THIS; s32 pad; s16 sins; if (limbIndex == 11) { if (!(this->unk_3D8 & 2)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - sins = fabsf(Math_SinS(globalCtx->gameplayFrames * 6000) * 95.0f) + 160.0f; + sins = fabsf(Math_SinS(play->gameplayFrames * 6000) * 95.0f) + 160.0f; gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sins, sins, sins, 255); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { *dList = NULL; } @@ -1093,19 +1092,19 @@ s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80997564 = { 800.0f, 1200.0f, 0.0f }; EnSkb* this = THIS; Collider_UpdateSpheres(limbIndex, &this->collider); if ((this->unk_3D8 & 1) && !(this->unk_3D8 & 2)) { if (limbIndex == 11) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); this->unk_3D8 |= 2; } } else if ((this->unk_3D8 & 0x40) && !(this->unk_3D8 & 0x80) && ((limbIndex != 11) || !(this->unk_3D8 & 1)) && (limbIndex != 12)) { - Actor_SpawnBodyParts(&this->actor, globalCtx, 1, dList); + Actor_SpawnBodyParts(&this->actor, play, 1, dList); } if (this->drawDmgEffTimer != 0) { @@ -1121,15 +1120,15 @@ 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 = THIS; this->limbCount = 0; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, EnSkb_PostLimbDraw, &this->actor); if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, this->limbCount, this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } 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 fe5722e53b..2e3d8e10a5 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -5,7 +5,7 @@ struct EnSkb; -typedef void (*EnSkbActionFunc)(struct EnSkb*, GlobalContext*); +typedef void (*EnSkbActionFunc)(struct EnSkb*, PlayState*); #define ENSKB_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 539d458ad6..b9660682fc 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -10,27 +10,27 @@ #define THIS ((EnSlime*)thisx) -void EnSlime_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSlime_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSlime_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSlime_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSlime_Init(Actor* thisx, PlayState* play); +void EnSlime_Destroy(Actor* thisx, PlayState* play); +void EnSlime_Update(Actor* thisx, PlayState* play); +void EnSlime_Draw(Actor* thisx, PlayState* play); -void func_80A2F140(EnSlime* this, GlobalContext* globalCtx); -void func_80A2F1A4(EnSlime* this, GlobalContext* globalCtx); -void func_80A2F418(EnSlime* this, GlobalContext* globalCtx); -void func_80A2F6CC(EnSlime* this, GlobalContext* globalCtx); -void func_80A2F8E0(EnSlime* this, GlobalContext* globalCtx); -void func_80A2FA88(EnSlime* this, GlobalContext* globalCtx); -void func_80A2FBA0(EnSlime* this, GlobalContext* globalCtx); -void func_80A2FE38(EnSlime* this, GlobalContext* globalCtx); -void func_80A30344(EnSlime* this, GlobalContext* globalCtx); -void func_80A304B8(EnSlime* this, GlobalContext* globalCtx); -void func_80A30820(EnSlime* this, GlobalContext* globalCtx); -void func_80A30944(EnSlime* this, GlobalContext* globalCtx); -void func_80A30A20(EnSlime* this, GlobalContext* globalCtx); -void func_80A30AE4(EnSlime* this, GlobalContext* globalCtx); -void func_80A30C2C(EnSlime* this, GlobalContext* globalCtx); -void func_80A30CEC(EnSlime* this, GlobalContext* globalCtx); +void func_80A2F140(EnSlime* this, PlayState* play); +void func_80A2F1A4(EnSlime* this, PlayState* play); +void func_80A2F418(EnSlime* this, PlayState* play); +void func_80A2F6CC(EnSlime* this, PlayState* play); +void func_80A2F8E0(EnSlime* this, PlayState* play); +void func_80A2FA88(EnSlime* this, PlayState* play); +void func_80A2FBA0(EnSlime* this, PlayState* play); +void func_80A2FE38(EnSlime* this, PlayState* play); +void func_80A30344(EnSlime* this, PlayState* play); +void func_80A304B8(EnSlime* this, PlayState* play); +void func_80A30820(EnSlime* this, PlayState* play); +void func_80A30944(EnSlime* this, PlayState* play); +void func_80A30A20(EnSlime* this, PlayState* play); +void func_80A30AE4(EnSlime* this, PlayState* play); +void func_80A30C2C(EnSlime* this, PlayState* play); +void func_80A30CEC(EnSlime* this, PlayState* play); #if 0 const ActorInit En_Slime_InitVars = { diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.h b/src/overlays/actors/ovl_En_Slime/z_en_slime.h index c24cae04e1..c90c49340f 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.h +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.h @@ -5,7 +5,7 @@ struct EnSlime; -typedef void (*EnSlimeActionFunc)(struct EnSlime*, GlobalContext*); +typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); typedef struct EnSlime { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 2b579bf8da..5d656af954 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -10,38 +10,38 @@ #define THIS ((EnSnowman*)thisx) -void EnSnowman_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSnowman_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSnowman_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSnowman_Init(Actor* thisx, PlayState* play); +void EnSnowman_Destroy(Actor* thisx, PlayState* play); +void EnSnowman_Update(Actor* thisx, PlayState* play); +void EnSnowman_Draw(Actor* thisx, PlayState* play); void EnSnowman_SetupMoveSnowPile(EnSnowman* this); -void EnSnowman_MoveSnowPile(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_SetupEmerge(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_Emerge(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_MoveSnowPile(EnSnowman* this, PlayState* play); +void EnSnowman_SetupEmerge(EnSnowman* this, PlayState* play); +void EnSnowman_Emerge(EnSnowman* this, PlayState* play); void EnSnowman_SetupReadySnowball(EnSnowman* this); -void EnSnowman_ReadySnowball(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_ReadySnowball(EnSnowman* this, PlayState* play); void EnSnowman_SetupThrowSnowball(EnSnowman* this); -void EnSnowman_ThrowSnowball(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_ThrowSnowball(EnSnowman* this, PlayState* play); void EnSnowman_SetupIdle(EnSnowman* this); -void EnSnowman_Idle(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_SetupSubmerge(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_Submerge(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_Melt(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_Stun(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_Damaged(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_Idle(EnSnowman* this, PlayState* play); +void EnSnowman_SetupSubmerge(EnSnowman* this, PlayState* play); +void EnSnowman_Submerge(EnSnowman* this, PlayState* play); +void EnSnowman_Melt(EnSnowman* this, PlayState* play); +void EnSnowman_Stun(EnSnowman* this, PlayState* play); +void EnSnowman_Damaged(EnSnowman* this, PlayState* play); void EnSnowman_SetupDead(EnSnowman* this); -void EnSnowman_Dead(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_Dead(EnSnowman* this, PlayState* play); void EnSnowman_SetupSplitDoNothing(EnSnowman* this); -void EnSnowman_SplitDoNothing(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_SplitDoNothing(EnSnowman* this, PlayState* play); void EnSnowman_SetupMarkForDeath(EnSnowman* this); -void EnSnowman_MarkForDeath(EnSnowman* this, GlobalContext* globalCtx); +void EnSnowman_MarkForDeath(EnSnowman* this, PlayState* play); void EnSnowman_CreateSplitEeno(EnSnowman* this, Vec3f* basePos, s32 yRot); -void EnSnowman_SetupCombine(EnSnowman* this, GlobalContext* globalCtx, Vec3f* combinePos); -void EnSnowman_Combine(EnSnowman* this, GlobalContext* globalCtx); -void EnSnowman_UpdateSnowball(Actor* thisx, GlobalContext* globalCtx); -void EnSnowman_DrawSnowPile(Actor* thisx, GlobalContext* globalCtx); -void EnSnowman_DrawSnowball(Actor* thisx, GlobalContext* globalCtx); +void EnSnowman_SetupCombine(EnSnowman* this, PlayState* play, Vec3f* combinePos); +void EnSnowman_Combine(EnSnowman* this, PlayState* play); +void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play); +void EnSnowman_DrawSnowPile(Actor* thisx, PlayState* play); +void EnSnowman_DrawSnowball(Actor* thisx, PlayState* play); typedef enum { // Indicates that this split Eeno is not currently trying to combine into a large Eeno. @@ -183,7 +183,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -void EnSnowman_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_Init(Actor* thisx, PlayState* play) { s32 pad; EnSnowman* this = THIS; s32 attackRange; @@ -196,19 +196,19 @@ void EnSnowman_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->params &= 7; if (EN_SNOWMAN_GET_TYPE(thisx) < EN_SNOWMAN_TYPE_SMALL_SNOWBALL) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gEenoSkel, &gEenoEmergeAnim, this->jointTable, - this->morphTable, EENO_LIMB_MAX); - SkelAnime_InitFlex(globalCtx, &this->snowPileSkelAnime, &gEenoSnowPileSkel, &gEenoSnowPileMoveAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gEenoSkel, &gEenoEmergeAnim, this->jointTable, this->morphTable, + EENO_LIMB_MAX); + SkelAnime_InitFlex(play, &this->snowPileSkelAnime, &gEenoSnowPileSkel, &gEenoSnowPileMoveAnim, this->snowPileJointTable, this->snowPileMorphTable, EENO_SNOW_PILE_LIMB_MAX); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); - Collider_InitAndSetCylinder(globalCtx, &this->collider, thisx, &sEenoCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sEenoCylinderInit); if (EN_SNOWMAN_GET_TYPE(thisx) == EN_SNOWMAN_TYPE_LARGE) { thisx->flags |= ACTOR_FLAG_400; - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_SNOWMAN, thisx->world.pos.x, - thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, EN_SNOWMAN_TYPE_SPLIT); - thisx->parent = Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SNOWMAN, - thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, - 0, 0, EN_SNOWMAN_TYPE_SPLIT, -1, thisx->unk20, NULL); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_SNOWMAN, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, 0, 0, 0, EN_SNOWMAN_TYPE_SPLIT); + thisx->parent = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SNOWMAN, thisx->world.pos.x, + thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, + EN_SNOWMAN_TYPE_SPLIT, -1, thisx->unk20, NULL); if ((thisx->child == NULL) || (thisx->parent == NULL)) { if (thisx->child != NULL) { Actor_MarkForDeath(thisx->child); @@ -238,10 +238,10 @@ void EnSnowman_Init(Actor* thisx, GlobalContext* globalCtx) { EnSnowman_SetupMoveSnowPile(this); } } else { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); thisx->flags &= ~ACTOR_FLAG_1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, thisx, &sSnowballCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sSnowballCylinderInit); thisx->world.rot.y = Actor_YawBetweenActors(thisx, &player->actor); thisx->velocity.y = (Actor_XZDistanceBetweenActors(thisx, &player->actor) * 0.035f) + -5.0f; thisx->velocity.y = CLAMP_MAX(thisx->velocity.y, 3.5f); @@ -279,16 +279,16 @@ void EnSnowman_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSnowman_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_Destroy(Actor* thisx, PlayState* play) { EnSnowman* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } /** * Spawns a circle of snow-colored dust around the actor. */ -void EnSnowman_SpawnCircularDustEffect(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_SpawnCircularDustEffect(EnSnowman* this, PlayState* play) { s16 angle = 0; Vec3f pos; f32 offset; @@ -299,7 +299,7 @@ void EnSnowman_SpawnCircularDustEffect(EnSnowman* this, GlobalContext* globalCtx offset = (Rand_ZeroFloat(10.0f) + 20.0f) * this->eenoScale; pos.x = (Math_SinS(angle) * offset) + this->actor.world.pos.x; pos.z = (Math_CosS(angle) * offset) + this->actor.world.pos.z; - func_800B0DE0(globalCtx, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, + func_800B0DE0(play, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, this->eenoScale * 400.0f, 10); angle += 0x1000; } @@ -308,7 +308,7 @@ void EnSnowman_SpawnCircularDustEffect(EnSnowman* this, GlobalContext* globalCtx /** * Spawns a batch of large snowball fragments and some snow-colored dust at snowballPos. */ -void EnSnowman_SpawnBigSnowballFragmentEffects(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_SpawnBigSnowballFragmentEffects(EnSnowman* this, PlayState* play) { static Vec3f sAccel = { 0.0f, -1.0f, 0.0f }; s16 altitude; s16 azimuth; @@ -327,12 +327,12 @@ void EnSnowman_SpawnBigSnowballFragmentEffects(EnSnowman* this, GlobalContext* g pos.x = (Rand_ZeroFloat(10.0f) * velocity.x) + this->snowballPos.x; pos.y = (Rand_ZeroFloat(8.0f) * velocity.y) + this->snowballPos.y; pos.z = (Rand_ZeroFloat(10.0f) * velocity.z) + this->snowballPos.z; - EffectSsHahen_Spawn(globalCtx, &pos, &velocity, &sAccel, 0, + EffectSsHahen_Spawn(play, &pos, &velocity, &sAccel, 0, Rand_S16Offset((((i % 3) * 50) + 50), (((i % 3) * 25) + 25)), 452, 20, sSnowballFragmentDLs[i % 3]); } - func_800B0DE0(globalCtx, &this->snowballPos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1000, 150); + func_800B0DE0(play, &this->snowballPos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1000, 150); } void EnSnowman_SetupMoveSnowPile(EnSnowman* this) { @@ -350,8 +350,8 @@ void EnSnowman_SetupMoveSnowPile(EnSnowman* this) { /** * Moves around beneath the snow as a snow pile. */ -void EnSnowman_MoveSnowPile(EnSnowman* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSnowman_MoveSnowPile(EnSnowman* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f combinePos; SkelAnime_Update(&this->snowPileSkelAnime); @@ -390,13 +390,13 @@ void EnSnowman_MoveSnowPile(EnSnowman* this, GlobalContext* globalCtx) { } combinePos.y = this->actor.world.pos.y; - EnSnowman_SetupCombine((EnSnowman*)this->actor.parent, globalCtx, &combinePos); - EnSnowman_SetupCombine((EnSnowman*)this->actor.child, globalCtx, &combinePos); - EnSnowman_SetupCombine(this, globalCtx, &combinePos); + EnSnowman_SetupCombine((EnSnowman*)this->actor.parent, play, &combinePos); + EnSnowman_SetupCombine((EnSnowman*)this->actor.child, play, &combinePos); + EnSnowman_SetupCombine(this, play, &combinePos); } else if ((this->work.timer == 0) && (fabsf(this->actor.playerHeightRel) < 60.0f) && - (this->actor.xzDistToPlayer < this->attackRange) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && + (this->actor.xzDistToPlayer < this->attackRange) && (Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000)) { - EnSnowman_SetupEmerge(this, globalCtx); + EnSnowman_SetupEmerge(this, play); } else if (this->snowPileTargetRotY != this->actor.shape.rot.y) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->snowPileTargetRotY, 0x100)) { this->turningOnSteepSlope = false; @@ -412,7 +412,7 @@ void EnSnowman_MoveSnowPile(EnSnowman* this, GlobalContext* globalCtx) { } } -void EnSnowman_SetupEmerge(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_SetupEmerge(EnSnowman* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gEenoEmergeAnim); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_SURFACE); this->collider.dim.radius = this->eenoScale * 40.0f; @@ -421,7 +421,7 @@ void EnSnowman_SetupEmerge(EnSnowman* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.x * 0.4f; this->actor.speedXZ = 0.0f; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnSnowman_SpawnCircularDustEffect(this, globalCtx); + EnSnowman_SpawnCircularDustEffect(this, play); this->collider.base.acFlags &= ~AC_ON; this->actionFunc = EnSnowman_Emerge; } @@ -429,8 +429,8 @@ void EnSnowman_SetupEmerge(EnSnowman* this, GlobalContext* globalCtx) { /** * Emerge from beneath the snow and face the player. */ -void EnSnowman_Emerge(EnSnowman* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSnowman_Emerge(EnSnowman* this, PlayState* play) { + Player* player = GET_PLAYER(play); Math_StepToF(&this->actor.scale.y, this->actor.scale.x, (this->actor.scale.x * 0.6f) / Animation_GetLastFrame(&gEenoEmergeAnim)); @@ -438,8 +438,8 @@ void EnSnowman_Emerge(EnSnowman* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->combineState == EN_SNOWMAN_COMBINE_STATE_ACTIVE) { - EnSnowman_SetupSubmerge(this, globalCtx); - } else if (!(player->stateFlags1 & 0x800000) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + EnSnowman_SetupSubmerge(this, play); + } else if (!(player->stateFlags1 & 0x800000) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { this->collider.base.acFlags |= AC_ON; this->work.snowballsToThrowBeforeIdling = 3; EnSnowman_SetupReadySnowball(this); @@ -468,25 +468,25 @@ void EnSnowman_SetupReadySnowball(EnSnowman* this) { * Plays the animation of the Eeno creating a snowball and spawns some snow-colored dust * near the snowball at the appropriate part of their animation. */ -void EnSnowman_ReadySnowball(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_ReadySnowball(EnSnowman* this, PlayState* play) { Vec3f pos; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); if ((EN_SNOWMAN_GET_TYPE(&this->actor) != EN_SNOWMAN_TYPE_LARGE) && this->isHoldingSnowball && - ((globalCtx->gameplayFrames % 2) != 0)) { + ((play->gameplayFrames % 2) != 0)) { pos.x = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.x; pos.y = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.y; pos.z = randPlusMinusPoint5Scaled(10.0f) + this->snowballPos.z; - func_800B0DE0(globalCtx, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, 30); + func_800B0DE0(play, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, 30); } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { if ((this->skelAnime.curFrame > 3.0f) && (this->skelAnime.curFrame < 14.0f) && - ((globalCtx->gameplayFrames % 2) != 0)) { + ((play->gameplayFrames % 2) != 0)) { pos.x = (this->actor.world.pos.x + (70.0f * Math_SinS(this->actor.shape.rot.y))) + randPlusMinusPoint5Scaled(40.0f); pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(20.0f); pos.z = (this->actor.world.pos.z + (70.0f * Math_CosS(this->actor.shape.rot.y))) + randPlusMinusPoint5Scaled(40.0f); - func_800B0DE0(globalCtx, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1000, 150); + func_800B0DE0(play, &pos, &sDustVelocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1000, 150); } } @@ -522,13 +522,13 @@ void EnSnowman_SetupThrowSnowball(EnSnowman* this) { * so it can eventually throw another one. Otherwise, this function will call EnSnowman_SetupIdle * to transition the Eeno into an idle state. */ -void EnSnowman_ThrowSnowball(EnSnowman* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSnowman_ThrowSnowball(EnSnowman* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 params; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); if (SkelAnime_Update(&this->skelAnime)) { - if ((this->work.snowballsToThrowBeforeIdling != 0) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && + if ((this->work.snowballsToThrowBeforeIdling != 0) && (Player_GetMask(play) != PLAYER_MASK_STONE) && !(player->stateFlags1 & 0x800000)) { EnSnowman_SetupReadySnowball(this); } else { @@ -545,7 +545,7 @@ void EnSnowman_ThrowSnowball(EnSnowman* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_MINI_THROW); } - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SNOWMAN, this->snowballPos.x, this->snowballPos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SNOWMAN, this->snowballPos.x, this->snowballPos.y, this->snowballPos.z, 0, this->actor.yawTowardsPlayer, 0, params); } } @@ -559,19 +559,19 @@ void EnSnowman_SetupIdle(EnSnowman* this) { /** * Simply makes the Eeno wait around for a bit before submerging back into the snow. */ -void EnSnowman_Idle(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Idle(EnSnowman* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->work.timer > 0) { this->work.timer--; } else { - EnSnowman_SetupSubmerge(this, globalCtx); + EnSnowman_SetupSubmerge(this, play); } } -void EnSnowman_SetupSubmerge(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_SetupSubmerge(EnSnowman* this, PlayState* play) { Animation_Change(&this->skelAnime, &gEenoEmergeAnim, -1.0f, Animation_GetLastFrame(&gEenoEmergeAnim), 0.0f, ANIMMODE_ONCE, -3.0f); - EnSnowman_SpawnCircularDustEffect(this, globalCtx); + EnSnowman_SpawnCircularDustEffect(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_HIDE); this->actionFunc = EnSnowman_Submerge; } @@ -579,7 +579,7 @@ void EnSnowman_SetupSubmerge(EnSnowman* this, GlobalContext* globalCtx) { /** * Submerge beneath the snow and become a snow pile. */ -void EnSnowman_Submerge(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Submerge(EnSnowman* this, PlayState* play) { Math_StepToF(&this->actor.scale.y, this->actor.scale.x * 0.4f, (this->actor.scale.x * 0.6f) / Animation_GetLastFrame(&gEenoEmergeAnim)); @@ -590,7 +590,7 @@ void EnSnowman_Submerge(EnSnowman* this, GlobalContext* globalCtx) { // Calling EnSnowman_SetupCombine while EnSnowman_Submerge is our actionFunc will result // in the broken target scale bug described in EnSnowman_SetupCombine. - EnSnowman_SetupCombine(this, globalCtx, &this->combinePos); + EnSnowman_SetupCombine(this, play, &this->combinePos); } else { EnSnowman_SetupMoveSnowPile(this); } @@ -611,7 +611,7 @@ void EnSnowman_SetupMelt(EnSnowman* this) { /** * Spawns smoke and shrinks the Eeno down until the timer runs out, then kills the Eeno. */ -void EnSnowman_Melt(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Melt(EnSnowman* this, PlayState* play) { Vec3f smokeVelocity; Vec3f smokePos; @@ -626,11 +626,11 @@ void EnSnowman_Melt(EnSnowman* this, GlobalContext* globalCtx) { smokePos.z = ((smokeVelocity.z >= 0.0f ? 1.0f : -1.0f) * Rand_ZeroFloat(20.0f) * this->eenoScale) + this->actor.world.pos.z; smokePos.y = this->actor.world.pos.y + 3.0f; - EffectSsIceSmoke_Spawn(globalCtx, &smokePos, &smokeVelocity, &gZeroVec3f, this->eenoScale * 300.0f); + EffectSsIceSmoke_Spawn(play, &smokePos, &smokeVelocity, &gZeroVec3f, this->eenoScale * 300.0f); } if (this->work.timer == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_SPLIT) { EnSnowman_SetupSplitDoNothing(this); } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { @@ -659,7 +659,7 @@ void EnSnowman_SetupStun(EnSnowman* this) { * Simply makes the Eeno do absolutely nothing until the stun is over. * Once the stun is over, this swaps the actionFunc back to what it was before the stun. */ -void EnSnowman_Stun(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Stun(EnSnowman* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { this->actionFunc = this->prevActionFunc; } @@ -689,7 +689,7 @@ void EnSnowman_SetupDamaged(EnSnowman* this) { * Once it's done spinning, it will spawn three small split-off Eenos if the Eeno is a large one. * Otherwise, it will either submerge underground (if it has health remaining) or die. */ -void EnSnowman_Damaged(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Damaged(EnSnowman* this, PlayState* play) { s32 rotationalVelocityScale; SkelAnime_Update(&this->skelAnime); @@ -707,7 +707,7 @@ void EnSnowman_Damaged(EnSnowman* this, GlobalContext* globalCtx) { this->work.timer--; } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_SPLIT); - EnSnowman_SpawnCircularDustEffect(this, globalCtx); + EnSnowman_SpawnCircularDustEffect(this, play); this->drawDmgEffAlpha = 0.0f; EnSnowman_CreateSplitEeno((EnSnowman*)this->actor.parent, &this->actor.world.pos, this->actor.shape.rot.y + 0x10000 / 3); @@ -718,10 +718,10 @@ void EnSnowman_Damaged(EnSnowman* this, GlobalContext* globalCtx) { // This is a hack to reuse EnSnowman_SpawnBigSnowballFragmentEffects, since it // draws the fragments at snowballPos. Math_Vec3f_Copy(&this->snowballPos, &this->actor.world.pos); - EnSnowman_SpawnBigSnowballFragmentEffects(this, globalCtx); + EnSnowman_SpawnBigSnowballFragmentEffects(this, play); } else if (this->actor.colChkInfo.health != 0) { this->collider.base.acFlags |= AC_ON; - EnSnowman_SetupSubmerge(this, globalCtx); + EnSnowman_SetupSubmerge(this, play); } else { EnSnowman_SetupDead(this); } @@ -735,7 +735,7 @@ void EnSnowman_SetupDead(EnSnowman* this) { /** * Spawns snow-colored dust and snowball fragments and kills the Eeno. */ -void EnSnowman_Dead(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Dead(EnSnowman* this, PlayState* play) { static Vec3f sAccel = { 0.0f, -0.5f, 0.0f }; Vec3f velocity; Vec3f pos; @@ -754,15 +754,14 @@ void EnSnowman_Dead(EnSnowman* this, GlobalContext* globalCtx) { pos.x = (Rand_ZeroFloat(6.0f) * velocity.x) + this->actor.world.pos.x; pos.y = (Rand_ZeroFloat(3.0f) * velocity.y) + this->actor.world.pos.y; pos.z = (Rand_ZeroFloat(6.0f) * velocity.z) + this->actor.world.pos.z; - EffectSsHahen_Spawn(globalCtx, &pos, &velocity, &sAccel, 0, + EffectSsHahen_Spawn(play, &pos, &velocity, &sAccel, 0, Rand_S16Offset((((i % 3) * 20) + 20), (((i % 3) * 10) + 10)), 452, 20, sSnowballFragmentDLs[i % 3]); } - func_800B0DE0(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, - 30); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_YMAJIN_DEAD_BREAK); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + func_800B0DE0(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, 30); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_YMAJIN_DEAD_BREAK); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_SPLIT) { EnSnowman_SetupSplitDoNothing(this); } else { @@ -798,7 +797,7 @@ void EnSnowman_SetupSplitDoNothing(EnSnowman* this) { this->actionFunc = EnSnowman_SplitDoNothing; } -void EnSnowman_SplitDoNothing(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_SplitDoNothing(EnSnowman* this, PlayState* play) { } /** @@ -813,7 +812,7 @@ void EnSnowman_SetupMarkForDeath(EnSnowman* this) { /** * Simply calls Actor_MarkForDeath on the Eeno. */ -void EnSnowman_MarkForDeath(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_MarkForDeath(EnSnowman* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -855,7 +854,7 @@ void EnSnowman_AbsorbEeno(EnSnowman* smallerEeno, EnSnowman* largerEeno) { smallerEeno->fwork.targetScaleDuringCombine = 0.0f; } -void EnSnowman_SetupCombine(EnSnowman* this, GlobalContext* globalCtx, Vec3f* combinePos) { +void EnSnowman_SetupCombine(EnSnowman* this, PlayState* play, Vec3f* combinePos) { if (this->actor.colChkInfo.health == 0) { this->combineState = EN_SNOWMAN_COMBINE_STATE_NO_ABSORPTION; } else { @@ -888,7 +887,7 @@ void EnSnowman_SetupCombine(EnSnowman* this, GlobalContext* globalCtx, Vec3f* co // will be set to EnSnowman_Submerge. When the submerging animation is complete with this // combineState, EnSnowman_Submerge will call EnSnowman_SetupCombine, causing the broken // target scale bug described above. - EnSnowman_SetupSubmerge(this, globalCtx); + EnSnowman_SetupSubmerge(this, play); } } } @@ -896,7 +895,7 @@ void EnSnowman_SetupCombine(EnSnowman* this, GlobalContext* globalCtx, Vec3f* co /** * Makes the small, split-off Eenos try to combine into a large Eeno by absorbing each other. */ -void EnSnowman_Combine(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_Combine(EnSnowman* this, PlayState* play) { EnSnowman* parent; EnSnowman* child; @@ -963,19 +962,19 @@ void EnSnowman_Combine(EnSnowman* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.x; } -void EnSnowman_UpdateDamage(EnSnowman* this, GlobalContext* globalCtx) { +void EnSnowman_UpdateDamage(EnSnowman* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); if ((this->actor.colChkInfo.damageEffect != EN_SNOWMAN_DMGEFF_HOOKSHOT) || (EN_SNOWMAN_GET_TYPE(&this->actor) != EN_SNOWMAN_TYPE_LARGE)) { if (this->actor.colChkInfo.damageEffect == EN_SNOWMAN_DMGEFF_MELT) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_ApplyDamage(&this->actor); EnSnowman_SetupMelt(this); } else { if ((this->actionFunc == EnSnowman_MoveSnowPile) || (this->actionFunc == EnSnowman_Combine)) { - EnSnowman_SetupEmerge(this, globalCtx); + EnSnowman_SetupEmerge(this, play); } else if (this->actor.colChkInfo.damageEffect == EN_SNOWMAN_DMGEFF_STUN) { Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); @@ -990,13 +989,13 @@ void EnSnowman_UpdateDamage(EnSnowman* this, GlobalContext* globalCtx) { } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { if (this->isHoldingSnowball == true) { this->isHoldingSnowball = false; - EnSnowman_SpawnBigSnowballFragmentEffects(this, globalCtx); + EnSnowman_SpawnBigSnowballFragmentEffects(this, play); } EnSnowman_SetupDamaged(this); } else { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } EnSnowman_SetupDamaged(this); @@ -1007,7 +1006,7 @@ void EnSnowman_UpdateDamage(EnSnowman* this, GlobalContext* globalCtx) { this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } @@ -1015,7 +1014,7 @@ void EnSnowman_UpdateDamage(EnSnowman* this, GlobalContext* globalCtx) { } } -void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_Update(Actor* thisx, PlayState* play) { s32 pad; EnSnowman* this = THIS; f32 wallCheckRadius; @@ -1023,8 +1022,8 @@ void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != EnSnowman_SplitDoNothing) { DECR(this->combineTimer); - EnSnowman_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnSnowman_UpdateDamage(this, play); + this->actionFunc(this, play); if (this->actionFunc != EnSnowman_MarkForDeath) { Actor_MoveWithGravity(&this->actor); @@ -1037,7 +1036,7 @@ void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx) { wallCheckRadius = this->collider.dim.radius; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, wallCheckRadius, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, wallCheckRadius, 0.0f, 0x1D); if ((this->actor.floorPoly != NULL) && ((this->actor.floorPoly->normal.y * SHT_MINV) < 0.7f)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); if (!this->turningOnSteepSlope) { @@ -1051,9 +1050,9 @@ void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx) { 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->actor.draw == EnSnowman_Draw) { Actor_SetFocus(&this->actor, this->actor.scale.y * 1800.0f); @@ -1070,7 +1069,7 @@ void EnSnowman_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSnowman_UpdateSnowball(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play) { EnSnowman* this = THIS; s16 scale; s32 i; @@ -1087,33 +1086,33 @@ void EnSnowman_UpdateSnowball(Actor* thisx, GlobalContext* globalCtx) { if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_SMALL_SNOWBALL) { scale = 10; for (i = 0; i < 3; i++) { - EffectSsHahen_SpawnBurst(globalCtx, &thisx->world.pos, 5.0f, 0, scale, scale >> 1, 3, 452, 20, + EffectSsHahen_SpawnBurst(play, &thisx->world.pos, 5.0f, 0, scale, scale >> 1, 3, 452, 20, sSnowballFragmentDLs[i]); scale *= 2; } - func_800B0DE0(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, - 500, 30); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_SMALL_SNOWBALL_BROKEN); + func_800B0DE0(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 500, + 30); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_SMALL_SNOWBALL_BROKEN); } else { // EnSnowman_SpawnBigSnowballFragmentEffects only fworks with snowballPos, so we need // to copy the snowball actor's current position into snowballPos to make this fwork. Math_Vec3f_Copy(&this->snowballPos, &this->actor.world.pos); - EnSnowman_SpawnBigSnowballFragmentEffects(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_SNOWBALL_BROKEN); + EnSnowman_SpawnBigSnowballFragmentEffects(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_SNOWBALL_BROKEN); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_IT_REFLECTION_WOOD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_IT_REFLECTION_WOOD); Actor_MarkForDeath(&this->actor); } else { this->actor.shape.rot.x += 0xF00; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, this->collider.dim.radius * 0.6f, + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider.dim.radius * 0.6f, this->collider.dim.height - this->collider.dim.yShift, 0x1F); 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); } } @@ -1135,7 +1134,7 @@ static Vec3f sBodyBottomBodyPartOffsets[] = { { 1000.0f, 0.0f, 3000.0f }, { 1000.0f, 0.0f, -3000.0f }, }; -void EnSnowman_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSnowman_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnSnowman* this = THIS; Gfx* gfx; @@ -1152,7 +1151,7 @@ void EnSnowman_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } if ((limbIndex == EENO_LIMB_RIGHT_HAND) && (this->isHoldingSnowball == true)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -1163,35 +1162,35 @@ void EnSnowman_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_Scale(0.3f, 0.3f, 0.3f, MTXMODE_APPLY); } - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], sSnowballDLs[EN_SNOWMAN_GET_TYPE(&this->actor)]); POLY_OPA_DISP = &gfx[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_MultZero(&this->snowballPos); } } -void EnSnowman_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_Draw(Actor* thisx, PlayState* play) { EnSnowman* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnSnowman_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + EnSnowman_PostLimbDraw, &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), this->drawDmgEffScale * this->eenoScale, 0.0f, this->drawDmgEffAlpha, this->drawDmgEffType); } -void EnSnowman_DrawSnowPile(Actor* thisx, GlobalContext* globalCtx) { +void EnSnowman_DrawSnowPile(Actor* thisx, PlayState* play) { EnSnowman* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->snowPileSkelAnime.skeleton, this->snowPileSkelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->snowPileSkelAnime.skeleton, this->snowPileSkelAnime.jointTable, this->snowPileSkelAnime.dListCount, NULL, NULL, &this->actor); } -void EnSnowman_DrawSnowball(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sSnowballDLs[EN_SNOWMAN_GET_TYPE(thisx) - EN_SNOWMAN_TYPE_SMALL_SNOWBALL]); +void EnSnowman_DrawSnowball(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sSnowballDLs[EN_SNOWMAN_GET_TYPE(thisx) - EN_SNOWMAN_TYPE_SMALL_SNOWBALL]); } diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h index 07d7f98c38..32a1ae352d 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.h @@ -17,7 +17,7 @@ typedef enum { struct EnSnowman; -typedef void (*EnSnowmanActionFunc)(struct EnSnowman*, GlobalContext*); +typedef void (*EnSnowmanActionFunc)(struct EnSnowman*, PlayState*); typedef struct EnSnowman { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c index 03038d0581..7e50201ac4 100644 --- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c +++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c @@ -10,12 +10,12 @@ #define THIS ((EnSnowwd*)thisx) -void EnSnowwd_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSnowwd_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSnowwd_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSnowwd_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSnowwd_Init(Actor* thisx, PlayState* play); +void EnSnowwd_Destroy(Actor* thisx, PlayState* play); +void EnSnowwd_Update(Actor* thisx, PlayState* play); +void EnSnowwd_Draw(Actor* thisx, PlayState* play); -void func_80AF76F0(EnSnowwd* this, GlobalContext* globalCtx); +void func_80AF76F0(EnSnowwd* this, PlayState* play); #if 0 const ActorInit En_Snowwd_InitVars = { diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h index fbe589e1c9..d344f034a1 100644 --- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h +++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h @@ -5,7 +5,7 @@ struct EnSnowwd; -typedef void (*EnSnowwdActionFunc)(struct EnSnowwd*, GlobalContext*); +typedef void (*EnSnowwdActionFunc)(struct EnSnowwd*, PlayState*); typedef struct EnSnowwd { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index ef47146b98..aa26c1a430 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -13,37 +13,37 @@ #define THIS ((EnSob1*)thisx) -void EnSob1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSob1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSob1_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSob1_Init(Actor* thisx, PlayState* play); +void EnSob1_Destroy(Actor* thisx, PlayState* play); +void EnSob1_Update(Actor* thisx, PlayState* play); -void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnSob1_GoronShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnSob1_BombShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play); +void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play); +void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play); -void EnSob1_ZoraShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_GoronShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_BombShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx); +void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play); +void EnSob1_GoronShopkeeper_Init(EnSob1* this, PlayState* play); +void EnSob1_BombShopkeeper_Init(EnSob1* this, PlayState* play); -void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_Walk(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_Hello(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_StartShopping(GlobalContext* globalCtx, EnSob1* this); -void EnSob1_SetupIdle(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_FaceShopkeeper(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_LookToShelf(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_EndingInteraction(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_TalkingToShopkeeper(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_SelectItem(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_BuyItemWithFanfare(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_CanBuy(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_CannotBuy(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_SetupItemPurchased(EnSob1* this, GlobalContext* globalCtx); -void EnSob1_ContinueShopping(EnSob1* this, GlobalContext* globalCtx); +void EnSob1_InitShop(EnSob1* this, PlayState* play); +void EnSob1_Idle(EnSob1* this, PlayState* play); +void EnSob1_Walk(EnSob1* this, PlayState* play); +void EnSob1_Walking(EnSob1* this, PlayState* play); +void EnSob1_Hello(EnSob1* this, PlayState* play); +void EnSob1_StartShopping(PlayState* play, EnSob1* this); +void EnSob1_SetupIdle(EnSob1* this, PlayState* play); +void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play); +void EnSob1_LookToShelf(EnSob1* this, PlayState* play); +void EnSob1_EndingInteraction(EnSob1* this, PlayState* play); +void EnSob1_BrowseShelf(EnSob1* this, PlayState* play); +void EnSob1_TalkingToShopkeeper(EnSob1* this, PlayState* play); +void EnSob1_SelectItem(EnSob1* this, PlayState* play); +void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, PlayState* play); +void EnSob1_BuyItemWithFanfare(EnSob1* this, PlayState* play); +void EnSob1_CanBuy(EnSob1* this, PlayState* play); +void EnSob1_CannotBuy(EnSob1* this, PlayState* play); +void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play); +void EnSob1_ContinueShopping(EnSob1* this, PlayState* play); void EnSob1_ResetItemPosition(EnSob1* this); void EnSob1_Blink(EnSob1* this); @@ -173,19 +173,19 @@ void EnSob1_SetupAction(EnSob1* this, EnSob1ActionFunc action) { this->actionFunc = action; } -s32 EnSob1_TestItemSelected(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 EnSob1_TestItemSelected(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CUP); } -u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->shopType == BOMB_SHOP) { if (gSaveContext.save.day == 1 && gSaveContext.save.time >= CLOCK_TIME(6, 00)) { @@ -220,11 +220,11 @@ u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { return 0; } -u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +u16 EnSob1_GetWelcome(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->shopType == BOMB_SHOP) { - switch (Player_GetMask(globalCtx)) { + switch (Player_GetMask(play)) { case PLAYER_MASK_NONE: case PLAYER_MASK_BUNNY: case PLAYER_MASK_POSTMAN: @@ -333,16 +333,16 @@ u16 EnSob1_GetGoodbye(EnSob1* this) { return 0x64C; } -void EnSob1_BombShopkeeper_EndInteraction(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_BombShopkeeper_EndInteraction(EnSob1* this, PlayState* play) { this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; this->goodbyeTextId = EnSob1_GetGoodbye(this); - Message_StartTextbox(globalCtx, this->goodbyeTextId, &this->actor); + Message_StartTextbox(play, this->goodbyeTextId, &this->actor); EnSob1_SetupAction(this, EnSob1_EndingInteraction); } -void EnSob1_SpawnShopItems(EnSob1* this, GlobalContext* globalCtx, ShopItem* shopItem) { +void EnSob1_SpawnShopItems(EnSob1* this, PlayState* play, ShopItem* shopItem) { s32 i; for (i = 0; i < ARRAY_COUNT(this->items); i++, shopItem++) { @@ -350,15 +350,15 @@ void EnSob1_SpawnShopItems(EnSob1* this, GlobalContext* globalCtx, ShopItem* sho this->items[i] = NULL; } else { this->items[i] = - (EnGirlA*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, shopItem->spawnPos.x, - shopItem->spawnPos.y, shopItem->spawnPos.z, 0, 0, 0, shopItem->shopItemId); + (EnGirlA*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GIRLA, shopItem->spawnPos.x, shopItem->spawnPos.y, + shopItem->spawnPos.z, 0, 0, 0, shopItem->shopItemId); } } } -s32 EnSob1_GetObjIndices(EnSob1* this, GlobalContext* globalCtx, s16* objIds) { +s32 EnSob1_GetObjIndices(EnSob1* this, PlayState* play, s16* objIds) { if (objIds[1] != OBJECT_ID_MAX) { - this->unusedObjIndex = Object_GetIndex(&globalCtx->objectCtx, objIds[1]); + this->unusedObjIndex = Object_GetIndex(&play->objectCtx, objIds[1]); if (this->unusedObjIndex < 0) { return false; } @@ -366,7 +366,7 @@ s32 EnSob1_GetObjIndices(EnSob1* this, GlobalContext* globalCtx, s16* objIds) { this->unusedObjIndex = -1; } if (objIds[2] != OBJECT_ID_MAX) { - this->shopkeeperAnimObjIndex = Object_GetIndex(&globalCtx->objectCtx, objIds[2]); + this->shopkeeperAnimObjIndex = Object_GetIndex(&play->objectCtx, objIds[2]); if (this->shopkeeperAnimObjIndex < 0) { return false; } @@ -376,7 +376,7 @@ s32 EnSob1_GetObjIndices(EnSob1* this, GlobalContext* globalCtx, s16* objIds) { return true; } -void EnSob1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_Init(Actor* thisx, PlayState* play) { EnSob1* this = THIS; s32 pad; s16* objIds; @@ -401,12 +401,12 @@ void EnSob1_Init(Actor* thisx, GlobalContext* globalCtx) { } objIds = sObjectIds[this->shopType]; - this->mainObjIndex = Object_GetIndex(&globalCtx->objectCtx, objIds[0]); + this->mainObjIndex = Object_GetIndex(&play->objectCtx, objIds[0]); if (this->mainObjIndex < 0) { Actor_MarkForDeath(&this->actor); return; } - if (!EnSob1_GetObjIndices(this, globalCtx, objIds)) { + if (!EnSob1_GetObjIndices(this, play, objIds)) { Actor_MarkForDeath(&this->actor); return; } @@ -414,105 +414,105 @@ void EnSob1_Init(Actor* thisx, GlobalContext* globalCtx) { EnSob1_SetupAction(this, EnSob1_InitShop); } -void EnSob1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_Destroy(Actor* thisx, PlayState* play) { EnSob1* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSob1_UpdateCursorPos(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_UpdateCursorPos(PlayState* play, EnSob1* this) { s16 x; s16 y; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(globalCtx, &this->items[this->cursorIndex]->actor, &x, &y); + Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y); this->cursorPos.x = x + xOffset; this->cursorPos.y = y + yOffset; this->cursorPos.z = 1.2f; } -void EnSob1_EndInteraction(GlobalContext* globalCtx, EnSob1* this) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_ProcessTalkRequest(&this->actor, &play->state); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; player->stateFlags2 &= ~0x20000000; - globalCtx->interfaceCtx.unk_222 = 0; - globalCtx->interfaceCtx.unk_224 = 0; + play->interfaceCtx.unk_222 = 0; + play->interfaceCtx.unk_224 = 0; EnSob1_SetupAction(this, EnSob1_Idle); } -s32 EnSob1_TestEndInteraction(EnSob1* this, GlobalContext* globalCtx, Input* input) { +s32 EnSob1_TestEndInteraction(EnSob1* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { if (this->shopType == BOMB_SHOP) { - EnSob1_BombShopkeeper_EndInteraction(this, globalCtx); + EnSob1_BombShopkeeper_EndInteraction(this, play); } else { - EnSob1_EndInteraction(globalCtx, this); + EnSob1_EndInteraction(play, this); } return true; } return false; } -s32 EnSob1_TestCancelOption(EnSob1* this, GlobalContext* globalCtx, Input* input) { +s32 EnSob1_TestCancelOption(EnSob1* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIndex]->actor.textId); + func_80151938(play, this->items[this->cursorIndex]->actor.textId); return true; } return false; } -void EnSob1_SetupStartShopping(GlobalContext* globalCtx, EnSob1* this, u8 skipHello) { - func_8011552C(globalCtx, 16); +void EnSob1_SetupStartShopping(PlayState* play, EnSob1* this, u8 skipHello) { + func_8011552C(play, 16); if (!skipHello) { EnSob1_SetupAction(this, EnSob1_Hello); } else { - EnSob1_StartShopping(globalCtx, this); + EnSob1_StartShopping(play, this); } } -void EnSob1_StartShopping(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_StartShopping(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_FaceShopkeeper); - func_80151938(globalCtx, sFacingShopkeeperTextIds[this->shopType]); - func_8011552C(globalCtx, 6); + func_80151938(play, sFacingShopkeeperTextIds[this->shopType]); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; } -void EnSob1_TalkToShopkeeper(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_TalkToShopkeeper(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_TalkingToShopkeeper); - this->talkOptionTextId = EnSob1_GetTalkOption(this, globalCtx); - func_80151938(globalCtx, this->talkOptionTextId); - func_8011552C(globalCtx, 6); + this->talkOptionTextId = EnSob1_GetTalkOption(this, play); + func_80151938(play, this->talkOptionTextId); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } -void EnSob1_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_SetupLookToShopkeeperFromShelf(PlayState* play, EnSob1* this) { play_sound(NA_SE_SY_CURSOR); this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_LookToShopkeeperFromShelf); } -void EnSob1_EndingInteraction(EnSob1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - EnSob1_EndInteraction(globalCtx, this); +void EnSob1_EndingInteraction(EnSob1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + EnSob1_EndInteraction(play, this); } } -void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_SetupWalk(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->actor.world.pos.x >= 0.0f && player->actor.world.pos.x <= 390.0f) && (player->actor.world.pos.z >= 72.0f && player->actor.world.pos.z <= 365.0f)) { @@ -520,11 +520,11 @@ void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) { } } -void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_Idle(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->headRotTarget = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -534,29 +534,29 @@ void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx) { this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } player->stateFlags2 |= 0x20000000; - this->welcomeTextId = EnSob1_GetWelcome(this, globalCtx); - Message_StartTextbox(globalCtx, this->welcomeTextId, &this->actor); + this->welcomeTextId = EnSob1_GetWelcome(this, play); + Message_StartTextbox(play, this->welcomeTextId, &this->actor); if (ENSOB1_GET_SHOPTYPE(&this->actor) == BOMB_SHOP) { this->headRotTarget = -0x2000; } - EnSob1_SetupStartShopping(globalCtx, this, false); + EnSob1_SetupStartShopping(play, this, false); } else { if ((player->actor.world.pos.x >= this->posXZRange.xMin && player->actor.world.pos.x <= this->posXZRange.xMax) && (player->actor.world.pos.z >= this->posXZRange.zMin && player->actor.world.pos.z <= this->posXZRange.zMax)) { - func_800B8614(&this->actor, globalCtx, 400.0f); + func_800B8614(&this->actor, play, 400.0f); } if (this->wasTalkedToWhileWalking == true) { this->wasTalkedToWhileWalking = false; - EnSob1_SetupStartShopping(globalCtx, this, false); + EnSob1_SetupStartShopping(play, this, false); } } } -void EnSob1_UpdateJoystickInputState(GlobalContext* globalCtx, EnSob1* this) { - s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; - s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; +void EnSob1_UpdateJoystickInputState(PlayState* play, EnSob1* this) { + s8 stickX = CONTROLLER1(&play->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&play->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -599,8 +599,8 @@ u8 EnSob1_SetCursorIndexFromNeutral(EnSob1* this, u8 shelfOffset) { return CURSOR_INVALID; } -void EnSob1_Hello(EnSob1* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnSob1_Hello(EnSob1* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -610,37 +610,37 @@ void EnSob1_Hello(EnSob1* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if ((talkState == 5) && Message_ShouldAdvance(globalCtx) && - !EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { + if ((talkState == 5) && Message_ShouldAdvance(play) && + !EnSob1_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if (this->welcomeTextId == 0x68A) { // Welcome text when wearing Kafei's mask - EnSob1_EndInteraction(globalCtx, this); + EnSob1_EndInteraction(play, this); } else { - EnSob1_StartShopping(globalCtx, this); + EnSob1_StartShopping(play, this); } } } -s32 EnSob1_FacingShopkeeperDialogResult(EnSob1* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.choiceIndex) { +s32 EnSob1_FacingShopkeeperDialogResult(EnSob1* this, PlayState* play) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - EnSob1_TalkToShopkeeper(globalCtx, this); + EnSob1_TalkToShopkeeper(play, this); return true; case 1: func_8019F230(); if (this->shopType == BOMB_SHOP) { - EnSob1_BombShopkeeper_EndInteraction(this, globalCtx); + EnSob1_BombShopkeeper_EndInteraction(this, play); } else { - EnSob1_EndInteraction(globalCtx, this); + EnSob1_EndInteraction(play, this); } return true; } return false; } -void EnSob1_FaceShopkeeper(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { s32 pad[2]; - u8 talkState = Message_GetState(&globalCtx->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); u8 cursorIndex; if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { @@ -660,15 +660,15 @@ void EnSob1_FaceShopkeeper(EnSob1* this, GlobalContext* globalCtx) { this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else { if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnSob1_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - if (!Message_ShouldAdvance(globalCtx) || !EnSob1_FacingShopkeeperDialogResult(this, globalCtx)) { + func_8011552C(play, 6); + if (!EnSob1_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + if (!Message_ShouldAdvance(play) || !EnSob1_FacingShopkeeperDialogResult(this, play)) { if (this->stickAccumX > 0) { cursorIndex = EnSob1_SetCursorIndexFromNeutral(this, 2); if (cursorIndex != CURSOR_INVALID) { this->cursorIndex = cursorIndex; EnSob1_SetupAction(this, EnSob1_LookToShelf); - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -679,13 +679,13 @@ void EnSob1_FaceShopkeeper(EnSob1* this, GlobalContext* globalCtx) { } } -void EnSob1_TalkingToShopkeeper(EnSob1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { - EnSob1_StartShopping(globalCtx, this); +void EnSob1_TalkingToShopkeeper(EnSob1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + EnSob1_StartShopping(play, this); } } -void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, PlayState* play) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; @@ -701,14 +701,14 @@ void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; - EnSob1_StartShopping(globalCtx, this); + EnSob1_StartShopping(play, this); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnSob1_EndWalk(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_EndWalk(EnSob1* this, PlayState* play) { s32 pad; f32 distSq; s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed; @@ -729,17 +729,17 @@ void EnSob1_EndWalk(EnSob1* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void EnSob1_SetupIdle(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_SetupIdle(EnSob1* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; if (Animation_GetLastFrame(&gBombShopkeeperSitAtCounterStartAnim) == curFrame) { EnSob1_ChangeAnim(&this->skelAnime, sAnimationsBombShopkeeper, BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_LOOP); EnSob1_SetupAction(this, EnSob1_Idle); } - EnSob1_Walking(this, globalCtx); + EnSob1_Walking(this, play); } -void EnSob1_Walk(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_Walk(EnSob1* this, PlayState* play) { s32 pad; f32 distSq; @@ -766,11 +766,11 @@ void EnSob1_Walk(EnSob1* this, GlobalContext* globalCtx) { } } Actor_MoveWithGravity(&this->actor); - EnSob1_Walking(this, globalCtx); + EnSob1_Walking(this, play); } -void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_Walking(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -780,7 +780,7 @@ void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -790,21 +790,21 @@ void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) { this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } player->stateFlags2 |= 0x20000000; - this->welcomeTextId = EnSob1_GetWelcome(this, globalCtx); - Message_StartTextbox(globalCtx, this->welcomeTextId, &this->actor); + this->welcomeTextId = EnSob1_GetWelcome(this, play); + Message_StartTextbox(play, this->welcomeTextId, &this->actor); this->wasTalkedToWhileWalking = true; } else { if ((player->actor.world.pos.x >= this->posXZRange.xMin && player->actor.world.pos.x <= this->posXZRange.xMax) && (player->actor.world.pos.z >= this->posXZRange.zMin && player->actor.world.pos.z <= this->posXZRange.zMax)) { - func_800B8614(&this->actor, globalCtx, 400.0f); + func_800B8614(&this->actor, play, 400.0f); } } } -void EnSob1_ItemPurchased(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -820,14 +820,14 @@ void EnSob1_ItemPurchased(EnSob1* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80151938(globalCtx, 0x647); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80151938(play, 0x647); } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnSob1_LookToShelf(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_LookToShelf(EnSob1* this, PlayState* play) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; @@ -843,23 +843,23 @@ void EnSob1_LookToShelf(EnSob1* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene) != 0) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; - EnSob1_UpdateCursorPos(globalCtx, this); + EnSob1_UpdateCursorPos(play, this); EnSob1_SetupAction(this, EnSob1_BrowseShelf); - func_80151938(globalCtx, this->items[this->cursorIndex]->actor.textId); + func_80151938(play, this->items[this->cursorIndex]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnSob1_CursorLeftRight(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_CursorLeftRight(PlayState* play, EnSob1* this) { u8 curTemp = this->cursorIndex; if (this->stickAccumX < 0) { if (curTemp != 2) { curTemp++; } else { - EnSob1_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnSob1_SetupLookToShopkeeperFromShelf(play, this); } if (this->items[curTemp] != NULL) { this->cursorIndex = curTemp; @@ -874,16 +874,16 @@ void EnSob1_CursorLeftRight(GlobalContext* globalCtx, EnSob1* this) { } } -s32 EnSob1_HasPlayerSelectedItem(GlobalContext* globalCtx, EnSob1* this, Input* input) { +s32 EnSob1_HasPlayerSelectedItem(PlayState* play, EnSob1* this, Input* input) { EnGirlA* item = this->items[this->cursorIndex]; - if (EnSob1_TestEndInteraction(this, globalCtx, input)) { + if (EnSob1_TestEndInteraction(this, play, input)) { return true; } - if (EnSob1_TestItemSelected(globalCtx)) { + if (EnSob1_TestItemSelected(play)) { if (!item->isOutOfStock) { this->tmpActionFunc = this->actionFunc; - func_80151938(globalCtx, this->items[this->cursorIndex]->choiceTextId); + func_80151938(play, this->items[this->cursorIndex]->choiceTextId); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -897,8 +897,8 @@ s32 EnSob1_HasPlayerSelectedItem(GlobalContext* globalCtx, EnSob1* this, Input* return false; } -void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; u8 prevCursorIndex = this->cursorIndex; u8 cursorIndex; @@ -910,14 +910,14 @@ void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) { } else { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnSob1_UpdateCursorPos(globalCtx, this); + EnSob1_UpdateCursorPos(play, this); if (talkState == 5) { - func_8011552C(globalCtx, 6); - if (!EnSob1_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { - EnSob1_CursorLeftRight(globalCtx, this); + func_8011552C(play, 6); + if (!EnSob1_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { + EnSob1_CursorLeftRight(play, this); cursorIndex = this->cursorIndex; if (cursorIndex != prevCursorIndex) { - func_80151938(globalCtx, this->items[cursorIndex]->actor.textId); + func_80151938(play, this->items[cursorIndex]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -925,33 +925,33 @@ void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) { } } -void EnSob1_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnSob1* this) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { + Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeAlpha(50); this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_BuyItemWithFanfare); } -void EnSob1_SetupCannotBuy(GlobalContext* globalCtx, EnSob1* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnSob1_SetupCannotBuy(PlayState* play, EnSob1* this, u16 textId) { + func_80151938(play, textId); EnSob1_SetupAction(this, EnSob1_CannotBuy); } -void EnSob1_SetupCanBuy(GlobalContext* globalCtx, EnSob1* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnSob1_SetupCanBuy(PlayState* play, EnSob1* this, u16 textId) { + func_80151938(play, textId); EnSob1_SetupAction(this, EnSob1_CanBuy); } -void EnSob1_HandleCanBuyItem(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { EnGirlA* item = this->items[this->cursorIndex]; EnGirlA* item2; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -959,119 +959,118 @@ void EnSob1_HandleCanBuyItem(GlobalContext* globalCtx, EnSob1* this) { } func_8019F208(); item2 = this->items[this->cursorIndex]; - item2->buyFanfareFunc(globalCtx, item2); - EnSob1_SetupBuyItemWithFanfare(globalCtx, this); + item2->buyFanfareFunc(play, item2); + EnSob1_SetupBuyItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_SUCCESS_2: func_8019F208(); - item->buyFunc(globalCtx, item); + item->buyFunc(play, item); if ((this->shopType == GORON_SHOP) && (item->actor.params == SI_POTION_RED_5)) { - EnSob1_SetupCanBuy(globalCtx, this, 0xBD7); + EnSob1_SetupCanBuy(play, this, 0xBD7); } else if ((this->shopType == ZORA_SHOP) && (item->actor.params == SI_POTION_RED_4)) { - EnSob1_SetupCanBuy(globalCtx, this, 0x12E7); + EnSob1_SetupCanBuy(play, this, 0x12E7); } else if ((this->shopType == GORON_SHOP_SPRING) && (item->actor.params == SI_POTION_RED_6)) { - EnSob1_SetupCanBuy(globalCtx, this, 0xBD7); + EnSob1_SetupCanBuy(play, this, 0xBD7); } else { - EnSob1_SetupCanBuy(globalCtx, this, sBuySuccessTextIds[this->shopType]); + EnSob1_SetupCanBuy(play, this, sBuySuccessTextIds[this->shopType]); } this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_NO_ROOM: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sNoRoomTextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sNoRoomTextIds[this->shopType]); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sNeedEmptyBottleTextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sNeedEmptyBottleTextIds[this->shopType]); break; case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sNeedRupeesTextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sNeedRupeesTextIds[this->shopType]); break; case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sCannotGetNowTextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sCannotGetNowTextIds[this->shopType]); break; case CANBUY_RESULT_CANNOT_GET_NOW_2: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sCannotGetNow2TextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sCannotGetNow2TextIds[this->shopType]); break; case CANBUY_RESULT_NO_ROOM_2: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, sNoRoom2TextIds[this->shopType]); + EnSob1_SetupCannotBuy(play, this, sNoRoom2TextIds[this->shopType]); break; case CANBUY_RESULT_ALREADY_HAVE: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, 0x658); + EnSob1_SetupCannotBuy(play, this, 0x658); break; case CANBUY_RESULT_HAVE_BETTER: play_sound(NA_SE_SY_ERROR); - EnSob1_SetupCannotBuy(globalCtx, this, 0x659); + EnSob1_SetupCannotBuy(play, this, 0x659); break; } } -void EnSob1_SelectItem(EnSob1* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnSob1_SelectItem(EnSob1* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (EnSob1_TakeItemOffShelf(this) && talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnSob1_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + func_8011552C(play, 6); + if (!EnSob1_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnSob1_HandleCanBuyItem(globalCtx, this); + EnSob1_HandleCanBuyItem(play, this); break; case 1: func_8019F230(); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIndex]->actor.textId); + func_80151938(play, this->items[this->cursorIndex]->actor.textId); break; } } } } -void EnSob1_CannotBuy(EnSob1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5) { - if (Message_ShouldAdvance(globalCtx)) { +void EnSob1_CannotBuy(EnSob1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5) { + if (Message_ShouldAdvance(play)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIndex]->actor.textId); + func_80151938(play, this->items[this->cursorIndex]->actor.textId); } } } -void EnSob1_CanBuy(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_CanBuy(EnSob1* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnSob1_ResetItemPosition(this); item = this->items[this->cursorIndex]; - item->restockFunc(globalCtx, item); + item->restockFunc(play, item); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, this->items[this->cursorIndex]->actor.textId); + func_80151938(play, this->items[this->cursorIndex]->actor.textId); } } -void EnSob1_BuyItemWithFanfare(EnSob1* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnSob1_BuyItemWithFanfare(EnSob1* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnSob1_SetupAction(this, EnSob1_SetupItemPurchased); } else { - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); } } -void EnSob1_SetupItemPurchased(EnSob1* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; +void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; EnSob1_SetupAction(this, EnSob1_ItemPurchased); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1080,23 +1079,23 @@ void EnSob1_SetupItemPurchased(EnSob1* this, GlobalContext* globalCtx) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnSob1_ContinueShopping(EnSob1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSob1_ContinueShopping(EnSob1* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnGirlA* item; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { EnSob1_ResetItemPosition(this); item = this->items[this->cursorIndex]; - item->restockFunc(globalCtx, item); + item->restockFunc(play, item); player->actor.shape.rot.y += 0x8000; player->stateFlags2 |= 0x20000000; - Message_StartTextbox(globalCtx, this->welcomeTextId, &this->actor); - EnSob1_SetupStartShopping(globalCtx, this, true); - func_800B85E0(&this->actor, globalCtx, 200.0f, EXCH_ITEM_MINUS1); + Message_StartTextbox(play, this->welcomeTextId, &this->actor); + EnSob1_SetupStartShopping(play, this, true); + func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); } } @@ -1304,17 +1303,16 @@ void EnSob1_Blink(EnSob1* this) { } } -void EnSob1_ChangeObject(EnSob1* this, GlobalContext* globalCtx) { - gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->shopkeeperAnimObjIndex].segment); +void EnSob1_ChangeObject(EnSob1* this, PlayState* play) { + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); } -s32 EnSob1_AreObjectsLoaded(EnSob1* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->mainObjIndex)) { - if (this->unusedObjIndex >= 0 && !Object_IsLoaded(&globalCtx->objectCtx, this->unusedObjIndex)) { +s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->mainObjIndex)) { + if (this->unusedObjIndex >= 0 && !Object_IsLoaded(&play->objectCtx, this->unusedObjIndex)) { return false; } - if (this->shopkeeperAnimObjIndex >= 0 && - !Object_IsLoaded(&globalCtx->objectCtx, this->shopkeeperAnimObjIndex)) { + if (this->shopkeeperAnimObjIndex >= 0 && !Object_IsLoaded(&play->objectCtx, this->shopkeeperAnimObjIndex)) { return false; } return true; @@ -1322,43 +1320,41 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, GlobalContext* globalCtx) { return false; } -void EnSob1_ZoraShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, - ZORA_LIMB_MAX); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->shopkeeperAnimObjIndex].segment); +void EnSob1_ZoraShopkeeper_Init(EnSob1* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_ZoraShopkeeper_Draw; this->changeObjectFunc = EnSob1_ChangeObject; } -void EnSob1_GoronShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, - GORON_LIMB_MAX); - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->shopkeeperAnimObjIndex].segment); +void EnSob1_GoronShopkeeper_Init(EnSob1* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->shopkeeperAnimObjIndex].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnSob1_GoronShopkeeper_Draw; this->changeObjectFunc = EnSob1_ChangeObject; } -void EnSob1_BombShopkeeper_Init(EnSob1* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBombShopkeeperSkel, &gBombShopkeeperWalkAnim, this->jointTable, +void EnSob1_BombShopkeeper_Init(EnSob1* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &gBombShopkeeperSkel, &gBombShopkeeperWalkAnim, this->jointTable, this->morphTable, BOMB_SHOPKEEPER_LIMB_MAX); this->actor.draw = EnSob1_BombShopkeeper_Draw; this->changeObjectFunc = NULL; this->skelAnime.playSpeed = 2.0f; } -void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) { +void EnSob1_InitShop(EnSob1* this, PlayState* play) { ShopItem* shopItems; EnSob1XZRange* xzRange; Vec3f* posOffset; - if (EnSob1_AreObjectsLoaded(this, globalCtx)) { + if (EnSob1_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.objBankIndex = this->mainObjIndex; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); posOffset = &sPosOffset[this->shopType]; this->actor.world.pos.x += posOffset->x; this->actor.world.pos.y += posOffset->y; @@ -1372,14 +1368,14 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) { EnSob1_GetCutscenes(this); this->cutscene = this->lookFowardCutscene; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - sInitFuncs[this->shopType](this, globalCtx); + sInitFuncs[this->shopType](this, play); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->wasTalkedToWhileWalking = false; this->waypoint = 0; if (this->shopType == BOMB_SHOP) { - this->path = SubS_GetPathByIndex(globalCtx, ENSOB1_GET_PATH(&this->actor), 0x1F); + this->path = SubS_GetPathByIndex(play, ENSOB1_GET_PATH(&this->actor), 0x1F); } if (this->shopType == BOMB_SHOP) { EnSob1_SetupAction(this, EnSob1_SetupWalk); @@ -1440,7 +1436,7 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; this->posXZRange = sPosXZRanges[this->shopType]; Actor_SetScale(&this->actor, sActorScales[this->shopType]); - EnSob1_SpawnShopItems(this, globalCtx, shopItems); + EnSob1_SpawnShopItems(this, play, shopItems); this->headRot = this->headRotTarget = 0; this->blinkTimer = 20; this->eyeTexIndex = 0; @@ -1449,30 +1445,30 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) { } } -void EnSob1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_Update(Actor* thisx, PlayState* play) { EnSob1ActionFunc changeObjectFunc; EnSob1* this = THIS; if (this->actionFunc != EnSob1_InitShop) { this->blinkFunc(this); - EnSob1_UpdateJoystickInputState(globalCtx, this); + EnSob1_UpdateJoystickInputState(play, this); EnSob1_UpdateItemSelectedProperty(this); EnSob1_UpdateStickDirectionPromptAnim(this); EnSob1_UpdateCursorAnim(this); Math_StepToS(&this->headRot, this->headRotTarget, 0x190); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 90.0f); changeObjectFunc = this->changeObjectFunc; if (changeObjectFunc != NULL) { - changeObjectFunc(this, globalCtx); + changeObjectFunc(this, play); } SkelAnime_Update(&this->skelAnime); } else { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void EnSob1_DrawCursor(GlobalContext* globalCtx, EnSob1* this, f32 x, f32 y, f32 z, u8 drawCursor) { +void EnSob1_DrawCursor(PlayState* play, EnSob1* this, f32 x, f32 y, f32 z, u8 drawCursor) { s32 ulx; s32 uly; s32 lrx; @@ -1481,9 +1477,9 @@ void EnSob1_DrawCursor(GlobalContext* globalCtx, EnSob1* this, f32 x, f32 y, f32 s32 dsdx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawCursor != 0) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b, this->cursorColor.a); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -1496,10 +1492,10 @@ void EnSob1_DrawCursor(GlobalContext* globalCtx, EnSob1* this, f32 x, f32 y, f32 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); + CLOSE_DISPS(play->state.gfxCtx); } -void EnSob1_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, f32 dx, +void EnSob1_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; @@ -1513,7 +1509,7 @@ void EnSob1_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f3 (void)"../z_en_soB1.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -1530,30 +1526,30 @@ void EnSob1_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f3 dtdy = dy * unk; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnSob1_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnSob1* this) { +void EnSob1_DrawStickDirectionPrompt(PlayState* play, EnSob1* this) { s32 drawStickRightPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled; (void)"../z_en_soB1.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawStickRightPrompt || drawStickLeftPrompt) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(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 (drawStickRightPrompt) { - EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, + EnSob1_DrawTextRec(play, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, + EnSob1_DrawTextRec(play, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); @@ -1562,22 +1558,22 @@ void EnSob1_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnSob1* this) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickRightPrompt) { - EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, + EnSob1_DrawTextRec(play, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, + EnSob1_DrawTextRec(play, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnSob1_ZoraShopkeeper_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnSob1_ZoraShopkeeper_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSob1* this = THIS; @@ -1587,7 +1583,7 @@ s32 EnSob1_ZoraShopkeeper_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbInd return false; } -s32 EnSob1_BombShopkeeper_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnSob1_BombShopkeeper_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSob1* this = THIS; @@ -1597,13 +1593,12 @@ s32 EnSob1_BombShopkeeper_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbInd return false; } -void EnSob1_BombShopkeeper_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, - Actor* thisx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnSob1_BombShopkeeper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + OPEN_DISPS(play->state.gfxCtx); if (limbIndex == BOMB_SHOPKEEPER_LIMB_LEFT_HAND) { gSPDisplayList(POLY_OPA_DISP++, gBombShopkeeperBombDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Gfx* EnSob1_EndDList(GraphicsContext* gfxCtx) { @@ -1616,76 +1611,76 @@ Gfx* EnSob1_EndDList(GraphicsContext* gfxCtx) { return dList; } -void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play) { static TexturePtr sZoraShopkeeperEyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; EnSob1* this = THIS; s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0x0C, EnSob1_EndDList(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, EnSob1_EndDList(play->state.gfxCtx)); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sZoraShopkeeperEyeTextures[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, EnSob1_ZoraShopkeeper_OverrideLimbDraw, NULL, &this->actor); for (i = 0; i < ARRAY_COUNT(this->items); i++) { this->items[i]->actor.scale.x = 0.2f; this->items[i]->actor.scale.y = 0.2f; this->items[i]->actor.scale.z = 0.2f; } - EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnSob1_DrawStickDirectionPrompt(globalCtx, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnSob1_DrawStickDirectionPrompt(play, this); + CLOSE_DISPS(play->state.gfxCtx); } -void EnSob1_GoronShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play) { static TexturePtr sGoronShopkeeperEyeTextures[] = { gGoronEyeOpenTex, gGoronEyeHalfTex, gGoronEyeClosedTex }; EnSob1* this = THIS; s32 pad; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sGoronShopkeeperEyeTextures[this->eyeTexIndex])); - 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); for (i = 0; i < ARRAY_COUNT(this->items); i++) { this->items[i]->actor.scale.x = 0.2f; this->items[i]->actor.scale.y = 0.2f; this->items[i]->actor.scale.z = 0.2f; } - EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnSob1_DrawStickDirectionPrompt(globalCtx, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnSob1_DrawStickDirectionPrompt(play, this); + CLOSE_DISPS(play->state.gfxCtx); } -void EnSob1_BombShopkeeper_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play) { EnSob1* this = THIS; s32 pad; u32 frames; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBombShopkeeperEyeTex)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSob1_BombShopkeeper_OverrideLimbDraw, EnSob1_BombShopkeeper_PostLimbDraw, &this->actor); for (i = 0; i < ARRAY_COUNT(this->items); i++) { this->items[i]->actor.scale.x = 0.2f; this->items[i]->actor.scale.y = 0.2f; this->items[i]->actor.scale.z = 0.2f; } - EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnSob1_DrawStickDirectionPrompt(globalCtx, this); - frames = globalCtx->gameplayFrames; - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnSob1_DrawStickDirectionPrompt(play, this); + frames = play->gameplayFrames; + func_8012C2DC(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -frames * 20, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -frames * 20, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h index a854d4c3f2..c06f562800 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h @@ -11,7 +11,7 @@ struct EnSob1; -typedef void (*EnSob1ActionFunc)(struct EnSob1*, GlobalContext*); +typedef void (*EnSob1ActionFunc)(struct EnSob1*, PlayState*); typedef void (*EnSob1BlinkFunc)(struct EnSob1*); #define ENSOB1_GET_SHOPTYPE(thisx) ((thisx)->params & 0x1F) 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 b9ccdb579c..4a64f1df6a 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -11,17 +11,17 @@ #define THIS ((EnSsh*)thisx) -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_Wait(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx); -void EnSsh_Land(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_Wait(EnSsh* this, PlayState* play); +void EnSsh_Idle(EnSsh* this, PlayState* play); +void EnSsh_Land(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); extern AnimationHeader D_06000304; @@ -110,17 +110,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 sP1StartColor[4] = { 255, 255, 255, 75 }; u8 sP2StartColor[4] = { 255, 255, 255, 75 }; @@ -139,11 +139,11 @@ s32 EnSsh_CreateBlureEffect(GlobalContext* globalCtx) { blureInit.unkFlag = false; blureInit.calcMode = 3; - Effect_Add(globalCtx, &blureIdx, 1, 0, 0, &blureInit); + Effect_Add(play, &blureIdx, 1, 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; @@ -151,8 +151,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; } return true; @@ -183,7 +183,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[] = { &sCylinderInit1, &sCylinderInit1, &sCylinderInit1, &sCylinderInit2, &sCylinderInit2, &sCylinderInit2, }; @@ -191,7 +191,7 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { s32 pad; for (i = 0; i < ARRAY_COUNT(this->collider1); i++) { - Collider_InitAndSetCylinder(globalCtx, &this->collider1[i], &this->actor, cylinders[i]); + Collider_InitAndSetCylinder(play, &this->collider1[i], &this->actor, cylinders[i]); } this->collider1[0].info.bumper.dmgFlags = 0x38A9; @@ -202,8 +202,8 @@ void EnSsh_InitColliders(EnSsh* this, GlobalContext* globalCtx) { this->collider1[2].info.bumper.dmgFlags = ~0x83038A9; CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit); - Collider_InitJntSph(globalCtx, &this->collider2); - Collider_SetJntSph(globalCtx, &this->collider2, &this->actor, &sJntSphInit, this->collider2Elements); + Collider_InitJntSph(play, &this->collider2); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->collider2Elements); } f32 EnSsh_SetAnimation(EnSsh* this, s32 arg0) { @@ -302,7 +302,7 @@ s32 EnSsh_Damaged(EnSsh* this) { return true; } -void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_Turn(EnSsh* this, PlayState* play) { if (this->hitTimer != 0) { this->hitTimer--; } @@ -315,7 +315,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) { + if (play->state.frames & 8) { 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) { @@ -437,8 +437,8 @@ void EnSsh_Sway(EnSsh* this) { } } -void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnSsh_CheckBodyStickHit(EnSsh* this, PlayState* play) { + Player* player = GET_PLAYER(play); ColliderInfo* colliderInfo = &this->collider1[0].info; if (player->unk_B28 != 0) { @@ -452,7 +452,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; @@ -479,9 +479,9 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_ROLL); Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_ST_ATTACK); - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); - func_800B8D98(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + func_800B8D98(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->hitCount--; return true; } @@ -506,7 +506,7 @@ s32 EnSsh_CheckHitFront(EnSsh* this) { return true; } -s32 EnSsh_CheckHitBack(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_CheckHitBack(EnSsh* this, PlayState* play) { ColliderCylinder* collider = &this->collider1[0]; s32 hit = false; @@ -540,16 +540,16 @@ 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; } - if (globalCtx->actorCtx.unk2 != 0) { + if (play->actorCtx.unk2 != 0) { this->invincibilityTimer = 8; if (this->stunTimer == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); @@ -560,27 +560,27 @@ s32 EnSsh_CollisionCheck(EnSsh* this, GlobalContext* globalCtx) { return false; } - return EnSsh_CheckHitBack(this, globalCtx); + return EnSsh_CheckHitBack(this, play); } -void EnSsh_SetBodyCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetBodyCylinderAC(EnSsh* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider1[0]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1[0].base); } -void EnSsh_SetLegsCylinderAC(EnSsh* this, GlobalContext* globalCtx) { +void EnSsh_SetLegsCylinderAC(EnSsh* this, PlayState* play) { s16 angleTowardsLink = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < (90 * (0x10000 / 360))) { Collider_UpdateCylinder(&this->actor, &this->collider1[2]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1[2].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1[2].base); } else { Collider_UpdateCylinder(&this->actor, &this->collider1[1]); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1[1].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1[1].base); } } -s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { +s32 EnSsh_SetCylinderOC(EnSsh* this, PlayState* play) { Vec3f colliderOffsets[] = { { 40.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { -40.0f, 0.0f, 0.0f } }; Vec3f colliderPos; s32 i; @@ -602,43 +602,43 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, GlobalContext* globalCtx) { this->collider1[3 + i].dim.pos.y = colliderPos.y; this->collider1[3 + i].dim.pos.z = colliderPos.z; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1[3 + i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1[3 + i].base); } return true; } -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->collider2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); return; } 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) { // @bug - this symbol no longer exists, reads from a random place in object_ssh_Tex_000190 instead f32 frameCount = Animation_GetLastFrame(&D_06000304); s32 pad; EnSsh* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphtable, 30); + SkelAnime_Init(play, &this->skelAnime, &object_ssh_Skel_006470, NULL, this->jointTable, this->morphtable, 30); Animation_Change(&this->skelAnime, &object_ssh_Anim_001494, 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 (!ENSSH_IS_CHILD(&this->actor)) { this->stateFlags |= SSH_STATE_FATHER; @@ -653,38 +653,38 @@ void EnSsh_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; this->initialYaw = this->actor.world.rot.y; EnSsh_SetupAction(this, EnSsh_Start); - if (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { Actor_MarkForDeath(&this->actor); } } -void EnSsh_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Destroy(Actor* thisx, PlayState* play) { EnSsh* this = THIS; s32 i; - Effect_Destroy(globalCtx, this->blureIdx); + Effect_Destroy(play, this->blureIdx); for (i = 0; i < ARRAY_COUNT(this->collider1); i++) { - Collider_DestroyCylinder(globalCtx, &this->collider1[i]); + Collider_DestroyCylinder(play, &this->collider1[i]); } - Collider_DestroyJntSph(globalCtx, &this->collider2); + Collider_DestroyJntSph(play, &this->collider2); } -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); +void EnSsh_Talk(EnSsh* this, PlayState* play) { + EnSsh_Bob(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x904: case 0x905: case 0x906: @@ -693,18 +693,18 @@ void EnSsh_Talk(EnSsh* this, GlobalContext* globalCtx) { case 0x911: case 0x912: case 0x914: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnSsh_Idle; break; } } } -void func_809756D0(EnSsh* this, GlobalContext* globalCtx) { +void func_809756D0(EnSsh* this, PlayState* play) { u16 phi_a1; if (gSaveContext.save.weekEventReg[34] & 8) { @@ -713,13 +713,13 @@ void func_809756D0(EnSsh* this, GlobalContext* globalCtx) { phi_a1 = 0x910; gSaveContext.save.weekEventReg[34] |= 8; } - Message_StartTextbox(globalCtx, phi_a1, &this->actor); + Message_StartTextbox(play, phi_a1, &this->actor); } -void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnSsh_Idle(EnSsh* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnSsh_Talk; - func_809756D0(this, globalCtx); + func_809756D0(this, play); return; } @@ -731,7 +731,7 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { EnSsh_SetAnimation(this, SSH_ANIM_WAIT); } - if (!EnSsh_IsCloseToLink(this, globalCtx)) { + if (!EnSsh_IsCloseToLink(this, play)) { EnSsh_SetReturnAnimation(this); EnSsh_SetupAction(this, EnSsh_Return); return; @@ -742,15 +742,15 @@ void EnSsh_Idle(EnSsh* this, GlobalContext* globalCtx) { this->sfxTimer = 64; } - EnSsh_Bob(this, globalCtx); + EnSsh_Bob(this, play); if ((this->unkTimer == 0) && (this->animTimer == 0) && (this->actor.xzDistToPlayer < 100.0f) && - Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&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); } @@ -766,16 +766,16 @@ 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) { @@ -784,14 +784,14 @@ 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)) { @@ -822,24 +822,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 |= SSH_STATE_GROUND_START; 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) { EnSsh* this = THIS; EnSsh_UpdateColliderScale(this); - if (EnSsh_CollisionCheck(this, globalCtx)) { + if (EnSsh_CollisionCheck(this, play)) { return; } @@ -848,11 +848,11 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { } else { SkelAnime_Update(&this->skelAnime); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, play); } - EnSsh_UpdateYaw(this, globalCtx); + EnSsh_UpdateYaw(this, play); if (DECR(this->blinkTimer) == 0) { this->blinkTimer = Rand_S16Offset(60, 60); @@ -863,11 +863,11 @@ void EnSsh_Update(Actor* thisx, GlobalContext* globalCtx) { 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, Actor* thisx) { +s32 EnSsh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSsh* this = THIS; switch (limbIndex) { @@ -902,35 +902,35 @@ s32 EnSsh_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnSsh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSsh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSsh* this = THIS; if ((limbIndex == 5) && (this->stateFlags & SSH_STATE_FATHER)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_ssh_DL_0000D8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } Collider_UpdateSpheres(limbIndex, &this->collider2); } -void EnSsh_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSsh_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80976178[] = { object_ssh_Tex_001970, object_ssh_Tex_001DF0, object_ssh_Tex_0021F0 }; s32 pad; EnSsh* this = THIS; - EnSsh_CheckBodyStickHit(this, globalCtx); + EnSsh_CheckBodyStickHit(this, play); EnSsh_Sway(this); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80976178[this->blinkState])); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSsh_OverrideLimbDraw, EnSsh_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 172ecf0a51..45122c4c3d 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -5,7 +5,7 @@ struct EnSsh; -typedef void (*EnSshActionFunc)(struct EnSsh*, GlobalContext*); +typedef void (*EnSshActionFunc)(struct EnSsh*, PlayState*); #define SSH_STATE_STUNNED (1 << 0) #define SSH_STATE_GROUND_START (1 << 2) 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 e2915a614b..95c39ee76c 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -12,16 +12,16 @@ #define THIS ((EnSt*)thisx) -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSt_Init(Actor* thisx, PlayState* play); +void EnSt_Destroy(Actor* thisx, PlayState* play); +void EnSt_Update(Actor* thisx, PlayState* play); -void func_808A6A78(EnSt* this, GlobalContext* globalCtx); -void func_808A6C04(EnSt* this, GlobalContext* globalCtx); -void func_808A6D84(EnSt* this, GlobalContext* globalCtx); -void func_808A6E24(EnSt* this, GlobalContext* globalCtx); -void func_808A701C(EnSt* this, GlobalContext* globalCtx); -void func_808A7478(Actor* thisx, GlobalContext* globalCtx); +void func_808A6A78(EnSt* this, PlayState* play); +void func_808A6C04(EnSt* this, PlayState* play); +void func_808A6D84(EnSt* this, PlayState* play); +void func_808A6E24(EnSt* this, PlayState* play); +void func_808A701C(EnSt* this, PlayState* play); +void func_808A7478(Actor* thisx, PlayState* play); const ActorInit En_St_InitVars = { ACTOR_EN_ST, @@ -163,7 +163,7 @@ static AnimationInfoS sAnimations[] = { { &object_st_Anim_005B98, 2.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -void func_808A5050(EnSt* this, GlobalContext* globalCtx) { +void func_808A5050(EnSt* this, PlayState* play) { static Color_RGBA8 D_808A770C = { 170, 130, 90, 255 }; static Color_RGBA8 D_808A7710 = { 100, 60, 20, 0 }; s32 i; @@ -191,16 +191,16 @@ void func_808A5050(EnSt* this, GlobalContext* globalCtx) { spA0.x = this->actor.world.pos.x + (2.0f * spB8.x); spA0.z = this->actor.world.pos.z + (2.0f * spB8.z); - func_800B0EB0(globalCtx, &spA0, &spB8, &spAC, &D_808A770C, &D_808A7710, 100, 40, rand); + func_800B0EB0(play, &spA0, &spB8, &spAC, &D_808A770C, &D_808A7710, 100, 40, rand); } spA0.x = this->actor.world.pos.x; spA0.z = this->actor.world.pos.z; spA0.y = this->actor.floorHeight; - EffectSsBlast_SpawnWhiteCustomScale(globalCtx, &spA0, &gZeroVec3f, &gZeroVec3f, 100, 220, 8); + EffectSsBlast_SpawnWhiteCustomScale(play, &spA0, &gZeroVec3f, &gZeroVec3f, 100, 220, 8); } -void func_808A52A8(EnSt* this, GlobalContext* globalCtx) { +void func_808A52A8(EnSt* this, PlayState* play) { static Color_RGBA8 D_808A7714 = { 170, 130, 90, 255 }; static Color_RGBA8 D_808A7718 = { 100, 60, 20, 0 }; s32 pad; @@ -231,29 +231,28 @@ void func_808A52A8(EnSt* this, GlobalContext* globalCtx) { spA0.x = this->actor.world.pos.x + (2.0f * spB8.x); spA0.z = this->actor.world.pos.z + (2.0f * spB8.z); - func_800B0EB0(globalCtx, &spA0, &spB8, &spAC, &D_808A7714, &D_808A7718, 100, 40, rand); + func_800B0EB0(play, &spA0, &spB8, &spAC, &D_808A7714, &D_808A7718, 100, 40, rand); } } -void func_808A54B0(EnSt* this, GlobalContext* globalCtx) { +void func_808A54B0(EnSt* this, PlayState* play) { s32 pad; f32 temp_f0; if ((this->unk_18C & 1) && (this->actor.colChkInfo.health != 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSegments[6] = PHYSICAL_TO_VIRTUAL2(globalCtx->objectCtx.status[this->unk_2C0].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL2(play->objectCtx.status[this->unk_2C0].segment); - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[this->unk_2C0].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->unk_2C0].segment); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(0.06f, 0.12f, 0.06f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 195, 0, 0x40, 0x20, 1, 215, 0, 8, 8)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 195, 0, 0x40, 0x20, 1, 215, 0, 8, 8)); temp_f0 = (f32)this->unk_310 / 8; if (temp_f0 > 1.0f) { @@ -264,7 +263,7 @@ void func_808A54B0(EnSt* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_025850); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_025970); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -295,7 +294,7 @@ s32 func_808A576C(EnSt* this) { return false; } -s32 func_808A5988(EnSt* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_808A5988(EnSt* this, PlayState* play, s32 arg2) { s32 ret = false; u8 drawDmgEffType; Vec3f limbPos[1]; @@ -319,7 +318,7 @@ s32 func_808A5988(EnSt* this, GlobalContext* globalCtx, s32 arg2) { } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(globalCtx, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.6f, + Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.6f, this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); ret = true; } @@ -327,7 +326,7 @@ s32 func_808A5988(EnSt* this, GlobalContext* globalCtx, s32 arg2) { return ret; } -void func_808A5AF8(EnSt* this, GlobalContext* globalCtx) { +void func_808A5AF8(EnSt* this, PlayState* play) { Vec3f sp54; s32 i; @@ -338,7 +337,7 @@ void func_808A5AF8(EnSt* this, GlobalContext* globalCtx) { sp54.z += this->unk_358[i].z; Math_Vec3f_Copy(&this->unk_358[i], &sp54); } - Actor_SpawnIceEffects(globalCtx, &this->actor, this->unk_358, 12, 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->unk_358, 12, 3, 0.1f, 0.3f); } s16 func_808A5BEC(EnSt* this) { @@ -412,11 +411,11 @@ void func_808A5DCC(EnSt* this, Color_RGB8* colour) { colour->b = 0; } -s32 func_808A5F28(EnSt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_808A5F28(EnSt* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; - if (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) { + if (Player_GetMask(play) == PLAYER_MASK_STONE) { if (this->unk_2C8 <= 0.0f) { return false; } @@ -476,7 +475,7 @@ s32 func_808A61F4(EnSt* this) { return this->actor.colChkInfo.health; } -void func_808A6220(EnSt* this, GlobalContext* globalCtx) { +void func_808A6220(EnSt* this, PlayState* play) { s32 pad; if ((DECR(this->unk_314) == 0) && (this->actor.colChkInfo.health != 0)) { @@ -484,11 +483,11 @@ void func_808A6220(EnSt* this, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider3); Collider_UpdateCylinder(&this->actor, &this->collider4); if ((s16)ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)) < 0x4E00) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider3.base); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider4.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider4.base); } if (this->actor.colChkInfo.health != 0) { @@ -502,8 +501,8 @@ void func_808A6220(EnSt* this, GlobalContext* globalCtx) { this->collider1.dim.radius = 18; this->collider1.dim.height = 48; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } } @@ -519,8 +518,8 @@ void func_808A63E8(EnSt* this) { this->unk_2C4 = 1.0f; } -void func_808A6468(EnSt* this, GlobalContext* globalCtx) { - func_808A5050(this, globalCtx); +void func_808A6468(EnSt* this, PlayState* play) { + func_808A5050(this, play); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); this->unk_18C |= (0x8 | 0x4); this->unk_18C &= ~(0x10 | 0x2); @@ -546,8 +545,8 @@ void func_808A650C(EnSt* this) { this->unk_18C |= 0x10; } -s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { - Player* sp3C = GET_PLAYER(globalCtx); +s32 func_808A6580(EnSt* this, PlayState* play) { + Player* sp3C = GET_PLAYER(play); s32 ret = false; s32 i; @@ -565,8 +564,8 @@ s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.damageEffect == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } this->collider3.base.acFlags &= ~AC_HIT; } @@ -575,8 +574,8 @@ s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { this->collider2.base.acFlags &= ~AC_HIT; this->collider4.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -613,10 +612,10 @@ s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { } } else { if (ENST_GET_3F(&this->actor) != ENST_3F_63) { - Flags_SetSwitch(globalCtx, ENST_GET_3F(&this->actor)); + Flags_SetSwitch(play, ENST_GET_3F(&this->actor)); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; @@ -663,9 +662,9 @@ s32 func_808A6580(EnSt* this, GlobalContext* globalCtx) { if ((this->collider1.base.ocFlags2 & OC2_HIT_PLAYER) || (this->collider1.base.atFlags & AT_HIT)) { if ((this->unk_316 == 0) && (this->unk_314 == 0) && (this->unk_312 == 0) && !(this->collider1.base.atFlags & AT_BOUNCED) && (this->actor.colChkInfo.health != 0)) { - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); Actor_PlaySfxAtPos(&sp3C->actor, NA_SE_PL_BODY_HIT); - func_800B8D98(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + func_800B8D98(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_316 = 10; this->unk_18C |= 1; this->unk_30E = 0; @@ -685,19 +684,18 @@ s32 func_808A6A3C(EnSt* this) { return ret; } -void func_808A6A78(EnSt* this, GlobalContext* globalCtx) { +void func_808A6A78(EnSt* this, PlayState* play) { s32 pad[2]; - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_2C0)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_2C0)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 8.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); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); - Collider_InitAndSetCylinder(globalCtx, &this->collider3, &this->actor, &sCylinderInit3); - Collider_InitAndSetCylinder(globalCtx, &this->collider4, &this->actor, &sCylinderInit4); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->collider3, &this->actor, &sCylinderInit3); + Collider_InitAndSetCylinder(play, &this->collider4, &this->actor, &sCylinderInit4); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (ENST_GET_1C0(&this->actor) == ENST_1C0_1) { @@ -715,7 +713,7 @@ void func_808A6A78(EnSt* this, GlobalContext* globalCtx) { } } -void func_808A6C04(EnSt* this, GlobalContext* globalCtx) { +void func_808A6C04(EnSt* this, PlayState* play) { this->unk_2CC = Math_SinS(this->unk_30C) * this->unk_2C4; this->unk_30C += 0xE00; Math_ApproachF(&this->unk_2C4, 1.0f, 0.1f, 0.3f); @@ -725,7 +723,7 @@ void func_808A6C04(EnSt* this, GlobalContext* globalCtx) { if ((this->unk_18C & 8) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); this->unk_18C &= ~8; - } else if ((this->unk_310 == 0) && func_808A5F28(this, globalCtx) && !func_808A6064(this)) { + } else if ((this->unk_310 == 0) && func_808A5F28(this, play) && !func_808A6064(this)) { func_808A650C(this); this->actionFunc = func_808A6D84; } else { @@ -738,13 +736,13 @@ void func_808A6C04(EnSt* this, GlobalContext* globalCtx) { } } -void func_808A6D84(EnSt* this, GlobalContext* globalCtx) { +void func_808A6D84(EnSt* this, PlayState* play) { func_808A60E0(this); this->actor.velocity.y = this->unk_2D4 + this->unk_2CC; Actor_MoveWithGravity(&this->actor); if (func_808A6064(this)) { if (this->unk_2C8 < 0.0f) { - func_808A6468(this, globalCtx); + func_808A6468(this, play); } else { func_808A63E8(this); } @@ -753,7 +751,7 @@ void func_808A6D84(EnSt* this, GlobalContext* globalCtx) { func_808A5CCC(this); } -void func_808A6E24(EnSt* this, GlobalContext* globalCtx) { +void func_808A6E24(EnSt* this, PlayState* play) { s32 i; s32 count = 0; @@ -770,7 +768,7 @@ void func_808A6E24(EnSt* this, GlobalContext* globalCtx) { this->unk_2CC = 0.0f; this->unk_2D4 = 0.0f; this->actor.gravity = -1.0f; - func_808A5AF8(this, globalCtx); + func_808A5AF8(this, play); } } else if (this->unk_18C & 0x80) { this->actionFunc = func_808A701C; @@ -793,7 +791,7 @@ void func_808A6E24(EnSt* this, GlobalContext* globalCtx) { } if ((s32)this->actor.velocity.y >= 2) { - func_808A52A8(this, globalCtx); + func_808A52A8(this, play); } } else { Math_ApproachF(&this->actor.shape.yOffset, 400.0f, 0.3f, 1000.0f); @@ -807,7 +805,7 @@ void func_808A6E24(EnSt* this, GlobalContext* globalCtx) { } } -void func_808A701C(EnSt* this, GlobalContext* globalCtx) { +void func_808A701C(EnSt* this, PlayState* play) { s32 i; s32 count = 0; @@ -823,7 +821,7 @@ void func_808A701C(EnSt* this, GlobalContext* globalCtx) { } if (count == ARRAY_COUNT(this->unk_31C)) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0); Actor_MarkForDeath(&this->actor); } } else if (DECR(this->unk_318) == 0) { @@ -835,11 +833,11 @@ void func_808A701C(EnSt* this, GlobalContext* globalCtx) { } } -void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Init(Actor* thisx, PlayState* play) { EnSt* this = THIS; - this->unk_2C0 = Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_KEEP); - if (((ENST_GET_3F(&this->actor) != ENST_3F_63) && Flags_GetSwitch(globalCtx, ENST_GET_3F(&this->actor))) || + this->unk_2C0 = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP); + if (((ENST_GET_3F(&this->actor) != ENST_3F_63) && Flags_GetSwitch(play, ENST_GET_3F(&this->actor))) || (this->unk_2C0 < 0)) { Actor_MarkForDeath(&this->actor); } else { @@ -847,16 +845,16 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Destroy(Actor* thisx, PlayState* play) { EnSt* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider3); - Collider_DestroyCylinder(globalCtx, &this->collider4); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider3); + Collider_DestroyCylinder(play, &this->collider4); } -void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSt_Update(Actor* thisx, PlayState* play) { EnSt* this = THIS; if (this->actor.flags & ACTOR_FLAG_8000) { @@ -869,14 +867,14 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_80; } - if (func_808A6580(this, globalCtx)) { + if (func_808A6580(this, play)) { this->actionFunc = func_808A6E24; } else if (DECR(this->unk_312) == 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { SkelAnime_Update(&this->skelAnime); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); } else if (this->unk_312 < 20) { s16 idx = (this->unk_312 % 2) ? -1 : 1; @@ -896,10 +894,10 @@ void EnSt_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 0.0f); - func_808A6220(this, globalCtx); + func_808A6220(this, play); } -s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnSt* this = THIS; Color_RGB8 sp20; @@ -913,34 +911,34 @@ s32 EnSt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void func_808A7478(Actor* thisx, GlobalContext* globalCtx) { +void func_808A7478(Actor* thisx, PlayState* play) { EnSt* this = THIS; s32 i; s32 count; if (!(this->unk_18C & 0x20)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (func_808A6A3C(this)) { - func_8012C2DC(globalCtx->state.gfxCtx); - POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C2DC(play->state.gfxCtx); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); } else { - func_8012C28C(globalCtx->state.gfxCtx); - POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSt_OverrideLimbDraw, NULL, &this->actor, POLY_OPA_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_31C); i++) { - count += func_808A5988(this, globalCtx, i); + count += func_808A5988(this, play, i); } if (count != 0) { this->unk_31A += 2; } - func_808A54B0(this, globalCtx); + func_808A54B0(this, play); } 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 f3a8275157..d5ca31f2ce 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/src/overlays/actors/ovl_En_St/z_en_st.h @@ -5,7 +5,7 @@ struct EnSt; -typedef void (*EnStActionFunc)(struct EnSt*, GlobalContext*); +typedef void (*EnStActionFunc)(struct EnSt*, PlayState*); #define ENST_GET_3F(thisx) (((thisx)->params & 0x3F) & 0xFF) #define ENST_GET_1C0(thisx) ((((thisx)->params & 0x1C0) >> 6) & 0xFF) 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 58a4f1c59d..4d80d00493 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -13,19 +13,19 @@ #define THIS ((EnSth*)thisx) -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSth_Update(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 func_80B67208(EnSth* this, GlobalContext* globalCtx); -void func_80B67540(EnSth* this, GlobalContext* globalCtx); -void func_80B677BC(EnSth* this, GlobalContext* globalCtx); -void func_80B678A8(EnSth* this, GlobalContext* globalCtx); -void func_80B67958(EnSth* this, GlobalContext* globalCtx); -void func_80B67C1C(EnSth* this, GlobalContext* globalCtx); -void func_80B67DA0(EnSth* this, GlobalContext* globalCtx); -void func_80B680A8(Actor* thisx, GlobalContext* globalCtx); -void func_80B6849C(Actor* thisx, GlobalContext* globalCtx); +void func_80B67208(EnSth* this, PlayState* play); +void func_80B67540(EnSth* this, PlayState* play); +void func_80B677BC(EnSth* this, PlayState* play); +void func_80B678A8(EnSth* this, PlayState* play); +void func_80B67958(EnSth* this, PlayState* play); +void func_80B67C1C(EnSth* this, PlayState* play); +void func_80B67DA0(EnSth* this, PlayState* play); +void func_80B680A8(Actor* thisx, PlayState* play); +void func_80B6849C(Actor* thisx, PlayState* play); const ActorInit En_Sth_InitVars = { ACTOR_EN_STH, @@ -78,21 +78,21 @@ Color_RGB8 D_80B6D20C[] = { { 190, 110, 0 }, { 0, 180, 110 }, { 0, 255, 0x50 }, { 255, 160, 60 }, { 190, 230, 250 }, { 240, 230, 120 }, }; -void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Init(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; s32 objectId; if (ENSTH_GET_100(&this->actor)) { - objectId = Object_GetIndex(&globalCtx->objectCtx, OBJECT_AHG); + objectId = Object_GetIndex(&play->objectCtx, OBJECT_AHG); } else { - objectId = Object_GetIndex(&globalCtx->objectCtx, OBJECT_STH); + objectId = Object_GetIndex(&play->objectCtx, OBJECT_STH); } this->unk_29E = objectId; - this->unk_29F = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MASK_TRUTH); + this->unk_29F = Object_GetIndex(&play->objectCtx, OBJECT_MASK_TRUTH); Actor_SetScale(&this->actor, 0.01f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); @@ -103,7 +103,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENSTH_GET_F(&this->actor)) { case ENSTH_F_1: - if (globalCtx->actorCtx.unk5 & 2) { + if (play->actorCtx.unk5 & 2) { this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); this->actionFunc = func_80B67958; } else { @@ -113,7 +113,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENSTH_F_2: - if (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { this->actionFunc = func_80B67DA0; } else { Actor_MarkForDeath(&this->actor); @@ -148,8 +148,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { break; case ENSTH_F_5: - if (!(gSaveContext.save.weekEventReg[13] & 0x20) || - (Inventory_GetSkullTokenCount(globalCtx->sceneNum) < 30)) { + if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { Actor_MarkForDeath(&this->actor); return; } @@ -164,14 +163,14 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSth_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Destroy(Actor* thisx, PlayState* play) { EnSth* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 func_80B6703C(EnSth* this, GlobalContext* globalCtx) { - if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && +s32 func_80B6703C(EnSth* this, PlayState* play) { + if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x2000)) { return true; } @@ -186,7 +185,7 @@ void func_80B670A4(EnSth* this, s16 arg1) { } } -void func_80B67148(EnSth* this, GlobalContext* globalCtx) { +void func_80B67148(EnSth* this, PlayState* play) { s32 day = CURRENT_DAY - 1; u16 val; @@ -195,30 +194,30 @@ void func_80B67148(EnSth* this, GlobalContext* globalCtx) { } val = D_80B6D1E8[day]; - Message_StartTextbox(globalCtx, val, &this->actor); + Message_StartTextbox(play, val, &this->actor); } -void func_80B671A0(EnSth* this, GlobalContext* globalCtx) { +void func_80B671A0(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->actionFunc = func_80B67208; - func_801477B4(globalCtx); + func_801477B4(play); } } -void func_80B67208(EnSth* this, GlobalContext* globalCtx) { +void func_80B67208(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80B67148(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80B67148(this, play); this->actionFunc = func_80B671A0; - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 110.0f); + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&this->actor, play, 110.0f); } } -void func_80B672A4(EnSth* this, GlobalContext* globalCtx) { +void func_80B672A4(EnSth* this, PlayState* play) { u16 sp1E; s32 day = CURRENT_DAY - 1; @@ -236,15 +235,15 @@ void func_80B672A4(EnSth* this, GlobalContext* globalCtx) { } else { sp1E = D_80B6D1F8[day]; } - Message_StartTextbox(globalCtx, sp1E, &this->actor); + Message_StartTextbox(play, sp1E, &this->actor); } -void func_80B67348(EnSth* this, GlobalContext* globalCtx) { +void func_80B67348(EnSth* this, PlayState* play) { u16 phi_a1; SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = func_80B67540; @@ -274,31 +273,31 @@ void func_80B67348(EnSth* this, GlobalContext* globalCtx) { } break; } - Message_StartTextbox(globalCtx, phi_a1, &this->actor); + Message_StartTextbox(play, phi_a1, &this->actor); } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } } -void func_80B67458(EnSth* this, GlobalContext* globalCtx) { +void func_80B67458(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B67348; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); if (CURRENT_DAY == 3) { func_80B670A4(this, 6); } else { func_80B670A4(this, 3); } } else { - Actor_PickUp(&this->actor, globalCtx, this->actor.home.rot.z, 10000.0f, 500.0f); + Actor_PickUp(&this->actor, play, this->actor.home.rot.z, 10000.0f, 500.0f); } } -void func_80B67540(EnSth* this, GlobalContext* globalCtx) { +void func_80B67540(EnSth* this, PlayState* play) { s32 sp2C = CURRENT_DAY - 1; if (sp2C < 0) { @@ -312,22 +311,22 @@ void func_80B67540(EnSth* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1134: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1132: case 0x113A: case 0x113F: - func_80151938(globalCtx, 0x1133); + func_80151938(play, 0x1133); break; case 0x1133: - func_80151938(globalCtx, 0x1136); + func_80151938(play, 0x1136); func_80B670A4(this, 6); break; @@ -360,23 +359,23 @@ void func_80B67540(EnSth* this, GlobalContext* globalCtx) { this->actor.home.rot.z = 4; break; } - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B67458; - func_80B67458(this, globalCtx); + func_80B67458(this, play); break; case 0x113C: - func_80151938(globalCtx, 0x113B); + func_80151938(play, 0x113B); break; case 0x1141: - func_80151938(globalCtx, 0x1140); + func_80151938(play, 0x1140); func_80B670A4(this, 3); break; default: this->actionFunc = func_80B677BC; - func_801477B4(globalCtx); + func_801477B4(play); this->unk_29C |= 2; break; } @@ -390,48 +389,48 @@ void func_80B67540(EnSth* this, GlobalContext* globalCtx) { } } -void func_80B677BC(EnSth* this, GlobalContext* globalCtx) { +void func_80B677BC(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80B672A4(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80B672A4(this, play); this->actionFunc = func_80B67540; - } else if (func_80B6703C(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 110.0f); + } else if (func_80B6703C(this, play)) { + func_800B8614(&this->actor, play, 110.0f); } } -void func_80B67838(EnSth* this, GlobalContext* globalCtx) { +void func_80B67838(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->actionFunc = func_80B678A8; - func_801477B4(globalCtx); + func_801477B4(play); } this->unk_294.x = -0x1388; } -void func_80B678A8(EnSth* this, GlobalContext* globalCtx) { +void func_80B678A8(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B67838; - } else if (func_80B6703C(this, globalCtx) || this->actor.isTargeted) { + } else if (func_80B6703C(this, play) || this->actor.isTargeted) { if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { this->actor.textId = 0x1130; } else { this->actor.textId = 0x1131; } - func_800B8614(&this->actor, globalCtx, 110.0f); + func_800B8614(&this->actor, play, 110.0f); } this->unk_294.x = -0x1388; } -void func_80B67958(EnSth* this, GlobalContext* globalCtx) { +void func_80B67958(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void func_80B67984(EnSth* this, GlobalContext* globalCtx) { +void func_80B67984(EnSth* this, PlayState* play) { u16 sp1E; if (gSaveContext.save.weekEventReg[34] & 0x10) { @@ -447,7 +446,7 @@ void func_80B67984(EnSth* this, GlobalContext* globalCtx) { sp1E = 0x918; } func_80B670A4(this, 2); - } else if (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30) { + } else if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { if (INV_CONTENT(ITEM_MASK_TRUTH) == ITEM_MASK_TRUTH) { this->unk_29C |= 4; sp1E = 0x919; @@ -460,52 +459,52 @@ void func_80B67984(EnSth* this, GlobalContext* globalCtx) { sp1E = 0x8FC; gSaveContext.save.weekEventReg[34] |= 2; } - Message_StartTextbox(globalCtx, sp1E, &this->actor); + Message_StartTextbox(play, sp1E, &this->actor); } -void func_80B67AB4(EnSth* this, GlobalContext* globalCtx) { +void func_80B67AB4(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B67C1C; gSaveContext.save.weekEventReg[34] |= 0x40; - Message_StartTextbox(globalCtx, 0x918, &this->actor); + Message_StartTextbox(play, 0x918, &this->actor); } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } } -void func_80B67B50(EnSth* this, GlobalContext* globalCtx) { +void func_80B67B50(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B67AB4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } else { this->unk_29C &= ~1; gSaveContext.save.weekEventReg[34] |= 8; - Actor_PickUp(&this->actor, globalCtx, GI_MASK_TRUTH, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, GI_MASK_TRUTH, 10000.0f, 50.0f); } } -void func_80B67C1C(EnSth* this, GlobalContext* globalCtx) { +void func_80B67C1C(EnSth* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x90C: func_80B670A4(this, 2); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x916: case 0x919: func_80B670A4(this, 3); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x8FC: @@ -513,15 +512,15 @@ void func_80B67C1C(EnSth* this, GlobalContext* globalCtx) { case 0x900: case 0x90A: case 0x90D: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x901: case 0x90B: case 0x917: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B67B50; - func_80B67B50(this, globalCtx); + func_80B67B50(this, play); break; case 0x91A: @@ -538,55 +537,54 @@ void func_80B67C1C(EnSth* this, GlobalContext* globalCtx) { default: this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B67DA0; break; } } } -void func_80B67DA0(EnSth* this, GlobalContext* globalCtx) { +void func_80B67DA0(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80B67984(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80B67984(this, play); this->actionFunc = func_80B67C1C; - } else if (func_80B6703C(this, globalCtx)) { + } else if (func_80B6703C(this, play)) { this->actor.textId = 0; - func_800B8614(&this->actor, globalCtx, 110.0f); + func_800B8614(&this->actor, play, 110.0f); } } -void func_80B67E20(Actor* thisx, GlobalContext* globalCtx) { +void func_80B67E20(Actor* thisx, PlayState* play) { EnSth* this = THIS; - if (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { this->actor.update = func_80B680A8; this->actor.draw = func_80B6849C; this->actor.flags |= ACTOR_FLAG_1; } } -void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSth_Update(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_29E)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_29E)) { this->actor.objBankIndex = this->unk_29E; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); if (ENSTH_GET_100(&this->actor)) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_ahg_Skel_005998, &ovl_En_Sth_Anim_0045B4, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ahg_Skel_005998, &ovl_En_Sth_Anim_0045B4, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); this->unk_29A = 1; if ((gSaveContext.save.weekEventReg[34] & 0x10) || (gSaveContext.save.weekEventReg[34] & 0x20) || - (gSaveContext.save.weekEventReg[34] & 0x40) || - (Inventory_GetSkullTokenCount(globalCtx->sceneNum) >= 30)) { + (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneNum) >= 30)) { func_80B670A4(this, 3); } } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_sth_Skel_0031F8, &ovl_En_Sth_Anim_003F50, + SkelAnime_InitFlex(play, &this->skelAnime, &object_sth_Skel_0031F8, &ovl_En_Sth_Anim_003F50, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_003F50); } @@ -612,7 +610,7 @@ void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { break; } - if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(globalCtx->sceneNum) < 30)) { + if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { this->actor.update = func_80B67E20; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; @@ -620,29 +618,29 @@ void EnSth_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B680A8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B680A8(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; Vec3s sp38; Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (func_80B6703C(this, globalCtx) && !(this->unk_29C & 8) && (this->unk_29A != 5)) { + if (func_80B6703C(this, play) && !(this->unk_29C & 8) && (this->unk_29A != 5)) { sp38.x = sp38.y = sp38.z = 0; - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_294, &sp38, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_294, &sp38, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_294.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_294.y, 0, 6, 6200, 100); } } -s32 func_80B681E8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80B681E8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; EnSth* this = THIS; @@ -653,13 +651,13 @@ s32 func_80B681E8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p } if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += (s16)(Math_SinS(globalCtx->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f); - rot->z += (s16)(Math_CosS(globalCtx->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f); + rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f); + rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f); } return false; } -void func_80B68310(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80B68310(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSth* this = THIS; if (limbIndex == 15) { @@ -668,48 +666,48 @@ void func_80B68310(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&D_80B6D200, &this->actor.focus.pos); if (!ENSTH_GET_100(&this->actor)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Sth_DL_0037C0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_29C & 1) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_29F)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_29F)) { Matrix_Push(); Matrix_RotateZS(0x3A98, MTXMODE_APPLY); Matrix_Translate(0.0f, 190.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x0A, globalCtx->objectCtx.status[this->unk_29F].segment); + gSPSegment(POLY_OPA_DISP++, 0x0A, play->objectCtx.status[this->unk_29F].segment); gSPDisplayList(POLY_OPA_DISP++, object_mask_truth_DL_0001A0); Matrix_Pop(); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } -void func_80B6849C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B6849C(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(globalCtx->state.gfxCtx, D_80B6D20C[1].r, D_80B6D20C[1].g, D_80B6D20C[1].b, 255)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 90, 110, 130, 255)); + Gfx_EnvColor(play->state.gfxCtx, D_80B6D20C[1].r, D_80B6D20C[1].g, D_80B6D20C[1].b, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(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, func_80B681E8, func_80B68310, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 422a92c34a..38d5fcc7fb 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -5,7 +5,7 @@ struct EnSth; -typedef void (*EnSthActionFunc)(struct EnSth*, GlobalContext*); +typedef void (*EnSthActionFunc)(struct EnSth*, PlayState*); #define ENSTH_GET_F(thisx) ((thisx)->params & 0xF) #define ENSTH_GET_100(thisx) ((thisx)->params & 0x100) diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c index 0bf0ae73c0..4cf9cb5fd2 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c @@ -10,9 +10,9 @@ #define THIS ((EnSth2*)thisx) -void EnSth2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSth2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSth2_Update(Actor* thisx, GlobalContext* globalCtx); +void EnSth2_Init(Actor* thisx, PlayState* play); +void EnSth2_Destroy(Actor* thisx, PlayState* play); +void EnSth2_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Sth2_InitVars = { diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 54a1f84a81..fe4882947a 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -10,17 +10,17 @@ #define THIS ((EnStoneheishi*)thisx) -void EnStoneheishi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnStoneheishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnStoneheishi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnStoneheishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnStoneheishi_Init(Actor* thisx, PlayState* play); +void EnStoneheishi_Destroy(Actor* thisx, PlayState* play); +void EnStoneheishi_Update(Actor* thisx, PlayState* play); +void EnStoneheishi_Draw(Actor* thisx, PlayState* play); -void func_80BC9560(EnStoneheishi* this, GlobalContext* globalCtx); -void func_80BC9680(EnStoneheishi* this, GlobalContext* globalCtx); -void func_80BC9908(EnStoneheishi* this, GlobalContext* globalCtx); -void func_80BC9A2C(EnStoneheishi* this, GlobalContext* globalCtx); -void func_80BC9D28(EnStoneheishi* this, GlobalContext* globalCtx); -void func_80BC9E50(EnStoneheishi* this, GlobalContext* globalCtx); +void func_80BC9560(EnStoneheishi* this, PlayState* play); +void func_80BC9680(EnStoneheishi* this, PlayState* play); +void func_80BC9908(EnStoneheishi* this, PlayState* play); +void func_80BC9A2C(EnStoneheishi* this, PlayState* play); +void func_80BC9D28(EnStoneheishi* this, PlayState* play); +void func_80BC9E50(EnStoneheishi* this, PlayState* play); #if 0 const ActorInit En_Stone_heishi_InitVars = { diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.h b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.h index 32604cca53..b858117b4d 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.h +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.h @@ -5,7 +5,7 @@ struct EnStoneheishi; -typedef void (*EnStoneheishiActionFunc)(struct EnStoneheishi*, GlobalContext*); +typedef void (*EnStoneheishiActionFunc)(struct EnStoneheishi*, PlayState*); typedef struct EnStoneheishi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index 3ca829630c..ec412ce794 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -10,13 +10,13 @@ #define THIS ((EnStopheishi*)thisx) -void EnStopheishi_Init(Actor* thisx, GlobalContext* globalCtx); -void EnStopheishi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnStopheishi_Update(Actor* thisx, GlobalContext* globalCtx); -void EnStopheishi_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnStopheishi_Init(Actor* thisx, PlayState* play); +void EnStopheishi_Destroy(Actor* thisx, PlayState* play); +void EnStopheishi_Update(Actor* thisx, PlayState* play); +void EnStopheishi_Draw(Actor* thisx, PlayState* play); -void func_80AE7F34(EnStopheishi* this, GlobalContext* globalCtx); -void func_80AE85C4(EnStopheishi* this, GlobalContext* globalCtx); +void func_80AE7F34(EnStopheishi* this, PlayState* play); +void func_80AE85C4(EnStopheishi* this, PlayState* play); #if 0 const ActorInit En_Stop_heishi_InitVars = { diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h index c85e00f06f..93e1f32ba3 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h @@ -5,7 +5,7 @@ struct EnStopheishi; -typedef void (*EnStopheishiActionFunc)(struct EnStopheishi*, GlobalContext*); +typedef void (*EnStopheishiActionFunc)(struct EnStopheishi*, PlayState*); typedef struct EnStopheishi { /* 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 abf58da86c..782f32c0d4 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -11,12 +11,12 @@ #define THIS ((EnStream*)thisx) -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_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, GlobalContext* globalCtx); +void EnStream_WaitForPlayer(EnStream* this, PlayState* play); const ActorInit En_Stream_InitVars = { ACTOR_EN_STREAM, @@ -38,7 +38,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 = THIS; this->size = EN_STREAM_SIZE(&this->actor); @@ -49,7 +49,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) { } s32 EnStream_PlayerIsInRange(Vec3f* vortexWorldPos, Vec3f* playerWorldPos, Vec3f* posDifference, f32 vortexYScale) { @@ -81,8 +81,8 @@ s32 EnStream_PlayerIsInRange(Vec3f* vortexWorldPos, Vec3f* playerWorldPos, Vec3f 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; @@ -112,8 +112,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); s32 pad; Vec3f temp; @@ -123,27 +123,27 @@ void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { } } -void EnStream_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnStream_Update(Actor* thisx, PlayState* play) { EnStream* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_800B8FE8(&this->actor, 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; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gfx = POLY_XLU_DISP; - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); multipliedFrames = frames * 20; gSPSegment(&gfx[1], 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 30, -multipliedFrames, 64, 64, 1, multipliedFrames, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, frames * 30, -multipliedFrames, 64, 64, 1, multipliedFrames, -multipliedFrames, 64, 64)); gSPDisplayList(&gfx[2], gWaterVortexDL); POLY_XLU_DISP = &gfx[3]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 3948b70c9a..c544be02f7 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.h +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.h @@ -23,7 +23,7 @@ typedef enum { struct EnStream; -typedef void (*EnStreamActionFunc)(struct EnStream*, GlobalContext*); +typedef void (*EnStreamActionFunc)(struct EnStream*, PlayState*); typedef struct EnStream { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 6290bde811..8d370985d7 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -13,29 +13,29 @@ #define THIS ((EnSuttari*)thisx) -void EnSuttari_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSuttari_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSuttari_Init(Actor* thisx, PlayState* play); +void EnSuttari_Destroy(Actor* thisx, PlayState* play); +void EnSuttari_Update(Actor* thisx, PlayState* play); +void EnSuttari_Draw(Actor* thisx, PlayState* play); -void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx); -void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD004(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx); -void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD130(EnSuttari* this, GlobalContext* globalCtx); -void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx); -void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx); -void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADE8C(EnSuttari* this, GlobalContext* globalCtx); -void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BACA14(EnSuttari* this, PlayState* play); +void func_80BACEE0(EnSuttari* this, PlayState* play); +void func_80BAD004(EnSuttari* this, PlayState* play); +void func_80BAD5F8(EnSuttari* this, PlayState* play); +void func_80BAD7F8(EnSuttari* this, PlayState* play); +void func_80BAD380(EnSuttari* this, PlayState* play); +void func_80BACBB0(EnSuttari* this, PlayState* play); +void func_80BADA9C(EnSuttari* this, PlayState* play); +void func_80BADDB4(EnSuttari* this, PlayState* play); +void func_80BAD130(EnSuttari* this, PlayState* play); +void func_80BACD2C(EnSuttari* this, PlayState* play); +void func_80BACE4C(EnSuttari* this, PlayState* play); +void func_80BADD0C(EnSuttari* this, PlayState* play); +void func_80BADA08(EnSuttari* this, PlayState* play); +void func_80BAD2B4(EnSuttari* this, PlayState* play); +void func_80BADE14(EnSuttari* this, PlayState* play); +void func_80BADE8C(EnSuttari* this, PlayState* play); +void func_80BADF3C(EnSuttari* this, PlayState* play); const ActorInit En_Suttari_InitVars = { ACTOR_EN_SUTTARI, @@ -181,7 +181,7 @@ static s32 D_80BAE8F8[] = { -1, -1, -1, -1, -1, -1, 1, 2, 0, 3, 1, 2, 0, 0, 3, 0, }; -void EnSuttari_UpdateCollider(EnSuttari* this, GlobalContext* globalCtx) { +void EnSuttari_UpdateCollider(EnSuttari* this, PlayState* play) { 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; @@ -192,7 +192,7 @@ void EnSuttari_UpdateCollider(EnSuttari* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.damageEffect == 0xF) { this->flags1 |= 0x100; this->flags1 &= ~0x40; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } else if (this->actor.colChkInfo.damageEffect == 0xE) { this->flags1 |= 0x200; this->flags1 &= ~0x40; @@ -200,18 +200,18 @@ void EnSuttari_UpdateCollider(EnSuttari* this, GlobalContext* globalCtx) { } } - 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->flags1 & 1) && (this->actionFunc != func_80BADE14)) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 30.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, 5); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 30.0f, 30.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, 4); } } -Actor* EnSuttari_GetActorById(GlobalContext* globalCtx, s16 actorId) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +Actor* EnSuttari_GetActorById(PlayState* play, s16 actorId) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actor != NULL) { if (actor->id == actorId) { @@ -222,11 +222,11 @@ Actor* EnSuttari_GetActorById(GlobalContext* globalCtx, s16 actorId) { return NULL; } -void EnSuttari_SetNextEntrance(GlobalContext* globalCtx, u16 nextEntranceIndex) { - globalCtx->nextEntranceIndex = nextEntranceIndex; - globalCtx->unk_1887F = 0x40; +void EnSuttari_SetNextEntrance(PlayState* play, u16 nextEntranceIndex) { + play->nextEntranceIndex = nextEntranceIndex; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } void EnSuttari_UpdateTime(void) { @@ -234,7 +234,7 @@ void EnSuttari_UpdateTime(void) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed); } -s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) { +s32 func_80BAA904(EnSuttari* this, PlayState* play) { Vec3f pos; s32 pad; CollisionPoly* poly; @@ -242,7 +242,7 @@ s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) { pos.x = (Math_SinS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 100.0f; pos.z = (Math_CosS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.z; - if (BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &pos) > -500.0f) { + if (BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos) > -500.0f) { return false; } return true; @@ -300,7 +300,7 @@ void func_80BAAA94(EnSuttari* this) { } } -void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAAB78(EnSuttari* this, PlayState* play) { if (this->flags1 & 4) { switch (this->textId) { case 0: @@ -365,7 +365,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { case 0: if (gSaveContext.save.weekEventReg[81] & 1) { this->textId = 0x1455; - ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 8; + ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; } else { this->textId = 0x1450; @@ -387,7 +387,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { case 0x1453: this->flags1 |= 0x400; gSaveContext.save.weekEventReg[81] |= 1; - ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 8; + ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 8; this->flags2 |= 1; this->textId = 0x1454; break; @@ -412,7 +412,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { break; } } - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } void func_80BAAF1C(EnSuttari* this) { @@ -429,7 +429,7 @@ void func_80BAAF1C(EnSuttari* this) { } } -void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAAFDC(EnSuttari* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; @@ -445,7 +445,7 @@ void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&effectVelOffset, &effectVel); Matrix_Pop(); if (this->unk3F0 == 0) { - EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &gZeroVec3f, 50, &this->unk3F0, 1); + EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->unk3F0, 1); } if (this->unk3F0 == 1) { play_sound(NA_SE_SY_FOUND); @@ -461,7 +461,7 @@ void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAB1A0(EnSuttari* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; @@ -477,7 +477,7 @@ void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { Matrix_MultVec3f(&effectVelOffset, &effectVel); Matrix_Pop(); if (this->unk3F0 == 0) { - EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &gZeroVec3f, 50, &this->unk3F0, 1); + EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->unk3F0, 1); } if (this->unk3F0 == 1) { play_sound(NA_SE_SY_FOUND); @@ -490,12 +490,12 @@ void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { this->unk3F6 = 20; this->actionFunc = func_80BADE8C; } else { - func_80BAAFDC(this, globalCtx); + func_80BAAFDC(this, play); } } } -void func_80BAB374(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAB374(EnSuttari* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; Vec3f sp38; @@ -503,7 +503,7 @@ void func_80BAB374(EnSuttari* this, GlobalContext* globalCtx) { sp38.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; sp38.y = this->actor.world.pos.y; sp38.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp38, 10.0f, 0, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &sp38, 10.0f, 0, 2.0f, 0, 0, 0); } } @@ -512,20 +512,20 @@ void func_80BAB434(EnSuttari* this) { this->unk3F4 += 0x400; } -void EnSuttari_GetPaths(EnSuttari* this, GlobalContext* globalCtx) { - this->paths[0] = SubS_GetPathByIndex(globalCtx, ENSUTTARI_GET_PATH(&this->actor), 0x3F); - this->paths[1] = SubS_GetPathByIndex(globalCtx, this->paths[0]->unk1, 0x3F); +void EnSuttari_GetPaths(EnSuttari* this, PlayState* play) { + this->paths[0] = SubS_GetPathByIndex(play, ENSUTTARI_GET_PATH(&this->actor), 0x3F); + this->paths[1] = SubS_GetPathByIndex(play, this->paths[0]->unk1, 0x3F); } -void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BAB4F0(EnSuttari* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f point; if (this->flags1 & 0x80) { - EnSuttari_UpdateCollider(this, globalCtx); + EnSuttari_UpdateCollider(this, play); } SkelAnime_Update(&this->skelAnime); - if (!(this->flags1 & 4) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + if (!(this->flags1 & 4) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer)) { point.x = player->actor.world.pos.x; point.y = player->bodyPartsPos[7].y + 3.0f; @@ -541,7 +541,7 @@ void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } } - SubS_FillLimbRotTables(globalCtx, this->unk2FA, this->unk31A, ARRAY_COUNT(this->unk2FA)); + SubS_FillLimbRotTables(play, this->unk2FA, this->unk31A, ARRAY_COUNT(this->unk2FA)); } s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq) { @@ -673,7 +673,7 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { } } -s32 func_80BABC48(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* scheduleResult) { +s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { u16 sp26 = SCHEDULE_TIME_NOW; u16 pad1; u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); @@ -682,7 +682,7 @@ s32 func_80BABC48(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch u16 phi_a0; if (sp1C >= 0) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp23, sp1C); + this->timePath = SubS_GetAdditionalPath(play, sp23, sp1C); } if (this->timePath == NULL) { return 0; @@ -706,7 +706,7 @@ s32 func_80BABC48(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch return 1; } -s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* scheduleResult) { +s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { s32 pad; EnDoor* sp48; u8 sp47 = ENSUTTARI_GET_PATH(&this->actor); @@ -719,10 +719,10 @@ s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch if (this->unk428 == 10 || this->unk428 == 11 || this->unk428 == 2) { return 0; } - sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, globalCtx, ACTORCAT_DOOR, ACTOR_EN_DOOR); + sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR); sp24 = D_80BAE8F8[scheduleResult->result]; if ((sp48 != NULL) && (sp24 >= 0)) { - this->timePath = SubS_GetAdditionalPath(globalCtx, sp47, sp24); + this->timePath = SubS_GetAdditionalPath(play, sp47, sp24); } if ((sp48 == NULL) || (this->timePath == NULL)) { return 0; @@ -742,7 +742,7 @@ s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch return 1; } -s32 func_80BABF64(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* scheduleResult) { +s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { s32 ret; switch (scheduleResult->result) { @@ -750,7 +750,7 @@ s32 func_80BABF64(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch case 14: case 13: case 12: - ret = func_80BABC48(this, globalCtx, scheduleResult); + ret = func_80BABC48(this, play, scheduleResult); break; case 11: case 10: @@ -758,7 +758,7 @@ s32 func_80BABF64(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch case 8: case 7: case 6: - ret = func_80BABDD8(this, globalCtx, scheduleResult); + ret = func_80BABDD8(this, play, scheduleResult); break; case 5: case 4: @@ -774,7 +774,7 @@ s32 func_80BABF64(EnSuttari* this, GlobalContext* globalCtx, ScheduleResult* sch return ret; } -s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { +s32 func_80BABFD4(EnSuttari* this, PlayState* play) { f32 knots[265]; Vec3f sp70; Vec3f sp64; @@ -789,7 +789,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; this->unk42C = 1; } else { @@ -797,7 +797,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { } this->actor.world.pos.x = timePathTargetPos.x; this->actor.world.pos.z = timePathTargetPos.z; - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { sp54 = this->timePathElapsedTime; sp50 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -812,7 +812,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { sp64 = this->timePathTargetPos; this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); } - if (SubS_InCsMode(globalCtx)) { + if (SubS_InCsMode(play)) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; @@ -820,7 +820,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BAC220(EnSuttari* this, GlobalContext* globalCtx) { +s32 func_80BAC220(EnSuttari* this, PlayState* play) { Vec3f sp3C; Vec3f sp30; s32 tmp2; @@ -841,8 +841,8 @@ s32 func_80BAC220(EnSuttari* this, GlobalContext* globalCtx) { return 0; } -void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BAC2FC(EnSuttari* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -850,7 +850,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { case 12: case 13: this->flags1 |= 0x80; - func_80BABFD4(this, globalCtx); + func_80BABFD4(this, play); break; case 15: if ((this->animationIndex == 1) && (curFrame == frameCount)) { @@ -870,16 +870,16 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } } - func_80BABFD4(this, globalCtx); + func_80BABFD4(this, play); break; case 6: case 8: this->flags1 |= 0x80; - func_80BAC220(this, globalCtx); + func_80BAC220(this, play); break; case 10: this->flags1 |= 0x80; - func_80BAC220(this, globalCtx); + func_80BAC220(this, play); break; case 9: case 11: @@ -890,17 +890,17 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { this->animationIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } - func_80BAC220(this, globalCtx); + func_80BAC220(this, play); break; case 7: this->flags1 |= 0x20; this->flags1 |= 0x80; - func_80BAC220(this, globalCtx); + func_80BAC220(this, play); break; case 14: this->flags1 |= 0x20; this->flags1 |= 0x80; - func_80BABFD4(this, globalCtx); + func_80BABFD4(this, play); break; case 1: Actor_MarkForDeath(&this->actor); @@ -930,7 +930,7 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { player->stateFlags1 |= 0x10000000; } this->textId = 0x2A30; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = func_80BAD2B4; } break; @@ -938,13 +938,13 @@ void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } -void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAC6E8(EnSuttari* this, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_00071C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_00071C, this->jointTable, this->morphTable, 16); this->actor.draw = EnSuttari_Draw; this->actor.flags |= ACTOR_FLAG_1; - if (globalCtx->sceneNum == SCENE_IKANA) { + if (play->sceneNum == SCENE_IKANA) { this->flags1 |= 1; if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { this->animationIndex = 2; @@ -960,7 +960,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { this->actionFunc = func_80BACEE0; return; } - } else if (globalCtx->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneNum == SCENE_BACKTOWN) { if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_MarkForDeath(&this->actor); } @@ -975,7 +975,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); this->actionFunc = func_80BAD004; return; - } else if (globalCtx->sceneNum == SCENE_ICHIBA) { + } else if (play->sceneNum == SCENE_ICHIBA) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -985,7 +985,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { this->flags1 |= 2; this->actionFunc = func_80BAD5F8; return; - } else if (globalCtx->sceneNum == SCENE_AYASHIISHOP) { + } else if (play->sceneNum == SCENE_AYASHIISHOP) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -1006,8 +1006,8 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } -void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BACA14(EnSuttari* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->animationIndex == 1 || this->animationIndex == 8) { this->animationIndex = 2; @@ -1021,20 +1021,20 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { this->actionFunc = func_80BACBB0; } } else if ((player->transformation == PLAYER_FORM_HUMAN) && GET_CUR_EQUIP_VALUE(EQUIP_SWORD) != 0) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk3F2 = this->headRot.y; - func_80BAAB78(this, globalCtx); + func_80BAAB78(this, play); this->actionFunc = func_80BADA9C; } else if (this->actor.xzDistToPlayer < 200.0f) { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } } Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); Actor_MoveWithGravity(&this->actor); } -void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BACBB0(EnSuttari* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 target; this->unk3F2 = this->headRot.y; @@ -1044,7 +1044,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { if (this->actor.bgCheckFlags & 8) { target = this->actor.wallYaw; - } else if (func_80BAA904(this, globalCtx)) { + } else if (func_80BAA904(this, play)) { target = -this->actor.world.rot.y; } else { target = -this->actor.yawTowardsPlayer; @@ -1064,8 +1064,8 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BACD2C(EnSuttari* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk3F2 = this->headRot.y; if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { @@ -1086,7 +1086,7 @@ void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BACE4C(EnSuttari* this, PlayState* play) { if (this->actor.xzDistToPlayer > 100.0f) { this->actionFunc = func_80BACBB0; } @@ -1098,58 +1098,58 @@ void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BACEE0(EnSuttari* this, PlayState* play) { ScheduleResult scheduleResult; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, globalCtx, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || + ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { this->actor.flags &= ~ACTOR_FLAG_1; scheduleResult.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } this->unk428 = scheduleResult.result; - func_80BAC2FC(this, globalCtx); + func_80BAC2FC(this, play); func_80BAB434(this); if (this->unk428 == 5) { gSaveContext.save.weekEventReg[58] |= 0x80; this->actionFunc = func_80BADDB4; this->actor.speedXZ = 0.0f; - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) { - func_80BAB1A0(this, globalCtx); + } else if (Player_GetMask(play) != PLAYER_MASK_STONE) { + func_80BAB1A0(this, play); } Actor_MoveWithGravity(&this->actor); } -void func_80BAD004(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAD004(EnSuttari* this, PlayState* play) { ScheduleResult scheduleResult; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, globalCtx, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || + ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { this->actor.flags &= ~ACTOR_FLAG_1; scheduleResult.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } this->unk428 = scheduleResult.result; - func_80BAC2FC(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x2A3A, &this->actor); + func_80BAC2FC(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x2A3A, &this->actor); this->actionFunc = func_80BAD130; } else if ((this->actor.xzDistToPlayer < 200.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } Actor_MoveWithGravity(&this->actor); } -void func_80BAD130(EnSuttari* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void func_80BAD130(EnSuttari* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (this->flags1 & 8) { this->actionFunc = func_80BAD004; } else if (this->flags1 & 4) { @@ -1164,11 +1164,11 @@ void func_80BAD130(EnSuttari* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); } -void func_80BAD230(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAD230(EnSuttari* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { ActorCutscene_Start(this->cutscenes[1], &this->actor); this->textId = 0x2A31; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->flags1 |= 0x4000; Audio_QueueSeqCmd(NA_BGM_CHASE | 0x8000); this->actionFunc = func_80BAD380; @@ -1177,40 +1177,40 @@ void func_80BAD230(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void func_80BAD2B4(EnSuttari* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->textId == 0x2A30) { ActorCutscene_Stop(this->cutscenes[0]); ActorCutscene_SetIntentToPlay(this->cutscenes[1]); this->actionFunc = func_80BAD230; } else { ActorCutscene_Stop(this->cutscenes[1]); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags1 |= 0x40; this->actionFunc = func_80BAD380; } } - func_80BAB374(this, globalCtx); + func_80BAB374(this, play); } -void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void func_80BAD380(EnSuttari* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 0x40) && (globalCtx->msgCtx.currentTextId != 0x2A31)) { + if ((player->stateFlags1 & 0x40) && (play->msgCtx.currentTextId != 0x2A31)) { this->flags1 |= 0x8000; this->actor.speedXZ = 0.0f; } else { this->flags1 &= ~0x8000; func_80BABA90(this, 1, 1); - if ((this->flags1 & 0x4000) && (talkState == 5) && Message_ShouldAdvance(globalCtx)) { + if ((this->flags1 & 0x4000) && (talkState == 5) && Message_ShouldAdvance(play)) { this->flags2 &= ~0x10; player->stateFlags1 &= ~0x10000000; this->flags1 &= ~0x4000; ActorCutscene_Stop(this->cutscenes[1]); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->flags1 |= 0x40; } if (this->flags1 & 0x100) { @@ -1220,9 +1220,9 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[79] |= 0x40; this->flags2 |= 4; this->actor.speedXZ = 0.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); Actor_MarkForDeath(&this->actor); return; } @@ -1233,17 +1233,17 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; Audio_QueueSeqCmd(0x101400FF); this->flags2 |= 4; - EnSuttari_SetNextEntrance(globalCtx, 0xD670); + EnSuttari_SetNextEntrance(play, 0xD670); } else { this->unk3F2 = this->headRot.y; Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 0.5f); Actor_MoveWithGravity(&this->actor); - func_80BAB374(this, globalCtx); + func_80BAB374(this, play); } } } -void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAD5F8(EnSuttari* this, PlayState* play) { ScheduleResult scheduleResult; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1253,82 +1253,82 @@ void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, globalCtx, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || + ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { this->actor.flags &= ~ACTOR_FLAG_1; scheduleResult.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } this->unk428 = scheduleResult.result; - func_80BAC2FC(this, globalCtx); + func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { Actor_MarkForDeath(&this->actor); return; } func_80BAB434(this); if ((this->flags1 & 0x20) && (this->unk430 == 0) && (scheduleResult.result != 7)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x2A02, &this->actor); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); } -void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BAD7F8(EnSuttari* this, PlayState* play) { ScheduleResult scheduleResult; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); if (this->enFsn == NULL) { - this->enFsn = (EnFsn*)EnSuttari_GetActorById(globalCtx, ACTOR_EN_FSN); + this->enFsn = (EnFsn*)EnSuttari_GetActorById(play, ACTOR_EN_FSN); } else { if ((this->flags1 & 0x2000) && (this->animationIndex == 1) && (curFrame == frameCount)) { this->animationIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, globalCtx, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || + ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { this->actor.flags &= ~ACTOR_FLAG_1; scheduleResult.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } this->unk428 = scheduleResult.result; - func_80BAC2FC(this, globalCtx); + func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { Actor_MarkForDeath(&this->actor); return; } if ((this->flags1 & 0x20) && (scheduleResult.result != 9)) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x2A02, &this->actor); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); } } -void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BADA08(EnSuttari* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80BAAB78(this, globalCtx); + func_80BAAB78(this, play); gSaveContext.save.weekEventReg[81] |= 4; } else if (this->actor.xzDistToPlayer < 500.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 500.0f); + func_800B8614(&this->actor, play, 500.0f); } } -void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { - u8 talkstate = Message_GetState(&globalCtx->msgCtx); +void func_80BADA9C(EnSuttari* this, PlayState* play) { + u8 talkstate = Message_GetState(&play->msgCtx); s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1340,18 +1340,18 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } if (talkstate == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->flags1 & 0x400) { if (this->textId == 0x29EE) { ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); } this->flags1 &= ~0x400; if (this->flags2 & 1) { - ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 0x10; + ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 0x10; this->flags2 &= ~1; } - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->textId = 0; if (this->flags1 & 1) { this->actionFunc = func_80BACA14; @@ -1360,18 +1360,18 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { } return; } - func_80BAAB78(this, globalCtx); + func_80BAAB78(this, play); } - } else if ((talkstate == 4) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + } else if ((talkstate == 4) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->flags1 |= 0x800; - func_80BAAB78(this, globalCtx); + func_80BAAB78(this, play); break; case 1: func_8019F230(); - func_80BAAB78(this, globalCtx); + func_80BAAB78(this, play); break; } } @@ -1381,7 +1381,7 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BADD0C(EnSuttari* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIdx])) { if (this->cutsceneIdx == 0) { ActorCutscene_Start(this->cutscenes[this->cutsceneIdx], &this->enFsn->actor); @@ -1395,7 +1395,7 @@ void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx) { } } -void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BADDB4(EnSuttari* this, PlayState* play) { func_80BABA90(this, 1, 1); func_80BAB434(this); if (gSaveContext.save.weekEventReg[51] & 0x10) { @@ -1404,7 +1404,7 @@ void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BADE14(EnSuttari* this, PlayState* play) { func_80BABA90(this, 1, 2); if (this->unk1F4[1] == -0x63) { this->actor.speedXZ = 0.0f; @@ -1415,20 +1415,20 @@ void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80BADE8C(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BADE8C(EnSuttari* this, PlayState* play) { this->unk3F2 = this->headRot.y; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - Message_StartTextbox(globalCtx, 0x2A3A, &this->actor); + Message_StartTextbox(play, 0x2A3A, &this->actor); this->actionFunc = func_80BAD130; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 500.0f); + func_800B8614(&this->actor, play, 500.0f); } } -void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx) { +void func_80BADF3C(EnSuttari* this, PlayState* play) { func_80BABB90(this, 0); if (this->unk1F4[0] == -0x63) { Actor_MarkForDeath(&this->actor); @@ -1440,7 +1440,7 @@ void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void EnSuttari_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSuttari_Init(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; @@ -1448,36 +1448,36 @@ void EnSuttari_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - Collider_InitCylinder(globalCtx, &this->collider); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); this->actor.flags &= ~ACTOR_FLAG_1; - EnSuttari_GetPaths(this, globalCtx); + EnSuttari_GetPaths(this, play); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80BAC6E8; this->actor.gravity = -4.0f; } -void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSuttari_Destroy(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; - if ((globalCtx->sceneNum == SCENE_BACKTOWN) && !(this->flags2 & 4)) { + if ((play->sceneNum == SCENE_BACKTOWN) && !(this->flags2 & 4)) { Audio_QueueSeqCmd(0x101400FF); } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSuttari_Update(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->flags1 & 8) && (this->flags2 & 0x10) && (player->stateFlags1 & 0x10000000)) { player->actor.freezeTimer = 3; } if (!(this->flags1 & 0x8000)) { - func_80BAB4F0(this, globalCtx); + func_80BAB4F0(this, play); } if (this->flags2 & 2) { EnSuttari_UpdateTime(); @@ -1495,8 +1495,7 @@ void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnSuttari_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSuttari_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSuttari* this = THIS; if (limbIndex == 15) { @@ -1519,7 +1518,7 @@ s32 EnSuttari_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSuttari_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80BAE950 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80BAE95C = { 2000.0f, -1000.0f, 0.0f }; EnSuttari* this = THIS; @@ -1535,16 +1534,16 @@ void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList if (this->actor.child == NULL) { if (this->flags1 & 0x100) { bombBag = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_NIMOTSU, - curState->mf[3][0], curState->mf[3][1], curState->mf[3][2], 0, 0, 0, -1); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_NIMOTSU, curState->mf[3][0], + curState->mf[3][1], curState->mf[3][2], 0, 0, 0, -1); if (bombBag != NULL) { Matrix_MtxFToYXZRot(curState, &bombBag->shape.rot, false); } } else { - func_8012C28C(globalCtx->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_013380); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } @@ -1554,32 +1553,32 @@ void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } } -void EnSuttari_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnSuttari_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } -void EnSuttari_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSuttari_Draw(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; Vec3f sp5C; Vec3f sp50; if (this->flags1 & 0x80) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 55, 55, 255, 0)); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 55, 55, 255, 0)); gDPPipeSync(POLY_OPA_DISP++); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSuttari_OverrideLimbDraw, EnSuttari_PostLimbDraw, EnSuttari_TransformLimbDraw, &this->actor); if (this->flags1 & 0x80) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp5C = this->actor.world.pos; sp50.x = 0.2f; sp50.y = 0.2f; sp50.z = 0.2f; - func_800BC620(&sp5C, &sp50, 0xFF, globalCtx); + func_800BC620(&sp5C, &sp50, 0xFF, play); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 5418f182e4..2861e59714 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -6,7 +6,7 @@ struct EnSuttari; -typedef void (*EnSuttariActionFunc)(struct EnSuttari*, GlobalContext*); +typedef void (*EnSuttariActionFunc)(struct EnSuttari*, PlayState*); #define ENSUTTARI_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) 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 ed320dadd8..35893a1f06 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -11,22 +11,22 @@ #define THIS ((EnSw*)thisx) -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); +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); -void func_808DA350(EnSw* this, GlobalContext* globalCtx); -void func_808DA3F4(EnSw* this, GlobalContext* globalCtx); -void func_808DA578(EnSw* this, GlobalContext* globalCtx); -void func_808DA6FC(EnSw* this, GlobalContext* globalCtx); -void func_808DA89C(EnSw* this, GlobalContext* globalCtx); -void func_808DAA60(EnSw* this, GlobalContext* globalCtx); -void func_808DACF4(EnSw* this, GlobalContext* globalCtx); -void func_808DAEB4(EnSw* this, GlobalContext* globalCtx); -void func_808DB100(EnSw* this, GlobalContext* globalCtx); -void func_808DB25C(EnSw* this, GlobalContext* globalCtx); -void func_808DB2E0(EnSw* this, GlobalContext* globalCtx); +void func_808DA350(EnSw* this, PlayState* play); +void func_808DA3F4(EnSw* this, PlayState* play); +void func_808DA578(EnSw* this, PlayState* play); +void func_808DA6FC(EnSw* this, PlayState* play); +void func_808DA89C(EnSw* this, PlayState* play); +void func_808DAA60(EnSw* this, PlayState* play); +void func_808DACF4(EnSw* this, PlayState* play); +void func_808DAEB4(EnSw* this, PlayState* play); +void func_808DB100(EnSw* this, PlayState* play); +void func_808DB25C(EnSw* this, PlayState* play); +void func_808DB2E0(EnSw* this, PlayState* play); const ActorInit En_Sw_InitVars = { ACTOR_EN_SW, @@ -141,7 +141,7 @@ static AnimationInfoS sAnimations[] = { { &object_st_Anim_005B98, 1.0f, 0, -1, ANIMMODE_LOOP_INTERP, -4 }, }; -void func_808D8940(EnSw* this, GlobalContext* globalCtx) { +void func_808D8940(EnSw* this, PlayState* play) { static Color_RGBA8 D_808DBAA4 = { 170, 130, 90, 255 }; static Color_RGBA8 D_808DBAA8 = { 100, 60, 20, 0 }; s32 i; @@ -167,7 +167,7 @@ void func_808D8940(EnSw* this, GlobalContext* globalCtx) { Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, temp_s0, &sp94, &spB8); spA0.x = this->actor.world.pos.x + (2.0f * spB8.x); spA0.z = this->actor.world.pos.z + (2.0f * spB8.z); - func_800B0EB0(globalCtx, &spA0, &spB8, &spAC, &D_808DBAA4, &D_808DBAA8, 60, 30, temp_f4); + func_800B0EB0(play, &spA0, &spB8, &spAC, &D_808DBAA4, &D_808DBAA8, 60, 30, temp_f4); } } @@ -196,7 +196,7 @@ s32 func_808D8B58(EnSw* this) { return 0; } -s32 func_808D8D60(EnSw* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_808D8D60(EnSw* this, PlayState* play, s32 arg2) { s32 ret = false; u8 drawDmgEffType; Vec3f limbPos[1]; @@ -217,7 +217,7 @@ s32 func_808D8D60(EnSw* this, GlobalContext* globalCtx, s32 arg2) { } drawDmgEffAlpha = 1.0f; } - Actor_DrawDamageEffects(globalCtx, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.3f, + Actor_DrawDamageEffects(play, &this->actor, limbPos, ARRAY_COUNT(limbPos), 0.3f, this->drawDmgEffFrozenSteamScales[arg2], drawDmgEffAlpha, drawDmgEffType); ret = true; } @@ -225,7 +225,7 @@ s32 func_808D8D60(EnSw* this, GlobalContext* globalCtx, s32 arg2) { return ret; } -void func_808D8ED0(EnSw* this, GlobalContext* globalCtx) { +void func_808D8ED0(EnSw* this, PlayState* play) { Vec3f sp54; s32 i; @@ -236,22 +236,22 @@ void func_808D8ED0(EnSw* this, GlobalContext* globalCtx) { sp54.z += this->unk_380[i].z; Math_Vec3f_Copy(&this->unk_380[i], &sp54); } - Actor_SpawnIceEffects(globalCtx, &this->actor, this->unk_380, ARRAY_COUNT(this->unk_380), 3, 0.1f, 0.3f); + Actor_SpawnIceEffects(play, &this->actor, this->unk_380, ARRAY_COUNT(this->unk_380), 3, 0.1f, 0.3f); } -void func_808D8FC4(EnSw* this, GlobalContext* globalCtx) { +void func_808D8FC4(EnSw* this, PlayState* play) { Math_Vec3f_ToVec3s(&this->collider.dim.worldSphere.center, &this->actor.world.pos); this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale; if (!(this->unk_410 & 0x10) && (this->actor.colChkInfo.health != 0) && (DECR(this->unk_458) <= 10)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (!(this->unk_410 & 0x10) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->unk_410 & 4) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -348,19 +348,18 @@ void func_808D93BC(EnSw* this) { this->actor.world.rot.x = -this->actor.world.rot.x; } -s32 func_808D9440(GlobalContext* globalCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, - s32* bgId) { +s32 func_808D9440(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32* bgId) { s32 ret = false; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, posA, posB, posResult, outPoly, true, true, true, true, bgId) && - !(func_800C9A4C(&globalCtx->colCtx, *outPoly, *bgId) & 0x30)) { + if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, outPoly, true, true, true, true, bgId) && + !(func_800C9A4C(&play->colCtx, *outPoly, *bgId) & 0x30)) { ret = true; } return ret; } #ifdef NON_MATCHING -void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 arg4) { +void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { CollisionPoly* spA4; CollisionPoly* spA0; s32 pad; @@ -390,11 +389,11 @@ void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 sp84.y = this->actor.world.pos.y - (this->unk_368.y * 4.0f); sp84.z = this->actor.world.pos.z - (this->unk_368.z * 4.0f); - if (func_808D9440(globalCtx, &sp90, &sp84, &sp6C, &spA0, &sp68)) { + if (func_808D9440(play, &sp90, &sp84, &sp6C, &spA0, &sp68)) { sp84.x = (this->unk_350.x * temp_f20) + sp90.x; sp84.y = (this->unk_350.y * temp_f20) + sp90.y; sp84.z = (this->unk_350.z * temp_f20) + sp90.z; - if (func_808D9440(globalCtx, &sp90, &sp84, &sp78, &spA4, &sp64)) { + if (func_808D9440(play, &sp90, &sp84, &sp78, &spA4, &sp64)) { func_808D91C4(this, spA4); Math_Vec3f_Copy(&this->actor.world.pos, &sp78); this->actor.floorBgId = sp64; @@ -427,7 +426,7 @@ void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 sp84.z = sp90.z - (this->unk_35C.z * temp_f20); } - if (func_808D9440(globalCtx, &sp90, &sp84, &sp78, &spA4, &sp64)) { + if (func_808D9440(play, &sp90, &sp84, &sp78, &spA4, &sp64)) { func_808D91C4(this, spA4); Math_Vec3f_Copy(&this->actor.world.pos, &sp78); this->actor.floorBgId = sp64; @@ -450,7 +449,7 @@ void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 } } #else -void func_808D94D0(EnSw* this, GlobalContext* globalCtx, s32 arg2, s32 arg3, s16 arg4); +void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808D94D0.s") #endif @@ -485,12 +484,12 @@ void func_808D9894(EnSw* this, Vec3f* vec) { Matrix_MultVec3f(&sp5C, vec); } -s32 func_808D9968(EnSw* this, GlobalContext* globalCtx) { +s32 func_808D9968(EnSw* this, PlayState* play) { s32 ret = false; s32 param = ENSW_GET_3FC(&this->actor); if (ENSW_GET_3(&this->actor)) { - if ((param != 0x3F) && Flags_GetTreasure(globalCtx, param)) { + if ((param != 0x3F) && Flags_GetTreasure(play, param)) { ret = true; } } @@ -498,15 +497,15 @@ s32 func_808D9968(EnSw* this, GlobalContext* globalCtx) { return ret; } -s32 func_808D99C8(EnSw* this, GlobalContext* globalCtx) { +s32 func_808D99C8(EnSw* this, PlayState* play) { s32 phi_v1 = 0; if (ENSW_GET_3(&this->actor) || (this->unk_458 > 10) || (this->actor.colChkInfo.health == 0)) { return false; } - if ((this->actor.xyzDistToPlayerSq < ((sREG(16) * 10) + 60000)) && (globalCtx->actorCtx.unk1F5 != 0) && - (globalCtx->actorCtx.unk1F4 == 0)) { + if ((this->actor.xyzDistToPlayerSq < ((sREG(16) * 10) + 60000)) && (play->actorCtx.unk1F5 != 0) && + (play->actorCtx.unk1F4 == 0)) { this->actor.colChkInfo.damage = 4; phi_v1 = true; } @@ -514,7 +513,7 @@ s32 func_808D99C8(EnSw* this, GlobalContext* globalCtx) { return phi_v1; } -s32 func_808D9A70(EnSw* this, GlobalContext* globalCtx) { +s32 func_808D9A70(EnSw* this, PlayState* play) { s16 sp2E = 0; f32 frame; @@ -544,7 +543,7 @@ s32 func_808D9A70(EnSw* this, GlobalContext* globalCtx) { } } } - func_808D94D0(this, globalCtx, 0, 0, sp2E); + func_808D94D0(this, play, 0, 0, sp2E); } return false; @@ -630,15 +629,15 @@ void func_808D9F08(EnSw* this) { this->unk_45E = this->unk_460; } -void func_808D9F78(EnSw* this, GlobalContext* globalCtx, s32 arg2) { +void func_808D9F78(EnSw* this, PlayState* play, s32 arg2) { if (arg2 != 0) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, 5); } Actor_SetScale(&this->actor, 0.02f); func_808D9DA0(this); this->actor.speedXZ = 10.0f; this->unk_44C = 10.0f; - func_808D94D0(this, globalCtx, 0, 0, 0); + func_808D94D0(this, play, 0, 0, 0); this->actor.speedXZ = 0.0f; this->unk_44C = 0.0f; this->unk_450 = 1.0f; @@ -646,26 +645,26 @@ void func_808D9F78(EnSw* this, GlobalContext* globalCtx, s32 arg2) { this->unk_410 |= 4; } -void func_808DA024(EnSw* this, GlobalContext* globalCtx) { +void func_808DA024(EnSw* this, PlayState* play) { func_808D9DA0(this); this->actor.speedXZ = 10.0f; this->unk_44C = 10.0f; - func_808D94D0(this, globalCtx, 0, 0, 0); + func_808D94D0(this, play, 0, 0, 0); this->actor.speedXZ = 0.0f; this->unk_44C = 0.0f; this->unk_450 = 1.0f; } -s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) { +s32 func_808DA08C(EnSw* this, PlayState* play) { s32 ret = 0; s32 i; - if (func_808D99C8(this, globalCtx) || (this->collider.base.acFlags & AC_HIT)) { + if (func_808D99C8(this, play) || (this->collider.base.acFlags & AC_HIT)) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect == 4) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -675,8 +674,8 @@ s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) { this->unk_45C = 0; } else if (!func_808D90C4(this)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALTU_DEAD); + Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; if (!ENSW_GET_3(&this->actor)) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); @@ -736,8 +735,8 @@ s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) { return ret; } -void func_808DA350(EnSw* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808DA350(EnSw* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((player->stateFlags1 & 0x200000) && (this->actor.xyzDistToPlayerSq < 8000.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_LAUGH); @@ -746,11 +745,11 @@ void func_808DA350(EnSw* this, GlobalContext* globalCtx) { this->unk_414 = 0.0f; this->actionFunc = func_808DA3F4; } else { - func_808D9A70(this, globalCtx); + func_808D9A70(this, play); } } -void func_808DA3F4(EnSw* this, GlobalContext* globalCtx) { +void func_808DA3F4(EnSw* this, PlayState* play) { s16 temp_v0; s16 temp_s1 = 0; Vec3f sp38; @@ -779,11 +778,11 @@ void func_808DA3F4(EnSw* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_ROLL); this->skelAnime.curFrame = 0.0f; } - func_808D94D0(this, globalCtx, 0, 0, temp_s1); + func_808D94D0(this, play, 0, 0, temp_s1); } #ifdef NON_MATCHING -void func_808DA578(EnSw* this, GlobalContext* globalCtx) { +void func_808DA578(EnSw* this, PlayState* play) { f32 temp_f0; s32 test; s32 test2; @@ -792,11 +791,11 @@ void func_808DA578(EnSw* this, GlobalContext* globalCtx) { if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.3f * temp_f0; - func_808D94D0(this, globalCtx, 1, 0, 0); + func_808D94D0(this, play, 1, 0, 0); if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp30, &this->unk_374); func_808D9894(this, &sp30); - func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp30.z, sp30.x)); + func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp30.z, sp30.x)); } } else if (this->unk_410 & 0x20) { Math_Vec3f_Copy(&this->unk_374, &this->actor.home.pos); @@ -817,12 +816,12 @@ void func_808DA578(EnSw* this, GlobalContext* globalCtx) { this->unk_414 = temp_f0; } #else -void func_808DA578(EnSw* this, GlobalContext* globalCtx); +void func_808DA578(EnSw* this, PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA578.s") #endif #ifdef NON_MATCHING -void func_808DA6FC(EnSw* this, GlobalContext* globalCtx) { +void func_808DA6FC(EnSw* this, PlayState* play) { f32 sp4C; s32 temp; s32 temp2; @@ -832,11 +831,11 @@ void func_808DA6FC(EnSw* this, GlobalContext* globalCtx) { if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.14f * temp_f0; - func_808D94D0(this, globalCtx, 1, 0, 0); + func_808D94D0(this, play, 1, 0, 0); if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -856,11 +855,11 @@ void func_808DA6FC(EnSw* this, GlobalContext* globalCtx) { this->unk_414 = sp4C; } #else -void func_808DA6FC(EnSw* this, GlobalContext* globalCtx); +void func_808DA6FC(EnSw* this, PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA6FC.s") #endif -void func_808DA89C(EnSw* this, GlobalContext* globalCtx) { +void func_808DA89C(EnSw* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { s32 i; s32 count; @@ -883,7 +882,7 @@ void func_808DA89C(EnSw* this, GlobalContext* globalCtx) { func_808D9E44(this); } this->drawDmgEffType = ACTOR_DRAW_DMGEFF_BLUE_FIRE; - func_808D8ED0(this, globalCtx); + func_808D8ED0(this, play); } } else if (ENSW_GET_3(&this->actor)) { this->actionFunc = func_808DAEB4; @@ -903,18 +902,18 @@ void func_808DA89C(EnSw* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; } if ((s32)this->actor.velocity.y >= 2) { - func_808D8940(this, globalCtx); + func_808D8940(this, play); } } else { Math_ApproachF(&this->actor.shape.yOffset, 400.0f, 0.3f, 1000.0f); } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } } -void func_808DAA60(EnSw* this, GlobalContext* globalCtx) { +void func_808DAA60(EnSw* this, PlayState* play) { Vec3s* sp44; s16 temp_v0; s16 sp40; @@ -964,11 +963,11 @@ void func_808DAA60(EnSw* this, GlobalContext* globalCtx) { } } } - func_808D94D0(this, globalCtx, 0, 0, sp40); + func_808D94D0(this, play, 0, 0, sp40); } #ifdef NON_MATCHING -void func_808DACF4(EnSw* this, GlobalContext* globalCtx) { +void func_808DACF4(EnSw* this, PlayState* play) { f32 sp4C; f32 temp_f0; s32 temp_f6; @@ -979,12 +978,12 @@ void func_808DACF4(EnSw* this, GlobalContext* globalCtx) { temp = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.1f * temp; - func_808D94D0(this, globalCtx, 1, 0, 0); + func_808D94D0(this, play, 1, 0, 0); if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, globalCtx, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -1011,11 +1010,11 @@ void func_808DACF4(EnSw* this, GlobalContext* globalCtx) { this->unk_414 = sp4C; } #else -void func_808DACF4(EnSw* this, GlobalContext* globalCtx); +void func_808DACF4(EnSw* this, PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DACF4.s") #endif -void func_808DAEB4(EnSw* this, GlobalContext* globalCtx) { +void func_808DAEB4(EnSw* this, PlayState* play) { Vec3f sp5C; s32 i; s32 count; @@ -1054,13 +1053,13 @@ void func_808DAEB4(EnSw* this, GlobalContext* globalCtx) { sp5C.x += this->unk_368.x * 10.0f; sp5C.y += this->unk_368.y * 10.0f; sp5C.z += this->unk_368.z * 10.0f; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_SI, sp5C.x, sp5C.y, - sp5C.z, 0, 0, 0, this->actor.params) != NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_SI, sp5C.x, sp5C.y, sp5C.z, 0, 0, + 0, this->actor.params) != NULL) { play_sound(NA_SE_SY_KINSTA_MARK_APPEAR); } Actor_MarkForDeath(&this->actor); } - func_808D94D0(this, globalCtx, 0, 0, 0x1554); + func_808D94D0(this, play, 0, 0, 0x1554); } } else { phi_a0 = DECR(this->unk_45C); @@ -1076,19 +1075,19 @@ void func_808DAEB4(EnSw* this, GlobalContext* globalCtx) { } } -void func_808DB100(EnSw* this, GlobalContext* globalCtx) { +void func_808DB100(EnSw* this, PlayState* play) { if (this->actor.parent != NULL) { this->unk_498 = this->actor.parent->id; this->unk_456 = 0; this->unk_454 = 0; this->skelAnime.curFrame = 0.0f; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 4); + func_800BC154(play, &play->actorCtx, &this->actor, 4); this->actionFunc = func_808DB25C; return; } if (!(this->unk_410 & 1)) { - func_808D9A70(this, globalCtx); + func_808D9A70(this, play); return; } @@ -1108,7 +1107,7 @@ void func_808DB100(EnSw* this, GlobalContext* globalCtx) { } } -void func_808DB25C(EnSw* this, GlobalContext* globalCtx) { +void func_808DB25C(EnSw* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { @@ -1120,11 +1119,11 @@ void func_808DB25C(EnSw* this, GlobalContext* globalCtx) { } } -void func_808DB2E0(EnSw* this, GlobalContext* globalCtx) { +void func_808DB2E0(EnSw* this, PlayState* play) { f32 temp_f2; if (this->actor.bgCheckFlags & 1) { - func_808D9F78(this, globalCtx, 0); + func_808D9F78(this, play, 0); temp_f2 = fabsf(this->actor.velocity.y) * 0.6f; this->actor.velocity.x *= 0.5f; this->actor.velocity.y = temp_f2; @@ -1134,14 +1133,14 @@ void func_808DB2E0(EnSw* this, GlobalContext* globalCtx) { if ((s32)temp_f2 != 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND); } else { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, 5); Math_Vec3f_Copy(&this->actor.velocity, &gZeroVec3f); this->unk_410 &= ~(0x10 | 0x1); this->actionFunc = func_808DB100; } if ((s32)this->actor.velocity.y >= 2) { - func_808D8940(this, globalCtx); + func_808D8940(this, play); } } @@ -1149,21 +1148,20 @@ void func_808DB2E0(EnSw* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.velocity.y += this->actor.gravity; Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); } -void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Init(Actor* thisx, PlayState* play) { EnSw* this = THIS; s32 pad; - if (!func_808D9968(this, globalCtx)) { + if (!func_808D9968(this, play)) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.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); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); this->skelAnime.playSpeed = 4.0f; - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); if (!ENSW_GET_3(&this->actor)) { this->actor.hintId = 0x1F; CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -1174,14 +1172,14 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.info.toucher.damage = 16; } - this->unk_1E4 = SubS_GetDayDependentPath(globalCtx, ENSW_GET_FF00(&this->actor), 255, &this->unk_4A0); + this->unk_1E4 = SubS_GetDayDependentPath(play, ENSW_GET_FF00(&this->actor), 255, &this->unk_4A0); if (this->unk_1E4 != NULL) { this->unk_4A0 = 1; } switch (ENSW_GET_3(&this->actor)) { case 0: - func_808D9F78(this, globalCtx, 1); + func_808D9F78(this, play, 1); this->actionFunc = func_808DA350; break; @@ -1199,7 +1197,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_410 |= 8; } - func_808DA024(this, globalCtx); + func_808DA024(this, play); this->unk_410 |= (0x10 | 0x1); this->unk_410 &= ~4; this->actionFunc = func_808DB100; @@ -1220,7 +1218,7 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_410 |= 8; } - func_808D9F78(this, globalCtx, 1); + func_808D9F78(this, play, 1); if (this->unk_1E4 != NULL) { this->unk_49C = 1; func_808D9F08(this); @@ -1235,19 +1233,19 @@ void EnSw_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnSw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Destroy(Actor* thisx, PlayState* play) { EnSw* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -void EnSw_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Update(Actor* thisx, PlayState* play) { EnSw* this = THIS; - if (func_808DA08C(this, globalCtx)) { + if (func_808DA08C(this, play)) { this->actionFunc = func_808DA89C; } else if (DECR(this->unk_45A) == 0) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || (this->unk_45A != 0)) { @@ -1255,10 +1253,10 @@ void EnSw_Update(Actor* thisx, GlobalContext* globalCtx) { } Actor_SetFocus(&this->actor, 0.0f); - func_808D8FC4(this, globalCtx); + func_808D8FC4(this, play); } -s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnSw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSw* this = THIS; if (ENSW_GET_3(&this->actor)) { @@ -1307,23 +1305,23 @@ s32 EnSw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnSw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSw_Draw(Actor* thisx, PlayState* play) { EnSw* this = THIS; s32 i; s32 count; if (this->unk_410 & 4) { if (ENSW_GET_3(&this->actor)) { - func_800B8050(&this->actor, globalCtx, MTXMODE_NEW); + func_800B8050(&this->actor, play, MTXMODE_NEW); } - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_RotateXS(-0x3C72, MTXMODE_APPLY); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, NULL, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSw_OverrideLimbDraw, NULL, &this->actor); } for (i = 0, count = 0; i < ARRAY_COUNT(this->unk_464); i++) { - count += func_808D8D60(this, globalCtx, i); + count += func_808D8D60(this, play, i); } if (count != 0) { 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 4d8e52955a..1ffc67ae20 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -5,7 +5,7 @@ struct EnSw; -typedef void (*EnSwActionFunc)(struct EnSw*, GlobalContext*); +typedef void (*EnSwActionFunc)(struct EnSw*, PlayState*); #define ENSW_GETS_3(params) ((params & 3) & 0xFF) #define ENSW_GET_3(thisx) (ENSW_GETS_3((thisx)->params)) diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index b45da318d4..10dc40483d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -12,17 +12,17 @@ #define THIS ((EnSyatekiCrow*)thisx) -void EnSyatekiCrow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiCrow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiCrow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiCrow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiCrow_Init(Actor* thisx, PlayState* play); +void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiCrow_Update(Actor* thisx, PlayState* play); +void EnSyatekiCrow_Draw(Actor* thisx, PlayState* play); void func_809CA5D4(EnSyatekiCrow* this); -void func_809CA67C(EnSyatekiCrow* this, GlobalContext* globalCtx); +void func_809CA67C(EnSyatekiCrow* this, PlayState* play); void func_809CA71C(EnSyatekiCrow* this); -void func_809CA840(EnSyatekiCrow* this, GlobalContext* globalCtx); -void func_809CA8E4(EnSyatekiCrow* this, GlobalContext* globalCtx); -void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx); +void func_809CA840(EnSyatekiCrow* this, PlayState* play); +void func_809CA8E4(EnSyatekiCrow* this, PlayState* play); +void func_809CABC0(EnSyatekiCrow* this, PlayState* play); static Vec3f D_809CB050 = { 0.0f, 0.0f, 0.0f }; @@ -78,8 +78,8 @@ static Vec3f D_809CB0CC = { 0.0f, 0.0f, 0.0f }; static Vec3f D_809CB0D8 = { 2500.0f, 0.0f, 0.0f }; -void EnSyatekiCrow_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnSyatekiCrow* this = THIS; Path* path; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; @@ -87,18 +87,18 @@ void EnSyatekiCrow_Init(Actor* thisx, GlobalContext* globalCtx2) { path = syatekiMan->path; while (path->unk2 != 0) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } for (i = 0; i < EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor); i++) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); - Collider_InitJntSph(globalCtx, &this->unk_23C); - Collider_SetJntSph(globalCtx, &this->unk_23C, &this->actor, &sJntSphInit, &this->unk_25C); + Collider_InitJntSph(play, &this->unk_23C); + Collider_SetJntSph(play, &this->unk_23C, &this->actor, &sJntSphInit, &this->unk_25C); this->unk_23C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); @@ -115,10 +115,10 @@ void EnSyatekiCrow_Init(Actor* thisx, GlobalContext* globalCtx2) { func_809CA5D4(this); } -void EnSyatekiCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play) { EnSyatekiCrow* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->unk_23C); + Collider_DestroyJntSph(play, &this->unk_23C); } void func_809CA5D4(EnSyatekiCrow* this) { @@ -133,7 +133,7 @@ void func_809CA5D4(EnSyatekiCrow* this) { this->actionFunc = func_809CA67C; } -void func_809CA67C(EnSyatekiCrow* this, GlobalContext* globalCtx) { +void func_809CA67C(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->unk_26A == 1) && (this->unk_1C2 == 1) && @@ -168,7 +168,7 @@ void func_809CA71C(EnSyatekiCrow* this) { this->actionFunc = func_809CA840; } -void func_809CA840(EnSyatekiCrow* this, GlobalContext* globalCtx) { +void func_809CA840(EnSyatekiCrow* this, PlayState* play) { if (((EN_SYATEKI_CROW_GET_PARAM_F(&this->actor) * 20) + 20) < this->unk_1BC) { Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_KAICHO_CRY); this->unk_1BC = 0; @@ -180,7 +180,7 @@ void func_809CA840(EnSyatekiCrow* this, GlobalContext* globalCtx) { } } -void func_809CA8E4(EnSyatekiCrow* this, GlobalContext* globalCtx) { +void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { Vec3f sp34; f32 sp30; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; @@ -232,7 +232,7 @@ void func_809CAAF8(EnSyatekiCrow* this) { this->actionFunc = func_809CABC0; } -void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx) { +void func_809CABC0(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); @@ -244,8 +244,7 @@ void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx) { } if (this->unk_1C4 > 20) { - func_800B3030(globalCtx, &this->actor.world.pos, &D_809CB050, &D_809CB050, this->actor.scale.x * 10000.0f, 0, - 0); + func_800B3030(play, &this->actor.world.pos, &D_809CB050, &D_809CB050, this->actor.scale.x * 10000.0f, 0, 0); syatekiMan->unk_27A++; syatekiMan->unk_274 &= ~(1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)); func_809CA5D4(this); @@ -254,28 +253,28 @@ void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx) { this->unk_1C4++; } -void func_809CACD0(EnSyatekiCrow* this, GlobalContext* globalCtx) { +void func_809CACD0(EnSyatekiCrow* this, PlayState* play) { if (this->actionFunc == func_809CA8E4) { if (this->unk_23C.base.acFlags & AC_HIT) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); this->unk_1C4 = 0; this->unk_23C.base.acFlags &= ~AC_HIT; - EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_809CB0C0, &D_809CB0CC, 5, 1); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_809CB0C0, &D_809CB0CC, 5, 1); func_809CAAF8(this); } else { this->unk_23C.elements->dim.worldSphere.center.x = this->actor.world.pos.x; this->unk_23C.elements->dim.worldSphere.center.y = sJntSphInit.elements[0].dim.modelSphere.center.y + this->actor.world.pos.y; this->unk_23C.elements->dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_23C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_23C.base); } } } -void EnSyatekiCrow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiCrow_Update(Actor* thisx, PlayState* play) { EnSyatekiCrow* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_809CABC0) { Actor_MoveWithoutGravity(&this->actor); @@ -283,11 +282,10 @@ void EnSyatekiCrow_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } - func_809CACD0(this, globalCtx); + func_809CACD0(this, play); } -s32 EnSyatekiCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSyatekiCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) { @@ -299,7 +297,7 @@ s32 EnSyatekiCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx* return false; } -void EnSyatekiCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSyatekiCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSyatekiCrow* this = THIS; Vec3f* sp1C; @@ -314,10 +312,10 @@ void EnSyatekiCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** d } } -void EnSyatekiCrow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiCrow_Draw(Actor* thisx, PlayState* play) { EnSyatekiCrow* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnSyatekiCrow_OverrideLimbDraw, EnSyatekiCrow_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index 8946e213fb..d0b626218d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -9,7 +9,7 @@ struct EnSyatekiCrow; -typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, GlobalContext*); +typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, PlayState*); typedef struct EnSyatekiCrow { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index bd5dece414..f0f0a225bd 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -12,27 +12,27 @@ #define THIS ((EnSyatekiDekunuts*)thisx) -void EnSyatekiDekunuts_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiDekunuts_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play); +void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play); +void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play); void func_80A2BE54(EnSyatekiDekunuts* this); -void func_80A2BF18(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2BF18(EnSyatekiDekunuts* this, PlayState* play); void func_80A2BFC4(EnSyatekiDekunuts* this); -void func_80A2C0F8(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C0F8(EnSyatekiDekunuts* this, PlayState* play); void func_80A2C150(EnSyatekiDekunuts* this); -void func_80A2C168(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C168(EnSyatekiDekunuts* this, PlayState* play); void func_80A2C1AC(EnSyatekiDekunuts* this); -void func_80A2C208(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C208(EnSyatekiDekunuts* this, PlayState* play); void func_80A2C27C(EnSyatekiDekunuts* this); -void func_80A2C2E0(EnSyatekiDekunuts* this, GlobalContext* globalCtx); -void func_80A2C33C(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play); +void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play); void func_80A2C3AC(EnSyatekiDekunuts* this); -void func_80A2C3F0(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C3F0(EnSyatekiDekunuts* this, PlayState* play); void func_80A2C478(EnSyatekiDekunuts* this); -void func_80A2C48C(EnSyatekiDekunuts* this, GlobalContext* globalCtx); -void func_80A2C5DC(EnSyatekiDekunuts* this, GlobalContext* globalCtx); +void func_80A2C48C(EnSyatekiDekunuts* this, PlayState* play); +void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play); const ActorInit En_Syateki_Dekunuts_InitVars = { ACTOR_EN_SYATEKI_DEKUNUTS, @@ -84,18 +84,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP), }; -void EnSyatekiDekunuts_Init(Actor* thisx, GlobalContext* globalCtx2) { +void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { static s32 D_80A2CB9C = 1; EnSyatekiDekunuts* this = THIS; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; s32 phi_v0; Path* path; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; s32 i; path = syatekiMan->path; - 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 (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { Actor_SetScale(&this->actor, 0.01f); @@ -107,11 +107,11 @@ void EnSyatekiDekunuts_Init(Actor* thisx, GlobalContext* globalCtx2) { } while (path->unk2 != phi_v0) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } for (i = 0; i < EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(&this->actor); i++) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } if (D_80A2CB9C == 1) { @@ -123,8 +123,8 @@ void EnSyatekiDekunuts_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gDekuScrubSkel, &gDekuScrubBurrowAnim, this->jointTable, - this->morphTable, DEKU_SCRUB_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gDekuScrubSkel, &gDekuScrubBurrowAnim, this->jointTable, this->morphTable, + DEKU_SCRUB_LIMB_MAX); if (path == NULL) { Actor_MarkForDeath(&this->actor); return; @@ -139,10 +139,10 @@ void EnSyatekiDekunuts_Init(Actor* thisx, GlobalContext* globalCtx2) { func_80A2BE54(this); } -void EnSyatekiDekunuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play) { EnSyatekiDekunuts* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80A2BE54(EnSyatekiDekunuts* this) { @@ -163,7 +163,7 @@ void func_80A2BE54(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2BF18; } -void func_80A2BF18(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2BF18(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->unk_26A == 1) && (this->unk_1E2 == 1) && ((syatekiMan->unk_272 & (1 << this->unk_1E8)) != 0)) { @@ -201,7 +201,7 @@ void func_80A2BFC4(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2C0F8; } -void func_80A2C0F8(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C0F8(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan; if (this->unk_1DA > 20) { @@ -219,7 +219,7 @@ void func_80A2C150(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2C168; } -void func_80A2C168(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C168(EnSyatekiDekunuts* this, PlayState* play) { if (this->unk_1DA > 20) { func_80A2C1AC(this); this->unk_1DA = 0; @@ -236,7 +236,7 @@ void func_80A2C1AC(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2C208; } -void func_80A2C208(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C208(EnSyatekiDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80A2C27C(this); } @@ -257,7 +257,7 @@ void func_80A2C27C(EnSyatekiDekunuts* this) { } } -void func_80A2C2E0(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((this->unk_1EE < this->unk_1D8) || (syatekiMan->unk_26A != 1)) { @@ -267,7 +267,7 @@ void func_80A2C2E0(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { this->unk_1D8++; } -void func_80A2C33C(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((gSaveContext.unk_3DE0[1] <= 0) || (syatekiMan->unk_26A != 1)) { @@ -284,7 +284,7 @@ void func_80A2C3AC(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2C3F0; } -void func_80A2C3F0(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C3F0(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->unk_26A == 1) { @@ -303,7 +303,7 @@ void func_80A2C478(EnSyatekiDekunuts* this) { this->actionFunc = func_80A2C48C; } -void func_80A2C48C(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C48C(EnSyatekiDekunuts* this, PlayState* play) { if (this->unk_1DA > 20) { func_80A2BE54(this); this->unk_1DA = 0; @@ -312,17 +312,17 @@ void func_80A2C48C(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { } } -void func_80A2C4D0(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C4D0(EnSyatekiDekunuts* this, PlayState* play) { static Vec3f D_80A2CBA0 = { 0.0f, 20.0f, 0.0f }; static Vec3f D_80A2CBAC = { 0.0f, 0.0f, 0.0f }; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { - EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 2); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 2); syatekiMan->unk_280 += 100; syatekiMan->unk_26E++; } else { - EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 0); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 0); syatekiMan->unk_280 += 30; syatekiMan->unk_278++; } @@ -334,7 +334,7 @@ void func_80A2C4D0(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { this->actionFunc = func_80A2C5DC; } -void func_80A2C5DC(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { +void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play) { static Color_RGBA8 D_80A2CBB8 = { 255, 255, 255, 255 }; static Color_RGBA8 D_80A2CBBC = { 150, 150, 150, 0 }; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; @@ -350,10 +350,10 @@ void func_80A2C5DC(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y + 18.0f; sp40.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(globalCtx, &sp40, &gZeroVec3f, &gZeroVec3f, &D_80A2CBB8, &D_80A2CBBC, 200, 0, 13); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); + EffectSsDeadDb_Spawn(play, &sp40, &gZeroVec3f, &gZeroVec3f, &D_80A2CBB8, &D_80A2CBBC, 200, 0, 13); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); sp40.y = this->actor.world.pos.y + 10.0f; - EffectSsHahen_SpawnBurst(globalCtx, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { syatekiMan->unk_272 &= ~(1 << this->unk_1E8); @@ -366,11 +366,11 @@ void func_80A2C5DC(EnSyatekiDekunuts* this, GlobalContext* globalCtx) { } } -void EnSyatekiDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiDekunuts* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->actionFunc != func_80A2BF18) && (this->unk_1D8 < this->unk_1EE) && (this->unk_1D8 > 10)) { if ((this->collider.base.acFlags & AC_HIT) && (this->unk_1E2 == 1)) { @@ -381,11 +381,11 @@ void EnSyatekiDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { } this->collider.base.acFlags &= ~AC_HIT; - func_80A2C4D0(this, globalCtx); + func_80A2C4D0(this, play); } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.acFlags &= ~AC_HIT; } @@ -393,7 +393,7 @@ void EnSyatekiDekunuts_Update(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } -s32 EnSyatekiDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, +s32 EnSyatekiDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiDekunuts* this = THIS; @@ -404,13 +404,13 @@ s32 EnSyatekiDekunuts_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, return false; } -void EnSyatekiDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play) { EnSyatekiDekunuts* this = THIS; Vec3f temp_f20; s32 i; if (this->actionFunc != func_80A2BF18) { - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiDekunuts_OverrideLimbDraw, NULL, &this->actor); } @@ -420,16 +420,15 @@ void EnSyatekiDekunuts_Draw(Actor* thisx, GlobalContext* globalCtx) { temp_f20.y = this->unk_1E4[i].y; temp_f20.z = this->unk_1E4[i].z; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(temp_f20.x, temp_f20.y, temp_f20.z, MTXMODE_NEW); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuScrubFlowerDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h index 50361894ba..5acf4d4932 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h @@ -10,7 +10,7 @@ struct EnSyatekiDekunuts; -typedef void (*EnSyatekiDekunutsActionFunc)(struct EnSyatekiDekunuts*, GlobalContext*); +typedef void (*EnSyatekiDekunutsActionFunc)(struct EnSyatekiDekunuts*, PlayState*); typedef struct EnSyatekiDekunuts { /* 0x000 */ Actor actor; 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 b5509e6c80..a615b7b52c 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 @@ -10,29 +10,29 @@ #define THIS ((EnSyatekiMan*)thisx) -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 func_809C6810(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C72D8(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx); -void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx); +void func_809C6810(EnSyatekiMan* this, PlayState* play); +void func_809C6848(EnSyatekiMan* this, PlayState* play); +void func_809C6E30(EnSyatekiMan* this, PlayState* play); +void func_809C72D8(EnSyatekiMan* this, PlayState* play); +void func_809C7990(EnSyatekiMan* this, PlayState* play); +void func_809C7A90(EnSyatekiMan* this, PlayState* play); +void func_809C7C14(EnSyatekiMan* this, PlayState* play); +void func_809C7D14(EnSyatekiMan* this, PlayState* play); +void func_809C7EB4(EnSyatekiMan* this, PlayState* play); +void func_809C7FFC(EnSyatekiMan* this, PlayState* play); +void func_809C80C0(EnSyatekiMan* this, PlayState* play); +void func_809C81D0(EnSyatekiMan* this, PlayState* play); +void func_809C8488(EnSyatekiMan* this, PlayState* play); +void func_809C8610(EnSyatekiMan* this, PlayState* play); +void func_809C8710(EnSyatekiMan* this, PlayState* play); +void func_809C8808(EnSyatekiMan* this, PlayState* play); +void func_809C898C(EnSyatekiMan* this, PlayState* play); +void func_809C8BF0(EnSyatekiMan* this, PlayState* play); const ActorInit En_Syateki_Man_InitVars = { ACTOR_EN_SYATEKI_MAN, @@ -112,29 +112,29 @@ static Vec3f D_809C9474 = { 0.0f, 10.0f, 140.0f }; static Vec3f D_809C9480 = { -20.0f, 20.0f, 198.0f }; static Vec3f D_809C948C = { -20.0f, 40.0f, 175.0f }; -void func_809C64C0(EnSyatekiMan* this, GlobalContext* globalCtx2, EnSyatekiManUnkStruct arg2[], s32 arg3) { - GlobalContext* globalCtx = globalCtx2; +void func_809C64C0(EnSyatekiMan* this, PlayState* play2, EnSyatekiManUnkStruct arg2[], s32 arg3) { + PlayState* play = play2; s32 i; for (i = 0; i < arg3; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, arg2[i].index, arg2[i].x, arg2[i].y, - arg2[i].z, 0, 0, 0, arg2[i].variable); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, arg2[i].index, arg2[i].x, arg2[i].y, arg2[i].z, 0, 0, 0, + arg2[i].variable); } } -void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - Path* sp34 = &globalCtx->setupPathList[ENSYATEKIMAN_GET_FF00(&this->actor)]; + Path* sp34 = &play->setupPathList[ENSYATEKIMAN_GET_FF00(&this->actor)]; s32 sp30 = D_809C946C[this->unk_194]; this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); - if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim, + if (play->sceneNum == SCENE_SYATEKI_MORI) { + SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, &gBurlyGuyHandsOnTableAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gBurlyGuyHandsOnTableAnim, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); } @@ -156,18 +156,18 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeIndex = 0; this->blinkTimer = 0; - if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneNum == SCENE_SYATEKI_MORI) { this->path = sp34; - func_809C64C0(this, globalCtx, D_809C9464[this->unk_194], sp30); + func_809C64C0(this, play, D_809C9464[this->unk_194], sp30); } } -void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { gSaveContext.save.weekEventReg[63] &= (u8)~1; } -s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809C6720(PlayState* play, Vec3f arg1) { + Player* player = GET_PLAYER(play); f32 sp28; f32 phi_f0; s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1); @@ -182,8 +182,8 @@ s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) { phi_f0 = 80.0f; } - globalCtx->actorCtx.unk268 = 1; - func_800B6F20(globalCtx, &globalCtx->actorCtx.unk_26C, phi_f0, sp22); + play->actorCtx.unk268 = 1; + func_800B6F20(play, &play->actorCtx.unk_26C, phi_f0, sp22); if (sp28 < 5.0f) { return true; @@ -192,55 +192,55 @@ s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) { return false; } -void func_809C6810(EnSyatekiMan* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) { +void func_809C6810(EnSyatekiMan* this, PlayState* play) { + if (play->sceneNum == SCENE_SYATEKI_MORI) { this->actionFunc = func_809C6848; - } else if (globalCtx->sceneNum == SCENE_SYATEKI_MIZU) { + } else if (play->sceneNum == SCENE_SYATEKI_MIZU) { this->actionFunc = func_809C72D8; } } -void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C6848(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { u16 sp22; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - sp22 = Text_GetFaceReaction(globalCtx, 0x31); + sp22 = Text_GetFaceReaction(play, 0x31); if (sp22 != 0) { - Message_StartTextbox(globalCtx, sp22, &this->actor); + Message_StartTextbox(play, sp22, &this->actor); this->unk_284 = sp22; } else if (player->transformation == PLAYER_FORM_HUMAN) { if (this->unk_282 == 0) { this->unk_282 = 1; - Message_StartTextbox(globalCtx, 0xA28, &this->actor); + Message_StartTextbox(play, 0xA28, &this->actor); this->unk_284 = 0xA28; } else { - Message_StartTextbox(globalCtx, 0xA29, &this->actor); + Message_StartTextbox(play, 0xA29, &this->actor); this->unk_284 = 0xA29; } } else { switch (CURRENT_DAY) { case 1: - Message_StartTextbox(globalCtx, 0xA38, &this->actor); + Message_StartTextbox(play, 0xA38, &this->actor); this->unk_284 = 0xA38; break; case 2: - Message_StartTextbox(globalCtx, 0xA39, &this->actor); + Message_StartTextbox(play, 0xA39, &this->actor); this->unk_284 = 0xA39; break; case 3: - Message_StartTextbox(globalCtx, 0xA3A, &this->actor); + Message_StartTextbox(play, 0xA3A, &this->actor); this->unk_284 = 0xA3A; break; } } this->actionFunc = func_809C6E30; } else { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } if (player->actor.world.pos.z < 135.0f) { @@ -248,18 +248,18 @@ void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C6A04(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (!CUR_UPG_VALUE(UPG_QUIVER)) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0xA30, &this->actor); + Message_StartTextbox(play, 0xA30, &this->actor); this->unk_284 = 0xA30; } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); - Message_StartTextbox(globalCtx, 0xA31, &this->actor); + Message_StartTextbox(play, 0xA31, &this->actor); this->unk_284 = 0xA31; if (this->unk_26A == 4) { gSaveContext.minigameState = 3; @@ -270,8 +270,8 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { func_801159EC(-20); gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_26A = 7; player->stateFlags1 |= 0x20; this->actionFunc = func_809C7FFC; @@ -281,17 +281,17 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { switch (CURRENT_DAY) { case 1: - Message_StartTextbox(globalCtx, 0xA2D, &this->actor); + Message_StartTextbox(play, 0xA2D, &this->actor); this->unk_284 = 0xA2D; break; case 2: - Message_StartTextbox(globalCtx, 0xA2E, &this->actor); + Message_StartTextbox(play, 0xA2E, &this->actor); this->unk_284 = 0xA2E; break; case 3: - Message_StartTextbox(globalCtx, 0xA2F, &this->actor); + Message_StartTextbox(play, 0xA2F, &this->actor); this->unk_284 = 0xA2F; break; } @@ -305,26 +305,26 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C6C2C(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->unk_284) { case 0xA28: case 0xA29: - Message_StartTextbox(globalCtx, 0xA2A, &this->actor); + Message_StartTextbox(play, 0xA2A, &this->actor); this->unk_284 = 0xA2A; break; case 0xA2B: case 0xA2C: case 0xA35: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->actor.freezeTimer = 0; - func_80112AFC(globalCtx); - globalCtx->interfaceCtx.hbaAmmo = 80; - func_80123F2C(globalCtx, 80); + func_80112AFC(play); + play->interfaceCtx.hbaAmmo = 80; + func_80123F2C(play, 80); this->unk_26A = 1; this->actionFunc = func_809C80C0; func_801A2BB8(NA_BGM_MINI_GAME_2); @@ -332,7 +332,7 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { case 0xA32: if (gSaveContext.save.weekEventReg[63] & 2) { - func_801477B4(globalCtx); + func_801477B4(play); player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; @@ -340,55 +340,55 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { gSaveContext.minigameState = 3; this->unk_26A = 0; } else { - Message_StartTextbox(globalCtx, 0xA33, &this->actor); + Message_StartTextbox(play, 0xA33, &this->actor); this->unk_284 = 0xA33; } break; case 0xA33: - Message_StartTextbox(globalCtx, 0xA2A, &this->actor); + Message_StartTextbox(play, 0xA2A, &this->actor); this->unk_284 = 0xA2A; this->unk_26A = 4; break; case 0xA34: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->actor.freezeTimer = 0; gSaveContext.minigameState = 3; player->stateFlags1 |= 0x20; this->actionFunc = func_809C7A90; - func_809C7A90(this, globalCtx); + func_809C7A90(this, play); break; } } } -void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C6E30(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x20) { player->stateFlags1 |= 0x20; } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 2: this->actionFunc = func_809C6848; this->unk_26A = 0; break; case 4: - func_809C6A04(this, globalCtx); + func_809C6A04(this, play); break; case 5: - func_809C6C2C(this, globalCtx); + func_809C6C2C(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if (Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; @@ -414,25 +414,25 @@ void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C6F98(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C6F98(EnSyatekiMan* this, PlayState* play) { switch (gSaveContext.save.playerForm) { case PLAYER_FORM_HUMAN: - Flags_SetAllTreasure(globalCtx, Flags_GetAllTreasure(globalCtx) + 1); + Flags_SetAllTreasure(play, Flags_GetAllTreasure(play) + 1); if (CURRENT_DAY != 3) { if (!(this->unk_282 & 1)) { this->unk_282 |= 1; - Message_StartTextbox(globalCtx, 0x3E8, &this->actor); + Message_StartTextbox(play, 0x3E8, &this->actor); this->unk_284 = 0x3E8; } else { - Message_StartTextbox(globalCtx, 0x3E9, &this->actor); + Message_StartTextbox(play, 0x3E9, &this->actor); this->unk_284 = 0x3E9; } } else if (!(this->unk_282 & 1)) { this->unk_282 |= 1; - Message_StartTextbox(globalCtx, 0x3EA, &this->actor); + Message_StartTextbox(play, 0x3EA, &this->actor); this->unk_284 = 0x3EA; } else { - Message_StartTextbox(globalCtx, 0x3EB, &this->actor); + Message_StartTextbox(play, 0x3EB, &this->actor); this->unk_284 = 0x3EB; } break; @@ -441,18 +441,18 @@ void func_809C6F98(EnSyatekiMan* this, GlobalContext* globalCtx) { if (CURRENT_DAY != 3) { if (!(this->unk_282 & 2)) { this->unk_282 |= 2; - Message_StartTextbox(globalCtx, 0x3EC, &this->actor); + Message_StartTextbox(play, 0x3EC, &this->actor); this->unk_284 = 0x3EC; } else { - Message_StartTextbox(globalCtx, 0x3ED, &this->actor); + Message_StartTextbox(play, 0x3ED, &this->actor); this->unk_284 = 0x3ED; } } else if (!(this->unk_282 & 2)) { this->unk_282 |= 2; - Message_StartTextbox(globalCtx, 0x3EE, &this->actor); + Message_StartTextbox(play, 0x3EE, &this->actor); this->unk_284 = 0x3EE; } else { - Message_StartTextbox(globalCtx, 0x3EF, &this->actor); + Message_StartTextbox(play, 0x3EF, &this->actor); this->unk_284 = 0x3EF; } break; @@ -461,18 +461,18 @@ void func_809C6F98(EnSyatekiMan* this, GlobalContext* globalCtx) { if (CURRENT_DAY != 3) { if (!(this->unk_282 & 8)) { this->unk_282 |= 8; - Message_StartTextbox(globalCtx, 0x3F0, &this->actor); + Message_StartTextbox(play, 0x3F0, &this->actor); this->unk_284 = 0x3F0; } else { - Message_StartTextbox(globalCtx, 0x3F1, &this->actor); + Message_StartTextbox(play, 0x3F1, &this->actor); this->unk_284 = 0x3F1; } } else if (!(this->unk_282 & 8)) { this->unk_282 |= 8; - Message_StartTextbox(globalCtx, 0x3F4, &this->actor); + Message_StartTextbox(play, 0x3F4, &this->actor); this->unk_284 = 0x3F4; } else { - Message_StartTextbox(globalCtx, 0x3F5, &this->actor); + Message_StartTextbox(play, 0x3F5, &this->actor); this->unk_284 = 0x3F5; } break; @@ -481,61 +481,61 @@ void func_809C6F98(EnSyatekiMan* this, GlobalContext* globalCtx) { if (CURRENT_DAY != 3) { if (!(this->unk_282 & 4)) { this->unk_282 |= 4; - Message_StartTextbox(globalCtx, 0x3F2, &this->actor); + Message_StartTextbox(play, 0x3F2, &this->actor); this->unk_284 = 0x3F2; } else { - Message_StartTextbox(globalCtx, 0x3F3, &this->actor); + Message_StartTextbox(play, 0x3F3, &this->actor); this->unk_284 = 0x3F3; } } else if (!(this->unk_282 & 4)) { this->unk_282 |= 4; - Message_StartTextbox(globalCtx, 0x3F4, &this->actor); + Message_StartTextbox(play, 0x3F4, &this->actor); this->unk_284 = 0x3F4; } else { - Message_StartTextbox(globalCtx, 0x3F5, &this->actor); + Message_StartTextbox(play, 0x3F5, &this->actor); this->unk_284 = 0x3F5; } break; } } -void func_809C72D8(EnSyatekiMan* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - u16 sp26 = Text_GetFaceReaction(globalCtx, 0x30); +void func_809C72D8(EnSyatekiMan* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + u16 sp26 = Text_GetFaceReaction(play, 0x30); if (sp26 != 0) { - Message_StartTextbox(globalCtx, sp26, &this->actor); + Message_StartTextbox(play, sp26, &this->actor); this->unk_284 = sp26; } else { - func_809C6F98(this, globalCtx); + func_809C6F98(this, play); } this->actionFunc = func_809C7990; } else { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7380(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex == 0) { + if (Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { if (!CUR_UPG_VALUE(UPG_QUIVER)) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { - Message_StartTextbox(globalCtx, 0x3F9, &this->actor); + Message_StartTextbox(play, 0x3F9, &this->actor); this->unk_284 = 0x3F9; } else { - Message_StartTextbox(globalCtx, 0x3FA, &this->actor); + Message_StartTextbox(play, 0x3FA, &this->actor); this->unk_284 = 0x3FA; } } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { - Message_StartTextbox(globalCtx, 0x3FB, &this->actor); + Message_StartTextbox(play, 0x3FB, &this->actor); this->unk_284 = 0x3FB; } else { - Message_StartTextbox(globalCtx, 0x3FC, &this->actor); + Message_StartTextbox(play, 0x3FC, &this->actor); this->unk_284 = 0x3FC; } @@ -550,10 +550,10 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { this->unk_26A = 2; if (!(this->unk_282 & 0x10)) { this->unk_282 |= 0x10; - Message_StartTextbox(globalCtx, 0x3FD, &this->actor); + Message_StartTextbox(play, 0x3FD, &this->actor); this->unk_284 = 0x3FD; } else { - Message_StartTextbox(globalCtx, 0x3FF, &this->actor); + Message_StartTextbox(play, 0x3FF, &this->actor); this->unk_284 = 0x3FF; } gSaveContext.save.weekEventReg[63] |= 1; @@ -562,10 +562,10 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { } else { func_8019F230(); if (CURRENT_DAY != 3) { - Message_StartTextbox(globalCtx, 0x3F7, &this->actor); + Message_StartTextbox(play, 0x3F7, &this->actor); this->unk_284 = 0x3F7; } else { - Message_StartTextbox(globalCtx, 0x3F8, &this->actor); + Message_StartTextbox(play, 0x3F8, &this->actor); this->unk_284 = 0x3F8; } @@ -578,41 +578,41 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7620(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { switch (this->unk_284) { case 0x3E8: case 0x3E9: case 0x3EA: case 0x3EB: - Message_StartTextbox(globalCtx, 0x3F6, &this->actor); + Message_StartTextbox(play, 0x3F6, &this->actor); this->unk_284 = 0x3F6; break; case 0x3EC: - Message_StartTextbox(globalCtx, 0x3ED, &this->actor); + Message_StartTextbox(play, 0x3ED, &this->actor); this->unk_284 = 0x3ED; break; case 0x3EE: - Message_StartTextbox(globalCtx, 0x3EF, &this->actor); + Message_StartTextbox(play, 0x3EF, &this->actor); this->unk_284 = 0x3EF; break; case 0x3F0: - Message_StartTextbox(globalCtx, 0x3F1, &this->actor); + Message_StartTextbox(play, 0x3F1, &this->actor); this->unk_284 = 0x3F1; break; case 0x3F2: - Message_StartTextbox(globalCtx, 0x3F3, &this->actor); + Message_StartTextbox(play, 0x3F3, &this->actor); this->unk_284 = 0x3F3; break; case 0x3F4: - Message_StartTextbox(globalCtx, 0x3F5, &this->actor); + Message_StartTextbox(play, 0x3F5, &this->actor); this->unk_284 = 0x3F5; break; @@ -620,15 +620,15 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { case 0x3FF: if (this->unk_26A == 4) { if (this->unk_284 == 0x3FD) { - Message_StartTextbox(globalCtx, 0x3FE, &this->actor); + Message_StartTextbox(play, 0x3FE, &this->actor); this->unk_284 = 0x3FE; } else { - Message_StartTextbox(globalCtx, 0x400, &this->actor); + Message_StartTextbox(play, 0x400, &this->actor); this->unk_284 = 0x400; } } else { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->actor.freezeTimer = 0; this->unk_26A = 7; player->stateFlags1 |= 0x20; @@ -640,12 +640,12 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { case 0x3FE: case 0x400: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->actor.freezeTimer = 0; this->unk_27E = 0; - func_80112AFC(globalCtx); - func_80123F2C(globalCtx, 0x63); + func_80112AFC(play); + func_80123F2C(play, 0x63); this->unk_26A = 1; func_801A2BB8(NA_BGM_MINI_GAME_2); this->actionFunc = func_809C8808; @@ -653,33 +653,33 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { case 0x401: if (gSaveContext.save.weekEventReg[63] & 2) { - func_801477B4(globalCtx); + func_801477B4(play); gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_26A = 0; this->actionFunc = func_809C72D8; } else { - Message_StartTextbox(globalCtx, 0x402, &this->actor); + Message_StartTextbox(play, 0x402, &this->actor); this->unk_284 = 0x402; } break; case 0x403: if (gSaveContext.save.weekEventReg[63] & 2) { - func_801477B4(globalCtx); + func_801477B4(play); gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_26A = 0; this->actionFunc = func_809C72D8; } else { - Message_StartTextbox(globalCtx, 0x404, &this->actor); + Message_StartTextbox(play, 0x404, &this->actor); this->unk_284 = 0x404; } break; case 0x402: case 0x404: - Message_StartTextbox(globalCtx, 0x3F6, &this->actor); + Message_StartTextbox(play, 0x3F6, &this->actor); this->unk_284 = 0x3F6; this->unk_26A = 4; break; @@ -687,40 +687,40 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { case 0x405: case 0x406: case 0x407: - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->actor.freezeTimer = 0; gSaveContext.minigameState = 3; this->actionFunc = func_809C7D14; - func_809C7D14(this, globalCtx); + func_809C7D14(this, play); break; } } } -void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7990(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x20) { player->stateFlags1 |= 0x20; } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 2: this->actionFunc = func_809C72D8; this->unk_26A = 0; break; case 4: - func_809C7380(this, globalCtx); + func_809C7380(this, play); break; case 5: - func_809C7620(this, globalCtx); + func_809C7620(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; player->stateFlags1 &= ~0x20; @@ -740,10 +740,10 @@ void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7A90(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (!(gSaveContext.save.weekEventReg[59] & 0x10)) { gSaveContext.save.weekEventReg[59] |= 0x10; } else if (!(gSaveContext.save.weekEventReg[32] & 2) && (this->unk_280 >= 0x884)) { @@ -753,13 +753,13 @@ void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { this->actionFunc = func_809C7C14; } else { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x10)) { - Actor_PickUp(&this->actor, globalCtx, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else if (this->unk_280 < 0x884) { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); } else if (!(gSaveContext.save.weekEventReg[32] & 2)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } player->actor.shape.rot.y = -0x8000; @@ -769,15 +769,15 @@ void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7C14(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((CURRENT_DAY == 3) && (gSaveContext.save.time > CLOCK_TIME(12, 0))) { - Message_StartTextbox(globalCtx, 0xA36, &this->actor); + Message_StartTextbox(play, 0xA36, &this->actor); this->unk_284 = 0xA36; } else { - Message_StartTextbox(globalCtx, 0xA37, &this->actor); + Message_StartTextbox(play, 0xA37, &this->actor); this->unk_284 = 0xA37; } player->stateFlags1 &= ~0x20; @@ -786,14 +786,14 @@ void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) { this->unk_26A = 0; this->actionFunc = func_809C6E30; } else { - func_800B85E0(&this->actor, globalCtx, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } -void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7D14(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { if (this->unk_284 == 0x407) { if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { gSaveContext.save.weekEventReg[59] |= 0x20; @@ -810,14 +810,14 @@ void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { } else { if (this->unk_284 == 0x407) { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x20)) { - Actor_PickUp(&this->actor, globalCtx, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } else if (!(gSaveContext.save.weekEventReg[32] & 4)) { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_HUGE, 500.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); } player->actor.shape.rot.y = -0x8000; @@ -827,11 +827,11 @@ void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7EB4(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (CURRENT_DAY != 3) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { player->stateFlags1 &= ~0x20; this->unk_280 = 0; this->unk_26A = 0; @@ -839,8 +839,8 @@ void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[63] &= (u8)~2; this->actionFunc = func_809C6810; } - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x408, &this->actor); + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x408, &this->actor); this->unk_284 = 0x408; player->stateFlags1 &= ~0x20; this->actor.flags &= ~ACTOR_FLAG_10000; @@ -848,37 +848,37 @@ void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { this->unk_26A = 0; this->actionFunc = func_809C7990; } else { - func_800B85E0(&this->actor, globalCtx, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } -void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809C7FFC(EnSyatekiMan* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_809C6720(globalCtx, D_809C9474)) { + if (func_809C6720(play, D_809C9474)) { player->stateFlags1 |= 0x20; this->unk_26A = 2; if (this->unk_282 != 2) { this->unk_282 = 2; - Message_StartTextbox(globalCtx, 0xA2B, &this->actor); + Message_StartTextbox(play, 0xA2B, &this->actor); this->unk_284 = 0xA2B; } else { - Message_StartTextbox(globalCtx, 0xA2C, &this->actor); + Message_StartTextbox(play, 0xA2C, &this->actor); this->unk_284 = 0xA2C; } this->actionFunc = func_809C6E30; } } -void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C80C0(EnSyatekiMan* this, PlayState* play) { static s16 D_809C9498 = 30; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (D_809C9498 > 0) { player->actor.world.pos = D_809C9474; player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; - globalCtx->unk_18790(globalCtx, -0x8000, &this->actor); + play->unk_18790(play, -0x8000, &this->actor); D_809C9498--; } else { D_809C9498 = 30; @@ -900,9 +900,9 @@ void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C81D0(EnSyatekiMan* this, PlayState* play) { static s16 D_809C949C = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (((this->unk_272 == 0) || (this->unk_26C > 140)) && (D_809C949C == 0) && (this->unk_27C < 4)) { D_809C949C = 1; @@ -956,7 +956,7 @@ void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx) { func_801A2C20(); this->unk_26A = 5; if (this->unk_280 == 0x848) { - func_8011B4E0(globalCtx, 2); + func_8011B4E0(play, 2); gSaveContext.unk_3DD0[1] = 6; this->actionFunc = func_809C8610; } else { @@ -966,7 +966,7 @@ void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C8488(EnSyatekiMan* this, PlayState* play) { if ((this->unk_26A == 1) || (this->unk_26A == 5)) { this->unk_190 = 0; this->unk_272 = 0; @@ -978,7 +978,7 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { } this->unk_270 = 15; if (this->unk_280 >= 0x848) { - Message_StartTextbox(globalCtx, 0xA34, &this->actor); + Message_StartTextbox(play, 0xA34, &this->actor); this->unk_284 = 0xA34; this->unk_26A = 6; } else if (this->unk_280 >= 0x7D0) { @@ -990,12 +990,12 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { this->actionFunc = func_809C6848; return; } - Message_StartTextbox(globalCtx, 0xA35, &this->actor); + Message_StartTextbox(play, 0xA35, &this->actor); this->unk_284 = 0xA35; this->unk_26A = 4; this->unk_280 = 0; } else { - Message_StartTextbox(globalCtx, 0xA32, &this->actor); + Message_StartTextbox(play, 0xA32, &this->actor); this->unk_284 = 0xA32; this->unk_26A = 6; } @@ -1006,16 +1006,16 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { } if (this->unk_270 < 5) { - globalCtx->unk_1887C = -10; + play->unk_1887C = -10; } } -void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C8610(EnSyatekiMan* this, PlayState* play) { static s32 D_809C94A0 = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; - if (globalCtx->interfaceCtx.unk_286 == 0) { + if (play->interfaceCtx.unk_286 == 0) { if (gSaveContext.unk_3DE0[1] == 0) { gSaveContext.unk_3DE0[1] = 0; gSaveContext.unk_3DD0[1] = 5; @@ -1025,7 +1025,7 @@ void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) { D_809C94A0 = 0; } else if (D_809C94A0 > 10) { gSaveContext.unk_3E88[1] += 100; - globalCtx->interfaceCtx.unk_25C += 10; + play->interfaceCtx.unk_25C += 10; this->unk_280 += 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); D_809C94A0 = 0; @@ -1035,7 +1035,7 @@ void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C8710(EnSyatekiMan* this, PlayState* play) { Vec3f sp24; if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) { @@ -1044,12 +1044,12 @@ void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) { sp24 = D_809C948C; } - if (func_809C6720(globalCtx, sp24)) { + if (func_809C6720(play, sp24)) { if (this->unk_284 == 0x3FD) { - Message_StartTextbox(globalCtx, 0x3FE, &this->actor); + Message_StartTextbox(play, 0x3FE, &this->actor); this->unk_284 = 0x3FE; } else { - Message_StartTextbox(globalCtx, 0x400, &this->actor); + Message_StartTextbox(play, 0x400, &this->actor); this->unk_284 = 0x400; } this->unk_26A = 2; @@ -1057,9 +1057,9 @@ void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C8808(EnSyatekiMan* this, PlayState* play) { static s16 D_809C94A4 = 30; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (D_809C94A4 == 30) { if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { @@ -1070,7 +1070,7 @@ void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx) { player->actor.prevPos = player->actor.world.pos; player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; - globalCtx->unk_18790(globalCtx, -0x8000, &this->actor); + play->unk_18790(play, -0x8000, &this->actor); player->stateFlags1 |= 0x20; D_809C94A4--; } else if (D_809C94A4 > 0) { @@ -1090,13 +1090,13 @@ void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx) { } } -void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C898C(EnSyatekiMan* this, PlayState* play) { static const s32 D_809C94D0[] = { 0x00000111, 0x00000650, 0x00010025, 0x00011011, 0x00000984, 0x00004050, 0x00010211, 0x00022015, 0x00026984, 0x00012852, 0x00011999, 0x00022895, 0x0000056A, 0x0002A451, 0x00004115, }; static s32 D_809C94A8 = 0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 sp30 = (((void)0, gSaveContext.unk_3DE0[1]) * 0.1f) + 1.0f; if (sp30 < 0x2EF) { @@ -1144,42 +1144,42 @@ void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) { this->actionFunc = func_809C8BF0; if (this->unk_280 == 50) { func_801A3098(NA_BGM_GET_ITEM | 0x900); - func_8011B4E0(globalCtx, 1); + func_8011B4E0(play, 1); } } } } -void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx) { +void func_809C8BF0(EnSyatekiMan* this, PlayState* play) { if (this->unk_26A == 1) { this->unk_190 = 0; - if ((this->unk_270 <= 0) && (globalCtx->interfaceCtx.unk_286 == 0)) { - Flags_SetAllTreasure(globalCtx, this->unk_280); + if ((this->unk_270 <= 0) && (play->interfaceCtx.unk_286 == 0)) { + Flags_SetAllTreasure(play, this->unk_280); this->unk_270 = 15; if (((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) || (this->unk_280 == 50)) { if ((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) { if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { - Message_StartTextbox(globalCtx, 0x407, &this->actor); + Message_StartTextbox(play, 0x407, &this->actor); this->unk_284 = 0x407; } else if (this->unk_280 == 50) { - Message_StartTextbox(globalCtx, 0x405, &this->actor); + Message_StartTextbox(play, 0x405, &this->actor); this->unk_284 = 0x405; } else { - Message_StartTextbox(globalCtx, 0x407, &this->actor); + Message_StartTextbox(play, 0x407, &this->actor); this->unk_284 = 0x407; } } else if (this->unk_280 == 50) { - Message_StartTextbox(globalCtx, 0x406, &this->actor); + Message_StartTextbox(play, 0x406, &this->actor); this->unk_284 = 0x406; } gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF0000) | (this->unk_280 & 0xFFFF); this->unk_26A = 6; } else { if (CURRENT_DAY != 3) { - Message_StartTextbox(globalCtx, 0x401, &this->actor); + Message_StartTextbox(play, 0x401, &this->actor); this->unk_284 = 0x401; } else { - Message_StartTextbox(globalCtx, 0x403, &this->actor); + Message_StartTextbox(play, 0x403, &this->actor); this->unk_284 = 0x403; } this->unk_26A = 4; @@ -1191,7 +1191,7 @@ void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx) { } if (this->unk_270 < 5) { - globalCtx->unk_1887C = -10; + play->unk_1887C = -10; } } @@ -1216,24 +1216,23 @@ void EnSyatekiMan_Blink(EnSyatekiMan* this) { this->blinkTimer++; } -void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); EnSyatekiMan_Blink(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); if (this->unk_26A != 1) { SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_258, &this->unk_25E, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_258, &this->unk_25E, this->actor.focus.pos); } } -s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiMan* this = THIS; - if ((globalCtx->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { + if ((play->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { *dList = gTownShootingGalleryManHeadDL; } @@ -1249,7 +1248,7 @@ s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnSyatekiMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSyatekiMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSyatekiMan* this = THIS; Vec3f sp18 = { 1600.0f, 0.0f, 0.0f }; @@ -1258,7 +1257,7 @@ void EnSyatekiMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } } -void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { gSwampShootingGalleryManEyeOpenTex, gSwampShootingGalleryManEyeHalfTex, @@ -1267,7 +1266,7 @@ void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) { EnSyatekiMan* this = THIS; s32 pad; - if (globalCtx->sceneNum == SCENE_SYATEKI_MIZU) { + if (play->sceneNum == SCENE_SYATEKI_MIZU) { sEyeTextures[0] = gTownShootingGalleryManEyeOpenTex; sEyeTextures[1] = gTownShootingGalleryManEyeClosedTex; sEyeTextures[2] = gTownShootingGalleryManEyeClosedTex; @@ -1277,15 +1276,15 @@ void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) { sEyeTextures[2] = gSwampShootingGalleryManEyeHalfTex; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(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, EnSyatekiMan_OverrideLimbDraw, EnSyatekiMan_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 16585ac841..c2f02c068b 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 @@ -7,7 +7,7 @@ struct EnSyatekiMan; -typedef void (*EnSyatekiManActionFunc)(struct EnSyatekiMan*, GlobalContext*); +typedef void (*EnSyatekiManActionFunc)(struct EnSyatekiMan*, PlayState*); #define ENSYATEKIMAN_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index 34afad3733..26cdf34150 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -11,21 +11,21 @@ #define THIS ((EnSyatekiOkuta*)thisx) -void EnSyatekiOkuta_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiOkuta_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiOkuta_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play); +void EnSyatekiOkuta_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play); +void EnSyatekiOkuta_Draw(Actor* thisx, PlayState* play); void func_80A36260(EnSyatekiOkuta* this); -void func_80A362A8(EnSyatekiOkuta* this, GlobalContext* globalCtx); +void func_80A362A8(EnSyatekiOkuta* this, PlayState* play); void func_80A362F8(EnSyatekiOkuta* this); -void func_80A36350(EnSyatekiOkuta* this, GlobalContext* globalCtx); -void func_80A363B4(EnSyatekiOkuta* this, GlobalContext* globalCtx); +void func_80A36350(EnSyatekiOkuta* this, PlayState* play); +void func_80A363B4(EnSyatekiOkuta* this, PlayState* play); void func_80A36444(EnSyatekiOkuta* this); -void func_80A36488(EnSyatekiOkuta* this, GlobalContext* globalCtx); +void func_80A36488(EnSyatekiOkuta* this, PlayState* play); void func_80A364C0(EnSyatekiOkuta* this); -void func_80A36504(EnSyatekiOkuta* this, GlobalContext* globalCtx); -void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx); +void func_80A36504(EnSyatekiOkuta* this, PlayState* play); +void func_80A365EC(EnSyatekiOkuta* this, PlayState* play); void func_80A36CB0(EnSyatekiOkuta* this); const ActorInit En_Syateki_Okuta_InitVars = { @@ -86,7 +86,7 @@ Color_RGBA8 D_80A37BA4 = { 255, 255, 255, 255 }; Color_RGBA8 D_80A37BA8 = { 150, 150, 150, 0 }; -void EnSyatekiOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiOkuta* this = THIS; WaterBox* waterbox; @@ -94,16 +94,16 @@ void EnSyatekiOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { s32 bgId; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(globalCtx, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable, OCTOROK_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); - this->actor.floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, - &this->actor, &this->actor.world.pos); + this->actor.floorHeight = + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!(WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &ySurface, &waterbox)) || + if (!(WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterbox)) || (ySurface <= this->actor.floorHeight)) { Actor_MarkForDeath(&this->actor); } else { @@ -115,18 +115,18 @@ void EnSyatekiOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A36260(this); } -void EnSyatekiOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiOkuta_Destroy(Actor* thisx, PlayState* play) { EnSyatekiOkuta* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A36148(Vec3f* pos, Vec3f* velocity, s16 scaleStep, GlobalContext* globalCtx) { - func_800B0DE0(globalCtx, pos, velocity, &gZeroVec3f, &D_80A37B90, &D_80A37B94, 400, scaleStep); +void func_80A36148(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) { + func_800B0DE0(play, pos, velocity, &gZeroVec3f, &D_80A37B90, &D_80A37B94, 400, scaleStep); } -void func_80A361B0(EnSyatekiOkuta* this, GlobalContext* globalCtx) { - EffectSsGSplash_Spawn(globalCtx, &this->actor.home.pos, NULL, NULL, 0, 800); +void func_80A361B0(EnSyatekiOkuta* this, PlayState* play) { + EffectSsGSplash_Spawn(play, &this->actor.home.pos, NULL, NULL, 0, 800); } s32 func_80A361F4(EnSyatekiOkuta* this) { @@ -158,8 +158,8 @@ void func_80A36260(EnSyatekiOkuta* this) { this->actionFunc = func_80A362A8; } -void func_80A362A8(EnSyatekiOkuta* this, GlobalContext* globalCtx) { - Actor* actorIt = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +void func_80A362A8(EnSyatekiOkuta* this, PlayState* play) { + Actor* actorIt = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actorIt != NULL) { if (actorIt->id == ACTOR_EN_SYATEKI_MAN) { @@ -179,7 +179,7 @@ void func_80A362F8(EnSyatekiOkuta* this) { this->actionFunc = func_80A36350; } -void func_80A36350(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A36350(EnSyatekiOkuta* this, PlayState* play) { } void func_80A36360(EnSyatekiOkuta* this) { @@ -189,12 +189,12 @@ void func_80A36360(EnSyatekiOkuta* this) { this->actionFunc = func_80A363B4; } -void func_80A363B4(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A363B4(EnSyatekiOkuta* this, PlayState* play) { if ((Animation_OnFrame(&this->skelAnime, 2.0f)) || (Animation_OnFrame(&this->skelAnime, 15.0f))) { if (func_80A361F4(this)) { return; } else { - func_80A361B0(this, globalCtx); + func_80A361B0(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } } @@ -209,7 +209,7 @@ void func_80A36444(EnSyatekiOkuta* this) { this->actionFunc = func_80A36488; } -void func_80A36488(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A36488(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->unk_26C >= 0x46) { @@ -222,9 +222,9 @@ void func_80A364C0(EnSyatekiOkuta* this) { this->actionFunc = func_80A36504; } -void func_80A36504(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A36504(EnSyatekiOkuta* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - func_80A361B0(this, globalCtx); + func_80A361B0(this, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_LAND); } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80A362F8(this); @@ -242,7 +242,7 @@ void func_80A3657C(EnSyatekiOkuta* this) { this->actionFunc = func_80A365EC; } -void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) { Vec3f sp84; Vec3f sp78; s32 pad; @@ -260,7 +260,7 @@ void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx) { sp84.x = 0.0f; sp84.y = -0.5f; sp84.z = 0.0f; - func_80A36148(&sp78, &sp84, -20, globalCtx); + func_80A36148(&sp78, &sp84, -20, play); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } @@ -268,7 +268,7 @@ void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - func_80A361B0(this, globalCtx); + func_80A361B0(this, play); } if (this->unk_2A4 < 3) { @@ -279,12 +279,12 @@ void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, (((this->unk_2A4 - 5) * 0.04f) + 0.8f) * 0.01f); } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.002f)) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_COMMON_WATER_MID); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_COMMON_WATER_MID); for (i = 0; i < 10; i++) { sp84.x = (Rand_ZeroOne() - 0.5f) * 7.0f; sp84.y = Rand_ZeroOne() * 7.0f; sp84.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &sp84, &D_80A37B98, &D_80A37BA4, + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &sp84, &D_80A37B98, &D_80A37BA4, &D_80A37BA8, Rand_S16Offset(100, 50), 25, 0); } @@ -296,7 +296,7 @@ void func_80A365EC(EnSyatekiOkuta* this, GlobalContext* globalCtx) { } } -void func_80A368E0(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A368E0(EnSyatekiOkuta* this, PlayState* play) { this->collider.dim.height = (sCylinderInit.dim.height - this->collider.dim.yShift) * this->unk_1D8.y * this->actor.scale.y * 100.0f; this->collider.dim.radius = sCylinderInit.dim.radius * this->actor.scale.x * 100.0f; @@ -320,10 +320,10 @@ void func_80A368E0(EnSyatekiOkuta* this, GlobalContext* globalCtx) { // jointTable->y is the y-translation of the skeleton root this->collider.dim.pos.y = this->actor.world.pos.y + (this->skelAnime.jointTable->y * this->actor.scale.y); this->collider.dim.pos.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80A36A90(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +s32 func_80A36A90(EnSyatekiOkuta* this, PlayState* play) { if ((this->actionFunc == func_80A365EC) || (this->actionFunc == func_80A36350)) { return false; } @@ -333,11 +333,11 @@ s32 func_80A36A90(EnSyatekiOkuta* this, GlobalContext* globalCtx) { return true; } - func_80A368E0(this, globalCtx); + func_80A368E0(this, play); return false; } -void func_80A36AF8(EnSyatekiOkuta* this, GlobalContext* globalCtx) { +void func_80A36AF8(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; s16 temp_v1_2; @@ -352,24 +352,24 @@ void func_80A36AF8(EnSyatekiOkuta* this, GlobalContext* globalCtx) { } } -void EnSyatekiOkuta_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiOkuta* this = THIS; EnSyatekiMan* syatekiMan; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_80A36350) { SkelAnime_Update(&this->skelAnime); } - func_80A36AF8(this, globalCtx); + func_80A36AF8(this, play); - if (func_80A36A90(this, globalCtx)) { + if (func_80A36A90(this, play)) { syatekiMan = (EnSyatekiMan*)this->actor.parent; if (this->unk_2A6 == 1) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - globalCtx->interfaceCtx.unk_25C++; + play->interfaceCtx.unk_25C++; syatekiMan->unk_280++; syatekiMan->unk_26E = 1; } else { @@ -462,8 +462,7 @@ s32 func_80A370EC(EnSyatekiOkuta* this, f32 arg1, Vec3f* arg2) { return true; } -s32 EnSyatekiOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSyatekiOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; Vec3f sp20; f32 curFrame; @@ -484,21 +483,21 @@ s32 EnSyatekiOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx return false; } -void EnSyatekiOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiOkuta_Draw(Actor* thisx, PlayState* play) { EnSyatekiOkuta* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_2A6 == 1) { gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); } else { gSPSegment(POLY_OPA_DISP++, 0x08, gShootingGalleryOctorokBlueMaterialDL); } - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiOkuta_OverrideLimbDraw, - NULL, &this->actor); - func_8012C2DC(globalCtx->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiOkuta_OverrideLimbDraw, NULL, + &this->actor); + func_8012C2DC(play->state.gfxCtx); if (this->actionFunc == func_80A365EC) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z + 20.0f, MTXMODE_NEW); @@ -509,7 +508,7 @@ void EnSyatekiOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 210, 64, 32, this->unk_2AA); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_2A6 == 2) { gSPDisplayList(POLY_XLU_DISP++, gShootingGalleryOctorokCrossDL); @@ -518,5 +517,5 @@ void EnSyatekiOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h index 17fafe94d6..a455765cd7 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.h @@ -8,7 +8,7 @@ struct EnSyatekiOkuta; -typedef void (*EnSyatekiOkutaActionFunc)(struct EnSyatekiOkuta*, GlobalContext*); +typedef void (*EnSyatekiOkutaActionFunc)(struct EnSyatekiOkuta*, PlayState*); typedef struct EnSyatekiOkuta { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 0a0b3f66ce..56abe88148 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -11,24 +11,24 @@ #define THIS ((EnSyatekiWf*)thisx) -void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiWf_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx); -void EnSyatekiWf_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnSyatekiWf_Init(Actor* thisx, PlayState* play); +void EnSyatekiWf_Destroy(Actor* thisx, PlayState* play); +void EnSyatekiWf_Update(Actor* thisx, PlayState* play); +void EnSyatekiWf_Draw(Actor* thisx, PlayState* play); void func_80A201CC(EnSyatekiWf* this); -void func_80A20284(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20284(EnSyatekiWf* this, PlayState* play); void func_80A2030C(EnSyatekiWf* this); -void func_80A20320(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20320(EnSyatekiWf* this, PlayState* play); void func_80A20378(EnSyatekiWf* this); -void func_80A203DC(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A203DC(EnSyatekiWf* this, PlayState* play); void func_80A20670(EnSyatekiWf* this); -void func_80A206DC(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A206DC(EnSyatekiWf* this, PlayState* play); void func_80A20710(EnSyatekiWf* this); -void func_80A2075C(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A2075C(EnSyatekiWf* this, PlayState* play); void func_80A2079C(EnSyatekiWf* this); -void func_80A20800(EnSyatekiWf* this, GlobalContext* globalCtx); -void func_80A208F8(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20800(EnSyatekiWf* this, PlayState* play); +void func_80A208F8(EnSyatekiWf* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[1] = { { @@ -139,7 +139,7 @@ static TexturePtr sEyeTextures[] = { gWolfosNormalEyeHalfTex, }; -void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiWf* this = THIS; Path* path; @@ -148,11 +148,11 @@ void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx) { path = syatekiMan->path; while (path->unk2 != 2) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } for (i = 0; i < EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor); i++) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } if (path == NULL) { @@ -175,15 +175,15 @@ void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx) { this->eyeIndex = 0; this->unk_2AC = 10.0f; - Collider_InitCylinder(globalCtx, &this->unk_2B4); - Collider_SetCylinder(globalCtx, &this->unk_2B4, &this->actor, &sCylinderInit1); - Collider_InitCylinder(globalCtx, &this->unk_300); - Collider_SetCylinder(globalCtx, &this->unk_300, &this->actor, &sCylinderInit2); - Collider_InitJntSph(globalCtx, &this->unk_34C); - Collider_SetJntSph(globalCtx, &this->unk_34C, &this->actor, &sJntSphInit, this->unk_36C); + Collider_InitCylinder(play, &this->unk_2B4); + Collider_SetCylinder(play, &this->unk_2B4, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->unk_300); + Collider_SetCylinder(play, &this->unk_300, &this->actor, &sCylinderInit2); + Collider_InitJntSph(play, &this->unk_34C); + Collider_SetJntSph(play, &this->unk_34C, &this->actor, &sJntSphInit, this->unk_36C); this->unk_34C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_NORMAL_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); this->actor.hintId = 0x4C; @@ -191,11 +191,11 @@ void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A201CC(this); } -void EnSyatekiWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiWf_Destroy(Actor* thisx, PlayState* play) { EnSyatekiWf* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->unk_2B4); - Collider_DestroyCylinder(globalCtx, &this->unk_300); + Collider_DestroyCylinder(play, &this->unk_2B4); + Collider_DestroyCylinder(play, &this->unk_300); } void func_80A200E0(EnSyatekiWf* this) { @@ -228,7 +228,7 @@ void func_80A201CC(EnSyatekiWf* this) { this->actionFunc = func_80A20284; } -void func_80A20284(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A20284(EnSyatekiWf* this, PlayState* play) { EnSyatekiMan* syatekiMan; if (this->actor.parent != NULL) { @@ -246,7 +246,7 @@ void func_80A2030C(EnSyatekiWf* this) { this->actionFunc = func_80A20320; } -void func_80A20320(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A20320(EnSyatekiWf* this, PlayState* play) { if (this->unk_29C >= 11) { Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_WOLFOS_APPEAR); this->unk_29C = 0; @@ -264,7 +264,7 @@ void func_80A20378(EnSyatekiWf* this) { this->actionFunc = func_80A203DC; } -void func_80A203DC(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A203DC(EnSyatekiWf* this, PlayState* play) { Vec3f sp54; f32 sp50; s16 temp_v0; @@ -319,7 +319,7 @@ void func_80A203DC(EnSyatekiWf* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 10.0f, 3, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 10.0f, 3, 2.0f, 0, 0, 0); } } } @@ -332,7 +332,7 @@ void func_80A20670(EnSyatekiWf* this) { this->actionFunc = func_80A206DC; } -void func_80A206DC(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A206DC(EnSyatekiWf* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { func_80A20710(this); } @@ -344,7 +344,7 @@ void func_80A20710(EnSyatekiWf* this) { this->actionFunc = func_80A2075C; } -void func_80A2075C(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A2075C(EnSyatekiWf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80A20378(this); } @@ -358,7 +358,7 @@ void func_80A2079C(EnSyatekiWf* this) { this->actionFunc = func_80A20800; } -void func_80A20800(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A20800(EnSyatekiWf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_29A--; if (this->unk_29A == 0) { @@ -367,19 +367,19 @@ void func_80A20800(EnSyatekiWf* this, GlobalContext* globalCtx) { } } -void func_80A20858(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A20858(EnSyatekiWf* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; this->unk_298 = 0; this->actor.speedXZ = 0.0f; - EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); syatekiMan->unk_280 += 100; this->actionFunc = func_80A208F8; } -void func_80A208F8(EnSyatekiWf* this, GlobalContext* globalCtx) { +void func_80A208F8(EnSyatekiWf* this, PlayState* play) { s32 pad; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -393,13 +393,13 @@ void func_80A208F8(EnSyatekiWf* this, GlobalContext* globalCtx) { sp68.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; sp68.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; sp68.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); - func_800B3030(globalCtx, &sp68, &sp5C, &sp5C, 0x64, 0, 2); + func_800B3030(play, &sp68, &sp5C, &sp5C, 0x64, 0, 2); } } } -void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnSyatekiWf* this = THIS; if (this->actionFunc != func_80A20284) { @@ -407,8 +407,8 @@ void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx2) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 60.0f, 5); - this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 5); + this->actionFunc(this, play); if (this->actor.bgCheckFlags & 3) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); @@ -425,24 +425,24 @@ void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.colChkInfo.health -= 2; if (this->actor.colChkInfo.health == 0) { func_801A3098(NA_BGM_GET_ITEM | 0x900); - func_80A20858(this, globalCtx); + func_80A20858(this, play); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); - EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 3, 0); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 3, 0); } } Collider_UpdateCylinder(&this->actor, &this->unk_2B4); if ((this->actionFunc != func_80A20284) && (this->actionFunc != func_80A208F8) && (this->actor.draw != NULL)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_300.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_2B4.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_34C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_300.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_2B4.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_34C.base); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; } if (this->eyeIndex == 0) { - if ((Rand_ZeroOne() < 0.2f) && ((globalCtx->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { + if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { this->eyeIndex++; } } else { @@ -450,12 +450,11 @@ void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnSyatekiWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnSyatekiWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void EnSyatekiWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSyatekiWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSyatekiWf* this = THIS; Vec3f sp18; @@ -468,15 +467,15 @@ void EnSyatekiWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnSyatekiWf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnSyatekiWf_Draw(Actor* thisx, PlayState* play) { EnSyatekiWf* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(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, EnSyatekiWf_OverrideLimbDraw, EnSyatekiWf_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index a43c76f778..1af2d0b962 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -9,7 +9,7 @@ struct EnSyatekiWf; -typedef void (*EnSyatekiWfActionFunc)(struct EnSyatekiWf*, GlobalContext*); +typedef void (*EnSyatekiWfActionFunc)(struct EnSyatekiWf*, PlayState*); typedef struct EnSyatekiWf { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 5745da0fd1..f79639543d 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -12,13 +12,13 @@ #define THIS ((EnTab*)thisx) -void EnTab_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTab_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTab_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTab_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTab_Init(Actor* thisx, PlayState* play); +void EnTab_Destroy(Actor* thisx, PlayState* play); +void EnTab_Update(Actor* thisx, PlayState* play); +void EnTab_Draw(Actor* thisx, PlayState* play); -void func_80BE127C(EnTab* this, GlobalContext* globalCtx); -void func_80BE1348(EnTab* this, GlobalContext* globalCtx); +void func_80BE127C(EnTab* this, PlayState* play); +void func_80BE1348(EnTab* this, PlayState* play); static u8 D_80BE18D0[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(3, 0x24 - 0x04), @@ -122,12 +122,12 @@ TexturePtr D_80BE1B24[] = { object_tab_Tex_006928, }; -EnGm* func_80BE04E0(EnTab* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { +EnGm* func_80BE04E0(EnTab* this, PlayState* play, u8 actorCat, s16 actorId) { Actor* foundActor = NULL; Actor* tempActor; while (true) { - foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); + foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); if ((foundActor == NULL) || (((EnTab*)foundActor != this) && (foundActor->update != NULL))) { break; } @@ -164,11 +164,11 @@ s32 func_80BE05BC(EnTab* this, s32 arg1) { return ret; } -void func_80BE0620(EnTab* this, GlobalContext* globalCtx) { +void func_80BE0620(EnTab* this, PlayState* play) { s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80BE0664(EnTab* this) { @@ -181,16 +181,16 @@ void func_80BE0664(EnTab* this) { } } -s32 func_80BE06DC(EnTab* this, GlobalContext* globalCtx) { +s32 func_80BE06DC(EnTab* this, PlayState* play) { s32 ret = false; if (this->unk_2FC & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { SubS_UpdateFlags(&this->unk_2FC, 0, 7); ret = true; this->unk_320 = 0; this->unk_328 = NULL; - this->actor.child = &GET_PLAYER(globalCtx)->actor; + this->actor.child = &GET_PLAYER(play)->actor; this->unk_2FC |= 8; this->actionFunc = func_80BE1348; } @@ -198,13 +198,13 @@ s32 func_80BE06DC(EnTab* this, GlobalContext* globalCtx) { return ret; } -Actor* func_80BE0778(EnTab* this, GlobalContext* globalCtx) { +Actor* func_80BE0778(EnTab* this, PlayState* play) { Actor* actor; if (this->unk_1D8 == 1) { actor = this->actor.child; } else { - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; } return actor; } @@ -239,8 +239,8 @@ void func_80BE07A0(EnTab* this) { this->unk_316 = CLAMP(this->unk_316, -0xE38, 0xE38); } -void func_80BE09A8(EnTab* this, GlobalContext* globalCtx) { - this->unk_1E0 = func_80BE0778(this, globalCtx); +void func_80BE09A8(EnTab* this, PlayState* play) { + this->unk_1E0 = func_80BE0778(this, play); if ((this->unk_2FC & 8) && (this->unk_1E0 != 0) && (DECR(this->unk_324) == 0)) { func_80BE07A0(this); this->unk_316 = 0; @@ -259,9 +259,9 @@ void func_80BE09A8(EnTab* this, GlobalContext* globalCtx) { } } -void func_80BE0A98(EnTab* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - s32 sp20 = Message_GetState(&globalCtx->msgCtx); +void func_80BE0A98(EnTab* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp20 = Message_GetState(&play->msgCtx); this->unk_308 += (this->unk_304 != 0.0f) ? 40.0f : -40.0f; this->unk_308 = CLAMP(this->unk_308, 0.0f, 80.0f); @@ -269,9 +269,9 @@ void func_80BE0A98(EnTab* this, GlobalContext* globalCtx) { Matrix_Translate(this->unk_308, 0.0f, 0.0f, MTXMODE_APPLY); if ((&this->actor == player->targetActor) && - ((globalCtx->msgCtx.currentTextId < 0xFF) || (globalCtx->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && + ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && (this->unk_334 == 3)) { - if ((globalCtx->state.frames % 2) == 0) { + if ((play->state.frames % 2) == 0) { if (this->unk_304 != 0.0f) { this->unk_304 = 0.0f; } else { @@ -313,27 +313,27 @@ s32 func_80BE0C04(EnTab* this, Actor* actor, f32 arg2) { return ret; } -s32 func_80BE0D38(EnTab* this, GlobalContext* globalCtx) { +s32 func_80BE0D38(EnTab* this, PlayState* play) { return Interface_HasEmptyBottle(); } -s32 func_80BE0D60(EnTab* this, GlobalContext* globalCtx) { +s32 func_80BE0D60(EnTab* this, PlayState* play) { s32 pad; s32 ret = false; this->unk_320++; if (this->unk_320 == 1) { - globalCtx->setPlayerTalkAnim(globalCtx, &gameplay_keep_Linkanim_00D568, 2); + play->setPlayerTalkAnim(play, &gameplay_keep_Linkanim_00D568, 2); } else if (this->unk_320 > 20) { - globalCtx->setPlayerTalkAnim(globalCtx, NULL, 0); + play->setPlayerTalkAnim(play, NULL, 0); this->unk_320 = 0; ret = true; } return ret; } -s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32* func_80BE0E04(EnTab* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_DEKU) { return D_80BE1984; @@ -342,7 +342,7 @@ s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { switch (this->unk_1D8) { case 2: this->unk_328 = func_80BE0D38; - if (Player_GetMask(globalCtx) != PLAYER_MASK_ROMANI) { + if (Player_GetMask(play) != PLAYER_MASK_ROMANI) { return D_80BE1998; } @@ -353,11 +353,11 @@ s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { case 1: this->unk_328 = func_80BE0D60; - if (Player_GetMask(globalCtx) == PLAYER_MASK_ROMANI) { + if (Player_GetMask(play) == PLAYER_MASK_ROMANI) { return D_80BE1940; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + if (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { return D_80BE1970; } return D_80BE1914; @@ -366,9 +366,9 @@ s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { return NULL; } -s32 func_80BE0F04(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; - EnGm* sp28 = func_80BE04E0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_GM); + EnGm* sp28 = func_80BE04E0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); if (sp28) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1AF0); @@ -385,7 +385,7 @@ s32 func_80BE0F04(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BE0FC4(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleResult* arg2) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1B04); @@ -399,18 +399,18 @@ s32 func_80BE0FC4(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -s32 func_80BE1060(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80BE1060(EnTab* this, PlayState* play, ScheduleResult* arg2) { s32 ret; this->unk_2FC = 0; switch (arg2->result) { case 1: - ret = func_80BE0F04(this, globalCtx, arg2); + ret = func_80BE0F04(this, play, arg2); break; case 2: - ret = func_80BE0FC4(this, globalCtx, arg2); + ret = func_80BE0FC4(this, play, arg2); break; default: @@ -420,16 +420,16 @@ s32 func_80BE1060(EnTab* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return ret; } -s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { +s32 func_80BE10BC(EnTab* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 dist; Actor* tempActor; switch (this->unk_1D8) { case 1: - if ((player->stateFlags1 & 0x40) && !(globalCtx->msgCtx.currentTextId <= 0x2B00) && - (globalCtx->msgCtx.currentTextId < 0x2B08)) { + if ((player->stateFlags1 & 0x40) && !(play->msgCtx.currentTextId <= 0x2B00) && + (play->msgCtx.currentTextId < 0x2B08)) { this->actor.child = &this->unk_1E4->actor; this->unk_2FC |= 8; } else { @@ -437,7 +437,7 @@ s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { if ((gSaveContext.save.weekEventReg[75] & 1) || (this->unk_1E4->actor.draw == NULL) || !(dist < 160.0f)) { - tempActor = &GET_PLAYER(globalCtx)->actor; + tempActor = &GET_PLAYER(play)->actor; this->actor.child = tempActor; } else { tempActor = &this->unk_1E4->actor; @@ -453,7 +453,7 @@ s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { break; case 2: - if (func_80BE0C04(this, &GET_PLAYER(globalCtx)->actor, 200.0f)) { + if (func_80BE0C04(this, &GET_PLAYER(play)->actor, 200.0f)) { this->unk_2FC |= 8; } else { this->unk_2FC &= ~8; @@ -464,20 +464,20 @@ s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { return false; } -void func_80BE1224(EnTab* this, GlobalContext* globalCtx) { +void func_80BE1224(EnTab* this, PlayState* play) { if ((this->unk_1D8 == 1) || (this->unk_1D8 == 2)) { - func_80BE10BC(this, globalCtx); + func_80BE10BC(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } -void func_80BE127C(EnTab* this, GlobalContext* globalCtx) { +void func_80BE127C(EnTab* this, PlayState* play) { ScheduleResult sp18; this->unk_31A = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(globalCtx, D_80BE18D0, &sp18) || - ((this->unk_1D8 != sp18.result) && !func_80BE1060(this, globalCtx, &sp18))) { + if (!Schedule_RunScript(play, D_80BE18D0, &sp18) || + ((this->unk_1D8 != sp18.result) && !func_80BE1060(this, play, &sp18))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; sp18.result = 0; @@ -486,15 +486,15 @@ void func_80BE127C(EnTab* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_1; } this->unk_1D8 = sp18.result; - func_80BE1224(this, globalCtx); + func_80BE1224(this, play); } -void func_80BE1348(EnTab* this, GlobalContext* globalCtx) { +void func_80BE1348(EnTab* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; - if (func_8010BF58(&this->actor, globalCtx, func_80BE0E04(this, globalCtx), this->unk_328, &this->unk_1DC)) { + if (func_8010BF58(&this->actor, play, func_80BE0E04(this, play), this->unk_328, &this->unk_1DC)) { SubS_UpdateFlags(&this->unk_2FC, 3, 7); this->unk_2FC &= ~8; this->unk_2FC |= 0x40; @@ -508,15 +508,14 @@ void func_80BE1348(EnTab* this, GlobalContext* globalCtx) { } } -void EnTab_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTab_Init(Actor* thisx, PlayState* play) { EnTab* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tab_Skel_007F78, NULL, this->jointTable, this->morphTable, - 20); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tab_Skel_007F78, NULL, this->jointTable, this->morphTable, 20); this->unk_32C = -1; func_80BE05BC(this, 0); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); @@ -527,44 +526,44 @@ void EnTab_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; this->actionFunc = func_80BE127C; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnTab_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTab_Destroy(Actor* thisx, PlayState* play) { EnTab* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTab_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTab_Update(Actor* thisx, PlayState* play) { EnTab* this = THIS; f32 radius; f32 height; - func_80BE06DC(this, globalCtx); + func_80BE06DC(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1D8 != 0) { func_80BE0590(this); func_80BE0664(this); - func_80BE09A8(this, globalCtx); + func_80BE09A8(this, play); radius = this->collider.dim.radius + this->unk_30C; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_2FC & 7); + func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_2FC & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); - func_80BE0620(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + func_80BE0620(this, play); } } -s32 EnTab_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnTab_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTab* this = THIS; if (limbIndex == 9) { - func_80BE0A98(this, globalCtx); + func_80BE0A98(this, play); } if ((this->unk_32C == 1) && (limbIndex == 18)) { @@ -573,7 +572,7 @@ s32 EnTab_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTab_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTab_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTab* this = THIS; if (limbIndex == 9) { @@ -582,7 +581,7 @@ void EnTab_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnTab_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTab_TransformDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnTab* this = THIS; s32 rotStep; s32 overrideStep; @@ -613,20 +612,20 @@ void EnTab_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) } } -void EnTab_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTab_Draw(Actor* thisx, PlayState* play) { EnTab* this = THIS; if (this->unk_1D8 != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BE1B24[this->unk_31E])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTab_OverrideLimbDraw, EnTab_PostLimbDraw, EnTab_TransformDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.h b/src/overlays/actors/ovl_En_Tab/z_en_tab.h index 266949fe8e..3e06c0b2af 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.h +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.h @@ -6,8 +6,8 @@ struct EnTab; -typedef void (*EnTabActionFunc)(struct EnTab*, GlobalContext*); -typedef s32 (*EnTabUnkFunc)(struct EnTab*, GlobalContext*); +typedef void (*EnTabActionFunc)(struct EnTab*, PlayState*); +typedef s32 (*EnTabUnkFunc)(struct EnTab*, PlayState*); typedef struct EnTab { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c index 5504dabdb7..3b94c70cf2 100644 --- a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c +++ b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c @@ -10,9 +10,9 @@ #define THIS ((EnTagObj*)thisx) -void EnTagObj_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTagObj_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTagObj_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTagObj_Init(Actor* thisx, PlayState* play); +void EnTagObj_Destroy(Actor* thisx, PlayState* play); +void EnTagObj_Update(Actor* thisx, PlayState* play); static ColliderCylinderInit sUnusedColliderInit = { { @@ -46,20 +46,20 @@ const ActorInit En_Tag_Obj_InitVars = { (ActorFunc)NULL, }; -void EnTagObj_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTagObj_Init(Actor* thisx, PlayState* play) { EnTagObj* this = THIS; this->hasSpawnedSeahorse = 0; } -void EnTagObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTagObj_Destroy(Actor* thisx, PlayState* play) { } -void EnTagObj_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTagObj_Update(Actor* thisx, PlayState* play) { EnTagObj* this = THIS; if (!this->hasSpawnedSeahorse) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OT, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); this->hasSpawnedSeahorse = 1; } diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c index 35dc1ba303..726d97227f 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c @@ -10,10 +10,10 @@ #define THIS ((EnTakaraya*)thisx) -void EnTakaraya_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraya_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraya_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTakaraya_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTakaraya_Init(Actor* thisx, PlayState* play); +void EnTakaraya_Destroy(Actor* thisx, PlayState* play); +void EnTakaraya_Update(Actor* thisx, PlayState* play); +void EnTakaraya_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Takaraya_InitVars = { diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h index f1da0e6c6d..f81e7d6979 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h @@ -5,7 +5,7 @@ struct EnTakaraya; -typedef void (*EnTakarayaActionFunc)(struct EnTakaraya*, GlobalContext*); +typedef void (*EnTakarayaActionFunc)(struct EnTakaraya*, PlayState*); typedef struct EnTakaraya { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Talk/z_en_talk.c b/src/overlays/actors/ovl_En_Talk/z_en_talk.c index 4cf4ca407b..c5b25233d7 100644 --- a/src/overlays/actors/ovl_En_Talk/z_en_talk.c +++ b/src/overlays/actors/ovl_En_Talk/z_en_talk.c @@ -10,11 +10,11 @@ #define THIS ((EnTalk*)thisx) -void EnTalk_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTalk_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTalk_Update(Actor* thisx, GlobalContext* globalCtx); -void func_80BDE058(EnTalk* this, GlobalContext* globalCtx); -void func_80BDE090(EnTalk* this, GlobalContext* globalCtx); +void EnTalk_Init(Actor* thisx, PlayState* play); +void EnTalk_Destroy(Actor* thisx, PlayState* play); +void EnTalk_Update(Actor* thisx, PlayState* play); +void func_80BDE058(EnTalk* this, PlayState* play); +void func_80BDE090(EnTalk* this, PlayState* play); const ActorInit En_Talk_InitVars = { ACTOR_EN_TALK, @@ -28,7 +28,7 @@ const ActorInit En_Talk_InitVars = { (ActorFunc)NULL, }; -void EnTalk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTalk_Init(Actor* thisx, PlayState* play) { EnTalk* this = THIS; s8 targetMode = this->actor.home.rot.x - 0x1; @@ -41,29 +41,29 @@ void EnTalk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = ENTALK_GET_TEXT_ID(&this->actor); } -void EnTalk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTalk_Destroy(Actor* thisx, PlayState* play) { } -void func_80BDE058(EnTalk* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80BDE058(EnTalk* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80BDE090; } } -void func_80BDE090(EnTalk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BDE090(EnTalk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BDE058; return; } - if ((this->actor.xzDistToPlayer < 40.0f && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) || + if ((this->actor.xzDistToPlayer < 40.0f && Player_IsFacingActor(&this->actor, 0x3000, play)) || this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void EnTalk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTalk_Update(Actor* thisx, PlayState* play) { EnTalk* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Talk/z_en_talk.h b/src/overlays/actors/ovl_En_Talk/z_en_talk.h index 629a5c0e27..38ac58764f 100644 --- a/src/overlays/actors/ovl_En_Talk/z_en_talk.h +++ b/src/overlays/actors/ovl_En_Talk/z_en_talk.h @@ -7,7 +7,7 @@ struct EnTalk; -typedef void (*EnTalkActionFunc)(struct EnTalk*, GlobalContext*); +typedef void (*EnTalkActionFunc)(struct EnTalk*, PlayState*); typedef struct EnTalk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 9b78916c4b..cc258c6647 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -10,42 +10,42 @@ #define THIS ((EnTalkGibud*)thisx) -void EnTalkGibud_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTalkGibud_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTalkGibud_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTalkGibud_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTalkGibud_Init(Actor* thisx, PlayState* play); +void EnTalkGibud_Destroy(Actor* thisx, PlayState* play); +void EnTalkGibud_Update(Actor* thisx, PlayState* play); +void EnTalkGibud_Draw(Actor* thisx, PlayState* play); void EnTalkGibud_SetupIdle(EnTalkGibud* this); -void EnTalkGibud_Idle(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Idle(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupAttemptPlayerFreeze(EnTalkGibud* this); -void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupWalkToPlayer(EnTalkGibud* this); -void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupGrab(EnTalkGibud* this); -void EnTalkGibud_Grab(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupGrabFail(EnTalkGibud* this); -void EnTalkGibud_GrabFail(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_GrabFail(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupTurnAwayAndShakeHead(EnTalkGibud* this); -void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupWalkToHome(EnTalkGibud* this); -void EnTalkGibud_WalkToHome(EnTalkGibud* this, GlobalContext* globalCtx); -void EnTalkGibud_Stunned(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play); +void EnTalkGibud_Stunned(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupDamage(EnTalkGibud* this); -void EnTalkGibud_Damage(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupDead(EnTalkGibud* this); -void EnTalkGibud_Dead(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Dead(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupRevive(EnTalkGibud* this); -void EnTalkGibud_Revive(EnTalkGibud* this, GlobalContext* globalCtx); -void EnTalkGibud_PassiveIdle(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Revive(EnTalkGibud* this, PlayState* play); +void EnTalkGibud_PassiveIdle(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupTalk(EnTalkGibud* this); -void EnTalkGibud_Talk(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play); void EnTalkGibud_SetupDisappear(EnTalkGibud* this); -void EnTalkGibud_Disappear(EnTalkGibud* this, GlobalContext* globalCtx); -void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, GlobalContext* globalCtx); -s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, GlobalContext* globalCtx); -s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, GlobalContext* globalCtx); -void EnTalkGibud_TurnTowardsPlayer(EnTalkGibud* this, GlobalContext* globalCtx); -s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, GlobalContext* globalCtx); +void EnTalkGibud_Disappear(EnTalkGibud* this, PlayState* play); +void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, PlayState* play); +s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, PlayState* play); +s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, PlayState* play); +void EnTalkGibud_TurnTowardsPlayer(EnTalkGibud* this, PlayState* play); +s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, PlayState* play); typedef struct { /* 0x0 */ s32 itemActionParam; @@ -221,7 +221,7 @@ static Vec3f sVelocity = { 0.0f, 0.0f, 0.0f }; static Vec3f sAccel = { 0.0f, 0.600000023842f, 0.0f }; -void EnTalkGibud_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTalkGibud_Init(Actor* thisx, PlayState* play) { s32 pad; EnTalkGibud* this = THIS; s32 i; @@ -232,10 +232,10 @@ void EnTalkGibud_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.textId = 0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, - this->morphTable, GIBDO_LIMB_MAX); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGibdoSkel, &gGibdoRedeadIdleAnim, this->jointTable, this->morphTable, + GIBDO_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->playerStunWaitTimer = 0; @@ -267,17 +267,17 @@ void EnTalkGibud_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } - if (this->switchFlag != -1 && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (this->switchFlag != -1 && Flags_GetSwitch(play, this->switchFlag)) { Actor_MarkForDeath(&this->actor); } EnTalkGibud_SetupIdle(this); } -void EnTalkGibud_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTalkGibud_Destroy(Actor* thisx, PlayState* play) { EnTalkGibud* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void EnTalkGibud_SetupIdle(EnTalkGibud* this) { @@ -289,8 +289,8 @@ void EnTalkGibud_SetupIdle(EnTalkGibud* this) { * This is the idle for when the player is not wearing the Gibdo Mask. The * Gibdo will attack the player if they get too close. */ -void EnTalkGibud_Idle(EnTalkGibud* this, GlobalContext* globalCtx) { - if (this->actor.xzDistToPlayer <= 150.0f && func_800B715C(globalCtx)) { +void EnTalkGibud_Idle(EnTalkGibud* this, PlayState* play) { + if (this->actor.xzDistToPlayer <= 150.0f && func_800B715C(play)) { EnTalkGibud_SetupAttemptPlayerFreeze(this); } @@ -303,20 +303,20 @@ void EnTalkGibud_SetupAttemptPlayerFreeze(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_AttemptPlayerFreeze; } -void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 rot = this->actor.shape.rot.y + this->headRotation.y + this->upperBodyRotation.y; s16 yaw = BINANG_SUB(this->actor.yawTowardsPlayer, rot); if (ABS_ALT(yaw) < 0x2008) { player->actor.freezeTimer = 60; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); EnTalkGibud_SetupWalkToPlayer(this); } - EnTalkGibud_TurnTowardsPlayer(this, globalCtx); + EnTalkGibud_TurnTowardsPlayer(this, play); } void EnTalkGibud_SetupWalkToPlayer(EnTalkGibud* this) { @@ -332,8 +332,8 @@ void EnTalkGibud_SetupWalkToPlayer(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_WalkToPlayer; } -void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xFA); @@ -341,14 +341,14 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 0x64, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 0x64, 0); - if (EnTalkGibud_PlayerInRangeWithCorrectState(this, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { + if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; if (gSaveContext.save.playerForm == PLAYER_FORM_GORON || gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnTalkGibud_SetupGrabFail(this); - } else if (globalCtx->grabPlayer(globalCtx, player)) { + } else if (play->grabPlayer(play, player)) { EnTalkGibud_SetupGrab(this); } } else { @@ -356,7 +356,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { player->actor.freezeTimer = 40; this->playerStunWaitTimer = 60; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); - func_80123E90(globalCtx, &this->actor); + func_80123E90(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); } else { this->playerStunWaitTimer--; @@ -364,7 +364,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { } } else if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { EnTalkGibud_SetupWalkToHome(this); - } else if (EnTalkGibud_PlayerOutOfRange(this, globalCtx)) { + } else if (EnTalkGibud_PlayerOutOfRange(this, play)) { EnTalkGibud_SetupWalkToHome(this); } @@ -374,7 +374,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); - } else if (!(globalCtx->gameplayFrames & 95)) { + } else if (!(play->gameplayFrames & 95)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -387,15 +387,15 @@ void EnTalkGibud_SetupGrab(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Grab; } -void EnTalkGibud_Grab(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player2 = GET_PLAYER(globalCtx); +void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { + Player* player2 = GET_PLAYER(play); Player* player = player2; s32 inPositionToAttack; u16 damageSfxId; switch (this->grabState) { case EN_TALK_GIBUD_GRAB_START: - inPositionToAttack = EnTalkGibud_MoveToIdealGrabPositionAndRotation(this, globalCtx); + inPositionToAttack = EnTalkGibud_MoveToIdealGrabPositionAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (inPositionToAttack == true)) { this->grabState = EN_TALK_GIBUD_GRAB_ATTACK; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_GRAB_ATTACK); @@ -407,7 +407,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, GlobalContext* globalCtx) { s16 requiredScopeTemp; damageSfxId = player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S; - globalCtx->damagePlayer(globalCtx, -8); + play->damagePlayer(play, -8); func_800B8E58(player, damageSfxId); func_8013ECE0(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 0; @@ -451,7 +451,7 @@ void EnTalkGibud_SetupGrabFail(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_GrabFail; } -void EnTalkGibud_GrabFail(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_GrabFail(EnTalkGibud* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -471,7 +471,7 @@ void EnTalkGibud_SetupTurnAwayAndShakeHead(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_TurnAwayAndShakeHead; } -void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 5, 3500, 200); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->headShakeTimer > 60) { @@ -490,7 +490,7 @@ void EnTalkGibud_SetupWalkToHome(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_WalkToHome; } -void EnTalkGibud_WalkToHome(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { @@ -509,7 +509,7 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 450); this->actor.world.rot = this->actor.shape.rot; } - if (EnTalkGibud_PlayerInRangeWithCorrectState(this, globalCtx)) { + if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play)) { if (gSaveContext.save.playerForm != PLAYER_FORM_GORON && gSaveContext.save.playerForm != PLAYER_FORM_DEKU && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnTalkGibud_SetupWalkToPlayer(this); @@ -531,7 +531,7 @@ void EnTalkGibud_SetupStunned(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Stunned; } -void EnTalkGibud_Stunned(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_Stunned(EnTalkGibud* this, PlayState* play) { if (this->actor.colorFilterTimer == 0) { if (this->actor.colChkInfo.health == 0) { EnTalkGibud_SetupDead(this); @@ -555,7 +555,7 @@ void EnTalkGibud_SetupDamage(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Damage; } -void EnTalkGibud_Damage(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; } @@ -568,12 +568,12 @@ void EnTalkGibud_Damage(EnTalkGibud* this, GlobalContext* globalCtx) { this->actor.hintId = 0x2A; this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, GIBDO_LIMB_MAX); this->type = EN_TALK_GIBUD_TYPE_REDEAD; } - if (EnTalkGibud_PlayerOutOfRange(this, globalCtx)) { + if (EnTalkGibud_PlayerOutOfRange(this, play)) { EnTalkGibud_SetupWalkToHome(this); } else { EnTalkGibud_SetupWalkToPlayer(this); @@ -589,7 +589,7 @@ void EnTalkGibud_SetupDead(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Dead; } -void EnTalkGibud_Dead(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_Dead(EnTalkGibud* this, PlayState* play) { if (this->deathTimer > 300) { EnTalkGibud_SetupRevive(this); } else { @@ -600,7 +600,7 @@ void EnTalkGibud_Dead(EnTalkGibud* this, GlobalContext* globalCtx) { if ((this->deathTimer == 20) && (this->drawDmgEffTimer > 0) && (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FIRE) && (this->type == EN_TALK_GIBUD_TYPE_GIBDO)) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gRedeadSkel, NULL, this->jointTable, this->morphTable, GIBDO_LIMB_MAX); this->type = EN_TALK_GIBUD_TYPE_REDEAD; } @@ -616,72 +616,72 @@ void EnTalkGibud_SetupRevive(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Revive; } -void EnTalkGibud_Revive(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_Revive(EnTalkGibud* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.colChkInfo.health = 8; EnTalkGibud_SetupIdle(this); } } -void EnTalkGibud_GetTextIdForRequestedItem(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_GetTextIdForRequestedItem(EnTalkGibud* this, PlayState* play) { switch (this->requestedItemIndex) { case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BLUE_POTION: - Message_StartTextbox(globalCtx, 0x138C, &this->actor); + Message_StartTextbox(play, 0x138C, &this->actor); this->textId = 0x138C; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BEANS: - Message_StartTextbox(globalCtx, 0x138D, &this->actor); + Message_StartTextbox(play, 0x138D, &this->actor); this->textId = 0x138D; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_SPRING_WATER: - Message_StartTextbox(globalCtx, 0x138E, &this->actor); + Message_StartTextbox(play, 0x138E, &this->actor); this->textId = 0x138E; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_FISH: - Message_StartTextbox(globalCtx, 0x138F, &this->actor); + Message_StartTextbox(play, 0x138F, &this->actor); this->textId = 0x138F; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BUGS: - Message_StartTextbox(globalCtx, 0x1390, &this->actor); + Message_StartTextbox(play, 0x1390, &this->actor); this->textId = 0x1390; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_DEKU_NUTS: - Message_StartTextbox(globalCtx, 0x1391, &this->actor); + Message_StartTextbox(play, 0x1391, &this->actor); this->textId = 0x1391; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BOMBS: - Message_StartTextbox(globalCtx, 0x1392, &this->actor); + Message_StartTextbox(play, 0x1392, &this->actor); this->textId = 0x1392; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_HOT_SPRING_WATER: - Message_StartTextbox(globalCtx, 0x1393, &this->actor); + Message_StartTextbox(play, 0x1393, &this->actor); this->textId = 0x1393; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_BIG_POE: - Message_StartTextbox(globalCtx, 0x1394, &this->actor); + Message_StartTextbox(play, 0x1394, &this->actor); this->textId = 0x1394; break; case EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_MILK: - Message_StartTextbox(globalCtx, 0x1395, &this->actor); + Message_StartTextbox(play, 0x1395, &this->actor); this->textId = 0x1395; break; } } -void EnTalkGibud_GetNextTextBoxId(EnTalkGibud* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void EnTalkGibud_GetNextTextBoxId(EnTalkGibud* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x1388: - EnTalkGibud_GetTextIdForRequestedItem(this, globalCtx); + EnTalkGibud_GetTextIdForRequestedItem(this, play); break; case 0x138C: @@ -695,14 +695,14 @@ void EnTalkGibud_GetNextTextBoxId(EnTalkGibud* this, GlobalContext* globalCtx) { case 0x1394: case 0x1395: // Prompts the player to choose an item - Message_StartTextbox(globalCtx, 0xFF, &this->actor); + Message_StartTextbox(play, 0xFF, &this->actor); this->textId = 0xFF; break; } } } -s32 EnTalkGibud_PresentedItemMatchesRequest(EnTalkGibud* this, GlobalContext* globalCtx, s32 presentedItemActionParam) { +s32 EnTalkGibud_PresentedItemMatchesRequest(EnTalkGibud* this, PlayState* play, s32 presentedItemActionParam) { EnTalkGibudRequestedItem* requestedItem = &sRequestedItemTable[this->requestedItemIndex]; if (requestedItem->itemActionParam == presentedItemActionParam) { @@ -720,17 +720,17 @@ s32 EnTalkGibud_PresentedItemMatchesRequest(EnTalkGibud* this, GlobalContext* gl return EN_TALK_GIBUD_REQUESTED_ITEM_NOT_MET; } -void EnTalkGibud_CheckPresentedItem(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_CheckPresentedItem(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 itemActionParam; if (this->itemActionParam == PLAYER_AP_NONE) { - itemActionParam = func_80123810(globalCtx); + itemActionParam = func_80123810(play); if (itemActionParam != PLAYER_AP_NONE) { this->itemActionParam = itemActionParam; } if (this->itemActionParam > PLAYER_AP_NONE) { - switch (EnTalkGibud_PresentedItemMatchesRequest(this, globalCtx, this->itemActionParam)) { + switch (EnTalkGibud_PresentedItemMatchesRequest(this, play, this->itemActionParam)) { case EN_TALK_GIBUD_REQUESTED_ITEM_MET: player->actor.textId = 0x138A; this->textId = 0x138A; @@ -749,9 +749,9 @@ void EnTalkGibud_CheckPresentedItem(EnTalkGibud* this, GlobalContext* globalCtx) default: break; } - func_801477B4(globalCtx); + func_801477B4(play); } else if (this->itemActionParam < PLAYER_AP_NONE) { - Message_StartTextbox(globalCtx, 0x1389, &this->actor); + Message_StartTextbox(play, 0x1389, &this->actor); this->textId = 0x1389; } } @@ -769,17 +769,16 @@ void EnTalkGibud_SetupPassiveIdle(EnTalkGibud* this) { * This is the idle for when the player is wearing the Gibdo Mask. The * Gibdo will not attempt to attack the player and can be spoken to. */ -void EnTalkGibud_PassiveIdle(EnTalkGibud* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnTalkGibud_PassiveIdle(EnTalkGibud* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->isTalking = true; - Message_StartTextbox(globalCtx, 0x1388, &this->actor); + Message_StartTextbox(play, 0x1388, &this->actor); this->textId = 0x1388; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); EnTalkGibud_SetupTalk(this); } else if (this->actor.xzDistToPlayer < 100.0f && !(this->collider.base.acFlags & AC_HIT)) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->headRotation, &this->upperBodyRotation, - this->actor.focus.pos); - func_800B8614(&this->actor, globalCtx, 100.0f); + Actor_TrackPlayer(play, &this->actor, &this->headRotation, &this->upperBodyRotation, this->actor.focus.pos); + func_800B8614(&this->actor, play, 100.0f); } else { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); @@ -791,11 +790,11 @@ void EnTalkGibud_SetupTalk(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Talk; } -void EnTalkGibud_Talk(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnTalkGibudRequestedItem* requestedItem; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -811,18 +810,18 @@ void EnTalkGibud_Talk(EnTalkGibud* this, GlobalContext* globalCtx) { break; case 5: - EnTalkGibud_GetNextTextBoxId(this, globalCtx); + EnTalkGibud_GetNextTextBoxId(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->textId == 0x138A) { // Remove the requested item/amount from the player's inventory requestedItem = &sRequestedItemTable[this->requestedItemIndex]; if (!requestedItem->isBottledItem) { func_80115A14(requestedItem->item, -requestedItem->amount); } else { - func_80123D50(globalCtx, player, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + func_80123D50(play, player, ITEM_BOTTLE, PLAYER_AP_BOTTLE); } player->stateFlags1 |= 0x20; player->stateFlags1 |= 0x20000000; @@ -835,10 +834,10 @@ void EnTalkGibud_Talk(EnTalkGibud* this, GlobalContext* globalCtx) { break; case 16: - EnTalkGibud_CheckPresentedItem(this, globalCtx); + EnTalkGibud_CheckPresentedItem(this, play); break; } - EnTalkGibud_FacePlayerWhenTalking(this, globalCtx); + EnTalkGibud_FacePlayerWhenTalking(this, play); } void EnTalkGibud_SetupDisappear(EnTalkGibud* this) { @@ -848,8 +847,8 @@ void EnTalkGibud_SetupDisappear(EnTalkGibud* this) { this->actionFunc = EnTalkGibud_Disappear; } -void EnTalkGibud_Disappear(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_Disappear(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f velocity = sVelocity; Vec3f accel = sAccel; Vec3f pos; @@ -865,14 +864,14 @@ void EnTalkGibud_Disappear(EnTalkGibud* this, GlobalContext* globalCtx) { pos.z += Rand_Centered() * 20.0f; velocity.x += Rand_Centered() * 1.5f; velocity.z += Rand_Centered() * 1.5f; - func_800B3030(globalCtx, &pos, &velocity, &accel, 100, 0, 1); + func_800B3030(play, &pos, &velocity, &accel, 100, 0, 1); } func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); player->stateFlags1 |= 0x20000000; this->disappearanceTimer--; } else { if (this->switchFlag != -1) { - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetSwitch(play, this->switchFlag); } player->stateFlags1 &= ~0x20; player->stateFlags1 &= ~0x20000000; @@ -880,7 +879,7 @@ void EnTalkGibud_Disappear(EnTalkGibud* this, GlobalContext* globalCtx) { } } -void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, PlayState* play) { s16 target = this->actor.yawTowardsPlayer; Math_ScaledStepToS(&this->actor.shape.rot.y, target, 0x320); @@ -891,8 +890,8 @@ void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, GlobalContext* globalC Math_ScaledStepToS(&this->headRotation.y, target, 0x190); } -s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) < 150.0f) && !(player->stateFlags1 & (0x200000 | 0x80000 | 0x40000 | 0x4000 | 0x2000 | 0x80)) && @@ -908,8 +907,8 @@ s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, GlobalContext* * engage with the player. If the player is out of this range, they will simply * walk back to their home. */ -s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { return true; @@ -918,19 +917,19 @@ s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, GlobalContext* globalCtx) { return false; } -void EnTalkGibud_CheckForGibdoMask(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_CheckForGibdoMask(EnTalkGibud* this, PlayState* play) { if ((this->actionFunc != EnTalkGibud_Grab) && (this->actionFunc != EnTalkGibud_Dead) && (this->actionFunc != EnTalkGibud_Disappear) && (this->actionFunc != EnTalkGibud_Revive) && (this->actionFunc != EnTalkGibud_Damage) && (this->actionFunc != EnTalkGibud_Talk)) { if (this->actionFunc != EnTalkGibud_PassiveIdle) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO) { + if (Player_GetMask(play) == PLAYER_MASK_GIBDO) { this->actor.flags &= ~(ACTOR_FLAG_4 | ACTOR_FLAG_1); this->actor.flags |= (ACTOR_FLAG_8 | ACTOR_FLAG_1); this->actor.hintId = 0xFF; this->actor.textId = 0; EnTalkGibud_SetupPassiveIdle(this); } - } else if (Player_GetMask(globalCtx) != PLAYER_MASK_GIBDO) { + } else if (Player_GetMask(play) != PLAYER_MASK_GIBDO) { this->actor.flags &= ~(ACTOR_FLAG_8 | ACTOR_FLAG_1); this->actor.flags |= (ACTOR_FLAG_4 | ACTOR_FLAG_1); if (this->type == EN_TALK_GIBUD_TYPE_REDEAD) { @@ -944,7 +943,7 @@ void EnTalkGibud_CheckForGibdoMask(EnTalkGibud* this, GlobalContext* globalCtx) } } -void EnTalkGibud_TurnTowardsPlayer(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_TurnTowardsPlayer(EnTalkGibud* this, PlayState* play) { s16 headAngle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->upperBodyRotation.y; s16 upperBodyAngle = CLAMP(headAngle, -500, 500); @@ -968,8 +967,8 @@ void EnTalkGibud_TurnTowardsPlayer(EnTalkGibud* this, GlobalContext* globalCtx) * performing its grab attack. Regardless of what this returns, the Gibdo is * moved closer to this ideal position and rotation. */ -s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f targetPos; f32 distanceFromTargetPos; f32 distanceFromTargetYOffset = 0.0f; @@ -993,21 +992,21 @@ s32 EnTalkGibud_MoveToIdealGrabPositionAndRotation(EnTalkGibud* this, GlobalCont return false; } -void EnTalkGibud_PlayAnimation(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_PlayAnimation(EnTalkGibud* this, PlayState* play) { if (this->actionFunc != EnTalkGibud_Stunned) { SkelAnime_Update(&this->skelAnime); } } -void EnTalkGibud_MoveWithGravity(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_MoveWithGravity(EnTalkGibud* this, PlayState* play) { if ((this->actionFunc == EnTalkGibud_WalkToPlayer) || (this->actionFunc == EnTalkGibud_WalkToHome) || (this->actionFunc == EnTalkGibud_Damage)) { Actor_MoveWithGravity(&this->actor); } } -void EnTalkGibud_UpdateDamage(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; @@ -1078,19 +1077,19 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, GlobalContext* globalCtx) { } } -void EnTalkGibud_UpdateCollision(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_UpdateCollision(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((this->actionFunc != EnTalkGibud_Dead) && (this->actionFunc != EnTalkGibud_Disappear) && (this->actionFunc != EnTalkGibud_Revive) && ((this->actionFunc != EnTalkGibud_Grab) || (this->grabState == EN_TALK_GIBUD_GRAB_RELEASE))) { if (this->isTalking != true) { 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 != EnTalkGibud_Damage) || ((player->unk_ADC != 0) && (player->unk_ADD != this->unk_3F7))) && ((this->actionFunc != EnTalkGibud_Stunned) || (this->stunTimer == 0))) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -1104,11 +1103,11 @@ void EnTalkGibud_UpdateCollision(EnTalkGibud* this, GlobalContext* globalCtx) { * the player like this will help prevent the Gibdo from looking like it's * clipping into the wall as it grabs onto the player. */ -void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f targetPos; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 35.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 29); if (this->actionFunc == EnTalkGibud_Grab && this->grabState == EN_TALK_GIBUD_GRAB_START && (this->actor.bgCheckFlags & 8)) { targetPos = player->actor.world.pos; @@ -1118,7 +1117,7 @@ void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, GlobalContext* } } -void EnTalkGibud_UpdateEffect(EnTalkGibud* this, GlobalContext* globalCtx) { +void EnTalkGibud_UpdateEffect(EnTalkGibud* this, PlayState* play) { if (this->drawDmgEffTimer > 0) { this->drawDmgEffTimer--; } @@ -1131,26 +1130,26 @@ void EnTalkGibud_UpdateEffect(EnTalkGibud* this, GlobalContext* globalCtx) { } } -void EnTalkGibud_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTalkGibud_Update(Actor* thisx, PlayState* play) { EnTalkGibud* this = THIS; - EnTalkGibud_CheckForGibdoMask(this, globalCtx); - EnTalkGibud_UpdateDamage(this, globalCtx); + EnTalkGibud_CheckForGibdoMask(this, play); + EnTalkGibud_UpdateDamage(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - EnTalkGibud_PlayAnimation(this, globalCtx); - EnTalkGibud_MoveWithGravity(this, globalCtx); - EnTalkGibud_UpdateCollision(this, globalCtx); - EnTalkGibud_MoveGrabbedPlayerAwayFromWall(this, globalCtx); - EnTalkGibud_UpdateEffect(this, globalCtx); + EnTalkGibud_PlayAnimation(this, play); + EnTalkGibud_MoveWithGravity(this, play); + EnTalkGibud_UpdateCollision(this, play); + EnTalkGibud_MoveGrabbedPlayerAwayFromWall(this, play); + EnTalkGibud_UpdateEffect(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 50.0f; } -s32 EnTalkGibud_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx, Gfx** gfx) { +s32 EnTalkGibud_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { EnTalkGibud* this = THIS; if (limbIndex == GIBDO_LIMB_UPPER_BODY_ROOT) { @@ -1162,8 +1161,7 @@ s32 EnTalkGibud_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnTalkGibud_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, - Gfx** gfx) { +void EnTalkGibud_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnTalkGibud* this = THIS; if ((this->drawDmgEffTimer != 0) && @@ -1179,36 +1177,36 @@ void EnTalkGibud_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void EnTalkGibud_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTalkGibud_Draw(Actor* thisx, PlayState* play) { EnTalkGibud* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->limbIndex = 0; if (this->actor.shape.shadowAlpha == 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnTalkGibud_OverrideLimbDraw, - EnTalkGibud_PostLimbDraw, &this->actor, POLY_OPA_DISP); + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTalkGibud_OverrideLimbDraw, EnTalkGibud_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->actor.shape.shadowAlpha); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnTalkGibud_OverrideLimbDraw, - EnTalkGibud_PostLimbDraw, &this->actor, POLY_XLU_DISP); + POLY_XLU_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTalkGibud_OverrideLimbDraw, EnTalkGibud_PostLimbDraw, &this->actor, POLY_XLU_DISP); } if (this->drawDmgEffTimer > 0) { - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->drawDmgEffScale, 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + 0.5f, this->drawDmgEffAlpha, this->drawDmgEffType); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h index b2d5b06b88..ba55f9fc3a 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.h @@ -9,7 +9,7 @@ struct EnTalkGibud; -typedef void (*EnTalkGibudActionFunc)(struct EnTalkGibud*, GlobalContext*); +typedef void (*EnTalkGibudActionFunc)(struct EnTalkGibud*, PlayState*); typedef struct EnTalkGibud { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index 0f8b560684..cbc4670978 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -10,13 +10,13 @@ #define THIS ((EnTanron1*)thisx) -void EnTanron1_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron1_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron1_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron1_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron1_Init(Actor* thisx, PlayState* play); +void EnTanron1_Destroy(Actor* thisx, PlayState* play); +void EnTanron1_Update(Actor* thisx, PlayState* play); +void EnTanron1_Draw(Actor* thisx, PlayState* play); -void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx); -void func_80BB5AAC(EnTanron1* this, GlobalContext* globalCtx); +void func_80BB5318(EnTanron1* this, PlayState* play); +void func_80BB5AAC(EnTanron1* this, PlayState* play); const ActorInit En_Tanron1_InitVars = { ACTOR_EN_TANRON1, @@ -34,7 +34,7 @@ static u64 sPad = { 0 }; #include "overlays/ovl_En_Tanron1/ovl_En_Tanron1.c" -void EnTanron1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron1_Init(Actor* thisx, PlayState* play) { EnTanron1* this = THIS; this->actor.flags &= ~ACTOR_FLAG_1; @@ -46,7 +46,7 @@ void EnTanron1_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTanron1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron1_Destroy(Actor* thisx, PlayState* play) { } void func_80BB4E50(EnTanron1Struct* arg0, Vec3f* arg1, s16 arg2) { @@ -71,10 +71,10 @@ void func_80BB4E50(EnTanron1Struct* arg0, Vec3f* arg1, s16 arg2) { } } -void EnTanron1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron1_Update(Actor* thisx, PlayState* play) { EnTanron1* this = THIS; Actor* temp_a0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 i; EnTanron1Struct* ptr = &this->unk_160[0]; Vec3f temp; @@ -108,7 +108,7 @@ void EnTanron1_Update(Actor* thisx, GlobalContext* globalCtx) { phi_f18 = 10.0f; while (phi_f18 < 1000.0f) { - temp_a0 = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; + temp_a0 = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (temp_a0 != NULL) { if (temp_a0->id != ACTOR_OBJ_SYOKUDAI) { temp_a0 = temp_a0->next; @@ -160,7 +160,7 @@ void EnTanron1_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_144 = 100; } } else { - temp_a0 = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + temp_a0 = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (temp_a0 != NULL) { if (temp_a0->params == 1) { temp_a0 = temp_a0->next; @@ -179,17 +179,17 @@ void EnTanron1_Update(Actor* thisx, GlobalContext* globalCtx) { break; } } - func_80BB5318(this, globalCtx); + func_80BB5318(this, play); } -void EnTanron1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron1_Draw(Actor* thisx, PlayState* play) { EnTanron1* this = THIS; - func_80BB5AAC(this, globalCtx); + func_80BB5AAC(this, play); } -void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BB5318(EnTanron1* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnTanron1Struct* ptr = NULL; f32 phi_f28 = 0.0f; Vec3f* phi_s2 = NULL; @@ -215,7 +215,7 @@ void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { } } - temp_v0 = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; + temp_v0 = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (temp_v0 != NULL) { if (temp_v0->params != 1) { temp_v0 = temp_v0->next; @@ -258,7 +258,7 @@ void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { temp.z = player->actor.world.pos.z - ptr->unk_00.z; if ((SQXYZ(temp) < 400.0f) && (player->transformation != PLAYER_FORM_DEKU)) { - func_800B8D10(globalCtx, &this->actor, 0.0f, 0, 0.0f, 1, 1); + func_800B8D10(play, &this->actor, 0.0f, 0, 0.0f, 1, 1); } } @@ -338,10 +338,9 @@ void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { if (Rand_ZeroOne() < 0.5f) { ptr->unk_34 = randPlusMinusPoint5Scaled(12.0f); } - ptr->unk_3C = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp98, &ptr->unk_00); + ptr->unk_3C = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp98, &ptr->unk_00); sp9C = ptr->unk_00.y; - WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, ptr->unk_00.x, ptr->unk_00.z, &sp9C, - &spA0); + WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_00.x, ptr->unk_00.z, &sp9C, &spA0); if ((sp9C < ptr->unk_00.y) && (ptr->unk_3C < sp9C)) { ptr->unk_3C = sp9C; } @@ -353,7 +352,7 @@ void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { } if (spB4 != NULL) { - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, spB4, &this->unk_3360, &spB0); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, spB4, &this->unk_3360, &spB0); if (spB8 >= (s16)(KREG(39) + 20)) { Audio_PlaySfxAtPos(&this->unk_3360, NA_SE_EN_MB_MOTH_DEAD); } else if (spBA >= 20) { @@ -362,15 +361,15 @@ void func_80BB5318(EnTanron1* this, GlobalContext* globalCtx) { } } -void func_80BB5AAC(EnTanron1* this, GlobalContext* globalCtx) { +void func_80BB5AAC(EnTanron1* this, PlayState* play) { EnTanron1Struct* ptrBase = &this->unk_160[0]; s16 i; u8 flag = 0; EnTanron1Struct* ptr = ptrBase; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < this->actor.params; i++, ptr++) { if (ptr->unk_24 == 1) { @@ -383,8 +382,7 @@ void func_80BB5AAC(EnTanron1* this, GlobalContext* globalCtx) { Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY); Matrix_Scale(1.2f, ptr->unk_2C, 1.2f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900); } } @@ -408,9 +406,9 @@ void func_80BB5AAC(EnTanron1* this, GlobalContext* globalCtx) { Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY); Matrix_Scale(1.0f, ptr->unk_2C, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 6f52cfed74..5f6d54b07c 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -13,18 +13,18 @@ #define THIS ((EnTanron2*)thisx) -void EnTanron2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron2_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron2_Init(Actor* thisx, PlayState* play); +void EnTanron2_Destroy(Actor* thisx, PlayState* play); +void EnTanron2_Update(Actor* thisx, PlayState* play); +void EnTanron2_Draw(Actor* thisx, PlayState* play); void func_80BB69C0(EnTanron2* this); -void func_80BB69FC(EnTanron2* this, GlobalContext* globalCtx); -void func_80BB6BD8(EnTanron2* this, GlobalContext* globalCtx); +void func_80BB69FC(EnTanron2* this, PlayState* play); +void func_80BB6BD8(EnTanron2* this, PlayState* play); void func_80BB6F64(EnTanron2* this); -void func_80BB6F78(EnTanron2* this, GlobalContext* globalCtx); -void func_80BB7408(EnTanron2* this, GlobalContext* globalCtx); -void func_80BB7B90(Actor* thisx, GlobalContext* globalCtx); +void func_80BB6F78(EnTanron2* this, PlayState* play); +void func_80BB7408(EnTanron2* this, PlayState* play); +void func_80BB7B90(Actor* thisx, PlayState* play); Boss04* D_80BB8450; f32 D_80BB8454; @@ -120,7 +120,7 @@ static ColliderCylinderInit sCylinderInit2 = { Color_RGBA8 D_80BB81E8 = { 255, 255, 255, 255 }; Color_RGBA8 D_80BB81EC = { 255, 100, 100, 255 }; -void EnTanron2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron2_Init(Actor* thisx, PlayState* play) { EnTanron2* this = THIS; D_80BB8450 = (Boss04*)this->actor.parent; @@ -128,7 +128,7 @@ void EnTanron2_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 100) { this->actor.update = func_80BB7B90; - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, 5); return; } @@ -140,8 +140,8 @@ void EnTanron2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.targetMode = 5; - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); if ((KREG(64) != 0) || (gSaveContext.eventInf[6] & 1)) { func_80BB69C0(this); @@ -155,12 +155,12 @@ void EnTanron2_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_14C = -this->unk_14C; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 4); this->actor.floorHeight += 20.0f; this->unk_148 = Rand_ZeroFloat(32.0f); } -void EnTanron2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron2_Destroy(Actor* thisx, PlayState* play) { } void func_80BB69C0(EnTanron2* this) { @@ -173,7 +173,7 @@ void func_80BB69C0(EnTanron2* this) { this->unk_158 = 0; } -void func_80BB69FC(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB69FC(EnTanron2* this, PlayState* play) { f32 sp34; f32 sp30; f32 sp2C; @@ -213,8 +213,8 @@ void func_80BB6B80(EnTanron2* this) { this->collider1.dim.yShift = -25; } -void func_80BB6BD8(EnTanron2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BB6BD8(EnTanron2* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp32; f32 sp2C; f32 sp28; @@ -295,7 +295,7 @@ void func_80BB6F64(EnTanron2* this) { this->actionFunc = func_80BB6F78; } -void func_80BB6F78(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB6F78(EnTanron2* this, PlayState* play) { switch (this->unk_158) { case 0: if (D_80BB8450->unk_708 == 13) { @@ -352,7 +352,7 @@ void func_80BB6F78(EnTanron2* this, GlobalContext* globalCtx) { } } -void func_80BB71C8(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB71C8(EnTanron2* this, PlayState* play) { s32 i; Vec3f spA8; Vec3f sp9C; @@ -370,22 +370,22 @@ void func_80BB71C8(EnTanron2* this, GlobalContext* globalCtx) { sp9C.y = spA8.y * -0.03f; sp9C.z = spA8.z * -0.03f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &sp90, &spA8, &sp9C, &D_80BB81E8, &D_80BB81EC, + EffectSsDtBubble_SpawnCustomColor(play, &sp90, &spA8, &sp9C, &D_80BB81E8, &D_80BB81EC, Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0); } } -void func_80BB7398(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB7398(EnTanron2* this, PlayState* play) { this->actionFunc = func_80BB7408; if ((s8)this->actor.colChkInfo.health <= 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_IKURA_DEAD); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_IKURA_DEAD); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); } } -void func_80BB7408(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB7408(EnTanron2* this, PlayState* 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; @@ -395,7 +395,7 @@ void func_80BB7408(EnTanron2* this, GlobalContext* globalCtx) { this->actor.world.pos.y = this->actor.floorHeight; if ((s8)this->actor.colChkInfo.health <= 0) { Actor_MarkForDeath(&this->actor); - func_80BB71C8(this, globalCtx); + func_80BB71C8(this, play); D_80BB8450->unk_6F6--; D_80BB8450->unk_2E2 += 4; D_80BB8450->unk_2E0 += 4; @@ -412,10 +412,10 @@ void func_80BB7408(EnTanron2* this, GlobalContext* globalCtx) { } } -void func_80BB7578(EnTanron2* this, GlobalContext* globalCtx) { +void func_80BB7578(EnTanron2* this, PlayState* play) { ColliderInfo* acHitInfo; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad2; s32 pad3; u8 damage; @@ -430,8 +430,8 @@ void func_80BB7578(EnTanron2* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); if ((player->unk_730 != 0) && (&this->actor != player->unk_730)) { player->unk_730 = &this->actor; - globalCtx->actorCtx.targetContext.arrowPointedActor = &this->actor; - globalCtx->actorCtx.targetContext.targetedActor = &this->actor; + play->actorCtx.targetContext.arrowPointedActor = &this->actor; + play->actorCtx.targetContext.targetedActor = &this->actor; } } else { this->unk_154 = 15; @@ -445,7 +445,7 @@ void func_80BB7578(EnTanron2* this, GlobalContext* globalCtx) { Matrix_MultVecZ(-20.0f, &this->actor.velocity); damage = this->actor.colChkInfo.damage; this->actor.colChkInfo.health -= damage; - func_80BB7398(this, globalCtx); + func_80BB7398(this, play); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); @@ -471,11 +471,11 @@ void func_80BB7578(EnTanron2* this, GlobalContext* globalCtx) { this->unk_152 = Rand_ZeroFloat(100.0f) + 200.0f; } else if (D_80BB8450->unk_1F6 == 10) { Actor_MarkForDeath(&this->actor); - func_80BB71C8(this, globalCtx); + func_80BB71C8(this, play); } } -void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron2_Update(Actor* thisx, PlayState* play) { s32 pad; EnTanron2* this = THIS; s32 pad2[2]; @@ -504,7 +504,7 @@ void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_156--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_80BB69FC) { if ((this->actor.world.pos.x < (D_80BB8450->unk_6D8 + 20.0f)) || @@ -521,20 +521,20 @@ void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { } this->unk_14A += this->unk_14C; - func_80BB7578(this, globalCtx); + func_80BB7578(this, play); if (this->unk_159 != 0) { if (this->actor.xzDistToPlayer < 100.0f) { if (this->unk_15A == 0) { Collider_UpdateCylinder(&this->actor, &this->collider2); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } else { this->unk_15A--; } } Collider_UpdateCylinder(&this->actor, &this->collider1); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } if (!(this->unk_148 & 0x1F)) { @@ -564,7 +564,7 @@ void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_159 = 1; } - input = CONTROLLER3(&globalCtx->state); + input = CONTROLLER3(&play->state); if (CHECK_BTN_ALL(input->press.button, BTN_L)) { this->unk_158 = 1; } @@ -574,30 +574,30 @@ void EnTanron2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80BB7B90(Actor* thisx, GlobalContext* globalCtx) { +void func_80BB7B90(Actor* thisx, PlayState* play) { EnTanron2* this = THIS; - D_80BB8454 = (Math_SinS(globalCtx->gameplayFrames * 0x3000) * 0.1f) + 1.0f; + D_80BB8454 = (Math_SinS(play->gameplayFrames * 0x3000) * 0.1f) + 1.0f; if (D_80BB8450->unk_1F6 == 11) { Actor_MarkForDeath(&this->actor); } } -void EnTanron2_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTanron2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; s32 i; s32 j; s32 found; Actor* tanron2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_003450); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 150); - tanron2 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + tanron2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; for (i = 0; i < ARRAY_COUNT(D_80BB8458); i++) { D_80BB8458[i] = NULL; @@ -626,44 +626,42 @@ void EnTanron2_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (D_80BB8458[i] != NULL) { Matrix_Translate(D_80BB8458[i]->actor.world.pos.x, D_80BB8458[i]->actor.world.pos.y, D_80BB8458[i]->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(D_80BB8458[i]->actor.scale.x, D_80BB8458[i]->actor.scale.y, 0.0f, MTXMODE_APPLY); Matrix_RotateZS(D_80BB8458[i]->unk_14A, MTXMODE_APPLY); Matrix_Scale(0.13f, 0.14299999f, 0.13f, MTXMODE_APPLY); Matrix_RotateZS(-D_80BB8458[i]->unk_14A, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_0034C8); } } - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 150); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_004510); - tanron2 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + tanron2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (tanron2 != NULL) { if ((tanron2->params < 100) && (((EnTanron2*)tanron2)->unk_15B != 0)) { Matrix_Translate(tanron2->world.pos.x, D_80BB8450->actor.floorHeight, tanron2->world.pos.z, MTXMODE_NEW); Matrix_Scale(0.6f, 0.0f, 0.6f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_boss04_DL_004550); } tanron2 = tanron2->next; } - func_8012C974(globalCtx->state.gfxCtx); + func_8012C974(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 255); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); - tanron2 = globalCtx->actorCtx.actorLists[ACTORCAT_BOSS].first; + tanron2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (tanron2 != NULL) { if ((tanron2->params < 100) && (((EnTanron2*)tanron2)->unk_15B != 0) && (tanron2->world.pos.y <= tanron2->floorHeight)) { @@ -671,12 +669,11 @@ void EnTanron2_Draw(Actor* thisx, GlobalContext* globalCtx2) { MTXMODE_NEW); Matrix_Scale(D_80BB8454, 0.0f, D_80BB8454, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_0377B0); } tanron2 = tanron2->next; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h index 755bb4ff4d..1bbb3ad2ea 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.h @@ -5,7 +5,7 @@ struct EnTanron2; -typedef void (*EnTanron2ActionFunc)(struct EnTanron2*, GlobalContext*); +typedef void (*EnTanron2ActionFunc)(struct EnTanron2*, PlayState*); typedef struct EnTanron2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 5e6bd32eea..64d8b2dd79 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -18,14 +18,14 @@ #define WORK_TIMER_ATTACK 2 #define WORK_TIMER_WAIT 2 -void EnTanron3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron3_Init(Actor* thisx, PlayState* play); +void EnTanron3_Destroy(Actor* thisx, PlayState* play); +void EnTanron3_Update(Actor* thisx, PlayState* play); +void EnTanron3_Draw(Actor* thisx, PlayState* play); -void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx); -void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx); -void EnTanron3_Die(EnTanron3* this, GlobalContext* globalCtx); +void EnTanron3_SetupLive(EnTanron3* this, PlayState* play); +void EnTanron3_Live(EnTanron3* this, PlayState* play); +void EnTanron3_Die(EnTanron3* this, PlayState* play); static Vec3f sZeroVec[] = { 0.0f, 0.0f, 0.0f }; @@ -85,8 +85,8 @@ static ColliderCylinderInit sUnusedCylinderInit = { { 20, 20, -10, { 0, 0, 0 } }, }; -void EnTanron3_CreateEffect(GlobalContext* globalCtx, Vec3f* effectPos) { - GyorgEffect* effectPtr = globalCtx->specialEffects; +void EnTanron3_CreateEffect(PlayState* play, Vec3f* effectPos) { + GyorgEffect* effectPtr = play->specialEffects; s16 i; for (i = 0; i < GYORG_EFFECT_COUNT; i++, effectPtr++) { @@ -107,27 +107,27 @@ void EnTanron3_CreateEffect(GlobalContext* globalCtx, Vec3f* effectPos) { } } -void EnTanron3_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron3_Init(Actor* thisx, PlayState* play) { EnTanron3* this = THIS; this->actor.gravity = -1.0f; - Collider_InitAndSetCylinder(globalCtx, &this->atCollider, &this->actor, &sCylinderInit); - Collider_InitAndSetCylinder(globalCtx, &this->acCollider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGyorgSmallFishSkel, &gGyorgSmallFishSwimAnim, this->jointTable, + Collider_InitAndSetCylinder(play, &this->atCollider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->acCollider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &gGyorgSmallFishSkel, &gGyorgSmallFishSwimAnim, this->jointTable, this->morphTable, GYORG_SMALL_FISH_LIMB_MAX); Actor_SetScale(&this->actor, 0.02f); - EnTanron3_SetupLive(this, globalCtx); + EnTanron3_SetupLive(this, play); this->actor.flags &= ~ACTOR_FLAG_1; this->currentRotationAngle = Rand_ZeroFloat(500000.0f); this->waterSurfaceYPos = 430.0f; sGyorg = (Boss03*)this->actor.parent; } -void EnTanron3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron3_Destroy(Actor* thisx, PlayState* play) { sGyorg->numSpawnedSmallFish--; } -void EnTanron3_SpawnBubbles(EnTanron3* this, GlobalContext* globalCtx) { +void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) { static Color_RGBA8 sPrimColor = { 100, 55, 55, 255 }; static Color_RGBA8 sEnvColor = { 50, 10, 10, 255 }; s32 i; @@ -141,12 +141,12 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, GlobalContext* globalCtx) { acceleration.x = velocity.x * -0.05f; acceleration.y = velocity.y * -0.05f; acceleration.z = velocity.z * -0.05f; - EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor, + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor, &sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0); } } -void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx) { +void EnTanron3_SetupLive(EnTanron3* this, PlayState* play) { this->actionFunc = EnTanron3_Live; Animation_MorphToLoop(&this->skelAnime, &gGyorgSmallFishSwimAnim, -10.0f); this->rotationStep = 0; @@ -169,14 +169,14 @@ void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx) { * - swimming around idly if the player is out of range * - flopping around on land if it beaches itself */ -void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { +void EnTanron3_Live(EnTanron3* this, PlayState* play) { s32 atanTemp; f32 xDistance; f32 yDistance; f32 zDistance; f32 xzDistance; f32 extraScaleY = 0.0f; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->skelAnime.curFrame = 4.0f; if ((player->actor.bgCheckFlags & 1) && player->actor.shape.feetPos[0].y >= 438.0f) { @@ -316,7 +316,7 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { effectPos.x = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.x; effectPos.y = this->actor.world.pos.y; effectPos.z = randPlusMinusPoint5Scaled(30.0f) + this->actor.world.pos.z; - EnTanron3_CreateEffect(globalCtx, &effectPos); + EnTanron3_CreateEffect(play, &effectPos); } break; } @@ -332,11 +332,11 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { } } -void EnTanron3_SetupDie(EnTanron3* this, GlobalContext* globalCtx) { +void EnTanron3_SetupDie(EnTanron3* this, PlayState* play) { f32 xDistance; f32 yDistance; f32 zDistance; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actionFunc = EnTanron3_Die; xDistance = this->actor.world.pos.x - player->actor.world.pos.x; @@ -349,25 +349,25 @@ void EnTanron3_SetupDie(EnTanron3* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_MINI_DEAD); } -void EnTanron3_Die(EnTanron3* this, GlobalContext* globalCtx) { +void EnTanron3_Die(EnTanron3* this, PlayState* play) { Actor_MoveWithoutGravityReverse(&this->actor); if (this->workTimer[WORK_TIMER_DIE] == 0) { - EnTanron3_SpawnBubbles(this, globalCtx); + EnTanron3_SpawnBubbles(this, play); Actor_MarkForDeath(&this->actor); if (Rand_ZeroOne() < 0.3f) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x60); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x60); } } } -void EnTanron3_CheckCollisions(EnTanron3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTanron3_CheckCollisions(EnTanron3* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (player->actor.world.pos.y > 350.0f) { if (this->atCollider.base.atFlags & AT_HIT) { this->atCollider.base.atFlags &= ~AT_HIT; - func_800B8D50(globalCtx, NULL, 3.0f, Math_FAtan2F(-player->actor.world.pos.z, -player->actor.world.pos.x), - 5.0f, 0); + func_800B8D50(play, NULL, 3.0f, Math_FAtan2F(-player->actor.world.pos.z, -player->actor.world.pos.x), 5.0f, + 0); } } if (this->acCollider.base.acFlags & AC_HIT) { @@ -375,13 +375,13 @@ void EnTanron3_CheckCollisions(EnTanron3* this, GlobalContext* globalCtx) { if (this->deathTimer == 0) { this->deathTimer = 15; this->fogTimer = 15; - EnTanron3_SetupDie(this, globalCtx); + EnTanron3_SetupDie(this, play); sGyorg->unk_324 = 20; } } } -void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron3_Update(Actor* thisx, PlayState* play) { s32 pad; EnTanron3* this = THIS; s16 i; @@ -402,8 +402,8 @@ void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx) { this->fogTimer--; } - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 20.0f, 5); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 20.0f, 5); // The fish has either just entered or just exited the water, so create a splash effect if (((this->actor.prevPos.y < this->waterSurfaceYPos) && (this->waterSurfaceYPos <= this->actor.world.pos.y)) || @@ -411,25 +411,24 @@ void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx) { splashPos.x = this->actor.world.pos.x; splashPos.y = this->waterSurfaceYPos + 10.0f; splashPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &splashPos, NULL, NULL, 1, 500); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 1, 500); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); } } - EnTanron3_CheckCollisions(this, globalCtx); + EnTanron3_CheckCollisions(this, play); Collider_UpdateCylinder(&this->actor, &this->atCollider); Collider_UpdateCylinder(&this->actor, &this->acCollider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->atCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->acCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->atCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->acCollider.base); if ((s8)sGyorg->actor.colChkInfo.health <= 0 && this->actionFunc != EnTanron3_Die) { - EnTanron3_SetupDie(this, globalCtx); + EnTanron3_SetupDie(this, play); this->workTimer[WORK_TIMER_DIE] = 0; } } -s32 EnTanron3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnTanron3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTanron3* this = THIS; if (limbIndex == GYORG_SMALL_FISH_LIMB_ROOT) { @@ -447,18 +446,18 @@ s32 EnTanron3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron3_Draw(Actor* thisx, PlayState* play) { EnTanron3* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if ((this->fogTimer % 2) != 0) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTanron3_OverrideLimbDraw, NULL, &this->actor); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h index 5f984e2efc..14971d6e8e 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h @@ -6,7 +6,7 @@ struct EnTanron3; -typedef void (*EnTanron3ActionFunc)(struct EnTanron3*, GlobalContext*); +typedef void (*EnTanron3ActionFunc)(struct EnTanron3*, PlayState*); #define TANRON3_WORK_TIMER_MAX 3 diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index 48eea68289..e68ca1b3a9 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -10,16 +10,16 @@ #define THIS ((EnTanron4*)thisx) -void EnTanron4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron4_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron4_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron4_Init(Actor* thisx, PlayState* play); +void EnTanron4_Destroy(Actor* thisx, PlayState* play); +void EnTanron4_Update(Actor* thisx, PlayState* play); +void EnTanron4_Draw(Actor* thisx, PlayState* play); void EnTanron4_SetupFlyNearHome(EnTanron4* this); void EnTanron4_SetupFlyNearActor(EnTanron4* this); -void EnTanron4_FlyNearHome(EnTanron4* this, GlobalContext* globalCtx); -void EnTanron4_FlyNearActor(EnTanron4* this, GlobalContext* globalCtx); +void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play); +void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play); typedef enum { /* 0 */ SEAGULL_FLY_FLAP, @@ -43,12 +43,12 @@ const ActorInit En_Tanron4_InitVars = { (ActorFunc)EnTanron4_Draw, }; -void EnTanron4_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTanron4_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTanron4* this = THIS; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSeagullSkel, &gSeagullFlapAnim, this->jointTable, - this->morphTable, OBJECT_TANRON4_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gSeagullSkel, &gSeagullFlapAnim, this->jointTable, this->morphTable, + OBJECT_TANRON4_LIMB_MAX); thisx->flags &= ~ACTOR_FLAG_1; thisx->speedXZ = 3.0f + KREG(48); @@ -65,7 +65,7 @@ void EnTanron4_Init(Actor* thisx, GlobalContext* globalCtx2) { s32 i; for (i = 0; i < thisx->params; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TANRON4, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON4, thisx->world.pos.x + randPlusMinusPoint5Scaled(500.0f), thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), thisx->world.pos.z + randPlusMinusPoint5Scaled(500.0f), 0, Rand_ZeroFloat(65536.0f), 0, @@ -80,7 +80,7 @@ void EnTanron4_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnTanron4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron4_Destroy(Actor* thisx, PlayState* play) { } void EnTanron4_SetupFlyNearHome(EnTanron4* this) { @@ -88,7 +88,7 @@ void EnTanron4_SetupFlyNearHome(EnTanron4* this) { Animation_MorphToLoop(&this->skelAnime, &gSeagullFlapAnim, 0.0f); } -void EnTanron4_FlyNearHome(EnTanron4* this, GlobalContext* globalCtx) { +void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -175,7 +175,7 @@ void EnTanron4_SetupFlyNearActor(EnTanron4* this) { Animation_MorphToLoop(&this->skelAnime, &gSeagullFlapAnim, 0.0f); } -void EnTanron4_FlyNearActor(EnTanron4* this, GlobalContext* globalCtx) { +void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play) { f32 xDiff; f32 yDiff; f32 zDiff; @@ -249,7 +249,7 @@ void EnTanron4_FlyNearActor(EnTanron4* this, GlobalContext* globalCtx) { Math_ApproachS(&this->roll, this->rollTarget, 3, 0x3E8 + KREG(45)); } -void EnTanron4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron4_Update(Actor* thisx, PlayState* play) { EnTanron4* this = THIS; Actor_SetScale(&this->actor, 0.001f * KREG(16) + 0.01f); @@ -265,19 +265,19 @@ void EnTanron4_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_UpdateVelocityWithoutGravity(&this->actor); Actor_UpdatePos(&this->actor); } } -void EnTanron4_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron4_Draw(Actor* thisx, PlayState* play) { EnTanron4* this = THIS; if (this->timeInfluence < 1400.0f) { Matrix_RotateZS(this->roll, MTXMODE_APPLY); - 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); } } diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h index 250a62cf12..de4874cfc6 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.h @@ -6,7 +6,7 @@ struct EnTanron4; -typedef void (*EnTanron4ActionFunc)(struct EnTanron4*, GlobalContext*); +typedef void (*EnTanron4ActionFunc)(struct EnTanron4*, PlayState*); typedef struct EnTanron4 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index 09da81ceea..dc74fa4618 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -13,13 +13,13 @@ #define THIS ((EnTanron5*)thisx) -void EnTanron5_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron5_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron5_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron5_Init(Actor* thisx, PlayState* play); +void EnTanron5_Destroy(Actor* thisx, PlayState* play); +void EnTanron5_Update(Actor* thisx, PlayState* play); +void EnTanron5_Draw(Actor* thisx, PlayState* play); -void func_80BE5818(Actor* thisx, GlobalContext* globalCtx); -void func_80BE5C10(Actor* thisx, GlobalContext* globalCtx); +void func_80BE5818(Actor* thisx, PlayState* play); +void func_80BE5C10(Actor* thisx, PlayState* play); s32 D_80BE5D80 = 0; @@ -144,7 +144,7 @@ void func_80BE4A2C(EnTanron5Effect* effect, Vec3f* arg1, f32 arg2) { } } -void EnTanron5_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron5_Init(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; if (ENTANRON5_GET(&this->actor) >= ENTANRON5_100) { @@ -185,7 +185,7 @@ void EnTanron5_Init(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(D_80BE5E74); i++) { child = - (EnTanron5*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TANRON5, D_80BE5DD4[i].x, + (EnTanron5*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, D_80BE5DD4[i].x, this->actor.world.pos.y, D_80BE5DD4[i].z, 0, Rand_ZeroFloat(0x10000), 0, i + 1); child->actor.parent = this->actor.parent; @@ -198,17 +198,17 @@ void EnTanron5_Init(Actor* thisx, GlobalContext* globalCtx) { child->actor.shape.rot.y = 0; } - Collider_InitAndSetCylinder(globalCtx, &child->collider, &child->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &child->collider, &child->actor, &sCylinderInit); } Actor_MarkForDeath(&this->actor); } else { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); this->actor.world.pos.y = this->actor.floorHeight + -20.0f; } } -void EnTanron5_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron5_Destroy(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; if (ENTANRON5_GET(&this->actor) >= ENTANRON5_100) { @@ -216,11 +216,11 @@ void EnTanron5_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTanron5_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTanron5* this = THIS; Boss02* boss02 = (Boss02*)this->actor.parent; - Player* player = GET_PLAYER(globalCtx2); + Player* player = GET_PLAYER(play2); s32 i; s32 phi_v0; s32 spC4; @@ -271,7 +271,7 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.base.acFlags &= ~AC_HIT; spC4 = 10; - if (Play_InCsMode(globalCtx)) { + if (Play_InCsMode(play)) { this->unk_144 = 1; } else { this->unk_144 = 5; @@ -285,12 +285,12 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { spB8.y += D_80BE5DD0 * 300.0f; for (i = 3; i < spC4; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TANRON5, spB8.x, spB8.y, spB8.z, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, spB8.x, spB8.y, spB8.z, Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, i + 100); } for (i = 0; i < 6; i++) { - func_80BE4A2C(globalCtx->specialEffects, &spB8, Rand_ZeroFloat(3.0f) + 6.0f); + func_80BE4A2C(play->specialEffects, &spB8, Rand_ZeroFloat(3.0f) + 6.0f); } this->actor.world.pos.y -= D_80BE5DD0 * 130.0f; @@ -331,11 +331,11 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { sp9C.z = (randPlusMinusPoint5Scaled(spA8) * D_80BE5DD0) + spB8.z; sp9C.y = this->actor.floorHeight + (spAC * D_80BE5DD0); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TANRON5, sp9C.x, sp9C.y, sp9C.z, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TANRON5, sp9C.x, sp9C.y, sp9C.z, Rand_ZeroFloat(0x10000), Rand_ZeroFloat(0x10000), 0, i + 100); if (i < 8) { - func_80BE4A2C(globalCtx->specialEffects, &sp9C, Rand_ZeroFloat(3.0f) + 6.0f); + func_80BE4A2C(play->specialEffects, &sp9C, Rand_ZeroFloat(3.0f) + 6.0f); } } } @@ -350,7 +350,7 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.shape.rot.y += phi_v0; Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, globalCtx, 4, 4); + func_800BC848(&this->actor, play, 4, 4); this->unk_1A0++; } else { Vec3f sp90; @@ -361,7 +361,7 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { sp90.z = info->bumper.hitPos.z; Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); - CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sp90); + CollisionCheck_SpawnShieldParticlesMetal(play, &sp90); } } } @@ -372,7 +372,7 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { } if ((this->unk_148 == gTwinmoldMajoraPillarDL) || (D_80BE5DD0 < 0.5f)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { f32 xDiff = player->actor.world.pos.x - this->actor.world.pos.x; f32 yDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -392,15 +392,15 @@ void EnTanron5_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { +void func_80BE5818(Actor* thisx, PlayState* play2) { f32 sp6C; s32 i; Vec3f sp5C; EnTanron5* this = THIS; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; if ((ENTANRON5_GET(&this->actor) < ENTANRON5_110) && (this->unk_1A0 != 0)) { this->unk_1A0++; @@ -417,7 +417,7 @@ void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { if (this->actor.speedXZ > 0.02f) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); } if (ENTANRON5_GET(&this->actor) < ENTANRON5_110) { @@ -431,7 +431,7 @@ void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { sp5C.y = this->actor.floorHeight; for (i = 0; i < 4; i++) { - func_80BE4930(globalCtx->specialEffects, &sp5C, Rand_ZeroFloat(1.0f) + 2.0f); + func_80BE4930(play->specialEffects, &sp5C, Rand_ZeroFloat(1.0f) + 2.0f); } this->unk_1A0++; } else { @@ -450,7 +450,7 @@ void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_1A1 == 0) { if ((D_80BE5DD0 > 0.5f) && ((ENTANRON5_GET(&this->actor) < ENTANRON5_108) || (ENTANRON5_GET(&this->actor) >= ENTANRON5_110))) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f temp; temp.x = player->actor.world.pos.x - this->actor.world.pos.x; @@ -460,15 +460,15 @@ void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { if (SQXYZ(temp) < sp6C) { if (ENTANRON5_GET(&this->actor) >= ENTANRON5_110) { if (this->unk_1A0 == 0) { - Item_Give(globalCtx, ITEM_ARROWS_10); + Item_Give(play, ITEM_ARROWS_10); } else { - Item_Give(globalCtx, ITEM_MAGIC_LARGE); + Item_Give(play, ITEM_MAGIC_LARGE); } Actor_MarkForDeath(&this->actor); play_sound(NA_SE_SY_GET_ITEM); } else { this->unk_1A1 = 20; - func_800B8D50(globalCtx, NULL, 5.0f, this->actor.world.rot.y, 0.0f, 8); + func_800B8D50(play, NULL, 5.0f, this->actor.world.rot.y, 0.0f, 8); } } } @@ -477,22 +477,22 @@ void func_80BE5818(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnTanron5_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron5_Draw(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; if ((-500.0f * D_80BE5DD0) < this->actor.projectedPos.z) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_148); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80BE5C10(Actor* thisx, GlobalContext* globalCtx) { +void func_80BE5C10(Actor* thisx, PlayState* play) { EnTanron5* this = THIS; TexturePtr texture; s32 phi_v0; @@ -504,9 +504,9 @@ void func_80BE5C10(Actor* thisx, GlobalContext* globalCtx) { } if (((-500.0f * D_80BE5DD0) < this->actor.projectedPos.z) && phi_v0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_1A0 == 0) { texture = gameplay_keep_Tex_05BEF0; } else { @@ -520,9 +520,9 @@ void func_80BE5C10(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 200.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZS(this->unk_198, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c index bb57ff92fc..45459e8b38 100644 --- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c +++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c @@ -10,13 +10,13 @@ #define THIS ((EnTanron6*)thisx) -void EnTanron6_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTanron6_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTanron6_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTanron6_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTanron6_Init(Actor* thisx, PlayState* play); +void EnTanron6_Destroy(Actor* thisx, PlayState* play); +void EnTanron6_Update(Actor* thisx, PlayState* play); +void EnTanron6_Draw(Actor* thisx, PlayState* play); void EnTanron6_DoNothing(EnTanron6* this); -void func_80BE60D0(EnTanron6* this, GlobalContext* globalCtx); +void func_80BE60D0(EnTanron6* this, PlayState* play); const ActorInit En_Tanron6_InitVars = { ACTOR_EN_TANRON6, @@ -65,7 +65,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0xF), }; -void EnTanron6_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron6_Init(Actor* thisx, PlayState* play) { EnTanron6* this = THIS; this->actor.colChkInfo.mass = 10; @@ -76,23 +76,23 @@ void EnTanron6_Init(Actor* thisx, GlobalContext* globalCtx) { EnTanron6_DoNothing(this); } -void EnTanron6_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron6_Destroy(Actor* thisx, PlayState* play) { } void EnTanron6_DoNothing(EnTanron6* this) { this->actionFunc = func_80BE60D0; } -void func_80BE60D0(EnTanron6* this, GlobalContext* globalCtx) { +void func_80BE60D0(EnTanron6* this, PlayState* play) { } -void EnTanron6_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron6_Update(Actor* thisx, PlayState* play) { EnTanron6* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D); } -void EnTanron6_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTanron6_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h index 7a1c60e25f..13d060e2e5 100644 --- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h +++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h @@ -5,7 +5,7 @@ struct EnTanron6; -typedef void (*EnTanron6ActionFunc)(struct EnTanron6*, GlobalContext*); +typedef void (*EnTanron6ActionFunc)(struct EnTanron6*, PlayState*); typedef struct EnTanron6 { /* 0x000 */ Actor actor; 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 e3e22939fe..af2824c698 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -11,10 +11,10 @@ #define THIS ((EnTest*)thisx) -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); const ActorInit En_Test_InitVars = { ACTOR_EN_TEST, @@ -126,14 +126,14 @@ void func_80862EDC(EnTestStruct* arg0) { } } -void func_80863048(GlobalContext* globalCtx, EnTestStruct* arg1) { +void func_80863048(PlayState* play, EnTestStruct* arg1) { EnTestStruct* ptr; s32 i; Mtx* mtx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); @@ -149,16 +149,16 @@ void func_80863048(GlobalContext* globalCtx, EnTestStruct* arg1) { Matrix_RotateZYX(ptr->unk_30.x, ptr->unk_30.y, ptr->unk_30.z, MTXMODE_APPLY); Matrix_Scale(ptr->unk_2C, ptr->unk_2C, ptr->unk_2C, MTXMODE_APPLY); - mtx = Matrix_NewMtx(globalCtx->state.gfxCtx); + mtx = Matrix_NewMtx(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnTest_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest* this = THIS; MtxF sp38; s32 sp34; @@ -172,8 +172,7 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { thisx->floorPoly = NULL; thisx->world.pos.y += 10.0f; - thisx->floorHeight = - BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &thisx->floorPoly, &sp34, &thisx->world.pos); + thisx->floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, &thisx->floorPoly, &sp34, &thisx->world.pos); if ((thisx->floorPoly == NULL) || (thisx->floorHeight == BGCHECK_Y_MIN)) { Actor_MarkForDeath(thisx); @@ -184,7 +183,7 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx2) { func_800C0094(thisx->floorPoly, thisx->world.pos.x, thisx->floorHeight, thisx->world.pos.z, &sp38); Matrix_MtxFToYXZRot(&sp38, &thisx->shape.rot, true); thisx->world.rot = thisx->shape.rot; - this->unk_20A = func_800C9BB8(&globalCtx->colCtx, thisx->floorPoly, sp34); + this->unk_20A = func_800C9BB8(&play->colCtx, thisx->floorPoly, sp34); } func_80183430(&this->skeletonInfo, &gameplay_keep_Blob_06EB70, &gameplay_keep_Blob_06BB0C, this->unk_178, @@ -194,13 +193,13 @@ void EnTest_Init(Actor* thisx, GlobalContext* globalCtx2) { func_80862B70(this->unk_20C); } -void EnTest_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Destroy(Actor* thisx, PlayState* play) { EnTest* this = THIS; func_8018349C(&this->skeletonInfo); } -void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Update(Actor* thisx, PlayState* play) { EnTest* this = THIS; s32 i; @@ -225,11 +224,11 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { func_80862EDC(this->unk_20C); } -s32 EnTest_OverrideKeyframeDraw(GlobalContext* globalCtx, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, - u8* flags, Actor* thisx, Vec3f* scale, Vec3s* rot, Vec3f* pos) { +s32 EnTest_OverrideKeyframeDraw(PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, + Actor* thisx, Vec3f* scale, Vec3s* rot, Vec3f* pos) { EnTest* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actor.params == -1) && ((limbIndex == 1) || (limbIndex == 2))) { *dList = NULL; @@ -244,12 +243,12 @@ s32 EnTest_OverrideKeyframeDraw(GlobalContext* globalCtx, SkeletonInfo* skeleton gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, ((20 - this->unk_209) * 255.0f) / 20.0f); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); return true; } -void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTest_Draw(Actor* thisx, PlayState* play) { EnTest* this = THIS; Mtx* sp28; s32 sp2C = this->unk_208 - 1; @@ -259,16 +258,16 @@ void EnTest_Draw(Actor* thisx, GlobalContext* globalCtx) { } if ((this->unk_20A == 15) || (this->unk_20A == 14)) { - AnimatedMat_DrawStep(globalCtx, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B730), sp2C); + AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B730), sp2C); } else { - AnimatedMat_DrawStep(globalCtx, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B6A0), sp2C); + AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B6A0), sp2C); } - sp28 = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(this->skeletonInfo.unk_18->unk_1 * sizeof(Mtx))); + sp28 = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(this->skeletonInfo.unk_18->unk_1 * sizeof(Mtx))); if (sp28 != NULL) { - func_8012C2DC(globalCtx->state.gfxCtx); - func_8018450C(globalCtx, &this->skeletonInfo, sp28, EnTest_OverrideKeyframeDraw, NULL, thisx); - func_80863048(globalCtx, this->unk_20C); + func_8012C2DC(play->state.gfxCtx); + func_8018450C(play, &this->skeletonInfo, sp28, EnTest_OverrideKeyframeDraw, NULL, thisx); + func_80863048(play, this->unk_20C); } } diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index c16a4133d3..962925216e 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -10,8 +10,8 @@ #define THIS ((EnTest2*)thisx) -void EnTest2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest2_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTest2_Init(Actor* thisx, PlayState* play); +void EnTest2_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Test2_InitVars = { diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index ce9a8f3c9e..f50fca2e78 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -10,9 +10,9 @@ #define THIS ((EnTest3*)thisx) -void EnTest3_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest3_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTest3_Init(Actor* thisx, PlayState* play); +void EnTest3_Destroy(Actor* thisx, PlayState* play); +void EnTest3_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Test3_InitVars = { diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.h b/src/overlays/actors/ovl_En_Test3/z_en_test3.h index 10f1105f55..a2731c7958 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.h +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.h @@ -5,7 +5,7 @@ struct EnTest3; -typedef void (*EnTest3ActionFunc)(struct EnTest3*, GlobalContext*); +typedef void (*EnTest3ActionFunc)(struct EnTest3*, PlayState*); typedef struct EnTest3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index bfe6a5b559..6895ee1123 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -12,12 +12,12 @@ #define THIS ((EnTest4*)thisx) -void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest4_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTest4_Init(Actor* thisx, PlayState* play); +void EnTest4_Destroy(Actor* thisx, PlayState* play); +void EnTest4_Update(Actor* thisx, PlayState* play); -void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx); -void func_80A42F20(EnTest4* this, GlobalContext* globalCtx); +void func_80A42AB8(EnTest4* this, PlayState* play); +void func_80A42F20(EnTest4* this, PlayState* play); const ActorInit En_Test4_InitVars = { ACTOR_EN_TEST4, @@ -45,28 +45,28 @@ static u16 D_80A43364[] = { CLOCK_TIME(6, 0), CLOCK_TIME(18, 0) }; static s16 sCutscenes[2]; static s16 sCurrentCs; -void func_80A41D70(EnTest4* this, GlobalContext* globalCtx) { +void func_80A41D70(EnTest4* this, PlayState* play) { if (this->unk_144 != 0) { - func_80151A68(globalCtx, sNightMessages1[CURRENT_DAY - 1]); - } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) { - if (globalCtx->actorCtx.unk5 & 2) { + func_80151A68(play, sNightMessages1[CURRENT_DAY - 1]); + } else if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0)) { + if (play->actorCtx.unk5 & 2) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); - func_80151A68(globalCtx, sDayMessages1[CURRENT_DAY - 1]); + func_80151A68(play, sDayMessages1[CURRENT_DAY - 1]); } else { this->unk_144 = 0; this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } - func_8010EE74(globalCtx, CURRENT_DAY); + func_8010EE74(play, CURRENT_DAY); D_801BDBC8 = 0xFE; - func_800FB758(globalCtx); - func_800FEAF4(&globalCtx->envCtx); + func_800FB758(play); + func_800FEAF4(&play->envCtx); this->actionFunc = func_80A42AB8; } if (gSaveContext.cutsceneTrigger == 0) { - if ((sCutscenes[this->unk_144] >= 0) && !(globalCtx->actorCtx.unk5 & 2)) { + if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) { this->actionFunc = func_80A42F20; sCurrentCs = sCutscenes[this->unk_144]; this->transitionCsTimer = 0; @@ -88,22 +88,22 @@ void func_80A41D70(EnTest4* this, GlobalContext* globalCtx) { } } -void func_80A41FA4(EnTest4* this, GlobalContext* globalCtx) { +void func_80A41FA4(EnTest4* this, PlayState* play) { if (this->unk_144 != 0) { - func_80151A68(globalCtx, sNightMessages2[CURRENT_DAY - 1]); - } else if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0)) { + func_80151A68(play, sNightMessages2[CURRENT_DAY - 1]); + } else if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0)) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); - func_8010EE74(globalCtx, CURRENT_DAY); - func_80151A68(globalCtx, sDayMessages2[CURRENT_DAY - 1]); + func_8010EE74(play, CURRENT_DAY); + func_80151A68(play, sDayMessages2[CURRENT_DAY - 1]); D_801BDBC8 = 0xFE; - func_800FB758(globalCtx); - func_800FEAF4(&globalCtx->envCtx); + func_800FB758(play); + func_800FEAF4(&play->envCtx); this->actionFunc = func_80A42AB8; } if (gSaveContext.cutsceneTrigger == 0) { - if ((sCutscenes[this->unk_144] >= 0) && ((globalCtx->actorCtx.unk5 & 2) == 0)) { + if ((sCutscenes[this->unk_144] >= 0) && ((play->actorCtx.unk5 & 2) == 0)) { this->actionFunc = func_80A42F20; sCurrentCs = sCutscenes[this->unk_144]; this->transitionCsTimer = 0; @@ -239,7 +239,7 @@ void func_80A42198(EnTest4* this) { } // Bells on first and second day -void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) { +void func_80A425E4(EnTest4* this, PlayState* play) { gSaveContext.screenScale = 1000.0f; if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < CLOCK_TIME(18, 0))) { @@ -277,7 +277,7 @@ void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) { this->nextBellTime = CLOCK_TIME(17, 30); } - if ((sCutscenes[this->unk_144] < 0) || ((globalCtx->actorCtx.unk5 & 2) != 0) || (CURRENT_DAY == 3) || + if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0) || (CURRENT_DAY == 3) || (gSaveContext.save.time >= CLOCK_TIME(17, 0))) { gSaveContext.screenScale = 1000.0f; } @@ -287,10 +287,10 @@ void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) { } } -void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTest4_Init(Actor* thisx, PlayState* play) { s32 dayTemp; EnTest4* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s8 temp_v0 = this->actor.cutscene; sCutscenes[0] = temp_v0; @@ -316,10 +316,10 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.gameMode = 0; { - GameState* state = &globalCtx->state; + GameState* state = &play->state; state->running = false; } - SET_NEXT_GAMESTATE(&globalCtx->state, Daytelop_Init, DaytelopContext); + SET_NEXT_GAMESTATE(&play->state, Daytelop_Init, DaytelopContext); if (this && this && this) {} this->unk_144 = 1; gSaveContext.save.time = CLOCK_TIME(6, 0); @@ -334,9 +334,8 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { } } else if (gSaveContext.save.time == CLOCK_TIME(6, 0)) { this->unk_144 = 0; - func_80A41D70(this, globalCtx); - if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && - !(globalCtx->actorCtx.unk5 & 2)) { + func_80A41D70(this, play); + if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) { player->stateFlags1 |= 0x200; } } else { @@ -353,24 +352,24 @@ void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { if (CURRENT_DAY == 3) { func_80A42198(this); } else { - func_80A425E4(this, globalCtx); + func_80A425E4(this, play); } this->lastBellTime = gSaveContext.save.time; - if ((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) { + if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) { gSaveContext.screenScaleFlag = 0; gSaveContext.screenScale = 1000.0f; } } -void EnTest4_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest4_Destroy(Actor* thisx, PlayState* play) { } -void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A42AB8(EnTest4* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if ((globalCtx->unk_18B4A == 0) && !Play_InCsMode(globalCtx) && (globalCtx->numSetupActors <= 0) && - (globalCtx->roomCtx.unk31 == 0) && (!Play_IsDebugCamEnabled())) { + if ((play->unk_18B4A == 0) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && (play->roomCtx.unk31 == 0) && + (!Play_IsDebugCamEnabled())) { s16 temp_a2; u16 temp_a0 = D_80A43364[this->unk_144]; s16 temp_a3; @@ -384,24 +383,24 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { if ((temp_a3 * temp_a2) <= 0) { gSaveContext.unk_3CA7 = 1; - if (globalCtx->actorCtx.unk5 & 0x4) { - globalCtx->actorCtx.unk5 &= ~0x4; + if (play->actorCtx.unk5 & 0x4) { + play->actorCtx.unk5 &= ~0x4; } if (temp_a0 != CLOCK_TIME(6, 0)) { - func_80A41FA4(this, globalCtx); + func_80A41FA4(this, play); } else if (temp_a0 == CLOCK_TIME(6, 0)) { if (CURRENT_DAY == 3) { - func_8011C808(globalCtx); + func_8011C808(play); Actor_MarkForDeath(&this->actor); gSaveContext.eventInf[1] |= 0x80; - } else if (((sCutscenes[this->unk_144] < 0) || (globalCtx->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) { - func_80A41FA4(this, globalCtx); + } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) { + func_80A41FA4(this, play); } else { gSaveContext.screenScale = 0.0f; - Play_SetRespawnData(&globalCtx->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), + Play_SetRespawnData(&play->state, RESTART_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); - func_80169EFC(&globalCtx->state); + func_80169EFC(&play->state); if (player->stateFlags1 & 0x800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; @@ -420,7 +419,7 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { } } - if ((sCutscenes[this->unk_144] >= 0) && ((globalCtx->actorCtx.unk5 & 2) == 0)) { + if ((sCutscenes[this->unk_144] >= 0) && ((play->actorCtx.unk5 & 2) == 0)) { player->stateFlags1 |= 0x200; this->unk_146 = gSaveContext.save.time; } else { @@ -439,38 +438,38 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { if (CURRENT_DAY == 3) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || - (globalCtx->sceneNum == SCENE_CLOCKTOWER))) { + (play->sceneNum == SCENE_CLOCKTOWER))) { s32 playerParams; u32 entranceIndex = gSaveContext.save.entranceIndex; - if ((globalCtx->actorCtx.unk5 & 2)) { + if ((play->actorCtx.unk5 & 2)) { playerParams = 0xCFF; } else { playerParams = 0xBFF; } - Play_SetRespawnData(&globalCtx->state, RESTART_MODE_RETURN, entranceIndex, player->unk_3CE, - playerParams, &player->unk_3C0, player->unk_3CC); + Play_SetRespawnData(&play->state, RESTART_MODE_RETURN, entranceIndex, player->unk_3CE, playerParams, + &player->unk_3C0, player->unk_3CC); - if ((globalCtx->sceneNum == SCENE_TENMON_DAI) || (globalCtx->sceneNum == SCENE_00KEIKOKU)) { - globalCtx->nextEntranceIndex = 0x5400; + if ((play->sceneNum == SCENE_TENMON_DAI) || (play->sceneNum == SCENE_00KEIKOKU)) { + play->nextEntranceIndex = 0x5400; } else { - globalCtx->nextEntranceIndex = 0xD800; + play->nextEntranceIndex = 0xD800; } gSaveContext.nextCutsceneIndex = 0xFFF1; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 2; player->stateFlags1 |= 0x200; Actor_MarkForDeath(&this->actor); } func_80A42198(this); } else { - func_80A425E4(this, globalCtx); + func_80A425E4(this, play); } } } } -void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { +void func_80A42F20(EnTest4* this, PlayState* play) { if (!this->transitionCsTimer) { if (sCurrentCs >= 0) { if (ActorCutscene_GetCanPlayNext(sCurrentCs) == 0) { @@ -492,11 +491,11 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { } } if (this->transitionCsTimer == 60) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); gSaveContext.save.time += CLOCK_TIME_MINUTE; this->unk_146 = gSaveContext.save.time; - globalCtx->numSetupActors = -globalCtx->numSetupActors; + play->numSetupActors = -play->numSetupActors; player->stateFlags1 &= ~0x200; } } else { @@ -516,21 +515,21 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { } } -void func_80A430C8(EnTest4* this, GlobalContext* globalCtx) { +void func_80A430C8(EnTest4* this, PlayState* play) { if ((CURRENT_DAY == 2) && (gSaveContext.save.time >= CLOCK_TIME(7, 0)) && - (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (globalCtx->envCtx.unk_F2[2] == 0)) { + (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { // rain? D_801BDBB0 = 1; - func_800FD78C(globalCtx); - globalCtx->envCtx.unk_E3 = 1; - globalCtx->envCtx.unk_F2[0] = 0x3C; + func_800FD78C(play); + play->envCtx.unk_E3 = 1; + play->envCtx.unk_F2[0] = 0x3C; } else { - if (globalCtx->envCtx.unk_F2[0] != 0) { - if ((globalCtx->state.frames % 4) == 0) { - globalCtx->envCtx.unk_F2[0]--; - if ((globalCtx->envCtx.unk_F2[0]) == 8) { - func_800FD858(globalCtx); + if (play->envCtx.unk_F2[0] != 0) { + if ((play->state.frames % 4) == 0) { + play->envCtx.unk_F2[0]--; + if ((play->envCtx.unk_F2[0]) == 8) { + func_800FD858(play); } } } @@ -541,12 +540,12 @@ void func_80A430C8(EnTest4* this, GlobalContext* globalCtx) { } } -void func_80A431C8(EnTest4* this, GlobalContext* globalCtx) { +void func_80A431C8(EnTest4* this, PlayState* play) { if (((gSaveContext.save.time >= CLOCK_TIME(17, 30)) && (gSaveContext.save.time < CLOCK_TIME(23, 0)) && - (globalCtx->envCtx.unk_F2[0] != 0)) || - (globalCtx->envCtx.unk_F2[2] != 0)) { + (play->envCtx.unk_F2[0] != 0)) || + (play->envCtx.unk_F2[2] != 0)) { D_801BDBB0 = 0; - globalCtx->envCtx.unk_E3 = 2; + play->envCtx.unk_E3 = 2; } if (D_801BDBB0 == 0) { @@ -554,7 +553,7 @@ void func_80A431C8(EnTest4* this, GlobalContext* globalCtx) { } } -void func_80A4323C(EnTest4* this, GlobalContext* globalCtx) { +void func_80A4323C(EnTest4* this, PlayState* play) { s32 temp_v0 = (this->actor.params >> 0xA) * 0x64; if (temp_v0 > 0) { @@ -562,23 +561,23 @@ void func_80A4323C(EnTest4* this, GlobalContext* globalCtx) { } } -void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest4_Update(Actor* thisx, PlayState* play) { EnTest4* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 2)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (func_800FE4B8(globalCtx) != 0) { + if (func_800FE4B8(play) != 0) { switch (this->state) { case TEST4_STATE_0: - func_80A430C8(this, globalCtx); + func_80A430C8(this, play); break; case TEST4_STATE_1: - func_80A431C8(this, globalCtx); + func_80A431C8(this, play); break; } } - func_80A4323C(this, globalCtx); + func_80A4323C(this, play); } } diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.h b/src/overlays/actors/ovl_En_Test4/z_en_test4.h index 4927c337e1..e26331ed57 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.h +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.h @@ -5,7 +5,7 @@ struct EnTest4; -typedef void (*EnTest4ActionFunc)(struct EnTest4*, GlobalContext*); +typedef void (*EnTest4ActionFunc)(struct EnTest4*, PlayState*); typedef struct EnTest4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index 4a93cf5e88..57db36ea6b 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -10,10 +10,10 @@ #define THIS ((EnTest5*)thisx) -void EnTest5_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest5_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest5_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTest5_HandleBottleAction(EnTest5* this, GlobalContext* globalCtx); +void EnTest5_Init(Actor* thisx, PlayState* play); +void EnTest5_Destroy(Actor* thisx, PlayState* play); +void EnTest5_Update(Actor* thisx, PlayState* play); +void EnTest5_HandleBottleAction(EnTest5* this, PlayState* play); void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc); const ActorInit En_Test5_InitVars = { @@ -32,15 +32,15 @@ void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTest5_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest5_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest5* this = THIS; WaterBox* water; f32 ySurface; // If not spawned above a water source, immediately despawn - if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &ySurface, &water)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &water)) { Actor_MarkForDeath(&this->actor); return; } @@ -52,19 +52,19 @@ void EnTest5_Init(Actor* thisx, GlobalContext* globalCtx2) { EnTest5_SetupAction(this, EnTest5_HandleBottleAction); } -void EnTest5_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest5_Destroy(Actor* thisx, PlayState* play) { } -void EnTest5_HandleBottleAction(EnTest5* this, GlobalContext* globalCtx) { +void EnTest5_HandleBottleAction(EnTest5* this, PlayState* play) { Player* player; Vec3f playerPosRelativeToWater; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; return; } - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player->interactRangeActor == NULL || player->getItemId != GI_MAX) { Math_Vec3f_DistXYZAndStoreDiff(&this->minPos, &player->actor.world.pos, &playerPosRelativeToWater); @@ -73,28 +73,27 @@ void EnTest5_HandleBottleAction(EnTest5* this, GlobalContext* globalCtx) { if (playerPosRelativeToWater.x >= 0.0f && playerPosRelativeToWater.x <= this->xLength && playerPosRelativeToWater.z >= 0.0f && playerPosRelativeToWater.z <= this->zLength && fabsf(playerPosRelativeToWater.y) < 100.0f && player->actor.depthInWater > 12.0f) { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, this->actor.xzDistToPlayer, - fabsf(this->actor.playerHeightRel)); + Actor_PickUp(&this->actor, play, GI_MAX, this->actor.xzDistToPlayer, fabsf(this->actor.playerHeightRel)); } } } -void EnTest5_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest5_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest5* this = THIS; Vec3f steamPos; CollisionPoly* poly; s32 pad; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); // If it's the hot spring variant, generate steam clouds - if (ENTEST5_IS_HOT_SPRING(&this->actor) && (globalCtx->state.frames % 4) == 0) { + if (ENTEST5_IS_HOT_SPRING(&this->actor) && (play->state.frames % 4) == 0) { steamPos.x = (Rand_ZeroOne() * this->xLength) + this->minPos.x; steamPos.y = this->minPos.y + 100.0f; steamPos.z = (Rand_ZeroOne() * this->zLength) + this->minPos.z; - if ((BgCheck_EntityRaycastFloor2(globalCtx, &globalCtx->colCtx, &poly, &steamPos) + 10.0f) < this->minPos.y) { + if ((BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &steamPos) + 10.0f) < this->minPos.y) { Vec3f steamVel; steamPos.y = this->minPos.y + 10.0f; @@ -102,7 +101,7 @@ void EnTest5_Update(Actor* thisx, GlobalContext* globalCtx2) { steamVel.x = 0.0f; steamVel.z = 0.0f; - EffectSsIceSmoke_Spawn(globalCtx, &steamPos, &steamVel, &gZeroVec3f, + EffectSsIceSmoke_Spawn(play, &steamPos, &steamVel, &gZeroVec3f, (s16)((-200) - (s32)(Rand_ZeroOne() * 50.0f))); } } diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.h b/src/overlays/actors/ovl_En_Test5/z_en_test5.h index 539f5b3c26..6481e254b6 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.h +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.h @@ -7,7 +7,7 @@ struct EnTest5; // SpringWaterModifier -typedef void (*EnTest5ActionFunc)(struct EnTest5*, GlobalContext*); +typedef void (*EnTest5ActionFunc)(struct EnTest5*, PlayState*); typedef struct EnTest5 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 5cca94ff07..91632c6808 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -11,14 +11,14 @@ #define THIS ((EnTest6*)thisx) -void EnTest6_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest6_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest6_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTest6_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTest6_Init(Actor* thisx, PlayState* play); +void EnTest6_Destroy(Actor* thisx, PlayState* play); +void EnTest6_Update(Actor* thisx, PlayState* play); +void EnTest6_Draw(Actor* thisx, PlayState* play); struct EnTest6Struct; -typedef void (*EnTest6StructFunc)(EnTest6*, GlobalContext*, struct EnTest6Struct*); +typedef void (*EnTest6StructFunc)(EnTest6*, PlayState*, struct EnTest6Struct*); typedef struct EnTest6Struct { /* 0x00 */ s32 unk_00; @@ -29,15 +29,15 @@ typedef struct EnTest6Struct { /* 0x14 */ EnTest6StructFunc unk_14; } EnTest6Struct; // size = 0x18 -void func_80A90D34(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr); -void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr); +void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr); +void func_80A90FC0(EnTest6* this, PlayState* play, EnTest6Struct* ptr); void EnTest6_SetupAction(EnTest6* this, EnTest6ActionFunc actionFunc); -void func_80A9156C(EnTest6* this, GlobalContext* globalCtx); -void func_80A91690(EnTest6* this, GlobalContext* globalCtx); -void func_80A91760(EnTest6* this, GlobalContext* globalCtx); -void func_80A920C8(EnTest6* this, GlobalContext* globalCtx); -void func_80A92188(EnTest6* this, GlobalContext* globalCtx); -void func_80A92950(EnTest6* this, GlobalContext* globalCtx); +void func_80A9156C(EnTest6* this, PlayState* play); +void func_80A91690(EnTest6* this, PlayState* play); +void func_80A91760(EnTest6* this, PlayState* play); +void func_80A920C8(EnTest6* this, PlayState* play); +void func_80A92188(EnTest6* this, PlayState* play); +void func_80A92950(EnTest6* this, PlayState* play); EnTest6Struct D_80A94910[12]; @@ -105,9 +105,9 @@ Color_RGB8 D_80A94070 = { 0, 0, 0 }; s16 D_80A94074 = 940; s16 D_80A94078 = 2000; -void func_80A90730(EnTest6* this, GlobalContext* globalCtx) { +void func_80A90730(EnTest6* this, PlayState* play) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 phi_s0; f32 phi_f24; @@ -117,13 +117,13 @@ void func_80A90730(EnTest6* this, GlobalContext* globalCtx) { switch (ENTEST6_GET(&this->actor)) { case ENTEST6_24: case ENTEST6_25: - func_80A91690(this, globalCtx); - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + func_80A91690(this, play); + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); return; case ENTEST6_26: - func_80A920C8(this, globalCtx); - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + func_80A920C8(this, play); + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); return; } @@ -196,43 +196,43 @@ void func_80A90C34(void) { func_80165690(); } -void func_80A90C54(GlobalContext* globalCtx, f32 arg1) { - globalCtx->envCtx.fillScreen = 1; - globalCtx->envCtx.screenFillColor[0] = 250; - globalCtx->envCtx.screenFillColor[1] = 250; - globalCtx->envCtx.screenFillColor[2] = 250; - globalCtx->envCtx.screenFillColor[3] = 255.0f * arg1; +void func_80A90C54(PlayState* play, f32 arg1) { + play->envCtx.fillScreen = 1; + play->envCtx.screenFillColor[0] = 250; + play->envCtx.screenFillColor[1] = 250; + play->envCtx.screenFillColor[2] = 250; + play->envCtx.screenFillColor[3] = 255.0f * arg1; } -void func_80A90D20(GlobalContext* globalCtx) { - globalCtx->envCtx.fillScreen = 0; +void func_80A90D20(PlayState* play) { + play->envCtx.fillScreen = 0; } -void func_80A90D34(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) { +void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (ptr->unk_00 != 0) { Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); Matrix_Scale(ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, MTXMODE_APPLY); - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00])); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0); } Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); Matrix_Scale(2.0f * ptr->unk_04, 2.0f * ptr->unk_04, 2.0f * ptr->unk_04, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZS(globalCtx->state.frames * 512, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZS(play->state.frames * 512, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 210, 210, 230, 128); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 0); @@ -240,12 +240,12 @@ void func_80A90D34(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) { +void func_80A90FC0(EnTest6* this, PlayState* play, EnTest6Struct* ptr) { s32 pad; - Gfx* gfx = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 2); + Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 2); Gfx* gfx2 = gfx; Hilite* sp70; Vec3f sp64; @@ -254,12 +254,12 @@ void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) sp64.y = ptr->unk_0C; sp64.z = ptr->unk_10 * ptr->unk_04; - sp70 = func_800BCBF4(&sp64, globalCtx); + sp70 = func_800BCBF4(&sp64, play); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (gfx != NULL) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetTileSize(gfx++, 1, sp70->h.x1 & 0xFFFF, sp70->h.y1 & 0xFFFF, (sp70->h.x1 + 60) & 0xFFFF, (sp70->h.y1 + 60) & 0xFFFF); @@ -269,22 +269,22 @@ void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) Matrix_Translate(sp64.x, sp64.y, sp64.z, MTXMODE_NEW); Matrix_Scale(ptr->unk_04 * 0.018f, ptr->unk_04 * 0.018f, ptr->unk_04 * 0.018f, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00])); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); } Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW); Matrix_Scale(ptr->unk_04 * 2.5f, ptr->unk_04 * 2.5f, ptr->unk_04 * 2.5f, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZS(globalCtx->state.frames * 256, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZS(play->state.frames * 256, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 4.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 220, 220, 230, 192); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); @@ -292,21 +292,21 @@ void func_80A90FC0(EnTest6* this, GlobalContext* globalCtx, EnTest6Struct* ptr) gSPDisplayList(POLY_XLU_DISP++, gEffSparklesDL); gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void EnTest6_SetupAction(EnTest6* this, EnTest6ActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnTest6_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest6_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest6* this = THIS; s32 i; if (((ENTEST6_GET(&this->actor) == ENTEST6_24) || (ENTEST6_GET(&this->actor) == ENTEST6_25) || (ENTEST6_GET(&this->actor) == ENTEST6_26)) && - (globalCtx->playerActorCsIds[8] == -1)) { + (play->playerActorCsIds[8] == -1)) { Actor_MarkForDeath(&this->actor); return; } @@ -314,62 +314,62 @@ void EnTest6_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(this->lights); i++) { Lights_PointNoGlowSetInfo(&this->lights[i].info, this->actor.world.pos.x, (s32)this->actor.world.pos.y - 20, this->actor.world.pos.z, 255, 255, 180, -1); - this->lights[i].node = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lights[i].info); + this->lights[i].node = LightContext_InsertLight(play, &play->lightCtx, &this->lights[i].info); } this->unk_286 = 0; this->unk_274 = 0; this->unk_278 = 0; this->unk_276 = 99; - func_80A90730(this, globalCtx); + func_80A90730(this, play); EnTest6_SetupAction(this, func_80A9156C); } -void EnTest6_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest6_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest6* this = THIS; s32 i; - globalCtx->envCtx.lightSettings.ambientColor[0] = 0; - globalCtx->envCtx.lightSettings.ambientColor[1] = 0; - globalCtx->envCtx.lightSettings.ambientColor[2] = 0; - globalCtx->envCtx.lightSettings.diffuseColor1[0] = 0; - globalCtx->envCtx.lightSettings.diffuseColor1[1] = 0; - globalCtx->envCtx.lightSettings.diffuseColor1[2] = 0; - globalCtx->envCtx.lightSettings.diffuseColor2[0] = 0; - globalCtx->envCtx.lightSettings.diffuseColor2[1] = 0; - globalCtx->envCtx.lightSettings.diffuseColor2[2] = 0; - globalCtx->envCtx.lightSettings.fogColor[0] = 0; - globalCtx->envCtx.lightSettings.fogColor[1] = 0; - globalCtx->envCtx.lightSettings.fogColor[2] = 0; - globalCtx->envCtx.lightSettings.fogNear = 0; - globalCtx->envCtx.lightSettings.fogFar = 0; - globalCtx->envCtx.fillScreen = 0; + play->envCtx.lightSettings.ambientColor[0] = 0; + play->envCtx.lightSettings.ambientColor[1] = 0; + play->envCtx.lightSettings.ambientColor[2] = 0; + play->envCtx.lightSettings.diffuseColor1[0] = 0; + play->envCtx.lightSettings.diffuseColor1[1] = 0; + play->envCtx.lightSettings.diffuseColor1[2] = 0; + play->envCtx.lightSettings.diffuseColor2[0] = 0; + play->envCtx.lightSettings.diffuseColor2[1] = 0; + play->envCtx.lightSettings.diffuseColor2[2] = 0; + play->envCtx.lightSettings.fogColor[0] = 0; + play->envCtx.lightSettings.fogColor[1] = 0; + play->envCtx.lightSettings.fogColor[2] = 0; + play->envCtx.lightSettings.fogNear = 0; + play->envCtx.lightSettings.fogFar = 0; + play->envCtx.fillScreen = 0; for (i = 0; i < ARRAY_COUNT(this->lights); i++) { - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lights[i].node); + LightContext_RemoveLight(play, &play->lightCtx, this->lights[i].node); } } -void func_80A9156C(EnTest6* this, GlobalContext* globalCtx) { +void func_80A9156C(EnTest6* this, PlayState* play) { switch (ENTEST6_GET(&this->actor)) { case ENTEST6_24: case ENTEST6_25: - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[8], NULL); - this->unk_284 = ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8]); + ActorCutscene_Start(play->playerActorCsIds[8], NULL); + this->unk_284 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); EnTest6_SetupAction(this, func_80A91760); } break; case ENTEST6_26: - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[8], NULL); - this->unk_284 = ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8]); + ActorCutscene_Start(play->playerActorCsIds[8], NULL); + this->unk_284 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); EnTest6_SetupAction(this, func_80A92188); } break; @@ -383,7 +383,7 @@ void func_80A9156C(EnTest6* this, GlobalContext* globalCtx) { } } -void func_80A91690(EnTest6* this, GlobalContext* globalCtx) { +void func_80A91690(EnTest6* this, PlayState* play) { this->unk_274 = 90; this->unk_27A = 100; this->unk_286 = 0; @@ -394,31 +394,31 @@ void func_80A91690(EnTest6* this, GlobalContext* globalCtx) { } } -void func_80A916F0(EnTest6* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A916F0(EnTest6* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; - globalCtx->unk_18844 = 0; - ActorCutscene_Stop(globalCtx->playerActorCsIds[8]); - func_800B7298(globalCtx, NULL, 6); + play->unk_18844 = 0; + ActorCutscene_Stop(play->playerActorCsIds[8]); + func_800B7298(play, NULL, 6); func_80A90C34(); Distortion_ClearType(0x20); Actor_MarkForDeath(&this->actor); } -void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { - Input* input = CONTROLLER1(&globalCtx->state); +void func_80A91760(EnTest6* this, PlayState* play) { + Input* input = CONTROLLER1(&play->state); s16 temp_s0; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Camera* sp78; Vec3f sp6C; Vec3f sp60; Vec3f sp54; s32 i; f32 sp4C; - Camera* temp_s3 = Play_GetCamera(globalCtx, this->unk_284); + Camera* temp_s3 = Play_GetCamera(play, this->unk_284); - sp78 = Play_GetCamera(globalCtx, CAM_ID_MAIN); + sp78 = Play_GetCamera(play, CAM_ID_MAIN); switch (this->unk_274) { case 90: @@ -432,10 +432,10 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { case 91: this->unk_15C += this->unk_14C; - func_800FD59C(globalCtx, &D_80A9404C, this->unk_15C); - func_800FD5E0(globalCtx, &D_80A94050, this->unk_15C); - func_800FD654(globalCtx, &D_80A94048, this->unk_15C); - func_800FD698(globalCtx, D_80A94054, D_80A94058, this->unk_15C); + func_800FD59C(play, &D_80A9404C, this->unk_15C); + func_800FD5E0(play, &D_80A94050, this->unk_15C); + func_800FD654(play, &D_80A94048, this->unk_15C); + func_800FD698(play, D_80A94054, D_80A94058, this->unk_15C); if (this->unk_27A == 90) { this->unk_282 = 0; @@ -470,7 +470,7 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { func_80A90C08(0x78); Distortion_SetType(0x20); Distortion_SetCountdown(80); - globalCtx->unk_18844 = 1; + play->unk_18844 = 1; this->unk_274 = 95; } break; @@ -484,10 +484,10 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { this->unk_282 -= 25; } - func_800FD59C(globalCtx, &D_80A9404C, this->unk_15C); - func_800FD5E0(globalCtx, &D_80A94050, this->unk_15C); - func_800FD654(globalCtx, &D_80A94048, this->unk_15C); - func_800FD698(globalCtx, D_80A94054 + this->unk_282, D_80A94058 + this->unk_282, this->unk_15C); + func_800FD59C(play, &D_80A9404C, this->unk_15C); + func_800FD5E0(play, &D_80A94050, this->unk_15C); + func_800FD654(play, &D_80A94048, this->unk_15C); + func_800FD698(play, D_80A94054 + this->unk_282, D_80A94058 + this->unk_282, this->unk_15C); this->unk_278 -= this->unk_27C; temp_s0 = this->unk_278; @@ -524,7 +524,7 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { this->unk_14C = 0.1f; func_80A90C34(); Distortion_ClearType(0x20); - globalCtx->unk_18844 = 0; + play->unk_18844 = 0; if (this->unk_254 != NULL) { ZeldaArena_Free(this->unk_254); } @@ -534,30 +534,30 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { case 99: this->unk_15C -= this->unk_14C; - func_800FD59C(globalCtx, &D_80A9404C, this->unk_15C); - func_800FD5E0(globalCtx, &D_80A94050, this->unk_15C); - func_800FD654(globalCtx, &D_80A94048, this->unk_15C); - func_800FD698(globalCtx, D_80A94054, D_80A94058, this->unk_15C); + func_800FD59C(play, &D_80A9404C, this->unk_15C); + func_800FD5E0(play, &D_80A94050, this->unk_15C); + func_800FD654(play, &D_80A94048, this->unk_15C); + func_800FD698(play, D_80A94054, D_80A94058, this->unk_15C); break; } if (this->unk_286 != 0) { - func_800B7298(globalCtx, NULL, 7); + func_800B7298(play, NULL, 7); } else { if (this->unk_27A == 90) { - func_800B7298(globalCtx, NULL, 0x42); + func_800B7298(play, NULL, 0x42); } if (this->unk_27A == 70) { - func_800B7298(globalCtx, NULL, 0x52); + func_800B7298(play, NULL, 0x52); } if (this->unk_27A == 30) { - func_800B7298(globalCtx, NULL, 0x51); + func_800B7298(play, NULL, 0x51); } if (this->unk_27A == 5) { - func_800B7298(globalCtx, NULL, 0x4A); + func_800B7298(play, NULL, 0x4A); } } @@ -577,13 +577,13 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { VEC3F_LERPIMPDST(&sp60, &temp_s3->eye, &sp54, sp4C); - Play_CameraSetAtEye(globalCtx, this->unk_284, &sp6C, &sp60); + Play_CameraSetAtEye(play, this->unk_284, &sp6C, &sp60); } else if ((this->unk_27A < 11) && (this->unk_27A > 0)) { temp_s3->fov += (sp78->fov - temp_s3->fov) / this->unk_27A; } if (this->unk_286 != 0) { - func_80A90C54(globalCtx, this->unk_286 * 0.05f); + func_80A90C54(play, this->unk_286 * 0.05f); temp_s3->fov += (sp78->fov - temp_s3->fov) * 0.05f; this->unk_286++; if (this->unk_286 >= 20) { @@ -600,13 +600,13 @@ void func_80A91760(EnTest6* this, GlobalContext* globalCtx) { } if (DECR(this->unk_27A) == 0) { - func_80A916F0(this, globalCtx); - globalCtx->msgCtx.ocarinaMode = 4; + func_80A916F0(this, play); + play->msgCtx.ocarinaMode = 4; } } -void func_80A920C8(EnTest6* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A920C8(EnTest6* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_27A = 120; this->unk_286 = 0; @@ -615,21 +615,21 @@ void func_80A920C8(EnTest6* this, GlobalContext* globalCtx) { this->actor.home.rot = player->actor.shape.rot; } -void func_80A92118(EnTest6* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A92118(EnTest6* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->actor.freezeTimer = 0; - globalCtx->unk_18844 = 0; - ActorCutscene_Stop(globalCtx->playerActorCsIds[8]); - func_800B7298(globalCtx, NULL, 6); + play->unk_18844 = 0; + ActorCutscene_Stop(play->playerActorCsIds[8]); + func_800B7298(play, NULL, 6); func_80A90C34(); Distortion_ClearType(0x20); Actor_MarkForDeath(&this->actor); } -void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { - Input* input = CONTROLLER1(&globalCtx->state); - Player* player = GET_PLAYER(globalCtx); +void func_80A92188(EnTest6* this, PlayState* play) { + Input* input = CONTROLLER1(&play->state); + Player* player = GET_PLAYER(play); Camera* camera; s32 pad; s16 sp46; @@ -637,48 +637,48 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { if (this->unk_27A > 115) { this->unk_160 += 0.2f; - func_80A90C54(globalCtx, this->unk_160); + func_80A90C54(play, this->unk_160); } else if (this->unk_27A > 90) { this->unk_160 -= 0.05f; - func_80A90C54(globalCtx, this->unk_160); + func_80A90C54(play, this->unk_160); } else if (this->unk_27A == 90) { this->unk_160 = 0.0f; - func_80A90D20(globalCtx); + func_80A90D20(play); } if (this->unk_27A == 1) { this->unk_160 = 0.0f; - func_80A90D20(globalCtx); + func_80A90D20(play); } else if (this->unk_27A < 17) { this->unk_160 -= 0.06666666f; - func_80A90C54(globalCtx, this->unk_160); + func_80A90C54(play, this->unk_160); } else if (this->unk_27A < 22) { this->unk_160 += 0.2f; - func_80A90C54(globalCtx, this->unk_160); + func_80A90C54(play, this->unk_160); } if (this->unk_27A == 115) { - func_800FD59C(globalCtx, &D_80A9406C, 1.0f); - func_800FD5E0(globalCtx, &D_80A94070, 1.0f); - func_800FD654(globalCtx, &D_80A94068, 1.0f); - func_800FD698(globalCtx, D_80A94074, D_80A94078, 1.0f); - globalCtx->unk_18844 = 1; + func_800FD59C(play, &D_80A9406C, 1.0f); + func_800FD5E0(play, &D_80A94070, 1.0f); + func_800FD654(play, &D_80A94068, 1.0f); + func_800FD698(play, D_80A94074, D_80A94078, 1.0f); + play->unk_18844 = 1; } if (this->unk_27A == 15) { - func_800FD59C(globalCtx, &D_80A9406C, 0.0f); - func_800FD5E0(globalCtx, &D_80A94070, 0.0f); - func_800FD654(globalCtx, &D_80A94068, 0.0f); - func_800FD698(globalCtx, D_80A94074, D_80A94078, 0.0f); - globalCtx->unk_18844 = 0; + func_800FD59C(play, &D_80A9406C, 0.0f); + func_800FD5E0(play, &D_80A94070, 0.0f); + func_800FD654(play, &D_80A94068, 0.0f); + func_800FD698(play, D_80A94074, D_80A94078, 0.0f); + play->unk_18844 = 0; } if (this->unk_286 >= 20) { - func_800FD59C(globalCtx, &D_80A9406C, this->unk_160); - func_800FD5E0(globalCtx, &D_80A94070, this->unk_160); - func_800FD654(globalCtx, &D_80A94068, this->unk_160); - func_800FD698(globalCtx, D_80A94074, D_80A94078, this->unk_160); - globalCtx->unk_18844 = 0; + func_800FD59C(play, &D_80A9406C, this->unk_160); + func_800FD5E0(play, &D_80A94070, this->unk_160); + func_800FD654(play, &D_80A94068, this->unk_160); + func_800FD698(play, D_80A94074, D_80A94078, this->unk_160); + play->unk_18844 = 0; } func_800B8F98(&player->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG); @@ -733,11 +733,11 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { break; } - func_80A92950(this, globalCtx); + func_80A92950(this, play); if (this->unk_27A == 115) { - sp44 = ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8]); - camera = Play_GetCamera(globalCtx, sp44); + sp44 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); + camera = Play_GetCamera(play, sp44); this->unk_258 = camera->at; this->unk_264 = camera->eye; @@ -748,11 +748,11 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { if ((this->unk_27A <= 115) && (this->unk_27A >= 16)) { func_80161998(D_80A93E80, &this->unk_18C); } else if (this->unk_27A < 16) { - sp46 = ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8]); + sp46 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); - Play_CameraSetAtEyeUp(globalCtx, sp46, &this->unk_258, &this->unk_264, &D_80A9405C); - Play_CameraSetFov(globalCtx, sp46, this->unk_270); - Play_CameraSetRoll(globalCtx, sp46, 0); + Play_CameraSetAtEyeUp(play, sp46, &this->unk_258, &this->unk_264, &D_80A9405C); + Play_CameraSetFov(play, sp46, this->unk_270); + Play_CameraSetRoll(play, sp46, 0); } switch (this->unk_27A) { @@ -769,23 +769,23 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { break; case 98: - func_800B7298(globalCtx, NULL, 0x40); + func_800B7298(play, NULL, 0x40); break; case 68: - func_800B7298(globalCtx, NULL, 0x41); + func_800B7298(play, NULL, 0x41); break; case 52: - func_800B7298(globalCtx, NULL, 0x58); + func_800B7298(play, NULL, 0x58); break; case 43: - func_800B7298(globalCtx, NULL, 0x72); + func_800B7298(play, NULL, 0x72); break; case 38: - func_800B7298(globalCtx, NULL, 7); + func_800B7298(play, NULL, 7); break; case 14: @@ -801,7 +801,7 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { } if ((this->unk_286 > 0) && (this->unk_286 < 20)) { - func_80A90C54(globalCtx, this->unk_286 * 0.05f); + func_80A90C54(play, this->unk_286 * 0.05f); this->unk_286++; if (this->unk_286 >= 20) { this->unk_27A = 15; @@ -815,26 +815,26 @@ void func_80A92188(EnTest6* this, GlobalContext* globalCtx) { } if (DECR(this->unk_27A) == 0) { - func_80A92118(this, globalCtx); + func_80A92118(this, play); } } -void EnTest6_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest6_Update(Actor* thisx, PlayState* play) { EnTest6* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { +void func_80A92950(EnTest6* this, PlayState* play) { s32 pad[2]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 temp_f0; s32 i; s32 temp_v0; - if (Cutscene_CheckActorAction(globalCtx, 0x1F9)) { - temp_v0 = Cutscene_GetActorActionIndex(globalCtx, 0x1F9); - this->unk_274 = globalCtx->csCtx.actorActions[temp_v0]->action; + if (Cutscene_CheckActorAction(play, 0x1F9)) { + temp_v0 = Cutscene_GetActorActionIndex(play, 0x1F9); + this->unk_274 = play->csCtx.actorActions[temp_v0]->action; switch (this->unk_274) { case 1: @@ -846,39 +846,39 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { this->unk_27C = 0; player->actor.shape.shadowDraw = NULL; - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_154 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } else { this->unk_154 = 150.0f; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 = globalCtx->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { + this->unk_280 = play->csCtx.actorActions[temp_v0]->startPos.y; } else { this->unk_280 = 38; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_150 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { + this->unk_150 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; } else { this->unk_150 = 480.0f; } break; case 3: - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)globalCtx->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; } else { this->unk_280 += 6; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_158 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { + this->unk_158 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; } else { this->unk_158 = -32.0f; } @@ -886,30 +886,30 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { break; case 4: - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)globalCtx->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; } else { this->unk_280 -= 4; } break; case 5: - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)globalCtx->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; } else { this->unk_280 -= 8; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_158 += (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { + this->unk_158 += (u32)play->csCtx.actorActions[temp_v0]->startPos.z; } else { this->unk_158 += 20.0f; } @@ -927,20 +927,20 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { this->unk_27C = 0; player->actor.shape.shadowDraw = NULL; - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_154 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } else { this->unk_154 = 100.0f; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_14C = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { + this->unk_14C = (u32)play->csCtx.actorActions[temp_v0]->startPos.y; } else { this->unk_14C = 20.0f; } - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_150 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { + this->unk_150 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; } else { this->unk_150 = 300.0f; } @@ -948,8 +948,8 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { break; case 7: - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_158 = (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_158 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } else { this->unk_158 = -5.0f; } @@ -957,8 +957,8 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { break; case 8: - if (globalCtx->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_158 += (u32)globalCtx->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { + this->unk_158 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; } else { this->unk_158 += 2.0f; } @@ -976,19 +976,19 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { return; case 9: - Play_SetRespawnData(&globalCtx->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), + Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; + play->unk_1887F = 2; if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; gSaveContext.eventInf[2] |= 0x80; } else { gSaveContext.respawnFlag = 2; } - globalCtx->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = 4; return; } } else { @@ -1057,14 +1057,14 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { case 9: if (gSaveContext.save.time > CLOCK_TIME(12, 0)) { - Play_SetRespawnData(&globalCtx->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), + Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; + play->unk_1887F = 2; gSaveContext.respawnFlag = 2; - globalCtx->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = 4; } return; } @@ -1092,7 +1092,7 @@ void func_80A92950(EnTest6* this, GlobalContext* globalCtx) { this->unk_278++; } -void func_80A93298(EnTest6* this, GlobalContext* globalCtx) { +void func_80A93298(EnTest6* this, PlayState* play) { s16 temp_s3; s16 temp_s4; f32 phi_f24; @@ -1101,14 +1101,14 @@ void func_80A93298(EnTest6* this, GlobalContext* globalCtx) { f32 cos; f32 sin; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->unk_148 = POLY_OPA_DISP; phi_f24 = 0.0f; temp_s3 = this->unk_27C; - temp_s4 = (s32)(Math_SinS(globalCtx->state.frames) * 12000.0f) + temp_s3 + 0x4E20; - phi_s2 = (globalCtx->state.frames & 0x3C) * 1024; + temp_s4 = (s32)(Math_SinS(play->state.frames) * 12000.0f) + temp_s3 + 0x4E20; + phi_s2 = (play->state.frames & 0x3C) * 1024; phi_s2 *= (this->unk_154 / 200.0f); this->unk_27C += (s16)this->unk_154; this->unk_27E = (s16)((this->unk_154 / 200.0f) * 256.0f); @@ -1122,7 +1122,7 @@ void func_80A93298(EnTest6* this, GlobalContext* globalCtx) { Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); Matrix_RotateZS(phi_s2, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255); gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); @@ -1136,7 +1136,7 @@ void func_80A93298(EnTest6* this, GlobalContext* globalCtx) { Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); Matrix_RotateZS(-phi_s2, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255); gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); @@ -1150,32 +1150,32 @@ void func_80A93298(EnTest6* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(D_80A94910); i++) { if (D_80A94910[i].unk_04 > 0.0f) { - D_80A94910[i].unk_14(this, globalCtx, &D_80A94910[i]); + D_80A94910[i].unk_14(this, play, &D_80A94910[i]); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A9369C(Actor* thisx, GlobalContext* globalCtx2) { +void func_80A9369C(Actor* thisx, PlayState* play2) { EnTest6* this = THIS; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; f32 temp_f20; f32 temp_f22; f32 phi_f26; s16 phi_s2; s16 sp78; s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 pad; if (this) {} - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); this->unk_148 = POLY_OPA_DISP; this->unk_27C += (s16)this->unk_154; this->unk_27E = this->unk_27C * 2; - sp78 = (globalCtx->state.frames & 0x3C) * 1024; + sp78 = (play->state.frames & 0x3C) * 1024; phi_s2 = this->unk_27C + 0x4000; switch (player->transformation) { @@ -1209,7 +1209,7 @@ void func_80A9369C(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateXS(phi_s2, MTXMODE_APPLY); Matrix_RotateZS(sp78, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(this->unk_148++, 0, 0xFF, this->unk_280, this->unk_280, this->unk_280, 255); gDPSetEnvColor(this->unk_148++, 235, 238, 235, 255); gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); @@ -1224,16 +1224,16 @@ void func_80A9369C(Actor* thisx, GlobalContext* globalCtx2) { POLY_OPA_DISP = this->unk_148; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A939E8(EnTest6* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - Player* player = GET_PLAYER(globalCtx); +void func_80A939E8(EnTest6* this, PlayState* play2) { + PlayState* play = play2; + Player* player = GET_PLAYER(play); f32 temp_f20; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (this->unk_274) { case 91: @@ -1252,7 +1252,7 @@ void func_80A939E8(EnTest6* this, GlobalContext* globalCtx2) { Matrix_RotateXS(-0x4000, MTXMODE_APPLY); Matrix_RotateZS(this->unk_278, MTXMODE_APPLY); - gSPMatrix(this->unk_148++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(this->unk_148++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255); gDPSetEnvColor(this->unk_148++, 245, 245, 200, this->unk_282); @@ -1271,11 +1271,11 @@ void func_80A939E8(EnTest6* this, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 128, 128, 128, this->unk_282 >> 1); gDPSetEnvColor(POLY_XLU_DISP++, 230, 230, 180, this->unk_282); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(this->unk_278 + (i << 2), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); } @@ -1295,24 +1295,24 @@ void func_80A939E8(EnTest6* this, GlobalContext* globalCtx2) { break; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnTest6_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTest6_Draw(Actor* thisx, PlayState* play) { EnTest6* this = THIS; if (this->unk_274 != 0) { switch (this->unk_276) { case 1: - func_80A93298(this, globalCtx); + func_80A93298(this, play); break; case 0: - func_80A9369C(thisx, globalCtx); + func_80A9369C(thisx, play); break; case 2: - func_80A939E8(this, globalCtx); + func_80A939E8(this, play); break; } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.h b/src/overlays/actors/ovl_En_Test6/z_en_test6.h index 0c1aab3b07..c34b6b8fbc 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.h +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.h @@ -5,7 +5,7 @@ struct EnTest6; -typedef void (*EnTest6ActionFunc)(struct EnTest6*, GlobalContext*); +typedef void (*EnTest6ActionFunc)(struct EnTest6*, PlayState*); #define ENTEST6_GET(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 8aacf408d5..bafcfff11d 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -11,28 +11,28 @@ #define THIS ((EnTest7*)thisx) -void EnTest7_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTest7_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTest7_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTest7_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTest7_Init(Actor* thisx, PlayState* play); +void EnTest7_Destroy(Actor* thisx, PlayState* play); +void EnTest7_Update(Actor* thisx, PlayState* play); +void EnTest7_Draw(Actor* thisx, PlayState* play); void EnTest7_SetupAction(EnTest7* this, EnTest7ActionFunc actionFunc); -void func_80AF19A8(EnTest7* this, GlobalContext* globalCtx); -void func_80AF1A2C(EnTest7* this, GlobalContext* globalCtx); -void func_80AF1CA0(EnTest7* this, GlobalContext* globalCtx); -void func_80AF1E44(EnTest7* this, GlobalContext* globalCtx); -void func_80AF1F48(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2030(EnTest7* this, GlobalContext* globalCtx); -void func_80AF21E8(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2318(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2350(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2854(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2938(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2AE8(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2C48(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2EC8(EnTest7* this, GlobalContext* globalCtx); -void func_80AF2F98(EnTest7* this, GlobalContext* globalCtx); -void func_80AF30F4(EnTest7* this, GlobalContext* globalCtx); +void func_80AF19A8(EnTest7* this, PlayState* play); +void func_80AF1A2C(EnTest7* this, PlayState* play); +void func_80AF1CA0(EnTest7* this, PlayState* play); +void func_80AF1E44(EnTest7* this, PlayState* play); +void func_80AF1F48(EnTest7* this, PlayState* play); +void func_80AF2030(EnTest7* this, PlayState* play); +void func_80AF21E8(EnTest7* this, PlayState* play); +void func_80AF2318(EnTest7* this, PlayState* play); +void func_80AF2350(EnTest7* this, PlayState* play); +void func_80AF2854(EnTest7* this, PlayState* play); +void func_80AF2938(EnTest7* this, PlayState* play); +void func_80AF2AE8(EnTest7* this, PlayState* play); +void func_80AF2C48(EnTest7* this, PlayState* play); +void func_80AF2EC8(EnTest7* this, PlayState* play); +void func_80AF2F98(EnTest7* this, PlayState* play); +void func_80AF30F4(EnTest7* this, PlayState* play); const ActorInit En_Test7_InitVars = { ACTOR_EN_TEST7, @@ -167,7 +167,7 @@ Vec3f D_80AF3414 = { 0.0f, 1.0f, 0.0f }; Vec3f D_80AF3420 = { 0.0f, 0.0f, 1.0f }; -void func_80AF0CDC(GlobalContext* globalCtx, EnTest7Struct2* arg1) { +void func_80AF0CDC(PlayState* play, EnTest7Struct2* arg1) { static MtxF D_80AF38B0; static Vec3f D_80AF38F0; static f32 D_80AF38FC; @@ -230,7 +230,7 @@ void func_80AF0CDC(GlobalContext* globalCtx, EnTest7Struct2* arg1) { arg1->unk_08.z += arg1->unk_1C; } -void func_80AF10D8(GlobalContext* globalCtx, EnTest7Struct2* arg1) { +void func_80AF10D8(PlayState* play, EnTest7Struct2* arg1) { arg1->unk_30.y += arg1->unk_38; arg1->unk_20 = Rand_Centered(); @@ -246,7 +246,7 @@ void func_80AF10D8(GlobalContext* globalCtx, EnTest7Struct2* arg1) { arg1->unk_08.z += arg1->unk_1C; } -void func_80AF118C(GlobalContext* globalCtx, EnTest7Struct2* arg1, EnTest7* this, s32 arg3, s32 arg4) { +void func_80AF118C(PlayState* play, EnTest7Struct2* arg1, EnTest7* this, s32 arg3, s32 arg4) { s32 pad[4]; EnTest7Struct2* ptr; s16 phi_s1; @@ -268,9 +268,9 @@ void func_80AF118C(GlobalContext* globalCtx, EnTest7Struct2* arg1, EnTest7* this } if (arg1->unk_00 == 1) { - func_80AF0CDC(globalCtx, arg1); + func_80AF0CDC(play, arg1); } else { - func_80AF10D8(globalCtx, arg1); + func_80AF10D8(play, arg1); } if (arg3) { @@ -320,17 +320,17 @@ void func_80AF118C(GlobalContext* globalCtx, EnTest7Struct2* arg1, EnTest7* this } } -void func_80AF14FC(GlobalContext* globalCtx2, EnTest7Struct2* arg1) { +void func_80AF14FC(PlayState* play2, EnTest7Struct2* arg1) { s32 pad[3]; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Mtx* temp_v0; EnTest7Struct2* ptr; s32 i; MtxF sp6C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C1C0(globalCtx->state.gfxCtx); + func_8012C1C0(play->state.gfxCtx); Matrix_Push(); @@ -362,7 +362,7 @@ void func_80AF14FC(GlobalContext* globalCtx2, EnTest7Struct2* arg1) { Matrix_Translate(0.0f, 30.0f, 0.0f, MTXMODE_APPLY); } - temp_v0 = Matrix_NewMtx(globalCtx->state.gfxCtx); + temp_v0 = Matrix_NewMtx(play->state.gfxCtx); if (temp_v0 != NULL) { gSPMatrix(POLY_OPA_DISP++, temp_v0, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_081628); @@ -373,7 +373,7 @@ void func_80AF14FC(GlobalContext* globalCtx2, EnTest7Struct2* arg1) { Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80AF1730(EnTest7Struct* arg0) { @@ -384,11 +384,11 @@ void func_80AF1730(EnTest7Struct* arg0) { arg0->unk_10 = 0; } -void EnTest7_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTest7_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTest7* this = THIS; - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); this->actor.world.rot.y = this->actor.shape.rot.y = player->actor.shape.rot.y; this->unk_144 = 0; @@ -412,47 +412,47 @@ void EnTest7_Init(Actor* thisx, GlobalContext* globalCtx2) { func_801A2E54(NA_BGM_SONG_OF_SOARING); } - if (globalCtx->playerActorCsIds[8] == -1) { + if (play->playerActorCsIds[8] == -1) { Actor_MarkForDeath(&this->actor); return; } - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); player2->stateFlags1 |= 0x20; Lights_PointNoGlowSetInfo(&this->lightInfo, (Math_SinS(this->unk_1E8E) * 90.0f) + player->actor.world.pos.x, player->actor.world.pos.y + 10.0f, (Math_CosS(this->unk_1E8E) * 90.0f) + player->actor.world.pos.z, 255, 255, 255, 255); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); } -void EnTest7_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTest7_Destroy(Actor* thisx, PlayState* play) { EnTest7* this = THIS; - ActorCutscene_Stop(globalCtx->playerActorCsIds[8]); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + ActorCutscene_Stop(play->playerActorCsIds[8]); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void func_80AF19A8(EnTest7* this, GlobalContext* globalCtx) { - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); +void func_80AF19A8(EnTest7* this, PlayState* play) { + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[8], NULL); + ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF1A2C); - globalCtx->unk_18844 = 1; + play->unk_18844 = 1; } } -void func_80AF1A2C(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF1A2C(EnTest7* this, PlayState* play) { Color_RGB8 sp34 = { 64, 0, 0 }; Color_RGB8 sp30 = { 220, 220, 255 }; f32 sp2C = this->unk_1E54 / 10.0f; - func_800FD59C(globalCtx, &sp30, sp2C); - func_800FD654(globalCtx, &sp34, sp2C); - func_800FD698(globalCtx, 2000, 4000, sp2C); + func_800FD59C(play, &sp30, sp2C); + func_800FD654(play, &sp34, sp2C); + func_800FD698(play, 2000, 4000, sp2C); if (this->unk_1E54 >= 10) { - Camera* camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); this->unk_1E60 = camera->eye; this->unk_1E6C = camera->at; @@ -465,7 +465,7 @@ void func_80AF1A2C(EnTest7* this, GlobalContext* globalCtx) { } } -void func_80AF1B68(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF1B68(EnTest7* this, PlayState* play) { this->unk_144 |= 2; if (this->unk_148.unk_04 < 11.0f) { @@ -477,7 +477,7 @@ void func_80AF1B68(EnTest7* this, GlobalContext* globalCtx) { if (this->unk_148.unk_00 < 11.0f) { this->unk_148.unk_00 += 1.0f; if (this->unk_148.unk_00 > 6.0f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_144 &= ~1; player->actor.draw = NULL; @@ -491,7 +491,7 @@ void func_80AF1B68(EnTest7* this, GlobalContext* globalCtx) { } } -void func_80AF1CA0(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF1CA0(EnTest7* this, PlayState* play) { Vec3f sp34; if (func_80183DE0(&this->unk_18CC)) { @@ -499,7 +499,7 @@ void func_80AF1CA0(EnTest7* this, GlobalContext* globalCtx) { } if (this->unk_18CC.frameCtrl.unk_10 > 60.0f) { - func_80AF1B68(this, globalCtx); + func_80AF1B68(this, play); } if ((this->unk_18CC.frameCtrl.unk_10 > 20.0f) && !(this->unk_144 & 0x40)) { @@ -514,7 +514,7 @@ void func_80AF1CA0(EnTest7* this, GlobalContext* globalCtx) { } if (Rand_ZeroOne() < 0.3f) { - Camera* camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); f32 rand = Rand_ZeroOne(); sp34.x = ((camera->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; @@ -529,15 +529,15 @@ void func_80AF1CA0(EnTest7* this, GlobalContext* globalCtx) { } } -void func_80AF1E44(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF1E44(EnTest7* this, PlayState* play) { Vec3f sp34; Camera* camera; f32 rand; - func_80AF1B68(this, globalCtx); + func_80AF1B68(this, play); if (Rand_ZeroOne() < 0.3f) { - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); rand = Rand_ZeroOne(); sp34.x = ((camera->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; sp34.y = ((camera->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; @@ -550,7 +550,7 @@ void func_80AF1E44(EnTest7* this, GlobalContext* globalCtx) { this->unk_18FC[1].y += 0x2EE0; } -void func_80AF1F48(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF1F48(EnTest7* this, PlayState* play) { s32 pad; s32 temp = this->unk_1E54 - 86; f32 temp_f0 = temp / 10.0f; @@ -572,7 +572,7 @@ void func_80AF1F48(EnTest7* this, GlobalContext* globalCtx) { func_80AF0C30(this->unk_15C, &sp20, 1); } -void func_80AF2030(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2030(EnTest7* this, PlayState* play) { s32 temp = this->unk_1E54 - 96; f32 four = 4; f32 sp1C = 1.0f - (temp / four); @@ -585,7 +585,7 @@ void func_80AF2030(EnTest7* this, GlobalContext* globalCtx) { this->unk_148.unk_10 -= 0x2EE0; this->actor.world.pos.y += 100.0f; - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); camera->player = NULL; camera->eye.x = ((camera->eye.x - this->unk_1E60.x) * sp1C) + this->unk_1E60.x; @@ -599,14 +599,14 @@ void func_80AF2030(EnTest7* this, GlobalContext* globalCtx) { MREG(66) = 255; MREG(67) = 255; MREG(68) = 255; - globalCtx->unk_18844 = 0; + play->unk_18844 = 0; this->unk_144 &= ~4; func_80AF082C(this, func_80AF21E8); func_80165690(); } } -void func_80AF21E8(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF21E8(EnTest7* this, PlayState* play) { s32 sp2C = this->unk_1E54 - 100; f32 sp1C; Color_RGB8 sp24 = { 64, 0, 0 }; @@ -622,16 +622,16 @@ void func_80AF21E8(EnTest7* this, GlobalContext* globalCtx) { } sp1C = 1.0f - (sp2C / 10.0f); - func_800FD59C(globalCtx, &sp20, sp1C); - func_800FD654(globalCtx, &sp24, sp1C); - func_800FD698(globalCtx, 2000, 4000, sp1C); + func_800FD59C(play, &sp20, sp1C); + func_800FD654(play, &sp24, sp1C); + func_800FD698(play, 2000, 4000, sp1C); if (this->unk_1E54 >= 110) { func_80AF082C(this, func_80AF2318); } } -void func_80AF2318(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2318(EnTest7* this, PlayState* play) { if (this->unk_1E54 >= 130) { func_80AF082C(this, func_80AF2350); } @@ -641,7 +641,7 @@ u16 D_80AF343C[] = { 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30, }; -void func_80AF2350(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2350(EnTest7* this, PlayState* play) { Vec3f sp2C; if (this) {} @@ -654,32 +654,32 @@ void func_80AF2350(EnTest7* this, GlobalContext* globalCtx) { this->unk_148.unk_10 -= 0x2EE0; - if (globalCtx->sceneNum == SCENE_SECOM) { - globalCtx->nextEntranceIndex = 0x2060; + if (play->sceneNum == SCENE_SECOM) { + play->nextEntranceIndex = 0x2060; } else if (ENTEST7_GET(&this->actor) == ENTEST7_26) { - func_80169F78(&globalCtx->state); + func_80169F78(&play->state); gSaveContext.respawn[2].playerParams = (gSaveContext.respawn[2].playerParams & 0xFF) | 0x600; gSaveContext.respawnFlag = -6; } else { - globalCtx->nextEntranceIndex = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; - if ((globalCtx->nextEntranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { - globalCtx->nextEntranceIndex = 0xCA0; - } else if ((globalCtx->nextEntranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { - globalCtx->nextEntranceIndex = 0xAE80; + play->nextEntranceIndex = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; + if ((play->nextEntranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { + play->nextEntranceIndex = 0xCA0; + } else if ((play->nextEntranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { + play->nextEntranceIndex = 0xAE80; } } - globalCtx->sceneLoadFlag = 0x14; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->unk_1887F = 2; gSaveContext.seqIndex = 0xFF; gSaveContext.nightSeqIndex = 0xFF; } -void func_80AF24D8(EnTest7* this, GlobalContext* globalCtx, f32 arg2) { +void func_80AF24D8(EnTest7* this, PlayState* play, f32 arg2) { Vec3f sp3C; Vec3f* pos; - Player* player = GET_PLAYER(globalCtx); - Camera* camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + Player* player = GET_PLAYER(play); + Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); pos = &player->actor.world.pos; camera->player = NULL; @@ -696,13 +696,13 @@ void func_80AF24D8(EnTest7* this, GlobalContext* globalCtx, f32 arg2) { camera->at.y += 1.4444444f; } -void func_80AF2654(EnTest7* this, GlobalContext* globalCtx, f32 arg2) { +void func_80AF2654(EnTest7* this, PlayState* play, f32 arg2) { Vec3f* pos; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Camera* camera; Vec3f sp30; - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); camera->player = NULL; pos = &player->actor.world.pos; @@ -722,41 +722,41 @@ void func_80AF2654(EnTest7* this, GlobalContext* globalCtx, f32 arg2) { camera->fov = ((this->unk_1E78 - camera->fov) * arg2) + camera->fov; } -void func_80AF2808(EnTest7* this, GlobalContext* globalCtx, f32 arg2) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF2808(EnTest7* this, PlayState* play, f32 arg2) { + Player* player = GET_PLAYER(play); player->actor.shape.rot.y += 0x2EE0; player->actor.scale.x = ((0.0f - this->unk_1E90) * arg2) + this->unk_1E90; player->actor.scale.z = ((0.0f - this->unk_1E94) * arg2) + this->unk_1E94; } -void func_80AF2854(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2854(EnTest7* this, PlayState* play) { f32 temp; f32 sixteen = 16.0f; if ((this->unk_1E54 >= 12) && (this->unk_1E54 < 31)) { temp = (this->unk_1E54 - 12) / 18.0f; - func_80AF24D8(this, globalCtx, temp); + func_80AF24D8(this, play, temp); } else if ((this->unk_1E54 >= 79) && (this->unk_1E54 < 96)) { temp = (this->unk_1E54 - 79) / sixteen; - func_80AF2654(this, globalCtx, temp); + func_80AF2654(this, play, temp); } if ((this->unk_1E54 >= 42) && (this->unk_1E54 < 69)) { temp = (this->unk_1E54 - 42) / 26.0f; - func_80AF2808(this, globalCtx, temp); + func_80AF2808(this, play, temp); } } -void func_80AF2938(EnTest7* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF2938(EnTest7* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->unk_1E98 = player->actor.draw; player->actor.draw = NULL; player->stateFlags2 |= 0x20000000; this->unk_144 |= 2; this->unk_148.unk_04 = 30.0f; - if (globalCtx->roomCtx.currRoom.unk3 != 1) { + if (play->roomCtx.currRoom.unk3 != 1) { func_80AF082C(this, func_80AF2AE8); } else { func_80AF082C(this, func_80AF2EC8); @@ -767,11 +767,11 @@ s16 D_80AF3450[] = { 0, 0x31C7 }; f32 D_80AF3454 = 3500.0f; -void func_80AF29C0(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF29C0(EnTest7* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - Camera* temp_s0 = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + Camera* temp_s0 = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); temp_s0->at.x = ((D_80AF3454 * Math_SinS(D_80AF3450[0]) * Math_CosS(D_80AF3450[1]))) + pos->x; temp_s0->at.y = (Math_SinS(D_80AF3450[1]) * D_80AF3454) + pos->y; @@ -782,29 +782,29 @@ void func_80AF29C0(EnTest7* this, GlobalContext* globalCtx) { this->actor.world.pos.z = temp_s0->at.z; } -void func_80AF2AE8(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2AE8(EnTest7* this, PlayState* play) { Camera* camera; - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); return; } - ActorCutscene_Start(globalCtx->playerActorCsIds[8], NULL); + ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF2C48); - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); this->unk_1E60 = camera->eye; this->unk_1E6C = camera->at; - func_80AF29C0(this, globalCtx); + func_80AF29C0(this, play); } -void func_80AF2BAC(EnTest7* this, GlobalContext* globalCtx, Vec3f* arg2, f32 arg3) { +void func_80AF2BAC(EnTest7* this, PlayState* play, Vec3f* arg2, f32 arg3) { f32 x; f32 y; f32 z; - Camera* camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); camera->player = NULL; x = ((camera->at.x - arg2->x) * arg3) + arg2->x; @@ -816,7 +816,7 @@ void func_80AF2BAC(EnTest7* this, GlobalContext* globalCtx, Vec3f* arg2, f32 arg camera->at.z = z; } -void func_80AF2C48(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2C48(EnTest7* this, PlayState* play) { f32 sp24 = (40 - this->unk_1E54) / 40.0f; Camera* camera; @@ -830,8 +830,8 @@ void func_80AF2C48(EnTest7* this, GlobalContext* globalCtx) { this->actor.world.pos.y = ((this->actor.world.pos.y - this->actor.home.pos.y) * sp24) + this->actor.home.pos.y; this->actor.world.pos.z = ((this->actor.world.pos.z - this->actor.home.pos.z) * sp24) + this->actor.home.pos.z; - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); - func_80AF2BAC(this, globalCtx, &this->actor.home.pos, sp24); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + func_80AF2BAC(this, play, &this->actor.home.pos, sp24); camera->at.x = this->actor.world.pos.x; camera->at.y = this->actor.world.pos.y + 40.0f; @@ -844,12 +844,12 @@ void func_80AF2C48(EnTest7* this, GlobalContext* globalCtx) { } } -void func_80AF2DB4(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2DB4(EnTest7* this, PlayState* play) { Camera* camera; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); camera->eye.x = (Math_SinS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->x; camera->eye.y = pos->y + 108.8042f; @@ -860,27 +860,27 @@ void func_80AF2DB4(EnTest7* this, GlobalContext* globalCtx) { camera->at.z = pos->z; } -void func_80AF2EC8(EnTest7* this, GlobalContext* globalCtx) { +void func_80AF2EC8(EnTest7* this, PlayState* play) { Camera* camera; - if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[8]); + if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { - ActorCutscene_Start(globalCtx->playerActorCsIds[8], NULL); + ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF2F98); - camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(globalCtx->playerActorCsIds[8])); + camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); this->unk_1E60 = camera->eye; this->unk_1E6C = camera->at; this->unk_1E54 = 40; - func_80AF2DB4(this, globalCtx); + func_80AF2DB4(this, play); } } -void func_80AF2F98(EnTest7* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - Player* player2 = GET_PLAYER(globalCtx); +void func_80AF2F98(EnTest7* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Player* player2 = GET_PLAYER(play); Vec3f sp2C; func_800B9010(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); @@ -909,8 +909,8 @@ void func_80AF2F98(EnTest7* this, GlobalContext* globalCtx) { } } -void func_80AF30F4(EnTest7* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AF30F4(EnTest7* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_1E54 > 90) { player->stateFlags1 &= ~0x20; @@ -919,22 +919,22 @@ void func_80AF30F4(EnTest7* this, GlobalContext* globalCtx) { } } -void EnTest7_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTest7_Update(Actor* thisx, PlayState* play) { EnTest7* this = THIS; - this->unk_1E58(this, globalCtx); + this->unk_1E58(this, play); if (this->actionFunc != NULL) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } this->unk_1E54++; - func_80AF118C(globalCtx, this->unk_15C, this, (this->unk_144 & 8) != 0, (this->unk_144 & 0x10) != 0); + func_80AF118C(play, this->unk_15C, this, (this->unk_144 & 8) != 0, (this->unk_144 & 0x10) != 0); } -s32 func_80AF31D0(GlobalContext* globalCtx, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, - Actor* thisx, Vec3f* scale, Vec3s* rot, Vec3f* pos) { +s32 func_80AF31D0(PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, Actor* thisx, + Vec3f* scale, Vec3s* rot, Vec3f* pos) { EnTest7* this = THIS; Vec3f sp18; @@ -945,16 +945,16 @@ s32 func_80AF31D0(GlobalContext* globalCtx, SkeletonInfo* skeletonInfo, s32 limb return true; } -void EnTest7_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTest7_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; EnTest7* this = THIS; s32 sp40; if (this->unk_144 & 1) { - Mtx* mtx = GRAPH_ALLOC(globalCtx->state.gfxCtx, ALIGN16(sizeof(Mtx) * this->unk_18CC.unk_18->unk_1)); + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(sizeof(Mtx) * this->unk_18CC.unk_18->unk_1)); if (mtx != NULL) { - func_8018450C(globalCtx, &this->unk_18CC, mtx, func_80AF31D0, NULL, &this->actor); + func_8018450C(play, &this->unk_18CC, mtx, func_80AF31D0, NULL, &this->actor); } else { return; } @@ -967,15 +967,14 @@ void EnTest7_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(this->unk_148.unk_08 * 100.0f, this->unk_148.unk_0C * 100.0f, this->unk_148.unk_08 * 100.0f, MTXMODE_APPLY); sp40 = this->unk_148.unk_00; - AnimatedMat_DrawStep(globalCtx, Lib_SegmentedToVirtual(&gameplay_keep_Matanimheader_0815D0), sp40); - Gfx_DrawDListXlu(globalCtx, gameplay_keep_DL_080FC8); + AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(&gameplay_keep_Matanimheader_0815D0), sp40); + Gfx_DrawDListXlu(play, gameplay_keep_DL_080FC8); Matrix_Pop(); } - func_80AF14FC(globalCtx, this->unk_15C); + func_80AF14FC(play, this->unk_15C); if (this->unk_144 & 4) { - func_800F9824(globalCtx, &globalCtx->envCtx, &globalCtx->view, globalCtx->state.gfxCtx, this->actor.world.pos, - 70.0f, 5.0f, 0, 0); + func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, this->actor.world.pos, 70.0f, 5.0f, 0, 0); } } diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.h b/src/overlays/actors/ovl_En_Test7/z_en_test7.h index a074c78750..ed12ab059f 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.h +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.h @@ -5,9 +5,9 @@ struct EnTest7; -typedef void (*EnTest7ActionFunc)(struct EnTest7*, GlobalContext*); -typedef void (*EnTest7UnkFunc)(struct EnTest7*, GlobalContext*); -typedef void (*EnTest7UnkDrawFunc)(Actor*, GlobalContext*); +typedef void (*EnTest7ActionFunc)(struct EnTest7*, PlayState*); +typedef void (*EnTest7UnkFunc)(struct EnTest7*, PlayState*); +typedef void (*EnTest7UnkDrawFunc)(Actor*, PlayState*); #define ENTEST7_GET(thisx) ((thisx)->params) 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 fe3aadc7b8..c090a050de 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -10,12 +10,12 @@ #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); -void func_8098FA70(EnTg* this, GlobalContext* globalCtx); +void func_8098FA70(EnTg* this, PlayState* play); #if 0 const ActorInit En_Tg_InitVars = { 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 de0c6fd2e3..b2303d0b52 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -5,7 +5,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_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index f642502401..8eb883a8a3 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -11,27 +11,27 @@ #define THIS ((EnThiefbird*)thisx) -void EnThiefbird_Init(Actor* thisx, GlobalContext* globalCtx); -void EnThiefbird_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnThiefbird_Update(Actor* thisx, GlobalContext* globalCtx); -void EnThiefbird_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnThiefbird_Init(Actor* thisx, PlayState* play); +void EnThiefbird_Destroy(Actor* thisx, PlayState* play); +void EnThiefbird_Update(Actor* thisx, PlayState* play); +void EnThiefbird_Draw(Actor* thisx, PlayState* play); void func_80C11538(EnThiefbird* this); -void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C11590(EnThiefbird* this, PlayState* play); void func_80C118E4(EnThiefbird* this); -void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx); -void func_80C11D14(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C1193C(EnThiefbird* this, PlayState* play); +void func_80C11D14(EnThiefbird* this, PlayState* play); void func_80C11DC0(EnThiefbird* this); -void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx); -void func_80C1215C(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C11DF0(EnThiefbird* this, PlayState* play); +void func_80C1215C(EnThiefbird* this, PlayState* play); void func_80C12308(EnThiefbird* this); -void func_80C12378(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C12378(EnThiefbird* this, PlayState* play); void func_80C1242C(EnThiefbird* this); -void func_80C124B0(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C124B0(EnThiefbird* this, PlayState* play); void func_80C126A8(EnThiefbird* this); -void func_80C126D8(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C126D8(EnThiefbird* this, PlayState* play); void func_80C12744(EnThiefbird* this); -void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx); +void func_80C127F4(EnThiefbird* this, PlayState* play); const ActorInit En_Thiefbird_InitVars = { ACTOR_EN_THIEFBIRD, @@ -144,15 +144,15 @@ static InitChainEntry sInitChain[] = { static Vec3f D_80C13920; static s32 D_80C1392C; -void EnThiefbird_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnThiefbird_Init(Actor* thisx, PlayState* play) { EnThiefbird* this = THIS; s32 i; ColliderJntSphElementDim* dim; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_thiefbird_Skel_0061A0, &object_thiefbird_Anim_000604, + SkelAnime_InitFlex(play, &this->skelAnime, &object_thiefbird_Skel_0061A0, &object_thiefbird_Anim_000604, this->jointTable, this->morphTable, 17); - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { dim = &this->collider.elements[i].dim; @@ -175,10 +175,10 @@ void EnThiefbird_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnThiefbird_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnThiefbird_Destroy(Actor* thisx, PlayState* play) { EnThiefbird* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80C10984(EnThiefbird* this, s32 arg1) { @@ -205,7 +205,7 @@ void func_80C10984(EnThiefbird* this, s32 arg1) { } } -s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) { +s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { static Gfx* D_80C13680[] = { object_thiefbird_DL_004348, object_thiefbird_DL_004B88, object_thiefbird_DL_0055E0 }; s32 isItemFound = false; s32 phi_a3 = 0; @@ -240,8 +240,8 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) { if (isItemFound) { func_801149A0(itemId2, slotId); this->unk_3E8 = object_thiefbird_DL_0033B0; - if (Message_GetState(&globalCtx->msgCtx) == 0) { - Message_StartTextbox(globalCtx, 0xF4, NULL); + if (Message_GetState(&play->msgCtx) == 0) { + Message_StartTextbox(play, 0xF4, NULL); } itemId1 = ITEM_BOTTLE; } else if (phi_a3 != 0) { @@ -264,8 +264,8 @@ s32 func_80C10B0C(EnThiefbird* this, GlobalContext* globalCtx) { this->unk_3E8 = D_80C13680[phi_a3 - 1]; } - if (Message_GetState(&globalCtx->msgCtx) == 0) { - Message_StartTextbox(globalCtx, 0xF5, NULL); + if (Message_GetState(&play->msgCtx) == 0) { + Message_StartTextbox(play, 0xF5, NULL); } } else { return false; @@ -300,8 +300,8 @@ void func_80C10DE8(s32 items[], s32 count, s32 item) { } } -s32 func_80C10E98(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80C10E98(PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_s0_2; s32 phi_s2; s32 spB0; @@ -390,7 +390,7 @@ s32 func_80C10E98(GlobalContext* globalCtx) { sp64.y = player->actor.world.pos.y + 20.0f; sp64.z = (Math_CosS(phi_s3) * 40.0f) + player->actor.world.pos.z; if (dropItem00Ids[i] != ITEM00_NO_DROP) { - Actor* temp_s1_5 = Item_DropCollectible(globalCtx, &sp64, dropItem00Ids[i]); + Actor* temp_s1_5 = Item_DropCollectible(play, &sp64, dropItem00Ids[i]); if (temp_s1_5 != NULL) { temp_s1_5->velocity.y = Rand_ZeroFloat(3.0f) + 6.0f; @@ -408,8 +408,8 @@ s32 func_80C10E98(GlobalContext* globalCtx) { return true; } -void func_80C11338(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C11338(EnThiefbird* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnItem00* item = NULL; f32 phi_f20 = 5000.0f; s32 i; @@ -418,7 +418,7 @@ void func_80C11338(EnThiefbird* this, GlobalContext* globalCtx) { this->unk_3EC = NULL; do { - item = (EnItem00*)SubS_FindActor(globalCtx, &item->actor, ACTORCAT_MISC, ACTOR_EN_ITEM00); + item = (EnItem00*)SubS_FindActor(play, &item->actor, ACTORCAT_MISC, ACTOR_EN_ITEM00); if (item != NULL) { if (item->unk152 > 0) { if (Actor_XZDistanceBetweenActors(&player->actor, &item->actor) > 10.0f) { @@ -451,11 +451,11 @@ void func_80C11454(EnThiefbird* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void func_80C114C0(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C114C0(EnThiefbird* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 11, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -467,8 +467,8 @@ void func_80C11538(EnThiefbird* this) { this->actionFunc = func_80C11590; } -void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C11590(EnThiefbird* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp38; SkelAnime_Update(&this->skelAnime); @@ -519,7 +519,7 @@ void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) { } if ((this->unk_18E == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x800000) && - (Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && (this->actor.depthInWater < -40.0f)) { + (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.depthInWater < -40.0f)) { func_80C118E4(this); } } @@ -531,8 +531,8 @@ void func_80C118E4(EnThiefbird* this) { this->actor.speedXZ = 5.0f; } -void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C1193C(EnThiefbird* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 pitch; SkelAnime_Update(&this->skelAnime); @@ -562,7 +562,7 @@ void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, rot, 4, 0x1000, 0x100); } - if ((this->unk_18E == 0) || (player->stateFlags1 & 0x800000) || (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || + if ((this->unk_18E == 0) || (player->stateFlags1 & 0x800000) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { @@ -571,10 +571,10 @@ void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { if (!(this->collider.base.atFlags & AT_BOUNCED)) { if ((D_80C1392C != 0) && CUR_UPG_VALUE(UPG_QUIVER) && ((STOLEN_ITEM_1 == STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 == STOLEN_ITEM_NONE)) && - (Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, globalCtx)) { + (Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, play)) { func_80C1242C(this); - } else if (func_80C10E98(globalCtx)) { - func_80C11338(this, globalCtx); + } else if (func_80C10E98(play)) { + func_80C11338(this, play); func_80C12744(this); } else { func_80C11538(this); @@ -604,7 +604,7 @@ void func_80C11C60(EnThiefbird* this) { this->actionFunc = func_80C11D14; } -void func_80C11D14(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C11D14(EnThiefbird* this, PlayState* play) { this->actor.colorFilterTimer = 40; if (this->unk_18E != 0) { this->unk_18E--; @@ -612,7 +612,7 @@ void func_80C11D14(EnThiefbird* this, GlobalContext* globalCtx) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { if (this->unk_18E < 38) { - func_80C114C0(this, globalCtx); + func_80C114C0(this, play); this->actor.speedXZ = 4.0f; } else { return; @@ -635,7 +635,7 @@ void func_80C11DC0(EnThiefbird* this) { this->actor.gravity = -0.5f; } -void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C11DF0(EnThiefbird* this, PlayState* play) { s32 i; s32 j; @@ -646,15 +646,15 @@ void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(globalCtx, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); + func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_HUGE); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_HUGE); for (i = 0; i < ARRAY_COUNT(D_80C13664); i++) { for (j = 0; j < this->unk_196[i]; j++) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, D_80C13664[i]); + Item_DropCollectible(play, &this->actor.world.pos, D_80C13664[i]); } } @@ -662,7 +662,7 @@ void func_80C11DF0(EnThiefbird* this, GlobalContext* globalCtx) { } } -void func_80C11F6C(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C11F6C(EnThiefbird* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_000278, -4.0f); func_80C10984(this, 15); if (this->actor.colChkInfo.damageEffect != 3) { @@ -692,20 +692,20 @@ void func_80C11F6C(EnThiefbird* this, GlobalContext* globalCtx) { this->unk_18E = 40; if (Rand_ZeroOne() < 0.9f) { - Item_DropCollectible(globalCtx, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); + Item_DropCollectible(play, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); } if (Rand_ZeroOne() < 0.6f) { - Item_DropCollectible(globalCtx, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); + Item_DropCollectible(play, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); } if (Rand_ZeroOne() < 0.3f) { - Item_DropCollectible(globalCtx, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); + Item_DropCollectible(play, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); } this->actionFunc = func_80C1215C; } -void func_80C1215C(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C1215C(EnThiefbird* this, PlayState* play) { f32 sp2C; if (this->unk_18E != 0) { @@ -714,7 +714,7 @@ void func_80C1215C(EnThiefbird* this, GlobalContext* globalCtx) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { if (this->unk_18E < 38) { - func_80C114C0(this, globalCtx); + func_80C114C0(this, play); this->actor.speedXZ = 4.0f; } else { return; @@ -755,7 +755,7 @@ void func_80C12308(EnThiefbird* this) { this->actionFunc = func_80C12378; } -void func_80C12378(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C12378(EnThiefbird* this, PlayState* play) { if (this->unk_18E != 0) { this->unk_18E--; } @@ -783,7 +783,7 @@ void func_80C1242C(EnThiefbird* this) { this->actor.speedXZ = 12.0f; } -void func_80C124B0(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C124B0(EnThiefbird* this, PlayState* play) { Actor* temp_v0; s16 temp_v1; @@ -796,7 +796,7 @@ void func_80C124B0(EnThiefbird* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 6, 0x1000, 0x100); Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &D_80C13920), 6, 0x1000, 0x100); - temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0); + temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); if (temp_v0 != NULL) { temp_v1 = temp_v0->world.rot.x - Actor_PitchToPoint(temp_v0, &this->actor.focus.pos); if (ABS_ALT(temp_v1) < 0x1800) { @@ -827,7 +827,7 @@ void func_80C126A8(EnThiefbird* this) { this->actionFunc = func_80C126D8; } -void func_80C126D8(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C126D8(EnThiefbird* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.shape.rot.x, 0x3000, 6, 0x1000); if (this->actor.playerHeightRel > 100.0f) { @@ -846,8 +846,8 @@ void func_80C12744(EnThiefbird* this) { this->skelAnime.playSpeed = 3.0f; } -void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C127F4(EnThiefbird* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v0; f32 temp_f0; @@ -866,7 +866,7 @@ void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx) { } if (this->unk_3EC == NULL) { - func_80C11338(this, globalCtx); + func_80C11338(this, play); } if (this->unk_3EC != NULL) { @@ -912,7 +912,7 @@ void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx) { } } -void func_80C12B1C(EnThiefbird* this, GlobalContext* globalCtx) { +void func_80C12B1C(EnThiefbird* this, PlayState* play) { ColliderJntSphElement* sph; s32 i; @@ -920,7 +920,7 @@ void func_80C12B1C(EnThiefbird* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~AT_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements->info); - func_80C114C0(this, globalCtx); + func_80C114C0(this, play); this->unk_194 = 0; for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { @@ -937,7 +937,7 @@ void func_80C12B1C(EnThiefbird* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; if (i != ARRAY_COUNT(this->colliderElements)) { sph = &this->collider.elements[i]; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, sph->info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sph->info.bumper.hitPos.x, sph->info.bumper.hitPos.y, sph->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } } else if (this->actor.colChkInfo.damageEffect == 2) { @@ -956,11 +956,11 @@ void func_80C12B1C(EnThiefbird* this, GlobalContext* globalCtx) { if (!Actor_ApplyDamage(&this->actor)) { this->actor.colChkInfo.health = 0; - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); func_80C10984(this, 40); func_80C11C60(this); } else { - func_80C11F6C(this, globalCtx); + func_80C11F6C(this, play); } } } @@ -995,12 +995,12 @@ void func_80C12D00(EnThiefbird* this) { } } -void EnThiefbird_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnThiefbird_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnThiefbird* this = THIS; - func_80C12B1C(this, globalCtx); - this->actionFunc(this, globalCtx); + func_80C12B1C(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; if (this->actor.colChkInfo.health != 0) { @@ -1009,16 +1009,16 @@ void EnThiefbird_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 25.0f, 50.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 25.0f, 50.0f, 7); if (this->actionFunc == func_80C1193C) { - 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); if (this->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); @@ -1036,8 +1036,7 @@ void EnThiefbird_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -s32 EnThiefbird_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnThiefbird_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnThiefbird* this = THIS; if ((limbIndex == 10) || (limbIndex == 11)) { @@ -1052,7 +1051,7 @@ s32 EnThiefbird_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } -void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 D_80C13698[] = { -1, 0, -1, 1, 3, -1, 2, 5, -1, -1, 7, 8, 9, -1, -1, 10, -1, }; @@ -1063,18 +1062,18 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi Collider_UpdateSpheres(limbIndex, &this->collider); if ((limbIndex == 10) || (limbIndex == 11)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], this->unk_3E4); POLY_OPA_DISP = &gfx[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (limbIndex == 16) { if (this->unk_3E8 != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_3E8 == object_thiefbird_DL_0033B0) { gfx = POLY_XLU_DISP; @@ -1082,7 +1081,7 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi gfx = POLY_OPA_DISP; } - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], this->unk_3E8); if (this->unk_3E8 == object_thiefbird_DL_0033B0) { @@ -1091,7 +1090,7 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi POLY_OPA_DISP = &gfx[2]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1108,13 +1107,13 @@ void EnThiefbird_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi } } -void func_80C13354(EnThiefbird* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80C13354(EnThiefbird* this, PlayState* play2) { + PlayState* play = play2; s32 i; Gfx* gfx; EnThiefbirdUnkStruct* ptr = &this->unk_3F0[0]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); @@ -1124,33 +1123,33 @@ void func_80C13354(EnThiefbird* this, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) { if (ptr->unk_22 != 0) { Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateYS(ptr->unk_1E, MTXMODE_APPLY); Matrix_RotateZS(ptr->unk_20, MTXMODE_APPLY); Matrix_Translate(0.0f, -10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(ptr->unk_18, ptr->unk_18, 1.0f, MTXMODE_APPLY); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], object_thiefbird_DL_0030D8); gfx = &gfx[2]; } } POLY_OPA_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnThiefbird_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnThiefbird_Draw(Actor* thisx, PlayState* play) { EnThiefbird* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnThiefbird_OverrideLimbDraw, EnThiefbird_PostLimbDraw, &this->actor); if (this->actor.colorFilterTimer > 0) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - func_80C13354(this, globalCtx); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + func_80C13354(this, play); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); Math_Vec3s_ToVec3f(&this->actor.focus.pos, &this->collider.elements[1].dim.worldSphere.center); } diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h index 990b4b2c56..6684f630bf 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h @@ -5,7 +5,7 @@ struct EnThiefbird; -typedef void (*EnThiefbirdActionFunc)(struct EnThiefbird*, GlobalContext*); +typedef void (*EnThiefbirdActionFunc)(struct EnThiefbird*, PlayState*); typedef struct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index 382bf2fdb1..d6ac472183 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -11,24 +11,24 @@ #define THIS ((EnTimeTag*)thisx) -void EnTimeTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTimeTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTimeTag_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTimeTag_Init(Actor* thisx, PlayState* play); +void EnTimeTag_Destroy(Actor* thisx, PlayState* play); +void EnTimeTag_Update(Actor* thisx, PlayState* play); -void func_80AC9FD4(EnTimeTag* this, GlobalContext* globalCtx); -void func_80AC9FE4(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA0A8(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA12C(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA184(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA268(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA348(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA3C0(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA418(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA5F8(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA714(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA724(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA7C4(EnTimeTag* this, GlobalContext* globalCtx); -void func_80ACA840(EnTimeTag* this, GlobalContext* globalCtx); +void func_80AC9FD4(EnTimeTag* this, PlayState* play); +void func_80AC9FE4(EnTimeTag* this, PlayState* play); +void func_80ACA0A8(EnTimeTag* this, PlayState* play); +void func_80ACA12C(EnTimeTag* this, PlayState* play); +void func_80ACA184(EnTimeTag* this, PlayState* play); +void func_80ACA268(EnTimeTag* this, PlayState* play); +void func_80ACA348(EnTimeTag* this, PlayState* play); +void func_80ACA3C0(EnTimeTag* this, PlayState* play); +void func_80ACA418(EnTimeTag* this, PlayState* play); +void func_80ACA5F8(EnTimeTag* this, PlayState* play); +void func_80ACA714(EnTimeTag* this, PlayState* play); +void func_80ACA724(EnTimeTag* this, PlayState* play); +void func_80ACA7C4(EnTimeTag* this, PlayState* play); +void func_80ACA840(EnTimeTag* this, PlayState* play); const ActorInit En_Time_Tag_InitVars = { ACTOR_EN_TIME_TAG, @@ -42,7 +42,7 @@ const ActorInit En_Time_Tag_InitVars = { (ActorFunc)NULL, }; -void EnTimeTag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTimeTag_Init(Actor* thisx, PlayState* play) { EnTimeTag* this = THIS; this->actionFunc = func_80ACA840; @@ -80,13 +80,13 @@ void EnTimeTag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTimeTag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTimeTag_Destroy(Actor* thisx, PlayState* play) { } -void func_80AC9FD4(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80AC9FD4(EnTimeTag* this, PlayState* play) { } -void func_80AC9FE4(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80AC9FE4(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = func_80AC9FD4; @@ -100,28 +100,28 @@ void func_80AC9FE4(EnTimeTag* this, GlobalContext* globalCtx) { } } -void func_80ACA0A8(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA0A8(EnTimeTag* this, PlayState* play) { EnTimeTag* this2 = this; - if ((globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 4)) { + if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.unk1202E == 4)) { if (this->actor.cutscene != -1) { this->actionFunc = func_80AC9FE4; ActorCutscene_SetIntentToPlay(this2->actor.cutscene); gSaveContext.unk_3DD0[3] = 0; } - globalCtx->msgCtx.ocarinaMode = 4; + play->msgCtx.ocarinaMode = 4; } } -void func_80ACA12C(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA12C(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { this->actionFunc = func_80ACA268; this->actor.textId = 0xC02; - Item_Give(globalCtx, ITEM_SONG_SOARING); + Item_Give(play, ITEM_SONG_SOARING); } } -void func_80ACA184(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA184(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actor.cutscene); @@ -133,68 +133,68 @@ void func_80ACA184(EnTimeTag* this, GlobalContext* globalCtx) { } } -void func_80ACA208(EnTimeTag* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_80ACA208(EnTimeTag* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = func_80ACA268; } } -void func_80ACA268(EnTimeTag* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80ACA268(EnTimeTag* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.textId == 0) { this->actionFunc = func_80ACA184; } else { this->actionFunc = func_80ACA208; } - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && - (Flags_GetSwitch(globalCtx, ENTIMETAG_GET_SWITCHFLAG(&this->actor)) || + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && + (Flags_GetSwitch(play, ENTIMETAG_GET_SWITCHFLAG(&this->actor)) || CHECK_QUEST_ITEM(QUEST_SONG_SOARING))) { this->actor.flags |= ACTOR_FLAG_1; - func_800B8614(&this->actor, globalCtx, 110.0f); + func_800B8614(&this->actor, play, 110.0f); } } -void func_80ACA348(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA348(EnTimeTag* this, PlayState* play) { if (this->actor.home.rot.x > 0) { this->actor.home.rot.x--; return; } if (this->actor.home.rot.z != 0) { - func_80151938(globalCtx, 0x1230); + func_80151938(play, 0x1230); } else { - func_80151938(globalCtx, 0x122D); + func_80151938(play, 0x122D); } this->actionFunc = func_80ACA418; } -void func_80ACA3C0(EnTimeTag* this, GlobalContext* globalCtx) { - if ((globalCtx->msgCtx.unk11F00->unk01 == 0) && (globalCtx->msgCtx.msgMode == 0x1B)) { +void func_80ACA3C0(EnTimeTag* this, PlayState* play) { + if ((play->msgCtx.unk11F00->unk01 == 0) && (play->msgCtx.msgMode == 0x1B)) { this->actor.home.rot.x = 5; this->actionFunc = func_80ACA348; - globalCtx->msgCtx.unk11F10 = 0; - globalCtx->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + play->msgCtx.msgMode = 0; } } -void func_80ACA418(EnTimeTag* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80ACA418(EnTimeTag* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x101C: case 0x101D: case 0x101E: case 0x122D: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x101F: case 0x122A: case 0x1230: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80ACA5F8; if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); @@ -202,13 +202,13 @@ void func_80ACA418(EnTimeTag* this, GlobalContext* globalCtx) { break; case 0x122B: - func_80152434(globalCtx, 0x3F); + func_80152434(play, 0x3F); this->actionFunc = func_80ACA3C0; this->actor.home.rot.z = 0; break; case 0x122E: - func_80152434(globalCtx, 0x40); + func_80152434(play, 0x40); this->actionFunc = func_80ACA3C0; this->actor.home.rot.z = 1; break; @@ -236,35 +236,35 @@ void func_80ACA418(EnTimeTag* this, GlobalContext* globalCtx) { } } -void func_80ACA5F8(EnTimeTag* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80ACA5F8(EnTimeTag* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (ENTIMETAG_GET_SWITCHFLAG(&this->actor) == 1) { - Message_StartTextbox(globalCtx, 0x101C, &this->actor); + Message_StartTextbox(play, 0x101C, &this->actor); } else { - Message_StartTextbox(globalCtx, 0x122B, &this->actor); + Message_StartTextbox(play, 0x122B, &this->actor); } this->actor.home.rot.x = 1; } else { - Message_StartTextbox(globalCtx, 0x122A, &this->actor); + Message_StartTextbox(play, 0x122A, &this->actor); if (0) {} - ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk_264 |= 4; - Actor_ChangeFocus(&this->actor, globalCtx, GET_PLAYER(globalCtx)->tatlActor); + ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 4; + Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); this->actor.home.rot.x = 0; } this->actionFunc = func_80ACA418; - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 110.0f); + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&this->actor, play, 110.0f); } } -void func_80ACA714(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA714(EnTimeTag* this, PlayState* play) { } -void func_80ACA724(EnTimeTag* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; - globalCtx->sceneLoadFlag = 0x14; +void func_80ACA724(EnTimeTag* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5) { + play->nextEntranceIndex = play->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; + play->sceneLoadFlag = 0x14; if (!ENTIMETAG_GET_E000(&this->actor)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_OC_DOOR_OPEN); } @@ -272,19 +272,19 @@ void func_80ACA724(EnTimeTag* this, GlobalContext* globalCtx) { } } -void func_80ACA7C4(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA7C4(EnTimeTag* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[63] & 1) && !(gSaveContext.save.weekEventReg[63] & 2)) { - func_800B7298(globalCtx, &this->actor, 7); - Message_StartTextbox(globalCtx, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); + func_800B7298(play, &this->actor, 7); + Message_StartTextbox(play, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); this->actionFunc = func_80ACA724; } } -void func_80ACA840(EnTimeTag* this, GlobalContext* globalCtx) { +void func_80ACA840(EnTimeTag* this, PlayState* play) { s16 temp_ft4; s16 temp_hi; - if ((globalCtx->sceneNum != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { + if ((play->sceneNum != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { temp_ft4 = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F temp_hi = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; if (gSaveContext.save.weekEventReg[63] & 1) { @@ -294,16 +294,16 @@ void func_80ACA840(EnTimeTag* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[63] |= 2; } } else if ((temp_ft4 == this->actor.home.rot.x) && (temp_hi == this->actor.home.rot.y) && - !Play_InCsMode(globalCtx)) { - func_800B7298(globalCtx, &this->actor, 7); - Message_StartTextbox(globalCtx, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); + !Play_InCsMode(play)) { + func_800B7298(play, &this->actor, 7); + Message_StartTextbox(play, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); this->actionFunc = func_80ACA724; } } } -void EnTimeTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTimeTag_Update(Actor* thisx, PlayState* play) { EnTimeTag* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h index 531b0aa902..7f420bc909 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h @@ -5,7 +5,7 @@ struct EnTimeTag; -typedef void (*EnTimeTagActionFunc)(struct EnTimeTag*, GlobalContext*); +typedef void (*EnTimeTagActionFunc)(struct EnTimeTag*, PlayState*); #define ENTIMETAG_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENTIMETAG_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) 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 153bb8722c..09e3bef208 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -11,40 +11,40 @@ #define THIS ((EnTite*)thisx) -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 func_80893ED4(EnTite* this); -void func_80893F30(EnTite* this, GlobalContext* globalCtx); +void func_80893F30(EnTite* this, PlayState* play); void func_80893FD0(EnTite* this); -void func_80894024(EnTite* this, GlobalContext* globalCtx); -void func_8089408C(EnTite* this, GlobalContext* globalCtx); -void func_808942B4(EnTite* this, GlobalContext* globalCtx); +void func_80894024(EnTite* this, PlayState* play); +void func_8089408C(EnTite* this, PlayState* play); +void func_808942B4(EnTite* this, PlayState* play); void func_80894414(EnTite* this); -void func_80894454(EnTite* this, GlobalContext* globalCtx); -void func_8089452C(EnTite* this, GlobalContext* globalCtx); -void func_808945B4(EnTite* this, GlobalContext* globalCtx); +void func_80894454(EnTite* this, PlayState* play); +void func_8089452C(EnTite* this, PlayState* play); +void func_808945B4(EnTite* this, PlayState* play); void func_808945EC(EnTite* this); -void func_80894638(EnTite* this, GlobalContext* globalCtx); +void func_80894638(EnTite* this, PlayState* play); void func_8089484C(EnTite* this); -void func_80894910(EnTite* this, GlobalContext* globalCtx); +void func_80894910(EnTite* this, PlayState* play); void func_80894B2C(EnTite* this); -void func_80894BC8(EnTite* this, GlobalContext* globalCtx); -void func_80894E0C(EnTite* this, GlobalContext* globalCtx); -void func_80895020(EnTite* this, GlobalContext* globalCtx); -void func_808951B8(EnTite* this, GlobalContext* globalCtx); -void func_80895424(EnTite* this, GlobalContext* globalCtx); +void func_80894BC8(EnTite* this, PlayState* play); +void func_80894E0C(EnTite* this, PlayState* play); +void func_80895020(EnTite* this, PlayState* play); +void func_808951B8(EnTite* this, PlayState* play); +void func_80895424(EnTite* this, PlayState* play); void func_808955E4(EnTite* this); -void func_80895640(EnTite* this, GlobalContext* globalCtx); +void func_80895640(EnTite* this, PlayState* play); void func_808956B8(EnTite* this); -void func_80895738(EnTite* this, GlobalContext* globalCtx); +void func_80895738(EnTite* this, PlayState* play); void func_80895A10(EnTite* this); -void func_80895AC0(EnTite* this, GlobalContext* globalCtx); +void func_80895AC0(EnTite* this, PlayState* play); void func_80895CB0(EnTite* this); -void func_80895D08(EnTite* this, GlobalContext* globalCtx); -void func_80895E28(EnTite* this, GlobalContext* globalCtx); +void func_80895D08(EnTite* this, PlayState* play); +void func_80895E28(EnTite* this, PlayState* play); const ActorInit En_Tite_InitVars = { ACTOR_EN_TITE, @@ -134,18 +134,18 @@ static InitChainEntry sInitChain[] = { static s32 D_80896B60 = 0; static Vec3f D_80896B64 = { 0.0f, 0.3f, 0.0f }; -void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Init(Actor* thisx, PlayState* play) { EnTite* this = THIS; s32 i; s32 j; Actor_ProcessInitChain(&this->actor, sInitChain); - 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(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); Actor_SetFocus(&this->actor, 20.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; this->unk_2C0 = 0x1D; @@ -183,10 +183,10 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTite_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Destroy(Actor* thisx, PlayState* play) { EnTite* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } void func_80893A18(EnTite* this) { @@ -194,16 +194,16 @@ void func_80893A18(EnTite* this) { this->collider.base.acFlags &= ~AC_HARD; } -s32 func_80893A34(EnTite* this, GlobalContext* globalCtx) { +s32 func_80893A34(EnTite* this, PlayState* play) { if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & 1) && - (func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 5)) { + (func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 5)) { return true; } return false; } -void func_80893A9C(EnTite* this, GlobalContext* globalCtx) { - if (func_80893A34(this, globalCtx)) { +void func_80893A9C(EnTite* this, PlayState* play) { + if (func_80893A34(this, play)) { func_808956B8(this); } else { func_80893FD0(this); @@ -233,17 +233,17 @@ void func_80893B70(EnTite* this) { } } -void func_80893BCC(EnTite* this, GlobalContext* globalCtx) { +void func_80893BCC(EnTite* this, PlayState* play) { Vec3f sp7C; s32 i; s32 j; if (this->actor.bgCheckFlags & 2) { - u32 surface = func_800C9BB8(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + u32 surface = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surface == COLPOLY_SURFACE_GROUND) || (surface == COLPOLY_SURFACE_SAND)) { for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { - func_800BBFB0(globalCtx, &this->limbPos[i], 1.0f, 2, 80, 15, 1); + func_800BBFB0(play, &this->limbPos[i], 1.0f, 2, 80, 15, 1); } } else if (surface == COLPOLY_SURFACE_SNOW) { Vec3f* ptr; @@ -254,7 +254,7 @@ void func_80893BCC(EnTite* this, GlobalContext* globalCtx) { sp7C.x = ptr->x + randPlusMinusPoint5Scaled(1.0f); sp7C.y = ptr->y + randPlusMinusPoint5Scaled(1.0f); sp7C.z = ptr->z + randPlusMinusPoint5Scaled(1.0f); - func_800B0DE0(globalCtx, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, + func_800B0DE0(play, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, (s32)Rand_ZeroFloat(16.0f) + 80, 15); } } @@ -274,12 +274,12 @@ void func_80893DD4(EnTite* this) { this->actor.flags &= ~ACTOR_FLAG_200; } -void func_80893E54(EnTite* this, GlobalContext* globalCtx) { +void func_80893E54(EnTite* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = COLTYPE_HIT6; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 9, 2, 0.2f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 9, 2, 0.2f, 0.2f); this->actor.flags |= ACTOR_FLAG_200; } } @@ -291,12 +291,12 @@ void func_80893ED4(EnTite* this) { this->actionFunc = func_80893F30; } -void func_80893F30(EnTite* this, GlobalContext* globalCtx) { +void func_80893F30(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); func_80893B70(this); if (this->unk_2BC > 0) { this->unk_2BC--; - } else if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 300.0f) && + } else if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 300.0f) && (this->actor.playerHeightRel < 80.0f)) { func_808945EC(this); } @@ -310,9 +310,9 @@ void func_80893FD0(EnTite* this) { this->actionFunc = func_80894024; } -void func_80894024(EnTite* this, GlobalContext* globalCtx) { +void func_80894024(EnTite* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_8089408C(this, globalCtx); + func_8089408C(this, play); } else { func_80893B70(this); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1000); @@ -320,7 +320,7 @@ void func_80894024(EnTite* this, GlobalContext* globalCtx) { } } -void func_8089408C(EnTite* this, GlobalContext* globalCtx) { +void func_8089408C(EnTite* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_tite_Anim_0004F8); if (!func_80893ADC(this)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); @@ -343,7 +343,7 @@ void func_8089408C(EnTite* this, GlobalContext* globalCtx) { sp70.x = this->actor.world.pos.x + (12.5f * sp64.x); sp70.y = this->actor.world.pos.y + 15.0f; sp70.z = this->actor.world.pos.z + (12.5f * sp64.z); - func_800B0DE0(globalCtx, &sp70, &sp64, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); + func_800B0DE0(play, &sp70, &sp64, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); this->actor.shape.rot.y += 0x4000; } @@ -362,19 +362,19 @@ void func_8089408C(EnTite* this, GlobalContext* globalCtx) { this->actionFunc = func_808942B4; } -void func_808942B4(EnTite* this, GlobalContext* globalCtx) { +void func_808942B4(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && (this->actor.velocity.y <= 0.0f)) { this->actor.speedXZ = 0.0f; this->collider.base.atFlags &= ~AT_HIT; if (!func_80893ADC(this)) { - func_80893BCC(this, globalCtx); + func_80893BCC(this, play); func_80894414(this); } else { this->actor.gravity = 0.0f; if (this->actor.velocity.y < -8.0f) { - func_8089452C(this, globalCtx); + func_8089452C(this, play); } else { this->actor.velocity.y = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); @@ -383,7 +383,7 @@ void func_808942B4(EnTite* this, GlobalContext* globalCtx) { } } else if (!(this->collider.base.atFlags & AT_HIT)) { this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { this->collider.base.atFlags &= ~AT_HIT; func_80894B2C(this); @@ -395,15 +395,15 @@ void func_80894414(EnTite* this) { this->actionFunc = func_80894454; } -void func_80894454(EnTite* this, GlobalContext* globalCtx) { +void func_80894454(EnTite* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || + if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if (!Actor_IsFacingPlayer(&this->actor, 0x2328)) { func_808945EC(this); } else { - func_80893A9C(this, globalCtx); + func_80893A9C(this, play); } } else { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1500); @@ -411,18 +411,18 @@ void func_80894454(EnTite* this, GlobalContext* globalCtx) { } } -void func_8089452C(EnTite* this, GlobalContext* globalCtx) { +void func_8089452C(EnTite* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); sp2C.y += this->actor.depthInWater; this->actor.velocity.y *= 0.75f; - EffectSsGRipple_Spawn(globalCtx, &sp2C, 0, 500, 0); + EffectSsGRipple_Spawn(play, &sp2C, 0, 500, 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER); this->actionFunc = func_808945B4; } -void func_808945B4(EnTite* this, GlobalContext* globalCtx) { +void func_808945B4(EnTite* this, PlayState* play) { if (func_80893B10(this)) { func_80894414(this); } @@ -435,7 +435,7 @@ void func_808945EC(EnTite* this) { this->actionFunc = func_80894638; } -void func_80894638(EnTite* this, GlobalContext* globalCtx) { +void func_80894638(EnTite* this, PlayState* play) { s16 temp_v0; s16 temp_v1; @@ -460,13 +460,13 @@ void func_80894638(EnTite* this, GlobalContext* globalCtx) { } } - if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || + if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater < 10.0f))) && Actor_IsFacingPlayer(&this->actor, 0xE38)) { if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.playerHeightRel <= 80.0f)) { - func_80893A9C(this, globalCtx); + func_80893A9C(this, play); } else { func_8089484C(this); } @@ -490,7 +490,7 @@ void func_8089484C(EnTite* this) { this->actionFunc = func_80894910; } -void func_80894910(EnTite* this, GlobalContext* globalCtx) { +void func_80894910(EnTite* this, PlayState* play) { Vec3f sp34; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f); @@ -502,10 +502,10 @@ void func_80894910(EnTite* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); sp34.y += this->actor.depthInWater; this->actor.velocity.y *= 0.75f; - EffectSsGRipple_Spawn(globalCtx, &sp34, 0, 500, 0); + EffectSsGRipple_Spawn(play, &sp34, 0, 500, 0); } } else { - func_80893BCC(this, globalCtx); + func_80893BCC(this, play); } if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && @@ -521,7 +521,7 @@ void func_80894910(EnTite* this, GlobalContext* globalCtx) { } } - if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || + if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.playerHeightRel <= 80.0f)) { @@ -547,7 +547,7 @@ void func_80894B2C(EnTite* this) { this->actionFunc = func_80894BC8; } -void func_80894BC8(EnTite* this, GlobalContext* globalCtx) { +void func_80894BC8(EnTite* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); SkelAnime_Update(&this->skelAnime); if (func_80893ADC(this) && (this->actor.velocity.y <= 0.0f)) { @@ -559,19 +559,19 @@ void func_80894BC8(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x40) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } else { - func_80893BCC(this, globalCtx); + func_80893BCC(this, play); } if ((this->actor.speedXZ == 0.0f) && ((this->actor.bgCheckFlags & 1) || func_80893ADC(this))) { this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.acFlags |= AC_ON; - if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || + if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) && (ABS_ALT(this->actor.shape.rot.x) < 4000) && (ABS_ALT(this->actor.shape.rot.z) < 4000))) { func_80893ED4(this); } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.playerHeightRel <= 80.0f) && Actor_IsFacingPlayer(&this->actor, 0x1770)) { - func_80893A9C(this, globalCtx); + func_80893A9C(this, play); } else { func_8089484C(this); } @@ -587,7 +587,7 @@ void func_80894DD0(EnTite* this) { this->actionFunc = func_80894E0C; } -void func_80894E0C(EnTite* this, GlobalContext* globalCtx) { +void func_80894E0C(EnTite* this, PlayState* play) { if (this->unk_2BC != 0) { this->unk_2BC--; } @@ -601,29 +601,29 @@ void func_80894E0C(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x40) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } else { - func_80893BCC(this, globalCtx); + func_80893BCC(this, play); } if (this->unk_2BC == 0) { - func_80893E54(this, globalCtx); + func_80893E54(this, play); if (this->actor.colChkInfo.health == 0) { - func_80895020(this, globalCtx); + func_80895020(this, play); } else if (this->unk_2B9 != 0) { func_808955E4(this); - } else if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || + } else if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) && (ABS_ALT(this->actor.shape.rot.x) < 4000) && (ABS_ALT(this->actor.shape.rot.z) < 4000))) { func_80893ED4(this); } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.playerHeightRel <= 80.0f) && Actor_IsFacingPlayer(&this->actor, 0x1770)) { - func_80893A9C(this, globalCtx); + func_80893A9C(this, play); } else { func_8089484C(this); } } } -void func_80895020(EnTite* this, GlobalContext* globalCtx) { +void func_80895020(EnTite* this, PlayState* play) { Vec3f sp74; s32 i; f32 temp_f0; @@ -632,11 +632,11 @@ void func_80895020(EnTite* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->collider.base.acFlags &= ~AC_ON; this->actor.colorFilterTimer = 0; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_10; this->unk_2BA = 1; - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, this->unk_2BE); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, this->unk_2BE); this->unk_2BC = 25; this->actor.gravity = -0.58f; this->actor.velocity.y = 0.0f; @@ -657,7 +657,7 @@ void func_80895020(EnTite* this, GlobalContext* globalCtx) { this->actionFunc = func_808951B8; } -void func_808951B8(EnTite* this, GlobalContext* globalCtx) { +void func_808951B8(EnTite* this, PlayState* play) { s32 i; this->unk_2BC--; @@ -665,8 +665,8 @@ void func_808951B8(EnTite* this, GlobalContext* globalCtx) { if (this->unk_2BC == 0) { for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { - func_800B3030(globalCtx, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->limbPos[i], 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 40, 7, 1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->limbPos[i], 11, NA_SE_EN_EXTINCT); } Actor_MarkForDeath(&this->actor); } else { @@ -692,7 +692,7 @@ void func_808952EC(EnTite* this) { this->actionFunc = func_80895424; } -void func_80895424(EnTite* this, GlobalContext* globalCtx) { +void func_80895424(EnTite* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.z, -0x8000, 4000); if (this->unk_2B8 != 0) { this->unk_2B8--; @@ -706,7 +706,7 @@ void func_80895424(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 1) { this->collider.base.acFlags |= AC_ON; if (this->actor.bgCheckFlags & 2) { - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } @@ -729,13 +729,13 @@ void func_808955E4(EnTite* this) { this->actionFunc = func_80895640; } -void func_80895640(EnTite* this, GlobalContext* globalCtx) { +void func_80895640(EnTite* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 4000); SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 1) { this->collider.base.acFlags |= AC_ON; this->actor.shape.yOffset = 0.0f; - func_80893BCC(this, globalCtx); + func_80893BCC(this, play); func_80893ED4(this); } } @@ -756,8 +756,8 @@ void func_808956FC(EnTite* this) { func_80893A18(this); } -void func_80895738(EnTite* this, GlobalContext* globalCtx) { - func_80893BCC(this, globalCtx); +void func_80895738(EnTite* this, PlayState* play) { + func_80893BCC(this, play); if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; this->actor.world.rot.y = BINANG_ROT180(this->actor.yawTowardsPlayer); @@ -779,32 +779,32 @@ void func_80895738(EnTite* this, GlobalContext* globalCtx) { this->unk_2BC--; Math_StepToF(&this->actor.speedXZ, 10.0f, 0.3f); this->actor.flags |= ACTOR_FLAG_1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (!func_80893A34(this, globalCtx)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (!func_80893A34(this, play)) { this->unk_2BC = 0; } } else if ((this->unk_2BC == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.3f)) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80893A18(this); - if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || + if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if (!Actor_IsFacingPlayer(&this->actor, 0x2328)) { func_808945EC(this); } else { - func_80893A9C(this, globalCtx); + func_80893A9C(this, play); } } this->actor.shape.rot.y += (s16)(this->actor.speedXZ * 768.0f); } -void func_8089595C(EnTite* this, GlobalContext* globalCtx) { +void func_8089595C(EnTite* this, PlayState* play) { Vec3f sp2C; sp2C.x = randPlusMinusPoint5Scaled(20.0f) + this->actor.world.pos.x; sp2C.y = this->actor.world.pos.y + 15.0f; sp2C.z = randPlusMinusPoint5Scaled(20.0f) + this->actor.world.pos.z; - func_800B0DE0(globalCtx, &sp2C, &gZeroVec3f, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); + func_800B0DE0(play, &sp2C, &gZeroVec3f, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); } void func_80895A10(EnTite* this) { @@ -818,14 +818,14 @@ void func_80895A10(EnTite* this) { this->actionFunc = func_80895AC0; } -void func_80895AC0(EnTite* this, GlobalContext* globalCtx) { +void func_80895AC0(EnTite* this, PlayState* play) { s16 temp_v1; s32 temp_v0; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (Rand_ZeroOne() < 0.25f) { - func_8089595C(this, globalCtx); + func_8089595C(this, play); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK); } @@ -846,8 +846,8 @@ void func_80895AC0(EnTite* this, GlobalContext* globalCtx) { } } - if ((this->actor.xzDistToPlayer < 240.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { - func_8089408C(this, globalCtx); + if ((this->actor.xzDistToPlayer < 240.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + func_8089408C(this, play); } else if (this->unk_2BC > 0) { this->unk_2BC--; this->actor.shape.rot.y += 0x100; @@ -867,16 +867,16 @@ void func_80895CB0(EnTite* this) { this->actionFunc = func_80895D08; } -void func_80895D08(EnTite* this, GlobalContext* globalCtx) { +void func_80895D08(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (Rand_ZeroOne() < 0.5f) { - func_8089595C(this, globalCtx); + func_8089595C(this, play); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK); } - if ((this->actor.xzDistToPlayer < 240.0f) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { - func_8089408C(this, globalCtx); + if ((this->actor.xzDistToPlayer < 240.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + func_8089408C(this, play); } else { this->unk_2BC--; if (this->unk_2BC == 0) { @@ -893,7 +893,7 @@ void func_80895DE8(EnTite* this) { this->actionFunc = func_80895E28; } -void func_80895E28(EnTite* this, GlobalContext* globalCtx) { +void func_80895E28(EnTite* this, PlayState* play) { Vec3f sp44; Vec3f sp38; s16 sp36; @@ -911,14 +911,14 @@ void func_80895E28(EnTite* this, GlobalContext* globalCtx) { sp38.y = 3.0f; sp38.z = 2.0f * Math_CosS(sp36); - func_800B0DE0(globalCtx, &sp44, &sp38, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); + func_800B0DE0(play, &sp44, &sp38, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); sp44.x = (2.0f * this->actor.world.pos.x) - sp44.x; sp44.z = (2.0f * this->actor.world.pos.z) - sp44.z; sp38.x *= -1.0f; sp38.z *= -1.0f; - func_800B0DE0(globalCtx, &sp44, &sp38, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); + func_800B0DE0(play, &sp44, &sp38, &D_80896B44, &D_80896B3C, &D_80896B40, 500, 50); if (Math_StepToF(&this->actor.shape.yOffset, 0.0f, 200.0f)) { this->actor.flags |= ACTOR_FLAG_1; @@ -928,7 +928,7 @@ void func_80895E28(EnTite* this, GlobalContext* globalCtx) { } } -void func_80895FF8(EnTite* this, GlobalContext* globalCtx) { +void func_80895FF8(EnTite* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~AT_HIT; @@ -942,14 +942,14 @@ void func_80895FF8(EnTite* this, GlobalContext* globalCtx) { if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { - func_80893E54(this, globalCtx); + func_80893E54(this, play); if (this->actor.shape.yOffset < 0.0f) { func_80895DE8(this); return; } if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } if (this->actor.colChkInfo.damageEffect != 0xF) { @@ -990,15 +990,15 @@ void func_80895FF8(EnTite* this, GlobalContext* globalCtx) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.5f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); } Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); if (this->actor.colChkInfo.health == 0) { - func_80895020(this, globalCtx); + func_80895020(this, play); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_DAMAGE); @@ -1012,7 +1012,7 @@ void func_80895FF8(EnTite* this, GlobalContext* globalCtx) { } } } else if ((this->actor.bgCheckFlags & 1) && (this->collider.base.acFlags & AC_ON) && - (this->actor.colChkInfo.health != 0) && (globalCtx->actorCtx.unk2 != 0) && + (this->actor.colChkInfo.health != 0) && (play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f))) { this->actor.flags |= ACTOR_FLAG_1; if (this->actor.shape.yOffset < 0.0f) { @@ -1027,7 +1027,7 @@ void func_80895FF8(EnTite* this, GlobalContext* globalCtx) { } } -void func_808963B4(EnTite* this, GlobalContext* globalCtx) { +void func_808963B4(EnTite* this, PlayState* play) { s32 i; Vec3f sp48; @@ -1035,30 +1035,30 @@ void func_808963B4(EnTite* this, GlobalContext* globalCtx) { for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { Math_Vec3f_Copy(&sp48, &this->limbPos[i]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &sp48, 0, 220, 0); + EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } } else if (this->actor.bgCheckFlags & 0x20) { - s32 temp = globalCtx->gameplayFrames & 7; + s32 temp = play->gameplayFrames & 7; if (!(temp & 1) && (this->actor.depthInWater < 10.0f)) { Math_Vec3f_Copy(&sp48, &this->limbPos[5 + (temp >> 1)]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &sp48, 0, 220, 0); + EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } } } -void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Update(Actor* thisx, PlayState* play) { EnTite* this = THIS; - func_80895FF8(this, globalCtx); + func_80895FF8(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actionFunc != func_808951B8) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 40.0f, 20.0f, this->unk_2C0); - func_808963B4(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 40.0f, 20.0f, this->unk_2C0); + func_808963B4(this, play); if (this->actor.bgCheckFlags & 1) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); if (this->unk_2B9 != 0) { @@ -1080,9 +1080,9 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; 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->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -1096,8 +1096,7 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnTite_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnTite_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTite* this = THIS; if (this->unk_2BA == -1) { @@ -1107,7 +1106,7 @@ s32 EnTite_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 D_80896B70[] = { -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, -1, -1, 2, -1, -1, -1, -1, 3, -1, -1, -1, -1, 4, -1, }; @@ -1135,7 +1134,7 @@ void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V this->unk_2BA = -1; } } else if (D_80896B8C[limbIndex] != -1) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); matrix = Matrix_GetCurrent(); matrix->xw = this->limbPos[D_80896B8C[limbIndex]].x; @@ -1143,18 +1142,18 @@ void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V matrix->zw = this->limbPos[D_80896B8C[limbIndex]].z; Matrix_RotateZS(this->actor.world.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, this->unk_3A8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTite_Draw(Actor* thisx, PlayState* play) { EnTite* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); @@ -1171,10 +1170,10 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = &gfx[4]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTite_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnTite_OverrideLimbDraw, EnTite_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 24f3bd6308..c17955ec8b 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -5,7 +5,7 @@ struct EnTite; -typedef void (*EnTiteActionFunc)(struct EnTite*, GlobalContext*); +typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); enum { /* -4 */ ENTITE_MINUS_4 = -4, 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 4dcea5b0dc..a0b83ff6dd 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -13,52 +13,52 @@ #define THIS ((EnTk*)thisx) -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); -void func_80AECA3C(EnTk* this, GlobalContext* globalCtx); -void func_80AECA90(EnTk* this, GlobalContext* globalCtx); -void func_80AECB0C(EnTk* this, GlobalContext* globalCtx); -void func_80AECB6C(EnTk* this, GlobalContext* globalCtx); -void func_80AECE0C(EnTk* this, GlobalContext* globalCtx); -s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx); -s32 func_80AED354(EnTk* this, GlobalContext* globalCtx, ScheduleResult* arg2); -s32 func_80AED38C(EnTk* this, GlobalContext* globalCtx, ScheduleResult* arg2); -void func_80AED4F8(EnTk* this, GlobalContext* globalCtx); -void func_80AED610(EnTk* this, GlobalContext* globalCtx); -void func_80AED898(EnTk* this, GlobalContext* globalCtx); -void func_80AED940(EnTk* this, GlobalContext* globalCtx); -void func_80AEDC4C(EnTk* this, GlobalContext* globalCtx); -void func_80AEDCBC(EnTk* this, GlobalContext* globalCtx); -void func_80AEDD4C(EnTk* this, GlobalContext* globalCtx); -void func_80AEDE10(EnTk* this, GlobalContext* globalCtx); -void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx); -void func_80AEE2A8(EnTk* this, GlobalContext* globalCtx); -void func_80AEE2C0(EnTk* this, GlobalContext* globalCtx); -void func_80AEE374(EnTk* this, GlobalContext* globalCtx); -void func_80AEE414(EnTk* this, GlobalContext* globalCtx); -void func_80AEE478(EnTk* this, GlobalContext* globalCtx); -void func_80AEE4D0(EnTk* this, GlobalContext* globalCtx); -void func_80AEE650(EnTk* this, GlobalContext* globalCtx); -void func_80AEE6B8(EnTk* this, GlobalContext* globalCtx); -void func_80AEE784(EnTk* this, GlobalContext* globalCtx); -void func_80AEE9B0(EnTk* this, GlobalContext* globalCtx); -void func_80AEEAD4(EnTk* this, GlobalContext* globalCtx); -void func_80AEEB88(EnTk* this, GlobalContext* globalCtx); -void func_80AEED38(EnTk* this, GlobalContext* globalCtx); -void func_80AEF048(EnTk* this, GlobalContext* globalCtx); -void func_80AEF094(EnTk* this, GlobalContext* globalCtx); -void func_80AEF15C(EnTk* this, GlobalContext* globalCtx); -void func_80AEF1B4(EnTk* this, GlobalContext* globalCtx); -void func_80AEF1C4(EnTk* this, GlobalContext* globalCtx); -void func_80AEF210(EnTk* this, GlobalContext* globalCtx); -void func_80AEF220(EnTk* this, GlobalContext* globalCtx); -void func_80AEF278(EnTk* this, GlobalContext* globalCtx); -void func_80AEF2C8(Actor* thisx, GlobalContext* globalCtx); -void func_80AEF2D8(Actor* thisx, GlobalContext* globalCtx); -void func_80AEF5F4(Actor* thisx, GlobalContext* globalCtx); +void func_80AECA3C(EnTk* this, PlayState* play); +void func_80AECA90(EnTk* this, PlayState* play); +void func_80AECB0C(EnTk* this, PlayState* play); +void func_80AECB6C(EnTk* this, PlayState* play); +void func_80AECE0C(EnTk* this, PlayState* play); +s32 func_80AECE60(EnTk* this, PlayState* play); +s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2); +s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2); +void func_80AED4F8(EnTk* this, PlayState* play); +void func_80AED610(EnTk* this, PlayState* play); +void func_80AED898(EnTk* this, PlayState* play); +void func_80AED940(EnTk* this, PlayState* play); +void func_80AEDC4C(EnTk* this, PlayState* play); +void func_80AEDCBC(EnTk* this, PlayState* play); +void func_80AEDD4C(EnTk* this, PlayState* play); +void func_80AEDE10(EnTk* this, PlayState* play); +void func_80AEDF5C(EnTk* this, PlayState* play); +void func_80AEE2A8(EnTk* this, PlayState* play); +void func_80AEE2C0(EnTk* this, PlayState* play); +void func_80AEE374(EnTk* this, PlayState* play); +void func_80AEE414(EnTk* this, PlayState* play); +void func_80AEE478(EnTk* this, PlayState* play); +void func_80AEE4D0(EnTk* this, PlayState* play); +void func_80AEE650(EnTk* this, PlayState* play); +void func_80AEE6B8(EnTk* this, PlayState* play); +void func_80AEE784(EnTk* this, PlayState* play); +void func_80AEE9B0(EnTk* this, PlayState* play); +void func_80AEEAD4(EnTk* this, PlayState* play); +void func_80AEEB88(EnTk* this, PlayState* play); +void func_80AEED38(EnTk* this, PlayState* play); +void func_80AEF048(EnTk* this, PlayState* play); +void func_80AEF094(EnTk* this, PlayState* play); +void func_80AEF15C(EnTk* this, PlayState* play); +void func_80AEF1B4(EnTk* this, PlayState* play); +void func_80AEF1C4(EnTk* this, PlayState* play); +void func_80AEF210(EnTk* this, PlayState* play); +void func_80AEF220(EnTk* this, PlayState* play); +void func_80AEF278(EnTk* this, PlayState* play); +void func_80AEF2C8(Actor* thisx, PlayState* play); +void func_80AEF2D8(Actor* thisx, PlayState* play); +void func_80AEF5F4(Actor* thisx, PlayState* play); static s32 D_80AF0050; @@ -199,15 +199,15 @@ void func_80AEC658(SkelAnime* skelAnime, f32 arg1, f32 arg2, f32* arg3, f32* arg } } -void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Init(Actor* thisx, PlayState* play) { s32 pad; EnTk* this = THIS; this->unk_2B0 = ENTK_GET_F(&this->actor); this->unk_2B1 = ENTK_GET_7F0(&this->actor); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(globalCtx, this->unk_2B1)) { + if (Flags_GetSwitch(play, this->unk_2B1)) { if (this->unk_2B0 == 0) { Actor_MarkForDeath(&this->actor); return; @@ -225,8 +225,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tk_Skel_00B9E8, NULL, this->jointTable, this->morphTable, - 18); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tk_Skel_00B9E8, NULL, this->jointTable, this->morphTable, 18); Animation_Change(&this->skelAnime, &object_tk_Anim_0030A4, 1.0f, 0.0f, Animation_GetLastFrame(&object_tk_Anim_0030A4.common), 0, 0.0f); this->unk_318 = 0; @@ -238,11 +237,11 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_2B0 == 2) { this->unk_316 = 0; this->actor.update = func_80AEF5F4; - func_80AECA3C(this, globalCtx); + func_80AECA3C(this, play); return; } - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.gravity = -1.0f; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -260,15 +259,15 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.room = -1; this->actor.update = func_80AEF2D8; this->unk_2D8 = 0.0f; - func_80AECB0C(this, globalCtx); - func_80AEF2D8(&this->actor, globalCtx); + func_80AECB0C(this, play); + func_80AEF2D8(&this->actor, play); break; case 0: this->unk_2D0 = -1; this->unk_310 = 0; this->unk_2E4 = 0; - func_80AED898(this, globalCtx); + func_80AED898(this, play); break; default: @@ -277,29 +276,29 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Destroy(Actor* thisx, PlayState* play) { EnTk* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80AECA3C(EnTk* this, GlobalContext* globalCtx) { +void func_80AECA3C(EnTk* this, PlayState* play) { this->unk_316 = 0; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actionFunc = func_80AECA90; } -void func_80AECA90(EnTk* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_80AEDE10(this, globalCtx); +void func_80AECA90(EnTk* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + func_80AEDE10(this, play); } else if (this->actor.xzDistToPlayer < 100.0f) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } } -void func_80AECB0C(EnTk* this, GlobalContext* globalCtx) { +void func_80AECB0C(EnTk* this, PlayState* play) { this->actor.speedXZ = 0.0f; this->unk_3CC = 0xFF; this->unk_2DC = 0.0f; @@ -307,7 +306,7 @@ void func_80AECB0C(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AECB6C; } -void func_80AECB6C(EnTk* this, GlobalContext* globalCtx) { +void func_80AECB6C(EnTk* this, PlayState* play) { f32 temp_f0; s32 temp2; s32 temp3; @@ -317,15 +316,15 @@ void func_80AECB6C(EnTk* this, GlobalContext* globalCtx) { u8 temp4; this->actor.textId = 0; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_80AED4F8(this, globalCtx); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + func_80AED4F8(this, play); return; } if (REG(15) != 0.0f) { - this->skelAnime.playSpeed = (f32)func_800FE620(globalCtx) / REG(15); + this->skelAnime.playSpeed = (f32)func_800FE620(play) / REG(15); } else { this->skelAnime.playSpeed = 0.0f; } @@ -347,8 +346,8 @@ void func_80AECB6C(EnTk* this, GlobalContext* globalCtx) { this->unk_2DC -= temp3; this->unk_2E0 += REG(15); - if (Schedule_RunScript(globalCtx, D_80AEF800, &sp34)) { - if ((this->unk_3CC != sp34.result) && !func_80AED354(this, globalCtx, &sp34)) { + if (Schedule_RunScript(play, D_80AEF800, &sp34)) { + if ((this->unk_3CC != sp34.result) && !func_80AED354(this, play, &sp34)) { return; } temp4 = sp34.result; @@ -366,7 +365,7 @@ void func_80AECB6C(EnTk* this, GlobalContext* globalCtx) { } this->unk_3CC = sp34.result; - func_80AECE0C(this, globalCtx); + func_80AECE0C(this, play); if (this->unk_3CE & 8) { this->actor.flags &= ~ACTOR_FLAG_1; @@ -374,15 +373,15 @@ void func_80AECB6C(EnTk* this, GlobalContext* globalCtx) { } } -void func_80AECE0C(EnTk* this, GlobalContext* globalCtx) { +void func_80AECE0C(EnTk* this, PlayState* play) { if (this->unk_3CC != 0) { if (1) {} - func_80AECE60(this, globalCtx); + func_80AECE60(this, play); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1555, 0xB6); } -s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { +s32 func_80AECE60(EnTk* this, PlayState* play) { EnDoor* door; f32 knots[265]; Vec3f sp94; @@ -398,7 +397,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(globalCtx, this->timePath, this->timePathWaypoint, &timePathTargetPos); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); this->actor.world.pos.y = timePathTargetPos.y; } else { timePathTargetPos = this->timePathTargetPos; @@ -412,7 +411,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { this->unk_3CE |= 4; } - if ((globalCtx->unk_18B4A != 0) || (this->timePathTimeSpeed == 0)) { + if ((play->unk_18B4A != 0) || (this->timePathTimeSpeed == 0)) { sp78 = this->timePathElapsedTime; sp74 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -430,7 +429,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp94, &sp88); } - if ((globalCtx->unk_18B4A != 0) || (this->timePathTimeSpeed == 0)) { + if ((play->unk_18B4A != 0) || (this->timePathTimeSpeed == 0)) { this->timePathElapsedTime = sp78; this->timePathWaypoint = sp74; this->timePathTargetPos = timePathTargetPos; @@ -441,7 +440,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { Actor* doorIter = NULL; do { - doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); + doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); if (doorIter != NULL) { if (Actor_XZDistanceBetweenActors(&this->actor, doorIter) <= 120.0f) { if (ABS(BINANG_SUB(Actor_YawToPoint(&this->actor, &doorIter->world.pos), @@ -458,7 +457,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { Actor* doorIter = NULL; do { - doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); + doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); if (doorIter != NULL) { if (Actor_XZDistanceBetweenActors(&this->actor, doorIter) <= 160.0f) { door = (EnDoor*)doorIter; @@ -487,28 +486,28 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) { } if (!(this->unk_3CE & 8) && !(this->unk_2CA & 0x10) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); + func_8013E8F8(&this->actor, play, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); } return false; } -s32 func_80AED354(EnTk* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2) { s32 phi_v1 = false; if (arg2->result != 0) { - phi_v1 = func_80AED38C(this, globalCtx, arg2); + phi_v1 = func_80AED38C(this, play, arg2); } return phi_v1; } -s32 func_80AED38C(EnTk* this, GlobalContext* globalCtx, ScheduleResult* arg2) { +s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2) { u16 sp1E = SCHEDULE_TIME_NOW; u8 params = ENTK_GET_F800(&this->actor); u16 phi_a1; s32 idx = arg2->result - 1; - this->timePath = SubS_GetAdditionalPath(globalCtx, params, D_80AEF8E8[idx + 1]); + this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[idx + 1]); if (this->timePath == NULL) { return false; } @@ -529,45 +528,45 @@ s32 func_80AED38C(EnTk* this, GlobalContext* globalCtx, ScheduleResult* arg2) { return true; } -void func_80AED4F8(EnTk* this, GlobalContext* globalCtx) { +void func_80AED4F8(EnTk* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actionFunc = func_80AED610; } -void func_80AED544(EnTk* this, GlobalContext* globalCtx) { +void func_80AED544(EnTk* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[31] & 0x10)) { - Message_StartTextbox(globalCtx, 0x13FE, &this->actor); + Message_StartTextbox(play, 0x13FE, &this->actor); gSaveContext.save.weekEventReg[31] |= 0x10; } else if (gSaveContext.save.time < CLOCK_TIME(9, 0)) { - Message_StartTextbox(globalCtx, 0x13FF, &this->actor); + Message_StartTextbox(play, 0x13FF, &this->actor); } else if (gSaveContext.save.time < CLOCK_TIME(12, 0)) { - Message_StartTextbox(globalCtx, 0x1400, &this->actor); + Message_StartTextbox(play, 0x1400, &this->actor); } else if (gSaveContext.save.time < CLOCK_TIME(15, 0)) { - Message_StartTextbox(globalCtx, 0x1401, &this->actor); + Message_StartTextbox(play, 0x1401, &this->actor); } else { - Message_StartTextbox(globalCtx, 0x1402, &this->actor); + Message_StartTextbox(play, 0x1402, &this->actor); } } -void func_80AED610(EnTk* this, GlobalContext* globalCtx) { +void func_80AED610(EnTk* this, PlayState* play) { if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - 0x1555, 0x71C)) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 4, &this->unk_2D4); - Message_StartTextbox(globalCtx, 0x13FD, &this->actor); + Message_StartTextbox(play, 0x13FD, &this->actor); } else if (CURRENT_DAY != 2) { - func_80AED544(this, globalCtx); - } else if (!Flags_GetSwitch(globalCtx, ENTK_GET_7F0(&this->actor))) { - Message_StartTextbox(globalCtx, 0x1403, &this->actor); + func_80AED544(this, play); + } else if (!Flags_GetSwitch(play, ENTK_GET_7F0(&this->actor))) { + Message_StartTextbox(play, 0x1403, &this->actor); } else if (gSaveContext.save.weekEventReg[60] & 2) { - func_80AED544(this, globalCtx); + func_80AED544(this, play); } else { - Message_StartTextbox(globalCtx, 0x1413, &this->actor); + Message_StartTextbox(play, 0x1413, &this->actor); } break; } @@ -580,8 +579,8 @@ void func_80AED610(EnTk* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x13FD: this->unk_2CA |= 0x10; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); @@ -590,13 +589,13 @@ void func_80AED610(EnTk* this, GlobalContext* globalCtx) { break; case 0x13FE: - func_80151938(globalCtx, 0x13FF); + func_80151938(play, 0x13FF); break; case 0x1413: func_801159EC(30); gSaveContext.save.weekEventReg[60] |= 2; - func_80151938(globalCtx, 0x13FF); + func_80151938(play, 0x13FF); break; case 0x13FF: @@ -629,7 +628,7 @@ void func_80AED610(EnTk* this, GlobalContext* globalCtx) { } } -void func_80AED898(EnTk* this, GlobalContext* globalCtx) { +void func_80AED898(EnTk* this, PlayState* play) { this->unk_316 = 0; this->actor.speedXZ = 0.0f; if (this->unk_2CA & 0x1000) { @@ -642,8 +641,8 @@ void func_80AED898(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AED940; } -void func_80AED940(EnTk* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AED940(EnTk* this, PlayState* play) { + Player* player = GET_PLAYER(play); Actor* actor; Vec3f sp44; @@ -674,7 +673,7 @@ void func_80AED940(EnTk* this, GlobalContext* globalCtx) { actor = NULL; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_TK); + actor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_TK); if (actor != NULL) { if (ENTK_GET_F(actor) == 1) { Math_Vec3f_Copy(&this->unk_2EC, &actor->world.pos); @@ -688,22 +687,22 @@ void func_80AED940(EnTk* this, GlobalContext* globalCtx) { } while (actor != NULL); } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_2CA &= ~0x80; this->actor.flags &= ~ACTOR_FLAG_10000; - globalCtx->msgCtx.msgMode = 0; - globalCtx->msgCtx.unk11F10 = 0; - func_80AEDE10(this, globalCtx); + play->msgCtx.msgMode = 0; + play->msgCtx.unk11F10 = 0; + func_80AEDE10(this, play); } else if (!(this->unk_2CA & 0x80)) { if (this->actor.xzDistToPlayer < 100.0f) { - func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); + func_8013E8F8(&this->actor, play, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); } } else { - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); } } -void func_80AEDBEC(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDBEC(EnTk* this, PlayState* play) { this->actor.params = -1; this->unk_2E8 = 0; this->actor.speedXZ = 0.0f; @@ -711,16 +710,16 @@ void func_80AEDBEC(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AEDC4C; } -void func_80AEDC4C(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDC4C(EnTk* this, PlayState* play) { if ((this->actor.params >= 0) && SubS_StartActorCutscene(&this->actor, this->cutscenes[1], this->actor.params, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_2E8 = ActorCutscene_GetLength(this->cutscenes[1]); - func_80151938(globalCtx, 0x1411); - func_80AEDCBC(this, globalCtx); + func_80151938(play, 0x1411); + func_80AEDCBC(this, play); } } -void func_80AEDCBC(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDCBC(EnTk* this, PlayState* play) { this->actor.speedXZ = 10.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 5, &this->unk_2D4); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_2EC); @@ -730,16 +729,16 @@ void func_80AEDCBC(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AEDD4C; } -void func_80AEDD4C(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDD4C(EnTk* this, PlayState* play) { this->unk_2E8--; if (this->unk_2E8 <= 0) { ActorCutscene_Stop(this->cutscenes[1]); - func_801477B4(globalCtx); + func_801477B4(play); Actor_MarkForDeath(&this->actor); } } -void func_80AEDDA0(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDDA0(EnTk* this, PlayState* play) { this->actor.speedXZ = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actor.flags |= ACTOR_FLAG_10000; @@ -747,10 +746,10 @@ void func_80AEDDA0(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AED940; } -void func_80AEDE10(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDE10(EnTk* this, PlayState* play) { switch (this->unk_2B0) { case 0: - if (Player_GetMask(globalCtx) == PLAYER_MASK_CAPTAIN) { + if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { this->unk_2E6 = 0x1404; break; } @@ -770,12 +769,12 @@ void func_80AEDE10(EnTk* this, GlobalContext* globalCtx) { break; case 4: - Message_StartTextbox(globalCtx, 0x140F, &this->actor); + Message_StartTextbox(play, 0x140F, &this->actor); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); break; case 3: - Message_StartTextbox(globalCtx, 0x1410, &this->actor); + Message_StartTextbox(play, 0x1410, &this->actor); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); break; } @@ -789,12 +788,12 @@ void func_80AEDE10(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AEDF5C; } -void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx) { +void func_80AEDF5C(EnTk* this, PlayState* play) { if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 0: switch (this->unk_2E6) { case 0x1404: @@ -811,12 +810,12 @@ void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx) { } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); } - Message_StartTextbox(globalCtx, this->unk_2E6, &this->actor); + Message_StartTextbox(play, this->unk_2E6, &this->actor); } break; case 0x1414: - Message_StartTextbox(globalCtx, this->unk_2E6, &this->actor); + Message_StartTextbox(play, this->unk_2E6, &this->actor); break; } break; @@ -829,66 +828,66 @@ void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx) { case 4: case 5: case 6: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1404: this->unk_2CA |= 0x1000; - func_80AED898(this, globalCtx); + func_80AED898(this, play); break; case 0x1405: - func_80151938(globalCtx, 0x1406); + func_80151938(play, 0x1406); break; case 0x1406: - func_80151938(globalCtx, 0x1407); + func_80151938(play, 0x1407); break; case 0x1407: - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - func_80151938(globalCtx, 0x1409); + func_80151938(play, 0x1409); } else { func_8019F230(); - func_80151938(globalCtx, 0x1408); + func_80151938(play, 0x1408); } break; case 0x1408: - func_80151938(globalCtx, 0x1407); + func_80151938(play, 0x1407); break; case 0x1409: - func_80151938(globalCtx, 0x140A); + func_80151938(play, 0x140A); break; case 0x140A: gSaveContext.save.weekEventReg[52] |= 0x80; case 0x140B: - func_80AEE784(this, globalCtx); + func_80AEE784(this, play); break; case 0x140D: this->unk_2CA |= 2; - if (globalCtx->msgCtx.choiceIndex == 0) { + if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - globalCtx->msgCtx.msgMode = 0x44; - func_80AEE2A8(this, globalCtx); + play->msgCtx.msgMode = 0x44; + func_80AEE2A8(this, play); } else { func_8019F230(); - func_80151938(globalCtx, 0x140E); + func_80151938(play, 0x140E); } break; case 0x140E: case 0x140F: case 0x1410: - func_80AEE784(this, globalCtx); + func_80AEE784(this, play); break; case 0x1414: - func_80AECA3C(this, globalCtx); + func_80AECA3C(this, play); break; } } @@ -896,17 +895,17 @@ void func_80AEDF5C(EnTk* this, GlobalContext* globalCtx) { } } -void func_80AEE2A8(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE2A8(EnTk* this, PlayState* play) { this->actionFunc = func_80AEE2C0; } -void func_80AEE2C0(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE2C0(EnTk* this, PlayState* play) { if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - func_80AEE374(this, globalCtx); + func_80AEE374(this, play); } } -s32 func_80AEE300(GlobalContext* globalCtx, Actor* arg1, Actor* arg2, void* _arg3) { +s32 func_80AEE300(PlayState* play, Actor* arg1, Actor* arg2, void* _arg3) { EnTkStruct* arg3 = (EnTkStruct*)_arg3; f32 temp_f0; @@ -920,13 +919,13 @@ s32 func_80AEE300(GlobalContext* globalCtx, Actor* arg1, Actor* arg2, void* _arg return false; } -void func_80AEE374(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE374(EnTk* this, PlayState* play) { EnTkStruct sp30; sp30.unk_00 = NULL; sp30.unk_04 = FLT_MAX; - SubS_FindActorCustom(globalCtx, &this->actor, NULL, ACTORCAT_NPC, ACTOR_EN_TK, &sp30, func_80AEE300); + SubS_FindActorCustom(play, &this->actor, NULL, ACTORCAT_NPC, ACTOR_EN_TK, &sp30, func_80AEE300); if (sp30.unk_00 == 0) { Actor_MarkForDeath(&this->actor); } else { @@ -935,25 +934,25 @@ void func_80AEE374(EnTk* this, GlobalContext* globalCtx) { } } -void func_80AEE414(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE414(EnTk* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_2CC, 2, 0xE38, 0x5B); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.shape.rot.y == this->unk_2CC) { - func_80AEE478(this, globalCtx); + func_80AEE478(this, play); } } -void func_80AEE478(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE478(EnTk* this, PlayState* play) { this->unk_310 = 2; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 3, &this->unk_2D4); this->actionFunc = func_80AEE4D0; } -void func_80AEE4D0(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE4D0(EnTk* this, PlayState* play) { Actor* bigPoe; if ((this->skelAnime.curFrame > 33.0f) && (this->skelAnime.curFrame < 41.0f)) { - func_800BBFB0(globalCtx, &this->unk_2B4, 10.0f, 2, 50, 30, 1); + func_800BBFB0(play, &this->unk_2B4, 10.0f, 2, 50, 30, 1); } if (Animation_OnFrame(&this->skelAnime, 33.0f)) { @@ -964,7 +963,7 @@ void func_80AEE4D0(EnTk* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 37.0f)) { bigPoe = NULL; do { - bigPoe = SubS_FindActor(globalCtx, bigPoe, ACTORCAT_PROP, ACTOR_EN_BIGPO); + bigPoe = SubS_FindActor(play, bigPoe, ACTORCAT_PROP, ACTOR_EN_BIGPO); if (bigPoe != NULL) { if ((bigPoe->params == 3) && (Actor_DistanceBetweenActors(&this->actor, bigPoe) < 80.0f)) { @@ -979,11 +978,11 @@ void func_80AEE4D0(EnTk* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80AEE650(this, globalCtx); + func_80AEE650(this, play); } } -void func_80AEE650(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE650(EnTk* this, PlayState* play) { if (this->unk_36C < ARRAY_COUNT(this->unk_324)) { Math_Vec3f_Copy(&this->unk_324[this->unk_36C], &this->actor.world.pos); this->unk_36C++; @@ -991,28 +990,28 @@ void func_80AEE650(EnTk* this, GlobalContext* globalCtx) { this->actionFunc = func_80AEE6B8; } -void func_80AEE6B8(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE6B8(EnTk* this, PlayState* play) { if (this->unk_2CA & 0x20) { if (this->unk_2E4 >= 3) { ActorCutscene_Stop(this->cutscenes[0]); - func_801477B4(globalCtx); - func_80AEDBEC(this, globalCtx); + func_801477B4(play); + func_80AEDBEC(this, play); } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_310 = 3; - func_80AEDE10(this, globalCtx); + func_80AEDE10(this, play); this->unk_2CA &= ~0x20; } } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_310 = 4; - func_80AEDE10(this, globalCtx); + func_80AEDE10(this, play); } } -void func_80AEE784(EnTk* this, GlobalContext* globalCtx) { +void func_80AEE784(EnTk* this, PlayState* play) { this->unk_2D0 = -1; this->unk_310 = 1; Math_Vec3s_Copy(&this->actor.world.rot, &this->actor.shape.rot); - func_80AEEAD4(this, globalCtx); + func_80AEEAD4(this, play); this->actionFunc = func_80AEE9B0; } @@ -1029,7 +1028,7 @@ s32 func_80AEE7E0(Vec3f* arg0, f32 arg1, Vec3f* arg2, s32 arg3) { return ret; } -s32 func_80AEE86C(EnTk* this, GlobalContext* globalCtx) { +s32 func_80AEE86C(EnTk* this, PlayState* play) { static Vec3f D_80AEFA78 = { 0.0f, 20.0f, 32.0f }; s32 pad; s32 ret = false; @@ -1039,40 +1038,40 @@ s32 func_80AEE86C(EnTk* this, GlobalContext* globalCtx) { Vec3f sp28; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80AEFA78, &sp28); - if ((BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &sp38, &sp34, &sp28) != BGCHECK_Y_MIN) && - (func_800C9BB8(&globalCtx->colCtx, sp38, sp34) == 1) && (this->unk_2D0 == (u32)1) && + if ((BgCheck_EntityRaycastFloor3(&play->colCtx, &sp38, &sp34, &sp28) != BGCHECK_Y_MIN) && + (func_800C9BB8(&play->colCtx, sp38, sp34) == 1) && (this->unk_2D0 == (u32)1) && (this->actor.xyzDistToPlayerSq <= SQ(115.0f)) && func_80AEE7E0(&this->actor.world.pos, 100.0f, this->unk_324, this->unk_36C) && (((this->unk_2CA & 2) && (Math_Vec3f_DistXZ(&this->unk_300, &sp28) >= 100.0f)) || !(this->unk_2CA & 2)) && - !Play_InCsMode(globalCtx)) { + !Play_InCsMode(play)) { Math_Vec3f_Copy(&this->unk_300, &sp28); ret = true; } return ret; } -void func_80AEE9B0(EnTk* this, GlobalContext* globalCtx) { - this->unk_30C(this, globalCtx); +void func_80AEE9B0(EnTk* this, PlayState* play) { + this->unk_30C(this, play); - func_80AEEAD4(this, globalCtx); + func_80AEEAD4(this, play); if (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_300) >= 100.0f) { this->unk_2CA &= ~2; } - if (func_80AEE86C(this, globalCtx)) { + if (func_80AEE86C(this, play)) { this->unk_310 = 2; - func_80AEDDA0(this, globalCtx); + func_80AEDDA0(this, play); } } -s32 func_80AEEA4C(EnTk* this, GlobalContext* globalCtx) { +s32 func_80AEEA4C(EnTk* this, PlayState* play) { s32 ret; if (this->unk_2CA & 1) { ret = 3; } else if (this->actor.xyzDistToPlayerSq < SQ(60.0f)) { ret = 0; - } else if (this->actor.isTargeted || (globalCtx->actorCtx.targetContext.unk_94 == &this->actor) || + } else if (this->actor.isTargeted || (play->actorCtx.targetContext.unk_94 == &this->actor) || (this->actor.xyzDistToPlayerSq < SQ(80.0f))) { ret = 1; } else { @@ -1081,36 +1080,36 @@ s32 func_80AEEA4C(EnTk* this, GlobalContext* globalCtx) { return ret; } -void func_80AEEAD4(EnTk* this, GlobalContext* globalCtx) { - s32 sp24 = func_80AEEA4C(this, globalCtx); +void func_80AEEAD4(EnTk* this, PlayState* play) { + s32 sp24 = func_80AEEA4C(this, play); if (sp24 != this->unk_2D0) { switch (sp24) { case 0: - func_80AEF220(this, globalCtx); + func_80AEF220(this, play); break; case 1: - func_80AEF048(this, globalCtx); + func_80AEF048(this, play); break; case 2: - func_80AEEB88(this, globalCtx); + func_80AEEB88(this, play); break; case 3: - func_80AEF15C(this, globalCtx); + func_80AEF15C(this, play); break; case 4: - func_80AEF1C4(this, globalCtx); + func_80AEF1C4(this, play); break; } this->unk_2D0 = sp24; } } -void func_80AEEB88(EnTk* this, GlobalContext* globalCtx) { +void func_80AEEB88(EnTk* this, PlayState* play) { s32 sp74; Vec3f sp68; s32 i; @@ -1124,8 +1123,8 @@ void func_80AEEB88(EnTk* this, GlobalContext* globalCtx) { sp68.y = this->actor.world.pos.y + 50.0f; sp68.z += this->actor.world.pos.z; - temp = BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &this->actor.floorPoly, &sp74, &sp68) - - this->actor.world.pos.y; + temp = + BgCheck_EntityRaycastFloor3(&play->colCtx, &this->actor.floorPoly, &sp74, &sp68) - this->actor.world.pos.y; if (temp <= -80.0f) { break; } @@ -1142,7 +1141,7 @@ void func_80AEEB88(EnTk* this, GlobalContext* globalCtx) { this->unk_30C = func_80AEED38; } -void func_80AEED38(EnTk* this, GlobalContext* globalCtx) { +void func_80AEED38(EnTk* this, PlayState* play) { f32 sp64; Vec3f sp58; s16 sp56 = this->actor.shape.rot.y; @@ -1154,7 +1153,7 @@ void func_80AEED38(EnTk* this, GlobalContext* globalCtx) { sp58.y += 30.0f; sp58.z += Math_CosS(sp56) * 20.0f; - if (BgCheck_SphVsFirstWall(&globalCtx->colCtx, &sp58, 20.0f)) { + if (BgCheck_SphVsFirstWall(&play->colCtx, &sp58, 20.0f)) { Math_Vec3f_Copy(&sp48, &this->actor.world.pos); sp56 = BINANG_ADD(this->actor.shape.rot.y, 0x4000); sp48.x += (Math_SinS(sp56) * 20.0f); @@ -1167,8 +1166,8 @@ void func_80AEED38(EnTk* this, GlobalContext* globalCtx) { sp3C.y += 30.0f; sp3C.z += Math_CosS(sp56) * 20.0f; - if (BgCheck_SphVsFirstWall(&globalCtx->colCtx, &sp48, 20.0f)) { - if (BgCheck_SphVsFirstWall(&globalCtx->colCtx, &sp3C, 20.0f)) { + if (BgCheck_SphVsFirstWall(&play->colCtx, &sp48, 20.0f)) { + if (BgCheck_SphVsFirstWall(&play->colCtx, &sp3C, 20.0f)) { this->unk_2CC = this->actor.shape.rot.y - 0x4000; } else { this->unk_2CC = this->actor.shape.rot.y - 0x4000; @@ -1190,19 +1189,19 @@ void func_80AEED38(EnTk* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } - if (Message_GetState(&globalCtx->msgCtx) == 0 && !Play_InCsMode(globalCtx) && (this->unk_2C6-- <= 0)) { - Message_StartTextbox(globalCtx, 0x140C, NULL); + if (Message_GetState(&play->msgCtx) == 0 && !Play_InCsMode(play) && (this->unk_2C6-- <= 0)) { + Message_StartTextbox(play, 0x140C, NULL); this->unk_2CA |= 0x4000; this->unk_2C6 = 200; } } -void func_80AEF048(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF048(EnTk* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); this->unk_30C = func_80AEF094; } -void func_80AEF094(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF094(EnTk* this, PlayState* play) { f32 sp2C; if (this->unk_2CA & 0x200) { @@ -1218,44 +1217,44 @@ void func_80AEF094(EnTk* this, GlobalContext* globalCtx) { } } -void func_80AEF15C(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF15C(EnTk* this, PlayState* play) { this->actor.speedXZ = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->unk_30C = func_80AEF1B4; } -void func_80AEF1B4(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF1B4(EnTk* this, PlayState* play) { } -void func_80AEF1C4(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF1C4(EnTk* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->unk_30C = func_80AEF210; } -void func_80AEF210(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF210(EnTk* this, PlayState* play) { } -void func_80AEF220(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF220(EnTk* this, PlayState* play) { this->actor.speedXZ = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->unk_30C = func_80AEF278; } -void func_80AEF278(EnTk* this, GlobalContext* globalCtx) { +void func_80AEF278(EnTk* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - 0x1555, 3, 0x1C7, 0); this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80AEF2C8(Actor* thisx, GlobalContext* globalCtx) { +void func_80AEF2C8(Actor* thisx, PlayState* play) { } -void func_80AEF2D8(Actor* thisx, GlobalContext* globalCtx) { +void func_80AEF2D8(Actor* thisx, PlayState* play) { s32 pad; EnTk* this = THIS; if (this->actor.draw != NULL) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } this->unk_320 = this->skelAnime.curFrame; @@ -1266,19 +1265,19 @@ void func_80AEF2D8(Actor* thisx, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_WALK); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 4); func_80AEC460(this); } -void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Update(Actor* thisx, PlayState* play) { s32 pad; EnTk* this = THIS; Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); this->unk_320 = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); func_80AEC460(this); @@ -1291,7 +1290,7 @@ void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2CA &= ~1; if (this->actor.floorBgId != BGCHECK_SCENE) { - BgDanpeiMovebg* platform = (BgDanpeiMovebg*)DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); + BgDanpeiMovebg* platform = (BgDanpeiMovebg*)DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (platform != NULL) { if (platform->dyna.actor.id == ACTOR_BG_DANPEI_MOVEBG) { @@ -1306,13 +1305,12 @@ void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); - if ((this->unk_2B0 == 0) && - (func_800C9B40(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 12)) { + if ((this->unk_2B0 == 0) && (func_800C9B40(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 12)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); this->unk_2CA |= 0x200; this->actor.velocity.y = 0.0f; @@ -1329,15 +1327,15 @@ void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AEF5F4(Actor* thisx, GlobalContext* globalCtx) { +void func_80AEF5F4(Actor* thisx, PlayState* play) { EnTk* this = THIS; this->unk_316 += 0x46C8; this->unk_318 = Math_SinS(this->unk_316) * 900.0f; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnTk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTk* this = THIS; if (limbIndex == 16) { @@ -1347,7 +1345,7 @@ s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80AEFA84 = { 0.0f, 0.0f, 4600.0f }; EnTk* this = THIS; @@ -1360,17 +1358,17 @@ void EnTk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec case 14: Matrix_MultVec3f(&D_80AEFA84, &this->unk_2B4); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_tk_DL_00B530); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); break; } } } -void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTk_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80AEFA90[] = { object_tk_Tex_004390, object_tk_Tex_004B90, @@ -1379,15 +1377,15 @@ void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnTk* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 25); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AEFA90[this->unk_2C2])); Matrix_RotateYS(this->unk_318, MTXMODE_APPLY); - 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->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 ade05d6be3..a5ff1b8175 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -5,8 +5,8 @@ struct EnTk; -typedef void (*EnTkActionFunc)(struct EnTk*, GlobalContext*); -typedef void (*EnTkUnkFunc)(struct EnTk*, GlobalContext*); +typedef void (*EnTkActionFunc)(struct EnTk*, PlayState*); +typedef void (*EnTkUnkFunc)(struct EnTk*, PlayState*); #define ENTK_GET_F(thisx) ((thisx)->params & 0xF) #define ENTK_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) 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 7ca536b6a9..9a09e27eb2 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -11,7 +11,7 @@ #define THIS ((EnTorch*)thisx) -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx); +void EnTorch_Init(Actor* thisx, PlayState* play); const ActorInit En_Torch_InitVars = { ACTOR_EN_TORCH, ACTORCAT_ITEMACTION, FLAGS, GAMEPLAY_KEEP, sizeof(EnTorch), @@ -22,11 +22,11 @@ static u8 sChestContents[] = { GI_RUPEE_BLUE, GI_RUPEE_RED, GI_RUPEE_PURPLE, GI_RUPEE_SILVER, GI_BOMBCHUS_1, GI_BOMBCHUS_5, GI_BOMBS_1, GI_BOMBS_1, }; -void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch_Init(Actor* thisx, PlayState* play) { EnTorch* this = THIS; s8 returnData = gSaveContext.respawn[RESPAWN_MODE_UNK_3].data; - 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, ENBOX_PARAMS(ENBOX_TYPE_SMALL, sChestContents[(returnData >> 0x5) & 0x7], returnData)); Actor_MarkForDeath(&this->actor); 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 c6931fac5c..2cb3cb1938 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -11,13 +11,13 @@ #define THIS ((EnTorch2*)thisx) -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); -void EnTorch2_UpdateIdle(Actor* thisx, GlobalContext* globalCtx); -void EnTorch2_UpdateDeath(Actor* thisx, GlobalContext* globalCtx); +void EnTorch2_UpdateIdle(Actor* thisx, PlayState* play); +void EnTorch2_UpdateDeath(Actor* thisx, PlayState* play); const ActorInit En_Torch2_InitVars = { ACTOR_EN_TORCH2, @@ -65,12 +65,12 @@ static Gfx* sShellDLists[] = { gameplay_keep_DL_01C430, // Human }; -void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Init(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; s16 params; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); // params: which form Link is in (e.g. human, deku, etc.) params = this->actor.params; @@ -83,16 +83,16 @@ void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx) { this->framesUntilNextState = 20; } -void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Destroy(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); - Play_SetRespawnData(&globalCtx->state, this->actor.params + RESPAWN_MODE_GORON - 1, 0xFF, 0, 0xBFF, + Collider_DestroyCylinder(play, &this->collider); + Play_SetRespawnData(&play->state, this->actor.params + RESPAWN_MODE_GORON - 1, 0xFF, 0, 0xBFF, &this->actor.world.pos, this->actor.shape.rot.y); - globalCtx->actorCtx.unk254[this->actor.params] = 0; + play->actorCtx.unk254[this->actor.params] = 0; } -void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Update(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; u16 targetAlpha; u16 remainingFrames; @@ -105,7 +105,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 70.0f, 0x05); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 70.0f, 0x05); if (this->framesUntilNextState == 0) { remainingFrames = 0; @@ -131,14 +131,14 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx) { } else { // Once the player has moved away, update collision and become opaque Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); targetAlpha = 255; } Math_StepToS(&this->alpha, targetAlpha, 8); } } -void EnTorch2_UpdateIdle(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_UpdateIdle(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; if (this->state == TORCH2_STATE_DYING) { @@ -148,7 +148,7 @@ void EnTorch2_UpdateIdle(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTorch2_UpdateDeath(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_UpdateDeath(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; // Fall down and become transparent, then delete once invisible @@ -160,20 +160,20 @@ void EnTorch2_UpdateDeath(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnTorch2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnTorch2* this = THIS; Gfx* gfx = sShellDLists[thisx->params]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha == 0xFF) { - Scene_SetRenderModeXlu(globalCtx, 0, 0x01); + Scene_SetRenderModeXlu(play, 0, 0x01); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - Gfx_DrawDListOpa(globalCtx, gfx); + Gfx_DrawDListOpa(play, gfx); } else { - Scene_SetRenderModeXlu(globalCtx, 1, 0x02); + Scene_SetRenderModeXlu(play, 1, 0x02); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->alpha); - Gfx_DrawDListXlu(globalCtx, gfx); + Gfx_DrawDListXlu(play, gfx); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index f12baac71c..72129f2136 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -13,42 +13,42 @@ #define ENTOTO_WEEK_EVENT_FLAGS (gSaveContext.save.weekEventReg[50] & 1 || gSaveContext.save.weekEventReg[51] & 0x80) -void EnToto_Init(Actor* thisx, GlobalContext* globalCtx); -void EnToto_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnToto_Update(Actor* thisx, GlobalContext* globalCtx); -void EnToto_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnToto_Init(Actor* thisx, PlayState* play); +void EnToto_Destroy(Actor* thisx, PlayState* play); +void EnToto_Update(Actor* thisx, PlayState* play); +void EnToto_Draw(Actor* thisx, PlayState* play); -void func_80BA3930(EnToto* this, GlobalContext* globalCtx); -void func_80BA39C8(EnToto* this, GlobalContext* globalCtx); -void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx); -void func_80BA3BFC(EnToto* this, GlobalContext* globalCtx); -void func_80BA3CC4(EnToto* this, GlobalContext* globalCtx); -void func_80BA3D38(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3EC0(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3ED4(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3EE8(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3F2C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3FB0(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA3FCC(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA40D4(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4128(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA415C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA43F4(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA445C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA44A0(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA46D8(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA47E0(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA49A4(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4C0C(EnToto* this, GlobalContext* globalCtx); -s32 func_80BA4C44(EnToto* this, GlobalContext* globalCtx); +void func_80BA3930(EnToto* this, PlayState* play); +void func_80BA39C8(EnToto* this, PlayState* play); +void func_80BA3DBC(EnToto* this, PlayState* play); +void func_80BA3BFC(EnToto* this, PlayState* play); +void func_80BA3CC4(EnToto* this, PlayState* play); +void func_80BA3D38(EnToto* this, PlayState* play); +s32 func_80BA3EC0(EnToto* this, PlayState* play); +s32 func_80BA3ED4(EnToto* this, PlayState* play); +s32 func_80BA3EE8(EnToto* this, PlayState* play); +s32 func_80BA3F2C(EnToto* this, PlayState* play); +s32 func_80BA3FB0(EnToto* this, PlayState* play); +s32 func_80BA3FCC(EnToto* this, PlayState* play); +s32 func_80BA402C(EnToto* this, PlayState* play); +s32 func_80BA407C(EnToto* this, PlayState* play); +s32 func_80BA40D4(EnToto* this, PlayState* play); +s32 func_80BA4128(EnToto* this, PlayState* play); +s32 func_80BA415C(EnToto* this, PlayState* play); +s32 func_80BA4204(EnToto* this, PlayState* play); +s32 func_80BA42BC(EnToto* this, PlayState* play); +s32 func_80BA43F4(EnToto* this, PlayState* play); +s32 func_80BA445C(EnToto* this, PlayState* play); +s32 func_80BA44A0(EnToto* this, PlayState* play); +s32 func_80BA4530(EnToto* this, PlayState* play); +s32 func_80BA46D8(EnToto* this, PlayState* play); +s32 func_80BA4740(EnToto* this, PlayState* play); +s32 func_80BA47E0(EnToto* this, PlayState* play); +s32 func_80BA49A4(EnToto* this, PlayState* play); +s32 func_80BA4A00(EnToto* this, PlayState* play); +s32 func_80BA4B24(EnToto* this, PlayState* play); +s32 func_80BA4C0C(EnToto* this, PlayState* play); +s32 func_80BA4C44(EnToto* this, PlayState* play); const ActorInit En_Toto_InitVars = { ACTOR_EN_TOTO, @@ -173,41 +173,41 @@ static EnTotoActionFunc D_80BA51B8[] = { func_80BA3DBC, }; -void func_80BA36C0(EnToto* this, GlobalContext* globalCtx, s32 index) { +void func_80BA36C0(EnToto* this, PlayState* play, s32 index) { this->unk2B7 = 0; this->actionFuncIndex = index; - D_80BA501C[this->actionFuncIndex](this, globalCtx); + D_80BA501C[this->actionFuncIndex](this, play); } -void EnToto_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnToto_Init(Actor* thisx, PlayState* play) { EnToto* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - if (globalCtx->sceneNum == SCENE_MILK_BAR && + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + if (play->sceneNum == SCENE_MILK_BAR && (gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < CLOCK_TIME(21, 30))) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= 0x400; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zm_Skel_00A978, - ((globalCtx->sceneNum == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), + SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, + ((play->sceneNum == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), this->jointTable, this->morphTable, 18); - func_80BA36C0(this, globalCtx, 0); + func_80BA36C0(this, play, 0); this->actor.shape.rot.x = 0; } -void EnToto_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnToto_Destroy(Actor* thisx, PlayState* play) { EnToto* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80BA383C(EnToto* this, GlobalContext* globalCtx) { +void func_80BA383C(EnToto* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && this->actionFuncIndex == 1 && this->skelAnime.animation != &object_zm_Anim_000C80) { - if (globalCtx->msgCtx.currentTextId != 0x2A98 && globalCtx->msgCtx.currentTextId != 0x2A99) { + if (play->msgCtx.currentTextId != 0x2A98 && play->msgCtx.currentTextId != 0x2A99) { if (this->unk2B4 & 1 || Rand_ZeroOne() > 0.5f) { this->unk2B4 = (this->unk2B4 + 1) & 3; } @@ -217,10 +217,10 @@ void func_80BA383C(EnToto* this, GlobalContext* globalCtx) { func_800BBB74(this->unk260, 0x14, 0x50, 3); } -void func_80BA3930(EnToto* this, GlobalContext* globalCtx) { +void func_80BA3930(EnToto* this, PlayState* play) { AnimationHeader* animationHeader = &object_zm_Anim_00C880; - if (globalCtx->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneNum == SCENE_SONCHONOIE) { animationHeader = &object_zm_Anim_003AA8; } Animation_MorphToLoop(&this->skelAnime, animationHeader, -4.0f); @@ -236,35 +236,35 @@ s32 func_80BA397C(EnToto* this, s16 arg1) { return 0; } -void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA39C8(EnToto* this, PlayState* play) { + Player* player = GET_PLAYER(play); - func_80BA383C(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BA36C0(this, globalCtx, 1); - if (globalCtx->sceneNum != SCENE_SONCHONOIE) { - Flags_SetSwitch(globalCtx, this->actor.params & 0x7F); + func_80BA383C(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BA36C0(this, play, 1); + if (play->sceneNum != SCENE_SONCHONOIE) { + Flags_SetSwitch(play, this->actor.params & 0x7F); } else if (player->transformation == PLAYER_FORM_DEKU) { - Flags_SetSwitch(globalCtx, this->actor.home.rot.x); + Flags_SetSwitch(play, this->actor.home.rot.x); } this->unk2B6 = 0; return; } //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro - if ((globalCtx->sceneNum == SCENE_MILK_BAR && + if ((play->sceneNum == SCENE_MILK_BAR && !(gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < 0xED02)) || - (globalCtx->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { + (play->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 9999.9f, 9999.9f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 9999.9f, 9999.9f, EXCH_ITEM_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 50.0f); - if (globalCtx->sceneNum == SCENE_SONCHONOIE) { + func_800B8614(&this->actor, play, 50.0f); + if (play->sceneNum == SCENE_SONCHONOIE) { if (player->transformation == PLAYER_FORM_DEKU) { - if (!Flags_GetSwitch(globalCtx, this->actor.home.rot.x)) { + if (!Flags_GetSwitch(play, this->actor.home.rot.x)) { this->text = D_80BA5068; } else { this->text = D_80BA5074; @@ -274,7 +274,7 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { } } else if (ENTOTO_WEEK_EVENT_FLAGS) { this->text = D_80BA502C; - } else if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { + } else if (!Flags_GetSwitch(play, this->actor.params & 0x7F)) { this->text = D_80BA5034; } else { this->text = D_80BA5038; @@ -285,13 +285,13 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { } } -void func_80BA3BFC(EnToto* this, GlobalContext* globalCtx) { - if (globalCtx->sceneNum == SCENE_SONCHONOIE) { +void func_80BA3BFC(EnToto* this, PlayState* play) { + if (play->sceneNum == SCENE_SONCHONOIE) { Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_000C80, -4.0f); this->unk2B4 = 0; } else { if (this->text->unk0 == 4) { - func_80151BB4(globalCtx, 9); + func_80151BB4(play, 9); } Animation_MorphToLoop(&this->skelAnime, &object_zm_Anim_00B3E0, -4.0f); } @@ -301,30 +301,30 @@ void func_80BA3C88(EnToto* this) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 4000, 800); } -void func_80BA3CC4(EnToto* this, GlobalContext* globalCtx) { - func_80BA383C(this, globalCtx); +void func_80BA3CC4(EnToto* this, PlayState* play) { + func_80BA383C(this, play); func_80BA3C88(this); - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - func_80BA36C0(this, globalCtx, this->text->unk1); + if (Actor_TextboxIsClosing(&this->actor, play)) { + func_80BA36C0(this, play, this->text->unk1); } else { - func_80BA4C44(this, globalCtx); + func_80BA4C44(this, play); } } -void func_80BA3D38(EnToto* this, GlobalContext* globalCtx) { +void func_80BA3D38(EnToto* this, PlayState* play) { this->cutscene = this->actor.cutscene; this->text = ENTOTO_WEEK_EVENT_FLAGS ? D_80BA50BC : D_80BA5088; - func_80BA4C0C(this, globalCtx); - globalCtx->actorCtx.unk5 |= 0x20; + func_80BA4C0C(this, play); + play->actorCtx.unk5 |= 0x20; this->unk260[0] = 0; } -void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { +void func_80BA3DBC(EnToto* this, PlayState* play) { Player* player; - func_80BA383C(this, globalCtx); + func_80BA383C(this, play); if (this->unk2B7 == 0) { - if (!func_80BA4C44(this, globalCtx)) { + if (!func_80BA4C44(this, play)) { return; } if (this->text->unk1 != 0 && ENTOTO_WEEK_EVENT_FLAGS) { @@ -332,63 +332,63 @@ void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { return; } } else { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (player->stateFlags1 & 0x400 && player->unk_AE7 != 0) { - func_80151BB4(globalCtx, 48); - func_80151BB4(globalCtx, 9); - func_80151BB4(globalCtx, 10); + func_80151BB4(play, 48); + func_80151BB4(play, 9); + func_80151BB4(play, 10); } else { return; } } - func_80BA36C0(this, globalCtx, 0); + func_80BA36C0(this, play, 0); ActorCutscene_Stop(this->cutscene); - globalCtx->actorCtx.unk5 &= ~0x20; + play->actorCtx.unk5 &= ~0x20; } -s32 func_80BA3EC0(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3EC0(EnToto* this, PlayState* play) { return 1; } -s32 func_80BA3ED4(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3ED4(EnToto* this, PlayState* play) { return 0; } -s32 func_80BA3EE8(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3EE8(EnToto* this, PlayState* play) { if (this->text->unk1 == 2) { - func_800B7298(globalCtx, NULL, 7); + func_800B7298(play, NULL, 7); } return 0; } -s32 func_80BA3F2C(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3F2C(EnToto* this, PlayState* play) { if (this->text->textId != 0) { - func_80151938(globalCtx, this->text->textId); + func_80151938(play, this->text->textId); } else { - func_801477B4(globalCtx); - func_80BA3EE8(this, globalCtx); + func_801477B4(play); + func_80BA3EE8(this, play); } if (this->text->unk0 == 4) { - func_80151BB4(globalCtx, 9); + func_80151BB4(play, 9); } return 0; } -s32 func_80BA3FB0(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3FB0(EnToto* this, PlayState* play) { this->unk2B1 = this->text->unk1; return 0; } -s32 func_80BA3FCC(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA3FCC(EnToto* this, PlayState* play) { if (DECR(this->unk2B1) == 0) { - Message_StartTextbox(globalCtx, this->text->textId, NULL); + Message_StartTextbox(play, this->text->textId, NULL); return 1; } return 0; } -s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA402C(EnToto* this, PlayState* play) { s16 prevCutscene = this->cutscene; this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); @@ -397,9 +397,9 @@ s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA407C(EnToto* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &GET_PLAYER(globalCtx)->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &GET_PLAYER(play)->actor); return 1; } @@ -407,52 +407,52 @@ s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA40D4(EnToto* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +s32 func_80BA40D4(EnToto* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { return 1; } return 0; } -s32 func_80BA4128(EnToto* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 2) { +s32 func_80BA4128(EnToto* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 2) { return 1; } return 0; } -s32 func_80BA415C(EnToto* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 4 && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex != 0) { +s32 func_80BA415C(EnToto* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 4 && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex != 0) { func_8019F230(); } else { func_8019F208(); } - return (globalCtx->msgCtx.choiceIndex != 0 ? 0 : this->text->unk1) + 1; // Possible msg MACRO + return (play->msgCtx.choiceIndex != 0 ? 0 : this->text->unk1) + 1; // Possible msg MACRO } return 0; } -s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA4204(EnToto* this, PlayState* play) { EnTotoUnkStruct2* temp_v1_2; if (DECR(this->unk2B1) == 0) { if (!ENTOTO_WEEK_EVENT_FLAGS) { temp_v1_2 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; - Message_StartTextbox(globalCtx, (this->text->unk0 == 6) ? temp_v1_2->unk0 : temp_v1_2->unk4, NULL); + Message_StartTextbox(play, (this->text->unk0 == 6) ? temp_v1_2->unk0 : temp_v1_2->unk4, NULL); } return 1; } return 0; } -s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BA42BC(EnToto* this, PlayState* play) { + Player* player = GET_PLAYER(play); u32 phi_s0 = 0; Vec3s* end = &D_80BA510C[3]; - func_80BA3FB0(this, globalCtx); - func_800B7298(globalCtx, NULL, 6); + func_80BA3FB0(this, play); + func_800B7298(play, NULL, 6); if (player->actor.world.pos.z > -310.0f) { if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) { phi_s0 = 3; @@ -464,29 +464,29 @@ s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx) { } } } - func_80122744(globalCtx, this->unk2BC, phi_s0, end - phi_s0); - this->spotlights = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DM_CHAR07, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF02); + func_80122744(play, this->unk2BC, phi_s0, end - phi_s0); + this->spotlights = Actor_Spawn(&play->actorCtx, play, ACTOR_DM_CHAR07, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF02); return 0; } -s32 func_80BA43F4(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA43F4(EnToto* this, PlayState* play) { func_80BA3C88(this); - if (func_80122760(globalCtx, this->unk2BC, 60.0f)) { - func_800B7298(globalCtx, NULL, 0x13); - return func_80BA4204(this, globalCtx); + if (func_80122760(play, this->unk2BC, 60.0f)) { + func_800B7298(play, NULL, 0x13); + return func_80BA4204(this, play); } return 0; } -s32 func_80BA445C(EnToto* this, GlobalContext* globalCtx) { - if (func_80BA4128(this, globalCtx)) { - func_800B7298(globalCtx, NULL, 6); +s32 func_80BA445C(EnToto* this, PlayState* play) { + if (func_80BA4128(this, play)) { + func_800B7298(play, NULL, 6); return 1; } return 0; } -s32 func_80BA44A0(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA44A0(EnToto* this, PlayState* play) { ActorCutscene_Stop(this->cutscene); this->unk2B1 = 0; return 0; @@ -502,8 +502,8 @@ s32 func_80BA44D4(EnTotoUnkStruct2* arg0, Player* player) { return 0; } -s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80BA4530(EnToto* this, PlayState* play) { + Player* player = GET_PLAYER(play); EnTotoUnkStruct2* temp_s0; s32 i; @@ -521,7 +521,7 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { Math_Vec3s_ToVec3f(&player->actor.world.pos, &temp_s0->unk6); player->actor.shape.rot.y = 0; player->currentYaw = 0; - return func_80BA407C(this, globalCtx); + return func_80BA407C(this, play); } if (!ENTOTO_WEEK_EVENT_FLAGS) { for (i = 0; i < 4; i++) { @@ -529,8 +529,8 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { if (this->unk2B1 < 10) { this->unk2B1++; if (this->unk2B1 >= 10) { - Message_StartTextbox(globalCtx, - D_80BA50DC[((void)0, gSaveContext.save.playerForm) - 1].unk2, NULL); + Message_StartTextbox(play, D_80BA50DC[((void)0, gSaveContext.save.playerForm) - 1].unk2, + NULL); } } return 0; @@ -542,14 +542,14 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA46D8(EnToto* this, GlobalContext* globalCtx) { - func_800B7298(globalCtx, NULL, 0x44); - func_80152434(globalCtx, D_80BA5120[CUR_FORM]); +s32 func_80BA46D8(EnToto* this, PlayState* play) { + func_800B7298(play, NULL, 0x44); + func_80152434(play, D_80BA5120[CUR_FORM]); return 0; } -s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == 4) { +s32 func_80BA4740(EnToto* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == 4) { if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { gSaveContext.save.weekEventReg[56] |= 0x10; } @@ -567,7 +567,7 @@ s32 func_80BA4740(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA47E0(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA47E0(EnToto* this, PlayState* play) { Vec3f spawnPos; s32 i; @@ -587,30 +587,29 @@ s32 func_80BA47E0(EnToto* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { if (gSaveContext.save.playerForm != (i + 1) && (D_80BA5128[i] & this->unk2B3)) { Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, - -1); + Actor_Spawn(&play->actorCtx, play, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, -1); } } - func_80BA402C(this, globalCtx); + func_80BA402C(this, play); if (ENTOTO_WEEK_EVENT_FLAGS) { - func_80BA402C(this, globalCtx); + func_80BA402C(this, play); } return 0; } -s32 func_80BA49A4(EnToto* this, GlobalContext* globalCtx) { - func_800B7298(globalCtx, NULL, 0x44); +s32 func_80BA49A4(EnToto* this, PlayState* play) { + func_800B7298(play, NULL, 0x44); func_801A31EC(NA_BGM_BALLAD_OF_THE_WIND_FISH, 4, this->unk2B3 ^ 0xF); this->unk2B1 = 4; return 0; } -s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA4A00(EnToto* this, PlayState* play) { Actor* actor; if (DECR(this->unk2B1) == 0) { if (!Audio_IsSequencePlaying(NA_BGM_BALLAD_OF_THE_WIND_FISH)) { - actor = &GET_PLAYER(globalCtx)->actor; + actor = &GET_PLAYER(play)->actor; actor = actor->next; while (actor != NULL) { Actor_MarkForDeath(actor); @@ -619,7 +618,7 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { if (this->spotlights != NULL) { Actor_MarkForDeath(this->spotlights); } - func_800B7298(globalCtx, NULL, 0x45); + func_800B7298(play, NULL, 0x45); if (this->unk2B3 == 0xF) { if (CURRENT_DAY == 1) { gSaveContext.save.weekEventReg[50] |= 1; @@ -627,7 +626,7 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[51] |= 0x80; } } else { - func_80BA402C(this, globalCtx); + func_80BA402C(this, play); } return 1; } @@ -635,22 +634,22 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA4B24(EnToto* this, PlayState* play) { Player* player; - if (func_80BA40D4(this, globalCtx)) { - player = GET_PLAYER(globalCtx); + if (func_80BA40D4(this, play)) { + player = GET_PLAYER(play); Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_0028B8, -4.0f); if (player->transformation == PLAYER_FORM_ZORA) { - if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { - Flags_SetSwitch(globalCtx, this->actor.params & 0x7F); + if (!Flags_GetSwitch(play, this->actor.params & 0x7F)) { + Flags_SetSwitch(play, this->actor.params & 0x7F); return 1; } else { return 3; } } else { - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 7) & 0x7F)) { - Flags_SetSwitch(globalCtx, (this->actor.params >> 7) & 0x7F); + if (!Flags_GetSwitch(play, (this->actor.params >> 7) & 0x7F)) { + Flags_SetSwitch(play, (this->actor.params >> 7) & 0x7F); return 4; } else { return 7; @@ -660,23 +659,23 @@ s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA4C0C(EnToto* this, GlobalContext* globalCtx) { - return D_80BA512C[this->text->unk0](this, globalCtx); +s32 func_80BA4C0C(EnToto* this, PlayState* play) { + return D_80BA512C[this->text->unk0](this, play); } -s32 func_80BA4C44(EnToto* this, GlobalContext* globalCtx) { +s32 func_80BA4C44(EnToto* this, PlayState* play) { s32 ret; - ret = D_80BA5174[this->text->unk0](this, globalCtx); + ret = D_80BA5174[this->text->unk0](this, play); if (ret != 0) { this->text += ret; - return func_80BA4C0C(this, globalCtx); + return func_80BA4C0C(this, play); } return 0; } -void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) { - CsCmdActorAction* action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 525)]; +void func_80BA4CB4(EnToto* this, PlayState* play) { + CsCmdActorAction* action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 525)]; if (this->unk2B5 != action->action) { this->unk2B5 = action->action; @@ -687,8 +686,8 @@ void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) { Animation_PlayOnce(&this->skelAnime, this->unk2B5 == 1 ? &object_zm_Anim_0016A4 : &object_zm_Anim_0022C8); if (this->unk2B5 == 2 && this->unk2B3 != 0xF) { - func_80151BB4(globalCtx, 9); - func_80151BB4(globalCtx, 10); + func_80151BB4(play, 9); + func_80151BB4(play, 10); } } } @@ -699,40 +698,40 @@ void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) { Animation_PlayLoop(&this->skelAnime, this->unk2B5 == 1 ? &object_zm_Anim_00C880 : &object_zm_Anim_001324); } } - if (this->unk2B5 == 4 && !Actor_HasParent(&this->actor, globalCtx)) { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_CIRCUS_LEADER, 9999.9f, 9999.9f); + if (this->unk2B5 == 4 && !Actor_HasParent(&this->actor, play)) { + Actor_PickUp(&this->actor, play, GI_MASK_CIRCUS_LEADER, 9999.9f, 9999.9f); } } -void EnToto_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnToto_Update(Actor* thisx, PlayState* play) { EnToto* this = THIS; s32 pad; - if (Cutscene_CheckActorAction(globalCtx, 0x20D)) { - func_80BA4CB4(this, globalCtx); + if (Cutscene_CheckActorAction(play, 0x20D)) { + func_80BA4CB4(this, play); } else { - D_80BA51B8[this->actionFuncIndex](this, globalCtx); + D_80BA51B8[this->actionFuncIndex](this, play); } - Collider_ResetCylinderAC(globalCtx, &this->collider.base); + Collider_ResetCylinderAC(play, &this->collider.base); Collider_UpdateCylinder(&this->actor, &this->collider); - 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); Actor_SetFocus(&this->actor, 40.0f); } -void EnToto_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnToto_Draw(Actor* thisx, PlayState* play) { TexturePtr sp4C[] = { object_zm_Tex_008AE8, object_zm_Tex_00A068, object_zm_Tex_00A468 }; EnToto* this = THIS; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp4C[this->unk260[0]])); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, NULL, &this->actor); + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h index cdfe3294ea..aed6af1ca1 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h @@ -5,8 +5,8 @@ struct EnToto; -typedef void (*EnTotoActionFunc)(struct EnToto*, GlobalContext*); -typedef s32 (*EnTotoUnkFunc)(struct EnToto*, GlobalContext*); +typedef void (*EnTotoActionFunc)(struct EnToto*, PlayState*); +typedef s32 (*EnTotoUnkFunc)(struct EnToto*, PlayState*); typedef struct EnTotoText { /* 0x0 */ u8 unk0; diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 17094ac7fa..12a95cb204 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -16,44 +16,44 @@ #define ENTRT_GIVEN_MUSHROOM (1 << 1) #define ENTRT_MET (1 << 2) -void EnTrt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTrt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTrt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTrt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTrt_Init(Actor* thisx, PlayState* play); +void EnTrt_Destroy(Actor* thisx, PlayState* play); +void EnTrt_Update(Actor* thisx, PlayState* play); +void EnTrt_Draw(Actor* thisx, PlayState* play); -void EnTrt_GetCutscenes(EnTrt* this, GlobalContext* globalCtx); +void EnTrt_GetCutscenes(EnTrt* this, PlayState* play); void EnTrt_ResetItemPosition(EnTrt* this); -void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, GlobalContext* globalCtx); +void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play); s32 EnTrt_ReturnItemToShelf(EnTrt* this); -s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, GlobalContext* globalCtx); +s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play); s32 EnTrt_TakeItemOffShelf(EnTrt* this); -void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_FaceShopkeeper(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_SetupEndInteraction(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_StartShopping(GlobalContext* globalCtx, EnTrt* this); -void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_EndConversation(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_TryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_Surprised(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_LookToShelf(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_GivenRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_SetupTalkToShopkeeper(GlobalContext* globalCtx, EnTrt* this); -void EnTrt_ContinueShopping(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnTrt* this); -void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_PayForMushroom(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_CanBuy(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_CannotBuy(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_BuyItemWithFanfare(EnTrt* this, GlobalContext* globalCtx); -void EnTrt_SetupItemGiven(EnTrt* this, GlobalContext* globalCtx); +void EnTrt_BeginInteraction(EnTrt* this, PlayState* play); +void EnTrt_IdleSleeping(EnTrt* this, PlayState* play); +void EnTrt_IdleAwake(EnTrt* this, PlayState* play); +void EnTrt_Hello(EnTrt* this, PlayState* play); +void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play); +void EnTrt_SetupEndInteraction(EnTrt* this, PlayState* play); +void EnTrt_StartShopping(PlayState* play, EnTrt* this); +void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play); +void EnTrt_EndConversation(EnTrt* this, PlayState* play); +void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play); +void EnTrt_Surprised(EnTrt* this, PlayState* play); +void EnTrt_LookToShelf(EnTrt* this, PlayState* play); +void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play); +void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play); +void EnTrt_BrowseShelf(EnTrt* this, PlayState* play); +void EnTrt_SetupTalkToShopkeeper(PlayState* play, EnTrt* this); +void EnTrt_ContinueShopping(EnTrt* this, PlayState* play); +void EnTrt_ItemGiven(EnTrt* this, PlayState* play); +void EnTrt_SelectItem(EnTrt* this, PlayState* play); +void EnTrt_SetupLookToShopkeeperFromShelf(PlayState* play, EnTrt* this); +void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play); +void EnTrt_PayForMushroom(EnTrt* this, PlayState* play); +void EnTrt_CanBuy(EnTrt* this, PlayState* play); +void EnTrt_CannotBuy(EnTrt* this, PlayState* play); +void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play); +void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play); void EnTrt_EyesClosed(EnTrt* this); void EnTrt_OpenThenCloseEyes(EnTrt* this); @@ -110,18 +110,18 @@ void EnTrt_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animations, s32 idx) animations->mode, animations->morphFrames); } -s32 EnTrt_TestItemSelected(GlobalContext* globalCtx) { - MessageContext* msgCtx = &globalCtx->msgCtx; +s32 EnTrt_TestItemSelected(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } - return CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_A) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(&globalCtx->state)->press.button, BTN_CUP); + return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CUP); } -void EnTrt_SpawnShopItems(EnTrt* this, GlobalContext* globalCtx, ShopItem* shopItem) { +void EnTrt_SpawnShopItems(EnTrt* this, PlayState* play, ShopItem* shopItem) { s32 i; for (i = 0; i < ARRAY_COUNT(this->items); i++, shopItem++) { @@ -131,25 +131,25 @@ void EnTrt_SpawnShopItems(EnTrt* this, GlobalContext* globalCtx, ShopItem* shopI this->items[i] = NULL; } else { this->items[i] = - (EnGirlA*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, shopItem->spawnPos.x, - shopItem->spawnPos.y, shopItem->spawnPos.z, 0, 0, 0, shopItem->shopItemId); + (EnGirlA*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GIRLA, shopItem->spawnPos.x, shopItem->spawnPos.y, + shopItem->spawnPos.z, 0, 0, 0, shopItem->shopItemId); } } } -void EnTrt_UpdateCollider(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_UpdateCollider(EnTrt* this, PlayState* play) { 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 EnTrt_UpdateCursorPos(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_UpdateCursorPos(PlayState* play, EnTrt* this) { s16 x; s16 y; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(globalCtx, &this->items[this->cursorIdx]->actor, &x, &y); + Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y); this->cursorPos.x = x + xOffset; this->cursorPos.y = y + yOffset; this->cursorPos.z = 1.2f; @@ -196,23 +196,23 @@ u16 EnTrt_GetItemChoiceTextId(EnTrt* this) { return item->choiceTextId; } -void EnTrt_EndInteraction(GlobalContext* globalCtx, EnTrt* this) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_ProcessTalkRequest(&this->actor, &play->state); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; Interface_ChangeAlpha(50); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; player->stateFlags2 &= ~0x20000000; - globalCtx->interfaceCtx.unk_222 = 0; - globalCtx->interfaceCtx.unk_224 = 0; + play->interfaceCtx.unk_222 = 0; + play->interfaceCtx.unk_224 = 0; this->textId = 0x834; this->timer = 80; this->flags |= ENTRT_FULLY_AWAKE; @@ -222,43 +222,43 @@ void EnTrt_EndInteraction(GlobalContext* globalCtx, EnTrt* this) { this->blinkFunc = EnTrt_NodOff; } -s32 EnTrt_TestEndInteraction(EnTrt* this, GlobalContext* globalCtx, Input* input) { +s32 EnTrt_TestEndInteraction(EnTrt* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - EnTrt_EndInteraction(globalCtx, this); + EnTrt_EndInteraction(play, this); return true; } return false; } -s32 EnTrt_TestCancelOption(EnTrt* this, GlobalContext* globalCtx, Input* input) { +s32 EnTrt_TestCancelOption(EnTrt* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); return true; } return false; } -void EnTrt_SetupStartShopping(GlobalContext* globalCtx, EnTrt* this, u8 skipHello) { - func_8011552C(globalCtx, 0x10); +void EnTrt_SetupStartShopping(PlayState* play, EnTrt* this, u8 skipHello) { + func_8011552C(play, 0x10); if (!skipHello) { this->actionFunc = EnTrt_Hello; } else { - EnTrt_StartShopping(globalCtx, this); + EnTrt_StartShopping(play, this); } } -void EnTrt_StartShopping(GlobalContext* globalCtx, EnTrt* this) { - func_80151938(globalCtx, 0x83E); - func_8011552C(globalCtx, 6); +void EnTrt_StartShopping(PlayState* play, EnTrt* this) { + func_80151938(play, 0x83E); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_FaceShopkeeper; } -void EnTrt_UpdateJoystickInputState(GlobalContext* globalCtx, EnTrt* this) { - s8 stickX = CONTROLLER1(&globalCtx->state)->rel.stick_x; - s8 stickY = CONTROLLER1(&globalCtx->state)->rel.stick_y; +void EnTrt_UpdateJoystickInputState(PlayState* play, EnTrt* this) { + s8 stickX = CONTROLLER1(&play->state)->rel.stick_x; + s8 stickY = CONTROLLER1(&play->state)->rel.stick_y; if (this->stickAccumX == 0) { if (stickX > 30 || stickX < -30) { @@ -301,8 +301,8 @@ u8 EnTrt_SetCursorIndexFromNeutral(EnTrt* this, u8 shelfOffset) { return CURSOR_INVALID; } -void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnTrt_Hello(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -312,17 +312,17 @@ void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + if (talkState == 5 && Message_ShouldAdvance(play)) { play_sound(NA_SE_SY_MESSAGE_PASS); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - EnTrt_StartShopping(globalCtx, this); + if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + EnTrt_StartShopping(play, this); } } } -void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); this->tmpGetMushroomCutscene = this->getMushroomCutscene; if (this->cutsceneState != ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { @@ -330,86 +330,86 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { player->stateFlags2 &= ~0x20000000; } - } else if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == 5 && Message_ShouldAdvance(play)) { switch (this->textId) { case 0x883: this->textId = 0x884; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); gSaveContext.save.weekEventReg[53] |= 8; - func_80123D50(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x888: this->textId = 0x889; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); break; case 0x889: if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnTrt_PayForMushroom; break; default: this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; - EnTrt_EndInteraction(globalCtx, this); + EnTrt_EndInteraction(play, this); break; } } } -void EnTrt_PayForMushroom(EnTrt* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnTrt_PayForMushroom(EnTrt* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - func_80123D50(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); + func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); this->actionFunc = EnTrt_SetupItemGiven; } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); } } -void EnTrt_Goodbye(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnTrt_Goodbye(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { switch (this->textId) { case 0x886: this->textId = 0x887; - func_80151938(globalCtx, this->textId); + func_80151938(play, this->textId); break; case 0x887: case 0x88B: - EnTrt_EndInteraction(globalCtx, this); + EnTrt_EndInteraction(play, this); break; } } } -void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->textId == 0x88F) { if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->tmpTextId = this->textId; this->textId = 0x88E; gSaveContext.save.weekEventReg[85] |= 8; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } else { if (gSaveContext.save.weekEventReg[12] & 8) { this->textId = 0x83D; - EnTrt_SetupStartShopping(globalCtx, this, 0); + EnTrt_SetupStartShopping(play, this, 0); } else if (gSaveContext.save.weekEventReg[84] & 0x40) { this->textId = 0x83B; if (Interface_HasItemInBottle(ITEM_POTION_RED)) { - EnTrt_SetupStartShopping(globalCtx, this, false); + EnTrt_SetupStartShopping(play, this, false); } else { this->actionFunc = EnTrt_TryToGiveRedPotion; } @@ -421,17 +421,17 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { return; } else if (gSaveContext.save.weekEventReg[17] & 1) { this->textId = 0x835; - EnTrt_SetupStartShopping(globalCtx, this, false); + EnTrt_SetupStartShopping(play, this, false); } - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } } } -void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { gSaveContext.save.weekEventReg[12] |= 0x10; @@ -440,17 +440,17 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { player->stateFlags2 &= ~0x20000000; this->actionFunc = EnTrt_GivenRedPotionForKoume; } else if (gSaveContext.save.weekEventReg[12] & 0x10) { - Actor_PickUp(&this->actor, globalCtx, GI_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); } } -void EnTrt_GivenRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { //! @bug: player is set to NULL not PLAYER Player* player = NULL; - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); @@ -466,41 +466,41 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); this->actionFunc = EnTrt_ItemGiven; } } -void EnTrt_EndConversation(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnTrt_EndConversation(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (talkState == 5) { - if (Message_ShouldAdvance(globalCtx)) { - EnTrt_EndInteraction(globalCtx, this); + if (Message_ShouldAdvance(play)) { + EnTrt_EndInteraction(play, this); } } else if (talkState == 6) { - if (Message_ShouldAdvance(globalCtx)) { - EnTrt_EndInteraction(globalCtx, this); + if (Message_ShouldAdvance(play)) { + EnTrt_EndInteraction(play, this); } } } -s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.choiceIndex) { +s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - EnTrt_SetupTalkToShopkeeper(globalCtx, this); + EnTrt_SetupTalkToShopkeeper(play, this); return true; case 1: func_8019F230(); - EnTrt_EndInteraction(globalCtx, this); + EnTrt_EndInteraction(play, this); return true; } return false; } -void EnTrt_FaceShopkeeper(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); u8 cursorIdx; if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { @@ -519,15 +519,15 @@ void EnTrt_FaceShopkeeper(EnTrt* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - if ((!Message_ShouldAdvance(globalCtx) || !EnTrt_FacingShopkeeperDialogResult(this, globalCtx)) && + func_8011552C(play, 6); + if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + if ((!Message_ShouldAdvance(play) || !EnTrt_FacingShopkeeperDialogResult(this, play)) && (this->stickAccumX > 0)) { cursorIdx = EnTrt_SetCursorIndexFromNeutral(this, 2); if (cursorIdx != CURSOR_INVALID) { this->cursorIdx = cursorIdx; this->actionFunc = EnTrt_LookToShelf; - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_CURSOR); } @@ -536,7 +536,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_LookToShelf(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_LookToShelf(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -552,23 +552,23 @@ void EnTrt_LookToShelf(EnTrt* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; - EnTrt_UpdateCursorPos(globalCtx, this); + EnTrt_UpdateCursorPos(play, this); this->actionFunc = EnTrt_BrowseShelf; - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnTrt_CursorLeftRight(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_CursorLeftRight(PlayState* play, EnTrt* this) { u8 curTemp = this->cursorIdx; if (this->stickAccumX < 0) { if (curTemp != 2) { curTemp++; } else { - EnTrt_SetupLookToShopkeeperFromShelf(globalCtx, this); + EnTrt_SetupLookToShopkeeperFromShelf(play, this); } if (this->items[curTemp] != NULL) { this->cursorIdx = curTemp; @@ -583,16 +583,16 @@ void EnTrt_CursorLeftRight(GlobalContext* globalCtx, EnTrt* this) { } } -s32 EnTrt_HasPlayerSelectedItem(GlobalContext* globalCtx, EnTrt* this, Input* input) { +s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) { EnGirlA* item = this->items[this->cursorIdx]; - if (EnTrt_TestEndInteraction(this, globalCtx, input)) { + if (EnTrt_TestEndInteraction(this, play, input)) { return true; } - if (EnTrt_TestItemSelected(globalCtx)) { + if (EnTrt_TestItemSelected(play)) { if (item->actor.params != SI_POTION_BLUE || (this->flags & ENTRT_GIVEN_MUSHROOM)) { this->tmpActionFunc = this->actionFunc; - func_80151938(globalCtx, EnTrt_GetItemChoiceTextId(this)); + func_80151938(play, EnTrt_GetItemChoiceTextId(this)); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -606,8 +606,8 @@ s32 EnTrt_HasPlayerSelectedItem(GlobalContext* globalCtx, EnTrt* this, Input* in return false; } -void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); s32 pad; u8 prevCursorIdx = this->cursorIdx; u8 cursorIdx; @@ -619,13 +619,13 @@ void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) { } else { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; - EnTrt_UpdateCursorPos(globalCtx, this); + EnTrt_UpdateCursorPos(play, this); if (talkState == 5) { - func_8011552C(globalCtx, 6); - if (!EnTrt_HasPlayerSelectedItem(globalCtx, this, CONTROLLER1(&globalCtx->state))) { - EnTrt_CursorLeftRight(globalCtx, this); + func_8011552C(play, 6); + if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { + EnTrt_CursorLeftRight(play, this); if (this->cursorIdx != prevCursorIdx) { - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); play_sound(NA_SE_SY_CURSOR); } } @@ -633,33 +633,33 @@ void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnTrt* this) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { + Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeAlpha(50); this->drawCursor = 0; this->actionFunc = EnTrt_BuyItemWithFanfare; } -void EnTrt_SetupCannotBuy(GlobalContext* globalCtx, EnTrt* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnTrt_SetupCannotBuy(PlayState* play, EnTrt* this, u16 textId) { + func_80151938(play, textId); this->actionFunc = EnTrt_CannotBuy; } -void EnTrt_SetupCanBuy(GlobalContext* globalCtx, EnTrt* this, u16 textId) { - func_80151938(globalCtx, textId); +void EnTrt_SetupCanBuy(PlayState* play, EnTrt* this, u16 textId) { + func_80151938(play, textId); this->actionFunc = EnTrt_CanBuy; } -void EnTrt_HandleCanBuyItem(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) { EnGirlA* item = this->items[this->cursorIdx]; EnGirlA* item2; - switch (item->canBuyFunc(globalCtx, item)) { + switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -667,80 +667,79 @@ void EnTrt_HandleCanBuyItem(GlobalContext* globalCtx, EnTrt* this) { } func_8019F208(); item2 = this->items[this->cursorIdx]; - item2->buyFanfareFunc(globalCtx, item2); - EnTrt_SetupBuyItemWithFanfare(globalCtx, this); + item2->buyFanfareFunc(play, item2); + EnTrt_SetupBuyItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_SUCCESS_2: func_8019F208(); - item->buyFunc(globalCtx, item); - EnTrt_SetupCanBuy(globalCtx, this, 0x848); + item->buyFunc(play, item); + EnTrt_SetupCanBuy(play, this, 0x848); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); break; case CANBUY_RESULT_NO_ROOM: play_sound(NA_SE_SY_ERROR); - EnTrt_SetupCannotBuy(globalCtx, this, 0x641); + EnTrt_SetupCannotBuy(play, this, 0x641); break; case CANBUY_RESULT_NEED_EMPTY_BOTTLE: play_sound(NA_SE_SY_ERROR); - EnTrt_SetupCannotBuy(globalCtx, this, 0x846); + EnTrt_SetupCannotBuy(play, this, 0x846); break; case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); - EnTrt_SetupCannotBuy(globalCtx, this, 0x847); + EnTrt_SetupCannotBuy(play, this, 0x847); break; case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); - EnTrt_SetupCannotBuy(globalCtx, this, 0x643); + EnTrt_SetupCannotBuy(play, this, 0x643); break; } } -void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_SelectItem(EnTrt* this, PlayState* play) { EnGirlA* item = this->items[this->cursorIdx]; - u8 talkState = Message_GetState(&globalCtx->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); if (EnTrt_TakeItemOffShelf(this)) { if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (!EnTrt_TestCancelOption(this, globalCtx, CONTROLLER1(&globalCtx->state)) && - Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + func_8011552C(play, 6); + if (!EnTrt_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: - EnTrt_HandleCanBuyItem(globalCtx, this); + EnTrt_HandleCanBuyItem(play, this); break; case 1: func_8019F230(); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); break; } } - } else if (talkState == 5 && Message_ShouldAdvance(globalCtx)) { + } else if (talkState == 5 && Message_ShouldAdvance(play)) { if (!Interface_HasEmptyBottle()) { play_sound(NA_SE_SY_ERROR); - EnTrt_SetupCannotBuy(globalCtx, this, 0x846); + EnTrt_SetupCannotBuy(play, this, 0x846); } else { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - EnTrt_SetupBuyItemWithFanfare(globalCtx, this); + EnTrt_SetupBuyItemWithFanfare(play, this); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; - item->boughtFunc(globalCtx, item); + item->boughtFunc(play, item); gSaveContext.save.weekEventReg[53] |= 0x10; } } } } -void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { + Player* player = GET_PLAYER(play); if ((gSaveContext.save.weekEventReg[85] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40)) { this->textId = 0x88F; @@ -762,10 +761,10 @@ void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { player->transformation == PLAYER_FORM_DEKU) { this->textId = 0x850; } - if (Player_GetMask(globalCtx) == PLAYER_MASK_SCENTS) { + if (Player_GetMask(play) == PLAYER_MASK_SCENTS) { this->textId = 0x890; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (player->transformation == PLAYER_FORM_HUMAN) { this->flags |= ENTRT_MET; } @@ -782,7 +781,7 @@ void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { this->actionFunc = EnTrt_BeginInteraction; } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) && (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } if (DECR(this->timer) == 0) { this->timer = 40; @@ -796,12 +795,12 @@ void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->flags &= ~ENTRT_FULLY_AWAKE; if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_FIERCE_DEITY) { - if (Player_GetMask(globalCtx) == PLAYER_MASK_SCENTS) { + if (Player_GetMask(play) == PLAYER_MASK_SCENTS) { this->textId = 0x890; } else { this->textId = this->tmpTextId; @@ -809,7 +808,7 @@ void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) { } else { this->textId = 0x850; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -828,7 +827,7 @@ void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) { this->actionFunc = EnTrt_BeginInteraction; } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) && (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(150, 100); @@ -841,7 +840,7 @@ void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed; s16 animLastFrame = Animation_GetLastFrame(&object_trt_Anim_0030EC) / (s16)this->skelAnime.playSpeed; @@ -870,13 +869,13 @@ void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) { } else if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(40, 20); EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 5); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->animationIndex = 5; switch (this->textId) { case 0x834: if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && !(gSaveContext.save.weekEventReg[16] & 0x10) && !(gSaveContext.save.weekEventReg[17] & 1)) { - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_Hello; @@ -885,7 +884,7 @@ void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) { } break; case 0x83E: - func_8011552C(globalCtx, 6); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actionFunc = EnTrt_FaceShopkeeper; @@ -901,7 +900,7 @@ void EnTrt_BeginInteraction(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_Surprised(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_Surprised(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); @@ -921,17 +920,17 @@ void EnTrt_Surprised(EnTrt* this, GlobalContext* globalCtx) { } else if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(40, 20); EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 5); - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->animationIndex = 5; this->actionFunc = EnTrt_TryToGiveRedPotionAfterSurprised; } } -void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); this->blinkFunc = EnTrt_Blink; - if (talkState == 6 && Message_ShouldAdvance(globalCtx)) { + if (talkState == 6 && Message_ShouldAdvance(play)) { if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -942,39 +941,39 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, GlobalContext* globalCt this->tmpTextId = this->textId; this->textId = 0x88E; gSaveContext.save.weekEventReg[85] |= 8; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } } -void EnTrt_TryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->textId == 0x83C) { if (Interface_HasEmptyBottle()) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->tmpTextId = this->textId; this->textId = 0x88E; gSaveContext.save.weekEventReg[85] |= 8; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_EndConversation; } } else { this->textId = 0x83C; - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); } } } -void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -990,7 +989,7 @@ void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { switch (this->textId) { case 0x889: this->textId = 0x88A; @@ -1009,73 +1008,73 @@ void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx) { this->textId = 0x849; break; } - func_80151938(globalCtx, this->textId); + func_80151938(play, this->textId); } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnTrt_SetupEndInteraction(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { - EnTrt_EndInteraction(globalCtx, this); +void EnTrt_SetupEndInteraction(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + EnTrt_EndInteraction(play, this); } } -void EnTrt_ShopkeeperGone(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, this->textId, &this->actor); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->textId, &this->actor); } else { if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= 50.0f) && (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) { - func_800B8614(&this->actor, globalCtx, 200.0f); + func_800B8614(&this->actor, play, 200.0f); } } - if (talkState == 6 && Message_ShouldAdvance(globalCtx)) { + if (talkState == 6 && Message_ShouldAdvance(play)) { if (gSaveContext.save.weekEventReg[20] & 2) { - globalCtx->nextEntranceIndex = 0xC50; + play->nextEntranceIndex = 0xC50; } else { - globalCtx->nextEntranceIndex = 0x8450; + play->nextEntranceIndex = 0x8450; } - globalCtx->unk_1887F = 0x40; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 0x40; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } -void EnTrt_CannotBuy(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { +void EnTrt_CannotBuy(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); } } -void EnTrt_CanBuy(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_CanBuy(EnTrt* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&globalCtx->msgCtx) == 5 && Message_ShouldAdvance(globalCtx)) { + if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); + item->restockFunc(play, item); this->actionFunc = this->tmpActionFunc; - func_80151938(globalCtx, EnTrt_GetItemTextId(this)); + func_80151938(play, EnTrt_GetItemTextId(this)); } } -void EnTrt_BuyItemWithFanfare(EnTrt* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnTrt_SetupItemGiven; } else { - Actor_PickUp(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); } } -void EnTrt_SetupItemGiven(EnTrt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { +void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { this->actionFunc = EnTrt_ItemGiven; if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1084,45 +1083,45 @@ void EnTrt_SetupItemGiven(EnTrt* this, GlobalContext* globalCtx) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void EnTrt_ContinueShopping(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); EnGirlA* item; if (talkState == 4) { - func_8011552C(globalCtx, 6); - if (Message_ShouldAdvance(globalCtx)) { + func_8011552C(play, 6); + if (Message_ShouldAdvance(play)) { EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); - if (!EnTrt_TestEndInteraction(this, globalCtx, CONTROLLER1(&globalCtx->state))) { - switch (globalCtx->msgCtx.choiceIndex) { + item->restockFunc(play, item); + if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y); player->stateFlags2 |= 0x20000000; - Message_StartTextbox(globalCtx, this->textId, &this->actor); - EnTrt_SetupStartShopping(globalCtx, this, true); - func_800B85E0(&this->actor, globalCtx, 400.0f, EXCH_ITEM_MINUS1); + Message_StartTextbox(play, this->textId, &this->actor); + EnTrt_SetupStartShopping(play, this, true); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); break; case 1: default: func_8019F230(); - EnTrt_EndInteraction(globalCtx, this); + EnTrt_EndInteraction(play, this); break; } } } } else if (talkState == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; - item->restockFunc(globalCtx, item); - EnTrt_EndInteraction(globalCtx, this); + item->restockFunc(play, item); + EnTrt_EndInteraction(play, this); } } } @@ -1357,21 +1356,21 @@ void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) { } } -void EnTrt_TalkToShopkeeper(EnTrt* this, GlobalContext* globalCtx) { - u8 talkState = talkState = Message_GetState(&globalCtx->msgCtx); - Player* player = GET_PLAYER(globalCtx); +void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { + u8 talkState = talkState = Message_GetState(&play->msgCtx); + Player* player = GET_PLAYER(play); s32 itemGiven; if (talkState == 5) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if (this->talkOptionTextId == 0x845 || this->talkOptionTextId == 0x882) { - func_80151938(globalCtx, 0xFF); + func_80151938(play, 0xFF); } else { - EnTrt_StartShopping(globalCtx, this); + EnTrt_StartShopping(play, this); } } } else if (talkState == 16) { - itemGiven = func_80123810(globalCtx); + itemGiven = func_80123810(play); if (itemGiven > EXCH_ITEM_NONE) { if (itemGiven == EXCH_ITEM_1E) { if (gSaveContext.save.weekEventReg[53] & 8) { @@ -1391,34 +1390,34 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, GlobalContext* globalCtx) { this->textId = player->actor.textId; this->actionFunc = EnTrt_Goodbye; } - func_801477B4(globalCtx); + func_801477B4(play); } else if (itemGiven < EXCH_ITEM_NONE) { if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->textId = 0x88B; } else { this->textId = 0x886; } - Message_StartTextbox(globalCtx, this->textId, &this->actor); + Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnTrt_Goodbye; } } } -void EnTrt_SetupTalkToShopkeeper(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_SetupTalkToShopkeeper(PlayState* play, EnTrt* this) { this->actionFunc = EnTrt_TalkToShopkeeper; - func_80151938(globalCtx, this->talkOptionTextId); - func_8011552C(globalCtx, 6); + func_80151938(play, this->talkOptionTextId); + func_8011552C(play, 6); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; } -void EnTrt_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_SetupLookToShopkeeperFromShelf(PlayState* play, EnTrt* this) { play_sound(NA_SE_SY_CURSOR); this->drawCursor = 0; this->actionFunc = EnTrt_LookToShopkeeperFromShelf; } -void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -1434,15 +1433,15 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; - EnTrt_StartShopping(globalCtx, this); + EnTrt_StartShopping(play, this); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } } } -void EnTrt_InitShopkeeper(EnTrt* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_00FD34, NULL, NULL, 0); +void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_00FD34, NULL, NULL, 0); if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && gSaveContext.save.day >= 2) { this->actor.draw = NULL; @@ -1451,11 +1450,11 @@ void EnTrt_InitShopkeeper(EnTrt* this, GlobalContext* globalCtx) { } } -void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) { - EnTrt_GetCutscenes(this, globalCtx); +void EnTrt_InitShop(EnTrt* this, PlayState* play) { + EnTrt_GetCutscenes(this, play); this->cutscene = this->lookForwardCutscene; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - EnTrt_InitShopkeeper(this, globalCtx); + EnTrt_InitShopkeeper(this, play); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->timer = Rand_S16Offset(40, 20); @@ -1521,7 +1520,7 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) { this->actor.gravity = 0.0f; Actor_SetScale(&this->actor, sActorScale); - EnTrt_SpawnShopItems(this, globalCtx, sShop); + EnTrt_SpawnShopItems(this, play, sShop); this->blinkTimer = 20; this->eyeTextureIdx = 0; this->blinkFunc = EnTrt_EyesClosed; @@ -1532,14 +1531,14 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void EnTrt_GetCutscenes(EnTrt* this, GlobalContext* globalCtx) { +void EnTrt_GetCutscenes(EnTrt* this, PlayState* play) { this->lookForwardCutscene = this->actor.cutscene; this->lookToShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookForwardCutscene); this->lookToShopkeeperCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShelfCutscene); this->getMushroomCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperCutscene); } -void EnTrt_DrawCursor(GlobalContext* globalCtx, EnTrt* this, f32 x, f32 y, f32 z, u8 drawCursor) { +void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 drawCursor) { s32 ulx; s32 uly; s32 lrx; @@ -1548,9 +1547,9 @@ void EnTrt_DrawCursor(GlobalContext* globalCtx, EnTrt* this, f32 x, f32 y, f32 z s32 dsdx; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawCursor != 0) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(play->state.gfxCtx); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b, this->cursorColor.a); gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, @@ -1563,11 +1562,10 @@ void EnTrt_DrawCursor(GlobalContext* globalCtx, EnTrt* this, f32 x, f32 y, f32 z 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); + CLOSE_DISPS(play->state.gfxCtx); } -void EnTrt_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 EnTrt_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; s32 uly; @@ -1580,7 +1578,7 @@ void EnTrt_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 (void)"../z_en_trt.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); @@ -1597,30 +1595,30 @@ void EnTrt_DrawTextRec(GlobalContext* globalCtx, s32 r, s32 g, s32 b, s32 a, f32 dtdy = dy * unk; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnTrt_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnTrt* this) { +void EnTrt_DrawStickDirectionPrompt(PlayState* play, EnTrt* this) { s32 drawStickRightPrompt = this->stickLeftPrompt.isEnabled; s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled; (void)"../z_en_trt.c"; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (drawStickRightPrompt || drawStickLeftPrompt) { - func_8012C654(globalCtx->state.gfxCtx); + func_8012C654(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 (drawStickRightPrompt) { - EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, + EnTrt_DrawTextRec(play, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g, this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a, this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, + EnTrt_DrawTextRec(play, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g, this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a, this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); @@ -1629,56 +1627,56 @@ void EnTrt_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnTrt* this) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); if (drawStickRightPrompt) { - EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, + EnTrt_DrawTextRec(play, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g, this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a, this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f); } if (drawStickLeftPrompt) { - EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, + EnTrt_DrawTextRec(play, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g, this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a, this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY, this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnTrt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt_Init(Actor* thisx, PlayState* play) { EnTrt* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - EnTrt_InitShop(this, globalCtx); + EnTrt_InitShop(this, play); } -void EnTrt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt_Destroy(Actor* thisx, PlayState* play) { EnTrt* this = THIS; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnTrt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt_Update(Actor* thisx, PlayState* play) { EnTrt* this = THIS; this->blinkFunc(this); - EnTrt_UpdateJoystickInputState(globalCtx, this); + EnTrt_UpdateJoystickInputState(play, this); EnTrt_UpdateItemSelectedProperty(this); EnTrt_UpdateStickDirectionPromptAnim(this); EnTrt_UpdateCursorAnim(this); - EnTrt_UpdateHeadYawAndPitch(this, globalCtx); - this->actionFunc(this, globalCtx); + EnTrt_UpdateHeadYawAndPitch(this, play); + this->actionFunc(this, play); Actor_SetFocus(&this->actor, 90.0f); SkelAnime_Update(&this->skelAnime); - EnTrt_UpdateCollider(this, globalCtx); + EnTrt_UpdateCollider(this, play); } -void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f playerPos; Vec3f pos; @@ -1715,7 +1713,7 @@ void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 i } } -s32 EnTrt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnTrt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTrt* this = THIS; s32 i; @@ -1731,7 +1729,7 @@ s32 EnTrt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTrt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTrt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTrt* this = THIS; s32 isFullyAwake; @@ -1749,7 +1747,7 @@ void EnTrt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnTrt_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTrt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnTrt* this = THIS; if (limbIndex == 21) { @@ -1761,21 +1759,21 @@ void EnTrt_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void EnTrt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt_Draw(Actor* thisx, PlayState* play) { static TexturePtr sEyeTextures[] = { object_trt_Tex_00B0B8, object_trt_Tex_00B8B8, object_trt_Tex_00C0B8 }; EnTrt* this = THIS; s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTrt_OverrideLimbDraw, EnTrt_PostLimbDraw, EnTrt_TransformLimbDraw, &this->actor); - EnTrt_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); - EnTrt_DrawStickDirectionPrompt(globalCtx, this); + EnTrt_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor); + EnTrt_DrawStickDirectionPrompt(play, this); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.h b/src/overlays/actors/ovl_En_Trt/z_en_trt.h index eb243317b9..6dc3bd82cc 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.h +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.h @@ -6,7 +6,7 @@ struct EnTrt; -typedef void (*EnTrtActionFunc)(struct EnTrt*, GlobalContext*); +typedef void (*EnTrtActionFunc)(struct EnTrt*, PlayState*); typedef void (*EnTrtBlinkFunc)(struct EnTrt*); typedef struct EnTrt { diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index f2b8c9138c..f108498e8f 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -11,20 +11,20 @@ #define THIS ((EnTrt2*)thisx) -void EnTrt2_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTrt2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTrt2_Update(Actor* thisx, GlobalContext* globalCtx); +void EnTrt2_Init(Actor* thisx, PlayState* play); +void EnTrt2_Destroy(Actor* thisx, PlayState* play); +void EnTrt2_Update(Actor* thisx, PlayState* play); void func_80AD46F8(EnTrt2* this); s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2); s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3); f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); -void func_80AD4A78(EnTrt2* this, GlobalContext* globalCtx); -s32 func_80AD4B08(GlobalContext* globalCtx); -void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx); -void func_80AD4FE4(EnTrt2* this, GlobalContext* globalCtx); -void func_80AD5234(EnTrt2* this, GlobalContext* globalCtx); -void func_80AD56E8(Actor* thisx, GlobalContext* globalCtx); +void func_80AD4A78(EnTrt2* this, PlayState* play); +s32 func_80AD4B08(PlayState* play); +void func_80AD4DB4(EnTrt2* this, PlayState* play); +void func_80AD4FE4(EnTrt2* this, PlayState* play); +void func_80AD5234(EnTrt2* this, PlayState* play); +void func_80AD56E8(Actor* thisx, PlayState* play); static AnimationInfoS sAnimations[] = { { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -122,12 +122,12 @@ void func_80AD3380(SkelAnime* skelAnime, AnimationInfoS* animation, s32 arg2) { animation->mode, animation->morphFrames); } -void func_80AD341C(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD341C(EnTrt2* this, PlayState* play) { 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; - 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_80AD349C(EnTrt2* this) { @@ -144,7 +144,7 @@ void func_80AD349C(EnTrt2* this) { } } -void func_80AD3530(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3530(EnTrt2* this, PlayState* play) { s16 phi_a1; f32 sp30; @@ -175,7 +175,7 @@ void func_80AD3530(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD3664(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3664(EnTrt2* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->unk_3DA)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_3DA, &this->actor); if (this->unk_3D9 == 0) { @@ -190,7 +190,7 @@ void func_80AD3664(EnTrt2* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); } -void func_80AD36EC(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD36EC(EnTrt2* this, PlayState* play) { Vec3s sp30; f32 sp2C; @@ -203,7 +203,7 @@ void func_80AD36EC(EnTrt2* this, GlobalContext* globalCtx) { this->unk_1E4 = 0; this->unk_3D9 = 1; this->actor.velocity.y = 0.0f; - this->path = SubS_GetPathByIndex(globalCtx, this->path->unk1, -1); + this->path = SubS_GetPathByIndex(play, this->path->unk1, -1); ActorCutscene_Stop(this->unk_3DA); this->unk_3DA = ActorCutscene_GetAdditionalCutscene(this->unk_3DA); ActorCutscene_SetIntentToPlay(this->unk_3DA); @@ -220,9 +220,9 @@ void func_80AD36EC(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD381C(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD381C(EnTrt2* this, PlayState* play) { if ((CURRENT_DAY == 2) || (CURRENT_DAY == 3)) { - if (func_80AD4B08(globalCtx) == 1) { + if (func_80AD4B08(play) == 1) { this->actor.world.pos.y -= 50.0f; this->unk_3D9 = 0; this->unk_3B2 = 0; @@ -234,7 +234,7 @@ void func_80AD381C(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD38B8(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD38B8(EnTrt2* this, PlayState* play) { Vec3s sp30; if (this->unk_3D9 == 2) { @@ -271,7 +271,7 @@ void func_80AD38B8(EnTrt2* this, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); } -void func_80AD3A24(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3A24(EnTrt2* this, PlayState* play) { func_80AD46F8(this); if (this->actor.speedXZ > 0.05f) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); @@ -283,7 +283,7 @@ void func_80AD3A24(EnTrt2* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80AD3AE4(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3AE4(EnTrt2* this, PlayState* play) { if (this->actor.world.pos.y < this->actor.home.pos.y) { Math_ApproachF(&this->actor.velocity.y, 0.5f, 0.2f, 0.1f); } else { @@ -294,7 +294,7 @@ void func_80AD3AE4(EnTrt2* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); } -void func_80AD3B6C(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3B6C(EnTrt2* this, PlayState* play) { if (DECR(this->unk_3B0) == 0) { this->unk_3B0 = 10; this->actor.velocity.y = -1.0f; @@ -303,7 +303,7 @@ void func_80AD3B6C(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD3BE4(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3BE4(EnTrt2* this, PlayState* play) { s16 sp2E = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Math_ScaledStepToS(&this->unk_3C0, sp2E, 400); @@ -316,33 +316,33 @@ void func_80AD3BE4(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD3C94(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3C94(EnTrt2* this, PlayState* play) { if (this->actor.world.pos.y < 5.0f) { - func_80AD4A78(this, globalCtx); + func_80AD4A78(this, play); if (this->actor.bgCheckFlags & 1) { this->unk_3B2 = 0xF; } } } -void func_80AD3CEC(EnTrt2* this, GlobalContext* globalCtx) { - u8 sp27 = Message_GetState(&globalCtx->msgCtx); +void func_80AD3CEC(EnTrt2* this, PlayState* play) { + u8 sp27 = Message_GetState(&play->msgCtx); func_80AD46F8(this); if (this->unk_3D8) { - Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); + Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3D8 = false; - } else if ((sp27 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + } else if ((sp27 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; func_80AD3380(&this->skelAnime, sAnimations, 6); this->unk_3B2 = 4; } } -void func_80AD3DA4(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD3DA4(EnTrt2* this, PlayState* play) { this->actor.velocity.y = 0.0f; - Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); + Message_StartTextbox(play, this->unk_3A8, &this->actor); if (this->unk_3A8 == 0x838) { this->unk_3B2 = 11; @@ -358,45 +358,45 @@ void func_80AD3DA4(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD3E34(EnTrt2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80AD3E34(EnTrt2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (Interface_HasEmptyBottle()) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_3B2 = 12; } else { gSaveContext.save.weekEventReg[85] |= 0x10; this->unk_3A8 = 0x88E; - Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); + Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; } } } -void func_80AD3EF0(EnTrt2* this, GlobalContext* globalCtx) { - u8 temp_v0 = Message_GetState(&globalCtx->msgCtx); +void func_80AD3EF0(EnTrt2* this, PlayState* play) { + u8 temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 == 6) { - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { if ((Interface_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || !(gSaveContext.save.weekEventReg[12] & 0x10)) { this->unk_3B2 = 12; } else { gSaveContext.save.weekEventReg[85] |= 0x10; this->unk_3A8 = 0x88E; - Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); + Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3B2 = 10; } } - } else if ((temp_v0 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + } else if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; this->unk_3B2 = 12; } } -void func_80AD3FF4(EnTrt2* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AD3FF4(EnTrt2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { if (!(gSaveContext.save.weekEventReg[12] & 0x10)) { gSaveContext.save.weekEventReg[12] |= 0x10; } @@ -404,44 +404,44 @@ void func_80AD3FF4(EnTrt2* this, GlobalContext* globalCtx) { this->actor.parent = NULL; this->unk_3B2 = 14; } else if (gSaveContext.save.weekEventReg[12] & 0x10) { - Actor_PickUp(&this->actor, globalCtx, GI_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, globalCtx, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); } } -void func_80AD40AC(EnTrt2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 6) && Message_ShouldAdvance(globalCtx)) { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); +void func_80AD40AC(EnTrt2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + func_800B85E0(&this->actor, play, 400.0f, -1); this->unk_3B2 = 13; } } -void func_80AD4110(EnTrt2* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80AD4110(EnTrt2* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3A8 = 0x84C; - func_80151938(globalCtx, this->unk_3A8); + func_80151938(play, this->unk_3A8); this->unk_3B2 = 10; } else { - func_800B85E0(&this->actor, globalCtx, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, -1); } } -void func_80AD417C(EnTrt2* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { +void func_80AD417C(EnTrt2* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { if (this->unk_3A8 == 0x84B) { func_80AD349C(this); - func_80AD3DA4(this, globalCtx); + func_80AD3DA4(this, play); } else { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; if (this->unk_3A8 == 0x84C) { func_80AD3380(&this->skelAnime, sAnimations, 6); - this->path = SubS_GetPathByIndex(globalCtx, ENTRT2_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); this->unk_3B2 = 18; } else if (this->unk_3A8 == 0x88F) { this->unk_3A8 = 0x88E; - Message_StartTextbox(globalCtx, this->unk_3A8, &this->actor); + Message_StartTextbox(play, this->unk_3A8, &this->actor); } else { this->actor.textId = 0; this->unk_3B2 = 15; @@ -450,8 +450,8 @@ void func_80AD417C(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD4298(EnTrt2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD4298(EnTrt2* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCanPlayNext(this->unk_3DA)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_3DA, &this->actor); @@ -465,14 +465,14 @@ void func_80AD4298(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD431C(EnTrt2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD431C(EnTrt2* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags1 &= ~0x20; Actor_MarkForDeath(&this->actor); } -void func_80AD434C(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD434C(EnTrt2* this, PlayState* play) { this->actor.shape.rot.y += 0x1000; Math_ApproachF(&this->actor.velocity.y, 1.5f, 0.2f, 0.1f); @@ -489,13 +489,13 @@ void func_80AD434C(EnTrt2* this, GlobalContext* globalCtx) { sp68.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; sp68.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; sp68.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); - func_800B3030(globalCtx, &sp68, &sp5C, &sp5C, 100, 0, 3); + func_800B3030(play, &sp68, &sp5C, &sp5C, 100, 0, 3); } func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } } else if (this->actor.world.pos.y < 5.0f) { - func_80AD4A78(this, globalCtx); + func_80AD4A78(this, play); } Actor_MoveWithGravity(&this->actor); @@ -505,18 +505,18 @@ void func_80AD434C(EnTrt2* this, GlobalContext* globalCtx) { } } -void func_80AD4550(EnTrt2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); - u8 sp23 = Message_GetState(&globalCtx->msgCtx); +void func_80AD4550(EnTrt2* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u8 sp23 = Message_GetState(&play->msgCtx); if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) { func_80AD3380(&this->skelAnime, sAnimations, 7); this->unk_3B2 = 17; } - if ((sp23 == 5) && Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if ((sp23 == 5) && Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; } } @@ -538,8 +538,8 @@ void func_80AD4608(EnTrt2* this) { } } -void func_80AD469C(EnTrt2* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_000A44, NULL, NULL, 0); +void func_80AD469C(EnTrt2* this, PlayState* play) { + SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_000A44, NULL, NULL, 0); this->actor.draw = func_80AD56E8; } @@ -623,20 +623,20 @@ f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { return sp20.y - arg2->y; } -void func_80AD4A78(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD4A78(EnTrt2* this, PlayState* play) { Vec3f sp34; sp34.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; sp34.y = this->actor.world.pos.y; sp34.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; - Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp34, 50.0f, 0, 2.0f, 0, 0, 0); + Actor_SpawnFloorDustRing(play, &this->actor, &sp34, 50.0f, 0, 2.0f, 0, 0, 0); } -s32 func_80AD4B08(GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80AD4B08(PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret; - if (SurfaceType_GetSceneExitIndex(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 0x15) { + if (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 0x15) { ret = true; } else { ret = false; @@ -644,11 +644,11 @@ s32 func_80AD4B08(GlobalContext* globalCtx) { return ret; } -s32 func_80AD4B4C(EnTrt2* this, GlobalContext* globalCtx) { +s32 func_80AD4B4C(EnTrt2* this, PlayState* play) { s32 sp24 = false; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { sp24 = true; this->actor.speedXZ = 0.0f; func_80AD349C(this); @@ -657,7 +657,7 @@ s32 func_80AD4B4C(EnTrt2* this, GlobalContext* globalCtx) { if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) { this->unk_3A8 = 0x84F; } - func_80AD3DA4(this, globalCtx); + func_80AD3DA4(this, play); } else if ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY)) { this->unk_3B2 = 16; @@ -683,9 +683,9 @@ s32 func_80AD4C4C(EnTrt2* this) { return false; } -s32 func_80AD4CCC(EnTrt2* this, GlobalContext* globalCtx) { +s32 func_80AD4CCC(EnTrt2* this, PlayState* play) { s16 sp1E = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (((this->unk_3B2 == 4) || (this->unk_3B2 == 5)) && this->actor.isTargeted && !(this->actor.bgCheckFlags & 1) && ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY))) { @@ -696,19 +696,19 @@ s32 func_80AD4CCC(EnTrt2* this, GlobalContext* globalCtx) { } if (func_80AD4C4C(this) && this->actor.isTargeted && (sp1E < 0x4000) && (sp1E > -0x4000)) { - func_800B863C(&this->actor, globalCtx); + func_800B863C(&this->actor, play); } return true; } -void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD4DB4(EnTrt2* this, PlayState* play) { static Vec3f D_80AD5904 = { 0.0f, 50.0f, 0.0 }; this->actor.flags &= ~ACTOR_FLAG_10; - Actor_SetObjectDependency(globalCtx, &this->actor); + Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.008f); - this->path = SubS_GetPathByIndex(globalCtx, ENTRT2_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); this->unk_3AE = Rand_S16Offset(100, 50); this->unk_3B0 = 10; this->unk_3A8 = 0; @@ -718,7 +718,7 @@ void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { this->actor.world.pos.z += D_80AD5904.z; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - func_80AD469C(this, globalCtx); + func_80AD469C(this, play); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; @@ -739,7 +739,7 @@ void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { return; } - if ((globalCtx->sceneNum == SCENE_20SICHITAI) || (globalCtx->sceneNum == SCENE_20SICHITAI2)) { + if ((play->sceneNum == SCENE_20SICHITAI) || (play->sceneNum == SCENE_20SICHITAI2)) { if (gSaveContext.save.day == 2) { if (!(gSaveContext.save.weekEventReg[15] & 0x80)) { gSaveContext.save.weekEventReg[15] |= 0x80; @@ -765,7 +765,7 @@ void func_80AD4DB4(EnTrt2* this, GlobalContext* globalCtx) { this->actionFunc = func_80AD4FE4; } -void func_80AD4FE4(EnTrt2* this, GlobalContext* globalCtx) { +void func_80AD4FE4(EnTrt2* this, PlayState* play) { static EnTrt2UnkFunc2 D_80AD5910[] = { func_80AD3664, func_80AD36EC, func_80AD38B8, func_80AD381C, func_80AD3530, func_80AD3A24, func_80AD434C, func_80AD3CEC, func_80AD3BE4, func_80AD3C94, func_80AD417C, func_80AD3EF0, func_80AD3FF4, func_80AD4110, @@ -774,11 +774,11 @@ void func_80AD4FE4(EnTrt2* this, GlobalContext* globalCtx) { this->unk_3BC(this); - D_80AD5910[this->unk_3B2](this, globalCtx); + D_80AD5910[this->unk_3B2](this, play); Actor_MoveWithGravity(&this->actor); - if (globalCtx->sceneNum != SCENE_20SICHITAI) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, 5); + if (play->sceneNum != SCENE_20SICHITAI) { + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } Actor_SetFocus(&this->actor, 90.0f); @@ -790,44 +790,44 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 500, ICHAIN_STOP), }; -void EnTrt2_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt2_Init(Actor* thisx, PlayState* play) { EnTrt2* this = THIS; - 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_ProcessInitChain(&this->actor, sInitChain); this->actionFunc = func_80AD4DB4; } -void EnTrt2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt2_Destroy(Actor* thisx, PlayState* play) { EnTrt2* this = THIS; - SkelAnime_Free(&this->skelAnime, globalCtx); - Collider_DestroyCylinder(globalCtx, &this->collider); + SkelAnime_Free(&this->skelAnime, play); + Collider_DestroyCylinder(play, &this->collider); } -void EnTrt2_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTrt2_Update(Actor* thisx, PlayState* play) { EnTrt2* this = THIS; if ((this->unk_3B2 != 6) && (this->unk_3B2 != 10) && (this->unk_3B2 != 13) && (this->unk_3B2 != 14) && (this->unk_3B2 != 16) && (this->unk_3B2 != 8) && (this->unk_3B2 != 9)) { - func_80AD4B4C(this, globalCtx); + func_80AD4B4C(this, play); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80AD341C(this, globalCtx); - func_80AD5234(this, globalCtx); + func_80AD341C(this, play); + func_80AD5234(this, play); if ((this->unk_3B2 != 6) && (this->unk_3B2 != 10) && (this->unk_3B2 != 13) && (this->unk_3B2 != 14) && (this->unk_3B2 != 16) && (this->unk_3B2 != 8) && (this->unk_3B2 != 9)) { - func_80AD4CCC(this, globalCtx); + func_80AD4CCC(this, play); } } -void func_80AD5234(EnTrt2* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AD5234(EnTrt2* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; @@ -873,8 +873,7 @@ void func_80AD5394(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4) { } } -s32 EnTrt2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnTrt2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTrt2* this = THIS; if ((limbIndex == 8) || (limbIndex == 13) || (limbIndex == 19)) { @@ -884,7 +883,7 @@ s32 EnTrt2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList return false; } -void EnTrt2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTrt2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTrt2* this = THIS; Vec3f sp30 = { 0.0f, -30.0f, 0.0f }; s32 phi_v0 = false; @@ -904,7 +903,7 @@ void EnTrt2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnTrt2_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTrt2_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnTrt2* this = THIS; if (limbIndex == 21) { @@ -916,7 +915,7 @@ void EnTrt2_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* th } } -void func_80AD56E8(Actor* thisx, GlobalContext* globalCtx) { +void func_80AD56E8(Actor* thisx, PlayState* play) { static TexturePtr D_80AD5978[] = { object_trt_Tex_00B0B8, object_trt_Tex_00B8B8, @@ -925,16 +924,16 @@ void func_80AD56E8(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnTrt2* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AD5978[this->unk_3B8])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80AD5978[this->unk_3B8])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTrt2_OverrideLimbDraw, EnTrt2_PostLimbDraw, EnTrt2_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h index bab2747212..da5c6fa9c8 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h @@ -5,9 +5,9 @@ struct EnTrt2; -typedef void (*EnTrt2ActionFunc)(struct EnTrt2*, GlobalContext*); +typedef void (*EnTrt2ActionFunc)(struct EnTrt2*, PlayState*); typedef void (*EnTrt2UnkFunc)(struct EnTrt2*); -typedef void (*EnTrt2UnkFunc2)(struct EnTrt2*, GlobalContext*); +typedef void (*EnTrt2UnkFunc2)(struct EnTrt2*, PlayState*); #define ENTRT2_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index d428553f87..03ca4215aa 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -11,18 +11,18 @@ #define THIS ((EnTru*)thisx) -void EnTru_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTru_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTru_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTru_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTru_Init(Actor* thisx, PlayState* play); +void EnTru_Destroy(Actor* thisx, PlayState* play); +void EnTru_Update(Actor* thisx, PlayState* play); +void EnTru_Draw(Actor* thisx, PlayState* play); -s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx); -s32 func_80A8777C(Actor* thisx, GlobalContext* globalCtx); -s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx); -s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx); -s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx); -void func_80A87FD0(EnTru* this, GlobalContext* globalCtx); -void func_80A881E0(EnTru* this, GlobalContext* globalCtx); +s32 func_80A875AC(Actor* thisx, PlayState* play); +s32 func_80A8777C(Actor* thisx, PlayState* play); +s32 func_80A87880(Actor* thisx, PlayState* play); +s32 func_80A87B48(Actor* thisx, PlayState* play); +s32 func_80A87DC0(Actor* thisx, PlayState* play); +void func_80A87FD0(EnTru* this, PlayState* play); +void func_80A881E0(EnTru* this, PlayState* play); static UNK_TYPE D_80A88910[] = { 0x0E08520C, @@ -148,13 +148,13 @@ void func_80A85620(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 ar } } -void func_80A85788(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { +void func_80A85788(EnTruUnkStruct* arg0, PlayState* play) { s32 i; s32 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 30; i++, arg0++) { if (arg0->unk_00 == 1) { @@ -174,20 +174,19 @@ void func_80A85788(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)alpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -arg0->unk_02 * 5, 32, 64, 1, 0, 0, 32, 32)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, -arg0->unk_02 * 5, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 14.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80A890A8); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80A85AA4(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { @@ -208,14 +207,14 @@ void func_80A85AA4(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 ar } } -void func_80A85BCC(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { +void func_80A85BCC(EnTruUnkStruct* arg0, PlayState* play) { s32 i; s32 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); - if (globalCtx) {} + OPEN_DISPS(play->state.gfxCtx); + if (play) {} - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 30; i++, arg0++) { if (arg0->unk_00 == 2) { @@ -235,16 +234,15 @@ void func_80A85BCC(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (u8)alpha); Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_80A8A108); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80A85E2C(EnTruUnkStruct* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, f32 arg5, f32 arg6, u8 arg7) { @@ -267,13 +265,13 @@ void func_80A85E2C(EnTruUnkStruct* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, #ifdef NON_MATCHING // s8/s6 flipped, same deal as above functions but the same fixes don't work -void func_80A85F84(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { +void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play) { u8 flag = false; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 30; i++, arg0++) { f32 alpha; @@ -305,10 +303,9 @@ void func_80A85F84(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { Matrix_Translate(arg0->unk_04.x, arg0->unk_04.y, arg0->unk_04.z, MTXMODE_NEW); Matrix_Scale(arg0->unk_28, arg0->unk_28, 1.0f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); idx = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f; gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B280[idx])); gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_01A830); @@ -317,10 +314,10 @@ void func_80A85F84(EnTruUnkStruct* arg0, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #else -void func_80A85F84(EnTruUnkStruct* arg0, GlobalContext* globalCtx); +void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tru/func_80A85F84.s") #endif @@ -434,15 +431,15 @@ s32 func_80A86924(EnTru* this, s32 arg1) { return ret; } -void func_80A8697C(EnTru* this, GlobalContext* globalCtx) { +void func_80A8697C(EnTru* this, PlayState* play) { this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale; if (this->actor.draw != NULL) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -s32 func_80A869DC(EnTru* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A869DC(EnTru* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp38; Vec3f sp2C; @@ -458,11 +455,11 @@ s32 func_80A869DC(EnTru* this, GlobalContext* globalCtx) { return true; } -s32 func_80A86B0C(EnTru* this, GlobalContext* globalCtx) { +s32 func_80A86B0C(EnTru* this, PlayState* play) { if (this->unk_34E & 8) { this->unk_34E &= ~0x10; this->unk_34E |= 0x20; - func_80A869DC(this, globalCtx); + func_80A869DC(this, play); } else if (this->unk_34E & 0x20) { this->unk_34E &= ~0x20; this->unk_366 = 0; @@ -476,12 +473,12 @@ s32 func_80A86B0C(EnTru* this, GlobalContext* globalCtx) { return true; } -s32 func_80A86BAC(EnTru* this, GlobalContext* globalCtx) { +s32 func_80A86BAC(EnTru* this, PlayState* play) { if (this->unk_34E & 0x400) { Matrix_Push(); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); switch (this->unk_390) { case 1: @@ -499,30 +496,30 @@ s32 func_80A86BAC(EnTru* this, GlobalContext* globalCtx) { Matrix_RotateXS(-0x4000, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tru_DL_0020C8); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } if (this->unk_34E & 0x800) { Matrix_Push(); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); Matrix_RotateXS(-0x4000, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_001F90); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } return false; @@ -636,7 +633,7 @@ s32 func_80A86DB8(EnTru* this) { return false; } -UNK_TYPE* func_80A871E0(EnTru* this, GlobalContext* globalCtx) { +UNK_TYPE* func_80A871E0(EnTru* this, PlayState* play) { if (this->unk_34E & 0x2000) { if (this->unk_38C == 35) { this->unk_390 = 1; @@ -665,12 +662,12 @@ UNK_TYPE* func_80A871E0(EnTru* this, GlobalContext* globalCtx) { return D_80A8892C; } -s32 func_80A872AC(EnTru* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A872AC(EnTru* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 ret = false; if (this->unk_34E & 7) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_34E &= ~0x80; } @@ -686,7 +683,7 @@ s32 func_80A872AC(EnTru* this, GlobalContext* globalCtx) { this->unk_378 = func_80A875AC; this->unk_390 = 0; this->unk_364 = 0; - this->unk_354 = func_80A871E0(this, globalCtx); + this->unk_354 = func_80A871E0(this, play); SubS_UpdateFlags(&this->unk_34E, 0, 7); this->actionFunc = func_80A881E0; ret = true; @@ -708,7 +705,7 @@ s32 func_80A873B8(EnTru* this) { return ret; } -s32 func_80A87400(EnTru* this, GlobalContext* globalCtx) { +s32 func_80A87400(EnTru* this, PlayState* play) { Vec3s* sp4C; Vec3f sp40; Vec3f sp34; @@ -747,7 +744,7 @@ s32 func_80A87400(EnTru* this, GlobalContext* globalCtx) { return ret; } -s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80A875AC(Actor* thisx, PlayState* play) { EnTru* this = THIS; s32 ret = false; @@ -806,17 +803,17 @@ s32 func_80A875AC(Actor* thisx, GlobalContext* globalCtx) { return ret; } -s32 func_80A8777C(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80A8777C(Actor* thisx, PlayState* play) { EnTru* this = THIS; s32 ret = 0; - s32 temp_v0 = Message_GetState(&globalCtx->msgCtx); + s32 temp_v0 = Message_GetState(&play->msgCtx); switch (temp_v0) { case 4: case 5: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { case 16: - temp_v0 = func_80123810(globalCtx); + temp_v0 = func_80123810(play); if ((temp_v0 == 35) || (temp_v0 == 36)) { this->unk_34E |= 8; if (temp_v0 == 35) { @@ -839,8 +836,8 @@ s32 func_80A8777C(Actor* thisx, GlobalContext* globalCtx) { return ret; } -s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80A87880(Actor* thisx, PlayState* play) { + Player* player = GET_PLAYER(play); EnTru* this = THIS; s32 ret = false; @@ -892,7 +889,7 @@ s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx) { Animation_OnFrame(&this->skelAnime, 52.0f)) { if (Animation_OnFrame(&this->skelAnime, 52.0f)) { this->unk_34E &= ~0x400; - func_80123D50(globalCtx, player, 18, 21); + func_80123D50(play, player, 18, 21); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DRINK); } else if (Animation_OnFrame(&this->skelAnime, 90.0f)) { @@ -913,9 +910,9 @@ s32 func_80A87880(Actor* thisx, GlobalContext* globalCtx) { return ret; } -s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80A87B48(Actor* thisx, PlayState* play) { EnTru* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp4C; Vec3f sp40; s16 sp3E; @@ -930,12 +927,12 @@ s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - sp3E = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + sp3E = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Math_Vec3f_Copy(&sp4C, &gZeroVec3f); sp4C.z = 40.0f; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, sp3E, &sp4C, &sp40); func_80A85620(this->unk_394, &sp40, 2.0f, 0.08f, 60.0f); - func_8016A268(&globalCtx->state, 1, 160, 160, 160, 0); + func_8016A268(&play->state, 1, 160, 160, 160, 0); this->unk_370 = 20; this->unk_372 = 10; this->unk_364++; @@ -972,7 +969,7 @@ s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { return ret; } -s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { +s32 func_80A87DC0(Actor* thisx, PlayState* play) { EnTru* this = THIS; s32 ret = false; @@ -1008,7 +1005,7 @@ s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { case 3: if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); + AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); break; } else { func_80A86924(this, 14); @@ -1018,7 +1015,7 @@ s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { } case 4: - if (func_80A87400(this, globalCtx) || (DECR(this->unk_362) == 0)) { + if (func_80A87400(this, play) || (DECR(this->unk_362) == 0)) { ret = true; gSaveContext.save.weekEventReg[12] |= 8; } @@ -1035,7 +1032,7 @@ s32 func_80A87DC0(Actor* thisx, GlobalContext* globalCtx) { return ret; } -void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { +void func_80A87FD0(EnTru* this, PlayState* play) { if (this->actor.draw != NULL) { if ((this->unk_34E & 0x80) || (gSaveContext.save.weekEventReg[16] & 0x10)) { if (func_80A873B8(this)) { @@ -1072,10 +1069,10 @@ void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { } } -void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A881E0(EnTru* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_8010BF58(&this->actor, globalCtx, this->unk_354, this->unk_378, &this->unk_1E8)) { + if (func_8010BF58(&this->actor, play, this->unk_354, this->unk_378, &this->unk_1E8)) { if (player->transformation != PLAYER_FORM_HUMAN) { this->unk_34E |= 0x80; } @@ -1103,7 +1100,7 @@ void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { } } -void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTru_Init(Actor* thisx, PlayState* play) { EnTru* this = THIS; if ((gSaveContext.save.entranceIndex != 0xC200) || (gSaveContext.save.weekEventReg[12] & 8)) { @@ -1112,13 +1109,12 @@ void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tru_Skel_01AA60, NULL, this->jointTable, this->morphTable, - 27); - Collider_InitAndSetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tru_Skel_01AA60, NULL, this->jointTable, this->morphTable, 27); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->unk_37C = -1; func_80A86924(this, 0); - this->path = SubS_GetDayDependentPath(globalCtx, ENTRU_GET_PATH(&this->actor), 255, &this->unk_384); + this->path = SubS_GetDayDependentPath(play, ENTRU_GET_PATH(&this->actor), 255, &this->unk_384); if (this->path != NULL) { this->unk_384 = 1; } @@ -1134,36 +1130,36 @@ void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) { } this->actionFunc = func_80A87FD0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } -void EnTru_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTru_Destroy(Actor* thisx, PlayState* play) { EnTru* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -void EnTru_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTru_Update(Actor* thisx, PlayState* play) { EnTru* this = THIS; f32 radius; - func_80A872AC(this, globalCtx); + func_80A872AC(this, play); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80A868F8(this); - func_80A86B0C(this, globalCtx); + func_80A86B0C(this, play); func_80A86DB8(this); radius = this->collider.dim.worldSphere.radius + 30; this->unk_388 = !(this->unk_34E & 0x80) ? EXCH_ITEM_NONE : EXCH_ITEM_NONE; - func_8013C964(&this->actor, globalCtx, radius, 20.0f, this->unk_388, this->unk_34E & 7); - func_80A8697C(this, globalCtx); + func_8013C964(&this->actor, play, radius, 20.0f, this->unk_388, this->unk_34E & 7); + func_80A8697C(this, play); func_80A86384(this->unk_394, &this->unk_1F8); } -s32 EnTru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnTru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; EnTru* this = THIS; @@ -1184,15 +1180,15 @@ s32 EnTru_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTru_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTru_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTru* this = THIS; if (limbIndex == 19) { - func_80A86BAC(this, globalCtx); + func_80A86BAC(this, play); } } -void EnTru_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTru_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnTru* this = THIS; s32 pad[3]; s32 overrideRot; @@ -1233,7 +1229,7 @@ void EnTru_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi } } -void EnTru_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTru_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80A8B408[] = { object_tru_Tex_018FA0, object_tru_Tex_0197A0, @@ -1243,19 +1239,19 @@ void EnTru_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnTru* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B408[this->unk_36E])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80A8B408[this->unk_36E])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTru_OverrideLimbDraw, EnTru_PostLimbDraw, EnTru_TransformLimbDraw, &this->actor); - func_80A85788(this->unk_394, globalCtx); - func_80A85BCC(this->unk_394, globalCtx); - func_80A85F84(this->unk_394, globalCtx); + func_80A85788(this->unk_394, play); + func_80A85BCC(this->unk_394, play); + func_80A85F84(this->unk_394, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.h b/src/overlays/actors/ovl_En_Tru/z_en_tru.h index d1090cec44..5e64c3a903 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.h +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.h @@ -5,8 +5,8 @@ struct EnTru; -typedef void (*EnTruActionFunc)(struct EnTru*, GlobalContext*); -typedef s32 (*EnTruUnkFunc)(Actor*, GlobalContext*); +typedef void (*EnTruActionFunc)(struct EnTru*, PlayState*); +typedef s32 (*EnTruUnkFunc)(Actor*, PlayState*); #define ENTRU_GET_PATH(thisx) ((thisx)->params & 0xFF) diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 3be859a992..2b8b2980d9 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -11,14 +11,14 @@ #define THIS ((EnTruMt*)thisx) -void EnTruMt_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTruMt_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTruMt_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTruMt_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTruMt_Init(Actor* thisx, PlayState* play); +void EnTruMt_Destroy(Actor* thisx, PlayState* play); +void EnTruMt_Update(Actor* thisx, PlayState* play); +void EnTruMt_Draw(Actor* thisx, PlayState* play); -void func_80B76A64(EnTruMt* this, GlobalContext* globalCtx); -void func_80B76BB8(EnTruMt* this, GlobalContext* globalCtx); -void func_80B76C38(EnTruMt* this, GlobalContext* globalCtx); +void func_80B76A64(EnTruMt* this, PlayState* play); +void func_80B76BB8(EnTruMt* this, PlayState* play); +void func_80B76C38(EnTruMt* this, PlayState* play); const ActorInit En_Tru_Mt_InitVars = { ACTOR_EN_TRU_MT, @@ -149,7 +149,7 @@ void func_80B76188(EnTruMt* this) { Math_SmoothStepToS(&this->unk_38C, 0, 4, 0x3E8, 1); } -s32 func_80B761FC(EnTruMt* this, GlobalContext* globalCtx) { +s32 func_80B761FC(EnTruMt* this, PlayState* play) { this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + 16.0f; this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; @@ -165,7 +165,7 @@ s32 func_80B761FC(EnTruMt* this, GlobalContext* globalCtx) { this->unk_3A4 = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DAMAGE2); } - globalCtx->interfaceCtx.unk_25E = 1; + play->interfaceCtx.unk_25E = 1; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); return true; } @@ -177,13 +177,13 @@ s32 func_80B761FC(EnTruMt* this, GlobalContext* globalCtx) { this->unk_38E.x = 0; } - 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); return false; } -s32 func_80B76368(EnTruMt* this, GlobalContext* globalCtx) { - Actor* bgActor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +s32 func_80B76368(EnTruMt* this, PlayState* play) { + Actor* bgActor = play->actorCtx.actorLists[ACTORCAT_BG].first; while (bgActor != NULL) { if (bgActor->id == ACTOR_BG_INGATE) { @@ -197,12 +197,12 @@ s32 func_80B76368(EnTruMt* this, GlobalContext* globalCtx) { return false; } -s32 func_80B763C4(EnTruMt* this, GlobalContext* globalCtx) { +s32 func_80B763C4(EnTruMt* this, PlayState* play) { Actor* foundActor; Actor* actor = NULL; while (true) { - foundActor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_TRU_MT); + foundActor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_TRU_MT); if (foundActor == NULL) { break; @@ -222,8 +222,8 @@ s32 func_80B763C4(EnTruMt* this, GlobalContext* globalCtx) { return false; } -void func_80B76440(EnTruMt* this, GlobalContext* globalCtx) { - if (func_80B76368(this, globalCtx)) { +void func_80B76440(EnTruMt* this, PlayState* play) { + if (func_80B76368(this, play)) { s16 temp_v1 = this->unk_394 - Math_Vec3f_Yaw(&this->unk_398, &this->actor.world.pos); if ((temp_v1 <= -0x2000) || (temp_v1 >= 0x2000)) { @@ -289,8 +289,8 @@ s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) { return sp50; } -void func_80B7679C(EnTruMt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B7679C(EnTruMt* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f sp40; Vec3f sp34; @@ -307,9 +307,9 @@ void func_80B7679C(EnTruMt* this, GlobalContext* globalCtx) { this->unk_348 = CLAMP(this->unk_348, -0x1C70, 0x1C70); } -s32 func_80B768F0(EnTruMt* this, GlobalContext* globalCtx) { +s32 func_80B768F0(EnTruMt* this, PlayState* play) { if (this->unk_328 & 0x10) { - func_80B7679C(this, globalCtx); + func_80B7679C(this, play); } return true; } @@ -319,11 +319,11 @@ void func_80B76924(EnTruMt* this) { this->unk_388 += 0x400; } -void func_80B76980(EnTruMt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B76980(EnTruMt* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (gSaveContext.unk_3F3C >= 10) { - Message_StartTextbox(globalCtx, 0x87F, &this->actor); + Message_StartTextbox(play, 0x87F, &this->actor); gSaveContext.eventInf[3] |= 0x40; gSaveContext.eventInf[4] |= 1; player->stateFlags3 &= ~0x400; @@ -340,12 +340,12 @@ void func_80B76980(EnTruMt* this, GlobalContext* globalCtx) { } } -void func_80B76A64(EnTruMt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B76A64(EnTruMt* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3s sp34; func_80B76924(this); - func_80B76980(this, globalCtx); + func_80B76980(this, play); player->stateFlags3 |= 0x400; if (this->path != NULL) { @@ -366,30 +366,30 @@ void func_80B76A64(EnTruMt* this, GlobalContext* globalCtx) { } this->unk_36C++; } - func_80B76440(this, globalCtx); + func_80B76440(this, play); } } -void func_80B76BB8(EnTruMt* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5) { - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->nextEntranceIndex = 0xA810; - globalCtx->unk_1887F = 3; +void func_80B76BB8(EnTruMt* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5) { + if (Message_ShouldAdvance(play)) { + play->nextEntranceIndex = 0xA810; + play->unk_1887F = 3; gSaveContext.nextTransition = 3; - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } } -void func_80B76C38(EnTruMt* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B76C38(EnTruMt* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80B76924(this); - func_80B76980(this, globalCtx); + func_80B76980(this, play); player->stateFlags3 |= 0x400; } -void EnTruMt_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTruMt_Init(Actor* thisx, PlayState* play) { s32 pad; EnTruMt* this = THIS; @@ -398,52 +398,52 @@ void EnTruMt_Init(Actor* thisx, GlobalContext* globalCtx) { return; } - if (func_80B763C4(this, globalCtx)) { + if (func_80B763C4(this, play)) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tru_Skel_01AA60, NULL, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_tru_Skel_01AA60, NULL, this->jointTable, this->morphTable, OBJECT_TRU_LIMB_MAX); - Collider_InitSphere(globalCtx, &this->collider); - Collider_SetSphere(globalCtx, &this->collider, &this->actor, &sSphereInit); + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); this->collider.dim.worldSphere.radius = 22; this->actor.colChkInfo.damageTable = &sDamageTable; - this->path = SubS_GetPathByIndex(globalCtx, ENTRUMT_GET_FF(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FF(&this->actor), 0x3F); this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.008f); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->unk_328 = 0; this->actor.room = -1; - this->path = SubS_GetPathByIndex(globalCtx, ENTRUMT_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FC00(&this->actor), 0x3F); func_80B76030(&this->skelAnime, 14); this->actionFunc = func_80B76A64; } -void EnTruMt_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTruMt_Destroy(Actor* thisx, PlayState* play) { EnTruMt* this = THIS; - Collider_DestroySphere(globalCtx, &this->collider); + Collider_DestroySphere(play, &this->collider); } -void EnTruMt_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTruMt_Update(Actor* thisx, PlayState* play) { EnTruMt* this = THIS; - func_80B768F0(this, globalCtx); + func_80B768F0(this, play); SkelAnime_Update(&this->skelAnime); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80B76110(this); Actor_SetFocus(&this->actor, 34.0f); if (!(gSaveContext.eventInf[4] & 1)) { - func_80B761FC(this, globalCtx); + func_80B761FC(this, play); } Actor_MoveWithoutGravity(&this->actor); @@ -474,8 +474,7 @@ void func_80B76ED4(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4) { } } -s32 EnTruMt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnTruMt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTruMt* this = THIS; if (limbIndex == OBJECT_TRU_LIMB_15) { @@ -488,7 +487,7 @@ s32 EnTruMt_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis return false; } -void EnTruMt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTruMt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnTruMt* this = THIS; MtxF* sp54; @@ -509,26 +508,26 @@ void EnTruMt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } if (limbIndex == OBJECT_TRU_LIMB_0E) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_MultVec3f(&D_80B77668, &this->unk_370); Matrix_Translate(this->unk_370.x, this->unk_370.y, this->unk_370.z, MTXMODE_NEW); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); Matrix_RotateZS(this->unk_38E.z, MTXMODE_APPLY); Matrix_RotateXS(this->unk_38E.x, MTXMODE_APPLY); Matrix_Scale(0.008f, 0.008f, 0.008f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tru_DL_0004C8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); sp54 = Matrix_GetCurrent(); if ((this->actor.child == NULL) || (this->actor.child->update == NULL)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_JC_MATO, sp54->xw, sp54->yw, - sp54->zw, this->unk_38E.x, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_JC_MATO, sp54->xw, sp54->yw, sp54->zw, + this->unk_38E.x, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), this->unk_38E.z, -1); } else if (!((EnJcMato*)this->actor.child)->hitFlag) { this->actor.child->world.pos.x = sp54->xw; @@ -536,14 +535,14 @@ void EnTruMt_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, this->actor.child->world.pos.z = sp54->zw; this->actor.child->world.rot = this->unk_38E; - this->actor.child->world.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + this->actor.child->world.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); this->actor.child->shape.rot = this->actor.child->world.rot; } } } -void EnTruMt_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTruMt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnTruMt* this = THIS; if (limbIndex == OBJECT_TRU_LIMB_15) { @@ -555,7 +554,7 @@ void EnTruMt_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* t } } -void EnTruMt_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTruMt_Draw(Actor* thisx, PlayState* play) { EnTruMt* this = THIS; TexturePtr sp48[] = { object_tru_Tex_018FA0, @@ -563,16 +562,16 @@ void EnTruMt_Draw(Actor* thisx, GlobalContext* globalCtx) { object_tru_Tex_019FA0, }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp48[this->unk_34C])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sp48[this->unk_34C])); - SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTruMt_OverrideLimbDraw, EnTruMt_PostLimbDraw, EnTruMt_TransformLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h index 049c11ecdc..657049aa29 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h @@ -6,7 +6,7 @@ struct EnTruMt; -typedef void (*EnTruMtActionFunc)(struct EnTruMt*, GlobalContext*); +typedef void (*EnTruMtActionFunc)(struct EnTruMt*, PlayState*); #define ENTRUMT_GET_FF(thisx) ((thisx)->params & 0xFF) #define ENTRUMT_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 02023b4ef4..f0ceee7d91 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -11,22 +11,22 @@ #define THIS ((EnTsn*)thisx) -void EnTsn_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTsn_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTsn_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTsn_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTsn_Init(Actor* thisx, PlayState* play); +void EnTsn_Destroy(Actor* thisx, PlayState* play); +void EnTsn_Update(Actor* thisx, PlayState* play); +void EnTsn_Draw(Actor* thisx, PlayState* play); -void func_80AE0010(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0304(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0418(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0460(EnTsn* this, GlobalContext* globalCtx); -void func_80AE04C4(EnTsn* this, GlobalContext* globalCtx); -void func_80AE04FC(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0704(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0C88(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0D10(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0D78(EnTsn* this, GlobalContext* globalCtx); -void func_80AE0F84(Actor* thisx, GlobalContext* globalCtx); +void func_80AE0010(EnTsn* this, PlayState* play); +void func_80AE0304(EnTsn* this, PlayState* play); +void func_80AE0418(EnTsn* this, PlayState* play); +void func_80AE0460(EnTsn* this, PlayState* play); +void func_80AE04C4(EnTsn* this, PlayState* play); +void func_80AE04FC(EnTsn* this, PlayState* play); +void func_80AE0704(EnTsn* this, PlayState* play); +void func_80AE0C88(EnTsn* this, PlayState* play); +void func_80AE0D10(EnTsn* this, PlayState* play); +void func_80AE0D78(EnTsn* this, PlayState* play); +void func_80AE0F84(Actor* thisx, PlayState* play); const ActorInit En_Tsn_InitVars = { ACTOR_EN_TSN, @@ -64,8 +64,8 @@ Vec3f D_80AE11BC = { 0.0f, 0.0f, 0.0f }; TexturePtr D_80AE11C8[] = { object_tsn_Tex_0073B8, object_tsn_Tex_0085B8 }; -EnTsn* func_80ADFCA0(GlobalContext* globalCtx) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +EnTsn* func_80ADFCA0(PlayState* play) { + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npc != NULL) { if ((npc->id == ACTOR_EN_TSN) && !ENTSN_GET_100(npc)) { @@ -77,7 +77,7 @@ EnTsn* func_80ADFCA0(GlobalContext* globalCtx) { return NULL; } -void func_80ADFCEC(EnTsn* this, GlobalContext* globalCtx) { +void func_80ADFCEC(EnTsn* this, PlayState* play) { this->actionFunc = func_80AE0C88; this->actor.update = func_80AE0F84; this->actor.destroy = NULL; @@ -111,29 +111,29 @@ void func_80ADFCEC(EnTsn* this, GlobalContext* globalCtx) { return; } - this->unk_1D8 = func_80ADFCA0(globalCtx); + this->unk_1D8 = func_80ADFCA0(play); this->unk_220 = 0; if (this->unk_1D8 == NULL) { Actor_MarkForDeath(&this->actor); } else if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_1) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 6); + func_800BC154(play, &play->actorCtx, &this->actor, 6); } } -void EnTsn_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTsn_Init(Actor* thisx, PlayState* play) { EnTsn* this = THIS; if (ENTSN_GET_100(&this->actor)) { - func_80ADFCEC(this, globalCtx); + func_80ADFCEC(this, play); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tsn_Skel_008AB8, &object_tsn_Anim_0092FC, NULL, NULL, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tsn_Skel_008AB8, &object_tsn_Anim_0092FC, NULL, NULL, 0); Animation_PlayLoop(&this->skelAnime, &object_tsn_Anim_0092FC); - 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->unk_220 = 0; @@ -148,13 +148,13 @@ void EnTsn_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTsn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTsn_Destroy(Actor* thisx, PlayState* play) { EnTsn* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80ADFF84(EnTsn* this, GlobalContext* globalCtx) { +void func_80ADFF84(EnTsn* this, PlayState* play) { u16 textId; if (gSaveContext.save.weekEventReg[26] & 8) { @@ -171,11 +171,11 @@ void func_80ADFF84(EnTsn* this, GlobalContext* globalCtx) { textId = 0x1084; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { - switch (globalCtx->msgCtx.currentTextId) { +void func_80AE0010(EnTsn* this, PlayState* play) { + switch (play->msgCtx.currentTextId) { case 0x107F: case 0x1080: case 0x1081: @@ -193,47 +193,47 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { break; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x107F: case 0x1081: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1080: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_001198, -10.0f); break; case 0x1082: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); gSaveContext.save.weekEventReg[25] |= 0x80; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1083: gSaveContext.save.weekEventReg[25] |= 0x80; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1084: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_000964, -10.0f); break; case 0x1085: case 0x1086: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1089: case 0x1093: gSaveContext.save.weekEventReg[26] |= 1; - func_801477B4(globalCtx); + func_801477B4(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; this->actor.textId = 0; @@ -241,24 +241,24 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { case 0x1087: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_001198, -10.0f); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1088: gSaveContext.save.weekEventReg[26] |= 1; if (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) { - func_801477B4(globalCtx); + func_801477B4(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; this->actor.textId = 0; } else { - func_80151938(globalCtx, 0x1093); + func_80151938(play, 0x1093); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); } break; case 0x107E: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; @@ -266,15 +266,15 @@ void func_80AE0010(EnTsn* this, GlobalContext* globalCtx) { } } -void func_80AE0304(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80AE0304(EnTsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80AE0010; this->unk_220 |= 1; if (this->actor.textId == 0) { - func_80ADFF84(this, globalCtx); + func_80ADFF84(this, play); } - } else if ((this->actor.xzDistToPlayer < 150.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 160.0f); + } else if ((this->actor.xzDistToPlayer < 150.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&this->actor, play, 160.0f); this->unk_220 |= 1; } else { this->unk_220 &= ~1; @@ -287,40 +287,40 @@ void func_80AE0304(EnTsn* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80AE0418(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { - Message_StartTextbox(globalCtx, 0x107D, NULL); +void func_80AE0418(EnTsn* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { + Message_StartTextbox(play, 0x107D, NULL); Actor_MarkForDeath(&this->actor); } } -void func_80AE0460(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80AE0460(EnTsn* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { ENTSN_SET_Z(&this->unk_1D8->actor, false); this->actionFunc = func_80AE0418; } else { - Actor_PickUp(&this->actor, globalCtx, GI_SEAHORSE, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, GI_SEAHORSE, 2000.0f, 1000.0f); } } -void func_80AE04C4(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80AE04C4(EnTsn* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80AE0C88; } } -void func_80AE04FC(EnTsn* this, GlobalContext* globalCtx) { +void func_80AE04FC(EnTsn* this, PlayState* play) { s32 sp24; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (Message_GetState(&globalCtx->msgCtx) == 0x10) { - sp24 = func_80123810(globalCtx); + if (Message_GetState(&play->msgCtx) == 0x10) { + sp24 = func_80123810(play); if (sp24 != 0) { gSaveContext.save.weekEventReg[26] |= 2; } if (sp24 > 0) { - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80AE0704; if (sp24 == 19) { if (CHECK_QUEST_ITEM(QUEST_UNK_19)) { @@ -355,15 +355,15 @@ void func_80AE04FC(EnTsn* this, GlobalContext* globalCtx) { } if (sp24 < 0) { - func_80151938(globalCtx, 0x1078); + func_80151938(play, 0x1078); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_001198, -10.0f); this->actionFunc = func_80AE0704; } } } -void func_80AE0698(EnTsn* this, GlobalContext* globalCtx) { - func_801477B4(globalCtx); +void func_80AE0698(EnTsn* this, PlayState* play) { + func_801477B4(play); this->actionFunc = func_80AE0C88; this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; @@ -371,27 +371,27 @@ void func_80AE0698(EnTsn* this, GlobalContext* globalCtx) { ENTSN_SET_Z(&this->unk_1D8->actor, false); } -void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80AE0704(EnTsn* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad[2]; - if ((this->unk_220 & 8) && (globalCtx->msgCtx.currentTextId == 0x1078)) { + if ((this->unk_220 & 8) && (play->msgCtx.currentTextId == 0x1078)) { this->unk_220 &= ~8; Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_001198, -10.0f); } - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 2: break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x106E: if (gSaveContext.save.weekEventReg[25] & 0x40) { - func_80151938(globalCtx, 0x1074); + func_80151938(play, 0x1074); } else { - func_80151938(globalCtx, 0x106F); + func_80151938(play, 0x106F); } this->unk_220 |= 2; gSaveContext.save.weekEventReg[25] |= 0x40; @@ -403,51 +403,51 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x1070: case 0x1071: case 0x1072: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1076: case 0x1079: Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_000964, -10.0f); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x107A: - func_80151938(globalCtx, 0x10A6); + func_80151938(play, 0x10A6); break; case 0x1075: case 0x1078: player->exchangeItemId = 0; - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; case 0x107C: if (Interface_HasEmptyBottle()) { gSaveContext.save.weekEventReg[26] |= 8; - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80AE0460; - func_80AE0460(this, globalCtx); + func_80AE0460(this, play); this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; ActorCutscene_Stop(this->actor.cutscene); this->actor.flags &= ~ACTOR_FLAG_100; REMOVE_QUEST_ITEM(QUEST_UNK_19); } else { - func_80151938(globalCtx, 0x10A8); + func_80151938(play, 0x10A8); } break; case 0x1073: case 0x1074: - func_80151938(globalCtx, 0xFF); + func_80151938(play, 0xFF); this->actionFunc = func_80AE04FC; break; case 0x107B: player->exchangeItemId = 0; - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; @@ -455,7 +455,7 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x10A6: case 0x10A8: Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); - func_80AE0698(this, globalCtx); + func_80AE0698(this, play); this->actor.flags &= ~ACTOR_FLAG_100; this->actionFunc = func_80AE04C4; break; @@ -463,7 +463,7 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x108A: case 0x1091: gSaveContext.save.weekEventReg[26] |= 4; - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); this->unk_220 |= 2; this->actor.textId = 0x1091; break; @@ -473,29 +473,29 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { case 0x108D: case 0x108E: case 0x108F: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1092: if (gSaveContext.save.weekEventReg[26] & 8) { - func_80AE0698(this, globalCtx); + func_80AE0698(this, play); } else { - func_80151938(globalCtx, 0x10A7); + func_80151938(play, 0x10A7); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_000964, -10.0f); } break; case 0x10A7: Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); - func_80AE0698(this, globalCtx); + func_80AE0698(this, play); break; case 0x1090: - func_80AE0698(this, globalCtx); + func_80AE0698(this, play); break; case 0x10A9: - func_80AE0698(this, globalCtx); + func_80AE0698(this, play); this->actor.flags &= ~ACTOR_FLAG_100; this->actionFunc = func_80AE04C4; break; @@ -526,49 +526,49 @@ void func_80AE0704(EnTsn* this, GlobalContext* globalCtx) { } } -void func_80AE0C88(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80AE0C88(EnTsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80AE0704; if ((this->actor.textId == 0x108A) || (this->actor.textId == 0x1091)) { this->unk_220 |= 4; ENTSN_SET_Z(&this->unk_1D8->actor, true); } } else if (this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 1000.0f); + func_800B8614(&this->actor, play, 1000.0f); } } -void func_80AE0D10(EnTsn* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); +void func_80AE0D10(EnTsn* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = func_80AE0D78; ActorCutscene_Stop(this->actor.cutscene); } } -void func_80AE0D78(EnTsn* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80AE0D78(EnTsn* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80AE0D10; this->unk_220 |= 4; } else if (this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 1000.0f); + func_800B8614(&this->actor, play, 1000.0f); } } -void EnTsn_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnTsn_Update(Actor* thisx, PlayState* play) { s32 pad; EnTsn* this = THIS; - 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_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 25.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, 4); SkelAnime_Update(&this->skelAnime); if (this->unk_220 & 1) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_222, &this->unk_228, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_222, &this->unk_228, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_222.x, 0, 6, 0x1838, 0x64); Math_SmoothStepToS(&this->unk_222.y, 0, 6, 0x1838, 0x64); @@ -587,13 +587,13 @@ void EnTsn_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80AE0F84(Actor* thisx, GlobalContext* globalCtx) { +void func_80AE0F84(Actor* thisx, PlayState* play) { EnTsn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -s32 EnTsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnTsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTsn* this = THIS; s16 shifted = this->unk_222.x >> 1; @@ -609,7 +609,7 @@ s32 EnTsn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnTsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnTsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTsn* this = THIS; Vec3f sp18 = D_80AE11BC; @@ -618,19 +618,19 @@ void EnTsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnTsn_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTsn_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTsn* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C5B0(globalCtx->state.gfxCtx); + func_8012C5B0(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80AE11C8[this->unk_22E])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80AE11C8[this->unk_22E])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTsn_OverrideLimbDraw, EnTsn_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h index 64df6ac423..199f98ce7a 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h @@ -5,7 +5,7 @@ struct EnTsn; -typedef void (*EnTsnActionFunc)(struct EnTsn*, GlobalContext*); +typedef void (*EnTsnActionFunc)(struct EnTsn*, PlayState*); #define ENTSN_GET_F(thisx) ((thisx)->params & 0xF) #define ENTSN_GET_100(thisx) ((thisx)->params & 0x100) 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 18476aa4e0..bf1e44e988 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,13 +11,13 @@ #define THIS ((EnTuboTrap*)thisx) -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_Idle(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx); -void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, 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_Idle(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play); +void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -58,34 +58,34 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Init(Actor* thisx, PlayState* play) { EnTuboTrap* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.shape.rot.z = 0; this->actor.world.rot.z = 0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 1.8f); - 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 = EnTuboTrap_Idle; } -void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnTuboTrap_Destroy(Actor* thisx, PlayState* play) { EnTuboTrap* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_DropCollectible(EnTuboTrap* this, PlayState* play) { s32 itemParam = ((this->actor.params >> 8) & 0x3F); s32 dropItem00Id = func_800A8150(itemParam); if (dropItem00Id > ITEM00_NO_DROP) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ((this->actor.params & 0x7F) << 8) | dropItem00Id); + Item_DropCollectible(play, &this->actor.world.pos, ((this->actor.params & 0x7F) << 8) | dropItem00Id); } } -void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { f32 rand; f32 sin; f32 cos; @@ -119,15 +119,14 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) { } else { arg5 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &vel, actorPos, -0xF0, arg5, 0x14, 0, 0, - ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, - gameplay_dangeon_keep_DL_018090); + EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0xF0, arg5, 0x14, 0, 0, ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, + 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, gameplay_dangeon_keep_DL_018090); } - func_800BBFB0(globalCtx, actorPos, 30.0f, 4, 0x14, 0x32, 0); + func_800BBFB0(play, actorPos, 30.0f, 4, 0x14, 0x32, 0); } -void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { f32 rand; f32 sin; f32 cos; @@ -141,7 +140,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) pos = *actorPos; pos.y += this->actor.depthInWater; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 0x190); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 0x190); for (i = 0, var = 0; i < 15; i++, var += 20000) { sin = Math_SinS(var); @@ -165,40 +164,39 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) arg5 = 32; } - EffectSsKakera_Spawn(globalCtx, &pos, &vel, actorPos, -0xAA, arg5, 0x32, 5, 0, - ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, - gameplay_dangeon_keep_DL_018090); + EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0xAA, arg5, 0x32, 5, 0, ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, + 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, gameplay_dangeon_keep_DL_018090); } } -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 & 0x20) && (this->actor.depthInWater > 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_MarkForDeath(&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_MarkForDeath(&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_MarkForDeath(&this->actor); return; } @@ -207,28 +205,28 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - 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_MarkForDeath(&this->actor); return; } } if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { - 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_MarkForDeath(&this->actor); } } -void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_Idle(EnTuboTrap* this, PlayState* play) { static s8 sTransformationHeight[] = { 40, 40, 40, 25, 28, }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 currentHeight; f32 transformationHeight; s16 startingRotation; @@ -236,7 +234,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { startingRotation = this->actor.home.rot.z; if ((startingRotation == 0) || (this->actor.playerHeightRel <= (startingRotation * 10.0f))) { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); currentHeight = this->actor.world.pos.y; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_10); // always update and can target @@ -254,7 +252,7 @@ void EnTuboTrap_Idle(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->targetHeight, 0.8f, 3.0f); @@ -265,7 +263,7 @@ void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { } } -void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, GlobalContext* globalCtx) { +void EnTuboTrap_FlyAtPlayer(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; @@ -282,16 +280,16 @@ void EnTuboTrap_FlyAtPlayer(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 = THIS; s32 padding; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f, 10.0f, 20.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 10.0f, 20.0f, 0x1F); Actor_SetFocus(&this->actor, 0.0f); if (this->actor.projectedPos.z < 811.0f) { @@ -309,10 +307,10 @@ void EnTuboTrap_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); } -void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gameplay_dangeon_keep_DL_017EA0); +void EnTuboTrap_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gameplay_dangeon_keep_DL_017EA0); } 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 673e57ae5d..2d0b771b2e 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 @@ -5,7 +5,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_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index c2cae36c3d..182db56591 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -10,10 +10,10 @@ #define THIS ((EnTwig*)thisx) -void EnTwig_Init(Actor* thisx, GlobalContext* globalCtx); -void EnTwig_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnTwig_Update(Actor* thisx, GlobalContext* globalCtx); -void EnTwig_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnTwig_Init(Actor* thisx, PlayState* play); +void EnTwig_Destroy(Actor* thisx, PlayState* play); +void EnTwig_Update(Actor* thisx, PlayState* play); +void EnTwig_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Twig_InitVars = { diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.h b/src/overlays/actors/ovl_En_Twig/z_en_twig.h index 0711d261c1..31328b99ec 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.h +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.h @@ -5,7 +5,7 @@ struct EnTwig; -typedef void (*EnTwigActionFunc)(struct EnTwig*, GlobalContext*); +typedef void (*EnTwigActionFunc)(struct EnTwig*, PlayState*); typedef struct EnTwig { /* 0x0000 */ Actor actor; 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 170cc6edb4..ca6b6a4191 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -10,14 +10,14 @@ #define THIS ((EnViewer*)thisx) -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 func_8089F17C(EnViewer* this, GlobalContext* globalCtx); -void func_8089F218(EnViewer* this, GlobalContext* globalCtx); -void func_8089F2C4(EnViewer* this, GlobalContext* globalCtx); +void func_8089F17C(EnViewer* this, PlayState* play); +void func_8089F218(EnViewer* this, PlayState* play); +void func_8089F2C4(EnViewer* this, PlayState* play); void EnViewer_SetupAction(EnViewer* this, EnViewerActionFunc actionFunc); 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 566c21f3ce..9c82938749 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -5,7 +5,7 @@ struct EnViewer; -typedef void (*EnViewerActionFunc)(struct EnViewer*, GlobalContext*); +typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); typedef struct EnViewer { /* 0x0000 */ Actor actor; 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 77449c7a35..4b43ec95a4 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -13,21 +13,21 @@ #define THIS ((EnVm*)thisx) -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 func_808CC420(EnVm* this); -void func_808CC490(EnVm* this, GlobalContext* globalCtx); +void func_808CC490(EnVm* this, PlayState* play); void func_808CC5C4(EnVm* this); -void func_808CC610(EnVm* this, GlobalContext* globalCtx); +void func_808CC610(EnVm* this, PlayState* play); void func_808CC788(EnVm* this); -void func_808CC820(EnVm* this, GlobalContext* globalCtx); -void func_808CCAA4(EnVm* this, GlobalContext* globalCtx); +void func_808CC820(EnVm* this, PlayState* play); +void func_808CCAA4(EnVm* this, PlayState* play); void func_808CCB08(EnVm* this); -void func_808CCB50(EnVm* this, GlobalContext* globalCtx); -void func_808CCCF0(EnVm* this, GlobalContext* globalCtx); +void func_808CCB50(EnVm* this, PlayState* play); +void func_808CCCF0(EnVm* this, PlayState* play); const ActorInit En_Vm_InitVars = { ACTOR_EN_VM, @@ -160,18 +160,17 @@ Color_RGBA8 D_808CD5BC = { 0, 0, 255, 0 }; Color_RGBA8 D_808CD5C0 = { 255, 255, 255, 255 }; -void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Init(Actor* thisx, PlayState* play) { EnVm* this = THIS; s32 i; s32 params; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_vm_Skel_003F60, &object_vm_Anim_000068, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_vm_Skel_003F60, &object_vm_Anim_000068, this->jointTable, this->morphTable, 11); - Collider_InitAndSetTris(globalCtx, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); - Collider_InitAndSetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, - this->colliderJntSphElements); + Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); + Collider_InitAndSetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); params = ENVM_GET_FF00(thisx); @@ -192,11 +191,11 @@ void EnVm_Init(Actor* thisx, GlobalContext* globalCtx) { func_808CC420(this); } -void EnVm_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Destroy(Actor* thisx, PlayState* play) { EnVm* this = THIS; - Collider_DestroyTris(globalCtx, &this->colliderTris); - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyTris(play, &this->colliderTris); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void func_808CC420(EnVm* this) { @@ -206,8 +205,8 @@ void func_808CC420(EnVm* this) { this->actionFunc = func_808CC490; } -void func_808CC490(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808CC490(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp22; s16 temp_v0; @@ -224,7 +223,7 @@ void func_808CC490(EnVm* this, GlobalContext* globalCtx) { temp_v0 = 0x1B91; } - if ((ABS_ALT(sp22) <= 0x2710) && (temp_v0 >= 0xE38) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { + if ((ABS_ALT(sp22) <= 0x2710) && (temp_v0 >= 0xE38) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { func_808CC5C4(this); } } @@ -237,8 +236,8 @@ void func_808CC5C4(EnVm* this) { this->actionFunc = func_808CC610; } -void func_808CC610(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808CC610(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp3A; s16 sp38; @@ -258,8 +257,8 @@ void func_808CC610(EnVm* this, GlobalContext* globalCtx) { sp3A)) { this->unk_214--; if (this->unk_214 == 0) { - EffectSsDeadDd_Spawn(globalCtx, &this->unk_228, &gZeroVec3f, &gZeroVec3f, &D_808CD5BC, &D_808CD5C0, 150, - -25, 16, 20); + EffectSsDeadDd_Spawn(play, &this->unk_228, &gZeroVec3f, &gZeroVec3f, &D_808CD5BC, &D_808CD5C0, 150, -25, 16, + 20); func_808CC788(this); } } @@ -274,8 +273,8 @@ void func_808CC788(EnVm* this) { this->actionFunc = func_808CC820; } -void func_808CC820(EnVm* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808CC820(EnVm* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp32; f32 temp_f2; @@ -294,7 +293,7 @@ void func_808CC820(EnVm* this, GlobalContext* globalCtx) { } } - if ((this->unk_216 < 0xAAA) || (Player_GetMask(globalCtx) == PLAYER_MASK_STONE) || (this->unk_214 == 0)) { + if ((this->unk_216 < 0xAAA) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (this->unk_214 == 0)) { this->unk_214 = 0; if (Math_StepToF(&this->unk_220, 0.0f, 0.003f)) { this->unk_210 = 0; @@ -313,7 +312,7 @@ void func_808CC820(EnVm* this, GlobalContext* globalCtx) { } Math_StepToF(&this->unk_220, 0.01f, 0.012f); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderTris.base); if (this->unk_210 == 0) { this->unk_210 = 1; @@ -333,7 +332,7 @@ void func_808CCA10(EnVm* this) { this->actionFunc = func_808CCAA4; } -void func_808CCAA4(EnVm* this, GlobalContext* globalCtx) { +void func_808CCAA4(EnVm* this, PlayState* play) { Math_ApproachS(&this->unk_216, 0, 0xA, 0x5DC); SkelAnime_Update(&this->skelAnime); if (this->unk_214 == 0) { @@ -349,7 +348,7 @@ void func_808CCB08(EnVm* this) { this->actionFunc = func_808CCB50; } -void func_808CCB50(EnVm* this, GlobalContext* globalCtx) { +void func_808CCB50(EnVm* this, PlayState* play) { Math_ApproachS(&this->unk_216, 0, 0xA, 0x5DC); if (this->unk_214 > 0) { @@ -365,10 +364,10 @@ void func_808CCB50(EnVm* this, GlobalContext* globalCtx) { } } -void func_808CCBE4(EnVm* this, GlobalContext* globalCtx) { +void func_808CCBE4(EnVm* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_vm_Anim_000068, -1.0f, Animation_GetLastFrame(&object_vm_Anim_000068), 0.0f, ANIMMODE_ONCE, 0.0f); - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 33); this->unk_214 = 33; this->unk_220 = 0.0f; @@ -383,27 +382,27 @@ void func_808CCBE4(EnVm* this, GlobalContext* globalCtx) { this->actionFunc = func_808CCCF0; } -void func_808CCCF0(EnVm* this, GlobalContext* globalCtx) { +void func_808CCCF0(EnVm* this, PlayState* play) { this->unk_216 += 0x5DC; this->unk_218 += 0x9C4; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 20.0f, 40.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 40.0f, 7); this->unk_214--; if (this->unk_214 == 1) { - EnBom* bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x, + EnBom* 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, 0); if (bomb != NULL) { bomb->timer = 0; } } else if (this->unk_214 == 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); Actor_MarkForDeath(&this->actor); } } -void func_808CCDE4(EnVm* this, GlobalContext* globalCtx) { +void func_808CCDE4(EnVm* this, PlayState* play) { s32 i; s16 temp_v0; @@ -419,7 +418,7 @@ void func_808CCDE4(EnVm* this, GlobalContext* globalCtx) { if (i != ARRAY_COUNT(this->colliderJntSphElements)) { func_800BE5CC(&this->actor, &this->colliderJntSph, i); if (this->actor.colChkInfo.damageEffect == 0) { - func_808CCBE4(this, globalCtx); + func_808CCBE4(this, play); } else if ((i == 0) && (this->actionFunc != func_808CCAA4)) { temp_v0 = (this->actor.world.rot.y - this->actor.shape.rot.y) - this->unk_218; if (ABS_ALT(temp_v0) > 0x6000) { @@ -430,16 +429,16 @@ void func_808CCDE4(EnVm* this, GlobalContext* globalCtx) { } } -void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Update(Actor* thisx, PlayState* play) { s32 pad; EnVm* this = THIS; - func_808CCDE4(this, globalCtx); + func_808CCDE4(this, play); if (this->unk_210 == 2) { - func_800B31BC(globalCtx, &this->unk_234, 20, -1, 155, 10); - if ((globalCtx->gameplayFrames % 2) != 0) { - func_800BBFB0(globalCtx, &this->unk_234, 6.0f, 1, 120, 20, 1); + func_800B31BC(play, &this->unk_234, 20, -1, 155, 10); + if ((play->gameplayFrames % 2) != 0) { + func_800BBFB0(play, &this->unk_234, 6.0f, 1, 120, 20, 1); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BIMOS_LAZER_GND - SFX_FLAG); } @@ -448,17 +447,17 @@ void EnVm_Update(Actor* thisx, GlobalContext* globalCtx) { func_800B9010(&this->actor, NA_SE_EN_BIMOS_LAZER - SFX_FLAG); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_212 += 12; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); if (this->actionFunc != func_808CCCF0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } } -s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnVm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnVm* this = THIS; if (limbIndex == OBJECT_VM_LIMB_02) { @@ -470,7 +469,7 @@ s32 EnVm_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnVm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { s32 pad; EnVm* this = THIS; Vec3f sp5C; @@ -487,8 +486,8 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Matrix_MultVecZ(1600.0f, &this->unk_228); Matrix_MultVecZ(this->unk_224 * 71.428566f, &this->unk_234); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.focus.pos, &this->unk_234, &sp5C, &sp4C, true, - true, false, true, &sp48)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.focus.pos, &this->unk_234, &sp5C, &sp4C, true, true, + false, true, &sp48)) { this->unk_224 = Math_Vec3f_DistXYZ(&this->actor.focus.pos, &sp5C) - 5.0f; this->unk_210 = 2; Math_Vec3f_Copy(&this->unk_234, &sp5C); @@ -504,12 +503,12 @@ void EnVm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnVm_Draw(Actor* thisx, PlayState* play) { s32 pad; EnVm* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -517,7 +516,7 @@ void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = &gfx[1]; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVm_OverrideLimbDraw, EnVm_PostLimbDraw, &this->actor); if (this->unk_210 == 2) { @@ -529,10 +528,10 @@ void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->unk_234.x, this->unk_234.y + 10.0f, this->unk_234.z, MTXMODE_NEW); Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY); - gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(&gfx[3], 0, 0, 255, 255, 255, 168); gDPSetEnvColor(&gfx[4], 0, 0, 255, 0); - gSPSegment(&gfx[5], 0x08, D_808CD58C[globalCtx->gameplayFrames & 7]); + gSPSegment(&gfx[5], 0x08, D_808CD58C[play->gameplayFrames & 7]); gSPDisplayList(&gfx[6], gameplay_keep_DL_044300); POLY_XLU_DISP = &gfx[7]; @@ -541,17 +540,17 @@ void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_224 > 0.0f) { gfx = POLY_OPA_DISP; - gSPSegment(&gfx[0], 0x08, func_8012CB28(globalCtx->state.gfxCtx, 0, this->unk_212)); + gSPSegment(&gfx[0], 0x08, func_8012CB28(play->state.gfxCtx, 0, this->unk_212)); Matrix_Translate(this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->unk_216, this->unk_218 + this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_Scale(this->unk_220, this->unk_220, this->unk_224 * 0.0015f, MTXMODE_APPLY); - gSPMatrix(&gfx[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[2], object_vm_DL_002728); POLY_OPA_DISP = &gfx[3]; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 1901ac34af..69c16dd719 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.h +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.h @@ -5,7 +5,7 @@ struct EnVm; -typedef void (*EnVmActionFunc)(struct EnVm*, GlobalContext*); +typedef void (*EnVmActionFunc)(struct EnVm*, PlayState*); #define ENVM_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) 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 8ebb04c227..4ab04487c4 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -12,36 +12,36 @@ #define THIS ((EnWallmas*)thisx) -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_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_SetupLand(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_TimerInit(EnWallmas* this, PlayState* play); +void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play); +void EnWallmas_SetupDrop(EnWallmas* this, PlayState* play); +void EnWallmas_Drop(EnWallmas* this, PlayState* play); +void EnWallmas_SetupLand(EnWallmas* this, PlayState* play); +void EnWallmas_Land(EnWallmas* this, PlayState* play); void EnWallmas_SetupStand(EnWallmas* this); -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_Stand(EnWallmas* this, PlayState* play); void EnWallmas_SetupWalk(EnWallmas* this); -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_Walk(EnWallmas* this, PlayState* play); void EnWallmas_SetupJumpToCeiling(EnWallmas* this); -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play); void EnWallmas_SetupReturnToCeiling(EnWallmas* this); -void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Damage(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play); +void EnWallmas_Damage(EnWallmas* this, PlayState* play); void EnWallmas_SetupCooldown(EnWallmas* this); -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play); +void EnWallmas_SetupDie(EnWallmas* this, PlayState* play); +void EnWallmas_Die(EnWallmas* this, PlayState* play); +void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play); +void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play); void EnWallmas_ProximityOrSwitchInit(EnWallmas* this); -void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx); -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx); +void EnWallmas_WaitForProximity(EnWallmas* this, PlayState* play); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play); +void EnWallmas_Stun(EnWallmas* this, PlayState* play); const ActorInit En_Wallmas_InitVars = { ACTOR_EN_WALLMAS, @@ -139,14 +139,14 @@ static s8 sLimbIndexToLimbPosIndex[] = { -1, -1, -1, -1, 0, -1, -1, 1, -1, 2, -1, -1, 3, -1, 4, -1, -1, 5, -1, -1, -1, 6, 7, -1, 8, }; -void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Init(Actor* thisx, PlayState* play) { EnWallmas* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.5f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWallmasterSkel, &gWallmasterIdleAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWallmasterSkel, &gWallmasterIdleAnim, this->jointTable, this->morphTable, WALLMASTER_LIMB_MAX); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->switchFlag = WALLMASTER_GET_SWITCH_FLAG(thisx); @@ -161,7 +161,7 @@ void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 25.0f); if (WALLMASTER_IS_FROZEN(&this->actor)) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, this->actor.world.pos.y - 15.0f, this->actor.world.pos.z, this->actor.world.rot.x, (this->actor.world.rot.y + 0x5900), this->actor.world.rot.z, 0xFF50); this->actor.params &= ~0x80; @@ -170,7 +170,7 @@ void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { } if (WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_FLAG) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { Actor_MarkForDeath(&this->actor); return; } @@ -179,14 +179,14 @@ void EnWallmas_Init(Actor* thisx, GlobalContext* globalCtx) { } else if (WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_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 = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->actor.parent != NULL) { EnEncount1* encount1 = (EnEncount1*)this->actor.parent; @@ -208,18 +208,18 @@ void EnWallmas_Freeze(EnWallmas* this) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); } -void EnWallmas_ThawIfFrozen(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_ThawIfFrozen(EnWallmas* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider.base.colType = 0; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 11, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 11, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } -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_1; this->actor.flags |= ACTOR_FLAG_20; @@ -231,8 +231,8 @@ void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_WaitToDrop; } -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; @@ -256,12 +256,12 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - EnWallmas_SetupDrop(this, globalCtx); + EnWallmas_SetupDrop(this, play); } } -void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void EnWallmas_SetupDrop(EnWallmas* this, PlayState* play) { + Player* player = GET_PLAYER(play); Animation_Change(&this->skelAnime, &gWallmasterLungeAnim, 0.0f, 20.0f, Animation_GetLastFrame(&gWallmasterLungeAnim), ANIMMODE_ONCE, 0.0f); @@ -276,32 +276,32 @@ void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { this->actionFunc = EnWallmas_Drop; } -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->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { EnWallmas_SetupReturnToCeiling(this); - } else if (!Play_InCsMode(globalCtx) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && + } else if (!Play_InCsMode(play) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && (this->actor.xzDistToPlayer < 30.0f) && (this->actor.playerHeightRel < -5.0f) && (-(f32)(player->cylinder.dim.height + 10) < this->actor.playerHeightRel)) { - EnWallmas_SetupTakePlayer(this, globalCtx); + EnWallmas_SetupTakePlayer(this, play); } 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); } } -void EnWallmas_SetupLand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupLand(EnWallmas* this, PlayState* play) { Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 1.0f, 41.0f, Animation_GetLastFrame(&gWallmasterJumpAnim), 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); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = EnWallmas_Land; } -void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Land(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnWallmas_SetupStand(this); } @@ -312,7 +312,7 @@ void EnWallmas_SetupStand(EnWallmas* this) { this->actionFunc = EnWallmas_Stand; } -void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stand(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnWallmas_SetupWalk(this); } @@ -327,7 +327,7 @@ void EnWallmas_SetupWalk(EnWallmas* this) { this->actionFunc = EnWallmas_Walk; } -void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Walk(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnWallmas_SetupJumpToCeiling(this); } @@ -346,7 +346,7 @@ void EnWallmas_SetupJumpToCeiling(EnWallmas* this) { this->actionFunc = EnWallmas_JumpToCeiling; } -void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnWallmas_SetupReturnToCeiling(this); } @@ -360,8 +360,8 @@ void EnWallmas_SetupReturnToCeiling(EnWallmas* this) { this->actionFunc = EnWallmas_ReturnToCeiling; } -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) { @@ -382,7 +382,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { if ((WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_TIMER_ONLY) || (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->detectionRadius)) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } else { EnWallmas_ProximityOrSwitchInit(this); } @@ -402,10 +402,10 @@ void EnWallmas_SetupDamage(EnWallmas* this, s32 arg1) { this->actionFunc = EnWallmas_Damage; } -void EnWallmas_Damage(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Damage(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { - EnWallmas_SetupDie(this, globalCtx); + EnWallmas_SetupDie(this, play); } else { EnWallmas_SetupCooldown(this); } @@ -426,24 +426,24 @@ void EnWallmas_SetupCooldown(EnWallmas* this) { this->actionFunc = EnWallmas_Cooldown; } -void EnWallmas_Cooldown(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Cooldown(EnWallmas* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EnWallmas_SetupReturnToCeiling(this); } } -void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupDie(EnWallmas* this, PlayState* play) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - func_800B3030(globalCtx, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 250, -10, 2); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 250, -10, 2); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); this->actionFunc = EnWallmas_Die; } -void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Die(EnWallmas* this, PlayState* play) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0015f)) { Actor_SetScale(&this->actor, 0.01f); - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x90); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); Actor_MarkForDeath(&this->actor); } @@ -451,18 +451,18 @@ void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.x; } -void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterHoverAnim, -5.0f); this->timer = -30; this->actionFunc = EnWallmas_TakePlayer; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; this->yTarget = this->actor.playerHeightRel; - func_800B724C(globalCtx, &this->actor, 18); + func_800B724C(play, &this->actor, 18); } -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)) { func_800B8E58(player, player->ageProperties->unk_92 + NA_SE_VO_LI_DAMAGE_S); @@ -499,7 +499,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { if (this->timer == 30) { play_sound(NA_SE_OC_ABYSS); - func_80169FDC(&globalCtx->state); + func_80169FDC(&play->state); } } @@ -514,17 +514,17 @@ void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { } } -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) < this->detectionRadius) { - EnWallmas_TimerInit(this, globalCtx); + EnWallmas_TimerInit(this, play); } } -void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { - EnWallmas_TimerInit(this, globalCtx); +void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { + EnWallmas_TimerInit(this, play); this->timer = 81; } } @@ -539,13 +539,13 @@ void EnWallmas_SetupStun(EnWallmas* this) { this->actionFunc = EnWallmas_Stun; } -void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_Stun(EnWallmas* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { - EnWallmas_ThawIfFrozen(this, globalCtx); + EnWallmas_ThawIfFrozen(this, play); if (this->actor.colChkInfo.health == 0) { EnWallmas_SetupDamage(this, false); } else { @@ -555,7 +555,7 @@ void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_UpdateDamage(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_UpdateDamage(EnWallmas* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); @@ -563,14 +563,14 @@ void EnWallmas_UpdateDamage(EnWallmas* this, GlobalContext* globalCtx) { if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || (!(this->collider.info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { if (Actor_ApplyDamage(&this->actor) == 0) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); this->actor.flags &= ~ACTOR_FLAG_1; } else if (this->actor.colChkInfo.damage != 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_DAMAGE); } - EnWallmas_ThawIfFrozen(this, globalCtx); + EnWallmas_ThawIfFrozen(this, play); if (this->actor.colChkInfo.damageEffect != WALLMASTER_DMGEFF_HOOKSHOT) { if (this->actor.colChkInfo.damageEffect == WALLMASTER_DMGEFF_ICE_ARROW) { @@ -603,9 +603,9 @@ void EnWallmas_UpdateDamage(EnWallmas* this, GlobalContext* globalCtx) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, - this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); } EnWallmas_SetupDamage(this, true); @@ -615,12 +615,12 @@ void EnWallmas_UpdateDamage(EnWallmas* this, GlobalContext* globalCtx) { } } -void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Update(Actor* thisx, PlayState* play) { s32 pad; EnWallmas* this = THIS; - EnWallmas_UpdateDamage(this, globalCtx); - this->actionFunc(this, globalCtx); + EnWallmas_UpdateDamage(this, play); + this->actionFunc(this, play); if ((this->actionFunc != EnWallmas_WaitToDrop) && (this->actionFunc != EnWallmas_WaitForProximity) && (this->actionFunc != EnWallmas_TakePlayer) && (this->actionFunc != EnWallmas_WaitForSwitchFlag)) { @@ -629,15 +629,15 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != EnWallmas_Drop) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 25.0f, 0.0f, 0x1DU); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, 0x1DU); } 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_Damage) && (this->actor.bgCheckFlags & 1) && (this->actor.freezeTimer == 0)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -655,14 +655,14 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWallmas_DrawShadow(EnWallmas* this, GlobalContext* globalCtx) { +void EnWallmas_DrawShadow(EnWallmas* this, PlayState* play) { s32 pad; f32 xzScale; MtxF mf; Gfx* gfx; if ((this->actor.floorPoly != NULL) && ((this->timer < 81) || (this->actionFunc == EnWallmas_Stun))) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -680,17 +680,16 @@ void EnWallmas_DrawShadow(EnWallmas* this, GlobalContext* globalCtx) { } Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPMatrix(&gfx[2], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[2], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[3], gCircleShadowDL); POLY_OPA_DISP = &gfx[4]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -s32 EnWallmas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnWallmas_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnWallmas* this = THIS; if (limbIndex == WALLMASTER_LIMB_ROOT) { @@ -704,7 +703,7 @@ s32 EnWallmas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void EnWallmas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnWallmas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnWallmas* this = THIS; Gfx* gfx; @@ -716,7 +715,7 @@ void EnWallmas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_MultVecX(1000.0f, &this->limbPos[9]); Matrix_MultVecX(-1000.0f, &this->limbPos[10]); } else if (limbIndex == WALLMASTER_LIMB_HAND) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -726,33 +725,31 @@ void EnWallmas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_RotateZS(0xAAA, MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix(&gfx[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], gWallmasterLittleFingerDL); POLY_OPA_DISP = &gfx[2]; Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void EnWallmas_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWallmas_Draw(Actor* thisx, PlayState* play) { EnWallmas* this = THIS; if (this->actionFunc != EnWallmas_WaitToDrop) { - func_8012C28C(globalCtx->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnWallmas_OverrideLimbDraw, EnWallmas_PostLimbDraw, - &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, - this->drawDmgEffType); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnWallmas_OverrideLimbDraw, EnWallmas_PostLimbDraw, &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } if (this->actor.colorFilterTimer != 0) { - func_800AE5A0(globalCtx); + func_800AE5A0(play); } - EnWallmas_DrawShadow(this, globalCtx); + EnWallmas_DrawShadow(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 06d4d24d15..64ca9b58bc 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -32,7 +32,7 @@ typedef enum { struct EnWallmas; -typedef void (*EnWallmasActionFunc)(struct EnWallmas*, GlobalContext*); +typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); typedef struct EnWallmas { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index 4065bdf395..65bca693ad 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -11,15 +11,15 @@ #define THIS ((EnWarpUzu*)thisx) -void EnWarpUzu_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWarpUzu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWarpUzu_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWarpUzu_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWarpUzu_Init(Actor* thisx, PlayState* play); +void EnWarpUzu_Destroy(Actor* thisx, PlayState* play); +void EnWarpUzu_Update(Actor* thisx, PlayState* play); +void EnWarpUzu_Draw(Actor* thisx, PlayState* play); -void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx); -void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx); -void func_80A66384(EnWarpUzu* this, GlobalContext* globalCtx); -void EnWarpUzu_DoNothing(EnWarpUzu* this, GlobalContext* globalCtx); +void func_80A66208(EnWarpUzu* this, PlayState* play); +void func_80A66278(EnWarpUzu* this, PlayState* play); +void func_80A66384(EnWarpUzu* this, PlayState* play); +void EnWarpUzu_DoNothing(EnWarpUzu* this, PlayState* play); const ActorInit En_Warp_Uzu_InitVars = { ACTOR_EN_WARP_UZU, @@ -60,23 +60,23 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void EnWarpUzu_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWarpUzu_Init(Actor* thisx, PlayState* play) { EnWarpUzu* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sCylinderInit); thisx->targetMode = 0; - func_80A66208(this, globalCtx); + func_80A66208(this, play); } -void EnWarpUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWarpUzu_Destroy(Actor* thisx, PlayState* play) { EnWarpUzu* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } static Vec3f D_80A664FC = { 0.0f, 53.0f, -29.0f }; -void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) { +void func_80A66208(EnWarpUzu* this, PlayState* play) { Vec3f sp24; this->actor.textId = 0; @@ -87,50 +87,50 @@ void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) { this->actionFunc = func_80A66278; } -void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { +void func_80A66278(EnWarpUzu* this, PlayState* play) { Player* player; s16 temp_v0; s16 phi_a0; s16 phi_v1; do { - player = GET_PLAYER(globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80A66384(this, globalCtx); + player = GET_PLAYER(play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80A66384(this, play); } else { phi_a0 = ABS((s16)(Actor_YawBetweenActors(&this->actor, &player->actor) - this->actor.shape.rot.y)); temp_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; phi_v1 = ABS(temp_v0); if (phi_a0 >= 0x2AAB) { if (phi_v1 < 0x238E) { - func_800B8614(&this->actor, globalCtx, 70.0f); + func_800B8614(&this->actor, play, 70.0f); } } } } while (0); } -void func_80A66384(EnWarpUzu* this, GlobalContext* globalCtx) { - globalCtx->nextEntranceIndex = 0x22A0; - gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = globalCtx->nextEntranceIndex; - func_80169EFC(&globalCtx->state); +void func_80A66384(EnWarpUzu* this, PlayState* play) { + play->nextEntranceIndex = 0x22A0; + gSaveContext.respawn[RESTART_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + func_80169EFC(&play->state); gSaveContext.respawnFlag = -2; this->actionFunc = EnWarpUzu_DoNothing; } -void EnWarpUzu_DoNothing(EnWarpUzu* this, GlobalContext* globalCtx) { +void EnWarpUzu_DoNothing(EnWarpUzu* this, PlayState* play) { } -void EnWarpUzu_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWarpUzu_Update(Actor* thisx, PlayState* play) { EnWarpUzu* this = THIS; s32 pad; this->actor.uncullZoneForward = 1000.0f; - 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); } -void EnWarpUzu_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_warp_uzu_DL_000EC0); +void EnWarpUzu_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_warp_uzu_DL_000EC0); } diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.h b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.h index 7cc148b978..a1a7766e6a 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.h +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.h @@ -5,7 +5,7 @@ struct EnWarpUzu; -typedef void (*EnWarpUzuActionFunc)(struct EnWarpUzu*, GlobalContext*); +typedef void (*EnWarpUzuActionFunc)(struct EnWarpUzu*, PlayState*); typedef struct EnWarpUzu { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 5759b0a9bd..fd9226483c 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -12,17 +12,17 @@ #define THIS ((EnWarptag*)thisx) -void EnWarptag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWarptag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWarptag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWarpTag_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWarptag_Init(Actor* thisx, PlayState* play); +void EnWarptag_Destroy(Actor* thisx, PlayState* play); +void EnWarptag_Update(Actor* thisx, PlayState* play); +void EnWarpTag_Draw(Actor* thisx, PlayState* play); -void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, GlobalContext* globalCtx); -void EnWarpTag_WaitForPlayer(EnWarptag* this, GlobalContext* globalCtx); -void EnWarpTag_Unused809C09A0(EnWarptag* this, GlobalContext* globalCtx); -void EnWarpTag_Unused809C0A20(EnWarptag* this, GlobalContext* globalCtx); -void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx); -void EnWarpTag_GrottoReturn(EnWarptag* this, GlobalContext* globalCtx); +void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, PlayState* play); +void EnWarpTag_WaitForPlayer(EnWarptag* this, PlayState* play); +void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play); +void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play); +void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play); +void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play); const ActorInit En_Warp_tag_InitVars = { ACTOR_EN_WARP_TAG, @@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3S(shape.rot, 0, ICHAIN_STOP), }; -void EnWarptag_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWarptag_Init(Actor* thisx, PlayState* play) { EnWarptag* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -58,7 +58,7 @@ void EnWarptag_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnWarpTag_WaitForPlayer; } else { - if ((this->dangeonKeepObject = Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_DANGEON_KEEP)) < 0) { + if ((this->dangeonKeepObject = Object_GetIndex(&play->objectCtx, GAMEPLAY_DANGEON_KEEP)) < 0) { Actor_MarkForDeath(&this->dyna.actor); } @@ -70,34 +70,34 @@ void EnWarptag_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWarptag_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWarptag_Destroy(Actor* thisx, PlayState* play) { EnWarptag* this = THIS; if (this->dyna.actor.draw != NULL) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } /** * Loads DynaPoly from GAMEPLAY_DANGEON_KEEP. */ -void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->dangeonKeepObject)) { +void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->dangeonKeepObject)) { this->actionFunc = EnWarpTag_WaitForPlayer; DynaPolyActor_Init(&this->dyna, 0x1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gWarpTagGoronTrialBaseCollider); + DynaPolyActor_LoadMesh(play, &this->dyna, &gWarpTagGoronTrialBaseCollider); this->dyna.actor.objBankIndex = this->dangeonKeepObject; this->dyna.actor.draw = EnWarpTag_Draw; } } -void EnWarpTag_WaitForPlayer(EnWarptag* this, GlobalContext* globalCtx) { - if (!Player_InCsMode(&globalCtx->state) && (this->dyna.actor.xzDistToPlayer <= 30.0f) && +void EnWarpTag_WaitForPlayer(EnWarptag* this, PlayState* play) { + if (!Player_InCsMode(&play->state) && (this->dyna.actor.xzDistToPlayer <= 30.0f) && (this->dyna.actor.playerHeightRel <= 10.0f)) { if (GET_WARPTAG_INVISIBLE(&this->dyna.actor)) { - func_800B7298(globalCtx, NULL, 0x51); + func_800B7298(play, NULL, 0x51); this->actionFunc = EnWarpTag_GrottoReturn; } else { - func_800B7298(globalCtx, NULL, 0xF); + func_800B7298(play, NULL, 0xF); this->actionFunc = EnWarpTag_RespawnPlayer; } } @@ -106,32 +106,32 @@ void EnWarpTag_WaitForPlayer(EnWarptag* this, GlobalContext* globalCtx) { /** * Unused ActionFunc: assigned in EnWarpTag_Init, no known variants use. */ -void EnWarpTag_Unused809C09A0(EnWarptag* this, GlobalContext* globalCtx) { - if (func_800B8718(&this->dyna.actor, &globalCtx->state)) { +void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { + if (func_800B8718(&this->dyna.actor, &play->state)) { // func above: checks for ACTOR_FLAG_20000000, returns true and resets if set, else return false // this actor doesnt have that flag set default, or in init, and this is called shortly after init // and I doubt its set externally by another actor, so I believe this is unused // might be a bug, they might have meant to set actor flag (0x2000 0000) up above but mistyped (0x200 0000) // also GET_WARPTAG_3C0 should always return 2C0 -> 0xF for all known in-game uses, which is OOB - func_80152434(globalCtx, D_809C1000[GET_WARPTAG_3C0(&this->dyna.actor)]); // unk message function + func_80152434(play, D_809C1000[GET_WARPTAG_3C0(&this->dyna.actor)]); // unk message function this->actionFunc = EnWarpTag_Unused809C0A20; } else { - func_800B8804(&this->dyna.actor, globalCtx, 50.0f); // updates player->unk_A90 + func_800B8804(&this->dyna.actor, play, 50.0f); // updates player->unk_A90 } } /** * Unused ActionFunc: assigned by EnWarpTag_Unused809C09A0, no known variants use. */ -void EnWarpTag_Unused809C0A20(EnWarptag* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode == 9) { - func_800B7298(globalCtx, NULL, 7); +void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == 9) { + func_800B7298(play, NULL, 7); this->actionFunc = EnWarpTag_RespawnPlayer; ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); - } else if (globalCtx->msgCtx.ocarinaMode >= 2) { - globalCtx->msgCtx.ocarinaMode = 4; + } else if (play->msgCtx.ocarinaMode >= 2) { + play->msgCtx.ocarinaMode = 4; this->actionFunc = EnWarpTag_Unused809C09A0; } } @@ -139,7 +139,7 @@ void EnWarpTag_Unused809C0A20(EnWarptag* this, GlobalContext* globalCtx) { /** * ActionFunc: Goron Trial (Moon), respawn at the beginning of goron rolling track, try again. */ -void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx) { +void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { ActorEntry* playerActorEntry; Player* player; s32 playerSpawnIndex; @@ -149,13 +149,13 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx) { u8 playerForm; s16 playerParams; - player = GET_PLAYER(globalCtx); - if (globalCtx->playerActorCsIds[4] >= 0 && ActorCutscene_GetCurrentIndex() != globalCtx->playerActorCsIds[4]) { - if (ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[4]) == 0) { - ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[4]); + player = GET_PLAYER(play); + if (play->playerActorCsIds[4] >= 0 && ActorCutscene_GetCurrentIndex() != play->playerActorCsIds[4]) { + if (ActorCutscene_GetCanPlayNext(play->playerActorCsIds[4]) == 0) { + ActorCutscene_SetIntentToPlay(play->playerActorCsIds[4]); } else { - ActorCutscene_StartAndSetUnkLinkFields(globalCtx->playerActorCsIds[4], &this->dyna.actor); + ActorCutscene_StartAndSetUnkLinkFields(play->playerActorCsIds[4], &this->dyna.actor); func_800B8E58(player, NA_SE_PL_WARP_PLATE); func_8016566C(0); } @@ -195,7 +195,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx) { entranceIndex = gSaveContext.save.entranceIndex; playerSpawnIndex = playerSpawnIndexPerForm[playerForm]; - playerActorEntry = &globalCtx->linkActorEntry[playerSpawnIndex]; + playerActorEntry = &play->linkActorEntry[playerSpawnIndex]; newRespawnPos.x = playerActorEntry->pos.x; newRespawnPos.y = playerActorEntry->pos.y; newRespawnPos.z = playerActorEntry->pos.z; @@ -209,11 +209,11 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx) { // why are we getting player home rotation from the room data? doesnt player have home.rot.y? // especially because we are converting from deg to binang, but isnt home.rot.y already in binang?? Play_SetRespawnData( - &globalCtx->state, 0, entranceIndex, // parameter 3 is called "sceneSetup" - globalCtx->setupEntranceList[playerSpawnIndex].room, playerParams, &newRespawnPos, + &play->state, 0, entranceIndex, // parameter 3 is called "sceneSetup" + play->setupEntranceList[playerSpawnIndex].room, playerParams, &newRespawnPos, ((((playerActorEntry->rot.y >> 7) & 0x1FF) / 180.0f) * 32768.0f)); // DEG_TO_BINANG ? - func_80169EFC(&globalCtx->state); + func_80169EFC(&play->state); gSaveContext.respawnFlag = ~0x4; func_80165690(); } @@ -231,7 +231,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, GlobalContext* globalCtx) { /** * ActionFunc: Deku Playground, return to North Clock Town. */ -void EnWarpTag_GrottoReturn(EnWarptag* this, GlobalContext* globalCtx) { +void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->dyna.actor.cutscene) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -241,9 +241,9 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, GlobalContext* globalCtx) { } if (this->grottoExitDelay++ == 10) { - globalCtx->nextEntranceIndex = globalCtx->setupExitList[GET_WARPTAG_EXIT_INDEX(&this->dyna.actor)]; - Scene_SetExitFade(globalCtx); - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = play->setupExitList[GET_WARPTAG_EXIT_INDEX(&this->dyna.actor)]; + Scene_SetExitFade(play); + play->sceneLoadFlag = 0x14; func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); func_801A4058(5); if (1) {} @@ -252,22 +252,22 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, GlobalContext* globalCtx) { } } -void EnWarptag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWarptag_Update(Actor* thisx, PlayState* play) { EnWarptag* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } /** * Only draws for Goron Trial (a rainblow animated target). */ -void EnWarpTag_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void EnWarpTag_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&gWarpTagRainbowAnimMat)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWarpTagRainbowAnimMat)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gWarpTagGoronTrialBaseDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h index 925fda9305..8bc521f15e 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h @@ -5,7 +5,7 @@ struct EnWarptag; -typedef void (*EnWarptagActionFunc)(struct EnWarptag*, GlobalContext*); +typedef void (*EnWarptagActionFunc)(struct EnWarptag*, PlayState*); typedef struct EnWarptag { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index df347dc36b..d17a3780af 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -12,15 +12,15 @@ #define THIS ((EnWaterEffect*)thisx) -void EnWaterEffect_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWaterEffect_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWaterEffect_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWaterEffect_Init(Actor* thisx, PlayState* play); +void EnWaterEffect_Destroy(Actor* thisx, PlayState* play); +void EnWaterEffect_Update(Actor* thisx, PlayState* play); +void EnWaterEffect_Draw(Actor* thisx, PlayState* play); -void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2); -void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2); -void func_80A5A534(Actor* thisx, GlobalContext* globalCtx); -void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2); +void func_80A59C04(Actor* thisx, PlayState* play2); +void func_80A5A184(Actor* thisx, PlayState* play2); +void func_80A5A534(Actor* thisx, PlayState* play); +void func_80A5A6B8(Actor* thisx, PlayState* play2); const ActorInit En_Water_Effect_InitVars = { ACTOR_EN_WATER_EFFECT, @@ -78,7 +78,7 @@ void func_80A58908(EnWaterEffect* this, Vec3f* arg1, Vec3f* arg2, u8 arg3) { } } -void EnWaterEffect_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWaterEffect_Init(Actor* thisx, PlayState* play) { s32 pad; EnWaterEffect* this = THIS; @@ -97,10 +97,10 @@ void EnWaterEffect_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->actor.shape.rot.z * 0.0002f); if (this->actor.params == ENWATEREFFECT_777) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30A); - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30B); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30A); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30B); } else if (this->actor.params == ENWATEREFFECT_778) { this->unk_DC4 = -3; } else if (this->actor.params == ENWATEREFFECT_779) { @@ -127,13 +127,13 @@ void EnWaterEffect_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWaterEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWaterEffect_Destroy(Actor* thisx, PlayState* play) { } -void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWaterEffect* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); EnWaterEffectStruct* ptr = &this->unk_144[0]; s16 i; s16 j; @@ -143,11 +143,11 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { u8 phi_v1; Vec3f sp88; - if (!Flags_GetSwitch(globalCtx, this->actor.params)) { + if (!Flags_GetSwitch(play, this->actor.params)) { this->unk_DC4++; if ((this->unk_DC4 % 32) == 0) { if (Rand_ZeroOne() < 0.5f) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 10.0f, 40.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, 4); sp88.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; sp88.y = this->actor.world.pos.y; sp88.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; @@ -198,11 +198,11 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { if (phi_v0) { ptr->unk_00 = 0; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_BOMB_DROP_WATER); + SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_04, 30, NA_SE_EV_BOMB_DROP_WATER); } else { ptr->unk_04.y = this->actor.floorHeight; if (ptr->unk_2A == 0) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP_GRD); + SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_04, 30, NA_SE_EV_WATERDROP_GRD); ptr->unk_00 = 3; ptr->unk_2C.x = 0.1f; ptr->unk_2C.y = 0.6f; @@ -212,15 +212,15 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { ptr->unk_28 = 9; Math_Vec3f_Copy(&sp98, &ptr->unk_04); sp98.y += 3.0f; - EffectSsGSplash_Spawn(globalCtx, &sp98, NULL, NULL, 1, 100); + EffectSsGSplash_Spawn(play, &sp98, NULL, NULL, 1, 100); } else { ptr->unk_00 = 0; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_WATERDROP); - EffectSsGRipple_Spawn(globalCtx, &ptr->unk_04, 70, 500, 0); - EffectSsGRipple_Spawn(globalCtx, &ptr->unk_04, 70, 500, 10); + SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_04, 30, NA_SE_EV_WATERDROP); + EffectSsGRipple_Spawn(play, &ptr->unk_04, 70, 500, 0); + EffectSsGRipple_Spawn(play, &ptr->unk_04, 70, 500, 10); Math_Vec3f_Copy(&sp98, &ptr->unk_04); sp98.y += 10.0f; - EffectSsGSplash_Spawn(globalCtx, &sp98, NULL, NULL, 1, 300); + EffectSsGSplash_Spawn(play, &sp98, NULL, NULL, 1, 300); } } @@ -249,7 +249,7 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { ptr->unk_3C = 150; ptr->unk_28 = Rand_ZeroFloat(5.0f) + 7.0f; } else { - EffectSsGRipple_Spawn(globalCtx, &ptr->unk_04, 0, 200, 0); + EffectSsGRipple_Spawn(play, &ptr->unk_04, 0, 200, 0); ptr->unk_00 = 0; } } @@ -266,9 +266,9 @@ void EnWaterEffect_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnWaterEffect_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnWaterEffect* this = THIS; s32 pad; EnWaterEffectStruct* backupPtr = &this->unk_144[0]; @@ -278,7 +278,7 @@ void EnWaterEffect_Draw(Actor* thisx, GlobalContext* globalCtx2) { OPEN_DISPS(gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->unk_144) / 2; i++, ptr++) { if ((ptr->unk_00 == 1) || (ptr->unk_00 == 2)) { @@ -296,9 +296,9 @@ void EnWaterEffect_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); if (ptr->unk_00 == 1) { - Matrix_RotateYS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); + Matrix_RotateYS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)), MTXMODE_APPLY); } else { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } Matrix_Scale(ptr->unk_2C.x, ptr->unk_2C.y, 1.0f, MTXMODE_APPLY); @@ -378,15 +378,15 @@ void func_80A599E8(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { } } -void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80A59C04(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWaterEffect* this = THIS; s16 i; s16 j; f32 temp_f0_2; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp90; - Actor* rotaryRoom = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; + Actor* rotaryRoom = play->actorCtx.actorLists[ACTORCAT_BG].first; CollisionPoly* sp88; EnWaterEffectStruct* ptr = &this->unk_144[0]; u8 phi_s5; @@ -403,13 +403,13 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { this->unk_DC6--; } - if ((rotaryRoom != NULL) && Flags_GetSwitch(globalCtx, (rotaryRoom->params >> 1) & 0x7F)) { + if ((rotaryRoom != NULL) && Flags_GetSwitch(play, (rotaryRoom->params >> 1) & 0x7F)) { this->unk_DC6 = Rand_ZeroFloat(150.0f) + 100.0f; - } else if (!Play_InCsMode(globalCtx)) { + } else if (!Play_InCsMode(play)) { this->unk_DC4++; if (this->unk_DC6 == 0) { this->unk_DC6 = Rand_ZeroFloat(150.0f) + 100.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 10.0f, 40.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, 4); sp74.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; sp74.y = this->actor.world.pos.y; sp74.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; @@ -466,7 +466,7 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { (fabsf(ptr->unk_04.y - (player->actor.world.pos.y + 25.0f)) < 30.0f)) { phi_s5 = true; if ((player->transformation != PLAYER_FORM_GORON) && !player->isBurning) { - func_800B8D50(globalCtx, &this->actor, 2.0f, Rand_ZeroFloat(0x10000), 0.0f, 0x10); + func_800B8D50(play, &this->actor, 2.0f, Rand_ZeroFloat(0x10000), 0.0f, 0x10); for (j = 0; j < ARRAY_COUNT(player->flameTimers); j++) { player->flameTimers[j] = Rand_S16Offset(0, 200); } @@ -478,7 +478,7 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { Math_Vec3f_Copy(&sp90, &ptr->unk_04); sp90.y += 30.0f; - temp_f0_2 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp88, &sp90); + temp_f0_2 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp88, &sp90); if (fabsf(temp_f0_2 - this->actor.floorHeight) > 200.0f) { phi_s5 = true; } @@ -493,7 +493,7 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { for (j = 0; j < 5; j++) { func_80A599E8(this, &ptr->unk_04, 2); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_04, 30, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_04, 30, NA_SE_EV_PLANT_BROKEN); } ptr->unk_2A++; } @@ -503,18 +503,18 @@ void func_80A59C04(Actor* thisx, GlobalContext* globalCtx2) { } } -void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80A5A184(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWaterEffect* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; EnWaterEffectStruct* ptr = &this->unk_144[0]; u8 flag = false; s16 i; OPEN_DISPS(gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->unk_144); i++, ptr++) { if (ptr->unk_00 == 4) { @@ -527,15 +527,15 @@ void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, (u8)ptr->unk_38, 0, 0, (u8)ptr->unk_3C); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (ptr->unk_01 * -20) & 0x1FF, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (ptr->unk_01 * -20) & 0x1FF, 0x20, 0x80)); Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); if (ptr->unk_2A >= 2) { - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); } else { - Matrix_RotateYS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); + Matrix_RotateYS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)), MTXMODE_APPLY); } Matrix_Scale(ptr->unk_2C.x, ptr->unk_2C.y, 1.0f, MTXMODE_APPLY); @@ -544,8 +544,7 @@ void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_0043E8); if ((ptr->unk_2A & 1) == 0) { @@ -553,19 +552,19 @@ void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateXS(ptr->unk_28, MTXMODE_APPLY); Matrix_Scale(ptr->unk_2C.z, ptr->unk_2C.z, ptr->unk_2C.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); } } } - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); CLOSE_DISPS(gfxCtx); } -void func_80A5A534(Actor* thisx, GlobalContext* globalCtx) { +void func_80A5A534(Actor* thisx, PlayState* play) { EnWaterEffect* this = THIS; s32 i; @@ -601,19 +600,19 @@ void func_80A5A534(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80A5A6B8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWaterEffect* this = THIS; EnWaterEffectStruct* ptr = &this->unk_144[0]; u8 phi_s4 = false; s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 165, 235, 255, 128); @@ -623,12 +622,11 @@ void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { if ((this->actor.params == ENWATEREFFECT_777) || (this->actor.params == ENWATEREFFECT_778)) { if (this->unk_E2C > 1.0f) { - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000DE0)); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000DE0)); Matrix_Scale(this->unk_DC8[1].y, this->unk_DC8[1].z, this->unk_DC8[1].y, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->unk_E2C); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_000420); } @@ -636,12 +634,11 @@ void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Pop(); if (this->unk_E30 > 1.0f) { - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E0C)); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E0C)); Matrix_Scale(this->unk_DC8[2].y, this->unk_DC8[2].z, this->unk_DC8[2].y, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->unk_E30); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_000730); } @@ -652,11 +649,11 @@ void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { } if ((this->unk_E34 > 1.0f) && (this->actor.params != ENWATEREFFECT_780)) { - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E40)); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E40)); Matrix_Scale(this->unk_DC8[3].y, this->unk_DC8[3].z, this->unk_DC8[3].y, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->unk_E34); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_000A48); } @@ -664,22 +661,22 @@ void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Pop(); if ((this->actor.params == ENWATEREFFECT_777) || (this->actor.params == ENWATEREFFECT_780)) { - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E58)); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E58)); Matrix_Scale(this->unk_DC8[4].y, this->unk_DC8[4].z, this->unk_DC8[4].y, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)this->unk_E38); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_000CD8); } if (this->actor.params == ENWATEREFFECT_777) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->unk_144) / 2; i++, ptr++) { if (ptr->unk_00 == 3) { if (!phi_s4) { - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex)); gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0); @@ -694,12 +691,12 @@ void func_80A5A6B8(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(ptr->unk_2C.x, 1.0f, ptr->unk_2C.x, MTXMODE_APPLY); Matrix_RotateYF(ptr->unk_2C.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_0042F8); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c index b21e2f0b8e..ba5a16db33 100644 --- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c +++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c @@ -10,10 +10,10 @@ #define THIS ((EnWdhand*)thisx) -void EnWdhand_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWdhand_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWdhand_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWdhand_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWdhand_Init(Actor* thisx, PlayState* play); +void EnWdhand_Destroy(Actor* thisx, PlayState* play); +void EnWdhand_Update(Actor* thisx, PlayState* play); +void EnWdhand_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Wdhand_InitVars = { diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h index 28e0d07da9..cf15b02249 100644 --- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h +++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.h @@ -5,7 +5,7 @@ struct EnWdhand; -typedef void (*EnWdhandActionFunc)(struct EnWdhand*, GlobalContext*); +typedef void (*EnWdhandActionFunc)(struct EnWdhand*, PlayState*); typedef struct EnWdhand { /* 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 0f81d088d2..152fba1479 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 @@ -10,30 +10,30 @@ #define THIS ((EnWeatherTag*)thisx) -void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWeatherTag_Draw(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_Draw(Actor* thisx, PlayState* play); -void func_80966A08(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966A68(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_Die(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966B08(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966E0C(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966E84(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966EF0(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966F74(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80966FEC(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80967148(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_DoNothing(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx); -void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, GlobalContext* globalCtx); -void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx); -void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx); -void func_80967608(EnWeatherTag* this, GlobalContext* globalCtx); +void func_80966A08(EnWeatherTag* this, PlayState* play); +void func_80966A68(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play); +void func_80966B08(EnWeatherTag* this, PlayState* play); +void func_80966BF4(EnWeatherTag* this, PlayState* play); +void func_80966D20(EnWeatherTag* this, PlayState* play); +void func_80966E0C(EnWeatherTag* this, PlayState* play); +void func_80966E84(EnWeatherTag* this, PlayState* play); +void func_80966EF0(EnWeatherTag* this, PlayState* play); +void func_80966F74(EnWeatherTag* this, PlayState* play); +void func_80966FEC(EnWeatherTag* this, PlayState* play); +void func_80967060(EnWeatherTag* this, PlayState* play); +void func_80967148(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_DoNothing(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_Unused_80967250(EnWeatherTag* this, PlayState* play); +void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, PlayState* play); +void func_809672DC(EnWeatherTag* this, PlayState* play); +void func_809674C8(EnWeatherTag* this, PlayState* play); +void func_80967608(EnWeatherTag* this, PlayState* play); const ActorInit En_Weather_Tag_InitVars = { ACTOR_EN_WEATHER_TAG, @@ -57,10 +57,10 @@ void EnWeatherTag_SetupAction(EnWeatherTag* this, EnWeatherTagActionFunc func) { this->actionFunc = func; } -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 = THIS; s32 pad; Path* path; @@ -93,16 +93,16 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { EnWeatherTag_SetupAction(this, func_80966FEC); break; case WEATHERTAG_TYPE_UNK5: - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 7); - globalCtx->skyboxId = 3; - globalCtx->envCtx.unk_1F = 5; - globalCtx->envCtx.unk_20 = 5; + func_800BC154(play, &play->actorCtx, &this->actor, 7); + play->skyboxId = 3; + play->envCtx.unk_1F = 5; + play->envCtx.unk_20 = 5; D_801F4E74 = 1.0f; EnWeatherTag_SetupAction(this, func_80966BF4); break; case WEATHERTAG_TYPE_WATERMURK: pathID = WEATHER_TAG_PATHID(this); - path = &globalCtx->setupPathList[pathID]; + path = &play->setupPathList[pathID]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; EnWeatherTag_SetupAction(this, func_809672DC); @@ -114,26 +114,25 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { // matches but unused params is suspicious // called WeatherTag_CheckEnableWeatherEffect in OOT, that's where "weatherMode" came from -u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24, +u8 func_80966608(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24, u8 weatherMode) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { - if (globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20) { + if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; - if (!(globalCtx->envCtx.unk_1E == 0) || - ((globalCtx->envCtx.unk_1F != 1) && (globalCtx->envCtx.unk_21 == 0))) { + if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; if (D_801BDBB0 != weatherMode) { D_801BDBB0 = weatherMode; - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_1F = new1F; - globalCtx->envCtx.unk_20 = new20; + play->envCtx.unk_21 = 1; + play->envCtx.unk_1F = new1F; + play->envCtx.unk_20 = new20; D_801BDBB4 = new20; - globalCtx->envCtx.unk_24 = new24; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + play->envCtx.unk_24 = new24; + play->envCtx.unk_22 = play->envCtx.unk_24; } returnVal = 1; } @@ -144,25 +143,23 @@ u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ // again with the unused parameters // called WeatherTag_CheckRestoreWeather in OOT -u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, - u16 new24) { - Player* player = GET_PLAYER(globalCtx); +u8 func_80966758(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24) { + Player* player = GET_PLAYER(play); u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { - if (globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20) { + if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; - if (!(globalCtx->envCtx.unk_1E == 0) || - ((globalCtx->envCtx.unk_1F != 1) && (globalCtx->envCtx.unk_21 == 0))) { + if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; D_801BDBB0 = 0; - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_1F = new1F; - globalCtx->envCtx.unk_20 = new20; + play->envCtx.unk_21 = 1; + play->envCtx.unk_1F = new1F; + play->envCtx.unk_20 = new20; D_801BDBB4 = new20; - globalCtx->envCtx.unk_24 = new24; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + play->envCtx.unk_24 = new24; + play->envCtx.unk_22 = play->envCtx.unk_24; returnVal = 1; } } @@ -171,8 +168,8 @@ u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ } // modify wind? -void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_8096689C(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 distance; f32 partialResult; @@ -189,28 +186,28 @@ void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) { partialResult = (1.0f - (distance / this->fadeDistance)); // strength based on distance? partialResult = (this->unk154 / 32768.0f) * partialResult; // another scale applied - globalCtx->envCtx.windSpeed = (this->actor.world.rot.z * partialResult) + 30.0f; + play->envCtx.windSpeed = (this->actor.world.rot.z * partialResult) + 30.0f; if (partialResult > 0.01f) { - globalCtx->envCtx.sandstormState = 8; + play->envCtx.sandstormState = 8; D_801F4E30 = 0x9B; - } else if (globalCtx->envCtx.sandstormState == 8) { + } else if (play->envCtx.sandstormState == 8) { D_801F4E30 = 0; - globalCtx->envCtx.sandstormState = 9; + play->envCtx.sandstormState = 9; } } // WEATHERTAG_TYPE_UNK0 -void func_80966A08(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80966A08(EnWeatherTag* this, PlayState* play) { this->unk154 += this->unk158; if (this->unk154 >= 0x8001) { this->unk154 = 0x8000; EnWeatherTag_SetupAction(this, func_80966A68); } - func_8096689C(this, globalCtx); + func_8096689C(this, play); } // WEATHERTAG_TYPE_UNK0 2 -void func_80966A68(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80966A68(EnWeatherTag* this, PlayState* play) { this->unk154 -= (this->unk158 >> 1); if (this->unk154 == 0) { this->unk154 = 1; @@ -221,10 +218,10 @@ void func_80966A68(EnWeatherTag* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); EnWeatherTag_SetupAction(this, EnWeatherTag_Die); } - func_8096689C(this, globalCtx); + func_8096689C(this, play); } -void EnWeatherTag_Die(EnWeatherTag* this, GlobalContext* globalCtx) { +void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play) { Actor_MarkForDeath(&this->actor); } @@ -232,12 +229,12 @@ void EnWeatherTag_Die(EnWeatherTag* this, GlobalContext* globalCtx) { // areas that use: all of ikana, swamp, termina field,stonetower temple, // poisoned swamp: placed behind the water fall from ikana // this tag stops spawning after STT cleared? -void func_80966B08(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966608(this, globalCtx, 0, 0, globalCtx->envCtx.unk_1F, 5, 100, 2) || D_801BDBB0 == 2) { - globalCtx->skyboxId = 3; +void func_80966B08(EnWeatherTag* this, PlayState* play) { + if (func_80966608(this, play, 0, 0, play->envCtx.unk_1F, 5, 100, 2) || D_801BDBB0 == 2) { + play->skyboxId = 3; EnWeatherTag_SetupAction(this, func_80966D20); } else if (D_801F4E74 <= 0.01f) { - globalCtx->skyboxId = 1; + play->skyboxId = 1; } else { Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); } @@ -245,13 +242,13 @@ void func_80966B08(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_UNK5: only one in ikana canyon, corner of cliff right outside of stone tower entrance // because it uses cutsecnes.. is this the clear ikana cutcsene? -void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80966BF4(EnWeatherTag* this, PlayState* play) { u8 newUnk20; CsCmdActorAction* tmpAction; - if (Cutscene_CheckActorAction(globalCtx, 567)) { - tmpAction = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 567)]; - if ((globalCtx->csCtx.frames >= tmpAction->startFrame) && (tmpAction->action >= 2)) { + if (Cutscene_CheckActorAction(play, 567)) { + tmpAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 567)]; + if ((play->csCtx.frames >= tmpAction->startFrame) && (tmpAction->action >= 2)) { switch (gSaveContext.save.day) { case 0: case 1: @@ -268,18 +265,18 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); - if (globalCtx->envCtx.unk_20 != newUnk20) { - globalCtx->envCtx.unk_21 = 1; - globalCtx->envCtx.unk_20 = newUnk20; - globalCtx->envCtx.unk_24 = 100; - globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; + if (play->envCtx.unk_20 != newUnk20) { + play->envCtx.unk_21 = 1; + play->envCtx.unk_20 = newUnk20; + play->envCtx.unk_24 = 100; + play->envCtx.unk_22 = play->envCtx.unk_24; } } } } // WEATHERTAG_TYPE_UNK1 2 -void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80966D20(EnWeatherTag* this, PlayState* play) { u8 newUnk20; switch (gSaveContext.save.day) { @@ -297,7 +294,7 @@ void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx) { } Math_SmoothStepToF(&D_801F4E74, 1.0f, 0.2f, 0.02f, 0.001f); - if (func_80966758(this, globalCtx, 1, 0, 5, newUnk20, 100)) { + if (func_80966758(this, play, 1, 0, 5, newUnk20, 100)) { EnWeatherTag_SetupAction(this, func_80966B08); } @@ -309,17 +306,17 @@ void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_WINTERFOG: // areas affected: winter goron village, path to mountain village, // path to goron village winter, winter mountain village -void func_80966E0C(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966608(this, globalCtx, 0, 1, 0, 2, 60, 3)) { - globalCtx->envCtx.unk_F2[3] = 0x80; +void func_80966E0C(EnWeatherTag* this, PlayState* play) { + if (func_80966608(this, play, 0, 1, 0, 2, 60, 3)) { + play->envCtx.unk_F2[3] = 0x80; EnWeatherTag_SetupAction(this, func_80966E84); } } // WEATHERTAG_TYPE_WINTERFOG 2 -void func_80966E84(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966758(this, globalCtx, 1, 0, 2, 0, 60)) { - globalCtx->envCtx.unk_F2[3] = 0; +void func_80966E84(EnWeatherTag* this, PlayState* play) { + if (func_80966758(this, play, 1, 0, 2, 0, 60)) { + play->envCtx.unk_F2[3] = 0; EnWeatherTag_SetupAction(this, func_80966E0C); } } @@ -327,19 +324,19 @@ void func_80966E84(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_UNK3: unused in vanilla? // just a heavy fog like the winter fog, but unused? // wait if you enter the scene through a room instead of fog you get a flash rain shower -void func_80966EF0(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966608(this, globalCtx, 0, 1, 0, 2, 100, 4)) { - func_800FD78C(globalCtx); - globalCtx->envCtx.unk_F2[0] = 60; +void func_80966EF0(EnWeatherTag* this, PlayState* play) { + if (func_80966608(this, play, 0, 1, 0, 2, 100, 4)) { + func_800FD78C(play); + play->envCtx.unk_F2[0] = 60; EnWeatherTag_SetupAction(this, func_80966F74); } } // WEATHERTAG_TYPE_UNK3 2 -void func_80966F74(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966758(this, globalCtx, 1, 0, 2, 0, 100)) { - func_800FD858(globalCtx); - globalCtx->envCtx.unk_F2[0] = 0; +void func_80966F74(EnWeatherTag* this, PlayState* play) { + if (func_80966758(this, play, 1, 0, 2, 0, 100)) { + func_800FD858(play); + play->envCtx.unk_F2[0] = 0; EnWeatherTag_SetupAction(this, func_80966EF0); } } @@ -347,7 +344,7 @@ void func_80966F74(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_UNK4: no visible effect, what does it doooo?? // used in south clock town??? romani ranch, clock tower rooftop woodfall..? stt // all of them have shorter distances though, like 0xA and 0x6, so their locations are important -void func_80966FEC(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80966FEC(EnWeatherTag* this, PlayState* play) { // weirdly, not the same as the other param lookup used in the rest of the file, which is float s32 distance = WEATHER_TAG_RANGE100INT(this); if (distance > 0) { @@ -355,13 +352,13 @@ void func_80966FEC(EnWeatherTag* this, GlobalContext* globalCtx) { } // unique pirates fortress behavior? - if ((globalCtx->sceneNum == SCENE_KAIZOKU) && (globalCtx->actorCtx.unk5 & 2)) { + if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.unk5 & 2)) { EnWeatherTag_SetupAction(this, func_80967060); } } // type 4_2 pirates fortres only? -void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80967060(EnWeatherTag* this, PlayState* play) { Vec3f vec1; Vec3f vec2; @@ -369,9 +366,9 @@ void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) { vec1.y = -145.0f; vec1.z = 181.0f; - func_80169474(globalCtx, &vec1, &vec2); + func_80169474(play, &vec1, &vec2); - if (globalCtx->view.fovy < 25.0f) { + if (play->view.fovy < 25.0f) { if ((vec2.x >= 70.0f) && (vec2.x < 250.0f) && (vec2.y >= 30.0f) && (vec2.y < 210.0f)) { EnWeatherTag_SetupAction(this, func_80967148); } @@ -379,7 +376,7 @@ void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) { } // type 4_3, start cutscene then die? -void func_80967148(EnWeatherTag* this, GlobalContext* globalCtx) { +void func_80967148(EnWeatherTag* this, PlayState* play) { s16 tempCutscene; tempCutscene = this->actor.cutscene; @@ -391,102 +388,101 @@ void func_80967148(EnWeatherTag* this, GlobalContext* globalCtx) { } } -void EnWeatherTag_DoNothing(EnWeatherTag* this, GlobalContext* globalCtx) { +void EnWeatherTag_DoNothing(EnWeatherTag* this, PlayState* play) { } // these two are isolated, they call themselves but nothing calls them? -void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966608(this, globalCtx, 0, 1, 0, 4, 100, 5)) { - func_800FD78C(globalCtx); - globalCtx->envCtx.unk_E3 = 1; - globalCtx->envCtx.unk_F2[0] = 60; +void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, PlayState* play) { + if (func_80966608(this, play, 0, 1, 0, 4, 100, 5)) { + func_800FD78C(play); + play->envCtx.unk_E3 = 1; + play->envCtx.unk_F2[0] = 60; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_80967250); } } // these two are isolated, they call themselves but nothing calls them -void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966758(this, globalCtx, 1, 0, 4, 0, 100)) { - func_800FD858(globalCtx); - globalCtx->envCtx.unk_E3 = 2; - globalCtx->envCtx.unk_F2[0] = 0; +void EnWeatherTag_Unused_80967250(EnWeatherTag* this, PlayState* play) { + if (func_80966758(this, play, 1, 0, 4, 0, 100)) { + func_800FD858(play); + play->envCtx.unk_E3 = 2; + play->envCtx.unk_F2[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_809671B8); } } // WEATHERTAG_TYPE_WATERMURK: (pinnacle rock, zora cape, zora coast) -void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809672DC(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; f32 distance; f32 range; f32 strength = 0.0f; - Actor_GetClosestPosOnPath(this->pathPoints, this->pathCount, &GET_PLAYER(globalCtx)->actor.world.pos, + Actor_GetClosestPosOnPath(this->pathPoints, this->pathCount, &GET_PLAYER(play)->actor.world.pos, &this->actor.world.pos, false); distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); range = WEATHER_TAG_RANGE100(this); if (distance < range) { - globalCtx->envCtx.sandstormState = 6; + play->envCtx.sandstormState = 6; strength = 1.0f - (distance / range); if (0.8f < strength) { strength = 1.0f; } D_801F4E30 = (200.0f * strength); } else { - if (globalCtx->envCtx.sandstormState == 6) { + if (play->envCtx.sandstormState == 6) { D_801F4E30 = 0; - globalCtx->envCtx.sandstormState = 7; + play->envCtx.sandstormState = 7; } } - Math_SmoothStepToS(&globalCtx->envCtx.lightSettings.fogNear, (s16)(-40.0f * strength), 1, 1, 1); + Math_SmoothStepToS(&play->envCtx.lightSettings.fogNear, (s16)(-40.0f * strength), 1, 1, 1); } // WEATHERTAG_TYPE_LOCALDAY2RAIN: rain proximity as approaching rainy scene // (milk road day 2 approaching ranch it rains, walking away towards termfield no rain) -void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809674C8(EnWeatherTag* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && - (globalCtx->envCtx.unk_F2[2] == 0)) { + (play->envCtx.unk_F2[2] == 0)) { D_801BDBB0 = 1; - func_800FD78C(globalCtx); - globalCtx->envCtx.unk_F2[4] = 0x20; + func_800FD78C(play); + play->envCtx.unk_F2[4] = 0x20; EnWeatherTag_SetupAction(this, func_80967608); } } } else { - if ((globalCtx->envCtx.unk_F2[4] != 0) && !(globalCtx->state.frames & 3)) { - globalCtx->envCtx.unk_F2[4]--; - if ((globalCtx->envCtx.unk_F2[4]) == 8) { - func_800FD858(globalCtx); + if ((play->envCtx.unk_F2[4] != 0) && !(play->state.frames & 3)) { + play->envCtx.unk_F2[4]--; + if ((play->envCtx.unk_F2[4]) == 8) { + func_800FD858(play); } } } } // WEATHERTAG_TYPE_LOCALDAY2RAIN 2 -void func_80967608(EnWeatherTag* this, GlobalContext* globalCtx) { - if ((WEATHER_TAG_RANGE100(this) + 10.0f) < - Actor_XZDistanceBetweenActors(&GET_PLAYER(globalCtx)->actor, &this->actor)) { +void func_80967608(EnWeatherTag* this, PlayState* play) { + if ((WEATHER_TAG_RANGE100(this) + 10.0f) < Actor_XZDistanceBetweenActors(&GET_PLAYER(play)->actor, &this->actor)) { D_801BDBB0 = 0; EnWeatherTag_SetupAction(this, func_809674C8); } } -void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = THIS; - this->actionFunc(this, globalCtx); - if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.msgMode != 0) && - (globalCtx->msgCtx.currentTextId == 0x5E6) && (!FrameAdvance_IsEnabled(&globalCtx->state)) && - (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { + this->actionFunc(this, play); + if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && + (!FrameAdvance_IsEnabled(&play->state)) && (play->sceneLoadFlag == 0) && + (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15); if (REG(15) != 0) { @@ -495,5 +491,5 @@ void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWeatherTag_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWeatherTag_Draw(Actor* thisx, PlayState* play) { } 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 f1a876718b..3f1b80c0ea 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 @@ -5,7 +5,7 @@ struct EnWeatherTag; -typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, GlobalContext*); +typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); typedef struct EnWeatherTag { /* 0x000 */ 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 89e765b984..3abb119ed1 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -12,48 +12,48 @@ #define THIS ((EnWf*)thisx) -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 func_80990F0C(EnWf* this); -void func_80990F50(EnWf* this, GlobalContext* globalCtx); +void func_80990F50(EnWf* this, PlayState* play); void func_80990FC8(EnWf* this); -void func_80991040(EnWf* this, GlobalContext* globalCtx); -void func_80991174(EnWf* this, GlobalContext* globalCtx); +void func_80991040(EnWf* this, PlayState* play); +void func_80991174(EnWf* this, PlayState* play); void func_80991200(EnWf* this); -void func_80991280(EnWf* this, GlobalContext* globalCtx); +void func_80991280(EnWf* this, PlayState* play); void func_80991438(EnWf* this); -void func_8099149C(EnWf* this, GlobalContext* globalCtx); +void func_8099149C(EnWf* this, PlayState* play); void func_80991738(EnWf* this); -void func_8099177C(EnWf* this, GlobalContext* globalCtx); +void func_8099177C(EnWf* this, PlayState* play); void func_80991948(EnWf* this); -void func_809919F4(EnWf* this, GlobalContext* globalCtx); +void func_809919F4(EnWf* this, PlayState* play); void func_80991C04(EnWf* this); -void func_80991C80(EnWf* this, GlobalContext* globalCtx); -void func_80992068(EnWf* this, GlobalContext* globalCtx); +void func_80991C80(EnWf* this, PlayState* play); +void func_80992068(EnWf* this, PlayState* play); void func_8099223C(EnWf* this); -void func_809922B4(EnWf* this, GlobalContext* globalCtx); -void func_809923E4(EnWf* this, GlobalContext* globalCtx); -void func_809924EC(EnWf* this, GlobalContext* globalCtx); +void func_809922B4(EnWf* this, PlayState* play); +void func_809923E4(EnWf* this, PlayState* play); +void func_809924EC(EnWf* this, PlayState* play); void func_809926D0(EnWf* this); -void func_80992784(EnWf* this, GlobalContext* globalCtx); +void func_80992784(EnWf* this, PlayState* play); void func_8099282C(EnWf* this); -void func_809928CC(EnWf* this, GlobalContext* globalCtx); -void func_80992A74(EnWf* this, GlobalContext* globalCtx); -void func_80992B8C(EnWf* this, GlobalContext* globalCtx); +void func_809928CC(EnWf* this, PlayState* play); +void func_80992A74(EnWf* this, PlayState* play); +void func_80992B8C(EnWf* this, PlayState* play); void func_80992D6C(EnWf* this); -void func_80992E0C(EnWf* this, GlobalContext* globalCtx); +void func_80992E0C(EnWf* this, PlayState* play); void func_80992FD4(EnWf* this); -void func_80993018(EnWf* this, GlobalContext* globalCtx); +void func_80993018(EnWf* this, PlayState* play); void func_80993148(EnWf* this); -void func_80993194(EnWf* this, GlobalContext* globalCtx); +void func_80993194(EnWf* this, PlayState* play); void func_80993350(EnWf* this); -void func_809933A0(EnWf* this, GlobalContext* globalCtx); +void func_809933A0(EnWf* this, PlayState* play); void func_80993524(EnWf* this); -void func_8099357C(EnWf* this, GlobalContext* globalCtx); -s32 func_8099408C(GlobalContext* globalCtx, EnWf* this); +void func_8099357C(EnWf* this, PlayState* play); +s32 func_8099408C(PlayState* play, EnWf* this); const ActorInit En_Wf_InitVars = { ACTOR_EN_WF, @@ -260,7 +260,7 @@ static InitChainEntry sInitChain[] = { static s32 D_809942D8 = 0; -void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Init(Actor* thisx, PlayState* play) { EnWf* this = THIS; s32 i; s32 temp_s0; @@ -268,9 +268,9 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 70.0f); this->actor.shape.shadowAlpha = 150; - Collider_InitAndSetJntSph(globalCtx, &this->collider1, &this->actor, &sJntSphInit, this->collider1Elements); - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->collider3, &this->actor, &sCylinderInit2); + Collider_InitAndSetJntSph(play, &this->collider1, &this->actor, &sJntSphInit, this->collider1Elements); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider3, &this->actor, &sCylinderInit2); Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos); if (this->actor.shape.rot.x <= 0) { @@ -293,11 +293,11 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { temp_s0 = CLAMP(temp_s0, 1, 255); this->actor.shape.rot.z = 0; this->actor.world.rot.z = 0; - this->actor.child = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, - temp_s0 | 0xFF00); + this->actor.child = + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, temp_s0 | 0xFF00); if (this->actor.child != NULL) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->actor.child->xzDistToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &player->actor); this->unk_2A4 = (temp_s0 * 0.5f) + 45.0f; @@ -308,7 +308,7 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { } } - if (Flags_GetClear(globalCtx, this->actor.room)) { + if (Flags_GetClear(play, this->actor.room)) { Actor_MarkForDeath(&this->actor); return; } @@ -317,7 +317,7 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.0075f); if (this->actor.params == 0) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_NORMAL_LIMB_MAX); this->actor.hintId = 0x4C; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable2, &sColChkInfoInit); @@ -325,7 +325,7 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider1.elements[1].info.toucher.damage = 8; this->actor.colChkInfo.health = 6; } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_WHITE_LIMB_MAX); this->actor.hintId = 0x57; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable1, &sColChkInfoInit); @@ -338,7 +338,7 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { func_80992FD4(this); } - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, 5); if (D_809942D8 == 0) { for (i = 0; i < ARRAY_COUNT(sNormalEyeTextures); i++) { @@ -350,12 +350,12 @@ void EnWf_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A2 = Rand_ZeroFloat(96.0f); } -void EnWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); - Collider_DestroyCylinder(globalCtx, &this->collider3); + Collider_DestroyJntSph(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); + Collider_DestroyCylinder(play, &this->collider3); } void func_809907D4(EnWf* this) { @@ -370,13 +370,13 @@ void func_809907D4(EnWf* this) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 80); } -void func_80990854(EnWf* this, GlobalContext* globalCtx) { +void func_80990854(EnWf* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->collider2.base.colType = COLTYPE_HIT5; this->collider3.base.colType = COLTYPE_HIT5; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(globalCtx, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, 10, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } @@ -392,8 +392,8 @@ void EnWf_Blink(EnWf* this) { } } -s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80990948(PlayState* play, EnWf* this, s16 arg2) { + Player* player = GET_PLAYER(play); s32 sp38; s32 pad; s32 pad2; @@ -410,13 +410,13 @@ s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { return true; } - if (func_800BE184(globalCtx, &this->actor, 100.0f, 10000, 12000, this->actor.shape.rot.y) && - ((player->swordAnimation == 0x11) || ((globalCtx->gameplayFrames % 2) != 0))) { + if (func_800BE184(play, &this->actor, 100.0f, 10000, 12000, this->actor.shape.rot.y) && + ((player->swordAnimation == 0x11) || ((play->gameplayFrames % 2) != 0))) { func_8099282C(this); return true; } - if (func_800BE184(globalCtx, &this->actor, 100.0f, 24000, 0x2AA8, this->actor.shape.rot.y)) { + if (func_800BE184(play, &this->actor, 100.0f, 24000, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & 8) && (sp38 < 12000)) { @@ -424,7 +424,7 @@ s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { return true; } - if ((player->swordAnimation == 0x11) || ((globalCtx->gameplayFrames % 2) != 0)) { + if ((player->swordAnimation == 0x11) || ((play->gameplayFrames % 2) != 0)) { func_8099282C(this); return true; } @@ -433,7 +433,7 @@ s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { return true; } - actor = func_800BC444(globalCtx, &this->actor, 80.0f); + actor = func_800BC444(play, &this->actor, 80.0f); if ((actor != NULL) && (actor->id == ACTOR_EN_BOM_CHU)) { EnBomChu* bomchu = (EnBomChu*)actor; @@ -447,13 +447,13 @@ s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { if (arg2 != 0) { if (!Actor_IsFacingPlayer(&this->actor, 7000)) { - func_80992A74(this, globalCtx); + func_80992A74(this, play); return true; } sp2E = player->actor.shape.rot.y - this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor)) { - if (((globalCtx->gameplayFrames % 8) != 0) || (ABS_ALT(sp2E) < 0x38E0)) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor)) { + if (((play->gameplayFrames % 8) != 0) || (ABS_ALT(sp2E) < 0x38E0)) { func_80991C04(this); return true; } @@ -465,7 +465,7 @@ s32 func_80990948(GlobalContext* globalCtx, EnWf* this, s16 arg2) { return false; } -void func_80990C6C(EnWf* this, GlobalContext* globalCtx, s32 arg2) { +void func_80990C6C(EnWf* this, PlayState* play, s32 arg2) { static Vec3f D_809942DC = { 0.0f, 0.1f, 0.0f }; static Color_RGBA8 D_809942E8 = { 185, 140, 70, 255 }; static Color_RGBA8 D_809942EC = { 255, 255, 255, 255 }; @@ -476,7 +476,7 @@ void func_80990C6C(EnWf* this, GlobalContext* globalCtx, s32 arg2) { s16 phi_s6; if (this->actor.floorPoly != NULL) { - temp_v0 = func_800C99D4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); + temp_v0 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if (temp_v0 != 5) { if ((temp_v0 == 15) || (temp_v0 == 14)) { phi_s1 = &D_809942EC; @@ -491,16 +491,16 @@ void func_80990C6C(EnWf* this, GlobalContext* globalCtx, s32 arg2) { sp88.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; sp88.y = Rand_ZeroFloat(5.0f) + this->actor.world.pos.y; sp88.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; - func_800B0F18(globalCtx, &sp88, &gZeroVec3f, &D_809942DC, phi_s1, phi_s1, phi_s6, 5, + func_800B0F18(play, &sp88, &gZeroVec3f, &D_809942DC, phi_s1, phi_s1, phi_s6, 5, Rand_ZeroFloat(5.0f) + 14.0f); } } } } -void func_80990E4C(EnWf* this, GlobalContext* globalCtx) { +void func_80990E4C(EnWf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 1.0f) && (this->actor.bgCheckFlags & 1)) { - func_80990C6C(this, globalCtx, 2); + func_80990C6C(this, play, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_WALK); } } @@ -530,7 +530,7 @@ void func_80990F0C(EnWf* this) { this->actionFunc = func_80990F50; } -void func_80990F50(EnWf* this, GlobalContext* globalCtx) { +void func_80990F50(EnWf* this, PlayState* play) { f32 phi_f2 = 240.0f; if (this->unk_2A0 != 0) { @@ -555,7 +555,7 @@ void func_80990FC8(EnWf* this) { this->actionFunc = func_80991040; } -void func_80991040(EnWf* this, GlobalContext* globalCtx) { +void func_80991040(EnWf* this, PlayState* play) { if (this->unk_2A0 != 0) { this->actor.scale.y += this->actor.scale.x * 0.2f; Math_StepToF(&this->actor.shape.shadowScale, 70.0f, 14.0f); @@ -577,7 +577,7 @@ void func_809910F0(EnWf* this) { this->actionFunc = func_80991174; } -void func_80991174(EnWf* this, GlobalContext* globalCtx) { +void func_80991174(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_2A0 > 0) { this->actor.scale.y -= this->actor.scale.x * 0.2f; @@ -598,8 +598,8 @@ void func_80991200(EnWf* this) { this->actor.speedXZ = 0.0f; } -void func_80991280(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80991280(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 temp_v0; s32 phi_v1; @@ -613,7 +613,7 @@ void func_80991280(EnWf* this, GlobalContext* globalCtx) { this->unk_298 = 0; } - if (!func_8099408C(globalCtx, this) && !func_80990948(globalCtx, this, 0)) { + if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { phi_v1 = ABS_ALT(BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y)); if ((this->actor.xzDistToPlayer < 80.0f) && (player->swordState != 0) && (phi_v1 >= 0x1F40)) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -648,16 +648,16 @@ void func_80991438(EnWf* this) { this->actionFunc = func_8099149C; } -void func_8099149C(EnWf* this, GlobalContext* globalCtx) { +void func_8099149C(EnWf* this, PlayState* play) { f32 sp2C; s32 sp28; s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - if (!func_8099408C(globalCtx, this)) { + if (!func_8099408C(play, this)) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 500); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (Actor_OtherIsTargeted(play, &this->actor)) { sp2C = 150.0f; } else { sp2C = 0.0f; @@ -675,7 +675,7 @@ void func_8099149C(EnWf* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); - if (!func_80990948(globalCtx, this, 0)) { + if (!func_80990948(play, this, 0)) { if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { func_80991948(this); @@ -683,10 +683,10 @@ void func_8099149C(EnWf* this, GlobalContext* globalCtx) { func_80991200(this); } } else if (this->actor.xzDistToPlayer < (90.0f + sp2C)) { - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && + if (!Actor_OtherIsTargeted(play, &this->actor) && ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (sp28 < 0x38E0)))) { func_80991C04(this); - } else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + } else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { func_8099223C(this); } else { func_80991948(this); @@ -697,7 +697,7 @@ void func_8099149C(EnWf* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); } - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); } } } @@ -707,13 +707,13 @@ void func_80991738(EnWf* this) { this->actionFunc = func_8099177C; } -void func_8099177C(EnWf* this, GlobalContext* globalCtx) { +void func_8099177C(EnWf* this, PlayState* play) { s16 temp_v0; s16 phi_v1; f32 phi_f2; f32 phi_f12; - if (!func_8099408C(globalCtx, this) && !func_80990948(globalCtx, this, 0)) { + if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { phi_v1 = (temp_v0 * 0.25f) + 2000.0f; @@ -767,13 +767,13 @@ void func_80991948(EnWf* this) { this->actionFunc = func_809919F4; } -void func_809919F4(EnWf* this, GlobalContext* globalCtx) { +void func_809919F4(EnWf* this, PlayState* play) { s16 sp26; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 temp_v0; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_29A, 2500); - if (!func_8099408C(globalCtx, this) && !func_80990948(globalCtx, this, 0)) { + if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; sp26 = BINANG_ROT180(player->actor.shape.rot.y + this->unk_29A); if (this->actor.bgCheckFlags & 8) { @@ -784,19 +784,19 @@ void func_809919F4(EnWf* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); if (this->unk_2A2 == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); } - if ((Math_CosS(sp26 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && + if ((Math_CosS(sp26 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 80.0f)) { func_80991C04(this); } else { this->unk_2A0--; if (this->unk_2A0 == 0) { - if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) { + if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { func_8099223C(this); } else { func_80991200(this); @@ -818,8 +818,8 @@ void func_80991C04(EnWf* this) { this->actionFunc = func_80991C80; } -void func_80991C80(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80991C80(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp30; s32 sp2C; s16 sp2A; @@ -839,12 +839,12 @@ void func_80991C80(EnWf* this, GlobalContext* globalCtx) { } sp2C = Animation_OnFrame(&this->skelAnime, 15.0f); - if (((sp2C != 0) && !Actor_IsTargeted(globalCtx, &this->actor) && + if (((sp2C != 0) && !Actor_IsTargeted(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || SkelAnime_Update(&this->skelAnime)) { if ((sp2C == 0) && (this->unk_2A0 != 0)) { this->actor.shape.rot.y += (s16)(0xCCC * (1.5f + ((this->unk_2A0 - 4) * 0.4f))); - func_80990C6C(this, globalCtx, 1); + func_80990C6C(this, play, 1); this->unk_2A0--; } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (sp2C == 0)) { func_80991200(this); @@ -858,13 +858,13 @@ void func_80991C80(EnWf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80992A74(this, globalCtx); + func_80992A74(this, play); } else if (ABS_ALT(sp2A) < 0x2711) { if (sp30 >= 0x3E81) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80991948(this); } else { - func_80990948(globalCtx, this, 1); + func_80990948(play, this, 1); } } else { func_80991948(this); @@ -884,8 +884,8 @@ void func_80991FD8(EnWf* this) { this->actionFunc = func_80992068; } -void func_80992068(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80992068(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 sp28; s16 sp26; @@ -905,13 +905,13 @@ void func_80992068(EnWf* this, GlobalContext* globalCtx) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80992A74(this, globalCtx); + func_80992A74(this, play); } else if (ABS_ALT(sp26) < 0x2711) { if (sp28 > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80991948(this); } else { - func_80990948(globalCtx, this, 1); + func_80990948(play, this, 1); } } else { func_80991948(this); @@ -931,13 +931,13 @@ void func_8099223C(EnWf* this) { this->actionFunc = func_809922B4; } -void func_809922B4(EnWf* this, GlobalContext* globalCtx) { +void func_809922B4(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)) { func_80991438(this); - } else if ((globalCtx->gameplayFrames % 2) != 0) { - func_80992A74(this, globalCtx); + } else if ((play->gameplayFrames % 2) != 0) { + func_80992A74(this, play); } else { func_80991200(this); } @@ -955,17 +955,17 @@ void func_809923B0(EnWf* this) { this->actionFunc = func_809923E4; } -void func_809923E4(EnWf* this, GlobalContext* globalCtx) { +void func_809923E4(EnWf* this, PlayState* play) { if (this->unk_2A0 != 0) { this->unk_2A0--; } if (this->unk_2A0 == 0) { - func_80990854(this, globalCtx); + func_80990854(this, play); if (this->actor.colChkInfo.health == 0) { func_80992D6C(this); } else { - func_80990948(globalCtx, this, 1); + func_80990948(play, this, 1); } } } @@ -982,7 +982,7 @@ void func_8099245C(EnWf* this) { this->actionFunc = func_809924EC; } -void func_809924EC(EnWf* this, GlobalContext* globalCtx) { +void func_809924EC(EnWf* this, PlayState* play) { s16 sp26; if (this->actor.bgCheckFlags & 2) { @@ -997,15 +997,15 @@ void func_809924EC(EnWf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { sp26 = this->actor.wallYaw - this->actor.shape.rot.y; - if (func_80990948(globalCtx, this, 0)) { + if (func_80990948(play, this, 0)) { return; } if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(sp26) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { func_809926D0(this); - } else if (!func_8099408C(globalCtx, this)) { - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && - ((globalCtx->gameplayFrames % 8) != 0)) { + } else if (!func_8099408C(play, this)) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + ((play->gameplayFrames % 8) != 0)) { func_80991C04(this); } else if (Rand_ZeroOne() > 0.5f) { func_80991200(this); @@ -1030,7 +1030,7 @@ void func_809926D0(EnWf* this) { this->actionFunc = func_80992784; } -void func_80992784(EnWf* this, GlobalContext* globalCtx) { +void func_80992784(EnWf* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2500); if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (2 | 1))) { this->actor.shape.rot.x = 0; @@ -1039,7 +1039,7 @@ void func_80992784(EnWf* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) { + if (!Actor_OtherIsTargeted(play, &this->actor)) { func_80991C04(this); } else { func_80991200(this); @@ -1057,15 +1057,15 @@ void func_8099282C(EnWf* this) { this->actionFunc = func_809928CC; } -void func_809928CC(EnWf* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809928CC(EnWf* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp2A; if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_2A0 != 0) { this->unk_2A0--; - } else if (func_800BE184(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { - if ((player->swordAnimation != 0x11) || ((globalCtx->gameplayFrames % 2) != 0)) { + } else if (func_800BE184(play, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + if ((player->swordAnimation != 0x11) || ((play->gameplayFrames % 2) != 0)) { this->unk_2A0 = 10; } else { func_8099223C(this); @@ -1073,8 +1073,8 @@ void func_809928CC(EnWf* this, GlobalContext* globalCtx) { } else if (Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (fabsf(this->actor.playerHeightRel) < 50.0f)) { sp2A = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && - (((globalCtx->gameplayFrames % 2) != 0) || (ABS_ALT(sp2A) < 0x38E0))) { + if (!Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 2) != 0) || (ABS_ALT(sp2A) < 0x38E0))) { func_80991C04(this); } else { func_80991948(this); @@ -1085,13 +1085,13 @@ void func_809928CC(EnWf* this, GlobalContext* globalCtx) { } } -void func_80992A74(EnWf* this, GlobalContext* globalCtx) { +void func_80992A74(EnWf* this, PlayState* play) { Player* player; f32 temp_f0; this->collider2.base.acFlags |= AC_ON; Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); temp_f0 = Math_SinS((player->actor.shape.rot.y + this->unk_29A) - this->actor.yawTowardsPlayer); if (temp_f0 > 0.0f) { this->unk_29A = 16000; @@ -1108,10 +1108,10 @@ void func_80992A74(EnWf* this, GlobalContext* globalCtx) { this->actionFunc = func_80992B8C; } -void func_80992B8C(EnWf* this, GlobalContext* globalCtx) { +void func_80992B8C(EnWf* this, PlayState* play) { s32 sp28; s32 sp2C; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_29A, 2000); if (this->actor.bgCheckFlags & 8) { @@ -1124,7 +1124,7 @@ void func_80992B8C(EnWf* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); - if (!func_80990948(globalCtx, this, 0)) { + if (!func_80990948(play, this, 0)) { this->unk_2A0--; if (this->unk_2A0 == 0) { sp28 = ABS_ALT(BINANG_SUB(player->actor.shape.rot.y, this->actor.yawTowardsPlayer)); @@ -1133,8 +1133,8 @@ void func_80992B8C(EnWf* this, GlobalContext* globalCtx) { this->unk_2A0 = (s32)Rand_ZeroFloat(3.0f) + 1; } else { 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) || (sp28 < 0x38E0))) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && + (((play->gameplayFrames % 4) == 0) || (sp28 < 0x38E0))) { func_80991C04(this); } else { func_80991438(this); @@ -1142,7 +1142,7 @@ void func_80992B8C(EnWf* this, GlobalContext* globalCtx) { } } - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); if (this->unk_2A2 == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); @@ -1163,7 +1163,7 @@ void func_80992D6C(EnWf* this) { this->actionFunc = func_80992E0C; } -void func_80992E0C(EnWf* this, GlobalContext* globalCtx) { +void func_80992E0C(EnWf* this, PlayState* play) { static Vec3f D_809942F0 = { 0.0f, 0.5f, 0.0f }; if (this->actor.bgCheckFlags & 2) { @@ -1176,9 +1176,9 @@ void func_80992E0C(EnWf* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_295 != 0) { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x60); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); } Actor_MarkForDeath(&this->actor); } else { @@ -1186,7 +1186,7 @@ void func_80992E0C(EnWf* this, GlobalContext* globalCtx) { Vec3f sp60; if (this->unk_2A0 == 25) { - SoundSource_PlaySfxEachFrameAtFixedWorldPos(globalCtx, &this->actor.world.pos, 36, + SoundSource_PlaySfxEachFrameAtFixedWorldPos(play, &this->actor.world.pos, 36, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } @@ -1196,7 +1196,7 @@ void func_80992E0C(EnWf* this, GlobalContext* globalCtx) { sp60.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; sp60.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; sp60.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); - func_800B3030(globalCtx, &sp60, &D_809942F0, &D_809942F0, 100, 0, 2); + func_800B3030(play, &sp60, &D_809942F0, &D_809942F0, 100, 0, 2); } func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); @@ -1208,7 +1208,7 @@ void func_80992FD4(EnWf* this) { this->actionFunc = func_80993018; } -void func_80993018(EnWf* this, GlobalContext* globalCtx) { +void func_80993018(EnWf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { if (func_80990EAC(this)) { @@ -1236,13 +1236,13 @@ void func_80993148(EnWf* this) { this->actionFunc = func_80993194; } -void func_80993194(EnWf* this, GlobalContext* globalCtx) { +void func_80993194(EnWf* this, PlayState* play) { s16 sp36; s16 sp34; s16 sp32; SkelAnime_Update(&this->skelAnime); - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { if (func_80990EAC(this)) { func_80990ED4(this); @@ -1281,13 +1281,13 @@ void func_80993350(EnWf* this) { this->actionFunc = func_809933A0; } -void func_809933A0(EnWf* this, GlobalContext* globalCtx) { +void func_809933A0(EnWf* this, PlayState* play) { s16 sp2E; s16 sp2C; s16 phi_a1; SkelAnime_Update(&this->skelAnime); - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { if (func_80990EAC(this)) { func_80990ED4(this); @@ -1322,11 +1322,11 @@ void func_80993524(EnWf* this) { this->actionFunc = func_8099357C; } -void func_8099357C(EnWf* this, GlobalContext* globalCtx) { +void func_8099357C(EnWf* this, PlayState* play) { s16 sp2E; SkelAnime_Update(&this->skelAnime); - func_80990E4C(this, globalCtx); + func_80990E4C(this, play); if (this->unk_295 != 0) { if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { sp2E = Actor_YawBetweenActors(&this->actor, this->actor.child); @@ -1368,7 +1368,7 @@ void func_8099357C(EnWf* this, GlobalContext* globalCtx) { } } -void func_80993738(EnWf* this, GlobalContext* globalCtx) { +void func_80993738(EnWf* this, PlayState* play) { if ((this->actionFunc == func_80991280) && (this->unk_298 != 0)) { this->unk_29E = Math_SinS(this->unk_298 * 4200) * 8920.0f; } else if ((this->actionFunc == func_80991C80) || (this->actionFunc == func_8099357C) || @@ -1380,7 +1380,7 @@ void func_80993738(EnWf* this, GlobalContext* globalCtx) { } } -void func_8099386C(EnWf* this, GlobalContext* globalCtx) { +void func_8099386C(EnWf* this, PlayState* play) { s32 pad; ColliderCylinder* collider; @@ -1414,10 +1414,10 @@ void func_8099386C(EnWf* this, GlobalContext* globalCtx) { (0x80000 | 0x40000 | 0x10000 | 0x8000 | 0x2000 | 0x1000 | 0x80 | 0x20 | 0x10 | 0x2 | 0x1))) && (this->actor.colChkInfo.damageEffect != 0xF)) { if (!Actor_ApplyDamage(&this->actor)) { - Enemy_StartFinishingBlow(globalCtx, &this->actor); + Enemy_StartFinishingBlow(play, &this->actor); } - func_80990854(this, globalCtx); + func_80990854(this, play); if (this->actor.colChkInfo.damageEffect == 1) { this->unk_2A0 = 40; @@ -1448,7 +1448,7 @@ void func_8099386C(EnWf* this, GlobalContext* globalCtx) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 4.0f; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, collider->info.bumper.hitPos.x, collider->info.bumper.hitPos.y, collider->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } @@ -1464,7 +1464,7 @@ void func_8099386C(EnWf* this, GlobalContext* globalCtx) { } } -void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Update(Actor* thisx, PlayState* play) { s32 pad; EnWf* this = THIS; @@ -1474,16 +1474,16 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_2A2--; } - func_8099386C(this, globalCtx); + func_8099386C(this, play); if (this->actionFunc != func_809923E4) { EnWf_Blink(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); - func_80993738(this, globalCtx); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); + func_80993738(this, play); if (this->actor.bgCheckFlags & (2 | 1)) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); @@ -1493,22 +1493,22 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actionFunc != func_80990F50) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } if (this->collider2.base.acFlags & AC_ON) { Collider_UpdateCylinder(&this->actor, &this->collider2); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider3.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider3.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); } if (this->actionFunc == func_809928CC) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } if (this->collider1.base.atFlags & AT_ON) { if (!(this->collider1.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } else { func_80991FD8(this); } @@ -1531,7 +1531,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnWf* this = THIS; if ((limbIndex == WOLFOS_NORMAL_LIMB_HEAD) || (limbIndex == WOLFOS_NORMAL_LIMB_EYES)) { @@ -1540,7 +1540,7 @@ s32 EnWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 D_809942FC[] = { -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, 2, -1, 3, 4, 5, 6, -1, -1, 7, 8, 9, }; @@ -1561,13 +1561,13 @@ void EnWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = THIS; if (this->actionFunc != func_80990F50) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->actor.params == 0) { gSPSegment(POLY_OPA_DISP++, 0x08, sNormalEyeTextures[this->eyeIndex]); @@ -1575,18 +1575,17 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x08, sWhiteEyeTextures[this->eyeIndex]); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); - Actor_DrawDamageEffects(globalCtx, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, - this->drawDmgEffType); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); } } -s32 func_8099408C(GlobalContext* globalCtx, EnWf* this) { - Actor* temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0); +s32 func_8099408C(PlayState* play, EnWf* this) { + Actor* temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); s16 temp_v1; if (temp_v0 != NULL) { 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 94cfb18e72..d4666db0ae 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*); #define ENWF_GET_80(thisx) ((thisx)->params & 0x80) diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index 7279650e77..0000cb3a3a 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -12,10 +12,10 @@ #define THIS ((EnWiz*)thisx) -void EnWiz_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWiz_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWiz_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWiz_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWiz_Init(Actor* thisx, PlayState* play); +void EnWiz_Destroy(Actor* thisx, PlayState* play); +void EnWiz_Update(Actor* thisx, PlayState* play); +void EnWiz_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Wiz_InitVars = { diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h index 1388260cf4..835007d0b8 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.h @@ -5,7 +5,7 @@ struct EnWiz; -typedef void (*EnWizActionFunc)(struct EnWiz*, GlobalContext*); +typedef void (*EnWizActionFunc)(struct EnWiz*, PlayState*); typedef struct EnWiz { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c index ddfa6af476..d49e71c08c 100644 --- a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c +++ b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c @@ -18,13 +18,13 @@ typedef enum { PLATFORM_TYPE_MAX, } PlatformType; -void EnWizBrock_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWizBrock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWizBrock_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWizBrock_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWizBrock_Init(Actor* thisx, PlayState* play); +void EnWizBrock_Destroy(Actor* thisx, PlayState* play); +void EnWizBrock_Update(Actor* thisx, PlayState* play); +void EnWizBrock_Draw(Actor* thisx, PlayState* play); -void EnWizBrock_SetupUpdateStatus(EnWizBrock* this, GlobalContext* globalCtx); -void EnWizBrock_UpdateStatus(EnWizBrock* this, GlobalContext* globalCtx); +void EnWizBrock_SetupUpdateStatus(EnWizBrock* this, PlayState* play); +void EnWizBrock_UpdateStatus(EnWizBrock* this, PlayState* play); s16 platformCount = 0; @@ -40,13 +40,13 @@ const ActorInit En_Wiz_Brock_InitVars = { (ActorFunc)EnWizBrock_Draw, }; -void EnWizBrock_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWizBrock_Init(Actor* thisx, PlayState* play) { EnWizBrock* this = THIS; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_wiz_Colheader_001690, &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.colChkInfo.mass = MASS_IMMOVABLE; this->dyna.actor.colChkInfo.health = 3; this->unk_1A6 = 0; @@ -57,13 +57,13 @@ void EnWizBrock_Init(Actor* thisx, GlobalContext* globalCtx) { this->alpha = 255.0f; } -void EnWizBrock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWizBrock_Destroy(Actor* thisx, PlayState* play) { EnWizBrock* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void EnWizBrock_SetupUpdateStatus(EnWizBrock* this, GlobalContext* globalCtx) { +void EnWizBrock_SetupUpdateStatus(EnWizBrock* this, PlayState* play) { this->actionFunc = EnWizBrock_UpdateStatus; } @@ -71,7 +71,7 @@ void EnWizBrock_SetupUpdateStatus(EnWizBrock* this, GlobalContext* globalCtx) { * @brief Checks the platform status, when the Wizzrobe is defeated, which triggers timer to * count up to 30 at which point the platforms are despawned. */ -void EnWizBrock_UpdateStatus(EnWizBrock* this, GlobalContext* globalCtx) { +void EnWizBrock_UpdateStatus(EnWizBrock* this, PlayState* play) { if (this->platformType == PLATFORM_TYPE_INACTIVE) { if (this->dyna.actor.colChkInfo.health != PLATFORM_TYPE_MAX) { this->platformType = this->dyna.actor.colChkInfo.health; @@ -93,42 +93,42 @@ void EnWizBrock_UpdateStatus(EnWizBrock* this, GlobalContext* globalCtx) { } } -void EnWizBrock_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnWizBrock_Update(Actor* thisx, PlayState* play) { EnWizBrock* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void EnWizBrock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnWizBrock_Draw(Actor* thisx, PlayState* play) { s32 pad; EnWizBrock* this = THIS; - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); if (this->dyna.actor.colChkInfo.health != 0) { - Scene_SetRenderModeXlu(globalCtx, 0, 1); + Scene_SetRenderModeXlu(play, 0, 1); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - Gfx_DrawDListOpa(globalCtx, gWizzrobePlatform); + Gfx_DrawDListOpa(play, gWizzrobePlatform); } else { - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, (s16)this->alpha); - Gfx_DrawDListXlu(globalCtx, gWizzrobePlatform); + Gfx_DrawDListXlu(play, gWizzrobePlatform); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->platformType != PLATFORM_TYPE_INACTIVE) { - OPEN_DISPS(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&gWizzrobePlatformTexAnim)); + OPEN_DISPS(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWizzrobePlatformTexAnim)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); if (this->platformType == PLATFORM_TYPE_FIRE) { @@ -137,9 +137,9 @@ void EnWizBrock_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 50, 00, 255, (s16)this->alpha); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gWizzrobePlatformCenter); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h index ac900777e7..0f01506976 100644 --- a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h +++ b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h @@ -5,7 +5,7 @@ struct EnWizBrock; -typedef void (*EnWizBrockActionFunc)(struct EnWizBrock*, GlobalContext*); +typedef void (*EnWizBrockActionFunc)(struct EnWizBrock*, PlayState*); typedef struct EnWizBrock { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c index 53713bbb14..5f1a280fba 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c @@ -12,21 +12,21 @@ #define THIS ((EnWizFire*)thisx) -void EnWizFire_Init(Actor* thisx, GlobalContext* globalCtx); -void EnWizFire_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx); -void EnWizFire_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnWizFire_Init(Actor* thisx, PlayState* play); +void EnWizFire_Destroy(Actor* thisx, PlayState* play); +void EnWizFire_Update(Actor* thisx, PlayState* play); +void EnWizFire_Draw(Actor* thisx, PlayState* play); -void func_80A4984C(EnWizFire* this, GlobalContext* globalCtx); -void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx); -void func_80A49F38(EnWizFire* this, GlobalContext* globalCtx); -void func_80A49FD8(EnWizFire* this, GlobalContext* globalCtx); -void func_80A4A11C(EnWizFire* this, GlobalContext* globalCtx); -void func_80A4A608(EnWizFire* this, GlobalContext* globalCtx); -void func_80A4BAB4(Actor* thisx, GlobalContext* globalCtx); +void func_80A4984C(EnWizFire* this, PlayState* play); +void func_80A49A44(EnWizFire* this, PlayState* play); +void func_80A49F38(EnWizFire* this, PlayState* play); +void func_80A49FD8(EnWizFire* this, PlayState* play); +void func_80A4A11C(EnWizFire* this, PlayState* play); +void func_80A4A608(EnWizFire* this, PlayState* play); +void func_80A4BAB4(Actor* thisx, PlayState* play); void func_80A4BC74(EnWizFire* this, Vec3f* arg1, Vec3f* arg2); -void func_80A4BDDC(EnWizFire* this, GlobalContext* globalCtx); -void func_80A4BF78(EnWizFire* this, GlobalContext* globalCtx); +void func_80A4BDDC(EnWizFire* this, PlayState* play); +void func_80A4BF78(EnWizFire* this, PlayState* play); static s32 D_80A4C1C0 = 0; @@ -62,17 +62,17 @@ static ColliderCylinderInit sCylinderInit = { { 0, 0, 0, { 0, 0, 0 } }, }; -void EnWizFire_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWizFire_Init(Actor* thisx, PlayState* play) { EnWizFire* this = THIS; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_162 = this->actor.params; this->actor.targetMode = 3; this->unk_172 = 10; this->unk_1FC = 255.0f; this->actor.flags &= ~ACTOR_FLAG_1; - if (!func_8012405C(globalCtx)) { + if (!func_8012405C(play)) { this->collider.info.toucher.dmgFlags = 0x20000000; } @@ -104,28 +104,28 @@ void EnWizFire_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnWizFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWizFire_Destroy(Actor* thisx, PlayState* play) { EnWizFire* this = THIS; if (this->unk_162 == 0) { - globalCtx->envCtx.lightSettings.fogColor[2] = 0; - globalCtx->envCtx.lightSettings.fogColor[1] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.fogColor[0] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor2[2] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor2[1] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor2[0] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor1[2] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor1[1] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.diffuseColor1[0] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.ambientColor[2] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.ambientColor[1] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.ambientColor[0] = globalCtx->envCtx.lightSettings.fogColor[2]; - globalCtx->envCtx.lightSettings.fogNear = globalCtx->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.fogColor[2] = 0; + play->envCtx.lightSettings.fogColor[1] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.fogColor[0] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor2[2] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor2[1] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor2[0] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor1[2] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor1[1] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.ambientColor[2] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.ambientColor[1] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.fogColor[2]; + play->envCtx.lightSettings.fogNear = play->envCtx.lightSettings.fogColor[2]; } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80A4984C(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4984C(EnWizFire* this, PlayState* play) { Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; s32 i; @@ -160,7 +160,7 @@ void func_80A4984C(EnWizFire* this, GlobalContext* globalCtx) { this->actionFunc = func_80A49A44; } -void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A49A44(EnWizFire* this, PlayState* play) { Vec3f sp54 = { 0.0f, 0.0f, 0.0f }; this->actor.world.rot.z += 5000; @@ -212,7 +212,7 @@ void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { this->actor.gravity = -0.7f; if (this->unk_164 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WIZ_FIRE, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WIZ_FIRE, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, this->actor.world.pos.z, 0, 0, 0, 2); this->unk_164 = 1; } @@ -233,7 +233,7 @@ void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { phi_s0 = 0; for (i = 0; i < 5; i++) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_WIZ_FIRE, this->actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WIZ_FIRE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, phi_s0, 0, 1); phi_s0 += BINANG_ADD((s32)randPlusMinusPoint5Scaled(0x1000), 0x3333); } @@ -262,11 +262,11 @@ void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) { this->unk_168 = 0; this->unk_148 = 1; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } - if (func_8012405C(globalCtx) && (this->collider.base.atFlags & AT_BOUNCED)) { + if (func_8012405C(play) && (this->collider.base.atFlags & AT_BOUNCED)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_MG); this->collider.base.atFlags &= ~(AT_TYPE_ENEMY | AT_BOUNCED | AT_HIT); this->collider.base.atFlags |= AT_TYPE_PLAYER; @@ -286,7 +286,7 @@ void func_80A49A44(EnWizFire* this, GlobalContext* globalCtx) { } } -void func_80A49F38(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A49F38(EnWizFire* this, PlayState* play) { this->unk_150 = 0.02f; this->unk_168 = Rand_S16Offset(50, 50); this->unk_154 = randPlusMinusPoint5Scaled(1.0f) * 0.007f; @@ -295,7 +295,7 @@ void func_80A49F38(EnWizFire* this, GlobalContext* globalCtx) { this->actionFunc = func_80A49FD8; } -void func_80A49FD8(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A49FD8(EnWizFire* this, PlayState* play) { if (this->unk_168 > 10) { Math_ApproachF(&this->unk_14C, this->unk_150, 0.3f, 0.01f); } else { @@ -317,7 +317,7 @@ void func_80A49FD8(EnWizFire* this, GlobalContext* globalCtx) { if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) { this->unk_168 = 0; this->unk_148 = 1; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } } @@ -327,7 +327,7 @@ void func_80A49FD8(EnWizFire* this, GlobalContext* globalCtx) { } } -void func_80A4A11C(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4A11C(EnWizFire* this, PlayState* play) { s32 pad; if ((this->actor.parent != NULL) && (this->actor.parent->id == ACTOR_EN_WIZ) && @@ -382,7 +382,7 @@ void func_80A4A11C(EnWizFire* this, GlobalContext* globalCtx) { D_80A4C1C0 = 1; this->unk_148 = 1; this->unk_16A = 0; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT); } } this->actor.world.pos.y = this->actor.floorHeight + 10.0f; @@ -434,7 +434,7 @@ void func_80A4A11C(EnWizFire* this, GlobalContext* globalCtx) { } } -void func_80A4A608(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4A608(EnWizFire* this, PlayState* play) { if (this->unk_16A == 0) { this->unk_16A = 2; this->unk_16E++; @@ -452,22 +452,22 @@ void func_80A4A608(EnWizFire* this, GlobalContext* globalCtx) { } } -void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx2) { +void EnWizFire_Update(Actor* thisx, PlayState* play2) { static Color_RGB8 D_80A4C234[] = { { 100, 40, 40 }, { 180, 0x78, 80 }, { 155, 80, 80 }, { 125, 20, 0 }, { 0, 0, 0 }, { 200, 250, 250 }, { 100, 250, 250 }, { 225, 255, 235 }, }; static Color_RGBA8 D_80A4C24C = { 250, 250, 250, 255 }; static Color_RGBA8 D_80A4C250 = { 180, 180, 180, 255 }; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; EnWizFire* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 j; s16 temp_s0; s16 idx; Actor_SetScale(&this->actor, this->unk_14C); - func_80A4BDDC(this, globalCtx); + func_80A4BDDC(this, play); this->unk_204 = this->unk_200 / 60.0f; if (this->unk_162 == 0) { @@ -483,44 +483,44 @@ void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx2) { phi_f0 = 968.0f; } - globalCtx->envCtx.lightSettings.fogNear = (phi_f0 - (s16)globalCtx->envCtx.unk_C4.fogNear) * this->unk_204; + play->envCtx.lightSettings.fogNear = (phi_f0 - (s16)play->envCtx.unk_C4.fogNear) * this->unk_204; - globalCtx->envCtx.lightSettings.ambientColor[0] = - ((f32)D_80A4C234[idx].r - globalCtx->envCtx.unk_C4.ambientColor[0]) * this->unk_204; - globalCtx->envCtx.lightSettings.ambientColor[1] = - ((f32)D_80A4C234[idx].g - globalCtx->envCtx.unk_C4.ambientColor[1]) * this->unk_204; - globalCtx->envCtx.lightSettings.ambientColor[2] = - ((f32)D_80A4C234[idx].b - globalCtx->envCtx.unk_C4.ambientColor[2]) * this->unk_204; + play->envCtx.lightSettings.ambientColor[0] = + ((f32)D_80A4C234[idx].r - play->envCtx.unk_C4.ambientColor[0]) * this->unk_204; + play->envCtx.lightSettings.ambientColor[1] = + ((f32)D_80A4C234[idx].g - play->envCtx.unk_C4.ambientColor[1]) * this->unk_204; + play->envCtx.lightSettings.ambientColor[2] = + ((f32)D_80A4C234[idx].b - play->envCtx.unk_C4.ambientColor[2]) * this->unk_204; idx++; - globalCtx->envCtx.lightSettings.diffuseColor1[0] = - ((f32)D_80A4C234[idx].r - globalCtx->envCtx.unk_C4.diffuseColor1[0]) * this->unk_204; - globalCtx->envCtx.lightSettings.diffuseColor1[1] = - ((f32)D_80A4C234[idx].g - globalCtx->envCtx.unk_C4.diffuseColor1[1]) * this->unk_204; - globalCtx->envCtx.lightSettings.diffuseColor1[2] = - ((f32)D_80A4C234[idx].b - globalCtx->envCtx.unk_C4.diffuseColor1[2]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor1[0] = + ((f32)D_80A4C234[idx].r - play->envCtx.unk_C4.diffuseColor1[0]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor1[1] = + ((f32)D_80A4C234[idx].g - play->envCtx.unk_C4.diffuseColor1[1]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor1[2] = + ((f32)D_80A4C234[idx].b - play->envCtx.unk_C4.diffuseColor1[2]) * this->unk_204; idx++; - globalCtx->envCtx.lightSettings.diffuseColor2[0] = - ((f32)D_80A4C234[idx].r - globalCtx->envCtx.unk_C4.diffuseColor[0]) * this->unk_204; - globalCtx->envCtx.lightSettings.diffuseColor2[1] = - ((f32)D_80A4C234[idx].g - globalCtx->envCtx.unk_C4.diffuseColor[1]) * this->unk_204; - globalCtx->envCtx.lightSettings.diffuseColor2[2] = - ((f32)D_80A4C234[idx].b - globalCtx->envCtx.unk_C4.diffuseColor[2]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor2[0] = + ((f32)D_80A4C234[idx].r - play->envCtx.unk_C4.diffuseColor[0]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor2[1] = + ((f32)D_80A4C234[idx].g - play->envCtx.unk_C4.diffuseColor[1]) * this->unk_204; + play->envCtx.lightSettings.diffuseColor2[2] = + ((f32)D_80A4C234[idx].b - play->envCtx.unk_C4.diffuseColor[2]) * this->unk_204; idx++; - globalCtx->envCtx.lightSettings.fogColor[0] = - ((f32)D_80A4C234[idx].r - globalCtx->envCtx.unk_C4.fogColor[0]) * this->unk_204; - globalCtx->envCtx.lightSettings.fogColor[1] = - ((f32)D_80A4C234[idx].g - globalCtx->envCtx.unk_C4.fogColor[1]) * this->unk_204; - globalCtx->envCtx.lightSettings.fogColor[2] = - ((f32)D_80A4C234[idx].b - globalCtx->envCtx.unk_C4.fogColor[2]) * this->unk_204; + play->envCtx.lightSettings.fogColor[0] = + ((f32)D_80A4C234[idx].r - play->envCtx.unk_C4.fogColor[0]) * this->unk_204; + play->envCtx.lightSettings.fogColor[1] = + ((f32)D_80A4C234[idx].g - play->envCtx.unk_C4.fogColor[1]) * this->unk_204; + play->envCtx.lightSettings.fogColor[2] = + ((f32)D_80A4C234[idx].b - play->envCtx.unk_C4.fogColor[2]) * this->unk_204; } } this->unk_170++; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->actor.shape.yOffset = 10.0f; Actor_UpdatePos(&this->actor); @@ -549,7 +549,7 @@ void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_16A--; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 5.0f, 10, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 5.0f, 10, 0x1D); if (((this->unk_148 != 0) || (D_80A4C1C0 != 0)) && (this->unk_16C == 0)) { Vec3f sp70; @@ -578,7 +578,7 @@ void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx2) { sp58.y = (Rand_ZeroOne() * 20.0f) + this->actor.floorHeight; temp_s0 = Rand_S16Offset(20, 20); sp58.z = ((f32)((Rand_ZeroOne() < .5f) ? -1 : 1) * temp_s0) + this->actor.world.pos.z; - func_800B0DE0(globalCtx, &sp58, &sp64, &sp70, &D_80A4C24C, &D_80A4C250, Rand_S16Offset(350, 100), sp54); + func_800B0DE0(play, &sp58, &sp64, &sp70, &D_80A4C24C, &D_80A4C250, Rand_S16Offset(350, 100), sp54); } } @@ -614,25 +614,25 @@ void EnWizFire_Update(Actor* thisx, GlobalContext* globalCtx2) { if ((this->unk_148 == 0) && (D_80A4C1C0 == 0) && ((this->unk_162 != 0) || (this->unk_1FC > 200.0f))) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (player->invincibilityTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -void func_80A4B0C8(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4B0C8(EnWizFire* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->unk_162 == 0) && (this->unk_160 == 2)) { - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->unk_1F0, this->unk_1F0, this->unk_1F0, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->unk_1FC); gDPSetEnvColor(POLY_XLU_DISP++, 0, 40, 30, 80); @@ -640,37 +640,36 @@ void func_80A4B0C8(EnWizFire* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 215, 215, 215, (s8)this->unk_1FC); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->state.frames & 0x7F, - -globalCtx->state.frames & 0x7F, 0x20, 0x40, 1, globalCtx->state.frames & 0xFF, - globalCtx->state.frames & 0xFF, 0x10, 0x10)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->state.frames & 0x7F, -play->state.frames & 0x7F, 0x20, + 0x40, 1, play->state.frames & 0xFF, play->state.frames & 0xFF, 0x10, 0x10)); Matrix_RotateYS(0, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_wiz_DL_005750); } - func_80A4BF78(this, globalCtx); + func_80A4BF78(this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A4B33C(EnWizFire* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80A4B33C(EnWizFire* this, PlayState* play2) { + PlayState* play = play2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->unk_162 == 0) && (this->unk_160 == 2)) { - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->unk_1F0, this->unk_1F0, this->unk_1F0, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -globalCtx->state.frames % 128, 0, 0x20, 0x20, 1, - (globalCtx->state.frames * 2) % 128, 0, 0x20, 0x20)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->state.frames % 128, 0, 0x20, 0x20, 1, + (play->state.frames * 2) % 128, 0, 0x20, 0x20)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 40, 0, (s8)this->unk_1FC); gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128); @@ -679,51 +678,50 @@ void func_80A4B33C(EnWizFire* this, GlobalContext* globalCtx2) { Matrix_Pop(); Matrix_Push(); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames % 128, - (-globalCtx->state.frames * 6) % 256, 0x20, 0x40, 1, - (globalCtx->state.frames * 2) % 128, (-globalCtx->state.frames * 6) % 256, 0x20, - 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, play->state.frames % 128, (-play->state.frames * 6) % 256, + 0x20, 0x40, 1, (play->state.frames * 2) % 128, (-play->state.frames * 6) % 256, + 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 80, 0, 0, (s8)this->unk_1FC); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 100); Matrix_Scale(this->unk_1F8, this->unk_1F8, this->unk_1F8, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_wiz_DL_003640); Matrix_Pop(); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (-globalCtx->state.frames * 3) % 128, 0, 0x20, 0x20, 1, - 0, (-globalCtx->state.frames * 10) % 256, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (-play->state.frames * 3) % 128, 0, 0x20, 0x20, 1, 0, + (-play->state.frames * 10) % 256, 0x20, 0x40)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 50, 0, 255); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 200, 235, 240, 128); Matrix_Scale(this->unk_1F4, this->unk_1F4, this->unk_1F4, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_wiz_DL_003FC0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnWizFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnWizFire_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWizFire* this = THIS; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Push(); for (i = 9; i >= this->unk_16E; i--) { @@ -741,48 +739,47 @@ void EnWizFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(this->unk_178[i].x, this->unk_178[i].y + this->actor.shape.yOffset, this->unk_178[i].z, MTXMODE_NEW); Matrix_Scale(temp_f20, temp_f20, temp_f20, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZS(this->actor.world.rot.z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_wiz_DL_002B40); } } Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->unk_166 == 0) { - func_80A4B33C(this, globalCtx); + func_80A4B33C(this, play); } else { - func_80A4B0C8(this, globalCtx); + func_80A4B0C8(this, play); } } -void func_80A4BAB4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A4BAB4(Actor* thisx, PlayState* play) { s32 pad; EnWizFire* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight + 20.0f, this->actor.world.pos.z, MTXMODE_NEW); Matrix_Scale(this->unk_14C + this->unk_154, this->unk_14C + this->unk_158, this->unk_14C + this->unk_15C, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_170 & 0x7F, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, this->unk_170 & 0x7F, (-this->unk_170 * 10) & 0x7F, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 100, 50, 0, (s8)this->unk_1FC); gDPSetEnvColor(POLY_XLU_DISP++, 200, 235, 245, 255); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_wiz_DL_002630); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80A4BC74(EnWizFire* this, Vec3f* arg1, Vec3f* arg2) { @@ -804,7 +801,7 @@ void func_80A4BC74(EnWizFire* this, Vec3f* arg1, Vec3f* arg2) { } } -void func_80A4BDDC(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4BDDC(EnWizFire* this, PlayState* play) { s32 i; EnWizFireStruct* ptr = &this->unk_254[0]; @@ -836,16 +833,16 @@ void func_80A4BDDC(EnWizFire* this, GlobalContext* globalCtx) { } } -void func_80A4BF78(EnWizFire* this, GlobalContext* globalCtx) { +void func_80A4BF78(EnWizFire* this, PlayState* play) { s16 i; u8 flag; EnWizFireStruct* ptr = &this->unk_254[0]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); flag = false; for (i = 0; i < ARRAY_COUNT(this->unk_254); i++, ptr++) { @@ -857,11 +854,11 @@ void func_80A4BF78(EnWizFire* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, ptr->unk_06); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (ptr->unk_01 * 3) & 0x7F, - (ptr->unk_01 * 0xF) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, (ptr->unk_01 * 3) & 0x7F, (ptr->unk_01 * 0xF) & 0xFF, + 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(ptr->unk_10.x, ptr->unk_10.y, ptr->unk_10.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_0C, ptr->unk_0C, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h index df396da97b..b628404bba 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.h @@ -5,7 +5,7 @@ struct EnWizFire; -typedef void (*EnWizFireActionFunc)(struct EnWizFire*, GlobalContext*); +typedef void (*EnWizFireActionFunc)(struct EnWizFire*, PlayState*); typedef struct { /* 0x00 */ u8 unk_00; 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 446d92cbdd..6bd72ae1a7 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -11,10 +11,10 @@ #define THIS ((EnWood02*)thisx) -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 @@ -98,11 +98,10 @@ Gfx* D_808C4D70[] = { object_wood02_DL_000700, }; -s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* arg2) { +s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* arg2) { f32 phi_f12; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg2, &this->actor.projectedPos, - &this->actor.projectedW); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg2, &this->actor.projectedPos, &this->actor.projectedW); if (this->actor.projectedW == 0.0f) { phi_f12 = 1000.0f; @@ -122,7 +121,7 @@ s32 EnWood02_SpawnZoneCheck(EnWood02* this, GlobalContext* globalCtx, Vec3f* arg /** 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* child; s32 extraRot; Vec3f childPos; @@ -144,7 +143,7 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { 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_14A[i] & 0x80) { unk = 0; } else { @@ -152,9 +151,9 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { } childParams = ((this->unk_144 << 8) & 0xFF00) | (this->actor.params + 1); - child = (EnWood02*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_WOOD02, - childPos.x, childPos.y, childPos.z, this->actor.world.rot.x, - sSpawnAngle[i], unk, childParams); + child = (EnWood02*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_WOOD02, childPos.x, + childPos.y, childPos.z, this->actor.world.rot.x, sSpawnAngle[i], + unk, childParams); if (child != NULL) { child->unk_14A[0] = i; this->unk_14A[i] |= 1; @@ -167,7 +166,7 @@ void EnWood02_SpawnOffspring(EnWood02* this, GlobalContext* globalCtx) { } } -void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Init(Actor* thisx, PlayState* play) { s16 spawnType = 0; f32 actorScale = 1.0f; EnWood02* this = THIS; @@ -192,14 +191,14 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); if ((this->actor.params < WOOD_BUSH_GREEN_SMALL) || (this->actor.params == WOOD_TREE_SPECIAL)) { - 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->actor.params == WOOD_TREE_SPECIAL) && !gSaveContext.save.isNight && (this->unk_144 != -1) && - !Flags_GetCollectible(globalCtx, this->unk_144)) { + !Flags_GetCollectible(play, this->unk_144)) { this->actor.child = - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANI, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ANI, this->actor.world.pos.x, this->actor.world.pos.y + 120.0f, this->actor.world.pos.z - 15.0f, 0, 0, 0, 1); if (this->actor.child != NULL) { this->actor.child->cutscene = this->actor.cutscene; @@ -296,7 +295,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { } if (spawnType == WOOD_SPAWN_SPAWNER) { - 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]; @@ -308,7 +307,7 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { // Snap to floor, or remove if over void this->actor.world.pos.y += 200.0f; - floorY = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); + floorY = BgCheck_EntityRaycastFloor5(&play->colCtx, &outPoly, &bgId, &this->actor, &this->actor.world.pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; @@ -323,33 +322,33 @@ void EnWood02_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } -void EnWood02_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnWood02_Destroy(Actor* thisx, PlayState* play) { EnWood02* this = THIS; if ((this->actor.params < WOOD_BUSH_GREEN_SMALL) || (this->actor.params == WOOD_TREE_SPECIAL)) { - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } } -void func_808C4458(EnWood02* this, GlobalContext* globalCtx, Vec3f* arg2, u16 arg3) { +void func_808C4458(EnWood02* this, PlayState* play, Vec3f* arg2, u16 arg3) { s32 pad[2]; s32 sp24; if (this->unk_148 != 0) { - if ((this->unk_144 == -1) || !Flags_GetCollectible(globalCtx, this->unk_144)) { + if ((this->unk_144 == -1) || !Flags_GetCollectible(play, this->unk_144)) { if ((this->unk_148 < 0) && (this->unk_148 >= -0x10)) { if (arg3 & 1) { - Item_DropCollectibleRandom(globalCtx, &this->actor, arg2, ((-1 - this->unk_148) * 0x10) | 0x8000); + Item_DropCollectibleRandom(play, &this->actor, arg2, ((-1 - this->unk_148) * 0x10) | 0x8000); } else { - Item_DropCollectibleRandom(globalCtx, &this->actor, arg2, (-1 - this->unk_148) * 0x10); + Item_DropCollectibleRandom(play, &this->actor, arg2, (-1 - this->unk_148) * 0x10); } } else if (this->unk_148 > 0) { sp24 = func_800A8150(this->unk_148 - 1); if (sp24 >= 0) { if (this->unk_144 == -1) { - Item_DropCollectible(globalCtx, arg2, sp24); + Item_DropCollectible(play, arg2, sp24); } else { - Item_DropCollectible(globalCtx, arg2, ((this->unk_144 & 0x7F) << 8) | sp24); + Item_DropCollectible(play, arg2, ((this->unk_144 & 0x7F) << 8) | sp24); } } } @@ -358,8 +357,8 @@ void func_808C4458(EnWood02* this, GlobalContext* globalCtx, Vec3f* arg2, u16 ar } } -void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnWood02_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnWood02* this = THIS; f32 wobbleAmplitude; @@ -380,7 +379,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { } this->unk_151 = 0; } else if (this->spawnType == WOOD_SPAWN_SPAWNER) { - EnWood02_SpawnOffspring(this, globalCtx); + EnWood02_SpawnOffspring(this, play); } if ((thisx->params < WOOD_BUSH_GREEN_SMALL) || (thisx->params == WOOD_TREE_SPECIAL)) { @@ -394,7 +393,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { dropsSpawnPt.y += 200.0f; - func_808C4458(this, globalCtx, &dropsSpawnPt, 0); + func_808C4458(this, play, &dropsSpawnPt, 0); // Spawn falling leaves if (this->unk_146 >= -1) { @@ -408,8 +407,8 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_PlaySfxAtPos(thisx, 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, randPlusMinusPoint5Scaled(0xFFFF), 0, leavesParams); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, + 0, randPlusMinusPoint5Scaled(0xFFFF), 0, leavesParams); } } @@ -419,7 +418,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { } if ((thisx->params == WOOD_TREE_SPECIAL) && (this->unk_144 != -1)) { - Flags_SetCollectible(globalCtx, this->unk_144); + Flags_SetCollectible(play, this->unk_144); this->unk_144 = -1; } this->unk_146 = -0x15; @@ -428,17 +427,17 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { if (thisx->xzDistToPlayer < 600.0f) { Collider_UpdateCylinder(thisx, &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 ((thisx->params < WOOD_LEAF_GREEN) || (thisx->params == WOOD_TREE_SPECIAL)) { // not leaves - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((this->unk_146 >= -1) && (((player->rideActor == NULL) && (sqrtf(thisx->xyzDistToPlayerSq) < 20.0f) && (player->linearVelocity != 0.0f)) || ((player->rideActor != NULL) && (sqrtf(thisx->xyzDistToPlayerSq) < 60.0f) && (player->rideActor->speedXZ != 0.0f)))) { - func_808C4458(this, globalCtx, &thisx->world.pos, 1); + func_808C4458(this, play, &thisx->world.pos, 1); this->unk_146 = -0x15; Actor_PlaySfxAtPos(thisx, NA_SE_EV_TREE_SWING); } @@ -463,8 +462,8 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EnWood02_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 type; s16 pad; u8 red; @@ -495,9 +494,9 @@ void EnWood02_Draw(Actor* thisx, GlobalContext* globalCtx) { 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_808C4D70[THIS->drawType & 0xF] != NULL) { - Gfx_DrawDListOpa(globalCtx, D_808C4D54[THIS->drawType & 0xF]); + Gfx_DrawDListOpa(play, D_808C4D54[THIS->drawType & 0xF]); gDPSetEnvColor(POLY_XLU_DISP++, red, green, blue, 0); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index b23282c31c..d78daa080d 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -11,26 +11,26 @@ #define THIS ((EnYb*)thisx) -void EnYb_Init(Actor* thisx, GlobalContext* globalCtx); -void EnYb_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnYb_Update(Actor* thisx, GlobalContext* globalCtx); -void EnYb_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnYb_Init(Actor* thisx, PlayState* play); +void EnYb_Destroy(Actor* thisx, PlayState* play); +void EnYb_Update(Actor* thisx, PlayState* play); +void EnYb_Draw(Actor* thisx, PlayState* play); -void EnYb_Idle(EnYb* this, GlobalContext* globalCtx); -void EnYb_TeachingDanceFinish(EnYb* this, GlobalContext* globalCtx); -void EnYb_SetupLeaving(EnYb* this, GlobalContext* globalCtx); +void EnYb_Idle(EnYb* this, PlayState* play); +void EnYb_TeachingDanceFinish(EnYb* this, PlayState* play); +void EnYb_SetupLeaving(EnYb* this, PlayState* play); -void EnYb_UpdateAnimation(EnYb* this, GlobalContext* globalCtx); +void EnYb_UpdateAnimation(EnYb* this, PlayState* play); void EnYb_FinishTeachingCutscene(EnYb* this); -void EnYb_Disappear(EnYb* this, GlobalContext* globalCtx); -void EnYb_ReceiveMask(EnYb* this, GlobalContext* globalCtx); -void EnYb_Talk(EnYb* this, GlobalContext* globalCtx); -void EnYb_TeachingDance(EnYb* this, GlobalContext* globalCtx); -void EnYb_WaitForMidnight(EnYb* this, GlobalContext* globalCtx); +void EnYb_Disappear(EnYb* this, PlayState* play); +void EnYb_ReceiveMask(EnYb* this, PlayState* play); +void EnYb_Talk(EnYb* this, PlayState* play); +void EnYb_TeachingDance(EnYb* this, PlayState* play); +void EnYb_WaitForMidnight(EnYb* this, PlayState* play); -void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, GlobalContext* globalCtx); -void EnYb_SetAnimation(GlobalContext*, EnYb*, s16, u8, f32); -s32 EnYb_CanTalk(EnYb* this, GlobalContext* globalCtx); +void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play); +void EnYb_SetAnimation(PlayState*, EnYb*, s16, u8, f32); +s32 EnYb_CanTalk(EnYb* this, PlayState* play); const ActorInit En_Yb_InitVars = { ACTOR_EN_YB, @@ -76,7 +76,7 @@ static Vec3f D_80BFB2F4 = { 500.0f, -500.0, 0.0f }; static Vec3f D_80BFB300 = { 500.0f, -500.0f, 0.0f }; -void EnYb_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnYb_Init(Actor* thisx, PlayState* play) { EnYb* this = THIS; s16 tempCutscene; s32 i; @@ -85,19 +85,19 @@ void EnYb_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, EnYb_ActorShadowFunc, 20.0f); // @Bug this alignment is because of player animations, but should be using ALIGN16 - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gYbSkeleton, &object_yb_Anim_000200, - (uintptr_t)this->jointTable & ~0xF, (uintptr_t)this->morphTable & ~0xF, YB_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gYbSkeleton, &object_yb_Anim_000200, (uintptr_t)this->jointTable & ~0xF, + (uintptr_t)this->morphTable & ~0xF, YB_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &object_yb_Anim_000200); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = EnYb_Idle; this->currentAnimIndex = 3; // gets overwritten to 2 in EnYb_SetAnimation later this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - EnYb_SetAnimation(globalCtx, this, 2, ANIMMODE_LOOP, 0.0f); + EnYb_SetAnimation(play, this, 2, ANIMMODE_LOOP, 0.0f); tempCutscene = this->actor.cutscene; for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { @@ -126,23 +126,23 @@ void EnYb_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnYb_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnYb_Destroy(Actor* thisx, PlayState* play) { EnYb* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80BFA2FC(GlobalContext* globalCtx) { +void func_80BFA2FC(PlayState* play) { if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { - func_80151BB4(globalCtx, 0x34); + func_80151BB4(play, 0x34); } - func_80151BB4(globalCtx, 0xF); + func_80151BB4(play, 0xF); } /** * Custom shadow draw function of type ActorShadowFunc. */ -void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, GlobalContext* globalCtx) { +void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { Vec3f oldPos; EnYb* this = THIS; @@ -153,7 +153,7 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, GlobalContext* globalCtx } Math_Vec3f_Copy(&oldPos, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.world.pos, &this->shadowPos); - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); if (oldPos.y < this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; @@ -161,23 +161,23 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, GlobalContext* globalCtx this->actor.world.pos.y = oldPos.y; } - ActorShadow_DrawCircle(&this->actor, mapper, globalCtx); + ActorShadow_DrawCircle(&this->actor, mapper, play); Math_Vec3f_Copy(&this->actor.world.pos, &oldPos); this->actor.scale.x = 0.01f; } } -void EnYb_SetAnimation(GlobalContext* globalCtx, EnYb* this, s16 animIndex, u8 animMode, f32 transitionRate) { +void EnYb_SetAnimation(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 transitionRate) { if (animIndex >= 0 && animIndex < 3) { if (animIndex != this->currentAnimIndex || animMode != ANIMMODE_LOOP) { if (animIndex > 0) { if (animMode == ANIMMODE_LOOP) { - LinkAnimation_Change(globalCtx, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, transitionRate); } else { // unused case, (only called once with animMode = ANIMMODE_LOOP) - LinkAnimation_Change(globalCtx, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, transitionRate); } @@ -195,8 +195,8 @@ void EnYb_SetAnimation(GlobalContext* globalCtx, EnYb* this, s16 animIndex, u8 a } } -s32 EnYb_CanTalk(EnYb* this, GlobalContext* globalCtx) { - if (this->actor.xzDistToPlayer < 100.0f && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && +s32 EnYb_CanTalk(EnYb* this, PlayState* play) { + if (this->actor.xzDistToPlayer < 100.0f && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { return true; } else { @@ -204,11 +204,11 @@ s32 EnYb_CanTalk(EnYb* this, GlobalContext* globalCtx) { } } -void EnYb_UpdateAnimation(EnYb* this, GlobalContext* globalCtx) { +void EnYb_UpdateAnimation(EnYb* this, PlayState* play) { if (this->currentAnimIndex <= 0) { SkelAnime_Update(&this->skelAnime); } else { - LinkAnimation_Update(globalCtx, &this->skelAnime); + LinkAnimation_Update(play, &this->skelAnime); } } @@ -233,20 +233,20 @@ void EnYb_EnableProximityMusic(EnYb* this) { func_800B9084(&this->actor); } -void EnYb_Disappear(EnYb* this, GlobalContext* globalCtx) { +void EnYb_Disappear(EnYb* this, PlayState* play) { s32 pad; Vec3f sp60; s32 i; - EnYb_UpdateAnimation(this, globalCtx); + EnYb_UpdateAnimation(this, play); for (i = 3; i >= 0; i--) { sp60.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; sp60.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; sp60.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); - func_800B3030(globalCtx, &sp60, &D_80BFB2E8, &D_80BFB2E8, 100, 0, 2); + func_800B3030(play, &sp60, &D_80BFB2E8, &D_80BFB2E8, 100, 0, 2); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_EXTINCT); if (this->alpha > 10) { this->alpha -= 10; } else { @@ -254,63 +254,63 @@ void EnYb_Disappear(EnYb* this, GlobalContext* globalCtx) { } } -void EnYb_SetupLeaving(EnYb* this, GlobalContext* globalCtx) { - EnYb_UpdateAnimation(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnYb_SetupLeaving(EnYb* this, PlayState* play) { + EnYb_UpdateAnimation(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnYb_Talk; // I am counting on you - Message_StartTextbox(globalCtx, 0x147D, &this->actor); - func_80BFA2FC(globalCtx); + Message_StartTextbox(play, 0x147D, &this->actor); + func_80BFA2FC(play); } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } EnYb_EnableProximityMusic(this); } -void EnYb_ReceiveMask(EnYb* this, GlobalContext* globalCtx) { - EnYb_UpdateAnimation(this, globalCtx); +void EnYb_ReceiveMask(EnYb* this, PlayState* play) { + EnYb_UpdateAnimation(this, play); // Player is parent: receiving the Kamaro mask - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = EnYb_SetupLeaving; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } else { - Actor_PickUp(&this->actor, globalCtx, GI_MASK_KAMARO, 10000.0f, 100.0f); + Actor_PickUp(&this->actor, play, GI_MASK_KAMARO, 10000.0f, 100.0f); } EnYb_EnableProximityMusic(this); } -void EnYb_Talk(EnYb* this, GlobalContext* globalCtx) { +void EnYb_Talk(EnYb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - EnYb_UpdateAnimation(this, globalCtx); + EnYb_UpdateAnimation(this, play); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x147D: // I am counting on you - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnYb_Disappear; gSaveContext.save.weekEventReg[82] |= 0x4; break; case 0x147C: // Spread my dance across the world - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAMARO) { - func_801477B4(globalCtx); + if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { + func_801477B4(play); this->actionFunc = EnYb_Idle; } else if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { - func_80151938(globalCtx, 0x147D); // I am counting on you - func_80BFA2FC(globalCtx); + func_80151938(play, 0x147D); // I am counting on you + func_80BFA2FC(play); } else { - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnYb_ReceiveMask; - EnYb_ReceiveMask(this, globalCtx); + EnYb_ReceiveMask(this, play); } break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = EnYb_Idle; break; } @@ -318,22 +318,22 @@ void EnYb_Talk(EnYb* this, GlobalContext* globalCtx) { EnYb_EnableProximityMusic(this); } -void EnYb_TeachingDanceFinish(EnYb* this, GlobalContext* globalCtx) { - EnYb_UpdateAnimation(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void EnYb_TeachingDanceFinish(EnYb* this, PlayState* play) { + EnYb_UpdateAnimation(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnYb_Talk; // Spread my dance across the world - Message_StartTextbox(globalCtx, 0x147C, &this->actor); + Message_StartTextbox(play, 0x147C, &this->actor); this->actor.flags &= ~ACTOR_FLAG_10000; } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } EnYb_EnableProximityMusic(this); } // dancing countdown -void EnYb_TeachingDance(EnYb* this, GlobalContext* globalCtx) { - EnYb_UpdateAnimation(this, globalCtx); +void EnYb_TeachingDance(EnYb* this, PlayState* play) { + EnYb_UpdateAnimation(this, play); if (this->teachingCutsceneTimer > 0) { this->teachingCutsceneTimer--; @@ -341,34 +341,34 @@ void EnYb_TeachingDance(EnYb* this, GlobalContext* globalCtx) { EnYb_FinishTeachingCutscene(this); this->actionFunc = EnYb_TeachingDanceFinish; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } EnYb_EnableProximityMusic(this); } -void EnYb_Idle(EnYb* this, GlobalContext* globalCtx) { +void EnYb_Idle(EnYb* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - EnYb_UpdateAnimation(this, globalCtx); + EnYb_UpdateAnimation(this, play); if (this->actor.xzDistToPlayer < 180.0f && fabsf(this->actor.playerHeightRel) < 50.0f && - globalCtx->msgCtx.ocarinaMode == 3 && globalCtx->msgCtx.unk1202E == 7 && + play->msgCtx.ocarinaMode == 3 && play->msgCtx.unk1202E == 7 && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { this->actionFunc = EnYb_TeachingDance; this->teachingCutsceneTimer = 200; EnYb_ChangeCutscene(this, 0); - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_80BFA2FC(globalCtx); + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + func_80BFA2FC(play); this->actionFunc = EnYb_Talk; - if (Player_GetMask(globalCtx) == PLAYER_MASK_KAMARO) { + if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { // I have taught you, go use it - Message_StartTextbox(globalCtx, 0x147C, &this->actor); + Message_StartTextbox(play, 0x147C, &this->actor); } else { // regular talk to him first dialogue - Message_StartTextbox(globalCtx, 0x147B, &this->actor); + Message_StartTextbox(play, 0x147B, &this->actor); } - } else if (EnYb_CanTalk(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + } else if (EnYb_CanTalk(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } if (this->playerOcarinaOut & 1) { @@ -384,9 +384,9 @@ void EnYb_Idle(EnYb* this, GlobalContext* globalCtx) { EnYb_EnableProximityMusic(this); } -void EnYb_WaitForMidnight(EnYb* this, GlobalContext* globalCtx) { +void EnYb_WaitForMidnight(EnYb* this, PlayState* play) { if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { - EnYb_UpdateAnimation(this, globalCtx); + EnYb_UpdateAnimation(this, play); this->alpha += 5; if (this->alpha > 250) { this->alpha = 255; @@ -397,20 +397,20 @@ void EnYb_WaitForMidnight(EnYb* this, GlobalContext* globalCtx) { } } -void EnYb_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnYb_Update(Actor* thisx, PlayState* play) { s32 pad; EnYb* this = THIS; if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_1)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_1)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->cutsceneIndex != -1 && ActorCutscene_GetCurrentIndex() != this->cutscenes[this->cutsceneIndex]) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -426,7 +426,7 @@ void EnYb_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnYb_PostLimbDrawOpa(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnYb_PostLimbDrawOpa(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnYb* this = THIS; if (limbIndex == YB_LIMB_HEAD) { @@ -437,7 +437,7 @@ void EnYb_PostLimbDrawOpa(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnYb_PostLimbDrawXlu(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnYb_PostLimbDrawXlu(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnYb* this = THIS; if (limbIndex == YB_LIMB_HEAD) { @@ -448,35 +448,35 @@ void EnYb_PostLimbDrawXlu(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } } -void EnYb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnYb_Draw(Actor* thisx, PlayState* play) { EnYb* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha != 0) { if (this->alpha < 255) { if (this->alpha > 128) { func_8012C2B4(POLY_XLU_DISP++); - Scene_SetRenderModeXlu(globalCtx, 2, 2); + Scene_SetRenderModeXlu(play, 2, 2); } else { func_8012C304(POLY_XLU_DISP++); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); } gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); if (1) {} POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnYb_PostLimbDrawXlu, &this->actor, POLY_XLU_DISP); } else { - func_8012C28C(globalCtx->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 0, 1); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + func_8012C28C(play->state.gfxCtx); + Scene_SetRenderModeXlu(play, 0, 1); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnYb_PostLimbDrawOpa, &this->actor); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.h b/src/overlays/actors/ovl_En_Yb/z_en_yb.h index 1b4c898a2e..72d92d817c 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.h +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.h @@ -6,7 +6,7 @@ struct EnYb; -typedef void (*EnYbActionFunc)(struct EnYb*, GlobalContext*); +typedef void (*EnYbActionFunc)(struct EnYb*, PlayState*); typedef struct EnYb { /* 0x000 */ Actor actor; 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 004907003a..d5e6f2e001 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -10,10 +10,10 @@ #define THIS ((EnZl1*)thisx) -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); const ActorInit En_Zl1_InitVars = { ACTOR_EN_ZL1, @@ -27,11 +27,11 @@ const ActorInit En_Zl1_InitVars = { (ActorFunc)EnZl1_Draw, }; -void EnZl1_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Init(Actor* thisx, PlayState* play) { } -void EnZl1_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Destroy(Actor* thisx, PlayState* play) { } -void EnZl1_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Update(Actor* thisx, PlayState* play) { } -void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZl1_Draw(Actor* thisx, PlayState* play) { } 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 731af37720..92e0b29252 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -10,12 +10,12 @@ #define THIS ((EnZl4*)thisx) -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 func_809A1D0C(EnZl4* this, GlobalContext* globalCtx); +void func_809A1D0C(EnZl4* this, PlayState* play); #if 0 const ActorInit En_Zl4_InitVars = { 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 17c2c6d046..1541e1cd4d 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h @@ -5,7 +5,7 @@ struct EnZl4; -typedef void (*EnZl4ActionFunc)(struct EnZl4*, GlobalContext*); +typedef void (*EnZl4ActionFunc)(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 31fb3a8537..72b55a0361 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -10,14 +10,14 @@ #define THIS ((EnZo*)thisx) -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); -void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx); -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx); -void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx); +void EnZo_FollowPath(EnZo* this, PlayState* play); +void EnZo_TreadWater(EnZo* this, PlayState* play); +void EnZo_DoNothing(EnZo* this, PlayState* play); const ActorInit En_Zo_InitVars = { ACTOR_EN_ZO, @@ -119,7 +119,7 @@ s32 EnZo_SetAnimation(SkelAnime* skelAnime, s16 index) { return didChange; } -s32 EnZo_PlayWalkingSound(EnZo* this, GlobalContext* globalCtx) { +s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { u8 leftWasGrounded; u8 rightWasGrounded; s32 waterSfxId; @@ -137,15 +137,15 @@ s32 EnZo_PlayWalkingSound(EnZo* this, GlobalContext* globalCtx) { } sfxId = waterSfxId + SFX_FLAG; } else { - sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; } - this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(globalCtx, &this->leftFootPos, -6.0f); + this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) { Actor_PlaySfxAtPos(&this->actor, sfxId); } - this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(globalCtx, &this->rightFootPos, -6.0f); + this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) { Actor_PlaySfxAtPos(&this->actor, sfxId); } @@ -163,23 +163,23 @@ void EnZo_Blink(EnZo* this, s32 maxEyeIndex) { } } -void EnZo_UpdateCollider(EnZo* this, GlobalContext* globalCtx) { +void EnZo_UpdateCollider(EnZo* this, PlayState* play) { 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; - 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 EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) { +void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { static TrackOptionsSet sTrackOptions = { { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, }; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f point; SkelAnime_Update(&this->skelAnime); @@ -201,10 +201,10 @@ void EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) { } EnZo_Blink(this, 3); - SubS_FillLimbRotTables(globalCtx, this->limbRotY, this->limbRotZ, 20); + SubS_FillLimbRotTables(play, this->limbRotY, this->limbRotZ, 20); } -void EnZo_Walk(EnZo* this, GlobalContext* globalCtx) { +void EnZo_Walk(EnZo* this, PlayState* play) { if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) { EnZo_SetAnimation(&this->skelAnime, 6); } @@ -216,7 +216,7 @@ void EnZo_Walk(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx) { +void EnZo_FollowPath(EnZo* this, PlayState* play) { s16 speed; Vec3f pos; @@ -237,7 +237,7 @@ void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx) { } } -void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { +void EnZo_TreadWater(EnZo* this, PlayState* play) { f32 targetYVel; if (this->actor.depthInWater < (sREG(0) + 50.0f)) { @@ -248,46 +248,45 @@ void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.velocity.y, targetYVel, (sREG(1) + 18.0f) * 0.01f, (sREG(2) + 12.0f) * 0.01f); } -void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx) { +void EnZo_DoNothing(EnZo* this, PlayState* play) { } -void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Init(Actor* thisx, PlayState* play) { EnZo* this = THIS; s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, - ZORA_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); EnZo_SetAnimation(&this->skelAnime, 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, &sDamageTable, &sColChkInfoInit); - this->path = SubS_GetPathByIndex(globalCtx, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH); + this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = EnZo_Walk; this->actor.gravity = -4.0f; } -void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Destroy(Actor* thisx, PlayState* play) { EnZo* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Update(Actor* thisx, PlayState* play) { EnZo* this = THIS; - this->actionFunc(this, globalCtx); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - EnZo_LookAtPlayer(this, globalCtx); - EnZo_PlayWalkingSound(this, globalCtx); - EnZo_UpdateCollider(this, globalCtx); + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnZo_LookAtPlayer(this, play); + EnZo_PlayWalkingSound(this, play); + EnZo_UpdateCollider(this, play); } -s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, +s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnZo* this = THIS; @@ -311,7 +310,7 @@ s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void EnZo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnZo* this = THIS; Vec3f sp30 = { 400.0f, 0.0f, 0.0f }; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; @@ -339,15 +338,15 @@ static Gfx sTransparencyDlist[] = { gsSPEndDisplayList(), }; -void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZo_Draw(Actor* thisx, PlayState* play) { EnZo* this = THIS; s32 i; - u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); u8* shadowTexIter; TexturePtr eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); @@ -356,7 +355,7 @@ void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0C, &sTransparencyDlist[2]); 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, EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, &this->actor, POLY_OPA_DISP); Matrix_RotateXS(0, MTXMODE_NEW); @@ -369,6 +368,6 @@ void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { ARRAY_COUNT(this->bodyPartsPos), sShadowSizes, sParentBodyParts); } - SubS_DrawShadowTex(&this->actor, &globalCtx->state, shadowTex); - CLOSE_DISPS(globalCtx->state.gfxCtx); + SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); + CLOSE_DISPS(play->state.gfxCtx); } 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 fcc753ba5a..0dc75a7309 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -6,7 +6,7 @@ struct EnZo; -typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*); +typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); #define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) #define ENZO_NO_PATH 0x3F diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index 33e26e7e56..ca2c62e22e 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -11,31 +11,31 @@ #define THIS ((EnZob*)thisx) -void EnZob_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZob_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZob_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZob_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZob_Init(Actor* thisx, PlayState* play); +void EnZob_Destroy(Actor* thisx, PlayState* play); +void EnZob_Update(Actor* thisx, PlayState* play); +void EnZob_Draw(Actor* thisx, PlayState* play); void func_80B9F7E4(EnZob* this, s16 arg1, u8 arg2); -void func_80B9FD24(EnZob* this, GlobalContext* globalCtx); -void func_80B9FDDC(EnZob* this, GlobalContext* globalCtx); -void func_80B9FE1C(EnZob* this, GlobalContext* globalCtx); -void func_80B9FE5C(EnZob* this, GlobalContext* globalCtx); -void func_80B9FF20(EnZob* this, GlobalContext* globalCtx); -void func_80B9FF80(EnZob* this, GlobalContext* globalCtx); -void func_80BA005C(EnZob* this, GlobalContext* globalCtx); -void func_80BA00BC(EnZob* this, GlobalContext* globalCtx); -void func_80BA0318(EnZob* this, GlobalContext* globalCtx); -void func_80BA0374(EnZob* this, GlobalContext* globalCtx); -void func_80BA0610(EnZob* this, GlobalContext* globalCtx); -void func_80BA06BC(EnZob* this, GlobalContext* globalCtx); -void func_80BA0728(EnZob* this, GlobalContext* globalCtx); -void func_80BA09E0(EnZob* this, GlobalContext* globalCtx); -void func_80BA0A04(EnZob* this, GlobalContext* globalCtx); -void func_80BA0AD8(EnZob* this, GlobalContext* globalCtx); -void func_80BA0BB4(EnZob* this, GlobalContext* globalCtx); -void func_80BA0C14(EnZob* this, GlobalContext* globalCtx); -void func_80BA0CF4(EnZob* this, GlobalContext* globalCtx); +void func_80B9FD24(EnZob* this, PlayState* play); +void func_80B9FDDC(EnZob* this, PlayState* play); +void func_80B9FE1C(EnZob* this, PlayState* play); +void func_80B9FE5C(EnZob* this, PlayState* play); +void func_80B9FF20(EnZob* this, PlayState* play); +void func_80B9FF80(EnZob* this, PlayState* play); +void func_80BA005C(EnZob* this, PlayState* play); +void func_80BA00BC(EnZob* this, PlayState* play); +void func_80BA0318(EnZob* this, PlayState* play); +void func_80BA0374(EnZob* this, PlayState* play); +void func_80BA0610(EnZob* this, PlayState* play); +void func_80BA06BC(EnZob* this, PlayState* play); +void func_80BA0728(EnZob* this, PlayState* play); +void func_80BA09E0(EnZob* this, PlayState* play); +void func_80BA0A04(EnZob* this, PlayState* play); +void func_80BA0AD8(EnZob* this, PlayState* play); +void func_80BA0BB4(EnZob* this, PlayState* play); +void func_80BA0C14(EnZob* this, PlayState* play); +void func_80BA0CF4(EnZob* this, PlayState* play); const ActorInit En_Zob_InitVars = { ACTOR_EN_ZOB, @@ -77,7 +77,7 @@ static AnimationHeader* sAnimations[] = { Vec3f D_80BA1120 = { 300.0f, 900.0f, 0.0f }; -void EnZob_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZob_Init(Actor* thisx, PlayState* play) { EnZob* this = THIS; s32 i; s16 cs; @@ -85,10 +85,10 @@ void EnZob_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.0115f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zob_Skel_010810, &object_zob_Anim_006998, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_zob_Skel_010810, &object_zob_Anim_006998, this->jointTable, this->morphTable, 24); Animation_PlayLoop(&this->skelAnime, &object_zob_Anim_006998); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_2F4 = 0; this->unk_30E = -1; this->unk_310 = 0; @@ -143,10 +143,10 @@ void EnZob_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZob_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZob_Destroy(Actor* thisx, PlayState* play) { EnZob* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B9F7E4(EnZob* this, s16 arg1, u8 arg2) { @@ -205,7 +205,7 @@ void func_80B9F86C(EnZob* this) { } } -void func_80B9FA3C(EnZob* this, GlobalContext* globalCtx) { +void func_80B9FA3C(EnZob* this, PlayState* play) { u16 textId; this->unk_2F4 |= 1; @@ -249,7 +249,7 @@ void func_80B9FA3C(EnZob* this, GlobalContext* globalCtx) { func_80B9F7E4(this, 4, 2); } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } void func_80B9FC0C(EnZob* this) { @@ -266,27 +266,27 @@ void func_80B9FC70(EnZob* this, s16 arg1) { this->unk_30E = arg1; } -void func_80B9FCA0(EnZob* this, GlobalContext* globalCtx) { - func_801477B4(globalCtx); - globalCtx->msgCtx.ocarinaMode = 4; +void func_80B9FCA0(EnZob* this, PlayState* play) { + func_801477B4(play); + play->msgCtx.ocarinaMode = 4; func_80B9FC0C(this); this->unk_2F4 &= ~1; this->actionFunc = func_80BA0728; this->unk_304 = 0; func_80B9F7E4(this, 6, 2); - func_800B8718(&this->actor, &globalCtx->state); + func_800B8718(&this->actor, &play->state); } -void func_80B9FD24(EnZob* this, GlobalContext* globalCtx) { +void func_80B9FD24(EnZob* this, PlayState* play) { s32 actionIndex; s16 action; func_80B9F86C(this); - if (Cutscene_CheckActorAction(globalCtx, 500)) { + if (Cutscene_CheckActorAction(play, 500)) { this->unk_30E = -1; - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 500); - action = globalCtx->csCtx.actorActions[actionIndex]->action; + actionIndex = Cutscene_GetActorActionIndex(play, 500); + action = play->csCtx.actorActions[actionIndex]->action; if (action != this->unk_310) { this->unk_310 = action; @@ -303,24 +303,24 @@ void func_80B9FD24(EnZob* this, GlobalContext* globalCtx) { } } -void func_80B9FDDC(EnZob* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, 0x120C, &this->actor); +void func_80B9FDDC(EnZob* this, PlayState* play) { + Message_StartTextbox(play, 0x120C, &this->actor); this->actionFunc = func_80BA00BC; } -void func_80B9FE1C(EnZob* this, GlobalContext* globalCtx) { - Message_StartTextbox(globalCtx, 0x1211, &this->actor); +void func_80B9FE1C(EnZob* this, PlayState* play) { + Message_StartTextbox(play, 0x1211, &this->actor); this->actionFunc = func_80BA00BC; } -void func_80B9FE5C(EnZob* this, GlobalContext* globalCtx) { +void func_80B9FE5C(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (globalCtx->msgCtx.ocarinaMode == 3) { - globalCtx->msgCtx.unk11F10 = 0; + if (play->msgCtx.ocarinaMode == 3) { + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80B9FDDC; func_80B9FC70(this, 0); - } else if (Message_GetState(&globalCtx->msgCtx) == 11) { - globalCtx->msgCtx.unk11F10 = 0; + } else if (Message_GetState(&play->msgCtx) == 11) { + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80B9FE1C; this->unk_304 = 3; func_80B9F7E4(this, 5, 2); @@ -328,25 +328,25 @@ void func_80B9FE5C(EnZob* this, GlobalContext* globalCtx) { } } -void func_80B9FF20(EnZob* this, GlobalContext* globalCtx) { +void func_80B9FF20(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Message_GetState(&globalCtx->msgCtx) == 7) { - func_80152434(globalCtx, 0x42); + if (Message_GetState(&play->msgCtx) == 7) { + func_80152434(play, 0x42); this->actionFunc = func_80B9FE5C; func_80B9FC70(this, 2); } } -void func_80B9FF80(EnZob* this, GlobalContext* globalCtx) { +void func_80B9FF80(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (globalCtx->msgCtx.ocarinaMode == 3) { + if (play->msgCtx.ocarinaMode == 3) { this->actionFunc = func_80B9FF20; this->unk_304 = 6; func_80B9F7E4(this, 1, 0); - func_80152434(globalCtx, 0x3E); + func_80152434(play, 0x3E); func_80B9FC70(this, 1); - } else if (Message_GetState(&globalCtx->msgCtx) == 11) { - globalCtx->msgCtx.unk11F10 = 0; + } else if (Message_GetState(&play->msgCtx) == 11) { + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80B9FE1C; this->unk_304 = 3; func_80B9F7E4(this, 5, 2); @@ -354,48 +354,48 @@ void func_80B9FF80(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA005C(EnZob* this, GlobalContext* globalCtx) { +void func_80BA005C(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Message_GetState(&globalCtx->msgCtx) == 7) { - func_80152434(globalCtx, 0x41); + if (Message_GetState(&play->msgCtx) == 7) { + func_80152434(play, 0x41); this->actionFunc = func_80B9FF80; func_80B9FC70(this, 2); } } -void func_80BA00BC(EnZob* this, GlobalContext* globalCtx) { +void func_80BA00BC(EnZob* this, PlayState* play) { func_80B9F86C(this); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.currentTextId == 0x1212)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1212)) { + switch (play->msgCtx.choiceIndex) { case 1: func_8019F208(); - func_80151938(globalCtx, 0x1209); + func_80151938(play, 0x1209); this->unk_304 = 1; func_80B9F7E4(this, 2, 2); break; case 0: func_8019F230(); - func_80151938(globalCtx, 0x1213); + func_80151938(play, 0x1213); break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1208: case 0x120E: case 0x1216: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x120C: - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80B9FD24; func_80B9F7E4(this, 8, 0); func_80B9FC70(this, 3); @@ -405,28 +405,28 @@ void func_80BA00BC(EnZob* this, GlobalContext* globalCtx) { case 0x1211: case 0x1213: case 0x1217: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); this->unk_304 = 3; func_80B9F7E4(this, 4, 2); break; case 0x1218: - func_80B9FCA0(this, globalCtx); + func_80B9FCA0(this, play); break; case 0x1214: this->unk_2F4 |= 8; - func_80B9FCA0(this, globalCtx); + func_80B9FCA0(this, play); break; case 0x120F: gSaveContext.save.weekEventReg[31] |= 8; this->unk_2F4 |= 0x10; - func_80B9FCA0(this, globalCtx); + func_80B9FCA0(this, play); break; case 0x1209: - func_80152434(globalCtx, 0x3D); + func_80152434(play, 0x3D); this->unk_304 = 4; func_80B9F7E4(this, 0, 0); this->actionFunc = func_80BA005C; @@ -438,47 +438,47 @@ void func_80BA00BC(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA0318(EnZob* this, GlobalContext* globalCtx) { - func_80152434(globalCtx, 0x3D); +void func_80BA0318(EnZob* this, PlayState* play) { + func_80152434(play, 0x3D); this->unk_304 = 4; func_80B9F7E4(this, 0, 0); this->actionFunc = func_80BA005C; func_80B9FC70(this, 1); } -void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80BA0374(EnZob* this, PlayState* play) { + Player* player = GET_PLAYER(play); func_80B9F86C(this); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.currentTextId == 0x1205)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1205)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(globalCtx, 0x1207); + func_80151938(play, 0x1207); func_80B9F7E4(this, 2, 2); break; case 1: func_8019F230(); - func_80151938(globalCtx, 0x1206); + func_80151938(play, 0x1206); break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x11F8: gSaveContext.save.weekEventReg[30] |= 2; - func_80151938(globalCtx, 0x11F9); + func_80151938(play, 0x11F9); break; case 0x11F9: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BA0728; this->unk_304 = 0; func_80B9F7E4(this, 6, 2); @@ -490,19 +490,19 @@ void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { case 0x11FF: case 0x1201: case 0x1203: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x11FD: this->unk_304 = 3; func_80B9F7E4(this, 4, 2); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x11FE: this->unk_304 = 1; func_80B9F7E4(this, 3, 0); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x11FA: @@ -513,7 +513,7 @@ void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { case 0x120F: case 0x1210: case 0x1215: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BA0728; this->unk_304 = 0; func_80B9F7E4(this, 6, 2); @@ -522,7 +522,7 @@ void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { break; case 0x1207: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BA0318; player->unk_A90 = &this->actor; player->stateFlags3 |= 0x20; @@ -533,56 +533,56 @@ void func_80BA0374(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA0610(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0610(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - Message_StartTextbox(globalCtx, 0x120D, &this->actor); + Message_StartTextbox(play, 0x120D, &this->actor); this->unk_304 = 3; func_80B9F7E4(this, 5, 2); func_80B9FC70(this, 0); this->actionFunc = func_80BA00BC; } else { - func_800B8614(&this->actor, globalCtx, 500.0f); + func_800B8614(&this->actor, play, 500.0f); } } -void func_80BA06BC(EnZob* this, GlobalContext* globalCtx) { - func_80B9FD24(this, globalCtx); - if (!Cutscene_CheckActorAction(globalCtx, 500)) { +void func_80BA06BC(EnZob* this, PlayState* play) { + func_80B9FD24(this, play); + if (!Cutscene_CheckActorAction(play, 500)) { this->actionFunc = func_80BA0610; this->actor.flags |= ACTOR_FLAG_10000; - func_80BA0610(this, globalCtx); + func_80BA0610(this, play); } } -void func_80BA0728(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0728(EnZob* this, PlayState* play) { s32 pad; Vec3f sp28; func_80B9F86C(this); - if (func_800B8718(&this->actor, &globalCtx->state)) { + if (func_800B8718(&this->actor, &play->state)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - Message_StartTextbox(globalCtx, 0x1208, NULL); + Message_StartTextbox(play, 0x1208, NULL); gSaveContext.save.weekEventReg[30] |= 8; } else { - Message_StartTextbox(globalCtx, 0x1216, NULL); + Message_StartTextbox(play, 0x1216, NULL); } this->actionFunc = func_80BA00BC; this->unk_304 = 1; func_80B9F7E4(this, 2, 2); this->unk_30E = 0; this->unk_2F4 |= 1; - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BA0374; - func_80B9FA3C(this, globalCtx); - } else if (Cutscene_CheckActorAction(globalCtx, 500)) { + func_80B9FA3C(this, play); + } else if (Cutscene_CheckActorAction(play, 500)) { this->actionFunc = func_80BA06BC; } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 60.0f) && - Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, globalCtx, 150.0f); - func_800B874C(&this->actor, globalCtx, 200.0f, 150.0f); + Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { + func_800B8614(&this->actor, play, 150.0f); + func_800B874C(&this->actor, play, 200.0f, 150.0f); } sp28.x = this->actor.projectedPos.x; @@ -591,7 +591,7 @@ void func_80BA0728(EnZob* this, GlobalContext* globalCtx) { func_801A1FB4(3, &sp28, 0x6C, 1000.0f); } -void func_80BA08E8(EnZob* this, GlobalContext* globalCtx) { +void func_80BA08E8(EnZob* this, PlayState* play) { s32 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -615,24 +615,24 @@ void func_80BA08E8(EnZob* this, GlobalContext* globalCtx) { func_80B9F7E4(this, 5, 2); } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80BA09E0(EnZob* this, GlobalContext* globalCtx) { +void func_80BA09E0(EnZob* this, PlayState* play) { func_80B9F86C(this); } -void func_80BA0A04(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0A04(EnZob* this, PlayState* play) { u8 temp_v0; func_80B9F86C(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - temp_v0 = Message_GetState(&globalCtx->msgCtx); + temp_v0 = Message_GetState(&play->msgCtx); if (temp_v0 != 2) { - if ((temp_v0 == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = func_80BA0AD8; this->unk_304 = 0; func_80B9F7E4(this, 6, 2); @@ -644,7 +644,7 @@ void func_80BA0A04(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA0AD8(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0AD8(EnZob* this, PlayState* play) { func_80B9F86C(this); if (this->actor.home.rot.y != this->actor.shape.rot.y) { @@ -652,16 +652,16 @@ void func_80BA0AD8(EnZob* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BA0A04; - func_80BA08E8(this, globalCtx); - } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && + func_80BA08E8(this, play); + } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void func_80BA0BB4(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0BB4(EnZob* this, PlayState* play) { func_80B9F86C(this); if (gSaveContext.save.weekEventReg[79] & 1) { this->actionFunc = func_80BA09E0; @@ -670,7 +670,7 @@ void func_80BA0BB4(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA0C14(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0C14(EnZob* this, PlayState* play) { func_80B9F86C(this); if (this->unk_312 < 799) { @@ -683,8 +683,8 @@ void func_80BA0C14(EnZob* this, GlobalContext* globalCtx) { this->unk_312 = 999; } - if (Cutscene_CheckActorAction(globalCtx, 515)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 515)]->action == 1) { + if (Cutscene_CheckActorAction(play, 515)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 1) { this->actionFunc = func_80BA0CF4; this->unk_312 = -1; } @@ -694,25 +694,25 @@ void func_80BA0C14(EnZob* this, GlobalContext* globalCtx) { } } -void func_80BA0CF4(EnZob* this, GlobalContext* globalCtx) { +void func_80BA0CF4(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Cutscene_CheckActorAction(globalCtx, 515) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 515)]->action == 2)) { + if (Cutscene_CheckActorAction(play, 515) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 2)) { this->actionFunc = func_80BA0C14; } } -void EnZob_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZob_Update(Actor* thisx, PlayState* play) { s32 pad; EnZob* this = THIS; Actor_MoveWithGravity(&this->actor); 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, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->unk_30E != -1) && (ActorCutscene_GetCurrentIndex() != this->unk_306[this->unk_30E])) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -726,7 +726,7 @@ void EnZob_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->unk_2F4 & 1) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2F6, &this->unk_2FC, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk_2F6, &this->unk_2FC, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_2F6.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2F6.y, 0, 6, 6200, 100); @@ -735,7 +735,7 @@ void EnZob_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80BA0F64(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80BA0F64(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnZob* this = THIS; if (limbIndex == 9) { @@ -745,7 +745,7 @@ s32 func_80BA0F64(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p return false; } -void func_80BA0FAC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80BA0FAC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnZob* this = THIS; if (limbIndex == 9) { @@ -753,23 +753,23 @@ void func_80BA0FAC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnZob_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZob_Draw(Actor* thisx, PlayState* play) { EnZob* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_2F4 & 0x20) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 0, 0, 0, 0, this->unk_312, 1000); } - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80BA0F64, func_80BA0FAC, &this->actor); if (this->unk_2F4 & 0x20) { - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.h b/src/overlays/actors/ovl_En_Zob/z_en_zob.h index 18834f17ed..7c34efb85a 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.h +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.h @@ -5,7 +5,7 @@ struct EnZob; -typedef void (*EnZobActionFunc)(struct EnZob*, GlobalContext*); +typedef void (*EnZobActionFunc)(struct EnZob*, PlayState*); #define ENZOB_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index f908ceafac..d2645b67b7 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -10,10 +10,10 @@ #define THIS ((EnZod*)thisx) -void EnZod_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZod_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZod_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZod_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZod_Init(Actor* thisx, PlayState* play); +void EnZod_Destroy(Actor* thisx, PlayState* play); +void EnZod_Update(Actor* thisx, PlayState* play); +void EnZod_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit En_Zod_InitVars = { diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.h b/src/overlays/actors/ovl_En_Zod/z_en_zod.h index 7e360a59a3..9e50b085cb 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.h +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.h @@ -5,7 +5,7 @@ struct EnZod; -typedef void (*EnZodActionFunc)(struct EnZod*, GlobalContext*); +typedef void (*EnZodActionFunc)(struct EnZod*, PlayState*); typedef struct EnZod { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 925eaeec00..4ad1108897 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -11,25 +11,25 @@ #define THIS ((EnZog*)thisx) -void EnZog_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZog_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZog_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZog_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZog_Init(Actor* thisx, PlayState* play); +void EnZog_Destroy(Actor* thisx, PlayState* play); +void EnZog_Update(Actor* thisx, PlayState* play); +void EnZog_Draw(Actor* thisx, PlayState* play); -void func_80B943A0(EnZog* this, GlobalContext* globalCtx); -void func_80B943C0(EnZog* this, GlobalContext* globalCtx); -void func_80B94470(EnZog* this, GlobalContext* globalCtx); -void func_80B9451C(EnZog* this, GlobalContext* globalCtx); -void func_80B9461C(EnZog* this, GlobalContext* globalCtx); -void func_80B946B4(EnZog* this, GlobalContext* globalCtx); -void func_80B946FC(EnZog* this, GlobalContext* globalCtx); -void func_80B948A8(EnZog* this, GlobalContext* globalCtx); -void func_80B94A00(EnZog* this, GlobalContext* globalCtx); -void func_80B94C5C(EnZog* this, GlobalContext* globalCtx); -void func_80B94D0C(EnZog* this, GlobalContext* globalCtx); -void func_80B94E34(EnZog* this, GlobalContext* globalCtx); -void func_80B95128(EnZog* this, GlobalContext* globalCtx); -void func_80B95240(EnZog* this, GlobalContext* globalCtx); +void func_80B943A0(EnZog* this, PlayState* play); +void func_80B943C0(EnZog* this, PlayState* play); +void func_80B94470(EnZog* this, PlayState* play); +void func_80B9451C(EnZog* this, PlayState* play); +void func_80B9461C(EnZog* this, PlayState* play); +void func_80B946B4(EnZog* this, PlayState* play); +void func_80B946FC(EnZog* this, PlayState* play); +void func_80B948A8(EnZog* this, PlayState* play); +void func_80B94A00(EnZog* this, PlayState* play); +void func_80B94C5C(EnZog* this, PlayState* play); +void func_80B94D0C(EnZog* this, PlayState* play); +void func_80B94E34(EnZog* this, PlayState* play); +void func_80B95128(EnZog* this, PlayState* play); +void func_80B95240(EnZog* this, PlayState* play); static u8 D_80B95E10; @@ -127,7 +127,7 @@ static Color_RGBA8 D_80B959A8 = { 80, 80, 220, 255 }; static Vec3f D_80B959AC = { 0.0f, 0.0f, 15.0f }; -void func_80B93310(Actor* thisx, Lights* mapper, GlobalContext* globalCtx) { +void func_80B93310(Actor* thisx, Lights* mapper, PlayState* play) { Vec3f sp34; EnZog* this = THIS; f32 sp2C; @@ -149,23 +149,23 @@ void func_80B93310(Actor* thisx, Lights* mapper, GlobalContext* globalCtx) { } Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_2F0); - func_800B4AEC(globalCtx, &this->actor, 50.0f); + func_800B4AEC(play, &this->actor, 50.0f); if (sp34.y < this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; } else { this->actor.world.pos.y = sp34.y; } this->actor.scale.z *= sp2C * (1 / 12.0f); - ActorShadow_DrawCircle(&this->actor, mapper, globalCtx); + ActorShadow_DrawCircle(&this->actor, mapper, play); this->actor.scale.z = this->actor.scale.x; Math_Vec3f_Copy(&this->actor.world.pos, &sp34); } } -void func_80B93468(EnZog* this, GlobalContext* globalCtx) { +void func_80B93468(EnZog* this, PlayState* play) { Vec3s* points; - this->unk_2E8 = &globalCtx->setupPathList[ENZOG_GET_FC00(&this->actor)]; + this->unk_2E8 = &play->setupPathList[ENZOG_GET_FC00(&this->actor)]; if (this->unk_2E8 != NULL) { points = &((Vec3s*)Lib_SegmentedToVirtual(this->unk_2E8->points))[this->unk_2EC]; points++; @@ -177,7 +177,7 @@ void func_80B93468(EnZog* this, GlobalContext* globalCtx) { } } -void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZog_Init(Actor* thisx, PlayState* play) { s32 pad; EnZog* this = THIS; s32 i; @@ -199,15 +199,15 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80B95128; this->actor.textId = 0x1004; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zog_Skel_029170, &object_zog_Anim_00FC0C, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_zog_Skel_029170, &object_zog_Anim_00FC0C, this->jointTable, this->morphTable, 23); Animation_PlayOnce(&this->skelAnime, &object_zog_Anim_00FC0C); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) && - ((globalCtx->csCtx.currentCsIndex != 2) || (gSaveContext.sceneSetupIndex != 0) || - (globalCtx->sceneNum != SCENE_30GYOSON))) { + ((play->csCtx.currentCsIndex != 2) || (gSaveContext.sceneSetupIndex != 0) || + (play->sceneNum != SCENE_30GYOSON))) { Actor_MarkForDeath(&this->actor); return; } @@ -235,7 +235,7 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_2EC = 0; if (ENZOG_GET_FC00(&this->actor) != ENZOG_FC00_63) { - func_80B93468(this, globalCtx); + func_80B93468(this, play); } else { this->unk_2E8 = NULL; } @@ -260,7 +260,7 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z = 0; if (ENZOG_GET_F(&this->actor) != ENZOG_F_2) { for (i = 0; i < 5; i++) { - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TANRON4, this->actor.world.pos.x, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON4, this->actor.world.pos.x, this->actor.world.pos.y + 500.0f, this->actor.world.pos.z, 0, 0, 0, 100); } } @@ -290,10 +290,10 @@ void EnZog_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZog_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZog_Destroy(Actor* thisx, PlayState* play) { EnZog* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80B939C0(EnZog* this, s16 arg1, u8 arg2) { @@ -302,7 +302,7 @@ void func_80B939C0(EnZog* this, s16 arg1, u8 arg2) { this->unk_304 = arg1; } -void func_80B93A48(EnZog* this, GlobalContext* globalCtx) { +void func_80B93A48(EnZog* this, PlayState* play) { s16* table; if (SkelAnime_Update(&this->skelAnime)) { @@ -346,7 +346,7 @@ void func_80B93BA8(EnZog* this, s16 arg1) { this->unk_30A |= 4; } -s32 func_80B93BE0(EnZog* this, GlobalContext* globalCtx) { +s32 func_80B93BE0(EnZog* this, PlayState* play) { Path* path = this->unk_2E8; s16 temp_v0; Vec3s* points; @@ -368,7 +368,7 @@ s32 func_80B93BE0(EnZog* this, GlobalContext* globalCtx) { if (ABS_ALT(temp_v0 - this->actor.world.rot.y) > 0x4000) { this->unk_2EC++; - func_80B93468(this, globalCtx); + func_80B93468(this, play); if ((this->unk_2EC + 1) >= this->unk_2E8->count) { this->unk_30A |= 1; return true; @@ -380,28 +380,28 @@ s32 func_80B93BE0(EnZog* this, GlobalContext* globalCtx) { return false; } -void func_80B93D2C(EnZog* this, GlobalContext* globalCtx) { +void func_80B93D2C(EnZog* this, PlayState* play) { s32 pad; Vec3f sp28 = this->actor.world.pos; sp28.y += this->actor.depthInWater; this->actor.world.pos.y += (this->actor.depthInWater - 10.0f) + (2.0f * Math_SinS(this->unk_308)); this->unk_308 += 0x200; - if ((globalCtx->gameplayFrames % 16) == 0) { - EffectSsGRipple_Spawn(globalCtx, &sp28, 150, 500, 0); + if ((play->gameplayFrames % 16) == 0) { + EffectSsGRipple_Spawn(play, &sp28, 150, 500, 0); } } -void func_80B93DE8(Vec3f* arg0, GlobalContext* globalCtx, s32 arg2) { +void func_80B93DE8(Vec3f* arg0, PlayState* play, s32 arg2) { Vec3f sp2C; sp2C.x = randPlusMinusPoint5Scaled(30.0f) + arg0->x; sp2C.y = arg0->y + 3.0f; sp2C.z = randPlusMinusPoint5Scaled(30.0f) + arg0->z; - EffectSsKirakira_SpawnDispersed(globalCtx, &sp2C, &D_80B9598C, &D_80B95998, &D_80B959A4, &D_80B959A8, 1000, arg2); + EffectSsKirakira_SpawnDispersed(play, &sp2C, &D_80B9598C, &D_80B95998, &D_80B959A4, &D_80B959A8, 1000, arg2); } -s32 func_80B93EA0(EnZog* this, GlobalContext* globalCtx) { +s32 func_80B93EA0(EnZog* this, PlayState* play) { s16 sp3E; if (SkelAnime_Update(&this->skelAnime)) { @@ -459,13 +459,13 @@ s32 func_80B93EA0(EnZog* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } - if (Cutscene_CheckActorAction(globalCtx, 471)) { - sp3E = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 471)]->action; - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 471)); + if (Cutscene_CheckActorAction(play, 471)) { + sp3E = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 471)]->action; + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 471)); switch (this->unk_306) { case 2: - if (globalCtx->csCtx.frames == 60) { + if (play->csCtx.frames == 60) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_JUMP_SAND); } break; @@ -478,9 +478,9 @@ s32 func_80B93EA0(EnZog* this, GlobalContext* globalCtx) { } if (this->unk_322 > 0) { - func_80B93DE8(&this->unk_2F0, globalCtx, 20); - func_80B93DE8(&this->actor.world.pos, globalCtx, 20); - func_80B93DE8(&this->actor.focus.pos, globalCtx, 20); + func_80B93DE8(&this->unk_2F0, play, 20); + func_80B93DE8(&this->actor.world.pos, play, 20); + func_80B93DE8(&this->actor.focus.pos, play, 20); } break; @@ -587,19 +587,19 @@ s32 func_80B93EA0(EnZog* this, GlobalContext* globalCtx) { return false; } -void func_80B943A0(EnZog* this, GlobalContext* globalCtx) { - func_80B93EA0(this, globalCtx); +void func_80B943A0(EnZog* this, PlayState* play) { + func_80B93EA0(this, play); } -void func_80B943C0(EnZog* this, GlobalContext* globalCtx) { +void func_80B943C0(EnZog* this, PlayState* play) { if (!(this->unk_30A & 4)) { this->actionFunc = func_80B943A0; this->unk_306 = -1; } } -void func_80B943EC(EnZog* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B943EC(EnZog* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_30A & 0x10) { if (!(player->stateFlags2 & 0x8000000)) { @@ -611,37 +611,37 @@ void func_80B943EC(EnZog* this, GlobalContext* globalCtx) { } } -void func_80B94470(EnZog* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 5) { - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.currentTextId == 0x103C)) { - func_801477B4(globalCtx); +void func_80B94470(EnZog* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 5) { + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x103C)) { + func_801477B4(play); this->actionFunc = func_80B9451C; this->unk_300 = this->unk_302 = 0; this->unk_31C = 2; this->unk_31E = 0; } } - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B9451C(EnZog* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B9451C(EnZog* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_300 = 2; this->actionFunc = func_80B94470; - } else if ((globalCtx->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + } else if ((play->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((play->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; } } else if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->actor, globalCtx, 150.0f); + func_800B8614(&this->actor, play, 150.0f); } - func_80B943EC(this, globalCtx); + func_80B943EC(this, play); } -void func_80B9461C(EnZog* this, GlobalContext* globalCtx) { - if (!func_80B93EA0(this, globalCtx)) { +void func_80B9461C(EnZog* this, PlayState* play) { + if (!func_80B93EA0(this, play)) { this->actor.textId = 0x103C; this->actionFunc = func_80B9451C; this->actor.flags |= ACTOR_FLAG_2000000; @@ -653,52 +653,52 @@ void func_80B9461C(EnZog* this, GlobalContext* globalCtx) { } } -void func_80B946B4(EnZog* this, GlobalContext* globalCtx) { - func_80B93A48(this, globalCtx); +void func_80B946B4(EnZog* this, PlayState* play) { + func_80B93A48(this, play); if (!(this->unk_30A & 4)) { this->actionFunc = func_80B9461C; this->unk_306 = -1; } } -void func_80B946FC(EnZog* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80B946FC(EnZog* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80B946B4; func_80B93BA8(this, 1); break; case 1: func_8019F230(); - func_80151938(globalCtx, 0x1014); + func_80151938(play, 0x1014); break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1008: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1009: this->unk_300 = 4; - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1014: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1015: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B948A8; this->unk_300 = this->unk_302 = 0; this->unk_31C = 2; @@ -709,15 +709,15 @@ void func_80B946FC(EnZog* this, GlobalContext* globalCtx) { break; } - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B948A8(EnZog* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B948A8(EnZog* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_300 = 2; this->actionFunc = func_80B946FC; - } else if ((globalCtx->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { - if ((globalCtx->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { + } else if ((play->msgCtx.ocarinaMode == 3) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((play->msgCtx.unk1202E == 7) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { func_80B93BA8(this, 2); this->actionFunc = func_80B943C0; this->actor.shape.shadowDraw = NULL; @@ -733,18 +733,18 @@ void func_80B948A8(EnZog* this, GlobalContext* globalCtx) { } if ((this->unk_302 == 0) && (this->actor.xzDistToPlayer < 120.0f)) { - func_800B8614(&this->actor, globalCtx, 150.0f); + func_800B8614(&this->actor, play, 150.0f); } } - func_80B93A48(this, globalCtx); - func_80B943EC(this, globalCtx); + func_80B93A48(this, play); + func_80B943EC(this, play); } -void func_80B94A00(EnZog* this, GlobalContext* globalCtx) { +void func_80B94A00(EnZog* this, PlayState* play) { s32 pad; Vec3f sp30; - if (func_80B93BE0(this, globalCtx)) { + if (func_80B93BE0(this, play)) { this->actionFunc = func_80B948A8; this->actor.flags |= ACTOR_FLAG_2000000; if (gSaveContext.save.weekEventReg[29] & 0x20) { @@ -766,17 +766,17 @@ void func_80B94A00(EnZog* this, GlobalContext* globalCtx) { this->actor.speedXZ = 1.5f; } - if ((this->actor.depthInWater > 0.0f) && ((globalCtx->gameplayFrames % 8) == 0)) { + if ((this->actor.depthInWater > 0.0f) && ((play->gameplayFrames % 8) == 0)) { sp30 = this->actor.world.pos; sp30.y += this->actor.depthInWater; - EffectSsGRipple_Spawn(globalCtx, &sp30, 150, 500, 0); + EffectSsGRipple_Spawn(play, &sp30, 150, 500, 0); } if (this->actor.shape.yOffset > 0.0f) { this->actor.shape.yOffset -= 20.0f; } - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); if ((this->unk_304 == 4) && (Animation_OnFrame(&this->skelAnime, 136.0f) || Animation_OnFrame(&this->skelAnime, 155.0f))) { @@ -793,7 +793,7 @@ void func_80B94A00(EnZog* this, GlobalContext* globalCtx) { } } -void func_80B94C5C(EnZog* this, GlobalContext* globalCtx) { +void func_80B94C5C(EnZog* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (this->unk_304 != 0) { if (this->actor.shape.yOffset > 0.0f) { @@ -812,11 +812,11 @@ void func_80B94C5C(EnZog* this, GlobalContext* globalCtx) { this->actionFunc = func_80B94A00; } - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B94D0C(EnZog* this, GlobalContext* globalCtx) { - func_80B93D2C(this, globalCtx); +void func_80B94D0C(EnZog* this, PlayState* play) { + func_80B93D2C(this, play); this->actor.speedXZ = 0.0f; if (this->unk_320 > 0) { this->unk_320--; @@ -827,17 +827,17 @@ void func_80B94D0C(EnZog* this, GlobalContext* globalCtx) { this->unk_31E = 0; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { this->unk_320 = 5; - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0x1004: case 0x1005: case 0x1006: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1007: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B94E34; this->unk_300 = 5; this->unk_320 = 0; @@ -847,15 +847,15 @@ void func_80B94D0C(EnZog* this, GlobalContext* globalCtx) { break; } } - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B94E34(EnZog* this, GlobalContext* globalCtx) { +void func_80B94E34(EnZog* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_80B93D2C(this, globalCtx); - func_80B93BE0(this, globalCtx); + func_80B93D2C(this, play); + func_80B93BE0(this, play); if (this->actor.speedXZ < 0.1f) { this->actor.speedXZ = 0.0f; } else { @@ -867,9 +867,9 @@ void func_80B94E34(EnZog* this, GlobalContext* globalCtx) { sp38.x += randPlusMinusPoint5Scaled(30.0f); sp38.y += 20.0f; sp38.z += randPlusMinusPoint5Scaled(30.0f); - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, sp38.x, sp38.z, &sp38.y, &sp44) && + if (WaterBox_GetSurface1(play, &play->colCtx, sp38.x, sp38.z, &sp38.y, &sp44) && (this->actor.world.pos.y < sp38.y)) { - EffectSsGSplash_Spawn(globalCtx, &sp38, NULL, NULL, 1, + EffectSsGSplash_Spawn(play, &sp38, NULL, NULL, 1, Rand_ZeroFloat(this->actor.speedXZ * 40.0f) + (this->actor.speedXZ * 60.0f)); } @@ -882,14 +882,14 @@ void func_80B94E34(EnZog* this, GlobalContext* globalCtx) { } if (ABS_ALT(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0x5000) { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 60.0f, 40.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 60.0f, 40.0f); } if (this->unk_324 > 0) { this->unk_324--; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B94D0C; this->actor.speedXZ = 0.0f; this->unk_300 = 2; @@ -907,18 +907,18 @@ void func_80B94E34(EnZog* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[88] |= 0x10; } else if ((this->actor.yawTowardsPlayer > 16000) && (this->actor.yawTowardsPlayer < 32000) && (this->unk_302 == 0)) { - func_800B8614(&this->actor, globalCtx, 150.0f); + func_800B8614(&this->actor, play, 150.0f); } this->actor.shape.rot.y = this->actor.world.rot.y; - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B95128(EnZog* this, GlobalContext* globalCtx) { - func_80B93D2C(this, globalCtx); - func_80B93BE0(this, globalCtx); +void func_80B95128(EnZog* this, PlayState* play) { + func_80B93D2C(this, play); + func_80B93BE0(this, play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B94D0C; this->unk_300 = 2; this->actor.speedXZ = 0.0f; @@ -940,28 +940,28 @@ void func_80B95128(EnZog* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_10000; gSaveContext.save.weekEventReg[91] |= 1; } else { - func_800B8614(&this->actor, globalCtx, 150.0f); + func_800B8614(&this->actor, play, 150.0f); } this->actor.shape.rot.y = this->actor.world.rot.y; - func_80B93A48(this, globalCtx); + func_80B93A48(this, play); } -void func_80B95240(EnZog* this, GlobalContext* globalCtx) { - func_80B93EA0(this, globalCtx); +void func_80B95240(EnZog* this, PlayState* play) { + func_80B93EA0(this, play); } -void EnZog_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZog_Update(Actor* thisx, PlayState* play) { s32 pad; EnZog* this = THIS; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 10.0f, 5); - if (Cutscene_CheckActorAction(globalCtx, 0x1D7) && (ENZOG_GET_F(&this->actor) != ENZOG_F_2)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 5); + if (Cutscene_CheckActorAction(play, 0x1D7) && (ENZOG_GET_F(&this->actor) != ENZOG_F_2)) { this->actionFunc = func_80B9461C; this->actor.shape.yOffset = 0.0f; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (((this->unk_304 == 6) && Animation_OnFrame(&this->skelAnime, 43.0f)) || ((this->unk_304 == 17) && Animation_OnFrame(&this->skelAnime, 14.0f))) { @@ -975,7 +975,7 @@ void EnZog_Update(Actor* thisx, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->actor, &this->collider); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; @@ -997,7 +997,7 @@ void EnZog_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnZog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80B959B8 = { 0.0f, 0.0f, 0.0f }; EnZog* this = THIS; @@ -1012,15 +1012,15 @@ void EnZog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } if ((this->unk_30A & 2) && (limbIndex == 17)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, object_zog_DL_0280A8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void func_80B95598(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { +void func_80B95598(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B959C4 = { 0.0f, 0.0f, 0.0f }; EnZog* this = THIS; @@ -1039,21 +1039,21 @@ void func_80B95598(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnZog_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZog_Draw(Actor* thisx, PlayState* play) { EnZog* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_30A & 8) { if (this->unk_322 > 128) { gfx = POLY_XLU_DISP++; func_8012C2B4(gfx); - Scene_SetRenderModeXlu(globalCtx, 2, 2); + Scene_SetRenderModeXlu(play, 2, 2); } else { gfx = POLY_XLU_DISP++; func_8012C304(gfx); - Scene_SetRenderModeXlu(globalCtx, 1, 2); + Scene_SetRenderModeXlu(play, 1, 2); } gfx = POLY_XLU_DISP; @@ -1064,11 +1064,11 @@ void EnZog_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = &gfx[3]; POLY_XLU_DISP = - SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, NULL, func_80B95598, &this->actor, POLY_XLU_DISP); + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, func_80B95598, &this->actor, POLY_XLU_DISP); } else { - func_8012C28C(globalCtx->state.gfxCtx); - Scene_SetRenderModeXlu(globalCtx, 0, 1); + func_8012C28C(play->state.gfxCtx); + Scene_SetRenderModeXlu(play, 0, 1); gfx = POLY_OPA_DISP; @@ -1077,9 +1077,9 @@ void EnZog_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(&gfx[2], 0, 0, 0, 255); POLY_OPA_DISP = &gfx[3]; - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, NULL, EnZog_PostLimbDraw, &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, EnZog_PostLimbDraw, &this->actor); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.h b/src/overlays/actors/ovl_En_Zog/z_en_zog.h index 7dba946d58..e649c52ab5 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.h +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.h @@ -5,7 +5,7 @@ struct EnZog; -typedef void (*EnZogActionFunc)(struct EnZog*, GlobalContext*); +typedef void (*EnZogActionFunc)(struct EnZog*, PlayState*); #define ENZOG_GET_F(thisx) ((thisx)->params & 0xF) #define ENZOG_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index b65da70e2a..29490e9645 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -12,31 +12,31 @@ #define THIS ((EnZoraegg*)thisx) -void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZoraegg_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZoraegg_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZoraegg_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZoraegg_Init(Actor* thisx, PlayState* play); +void EnZoraegg_Destroy(Actor* thisx, PlayState* play); +void EnZoraegg_Update(Actor* thisx, PlayState* play); +void EnZoraegg_Draw(Actor* thisx, PlayState* play); -s32 func_80B319A8(GlobalContext* globalCtx); -void func_80B32084(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32094(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B320E0(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B321D0(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32228(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B322BC(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32390(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B324B0(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32644(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B326F4(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32820(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32928(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32A88(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32B10(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32B3C(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32B70(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32BB8(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32C34(EnZoraegg* this, GlobalContext* globalCtx); -void func_80B32D08(EnZoraegg* this, GlobalContext* globalCtx); +s32 func_80B319A8(PlayState* play); +void func_80B32084(EnZoraegg* this, PlayState* play); +void func_80B32094(EnZoraegg* this, PlayState* play); +void func_80B320E0(EnZoraegg* this, PlayState* play); +void func_80B321D0(EnZoraegg* this, PlayState* play); +void func_80B32228(EnZoraegg* this, PlayState* play); +void func_80B322BC(EnZoraegg* this, PlayState* play); +void func_80B32390(EnZoraegg* this, PlayState* play); +void func_80B324B0(EnZoraegg* this, PlayState* play); +void func_80B32644(EnZoraegg* this, PlayState* play); +void func_80B326F4(EnZoraegg* this, PlayState* play); +void func_80B32820(EnZoraegg* this, PlayState* play); +void func_80B32928(EnZoraegg* this, PlayState* play); +void func_80B32A88(EnZoraegg* this, PlayState* play); +void func_80B32B10(EnZoraegg* this, PlayState* play); +void func_80B32B3C(EnZoraegg* this, PlayState* play); +void func_80B32B70(EnZoraegg* this, PlayState* play); +void func_80B32BB8(EnZoraegg* this, PlayState* play); +void func_80B32C34(EnZoraegg* this, PlayState* play); +void func_80B32D08(EnZoraegg* this, PlayState* play); const ActorInit En_Zoraegg_InitVars = { ACTOR_EN_ZORAEGG, @@ -72,13 +72,13 @@ void func_80B31590(EnZoraegg* this) { this->actor.shape.rot.x = this->actor.shape.rot.z; } -void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZoraegg_Init(Actor* thisx, PlayState* play) { s32 pad; EnZoraegg* this = THIS; u16 sp40[] = { 457, 458, 459, 460, 461, 462, 464 }; Actor_SetScale(&this->actor, 0.006f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zoraegg_Skel_004C90, &object_zoraegg_Anim_005098, + SkelAnime_InitFlex(play, &this->skelAnime, &object_zoraegg_Skel_004C90, &object_zoraegg_Anim_005098, this->jointTable, this->morphTable, 7); Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_005098); ActorShape_Init(&this->actor.shape, 1100.0f, NULL, 0.0f); @@ -97,14 +97,14 @@ void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { switch (ENZORAEGG_GET_1F(&this->actor)) { case ENZORAEGG_1F_0: - if (Flags_GetSwitch(globalCtx, ENZORAEGG_GET_FE00(&this->actor))) { + if (Flags_GetSwitch(play, ENZORAEGG_GET_FE00(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } break; case ENZORAEGG_1F_17: - if (func_80B319A8(globalCtx) >= 7) { + if (func_80B319A8(play) >= 7) { Actor_MarkForDeath(&this->actor); this->actor.home.rot.z = 1; return; @@ -168,7 +168,7 @@ void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1EE = 0; this->unk_1EF = 0; this->actionFunc = func_80B32B10; - if (((ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_3) >= func_80B319A8(globalCtx)) { + if (((ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_3) >= func_80B319A8(play)) { this->actionFunc = func_80B32B3C; this->actor.draw = NULL; } @@ -202,17 +202,17 @@ void EnZoraegg_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZoraegg_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZoraegg_Destroy(Actor* thisx, PlayState* play) { } -s32 func_80B319A8(GlobalContext* globalCtx) { - return gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 & 7; +s32 func_80B319A8(PlayState* play) { + return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; } -void func_80B319D0(GlobalContext* globalCtx, s32 arg1) { +void func_80B319D0(PlayState* play, s32 arg1) { if ((arg1 < 8) && (arg1 >= 0)) { - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 &= ~7; - gSaveContext.save.permanentSceneFlags[globalCtx->sceneNum].unk_14 |= arg1; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg1; } } @@ -240,15 +240,15 @@ void func_80B31A34(EnZoraegg* this) { } } -void func_80B31C40(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B31C40(EnZoraegg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos); this->actor.focus.pos.y += 10.0f; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } -Actor* func_80B31CB4(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +Actor* func_80B31CB4(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_17) && @@ -261,8 +261,8 @@ Actor* func_80B31CB4(GlobalContext* globalCtx) { return NULL; } -Actor* func_80B31D14(GlobalContext* globalCtx) { - Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; +Actor* func_80B31D14(PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (actor != NULL) { if ((actor->id == ACTOR_EN_ZORAEGG) && (ENZORAEGG_GET_1F(actor) == ENZORAEGG_1F_3)) { @@ -273,13 +273,13 @@ Actor* func_80B31D14(GlobalContext* globalCtx) { return NULL; } -void func_80B31D64(EnZoraegg* this, GlobalContext* globalCtx, s32 arg2, f32 arg3) { +void func_80B31D64(EnZoraegg* this, PlayState* play, s32 arg2, f32 arg3) { Vec3f sp24 = this->actor.world.pos; sp24.y += arg3; - if ((globalCtx->gameplayFrames & arg2) == 0) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); + if ((play->gameplayFrames & arg2) == 0) { + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 0.0f, 10.0f, 0.13f); } } @@ -322,45 +322,45 @@ void func_80B31E00(EnZoraegg* this) { } } -void func_80B32084(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32084(EnZoraegg* this, PlayState* play) { } -void func_80B32094(EnZoraegg* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 2) { +void func_80B32094(EnZoraegg* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 2) { this->actionFunc = func_80B320E0; } - func_80B31C40(this, globalCtx); + func_80B31C40(this, play); } -void func_80B320E0(EnZoraegg* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetSwitch(globalCtx, ENZORAEGG_GET_FE00(&this->actor)); +void func_80B320E0(EnZoraegg* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { + Flags_SetSwitch(play, ENZORAEGG_GET_FE00(&this->actor)); Actor_MarkForDeath(&this->actor); - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B32094; - Message_StartTextbox(globalCtx, 0x24B, &this->actor); + Message_StartTextbox(play, 0x24B, &this->actor); } else { - Actor_PickUp(&this->actor, globalCtx, GI_MAX, 80.0f, 60.0f); + Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 60.0f); if (this->actor.isTargeted) { - func_800B8614(&this->actor, globalCtx, 110.0f); + func_800B8614(&this->actor, play, 110.0f); } } this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.targetMode = 3; - func_80B31C40(this, globalCtx); + func_80B31C40(this, play); } -void func_80B321D0(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B321D0(EnZoraegg* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { this->actionFunc = func_80B322BC; - func_80B319D0(globalCtx, func_80B319A8(globalCtx) + 1); + func_80B319D0(play, func_80B319A8(play) + 1); } } -void func_80B32228(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32228(EnZoraegg* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, this->unk_1DC); @@ -378,11 +378,11 @@ void func_80B32228(EnZoraegg* this, GlobalContext* globalCtx) { } } -void func_80B322BC(EnZoraegg* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B322BC(EnZoraegg* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->actor.cutscene != -1) { - this->unk_1DC = func_80B31CB4(globalCtx); + this->unk_1DC = func_80B31CB4(play); if (this->unk_1DC != NULL) { this->unk_1E8 = 3; this->actionFunc = func_80B32228; @@ -392,23 +392,23 @@ void func_80B322BC(EnZoraegg* this, GlobalContext* globalCtx) { if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z))) { - func_8012300C(globalCtx, 25); + func_8012300C(play, 25); } } -void func_80B32390(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32390(EnZoraegg* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - Actor* temp_v0 = func_80B31D14(globalCtx); + Actor* temp_v0 = func_80B31D14(play); if (temp_v0 != NULL) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, temp_v0); gSaveContext.eventInf[3] |= 8; Actor_MarkForDeath(&this->actor); } - } else if ((func_80B319A8(globalCtx) >= 7) && + } else if ((func_80B319A8(play) >= 7) && (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) { @@ -416,28 +416,25 @@ void func_80B32390(EnZoraegg* this, GlobalContext* globalCtx) { } } -void func_80B324B0(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B324B0(EnZoraegg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCmd)) { + if (Cutscene_CheckActorAction(play, this->actorActionCmd)) { if (this->unk_1EA & 4) { - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCmd) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)]->action == - 3)) { + if (Cutscene_CheckActorAction(play, this->actorActionCmd) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 3)) { Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); this->unk_1EA &= ~4; } } else { - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCmd) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)]->action == - 4)) { + if (Cutscene_CheckActorAction(play, this->actorActionCmd) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 4)) { Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004E04); this->unk_1EA |= 4; } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if ((this->unk_1EA & 4) && Animation_OnFrame(&this->skelAnime, this->unk_1E4)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); @@ -449,18 +446,17 @@ void func_80B324B0(EnZoraegg* this, GlobalContext* globalCtx) { } } -void func_80B32644(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32644(EnZoraegg* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); this->unk_1EE = 0; this->unk_1EA |= 2; } - if (!Cutscene_CheckActorAction(globalCtx, this->actorActionCmd)) { + if (!Cutscene_CheckActorAction(play, this->actorActionCmd)) { this->actionFunc = func_80B324B0; } else { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (this->unk_1EE > 25) { this->unk_1EE -= 25; @@ -470,11 +466,11 @@ void func_80B32644(EnZoraegg* this, GlobalContext* globalCtx) { } } -void func_80B326F4(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B326F4(EnZoraegg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCmd) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)]->action == 3)) { + if (Cutscene_CheckActorAction(play, this->actorActionCmd) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 3)) { Animation_Change(&this->skelAnime, &object_zoraegg_Anim_004D20, 1.0f, 0.0f, Animation_GetLastFrame(&object_zoraegg_Anim_004D20), 2, 5.0f); this->unk_1E8 = 0; @@ -485,15 +481,14 @@ void func_80B326F4(EnZoraegg* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (Animation_OnFrame(&this->skelAnime, 4.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); } } -void func_80B32820(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32820(EnZoraegg* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_1E8 >= 2) { this->actionFunc = func_80B326F4; @@ -509,15 +504,14 @@ void func_80B32820(EnZoraegg* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_0); } } -void func_80B32928(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32928(EnZoraegg* this, PlayState* play) { if (this->unk_1E8 < 112) { this->unk_1E8++; } @@ -536,16 +530,15 @@ void func_80B32928(EnZoraegg* this, GlobalContext* globalCtx) { if (this->unk_1E8 < 112) { if ((this->unk_1E8 >= 69) && (this->unk_1E8 < 72)) { - func_80B31D64(this, globalCtx, 0, 0.0f); - func_80B31D64(this, globalCtx, 0, 0.0f); - func_80B31D64(this, globalCtx, 0, 0.0f); + func_80B31D64(this, play, 0, 0.0f); + func_80B31D64(this, play, 0, 0.0f); + func_80B31D64(this, play, 0, 0.0f); } else { - func_80B31D64(this, globalCtx, 0xD, 0.0f); + func_80B31D64(this, play, 0xD, 0.0f); } } - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, - Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (Animation_OnFrame(&this->skelAnime, 97.0f) || Animation_OnFrame(&this->skelAnime, 101.0f) || Animation_OnFrame(&this->skelAnime, 105.0f)) { @@ -553,49 +546,49 @@ void func_80B32928(EnZoraegg* this, GlobalContext* globalCtx) { } } -void func_80B32A88(EnZoraegg* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, this->actorActionCmd) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, this->actorActionCmd)]->action == 2)) { +void func_80B32A88(EnZoraegg* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, this->actorActionCmd) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 2)) { this->unk_1E8 = 0; this->actionFunc = func_80B32928; } - func_80B31D64(this, globalCtx, 13, 0.0f); + func_80B31D64(this, play, 13, 0.0f); } -void func_80B32B10(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32B10(EnZoraegg* this, PlayState* play) { if (gSaveContext.eventInf[3] & 8) { this->actionFunc = func_80B32A88; } } -void func_80B32B3C(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32B3C(EnZoraegg* this, PlayState* play) { if (gSaveContext.eventInf[3] & 8) { this->actionFunc = func_80B32A88; this->actor.draw = EnZoraegg_Draw; } } -void func_80B32B70(EnZoraegg* this, GlobalContext* globalCtx) { - func_80B31C40(this, globalCtx); - if (Cutscene_CheckActorAction(globalCtx, 0x1C9)) { +void func_80B32B70(EnZoraegg* this, PlayState* play) { + func_80B31C40(this, play); + if (Cutscene_CheckActorAction(play, 0x1C9)) { Actor_MarkForDeath(&this->actor); } } -void func_80B32BB8(EnZoraegg* this, GlobalContext* globalCtx) { - func_80B31C40(this, globalCtx); - func_80B31D64(this, globalCtx, 13, 0.0f); +void func_80B32BB8(EnZoraegg* this, PlayState* play) { + func_80B31C40(this, play); + func_80B31D64(this, play, 13, 0.0f); if (this->actor.bgCheckFlags & 0x1) { this->actionFunc = func_80B32B70; } - if (Cutscene_CheckActorAction(globalCtx, 0x1C9)) { + if (Cutscene_CheckActorAction(play, 0x1C9)) { Actor_MarkForDeath(&this->actor); } } -void func_80B32C34(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32C34(EnZoraegg* this, PlayState* play) { WaterBox* sp34; f32 sp30; s32 pad; @@ -605,18 +598,17 @@ void func_80B32C34(EnZoraegg* this, GlobalContext* globalCtx) { this->actor.focus.pos.y += 10.0f; sp30 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, - &sp34)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp34)) { if ((this->actor.world.pos.y + 50.0f) < sp30) { this->actionFunc = func_80B32BB8; } - func_80B31D64(this, globalCtx, 0, -20.0f); - func_80B31D64(this, globalCtx, 0, -20.0f); + func_80B31D64(this, play, 0, -20.0f); + func_80B31D64(this, play, 0, -20.0f); } } -void func_80B32D08(EnZoraegg* this, GlobalContext* globalCtx) { +void func_80B32D08(EnZoraegg* this, PlayState* play) { WaterBox* sp44; f32 sp40; Vec3f sp34; @@ -627,15 +619,14 @@ void func_80B32D08(EnZoraegg* this, GlobalContext* globalCtx) { this->actor.focus.pos.y += 10.0f; sp40 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, - &sp44)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, &sp44)) { if (this->actor.world.pos.y < sp40) { sp34.x = this->actor.world.pos.x; sp34.y = sp40; sp34.z = this->actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp34, 150, 500, 0); - EffectSsGSplash_Spawn(globalCtx, &sp34, NULL, NULL, 0, 200); + EffectSsGRipple_Spawn(play, &sp34, 150, 500, 0); + EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 200); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); this->actionFunc = func_80B32C34; @@ -654,10 +645,10 @@ void func_80B32D08(EnZoraegg* this, GlobalContext* globalCtx) { } } -void EnZoraegg_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZoraegg_Update(Actor* thisx, PlayState* play) { EnZoraegg* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (DECR(this->unk_1F4) == 0) { this->unk_1F4 = Rand_S16Offset(60, 60); @@ -669,7 +660,7 @@ void EnZoraegg_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B32F04(Actor* thisx, GlobalContext* globalCtx) { +void func_80B32F04(Actor* thisx, PlayState* play) { f32 sp7C; f32 sp78; f32 sp74; @@ -684,7 +675,7 @@ void func_80B32F04(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); - sp4C = GET_ACTIVE_CAM(globalCtx)->eye; + sp4C = GET_ACTIVE_CAM(play)->eye; sp62 = Math_Vec3f_Yaw(&sp4C, &this->actor.focus.pos); sp60 = -Math_Vec3f_Pitch(&sp4C, &this->actor.focus.pos); @@ -696,13 +687,13 @@ void func_80B32F04(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(this->actor.world.pos.x + sp74, this->actor.world.pos.y + sp78 + 6.0f, temp_f2 = this->actor.world.pos.z + sp7C, MTXMODE_NEW); - sp7C = Math_SinS(globalCtx->gameplayFrames * 0x4000); + sp7C = Math_SinS(play->gameplayFrames * 0x4000); Matrix_Scale(this->actor.scale.x * (((sp7C + 1.0f) * 0.1f) + 9.0f), this->actor.scale.y * (((sp7C + 1.0f) * 0.1f) + 9.0f), this->actor.scale.z * (((sp7C + 1.0f) * 0.1f) + 9.0f), MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_XLU_DISP; gfx = func_8012C868(gfx); @@ -711,35 +702,35 @@ void func_80B32F04(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); gDPSetPrimColor(gfx++, 0, 0, 120, 180, 200, (s32)(this->unk_1ED * (20.0f / 51))); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); POLY_XLU_DISP = gfx; Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B331C8(Actor* thisx, GlobalContext* globalCtx) { +void func_80B331C8(Actor* thisx, PlayState* play) { EnZoraegg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Push(); Matrix_Scale(this->unk_1E0, this->unk_1E0, this->unk_1E0, MTXMODE_APPLY); if (this->unk_1ED >= 254) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); gSPDisplayList(POLY_OPA_DISP++, object_zoraegg_DL_005250); } else { func_8012C304(POLY_XLU_DISP++); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_1ED); gSPDisplayList(POLY_XLU_DISP++, object_zoraegg_DL_005250); @@ -747,13 +738,12 @@ void func_80B331C8(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); - func_80B32F04(thisx, globalCtx); + func_80B32F04(thisx, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -s32 EnZoraegg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - Actor* thisx) { +s32 EnZoraegg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnZoraegg* this = THIS; switch (this->unk_1EC) { @@ -772,21 +762,21 @@ s32 EnZoraegg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL return false; } -void func_80B333DC(GlobalContext* globalCtx, Gfx** dList, f32 arg2) { +void func_80B333DC(PlayState* play, Gfx** dList, f32 arg2) { Matrix_Push(); Matrix_Scale(arg2, arg2, arg2, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnZoraegg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnZoraegg* this = THIS; f32 temp_f20; f32 temp_f2; @@ -799,13 +789,13 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_Push(); Matrix_Scale(temp_f20, temp_f20, temp_f20, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); break; case 4: @@ -815,7 +805,7 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList case 5: case 6: temp_f20 = this->unk_1EF * 0.01f; - func_80B333DC(globalCtx, dList, temp_f20); + func_80B333DC(play, dList, temp_f20); break; } break; @@ -827,13 +817,13 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList Matrix_Push(); Matrix_Scale(1.0f, temp_f20, temp_f20, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); break; case 4: @@ -841,13 +831,13 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList temp_f20 = (this->unk_1EE * 0.0035f) + 0.65f; Matrix_Scale(1.0f, temp_f20 * temp_f2, temp_f2, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_Pop(); break; @@ -855,7 +845,7 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList case 5: case 6: temp_f20 = this->unk_1EE * 0.01f; - func_80B333DC(globalCtx, dList, temp_f20); + func_80B333DC(play, dList, temp_f20); break; } break; @@ -864,29 +854,29 @@ void EnZoraegg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList TexturePtr D_80B33950[] = { object_zoraegg_Tex_003430, object_zoraegg_Tex_004430, object_zoraegg_Tex_004830 }; -void func_80B33818(Actor* thisx, GlobalContext* globalCtx) { +void func_80B33818(Actor* thisx, PlayState* play) { EnZoraegg* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B33950[this->unk_1F2])); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnZoraegg_OverrideLimbDraw, EnZoraegg_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EnZoraegg_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZoraegg_Draw(Actor* thisx, PlayState* play) { EnZoraegg* this = THIS; if (this->unk_1ED > 0) { - func_80B331C8(thisx, globalCtx); + func_80B331C8(thisx, play); } if (this->unk_1ED != 255) { - func_80B33818(thisx, globalCtx); + func_80B33818(thisx, play); } } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h index fb65579fa6..e5e638a222 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h @@ -5,7 +5,7 @@ struct EnZoraegg; -typedef void (*EnZoraeggActionFunc)(struct EnZoraegg*, GlobalContext*); +typedef void (*EnZoraeggActionFunc)(struct EnZoraegg*, PlayState*); #define ENZORAEGG_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENZORAEGG_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 0f299f2550..ffb3dee88c 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -11,28 +11,28 @@ #define THIS ((EnZos*)thisx) -void EnZos_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZos_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZos_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZos_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZos_Init(Actor* thisx, PlayState* play); +void EnZos_Destroy(Actor* thisx, PlayState* play); +void EnZos_Update(Actor* thisx, PlayState* play); +void EnZos_Draw(Actor* thisx, PlayState* play); void func_80BBAE84(EnZos* this, s16 arg1, u8 arg2); -void func_80BBB2C4(EnZos* this, GlobalContext* globalCtx); -void func_80BBB354(EnZos* this, GlobalContext* globalCtx); -void func_80BBB4CC(EnZos* this, GlobalContext* globalCtx); -void func_80BBB574(EnZos* this, GlobalContext* globalCtx); -void func_80BBB718(EnZos* this, GlobalContext* globalCtx); -void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx); -void func_80BBBB84(EnZos* this, GlobalContext* globalCtx); -void func_80BBBCBC(EnZos* this, GlobalContext* globalCtx); -void func_80BBBD5C(EnZos* this, GlobalContext* globalCtx); -void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx); -void func_80BBC070(EnZos* this, GlobalContext* globalCtx); -void func_80BBC14C(EnZos* this, GlobalContext* globalCtx); -void func_80BBC22C(EnZos* this, GlobalContext* globalCtx); -void func_80BBC24C(EnZos* this, GlobalContext* globalCtx); -void func_80BBC298(EnZos* this, GlobalContext* globalCtx); -void func_80BBC37C(EnZos* this, GlobalContext* globalCtx); +void func_80BBB2C4(EnZos* this, PlayState* play); +void func_80BBB354(EnZos* this, PlayState* play); +void func_80BBB4CC(EnZos* this, PlayState* play); +void func_80BBB574(EnZos* this, PlayState* play); +void func_80BBB718(EnZos* this, PlayState* play); +void func_80BBB8AC(EnZos* this, PlayState* play); +void func_80BBBB84(EnZos* this, PlayState* play); +void func_80BBBCBC(EnZos* this, PlayState* play); +void func_80BBBD5C(EnZos* this, PlayState* play); +void func_80BBBDE0(EnZos* this, PlayState* play); +void func_80BBC070(EnZos* this, PlayState* play); +void func_80BBC14C(EnZos* this, PlayState* play); +void func_80BBC22C(EnZos* this, PlayState* play); +void func_80BBC24C(EnZos* this, PlayState* play); +void func_80BBC298(EnZos* this, PlayState* play); +void func_80BBC37C(EnZos* this, PlayState* play); const ActorInit En_Zos_InitVars = { ACTOR_EN_ZOS, @@ -66,17 +66,17 @@ static ColliderCylinderInit sCylinderInit = { { 60, 40, 0, { 0, 0, 0 } }, }; -void EnZos_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZos_Init(Actor* thisx, PlayState* play) { EnZos* this = THIS; Actor_SetScale(&this->actor, 0.0115f); this->actionFunc = func_80BBBDE0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zos_Skel_015238, &object_zos_Anim_00A164, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &object_zos_Skel_015238, &object_zos_Anim_00A164, this->jointTable, this->morphTable, 18); Animation_PlayLoop(&this->skelAnime, &object_zos_Anim_00A164); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_2B6 = 0; this->actor.terminalVelocity = -4.0f; this->actor.gravity = -4.0f; @@ -112,7 +112,7 @@ void EnZos_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZos_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZos_Destroy(Actor* thisx, PlayState* play) { EnZos* this = THIS; gSaveContext.save.weekEventReg[52] &= (u8)~0x10; @@ -139,8 +139,8 @@ void func_80BBAE84(EnZos* this, s16 arg1, u8 arg2) { } } -s32 func_80BBAF5C(EnZos* this, GlobalContext* globalCtx) { - if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && +s32 func_80BBAF5C(EnZos* this, PlayState* play) { + if (Player_IsFacingActor(&this->actor, 0x3000, play) && ((!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.home.rot.y == this->actor.shape.rot.y)) || (Actor_IsFacingPlayer(&this->actor, 0x3000) && (this->actor.home.rot.y != this->actor.shape.rot.y))) && (this->actor.xzDistToPlayer < 100.0f)) { @@ -149,7 +149,7 @@ s32 func_80BBAF5C(EnZos* this, GlobalContext* globalCtx) { return false; } -s32 func_80BBAFFC(EnZos* this, GlobalContext* globalCtx) { +s32 func_80BBAFFC(EnZos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { switch ((s16)Rand_ZeroFloat(4.0f)) { case 0: @@ -173,7 +173,7 @@ s32 func_80BBAFFC(EnZos* this, GlobalContext* globalCtx) { return false; } -void func_80BBB0D4(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB0D4(EnZos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroFloat(1.0f) < 0.9f) { func_80BBAE84(this, 0, 2); @@ -184,7 +184,7 @@ void func_80BBB0D4(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBB15C(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB15C(EnZos* this, PlayState* play) { s32 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -218,43 +218,43 @@ void func_80BBB15C(EnZos* this, GlobalContext* globalCtx) { this->unk_2B6 |= 0x10; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80BBB2C4(EnZos* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - Message_StartTextbox(globalCtx, 0x124F, &this->actor); +void func_80BBB2C4(EnZos* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x124F, &this->actor); this->actionFunc = func_80BBB8AC; this->actor.flags &= ~ACTOR_FLAG_10000; } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } } -void func_80BBB354(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB354(EnZos* this, PlayState* play) { s32 item; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80BBB2C4; gSaveContext.save.weekEventReg[39] |= 0x20; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } else { if (gSaveContext.save.weekEventReg[39] & 0x20) { item = GI_RUPEE_PURPLE; } else { item = GI_HEART_PIECE; } - Actor_PickUp(&this->actor, globalCtx, item, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, item, 10000.0f, 50.0f); } } -void func_80BBB414(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB414(EnZos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(globalCtx, 501)) { - s16 action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 501)]->action; + if (Cutscene_CheckActorAction(play, 501)) { + s16 action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 501)]->action; if (action != this->unk_2BA) { this->unk_2BA = action; @@ -272,8 +272,8 @@ void func_80BBB414(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBB4CC(EnZos* this, GlobalContext* globalCtx) { - func_80BBB414(this, globalCtx); +void func_80BBB4CC(EnZos* this, PlayState* play) { + func_80BBB414(this, play); if ((this->actor.cutscene != -1) && (ActorCutscene_GetCurrentIndex() != this->actor.cutscene)) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -288,32 +288,32 @@ void func_80BBB4CC(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBB574(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB574(EnZos* this, PlayState* play) { if (!(this->unk_2B6 & 0x10)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; } - if (func_80BBAFFC(this, globalCtx)) { + if (func_80BBAFFC(this, play)) { if (this->unk_2B6 & 0x20) { this->unk_2B6 &= ~0x20; - func_80151938(globalCtx, 0x124C); + func_80151938(play, 0x124C); } } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x124B: if (this->unk_2B8 == 9) { - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->unk_2B6 |= 0x20; } else { - func_80151938(globalCtx, 0x124C); + func_80151938(play, 0x124C); } break; case 0x124C: - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; this->actionFunc = func_80BBB4CC; func_80BBAE84(this, 10, 0); break; @@ -321,28 +321,28 @@ void func_80BBB574(EnZos* this, GlobalContext* globalCtx) { case 0x124D: this->unk_2B6 &= ~0x10; func_80BBAE84(this, 6, 0); - func_80151938(globalCtx, 0x124E); + func_80151938(play, 0x124E); break; case 0x124E: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BBB354; - func_80BBB354(this, globalCtx); + func_80BBB354(this, play); break; } } } -void func_80BBB718(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB718(EnZos* this, PlayState* play) { s32 sp24; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&globalCtx->msgCtx) == 0x10) { - sp24 = func_80123810(globalCtx); + if (Message_GetState(&play->msgCtx) == 0x10) { + sp24 = func_80123810(play); if (sp24 > 0) { - func_801477B4(globalCtx); + func_801477B4(play); if (sp24 == 25) { player->actor.textId = 0x1232; @@ -360,9 +360,9 @@ void func_80BBB718(EnZos* this, GlobalContext* globalCtx) { this->actionFunc = func_80BBB8AC; } else if (sp24 < 0) { if (gSaveContext.save.weekEventReg[39] & 8) { - func_80151938(globalCtx, 0x1241); + func_80151938(play, 0x1241); } else { - func_80151938(globalCtx, 0x1237); + func_80151938(play, 0x1237); gSaveContext.save.weekEventReg[39] |= 8; func_80BBAE84(this, 4, 0); this->unk_2B6 |= 4; @@ -372,9 +372,9 @@ void func_80BBB718(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { +void func_80BBB8AC(EnZos* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); @@ -386,8 +386,8 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { } } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1237: player->exchangeItemId = 0; @@ -397,13 +397,13 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { case 0x123C: case 0x123E: case 0x123F: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1244: this->unk_2B6 &= ~0x10; func_80BBAE84(this, 6, 0); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1232: @@ -413,29 +413,29 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { case 0x1239: case 0x1246: func_80BBAE84(this, 6, 0); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1233: func_80BBAE84(this, 5, 0); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1245: case 0x1248: func_80BBAE84(this, 3, 0); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1231: - func_80151938(globalCtx, 0xFF); + func_80151938(play, 0xFF); this->actionFunc = func_80BBB718; break; case 0x1243: case 0x1249: func_80BBAE84(this, 2, 0); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; @@ -444,22 +444,22 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { case 0x123D: case 0x1242: func_80BBAE84(this, 2, 0); - Actor_ProcessTalkRequest(&this->actor, &globalCtx->state); - func_801477B4(globalCtx); + Actor_ProcessTalkRequest(&this->actor, &play->state); + func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; case 0x1236: func_80BBAE84(this, 2, 0); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; default: if (0) {} - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; @@ -467,51 +467,51 @@ void func_80BBB8AC(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBBB84(EnZos* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BBBB84(EnZos* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - Message_StartTextbox(globalCtx, 0x1248, &this->actor); + Message_StartTextbox(play, 0x1248, &this->actor); this->actionFunc = func_80BBB8AC; func_80BBAE84(this, 6, 0); this->unk_2B6 |= 2; } else if (gSaveContext.save.weekEventReg[41] & 0x10) { - Message_StartTextbox(globalCtx, 0x124A, &this->actor); + Message_StartTextbox(play, 0x124A, &this->actor); this->actionFunc = func_80BBB8AC; func_80BBAE84(this, 6, 0); } else { gSaveContext.save.weekEventReg[41] |= 0x10; - Message_StartTextbox(globalCtx, 0x124B, &this->actor); + Message_StartTextbox(play, 0x124B, &this->actor); this->actionFunc = func_80BBB574; func_80BBAE84(this, 9, 2); this->unk_2B6 |= 0x10; } } else { - func_800B8614(&this->actor, globalCtx, 300.0f); + func_800B8614(&this->actor, play, 300.0f); } } -void func_80BBBCBC(EnZos* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BBBCBC(EnZos* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80BBAE84(this, 5, 0); - Message_StartTextbox(globalCtx, 0x124D, &this->actor); + Message_StartTextbox(play, 0x124D, &this->actor); this->actionFunc = func_80BBB574; } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } } -void func_80BBBD5C(EnZos* this, GlobalContext* globalCtx) { - func_80BBB414(this, globalCtx); - if (!Cutscene_CheckActorAction(globalCtx, 0x1F5)) { +void func_80BBBD5C(EnZos* this, PlayState* play) { + func_80BBB414(this, play); + if (!Cutscene_CheckActorAction(play, 0x1F5)) { this->actionFunc = func_80BBBCBC; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } } -void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx) { +void func_80BBBDE0(EnZos* this, PlayState* play) { Actor* thisx = &this->actor; Vec3f sp28; @@ -524,23 +524,23 @@ void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx) { } } - func_80BBB0D4(this, globalCtx); + func_80BBB0D4(this, play); - if (globalCtx->msgCtx.ocarinaMode == 0x2A) { - globalCtx->msgCtx.ocarinaMode = 4; + if (play->msgCtx.ocarinaMode == 0x2A) { + play->msgCtx.ocarinaMode = 4; this->actionFunc = func_80BBBB84; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); return; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BBB8AC; - func_80BBB15C(this, globalCtx); - } else if (Cutscene_CheckActorAction(globalCtx, 0x1F5)) { + func_80BBB15C(this, play); + } else if (Cutscene_CheckActorAction(play, 0x1F5)) { this->actionFunc = func_80BBBD5C; - } else if (func_80BBAF5C(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + } else if (func_80BBAF5C(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } if (!Actor_IsFacingPlayer(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 100.0f)) { @@ -555,7 +555,7 @@ void func_80BBBDE0(EnZos* this, GlobalContext* globalCtx) { func_801A1FB4(3, &sp28, 110, 1000.0f); } -void func_80BBBFBC(EnZos* this, GlobalContext* globalCtx) { +void func_80BBBFBC(EnZos* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -572,19 +572,19 @@ void func_80BBBFBC(EnZos* this, GlobalContext* globalCtx) { textId = 0x1258; func_80BBAE84(this, 6, 0); } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80BBC070(EnZos* this, GlobalContext* globalCtx) { +void func_80BBC070(EnZos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80BBAE84(this, 2, 0); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BBC14C; this->unk_2B6 |= 1; } @@ -598,7 +598,7 @@ void func_80BBC070(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBC14C(EnZos* this, GlobalContext* globalCtx) { +void func_80BBC14C(EnZos* this, PlayState* play) { Actor* thisx = &this->actor; if (this->unk_2B6 & 1) { @@ -610,30 +610,30 @@ void func_80BBC14C(EnZos* this, GlobalContext* globalCtx) { } } - func_80BBB0D4(this, globalCtx); + func_80BBB0D4(this, play); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BBC070; - func_80BBBFBC(this, globalCtx); - } else if (func_80BBAF5C(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_80BBBFBC(this, play); + } else if (func_80BBAF5C(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80BBC22C(EnZos* this, GlobalContext* globalCtx) { - func_80BBAFFC(this, globalCtx); +void func_80BBC22C(EnZos* this, PlayState* play) { + func_80BBAFFC(this, play); } -void func_80BBC24C(EnZos* this, GlobalContext* globalCtx) { - func_80BBB0D4(this, globalCtx); +void func_80BBC24C(EnZos* this, PlayState* play) { + func_80BBB0D4(this, play); if (gSaveContext.save.weekEventReg[79] & 1) { this->actionFunc = func_80BBC22C; func_80BBAE84(this, 7, 2); } } -void func_80BBC298(EnZos* this, GlobalContext* globalCtx) { - func_80BBAFFC(this, globalCtx); +void func_80BBC298(EnZos* this, PlayState* play) { + func_80BBAFFC(this, play); if (this->unk_2BC < 799) { this->unk_2BC += 200; @@ -645,8 +645,8 @@ void func_80BBC298(EnZos* this, GlobalContext* globalCtx) { this->unk_2BC = 999; } - if (Cutscene_CheckActorAction(globalCtx, 515)) { - if (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 515)]->action == 1) { + if (Cutscene_CheckActorAction(play, 515)) { + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 1) { this->actionFunc = func_80BBC37C; this->unk_2BC = -1; } @@ -656,24 +656,24 @@ void func_80BBC298(EnZos* this, GlobalContext* globalCtx) { } } -void func_80BBC37C(EnZos* this, GlobalContext* globalCtx) { - func_80BBAFFC(this, globalCtx); - if (Cutscene_CheckActorAction(globalCtx, 515) && - (globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 515)]->action == 3)) { +void func_80BBC37C(EnZos* this, PlayState* play) { + func_80BBAFFC(this, play); + if (Cutscene_CheckActorAction(play, 515) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 3)) { this->actionFunc = func_80BBC298; } } -void EnZos_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZos_Update(Actor* thisx, PlayState* play) { s32 pad; EnZos* this = THIS; Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 30.0f, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, 4); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (DECR(this->unk_2AE) == 0) { this->unk_2AE = Rand_S16Offset(60, 60); @@ -685,11 +685,11 @@ void EnZos_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 func_80BBC4E4(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 func_80BBC4E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { return false; } -void func_80BBC500(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80BBC500(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80BBC750 = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 9) { @@ -697,7 +697,7 @@ void func_80BBC500(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } } -void EnZos_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZos_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80BBC75C[] = { object_zos_Tex_010918, object_zos_Tex_011118, @@ -706,9 +706,9 @@ void EnZos_Draw(Actor* thisx, GlobalContext* globalCtx) { EnZos* this = THIS; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_2B6 & 0x40) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 0, 0, 0, 0, this->unk_2BC, 1000); @@ -722,7 +722,7 @@ void EnZos_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateYS(this->actor.home.rot.y - this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -974.4f, MTXMODE_APPLY); - gSPMatrix(&gfx[1], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[2], object_zos_DL_0136E0); gSPDisplayList(&gfx[3], object_zos_DL_013088); @@ -730,12 +730,12 @@ void EnZos_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80BBC4E4, func_80BBC500, &this->actor); if (this->unk_2B6 & 0x40) { - POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.h b/src/overlays/actors/ovl_En_Zos/z_en_zos.h index 991f08d578..92dc2c062f 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.h +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.h @@ -5,7 +5,7 @@ struct EnZos; -typedef void (*EnZosActionFunc)(struct EnZos*, GlobalContext*); +typedef void (*EnZosActionFunc)(struct EnZos*, PlayState*); #define ENZOS_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index ca197eb121..4aff29b1a0 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -11,25 +11,25 @@ #define THIS ((EnZot*)thisx) -void EnZot_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZot_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZot_Init(Actor* thisx, PlayState* play); +void EnZot_Destroy(Actor* thisx, PlayState* play); +void EnZot_Update(Actor* thisx, PlayState* play); +void EnZot_Draw(Actor* thisx, PlayState* play); void func_80B96BEC(EnZot* this, s16 arg1, u8 arg2); -void func_80B97100(EnZot* this, GlobalContext* globalCtx); -void func_80B97240(EnZot* this, GlobalContext* globalCtx); -void func_80B97708(EnZot* this, GlobalContext* globalCtx); -void func_80B97B5C(EnZot* this, GlobalContext* globalCtx); -void func_80B97CC8(EnZot* this, GlobalContext* globalCtx); -void func_80B97FD0(EnZot* this, GlobalContext* globalCtx); -void func_80B980FC(EnZot* this, GlobalContext* globalCtx); -void func_80B98728(EnZot* this, GlobalContext* globalCtx); -void func_80B98998(EnZot* this, GlobalContext* globalCtx); -void func_80B98CA8(EnZot* this, GlobalContext* globalCtx); -void func_80B990A4(EnZot* this, GlobalContext* globalCtx); -void func_80B992C0(EnZot* this, GlobalContext* globalCtx); -void func_80B99384(EnZot* this, GlobalContext* globalCtx); +void func_80B97100(EnZot* this, PlayState* play); +void func_80B97240(EnZot* this, PlayState* play); +void func_80B97708(EnZot* this, PlayState* play); +void func_80B97B5C(EnZot* this, PlayState* play); +void func_80B97CC8(EnZot* this, PlayState* play); +void func_80B97FD0(EnZot* this, PlayState* play); +void func_80B980FC(EnZot* this, PlayState* play); +void func_80B98728(EnZot* this, PlayState* play); +void func_80B98998(EnZot* this, PlayState* play); +void func_80B98CA8(EnZot* this, PlayState* play); +void func_80B990A4(EnZot* this, PlayState* play); +void func_80B992C0(EnZot* this, PlayState* play); +void func_80B99384(EnZot* this, PlayState* play); const ActorInit En_Zot_InitVars = { ACTOR_EN_ZOT, @@ -63,7 +63,7 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -void func_80B965D0(EnZot* this, GlobalContext* globalCtx) { +void func_80B965D0(EnZot* this, PlayState* play) { s32 i; if ((this->path != NULL) && (this->path->count >= 5)) { @@ -71,25 +71,25 @@ void func_80B965D0(EnZot* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->unk_2D8); i++, points++) { if (this->unk_2D8[i] == NULL) { - this->unk_2D8[i] = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_TSUBO, points->x, points->y, - points->z, 0, 0, 0, 0x13F); + this->unk_2D8[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_TSUBO, points->x, points->y, points->z, + 0, 0, 0, 0x13F); } } } } -void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void EnZot_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnZot* this = THIS; s32 i; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80B97100; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); Animation_PlayLoop(&this->skelAnime, &gZoraStandAnim); this->unk_2F0 = 0; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_2F2 = 0; this->unk_2F4 = 0; @@ -111,9 +111,9 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2D8[i] = NULL; } if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &globalCtx->setupPathList[ENZOT_GET_FC00(&this->actor)]; + this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; this->unk_2D4 = 0; - func_80B965D0(this, globalCtx); + func_80B965D0(this, play); } else { this->path = NULL; } @@ -124,7 +124,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { case 4: this->actionFunc = func_80B97B5C; if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &globalCtx->setupPathList[ENZOT_GET_FC00(&this->actor)]; + this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; } else { this->path = NULL; } @@ -134,7 +134,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { this->unk_2F2 |= 4; this->actionFunc = func_80B97FD0; if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &globalCtx->setupPathList[ENZOT_GET_FC00(&this->actor)]; + this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; } else { this->path = NULL; } @@ -167,7 +167,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc = func_80B992C0; func_80B96BEC(this, 1, 0); if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &globalCtx->setupPathList[ENZOT_GET_FC00(&this->actor)]; + this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; } else { this->path = NULL; } @@ -211,7 +211,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { case 22: this->actionFunc = func_80B980FC; if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &globalCtx->setupPathList[ENZOT_GET_FC00(&this->actor)]; + this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; } else { this->path = NULL; } @@ -224,10 +224,10 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { } } -void EnZot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZot_Destroy(Actor* thisx, PlayState* play) { EnZot* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (ENZOT_GET_1F(&this->actor) == 8) { gSaveContext.save.weekEventReg[41] &= (u8)~0x20; } @@ -274,8 +274,8 @@ void func_80B96D4C(EnZot* this) { } } -s32 func_80B96DF0(EnZot* this, GlobalContext* globalCtx) { - if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x3000) && +s32 func_80B96DF0(EnZot* this, PlayState* play) { + if (Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000) && (this->actor.xzDistToPlayer < 100.0f)) { return true; } @@ -353,10 +353,10 @@ s32 func_80B96FB0(EnZot* this) { return false; } -void func_80B97100(EnZot* this, GlobalContext* globalCtx) { +void func_80B97100(EnZot* this, PlayState* play) { } -void func_80B97110(EnZot* this, GlobalContext* globalCtx) { +void func_80B97110(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -374,39 +374,39 @@ void func_80B97110(EnZot* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[28] |= 0x40; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B97194(EnZot* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { +void func_80B97194(EnZot* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x125C: case 0x125F: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x125D: case 0x125E: case 0x1260: case 0x1261: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B97240; break; } } } -void func_80B97240(EnZot* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B97240(EnZot* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B97194; - func_80B97110(this, globalCtx); - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && + func_80B97110(this, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B972E8(EnZot* this, GlobalContext* globalCtx) { +void func_80B972E8(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.weekEventReg[29] & 0x10) { @@ -440,50 +440,50 @@ void func_80B972E8(EnZot* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[29] |= 8; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B973BC(EnZot* this, GlobalContext* globalCtx) { +void func_80B973BC(EnZot* this, PlayState* play) { func_80B96D4C(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x126E: case 0x1270: case 0x1273: case 0x1274: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1272: - func_80151938(globalCtx, 0x126F); + func_80151938(play, 0x126F); break; case 0x126F: func_801159EC(90); - func_80151938(globalCtx, 0x1270); + func_80151938(play, 0x1270); break; case 0x1275: if (gSaveContext.save.playerData.rupees < 10) { - func_80151938(globalCtx, 0x1277); + func_80151938(play, 0x1277); } else { - func_80151938(globalCtx, 0x1278); + func_80151938(play, 0x1278); func_801159EC(-10); } break; case 0x1276: - func_80151938(globalCtx, 0x1275); + func_80151938(play, 0x1275); break; case 0x1271: case 0x1277: case 0x1278: case 0x1279: - func_801477B4(globalCtx); - func_80B965D0(this, globalCtx); + func_801477B4(play); + func_80B965D0(this, play); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.textId = 0; this->actionFunc = func_80B97708; @@ -510,45 +510,45 @@ void func_80B973BC(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B975F8(EnZot* this, GlobalContext* globalCtx) { +void func_80B975F8(EnZot* this, PlayState* play) { func_80B96D4C(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B973BC; } else { - func_800B8500(&this->actor, globalCtx, 10000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 10000.0f, 1000.0f, EXCH_ITEM_NONE); } } -void func_80B9765C(EnZot* this, GlobalContext* globalCtx) { +void func_80B9765C(EnZot* this, PlayState* play) { func_80B96D4C(this); - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { s32 requiredScopeTemp; - switch (globalCtx->msgCtx.currentTextId) { + switch (play->msgCtx.currentTextId) { case 0x1262: case 0x1267: case 0x126A: case 0x126B: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B97708; break; } } } -void func_80B97708(EnZot* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B97708(EnZot* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_v1; func_80B96D4C(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x400, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B9765C; - func_80B972E8(this, globalCtx); + func_80B972E8(this, play); return; } @@ -573,14 +573,14 @@ void func_80B97708(EnZot* this, GlobalContext* globalCtx) { this->actor.textId = 0x1276; } this->unk_2F2 |= 1; - func_80B975F8(this, globalCtx); + func_80B975F8(this, play); this->actionFunc = func_80B975F8; - } else if (func_80B96DF0(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + } else if (func_80B96DF0(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B9787C(EnZot* this, GlobalContext* globalCtx) { +void func_80B9787C(EnZot* this, PlayState* play) { u16 textId; if (this->actor.textId == 0) { @@ -643,11 +643,11 @@ void func_80B9787C(EnZot* this, GlobalContext* globalCtx) { break; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } } -void func_80B979DC(EnZot* this, GlobalContext* globalCtx) { +void func_80B979DC(EnZot* this, PlayState* play) { if (func_80B96E5C(this)) { this->actionFunc = func_80B97B5C; func_80B96BEC(this, 0, 0); @@ -657,16 +657,16 @@ void func_80B979DC(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B97A44(EnZot* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { +void func_80B97A44(EnZot* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1279: case 0x127C: case 0x127F: case 0x1282: case 0x1285: case 0x1288: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x127D: @@ -675,7 +675,7 @@ void func_80B97A44(EnZot* this, GlobalContext* globalCtx) { case 0x1284: case 0x1289: case 0x128A: - func_801477B4(globalCtx); + func_801477B4(play); if (!(this->unk_2F2 & 2)) { this->unk_2F2 |= 2; this->actionFunc = func_80B979DC; @@ -686,25 +686,25 @@ void func_80B97A44(EnZot* this, GlobalContext* globalCtx) { break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B97B5C; break; } } } -void func_80B97B5C(EnZot* this, GlobalContext* globalCtx) { +void func_80B97B5C(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x400, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B97A44; - func_80B9787C(this, globalCtx); - } else if (func_80B96DF0(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_80B9787C(this, play); + } else if (func_80B96DF0(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B97BF8(EnZot* this, GlobalContext* globalCtx) { +void func_80B97BF8(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -712,28 +712,28 @@ void func_80B97BF8(EnZot* this, GlobalContext* globalCtx) { } else { textId = 0x128B; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B97C40(EnZot* this, GlobalContext* globalCtx) { +void func_80B97C40(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - func_801477B4(globalCtx); + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + func_801477B4(play); this->actionFunc = func_80B97CC8; } } -void func_80B97CC8(EnZot* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B97CC8(EnZot* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B97C40; - Message_StartTextbox(globalCtx, 0x128B, &this->actor); - } else if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + Message_StartTextbox(play, 0x128B, &this->actor); + } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B97D6C(EnZot* this, GlobalContext* globalCtx) { +void func_80B97D6C(EnZot* this, PlayState* play) { if (func_80B96E5C(this)) { this->actionFunc = func_80B97CC8; this->actor.speedXZ = 0.0f; @@ -747,14 +747,14 @@ void func_80B97D6C(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B97E0C(EnZot* this, GlobalContext* globalCtx) { +void func_80B97E0C(EnZot* this, PlayState* play) { if (this->unk_2F2 & 0x40) { this->actionFunc = func_80B97D6C; func_80B96BEC(this, 3, 0); } } -void func_80B97E4C(EnZot* this, GlobalContext* globalCtx) { +void func_80B97E4C(EnZot* this, PlayState* play) { if (1) { do { } while (0); } @@ -767,22 +767,22 @@ void func_80B97E4C(EnZot* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x128C: this->unk_2F2 &= ~4; func_80B96BEC(this, 6, 2); - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x128D: case 0x128E: case 0x128F: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1290: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B97D6C; this->unk_2F2 |= 4; func_80B96BEC(this, 3, 0); @@ -790,31 +790,31 @@ void func_80B97E4C(EnZot* this, GlobalContext* globalCtx) { break; case 0x128B: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B97FD0; break; } } } -void func_80B97FD0(EnZot* this, GlobalContext* globalCtx) { +void func_80B97FD0(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B97E4C; - func_80B97BF8(this, globalCtx); + func_80B97BF8(this, play); } else if (gSaveContext.save.weekEventReg[38] & 8) { if ((this->actor.xzDistToPlayer < 120.0f) && (gSaveContext.save.playerForm == PLAYER_FORM_ZORA)) { this->unk_2F2 |= 4; this->actionFunc = func_80B97E0C; func_80B96BEC(this, 6, 2); } - } else if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B980FC(EnZot* this, GlobalContext* globalCtx) { +void func_80B980FC(EnZot* this, PlayState* play) { if (this->actor.home.rot.x > 0) { this->actor.home.rot.x--; } else if (func_80B96E5C(this)) { @@ -828,7 +828,7 @@ void func_80B980FC(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B98178(EnZot* this, GlobalContext* globalCtx) { +void func_80B98178(EnZot* this, PlayState* play) { u16 textId; s32 phi_v0; @@ -859,7 +859,7 @@ void func_80B98178(EnZot* this, GlobalContext* globalCtx) { textId = 0x12A6; gSaveContext.save.weekEventReg[39] |= 4; } - } else if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { + } else if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { textId = 0x12A0; } else if (gSaveContext.save.weekEventReg[39] & 2) { textId = 0x12A5; @@ -895,10 +895,10 @@ void func_80B98178(EnZot* this, GlobalContext* globalCtx) { } break; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B98348(EnZot* this, GlobalContext* globalCtx) { +void func_80B98348(EnZot* this, PlayState* play) { s16 y; if (ENZOT_GET_1F(&this->actor) == 7) { @@ -921,41 +921,41 @@ void func_80B98348(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B9849C(EnZot* this, GlobalContext* globalCtx) { - func_80B98348(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B9849C(EnZot* this, PlayState* play) { + func_80B98348(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->unk_2D4 == 2) { - Message_StartTextbox(globalCtx, 0x12AD, &this->actor); + Message_StartTextbox(play, 0x12AD, &this->actor); } else { - Message_StartTextbox(globalCtx, 0x12B0, &this->actor); + Message_StartTextbox(play, 0x12B0, &this->actor); } this->actionFunc = func_80B98728; } else { - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); } } -void func_80B9854C(EnZot* this, GlobalContext* globalCtx) { - func_80B98348(this, globalCtx); - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B9854C(EnZot* this, PlayState* play) { + func_80B98348(this, play); + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B9849C; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, globalCtx, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); } else { - Actor_PickUp(&this->actor, globalCtx, this->unk_2D4, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, this->unk_2D4, 10000.0f, 50.0f); } } -void func_80B985EC(EnZot* this, GlobalContext* globalCtx) { +void func_80B985EC(EnZot* this, PlayState* play) { s32 itemActionParam; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); - func_80B98348(this, globalCtx); - if (Message_GetState(&globalCtx->msgCtx) == 0x10) { - itemActionParam = func_80123810(globalCtx); + func_80B98348(this, play); + if (Message_GetState(&play->msgCtx) == 0x10) { + itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { - func_801477B4(globalCtx); + func_801477B4(play); if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_UNK_19) && func_8013A4C4(4)) { if (func_8013A4C4(5) && func_8013A4C4(6)) { player->actor.textId = 0x12AE; @@ -968,35 +968,35 @@ void func_80B985EC(EnZot* this, GlobalContext* globalCtx) { } this->actionFunc = func_80B98728; } else if (itemActionParam < PLAYER_AP_NONE) { - func_80151938(globalCtx, 0x12AB); + func_80151938(play, 0x12AB); this->actionFunc = func_80B98728; } } } -void func_80B98728(EnZot* this, GlobalContext* globalCtx) { - func_80B98348(this, globalCtx); +void func_80B98728(EnZot* this, PlayState* play) { + func_80B98348(this, play); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 4: - if (Message_ShouldAdvance(globalCtx) && (globalCtx->msgCtx.currentTextId == 0x1293)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1293)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(globalCtx, 0x1294); + func_80151938(play, 0x1294); break; case 1: func_8019F230(); - func_80151938(globalCtx, 0x1298); + func_80151938(play, 0x1298); break; } } break; case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1291: case 0x1292: case 0x1296: @@ -1013,44 +1013,44 @@ void func_80B98728(EnZot* this, GlobalContext* globalCtx) { case 0x12A7: case 0x12A8: case 0x12AE: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x12A9: case 0x12AA: - func_80151938(globalCtx, 0xFF); + func_80151938(play, 0xFF); this->actionFunc = func_80B985EC; break; case 0x1294: if (CURRENT_DAY == 3) { - func_80151938(globalCtx, 0x1296); + func_80151938(play, 0x1296); } else { - func_80151938(globalCtx, 0x1295); + func_80151938(play, 0x1295); } break; case 0x12AB: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98998; break; case 0x12AC: - func_801477B4(globalCtx); + func_801477B4(play); this->unk_2D4 = 2; this->actionFunc = func_80B9854C; - func_80B9854C(this, globalCtx); + func_80B9854C(this, play); break; case 0x12AF: - func_801477B4(globalCtx); + func_801477B4(play); this->unk_2D4 = 4; this->actionFunc = func_80B9854C; - func_80B9854C(this, globalCtx); + func_80B9854C(this, play); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98998; this->actor.flags &= ~ACTOR_FLAG_10000; break; @@ -1060,18 +1060,18 @@ void func_80B98728(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B98998(EnZot* this, GlobalContext* globalCtx) { +void func_80B98998(EnZot* this, PlayState* play) { this->unk_2F2 &= ~8; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B98728; - func_80B98178(this, globalCtx); - } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && + func_80B98178(this, play); + } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x7000)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B98A4C(EnZot* this, GlobalContext* globalCtx) { +void func_80B98A4C(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -1087,73 +1087,73 @@ void func_80B98A4C(EnZot* this, GlobalContext* globalCtx) { textId = 0x12B1; gSaveContext.save.weekEventReg[39] |= 0x40; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B98AD0(EnZot* this, GlobalContext* globalCtx) { - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { +void func_80B98AD0(EnZot* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x12B1: case 0x12B4: case 0x12B7: case 0x12B9: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x12B8: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98CA8; gSaveContext.save.weekEventReg[41] &= (u8)~0x20; AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98CA8; gSaveContext.save.weekEventReg[41] |= 0x20; AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98CA8; break; } } } -void func_80B98BF4(EnZot* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B98BF4(EnZot* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.save.weekEventReg[41] & 0x20) { - Message_StartTextbox(globalCtx, 0x12B7, &this->actor); + Message_StartTextbox(play, 0x12B7, &this->actor); this->actionFunc = func_80B98AD0; } else { - Message_StartTextbox(globalCtx, 0x12B9, &this->actor); + Message_StartTextbox(play, 0x12B9, &this->actor); this->actionFunc = func_80B98AD0; } } else { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B98CA8(EnZot* this, GlobalContext* globalCtx) { - if (func_800B8718(&this->actor, &globalCtx->state)) { - globalCtx->msgCtx.ocarinaMode = 4; +void func_80B98CA8(EnZot* this, PlayState* play) { + if (func_800B8718(&this->actor, &play->state)) { + play->msgCtx.ocarinaMode = 4; AudioOcarina_StartDefault(0xFFFF); this->actionFunc = func_80B98BF4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8614(&this->actor, globalCtx, 120.0f); - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + func_800B8614(&this->actor, play, 120.0f); + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B98AD0; - func_80B98A4C(this, globalCtx); + func_80B98A4C(this, play); } else { - if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { + func_800B8614(&this->actor, play, 120.0f); } if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { - func_800B874C(&this->actor, globalCtx, 120.0, 100.0f); + func_800B874C(&this->actor, play, 120.0, 100.0f); } } @@ -1162,11 +1162,11 @@ void func_80B98CA8(EnZot* this, GlobalContext* globalCtx) { } } -void func_80B98E10(EnZot* this, GlobalContext* globalCtx) { +void func_80B98E10(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { + if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { if (gSaveContext.save.weekEventReg[40] & 4) { textId = 0x12C5; } else { @@ -1180,7 +1180,7 @@ void func_80B98E10(EnZot* this, GlobalContext* globalCtx) { gSaveContext.save.weekEventReg[40] |= 2; } } else { - if (Flags_GetSwitch(globalCtx, this->actor.home.rot.z & 0x7F)) { + if (Flags_GetSwitch(play, this->actor.home.rot.z & 0x7F)) { if (this->unk_2F2 & 0x10) { textId = 0x12BF; } else { @@ -1195,61 +1195,61 @@ void func_80B98E10(EnZot* this, GlobalContext* globalCtx) { textId = 0x12BB; } } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B98F30(EnZot* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_80B98F30(EnZot* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80B990A4; } else { - Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_BLUE, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 10000.0f, 50.0f); } } -void func_80B98F94(EnZot* this, GlobalContext* globalCtx) { +void func_80B98F94(EnZot* this, PlayState* play) { if (!(this->unk_2F2 & 4)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x12BB: this->unk_2F2 &= ~4; case 0x12BC: case 0x12C0: case 0x12C3: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x12BE: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B98F30; - func_80B98F30(this, globalCtx); + func_80B98F30(this, play); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B990A4; break; } } } -void func_80B990A4(EnZot* this, GlobalContext* globalCtx) { +void func_80B990A4(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x400, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B98F94; - func_80B98E10(this, globalCtx); - } else if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_80B98E10(this, play); + } else if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { + func_800B8614(&this->actor, play, 120.0f); } } -void func_80B99160(EnZot* this, GlobalContext* globalCtx) { +void func_80B99160(EnZot* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -1265,66 +1265,66 @@ void func_80B99160(EnZot* this, GlobalContext* globalCtx) { textId = 0x12C6; gSaveContext.save.weekEventReg[40] |= 8; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80B991E4(EnZot* this, GlobalContext* globalCtx) { +void func_80B991E4(EnZot* this, PlayState* play) { if (1) { do { } while (0); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - u16 temp = globalCtx->msgCtx.currentTextId; + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + u16 temp = play->msgCtx.currentTextId; u32 temp2; if ((temp == 0x12C6) || (temp == 0x12C7) || (temp == 0x12CA) || (temp == 0x12CB)) { temp2 = temp; - func_80151938(globalCtx, temp2 + 1); + func_80151938(play, temp2 + 1); } else { - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80B992C0; func_80B96BEC(this, 1, 0); } } } -void func_80B992C0(EnZot* this, GlobalContext* globalCtx) { - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80B992C0(EnZot* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B991E4; - func_80B99160(this, globalCtx); + func_80B99160(this, play); this->actor.speedXZ = 0.0f; func_80B96BEC(this, 0, 0); } else { - if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && (this->actor.xzDistToPlayer < 100.0f)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { + func_800B8614(&this->actor, play, 120.0f); } this->actor.speedXZ = 1.5f; func_80B96FB0(this); } } -void func_80B99384(EnZot* this, GlobalContext* globalCtx) { +void func_80B99384(EnZot* this, PlayState* play) { } -void EnZot_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZot_Update(Actor* thisx, PlayState* play) { s32 pad; EnZot* this = THIS; Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 30.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, 5); this->unk_2F2 &= ~0x40; if (SkelAnime_Update(&this->skelAnime) && (this->unk_2F0 != 0)) { this->unk_2F2 |= 0x40; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (!(this->unk_2F2 & 8)) { - if (!(this->unk_2F2 & 4) && func_80B96DF0(this, globalCtx)) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2C4, &this->unk_2CA, this->actor.focus.pos); + if (!(this->unk_2F2 & 4) && func_80B96DF0(this, play)) { + Actor_TrackPlayer(play, &this->actor, &this->unk_2C4, &this->unk_2CA, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_2C4.x, 0, 6, 6200, 100); Math_SmoothStepToS(&this->unk_2C4.y, 0, 6, 6200, 100); @@ -1351,7 +1351,7 @@ Gfx* func_80B99580(GraphicsContext* gfxCtx) { return dList; } -s32 EnZot_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnZot_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnZot* this = THIS; s32 pad; @@ -1369,13 +1369,13 @@ s32 EnZot_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if (((this->unk_2F0 == 8) || (this->unk_2F0 == 9)) && ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13))) { - rot->y += (s16)(Math_SinS(globalCtx->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f); - rot->z += (s16)(Math_CosS(globalCtx->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f); + rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f); + rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f); } return false; } -void EnZot_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnZot_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80B99934 = { 400.0f, 0.0f, 0.0f }; EnZot* this = THIS; @@ -1384,7 +1384,7 @@ void EnZot_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZot_Draw(Actor* thisx, PlayState* play) { TexturePtr sp4C[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, @@ -1392,16 +1392,16 @@ void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx) { }; EnZot* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp4C[this->unk_2EC])); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80B99580(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80B99580(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, EnZot_OverrideLimbDraw, EnZot_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.h b/src/overlays/actors/ovl_En_Zot/z_en_zot.h index 06fb724ae2..14da492d80 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.h +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.h @@ -5,7 +5,7 @@ struct EnZot; -typedef void (*EnZotActionFunc)(struct EnZot*, GlobalContext*); +typedef void (*EnZotActionFunc)(struct EnZot*, PlayState*); #define ENZOT_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENZOT_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 5979178f15..407b5562ac 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -12,21 +12,21 @@ #define THIS ((EnZov*)thisx) -void EnZov_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZov_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZov_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZov_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZov_Init(Actor* thisx, PlayState* play); +void EnZov_Destroy(Actor* thisx, PlayState* play); +void EnZov_Update(Actor* thisx, PlayState* play); +void EnZov_Draw(Actor* thisx, PlayState* play); void func_80BD1570(EnZov* this, s16 index, u8 mode); -void func_80BD187C(EnZov* this, GlobalContext* globalCtx); -void func_80BD19FC(EnZov* this, GlobalContext* globalCtx); -void func_80BD1BF0(EnZov* this, GlobalContext* globalCtx); -void func_80BD1C38(EnZov* this, GlobalContext* globalCtx); -void func_80BD1C84(EnZov* this, GlobalContext* globalCtx); -void func_80BD1D94(EnZov* this, GlobalContext* globalCtx); -void func_80BD1DB8(EnZov* this, GlobalContext* globalCtx); -void func_80BD1F1C(EnZov* this, GlobalContext* globalCtx); -s32 func_80BD1FC8(GlobalContext* globalCtx, EnZov* this); +void func_80BD187C(EnZov* this, PlayState* play); +void func_80BD19FC(EnZov* this, PlayState* play); +void func_80BD1BF0(EnZov* this, PlayState* play); +void func_80BD1C38(EnZov* this, PlayState* play); +void func_80BD1C84(EnZov* this, PlayState* play); +void func_80BD1D94(EnZov* this, PlayState* play); +void func_80BD1DB8(EnZov* this, PlayState* play); +void func_80BD1F1C(EnZov* this, PlayState* play); +s32 func_80BD1FC8(PlayState* play, EnZov* this); const ActorInit En_Zov_InitVars = { ACTOR_EN_ZOV, @@ -79,14 +79,14 @@ static s8 D_80BD2770[] = { 1, 2, 1, 0, 0, 1, 2, 1, }; -void EnZov_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZov_Init(Actor* thisx, PlayState* play) { EnZov* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zov_Skel_016258, &object_zov_Anim_00D3EC, this->jontTable, + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->skelAnime, &object_zov_Skel_016258, &object_zov_Anim_00D3EC, this->jontTable, this->morphTable, 23); Animation_PlayLoop(&this->skelAnime, &object_zov_Anim_00D3EC); @@ -127,10 +127,10 @@ void EnZov_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void EnZov_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZov_Destroy(Actor* thisx, PlayState* play) { EnZov* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80BD13DC(EnZov* this) { @@ -174,15 +174,15 @@ void func_80BD1570(EnZov* this, s16 index, u8 mode) { func_80BD1470(this, index, mode, 5.0f); } -s32 func_80BD15A4(EnZov* this, GlobalContext* globalCtx) { - if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && +s32 func_80BD15A4(EnZov* this, PlayState* play) { + if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { return true; } return false; } -void func_80BD160C(EnZov* this, GlobalContext* globalCtx) { +void func_80BD160C(EnZov* this, PlayState* play) { s32 textId = 0; if (gSaveContext.save.weekEventReg[53] & 0x20) { @@ -213,7 +213,7 @@ void func_80BD160C(EnZov* this, GlobalContext* globalCtx) { this->unk_320 |= 1; if (textId != 0) { - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } } @@ -256,22 +256,22 @@ void func_80BD1764(EnZov* this) { } } -void func_80BD187C(EnZov* this, GlobalContext* globalCtx) { +void func_80BD187C(EnZov* this, PlayState* play) { func_80BD1764(this); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1022: - func_80151938(globalCtx, 0x1023); + func_80151938(play, 0x1023); break; case 0x1023: if ((this->unk_322 != 6) && (this->unk_322 != 1)) { func_80BD1570(this, 1, 2); } - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BD1C84; break; @@ -279,14 +279,14 @@ void func_80BD187C(EnZov* this, GlobalContext* globalCtx) { if (this->unk_322 != 6) { func_80BD1570(this, 0, 0); } - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BD1C84; break; default: this->unk_320 &= ~1; func_80BD1570(this, 0, 0); - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BD1C84; break; } @@ -294,7 +294,7 @@ void func_80BD187C(EnZov* this, GlobalContext* globalCtx) { break; case 2: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BD1C84; this->unk_320 &= ~1; func_80BD1570(this, 0, 0); @@ -302,7 +302,7 @@ void func_80BD187C(EnZov* this, GlobalContext* globalCtx) { } } -void func_80BD19FC(EnZov* this, GlobalContext* globalCtx) { +void func_80BD19FC(EnZov* this, PlayState* play) { func_80BD1764(this); if (this->unk_322 == 0) { if (!(this->unk_320 & 2)) { @@ -314,9 +314,9 @@ void func_80BD19FC(EnZov* this, GlobalContext* globalCtx) { this->unk_324--; } else { func_80BD13DC(this); - Message_StartTextbox(globalCtx, 0x1021, &this->actor); - ((EnElf*)(GET_PLAYER(globalCtx)->tatlActor))->unk_264 |= 4; - Actor_ChangeFocus(&this->actor, globalCtx, GET_PLAYER(globalCtx)->tatlActor); + Message_StartTextbox(play, 0x1021, &this->actor); + ((EnElf*)(GET_PLAYER(play)->tatlActor))->unk_264 |= 4; + Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); this->actionFunc = func_80BD187C; } } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -325,11 +325,11 @@ void func_80BD19FC(EnZov* this, GlobalContext* globalCtx) { } } -s32 func_80BD1AE0(EnZov* this, GlobalContext* globalCtx) { +s32 func_80BD1AE0(EnZov* this, PlayState* play) { func_80BD1764(this); - if (Cutscene_CheckActorAction(globalCtx, 504)) { - s16 action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 504)]->action; + if (Cutscene_CheckActorAction(play, 504)) { + s16 action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 504)]->action; if (action != this->unk_326) { this->unk_326 = action; @@ -358,36 +358,36 @@ s32 func_80BD1AE0(EnZov* this, GlobalContext* globalCtx) { return false; } -void func_80BD1BF0(EnZov* this, GlobalContext* globalCtx) { - if (!func_80BD1AE0(this, globalCtx)) { +void func_80BD1BF0(EnZov* this, PlayState* play) { + if (!func_80BD1AE0(this, play)) { func_80BD1570(this, 0, 0); this->actionFunc = func_80BD1C84; } } -void func_80BD1C38(EnZov* this, GlobalContext* globalCtx) { - if (func_80BD1AE0(this, globalCtx)) { - Cutscene_ActorTranslateAndYaw(&this->actor, globalCtx, Cutscene_GetActorActionIndex(globalCtx, 504)); +void func_80BD1C38(EnZov* this, PlayState* play) { + if (func_80BD1AE0(this, play)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 504)); } } -void func_80BD1C84(EnZov* this, GlobalContext* globalCtx) { +void func_80BD1C84(EnZov* this, PlayState* play) { func_80BD1764(this); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BD187C; - func_80BD160C(this, globalCtx); - } else if (func_80BD15A4(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_80BD160C(this, play); + } else if (func_80BD15A4(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } - if (Cutscene_CheckActorAction(globalCtx, 0x1F8)) { + if (Cutscene_CheckActorAction(play, 0x1F8)) { this->actionFunc = func_80BD1BF0; - func_80BD1BF0(this, globalCtx); + func_80BD1BF0(this, play); } } -void func_80BD1D30(EnZov* this, GlobalContext* globalCtx) { +void func_80BD1D30(EnZov* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { @@ -399,48 +399,48 @@ void func_80BD1D30(EnZov* this, GlobalContext* globalCtx) { } else { textId = 0x1031; } - Message_StartTextbox(globalCtx, textId, &this->actor); + Message_StartTextbox(play, textId, &this->actor); } -void func_80BD1D94(EnZov* this, GlobalContext* globalCtx) { +void func_80BD1D94(EnZov* this, PlayState* play) { func_80BD1764(this); } -void func_80BD1DB8(EnZov* this, GlobalContext* globalCtx) { +void func_80BD1DB8(EnZov* this, PlayState* play) { func_80BD1764(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&globalCtx->msgCtx) == 5) && Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x1033: case 0x1034: case 0x1035: case 0x1036: case 0x1037: case 0x1038: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1039: - globalCtx->nextEntranceIndex = globalCtx->setupExitList[ENZOV_GET_FE00(&this->actor)]; - globalCtx->unk_1887F = 5; - globalCtx->sceneLoadFlag = 0x14; + play->nextEntranceIndex = play->setupExitList[ENZOV_GET_FE00(&this->actor)]; + play->unk_1887F = 5; + play->sceneLoadFlag = 0x14; gSaveContext.save.weekEventReg[78] |= 1; this->actionFunc = func_80BD1D94; - globalCtx->msgCtx.unk11F10 = 0; + play->msgCtx.unk11F10 = 0; Audio_QueueSeqCmd(0x101400FF); break; default: - func_801477B4(globalCtx); + func_801477B4(play); this->actionFunc = func_80BD1F1C; break; } } } -void func_80BD1F1C(EnZov* this, GlobalContext* globalCtx) { +void func_80BD1F1C(EnZov* this, PlayState* play) { func_80BD1764(this); if (this->actor.home.rot.y != this->actor.shape.rot.y) { @@ -448,41 +448,41 @@ void func_80BD1F1C(EnZov* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; } - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BD1DB8; - func_80BD1D30(this, globalCtx); - } else if (func_80BD15A4(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 120.0f); + func_80BD1D30(this, play); + } else if (func_80BD15A4(this, play)) { + func_800B8614(&this->actor, play, 120.0f); } } -s32 func_80BD1FC8(GlobalContext* globalCtx, EnZov* this) { +s32 func_80BD1FC8(PlayState* play, EnZov* this) { s32 ret; s32 pad; - ret = func_8013A530(globalCtx, &this->actor, 4, &this->actor.focus.pos, &this->actor.shape.rot, 10.0f, 300.0f, -1); - ret |= func_8013A530(globalCtx, &this->actor, 5, &this->unk_308, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); - ret |= func_8013A530(globalCtx, &this->actor, 6, &this->unk_314, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret = func_8013A530(play, &this->actor, 4, &this->actor.focus.pos, &this->actor.shape.rot, 10.0f, 300.0f, -1); + ret |= func_8013A530(play, &this->actor, 5, &this->unk_308, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret |= func_8013A530(play, &this->actor, 6, &this->unk_314, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); return ret; } -void EnZov_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZov_Update(Actor* thisx, PlayState* play) { s32 pad; EnZov* this = THIS; Actor_MoveWithGravity(&this->actor); 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, 4); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - if (!Cutscene_CheckActorAction(globalCtx, 0x1F8)) { + if (!Cutscene_CheckActorAction(play, 0x1F8)) { this->unk_320 &= ~0x10; } - if ((this->unk_320 & 1) && func_80BD15A4(this, globalCtx)) { - Actor_TrackPlayer(globalCtx, &this->actor, &this->unk_2F0, &this->unk_2F6, this->actor.focus.pos); + if ((this->unk_320 & 1) && func_80BD15A4(this, play)) { + Actor_TrackPlayer(play, &this->actor, &this->unk_2F0, &this->unk_2F6, this->actor.focus.pos); } else { if ((this->unk_320 & 0x10) && (this->unk_322 == 0)) { Math_SmoothStepToS(&this->unk_2F0.x, -0x1B58, 6, 0x1838, 0x64); @@ -515,7 +515,7 @@ void EnZov_Update(Actor* thisx, GlobalContext* globalCtx) { } } -s32 EnZov_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnZov_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnZov* this = THIS; if (limbIndex == 12) { @@ -531,7 +531,7 @@ s32 EnZov_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, return false; } -void EnZov_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnZov_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnZov* this = THIS; if (limbIndex == 12) { @@ -549,7 +549,7 @@ void EnZov_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } } -void EnZov_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZov_Draw(Actor* thisx, PlayState* play) { EnZov* this = THIS; Gfx* gfx; s32 curFrame; @@ -558,9 +558,9 @@ void EnZov_Draw(Actor* thisx, GlobalContext* globalCtx) { if (1) {} - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); phi_a1 = 0; curFrame = this->skelAnime.curFrame; phi_v1 = this->unk_2EC; @@ -626,8 +626,8 @@ void EnZov_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(&gfx[1], 0x08, Lib_SegmentedToVirtual(D_80BD2768[phi_a1])); POLY_OPA_DISP = &gfx[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(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, EnZov_OverrideLimbDraw, EnZov_PostLimbDraw, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.h b/src/overlays/actors/ovl_En_Zov/z_en_zov.h index ce1cc9d0f3..4078424d97 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.h +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.h @@ -5,8 +5,8 @@ struct EnZov; -typedef void (*EnZovActionFunc)(struct EnZov*, GlobalContext*); -typedef s32 (*EnZovUnkFunc)(GlobalContext*, struct EnZov*); +typedef void (*EnZovActionFunc)(struct EnZov*, PlayState*); +typedef s32 (*EnZovUnkFunc)(PlayState*, struct EnZov*); #define ENZOV_GET_F(thisx) ((thisx)->params & 0xF) #define ENZOV_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index c0751b0782..fa90b6a7f4 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -11,16 +11,16 @@ #define THIS ((EnZow*)thisx) -void EnZow_Init(Actor* thisx, GlobalContext* globalCtx); -void EnZow_Destroy(Actor* thisx, GlobalContext* globalCtx); -void EnZow_Update(Actor* thisx, GlobalContext* globalCtx); -void EnZow_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnZow_Init(Actor* thisx, PlayState* play); +void EnZow_Destroy(Actor* thisx, PlayState* play); +void EnZow_Update(Actor* thisx, PlayState* play); +void EnZow_Draw(Actor* thisx, PlayState* play); -void func_80BDD350(EnZow* this, GlobalContext* globalCtx); -void func_80BDD570(EnZow* this, GlobalContext* globalCtx); -void func_80BDD634(EnZow* this, GlobalContext* globalCtx); -void func_80BDD6BC(EnZow* this, GlobalContext* globalCtx); -void func_80BDD79C(EnZow* this, GlobalContext* globalCtx); +void func_80BDD350(EnZow* this, PlayState* play); +void func_80BDD570(EnZow* this, PlayState* play); +void func_80BDD634(EnZow* this, PlayState* play); +void func_80BDD6BC(EnZow* this, PlayState* play); +void func_80BDD79C(EnZow* this, PlayState* play); const ActorInit En_Zow_InitVars = { ACTOR_EN_ZOW, @@ -176,13 +176,13 @@ void func_80BDC6F8(EnZow* this, EnZowStruct* ptr) { } } -void func_80BDC830(EnZowStruct* ptr, GlobalContext* globalCtx) { +void func_80BDC830(EnZowStruct* ptr, PlayState* play) { s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); u8 flag = false; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 15; i++, ptr++) { if (ptr->unk_00 == 1) { @@ -199,22 +199,21 @@ void func_80BDC830(EnZowStruct* ptr, GlobalContext* globalCtx) { Matrix_Translate(ptr->unk_14.x, ptr->unk_14.y, ptr->unk_14.z, MTXMODE_NEW); Matrix_Scale(ptr->unk_04, 1.0f, ptr->unk_04, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraRippleModelDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80BDC9DC(EnZowStruct* ptr, GlobalContext* globalCtx) { +void func_80BDC9DC(EnZowStruct* ptr, PlayState* play) { s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); u8 flag = false; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 15; i++, ptr++) { if (ptr->unk_00 == 3) { @@ -228,25 +227,24 @@ void func_80BDC9DC(EnZowStruct* ptr, GlobalContext* globalCtx) { } Matrix_Translate(ptr->unk_14.x, ptr->unk_14.y, ptr->unk_14.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_04, ptr->unk_04, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraBubbleModelDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80BDCB84(EnZowStruct* ptr, GlobalContext* globalCtx) { +void func_80BDCB84(EnZowStruct* ptr, PlayState* play) { s16 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); u8 flag = false; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); for (i = 0; i < 15; i++, ptr++) { if (ptr->unk_00 == 2) { @@ -261,16 +259,15 @@ void func_80BDCB84(EnZowStruct* ptr, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, ptr->unk_0F); Matrix_Translate(ptr->unk_14.x, ptr->unk_14.y, ptr->unk_14.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(ptr->unk_04, ptr->unk_04, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gZoraSplashModelDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } void func_80BDCD38(EnZow* this, EnZowStruct* ptr, f32 arg2, f32 arg3, u8 arg4) { @@ -306,17 +303,17 @@ void func_80BDCDA8(EnZow* this, EnZowStruct* ptr) { } } -void EnZow_Init(Actor* thisx, GlobalContext* globalCtx) { +void EnZow_Init(Actor* thisx, PlayState* play) { s32 pad; EnZow* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80BDD79C; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); + SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); Animation_PlayOnce(&this->skelAnime, &gZoraSurfacingAnim); this->unk_2C8 = 1; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.shape.rot.z = 0; this->unk_2CA = 0; this->unk_2CC = 0; @@ -327,10 +324,10 @@ void EnZow_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; } -void EnZow_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void EnZow_Destroy(Actor* thisx, PlayState* play) { EnZow* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } static AnimationHeader* sAnimations[] = { &gZoraTreadingWaterAnim, &gZoraSurfacingAnim, &gZoraSurfacingAnim }; @@ -348,15 +345,15 @@ void func_80BDD04C(EnZow* this, s16 arg1, u8 arg2) { } } -s32 func_80BDD154(EnZow* this, GlobalContext* globalCtx) { - if (Player_IsFacingActor(&this->actor, 0x3000, globalCtx) && Actor_IsFacingPlayer(&this->actor, 0x3000) && +s32 func_80BDD154(EnZow* this, PlayState* play) { + if (Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000) && (this->actor.xzDistToPlayer < 170.0f) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { return true; } return false; } -void func_80BDD1E0(EnZow* this, GlobalContext* globalCtx) { +void func_80BDD1E0(EnZow* this, PlayState* play) { u16 phi_a1; if (ENZOW_GET_F(&this->actor) == ENZOW_F_1) { @@ -403,10 +400,10 @@ void func_80BDD1E0(EnZow* this, GlobalContext* globalCtx) { } else { phi_a1 = 0x12EF; } - Message_StartTextbox(globalCtx, phi_a1, &this->actor); + Message_StartTextbox(play, phi_a1, &this->actor); } -void func_80BDD350(EnZow* this, GlobalContext* globalCtx) { +void func_80BDD350(EnZow* this, PlayState* play) { if (this->unk_2CA & 2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_WATER); func_80BDCDA8(this, this->unk_2D0); @@ -438,7 +435,7 @@ void func_80BDD350(EnZow* this, GlobalContext* globalCtx) { } } -void func_80BDD490(EnZow* this, GlobalContext* globalCtx) { +void func_80BDD490(EnZow* this, PlayState* play) { this->actor.velocity.y = 0.0f; if (this->actor.xzDistToPlayer > 440.0f) { this->actionFunc = func_80BDD350; @@ -447,7 +444,7 @@ void func_80BDD490(EnZow* this, GlobalContext* globalCtx) { func_80BDD04C(this, 0, 0); } - if ((globalCtx->gameplayFrames & 7) == 0) { + if ((play->gameplayFrames & 7) == 0) { func_80BDCD38(this, this->unk_2D0, 0.2f, 1.0f, 200); } @@ -458,13 +455,13 @@ void func_80BDD490(EnZow* this, GlobalContext* globalCtx) { } } -void func_80BDD570(EnZow* this, GlobalContext* globalCtx) { - func_80BDD490(this, globalCtx); +void func_80BDD570(EnZow* this, PlayState* play) { + func_80BDD490(this, play); - switch (Message_GetState(&globalCtx->msgCtx)) { + switch (Message_GetState(&play->msgCtx)) { case 5: - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.currentTextId) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { case 0x12E8: case 0x12E9: case 0x12EC: @@ -480,11 +477,11 @@ void func_80BDD570(EnZow* this, GlobalContext* globalCtx) { case 0x12FB: case 0x12FD: case 0x12FF: - func_80151938(globalCtx, globalCtx->msgCtx.currentTextId + 1); + func_80151938(play, play->msgCtx.currentTextId + 1); break; default: - func_801477B4(globalCtx); + func_801477B4(play); break; } } @@ -496,17 +493,17 @@ void func_80BDD570(EnZow* this, GlobalContext* globalCtx) { } } -void func_80BDD634(EnZow* this, GlobalContext* globalCtx) { - func_80BDD490(this, globalCtx); - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { +void func_80BDD634(EnZow* this, PlayState* play) { + func_80BDD490(this, play); + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BDD570; - func_80BDD1E0(this, globalCtx); - } else if (func_80BDD154(this, globalCtx)) { - func_800B8614(&this->actor, globalCtx, 180.0f); + func_80BDD1E0(this, play); + } else if (func_80BDD154(this, play)) { + func_800B8614(&this->actor, play, 180.0f); } } -void func_80BDD6BC(EnZow* this, GlobalContext* globalCtx) { +void func_80BDD6BC(EnZow* this, PlayState* play) { if (this->unk_2CE < 245) { this->unk_2CE += 10; } else { @@ -525,7 +522,7 @@ void func_80BDD6BC(EnZow* this, GlobalContext* globalCtx) { } } -void func_80BDD79C(EnZow* this, GlobalContext* globalCtx) { +void func_80BDD79C(EnZow* this, PlayState* play) { if (this->actor.xzDistToPlayer < 400.0f) { this->actor.velocity.y = 4.0f; this->actionFunc = func_80BDD6BC; @@ -542,15 +539,15 @@ void func_80BDD79C(EnZow* this, GlobalContext* globalCtx) { } } -void EnZow_Update(Actor* thisx, GlobalContext* globalCtx) { +void EnZow_Update(Actor* thisx, PlayState* play) { s32 pad; EnZow* this = THIS; Vec3f sp34; Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 15.0f, 30.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, 5); if (this->unk_2CE != 0) { this->unk_2CA &= ~2; @@ -564,10 +561,10 @@ void EnZow_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_2CE != 0) { - if ((globalCtx->state.frames & 8) != 0) { + if ((play->state.frames & 8) != 0) { sp34 = this->actor.world.pos; sp34.y += ((Rand_ZeroOne() - 0.5f) * 10.0f) + 18.0f; sp34.x += (Rand_ZeroOne() - 0.5f) * 28.0f; @@ -601,17 +598,17 @@ Gfx* func_80BDDA7C(GraphicsContext* gfxCtx) { Vec3f D_80BDDD4C = { 400.0f, 0.0f, 0.0f }; -void func_80BDDAA0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void func_80BDDAA0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { if (limbIndex == 15) { Matrix_MultVec3f(&D_80BDDD4C, &thisx->focus.pos); } } -void func_80BDDAE0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - func_80BDDAA0(globalCtx, limbIndex, dList, rot, thisx); +void func_80BDDAE0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + func_80BDDAA0(play, limbIndex, dList, rot, thisx); } -void EnZow_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnZow_Draw(Actor* thisx, PlayState* play) { TexturePtr sp54[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, @@ -621,30 +618,30 @@ void EnZow_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); - func_80BDC830(this->unk_2D0, globalCtx); - func_80BDC9DC(this->unk_2D0, globalCtx); - func_80BDCB84(this->unk_2D0, globalCtx); + func_80BDC830(this->unk_2D0, play); + func_80BDC9DC(this->unk_2D0, play); + func_80BDCB84(this->unk_2D0, play); Matrix_Pop(); if (this->unk_2CE != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->unk_2CE >= 255) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp54[this->unk_2C4])); - gSPSegment(POLY_OPA_DISP++, 0x0C, func_80BDDA7C(globalCtx->state.gfxCtx)); + gSPSegment(POLY_OPA_DISP++, 0x0C, func_80BDDA7C(play->state.gfxCtx)); - SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, func_80BDDAA0, &this->actor); } else { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sp54[this->unk_2C4])); - func_800BDAA0(globalCtx, &this->skelAnime, NULL, func_80BDDAE0, &this->actor, this->unk_2CE); + func_800BDAA0(play, &this->skelAnime, NULL, func_80BDDAE0, &this->actor, this->unk_2CE); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.h b/src/overlays/actors/ovl_En_Zow/z_en_zow.h index e169e28160..8faeae73f0 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.h +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.h @@ -5,7 +5,7 @@ struct EnZow; -typedef void (*EnZowActionFunc)(struct EnZow*, GlobalContext*); +typedef void (*EnZowActionFunc)(struct EnZow*, PlayState*); #define ENZOW_GET_F(thisx) ((thisx)->params & 0xF) 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 d02bb91da9..8842d3e31a 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 @@ -11,12 +11,12 @@ #define THIS ((ItemBHeart*)thisx) -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_808BCF54(ItemBHeart* this, GlobalContext* globalCtx); +void func_808BCF54(ItemBHeart* this, PlayState* play); const ActorInit Item_B_Heart_InitVars = { ACTOR_ITEM_B_HEART, @@ -37,10 +37,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 = THIS; - if (Flags_GetCollectible(globalCtx, 0x1F)) { + if (Flags_GetCollectible(play, 0x1F)) { Actor_MarkForDeath(&this->actor); return; } @@ -57,38 +57,38 @@ void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y += (20.0f * this->unk_168); } -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 = THIS; - func_808BCF54(this, globalCtx); + func_808BCF54(this, play); if (!(this->unk_168 < 0.5f)) { - if (Actor_HasParent(&this->actor, globalCtx)) { - Flags_SetCollectible(globalCtx, 0x1F); + if (Actor_HasParent(&this->actor, play)) { + Flags_SetCollectible(play, 0x1F); Actor_MarkForDeath(&this->actor); } else { - Actor_PickUp(&this->actor, globalCtx, GI_HEART_CONTAINER, 30.0f, 80.0f); + Actor_PickUp(&this->actor, play, GI_HEART_CONTAINER, 30.0f, 80.0f); } } } -void func_808BCF54(ItemBHeart* this, GlobalContext* globalCtx) { +void func_808BCF54(ItemBHeart* this, PlayState* play) { this->actor.shape.rot.y += 0x400; Math_ApproachF(&this->unk_164, 0.4f, 0.1f, 0.01f); Actor_SetScale(&this->actor, this->unk_164 * this->unk_168); } -void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemBHeart_Draw(Actor* thisx, PlayState* play) { ItemBHeart* this = THIS; Actor* blueWarpActor; u8 flag = false; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - blueWarpActor = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + blueWarpActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (blueWarpActor != NULL) { if ((blueWarpActor->id == ACTOR_DOOR_WARP1) && (blueWarpActor->projectedPos.z > this->actor.projectedPos.z)) { @@ -99,16 +99,16 @@ void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (flag || thisx->world.rot.y != 0) { - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001290); gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001470); } else { - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_gi_hearts_DL_001290); gSPDisplayList(POLY_OPA_DISP++, object_gi_hearts_DL_001470); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 2eb9202073..87a385dd57 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -10,15 +10,15 @@ #define THIS ((ItemEtcetera*)thisx) -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Update(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_WaitForObject(ItemEtcetera* this, GlobalContext* globalCtx); -void func_8092009C(ItemEtcetera* this, GlobalContext* globalCtx); -void func_809200F8(ItemEtcetera* this, GlobalContext* globalCtx); -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx); -void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx); +void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play); +void func_8092009C(ItemEtcetera* this, PlayState* play); +void func_809200F8(ItemEtcetera* this, PlayState* play); +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play); +void ItemEtcetera_Draw(Actor* thisx, PlayState* play); const ActorInit Item_Etcetera_InitVars = { ACTOR_ITEM_ETCETERA, @@ -51,11 +51,11 @@ void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionF this->actionFunc = actionFunc; } -void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Init(Actor* thisx, PlayState* play) { s32 pad; ItemEtcetera* this = THIS; s32 type = ITEMETCETERA_GET_FF(&this->actor); - s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[type]); + s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); if (objBankIndex < 0) { // assert on debug @@ -89,51 +89,51 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ItemEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Destroy(Actor* thisx, PlayState* play) { } -void ItemEtcetera_WaitForObject(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { +void ItemEtcetera_WaitForObject(ItemEtcetera* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->actor.objBankIndex = this->objIndex; this->actor.draw = this->drawFunc; this->actionFunc = this->futureActionFunc; } } -void func_8092009C(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Actor_HasParent(&this->actor, globalCtx)) { +void func_8092009C(ItemEtcetera* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { Actor_MarkForDeath(&this->actor); } else { - Actor_PickUp(&this->actor, globalCtx, this->itemID, 30.0f, 50.0f); + Actor_PickUp(&this->actor, play, this->itemID, 30.0f, 50.0f); } } -void func_809200F8(ItemEtcetera* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, ITEMETCETERA_GET_TREASUREFLAG(&this->actor))) { +void func_809200F8(ItemEtcetera* this, PlayState* play) { + if (Flags_GetTreasure(play, ITEMETCETERA_GET_TREASUREFLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); } } -void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_Update(Actor* thisx, PlayState* play) { ItemEtcetera* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { +void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) { ItemEtcetera* this = THIS; - if (globalCtx->actorCtx.unk4 == 100) { - func_800B8050(&this->actor, globalCtx, 0); - func_800B8118(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + if (play->actorCtx.unk4 == 100) { + func_800B8050(&this->actor, play, 0); + func_800B8118(&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 = THIS; - func_800B8050(&this->actor, globalCtx, 0); - func_800B8118(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->giDrawId); + func_800B8050(&this->actor, play, 0); + func_800B8118(&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 16b476d964..d859b57134 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -8,7 +8,7 @@ struct ItemEtcetera; #define ITEMETCETERA_GET_FF(thisx) ((thisx)->params & 0xFF) #define ITEMETCETERA_GET_TREASUREFLAG(thisx) (((thisx)->params >> 8) & 0x1F) -typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, GlobalContext*); +typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, PlayState*); typedef enum { /* 0x00 */ ITEM_ETC_BOTTLE_1, 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 7017dfcec3..cdf0447e67 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -10,12 +10,12 @@ #define THIS ((ItemInbox*)thisx) -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_Idle(ItemInbox* this, GlobalContext* globalCtx); +void ItemInbox_Idle(ItemInbox* this, PlayState* play); const ActorInit Item_Inbox_InitVars = { ACTOR_ITEM_INBOX, @@ -29,32 +29,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 = THIS; this->actionFunc = ItemInbox_Idle; Actor_SetScale(&this->actor, 0.2f); } -void ItemInbox_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Destroy(Actor* thisx, PlayState* play) { } -void ItemInbox_Idle(ItemInbox* this, GlobalContext* globalCtx) { - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { +void ItemInbox_Idle(ItemInbox* this, PlayState* play) { + if (Flags_GetTreasure(play, (this->actor.params >> 8) & 0x1F)) { Actor_MarkForDeath(&this->actor); } } -void ItemInbox_Update(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Update(Actor* thisx, PlayState* play) { ItemInbox* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ItemInbox_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ItemInbox_Draw(Actor* thisx, PlayState* play) { ItemInbox* this = THIS; - func_800B8050(&this->actor, globalCtx, 0); - func_800B8118(&this->actor, globalCtx, 0); - GetItem_Draw(globalCtx, this->actor.params & 0xFF); + func_800B8050(&this->actor, play, 0); + func_800B8118(&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 b2e1abf609..0b3247ee75 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h @@ -5,7 +5,7 @@ struct ItemInbox; -typedef void (*ItemInboxActionFunc)(struct ItemInbox*, GlobalContext*); +typedef void (*ItemInboxActionFunc)(struct ItemInbox*, PlayState*); typedef struct ItemInbox { /* 0x000 */ 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 eee9de2948..fa7bf1adbe 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -12,10 +12,10 @@ #define THIS ((MirRay*)thisx) -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); @@ -256,8 +256,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[MIRRAY_LOCATION(&this->actor)]; Vec3f reflectionPt; Vec3s lightPt; @@ -287,7 +287,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 = THIS; MirRayDataEntry* dataEntry = &sMirRayData[MIRRAY_LOCATION(&this->actor)]; @@ -311,7 +311,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; @@ -332,15 +332,15 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { this->shieldCorners[5].y = -800.0f; if (dataEntry->params & 2) { - Collider_InitJntSph(globalCtx, &this->collider1); - Collider_SetJntSph(globalCtx, &this->collider1, &this->actor, &sJntSphInit, this->collider1Elements); + Collider_InitJntSph(play, &this->collider1); + Collider_SetJntSph(play, &this->collider1, &this->actor, &sJntSphInit, this->collider1Elements); if (!(dataEntry->params & 4)) { // Beams not from mirrors MirRay_SetupCollider(this); } } - Collider_InitQuad(globalCtx, &this->collider2); - Collider_SetQuad(globalCtx, &this->collider2, &this->actor, &sQuadInit); + Collider_InitQuad(play, &this->collider2); + Collider_SetQuad(play, &this->collider2, &this->actor, &sQuadInit); if ((MIRRAY_LOCATION(&this->actor) == MIRRAY_SPIRIT_TOPROOM_CEILINGMIRROR) || (MIRRAY_LOCATION(&this->actor) == MIRRAY_SPIRIT_TOPROOM_COBRA1) || @@ -349,22 +349,22 @@ void MirRay_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Destroy(Actor* thisx, PlayState* play) { MirRay* this = THIS; - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (sMirRayData[MIRRAY_LOCATION(&this->actor)].params & 2) { - Collider_DestroyJntSph(globalCtx, &this->collider1); + Collider_DestroyJntSph(play, &this->collider1); } - Collider_DestroyQuad(globalCtx, &this->collider2); + Collider_DestroyQuad(play, &this->collider2); } -void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Update(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); D_808E3BF0 = false; @@ -373,14 +373,14 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { if (sMirRayData[MIRRAY_LOCATION(&this->actor)].params & 4) { MirRay_SetupCollider(this); } - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } if (this->reflectIntensity > 0.0f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } - MirRay_MakeShieldLight(this, globalCtx); + MirRay_MakeShieldLight(this, play); if (this->reflectIntensity > 0.0f) { func_800B8F98(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); @@ -388,10 +388,10 @@ void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { +void MirRay_SetIntensity(MirRay* this, PlayState* play) { f32 sp4C[3]; s32 pad[4]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; f32 temp_f0; f32 temp_f0_2; @@ -429,9 +429,9 @@ 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) { +void MirRay_SetupReflectionPolys(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { s32 i; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; Vec3f posA; Vec3f posB; @@ -455,7 +455,7 @@ void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayS posB.y = sp60[1] + posA.y; posB.z = sp60[2] + posA.z; - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, &posA, &posB, &sp70, &outPoly, 1)) { + if (BgCheck_AnyLineTest1(&play->colCtx, &posA, &posB, &sp70, &outPoly, 1)) { reflection[i].reflectionPoly = outPoly; } else { reflection[i].reflectionPoly = NULL; @@ -485,8 +485,8 @@ void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { // Creates the reflected beam's collider (to interact with objects) and places and orients the shield images #ifdef NON_MATCHING // Beginning block re-ordered -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; @@ -589,42 +589,42 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe } } #else -void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection); +void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray/MirRay_ReflectedBeam.s") #endif -void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MirRay_Draw(Actor* thisx, PlayState* play) { s32 pad; MirRay* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); MirRayShieldReflection reflection[6]; s32 i; this->reflectIntensity = 0.0f; - if (!D_808E3BF0 && !this->unLit && func_80124088(globalCtx)) { + if (!D_808E3BF0 && !this->unLit && func_80124088(play)) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); - MirRay_SetIntensity(this, globalCtx); + MirRay_SetIntensity(this, play); if (this->reflectIntensity <= 0.0f) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Scale(1.0f, 1.0f, this->reflectIntensity, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(s8)(this->reflectIntensity * 100.0f)); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_mir_ray_Matanimheader_0003F8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_mir_ray_Matanimheader_0003F8)); gSPDisplayList(POLY_XLU_DISP++, object_mir_ray_DL_000168); - 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; @@ -644,7 +644,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { 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), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), 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, 255, reflection[0].opacity); @@ -654,7 +654,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { D_808E3BF0 = true; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c index f6e8750cb4..3361e3a1fb 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c @@ -10,10 +10,10 @@ #define THIS ((MirRay2*)thisx) -void MirRay2_Init(Actor* thisx, GlobalContext* globalCtx); -void MirRay2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MirRay2_Update(Actor* thisx, GlobalContext* globalCtx); -void MirRay2_Draw(Actor* thisx, GlobalContext* globalCtx); +void MirRay2_Init(Actor* thisx, PlayState* play); +void MirRay2_Destroy(Actor* thisx, PlayState* play); +void MirRay2_Update(Actor* thisx, PlayState* play); +void MirRay2_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Mir_Ray2_InitVars = { diff --git a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c index f5209c3929..1127be69ed 100644 --- a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c +++ b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c @@ -11,10 +11,10 @@ #define THIS ((MirRay3*)thisx) -void MirRay3_Init(Actor* thisx, GlobalContext* globalCtx); -void MirRay3_Destroy(Actor* thisx, GlobalContext* globalCtx); -void MirRay3_Update(Actor* thisx, GlobalContext* globalCtx); -void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx); +void MirRay3_Init(Actor* thisx, PlayState* play); +void MirRay3_Destroy(Actor* thisx, PlayState* play); +void MirRay3_Update(Actor* thisx, PlayState* play); +void MirRay3_Draw(Actor* thisx, PlayState* play); const ActorInit Mir_Ray3_InitVars = { ACTOR_MIR_RAY3, @@ -75,7 +75,7 @@ typedef struct { /* 0x50 */ u8 unk_50; } MirRay3Struct; // size = 0x54 -void MirRay3_Init(Actor* thisx, GlobalContext* globalCtx) { +void MirRay3_Init(Actor* thisx, PlayState* play) { s32 pad; MirRay3* this = THIS; @@ -100,34 +100,34 @@ void MirRay3_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_218[5].x = 758.0f; this->unk_218[5].y = -800.0f; - Collider_InitQuad(globalCtx, &this->colliderQuad); - Collider_SetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); - Collider_InitCylinder(globalCtx, &this->colliderCylinder); - Collider_SetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad); + Collider_SetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->actor.world.rot.x = this->actor.shape.rot.x = 0; } -void MirRay3_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void MirRay3_Destroy(Actor* thisx, PlayState* play) { MirRay3* this = THIS; - Collider_DestroyQuad(globalCtx, &this->colliderQuad); - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); + Collider_DestroyQuad(play, &this->colliderQuad); + Collider_DestroyCylinder(play, &this->colliderCylinder); } -void MirRay3_Update(Actor* thisx, GlobalContext* globalCtx) { +void MirRay3_Update(Actor* thisx, PlayState* play) { s32 pad[2]; MirRay3* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_210 &= ~1; if (this->unk_214 > 0.5f) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); } this->unk_210 &= ~2; - if (func_8012405C(globalCtx)) { + if (func_8012405C(play)) { if (this->colliderCylinder.base.acFlags & AC_HIT) { this->unk_210 |= 2; } @@ -135,7 +135,7 @@ void MirRay3_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.y = player->shieldMf.mf[3][1]; this->actor.world.pos.z = player->shieldMf.mf[3][2]; Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } if (this->unk_214 > 0.1f) { @@ -145,8 +145,8 @@ void MirRay3_Update(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->unk_214, 1.0f, 0.1f); } -void func_80B9E544(MirRay3* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B9E544(MirRay3* this, PlayState* play) { + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; f32 temp_f0; @@ -161,8 +161,8 @@ void func_80B9E544(MirRay3* this, GlobalContext* globalCtx) { } } -void func_80B9E5F4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr) { - Player* player = GET_PLAYER(globalCtx); +void func_80B9E5F4(MirRay3* this, PlayState* play, MirRay3Struct* ptr) { + Player* player = GET_PLAYER(play); MtxF* shieldMtx = &player->shieldMf; s32 i; Vec3f sp88; @@ -187,7 +187,7 @@ void func_80B9E5F4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr) sp7C.y = sp60[1] + sp88.y; sp7C.z = sp60[2] + sp88.z; - if (BgCheck_AnyLineTest1(&globalCtx->colCtx, &sp88, &sp7C, &sp70, &sp6C, true)) { + if (BgCheck_AnyLineTest1(&play->colCtx, &sp88, &sp7C, &sp70, &sp6C, true)) { ptr[i].unk_4C = sp6C; } else { ptr[i].unk_4C = NULL; @@ -214,8 +214,8 @@ void func_80B9E7D0(MirRay3Struct* ptr) { } #ifdef NON_MATCHING -void func_80B9E8D4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr) { - Player* player = GET_PLAYER(globalCtx); +void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr) { + Player* player = GET_PLAYER(play); s32 i; MtxF* shieldMf = &player->shieldMf; Vec3f sp140; @@ -321,7 +321,7 @@ void func_80B9E8D4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr) sp134.y = (spF8[1] * temp_f2) + sp140.y; sp134.z = (spF8[2] * temp_f2) + sp140.z; - if (!BgCheck_AnyLineTest1(&globalCtx->colCtx, &sp140, &sp134, &sp128, &spC4, 1)) { + if (!BgCheck_AnyLineTest1(&play->colCtx, &sp140, &sp134, &sp128, &spC4, 1)) { Math_Vec3f_Copy(&sp128, &sp134); } @@ -340,33 +340,33 @@ void func_80B9E8D4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr) Collider_SetQuadVertices(&this->colliderQuad, &spD4, &sp140, &spC8, &sp128); } #else -void func_80B9E8D4(MirRay3* this, GlobalContext* globalCtx, MirRay3Struct* ptr); +void func_80B9E8D4(MirRay3* this, PlayState* play, MirRay3Struct* ptr); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray3/func_80B9E8D4.s") #endif -void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) { +void MirRay3_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; MirRay3* this = THIS; MirRay3Struct sp8C[6]; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; f32 temp; u16 time; - if (!(this->unk_210 & 1) && func_8012405C(globalCtx)) { + if (!(this->unk_210 & 1) && func_8012405C(play)) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); - func_80B9E544(this, globalCtx); + func_80B9E544(this, play); if (this->unk_214 <= 0.1f) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Scale(1.0f, 1.0f, this->unk_214, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (MIRRAY3_GET_F(&this->actor) == MIRRAY3_F_1) { time = gSaveContext.save.time; @@ -384,13 +384,13 @@ void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 218, 225, 205, 255); } - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_mir_ray_Matanimheader_0003F8)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_mir_ray_Matanimheader_0003F8)); gSPDisplayList(POLY_XLU_DISP++, object_mir_ray_DL_000168); - func_80B9E5F4(this, globalCtx, sp8C); + func_80B9E5F4(this, play, sp8C); func_80B9E7D0(sp8C); - func_80B9E8D4(this, globalCtx, sp8C); + func_80B9E8D4(this, play, sp8C); if (sp8C[0].unk_4C == NULL) { sp8C[0].unk_50 = 0; @@ -410,7 +410,7 @@ void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); Matrix_Mult(&sp8C[i].unk_0C, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, sp8C[0].unk_50); @@ -420,6 +420,6 @@ void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) { this->unk_210 |= 1; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 97865650d4..262de706cf 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -11,16 +11,16 @@ #define THIS ((ObjAqua*)thisx) -void ObjAqua_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjAqua_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjAqua_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjAqua_Init(Actor* thisx, PlayState* play); +void ObjAqua_Destroy(Actor* thisx, PlayState* play); +void ObjAqua_Update(Actor* thisx, PlayState* play); +void ObjAqua_Draw(Actor* thisx, PlayState* play); void func_80ACBC70(ObjAqua* this); void func_80ACBDCC(ObjAqua* this); -void func_80ACBC8C(ObjAqua* this, GlobalContext* globalCtx); -void func_80ACBD48(ObjAqua* this, GlobalContext* globalCtx); -void func_80ACBDFC(ObjAqua* this, GlobalContext* globalCtx); +void func_80ACBC8C(ObjAqua* this, PlayState* play); +void func_80ACBD48(ObjAqua* this, PlayState* play); +void func_80ACBDFC(ObjAqua* this, PlayState* play); void func_80ACBD34(ObjAqua* this); @@ -67,7 +67,7 @@ Vec3f D_80ACC308 = { 1.0f / 1000.0f, 7.0f / 10000.0f, 1.0f / 1000.0f }; Vec3f D_80ACC314 = { 8.6f / 1000.0f, 8.0f / 10000.0f, 8.6f / 1000.0f }; Vec3f D_80ACC320 = { 1.0f / 100.0f, 2.6f / 1000.0f, 1.0f / 100.0f }; -void func_80ACB6A0(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACB6A0(ObjAqua* this, PlayState* play) { s32 pad; Vec3f sp58; s32 angleOffset = 0; @@ -77,15 +77,15 @@ void func_80ACB6A0(ObjAqua* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { sp58.x = this->actor.world.pos.x + Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f; sp58.z = this->actor.world.pos.z + Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 120); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 120); angleOffset += 0x4000; } sp58.x = this->actor.world.pos.x; sp58.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 300); } -void func_80ACB7F4(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACB7F4(ObjAqua* this, PlayState* play) { s32 pad; Vec3f effectPos; s32 angleOffset = 0; @@ -95,15 +95,15 @@ void func_80ACB7F4(ObjAqua* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { effectPos.x = (this->actor.world.pos.x + Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f); effectPos.z = (this->actor.world.pos.z + Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f); - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 0, 120); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 0, 120); angleOffset += 0x4000; } effectPos.x = this->actor.world.pos.x; effectPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &effectPos, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 0, 300); } -void func_80ACB940(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACB940(ObjAqua* this, PlayState* play) { s32 pad; Vec3f effectPos; Vec3f effectVel; @@ -114,7 +114,7 @@ void func_80ACB940(ObjAqua* this, GlobalContext* globalCtx) { effectPos.x = this->actor.world.pos.x + (effectVel.x * 40.0f); effectPos.y = this->actor.world.pos.y; effectPos.z = this->actor.world.pos.z + (effectVel.z * 40.0f); - EffectSsIceSmoke_Spawn(globalCtx, &effectPos, &effectVel, &gZeroVec3f, (s32)(Rand_ZeroOne() * 24.0f) + 70); + EffectSsIceSmoke_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, (s32)(Rand_ZeroOne() * 24.0f) + 70); } void func_80ACBA10(ObjAqua* this) { @@ -126,21 +126,21 @@ void func_80ACBA10(ObjAqua* this) { Matrix_MtxFToYXZRot(&sp2C, &this->actor.shape.rot, false); } -s32 func_80ACBA60(ObjAqua* this, GlobalContext* globalCtx) { +s32 func_80ACBA60(ObjAqua* this, PlayState* play) { s32 pad; WaterBox* waterBox; f32 ySurface; s32 bgId; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &ySurface, &waterBox, &bgId) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, + &waterBox, &bgId) && (this->actor.world.pos.y < ySurface)) { return true; } return false; } -void ObjAqua_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjAqua_Init(Actor* thisx, PlayState* play) { ObjAqua* this = THIS; s32 i; @@ -148,16 +148,15 @@ void ObjAqua_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.x = 0.0009f; this->actor.scale.y = 0.0005f; this->actor.scale.z = 0.0009f; - 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); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); if (1) {}; this->actor.shape.shadowAlpha = 140; this->alpha = 255; - if (func_80ACBA60(this, globalCtx)) { + if (func_80ACBA60(this, play)) { for (i = 0; i < 8; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -4.0f, 4.0f, 4.0f, - (Rand_ZeroOne() * 0.09f) + 0.03f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, -4.0f, 4.0f, 4.0f, (Rand_ZeroOne() * 0.09f) + 0.03f); } func_80ACBDCC(this); } else { @@ -165,9 +164,9 @@ void ObjAqua_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjAqua_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjAqua_Destroy(Actor* thisx, PlayState* play) { ObjAqua* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80ACBC70(ObjAqua* this) { @@ -175,16 +174,16 @@ void func_80ACBC70(ObjAqua* this) { this->actionFunc = func_80ACBC8C; } -void func_80ACBC8C(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACBC8C(ObjAqua* this, PlayState* play) { if (this->actor.bgCheckFlags & 0x21) { if (this->actor.bgCheckFlags & 1) { - func_80ACB7F4(this, globalCtx); + func_80ACB7F4(this, play); func_80ACBA10(this); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOTTLE_WATERING); func_80ACBD34(this); } else { - func_80ACB6A0(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 0x28, NA_SE_EV_BOMB_DROP_WATER); + func_80ACB6A0(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 0x28, NA_SE_EV_BOMB_DROP_WATER); Actor_MarkForDeath(&this->actor); } } else if (this->counter <= 0) { @@ -196,9 +195,9 @@ void func_80ACBD34(ObjAqua* this) { this->actionFunc = func_80ACBD48; } -void func_80ACBD48(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACBD48(ObjAqua* this, PlayState* play) { if ((AQUA_HOT(&this->actor) == 1) && (this->alpha > 90)) { - func_80ACB940(this, globalCtx); + func_80ACB940(this, play); } if (this->alpha > 5) { this->alpha -= 5; @@ -219,7 +218,7 @@ void func_80ACBDCC(ObjAqua* this) { this->actionFunc = func_80ACBDFC; } -void func_80ACBDFC(ObjAqua* this, GlobalContext* globalCtx) { +void func_80ACBDFC(ObjAqua* this, PlayState* play) { s32 pad; f32 temp = this->counter; @@ -229,7 +228,7 @@ void func_80ACBDFC(ObjAqua* this, GlobalContext* globalCtx) { if (AQUA_HOT(&this->actor) == 1) { f32 temp_f2 = this->actor.scale.x * 10000.0f; - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, temp_f2 * -0.5f, temp_f2, temp_f2, + EffectSsBubble_Spawn(play, &this->actor.world.pos, temp_f2 * -0.5f, temp_f2, temp_f2, (Rand_ZeroOne() * 0.1f) + 0.03f); } if (this->counter <= 0) { @@ -237,14 +236,14 @@ void func_80ACBDFC(ObjAqua* this, GlobalContext* globalCtx) { } } -void ObjAqua_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjAqua_Update(Actor* thisx, PlayState* play) { ObjAqua* this = THIS; s32 pad; if (this->counter > 0) { this->counter--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update) { if (this->actionFunc == func_80ACBC8C) { Math_Vec3f_StepTo(&this->actor.scale, &D_80ACC308, 0.00006f); @@ -255,30 +254,30 @@ void ObjAqua_Update(Actor* thisx, GlobalContext* globalCtx) { } this->actor.velocity.y *= 0.9f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 12.0f, 4.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 4.0f, 0.0f, 5); if (this->actionFunc != func_80ACBDFC) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 3000.0f; - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } } -void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjAqua_Draw(Actor* thisx, PlayState* play) { ObjAqua* this = THIS; s32 framesTemp; s32 pad; - s16 yaw = Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; + s16 yaw = Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamera]) + 0x8000; s32 actionFuncTemp = this->actionFunc == func_80ACBDFC; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - framesTemp = ((globalCtx->gameplayFrames & 0x7FFFFFFF) * -0xA) & 0x1FF; + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + framesTemp = ((play->gameplayFrames & 0x7FFFFFFF) * -0xA) & 0x1FF; if (actionFuncTemp) { framesTemp >>= 1; } gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, framesTemp, 0x20, 0x80)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, framesTemp, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 0); if (actionFuncTemp) { @@ -290,7 +289,7 @@ void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, MTXMODE_APPLY); } Matrix_RotateYS(yaw, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h index 8360ae1e2d..bffe794d5f 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h @@ -8,7 +8,7 @@ struct ObjAqua; -typedef void (*ObjAquaActionFunc)(struct ObjAqua*, GlobalContext*); +typedef void (*ObjAquaActionFunc)(struct ObjAqua*, PlayState*); typedef struct ObjAqua { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index 3e72b809e7..9b31c22ca6 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -11,17 +11,17 @@ #define THIS ((ObjArmos*)thisx) -void ObjArmos_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjArmos_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjArmos_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjArmos_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjArmos_Init(Actor* thisx, PlayState* play); +void ObjArmos_Destroy(Actor* thisx, PlayState* play); +void ObjArmos_Update(Actor* thisx, PlayState* play); +void ObjArmos_Draw(Actor* thisx, PlayState* play); void func_809A54B4(ObjArmos* this); -void func_809A54E0(ObjArmos* this, GlobalContext* globalCtx); +void func_809A54E0(ObjArmos* this, PlayState* play); void func_809A5610(ObjArmos* this); -void func_809A562C(ObjArmos* this, GlobalContext* globalCtx); +void func_809A562C(ObjArmos* this, PlayState* play); void func_809A57D8(ObjArmos* this); -void func_809A57F4(ObjArmos* this, GlobalContext* globalCtx); +void func_809A57F4(ObjArmos* this, PlayState* play); const ActorInit Obj_Armos_InitVars = { ACTOR_OBJ_ARMOS, @@ -44,9 +44,9 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), }; -s32 func_809A4E00(ObjArmos* this, GlobalContext* globalCtx, s16 arg2) { - return !DynaPolyActor_ValidateMove(globalCtx, &this->dyna, 30, arg2, 1) || - !DynaPolyActor_ValidateMove(globalCtx, &this->dyna, 30, arg2, 28); +s32 func_809A4E00(ObjArmos* this, PlayState* play, s16 arg2) { + return !DynaPolyActor_ValidateMove(play, &this->dyna, 30, arg2, 1) || + !DynaPolyActor_ValidateMove(play, &this->dyna, 30, arg2, 28); } s32 func_809A4E68(ObjArmos* this) { @@ -176,7 +176,7 @@ void func_809A518C(ObjArmos* this, s32 arg1) { this->unk_264 = arg1; } -void ObjArmos_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjArmos_Init(Actor* thisx, PlayState* play) { s32 pad; ObjArmos* this = THIS; s32 sp44 = OBJARMOS_GET_ROTZ_7(&this->dyna.actor); @@ -189,16 +189,16 @@ void ObjArmos_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.x = this->dyna.actor.shape.rot.z = 0; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_am_Colheader_005CF8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_am_Colheader_005CF8); - SkelAnime_Init(globalCtx, &this->skelAnime, &object_am_Skel_005948, &gArmosPushedBackAnim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &object_am_Skel_005948, &gArmosPushedBackAnim, this->jointTable, this->morphTable, OBJECT_AM_LIMB_MAX); Animation_Change(&this->skelAnime, &gArmosPushedBackAnim, 0.0f, sp3C, sp3C, ANIMMODE_ONCE, 0.0f); if (sp40 == 0) { func_809A57D8(this); - } else if (Flags_GetSwitch(globalCtx, OBJARMOS_GET_7F(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJARMOS_GET_7F(&this->dyna.actor))) { if (sp44 == OBJARMOS_ROT_7_0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (sp40 * 60); func_809A57D8(this); @@ -219,10 +219,10 @@ void ObjArmos_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjArmos_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjArmos_Destroy(Actor* thisx, PlayState* play) { ObjArmos* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_809A54B4(ObjArmos* this) { @@ -234,7 +234,7 @@ void func_809A54B4(ObjArmos* this) { this->unk_266[0] = 0; } -void func_809A54E0(ObjArmos* this, GlobalContext* globalCtx) { +void func_809A54E0(ObjArmos* this, PlayState* play) { s32 i; s32 sp20 = func_809A4E68(this); @@ -248,11 +248,11 @@ void func_809A54E0(ObjArmos* this, GlobalContext* globalCtx) { if (sp20 != -1) { if ((this->unk_266[sp20] >= 9) && func_809A4F00(this, sp20) && func_809A500C(this, sp20) && - !func_809A4E00(this, globalCtx, (this->dyna.pushForce > 0.0f) ? 90 : 120)) { + !func_809A4E00(this, play, (this->dyna.pushForce > 0.0f) ? 90 : 120)) { func_809A518C(this, sp20); func_809A5610(this); } else { - GET_PLAYER(globalCtx)->stateFlags2 &= ~0x10; + GET_PLAYER(play)->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; } } @@ -263,7 +263,7 @@ void func_809A5610(ObjArmos* this) { this->unk_24C = 5; } -void func_809A562C(ObjArmos* this, GlobalContext* globalCtx) { +void func_809A562C(ObjArmos* this, PlayState* play) { s32 pad[2]; Player* player; f32 temp2 = this->unk_260 - *this->unk_25C; @@ -271,21 +271,21 @@ void func_809A562C(ObjArmos* this, GlobalContext* globalCtx) { s32 sp20; if (Math_StepToF(this->unk_25C, this->unk_260, (Math_SinS(fabsf(temp2) * 546.13336f) * 1.6f) + 1.0f)) { - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); temp = OBJARMOS_GET_ROTZ_7(&this->dyna.actor); sp20 = false; if ((temp == OBJARMOS_ROT_7_4) || (temp == OBJARMOS_ROT_7_5) || (temp == OBJARMOS_ROT_7_6)) { - if (!func_809A500C(this, this->unk_264) || func_809A4E00(this, globalCtx, 0x5A)) { + if (!func_809A500C(this, this->unk_264) || func_809A4E00(this, play, 0x5A)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else if (func_809A500C(this, this->unk_264)) { - if (func_809A4E00(this, globalCtx, 0x5A)) { + if (func_809A4E00(this, play, 0x5A)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Flags_SetSwitch(globalCtx, OBJARMOS_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJARMOS_GET_7F(&this->dyna.actor)); sp20 = true; } @@ -307,26 +307,26 @@ void func_809A57D8(ObjArmos* this) { this->unk_24C = 4; } -void func_809A57F4(ObjArmos* this, GlobalContext* globalCtx) { +void func_809A57F4(ObjArmos* this, PlayState* play) { if (fabsf(this->dyna.pushForce) > 0.1f) { - GET_PLAYER(globalCtx)->stateFlags2 &= ~0x10; + GET_PLAYER(play)->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; } } -void ObjArmos_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjArmos_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjArmos* this = THIS; s32 sp2C; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; if (this->unk_24C != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 30.0f, 0.0f, this->unk_24C); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 30.0f, 0.0f, this->unk_24C); if ((this->actionFunc == func_809A54E0) && (this->dyna.actor.bgCheckFlags & 1) && - (DynaPoly_GetActor(&globalCtx->colCtx, this->dyna.actor.floorBgId) == NULL)) { + (DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId) == NULL)) { this->unk_24C = 0; } @@ -334,15 +334,15 @@ void ObjArmos_Update(Actor* thisx, GlobalContext* globalCtx2) { this->unk_250.y = this->dyna.actor.world.pos.y + 20.0f; this->unk_250.z = (Math_CosS(this->dyna.actor.shape.rot.y) * -9.0f) + this->dyna.actor.world.pos.z; - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->dyna.actor.floorPoly, - &sp2C, &this->dyna.actor, &this->unk_250); + this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &sp2C, + &this->dyna.actor, &this->unk_250); } } -void func_809A5960(ObjArmos* this, GlobalContext* globalCtx) { +void func_809A5960(ObjArmos* this, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Vec3f sp28; sp28.x = Math_SinS(this->dyna.actor.shape.rot.y); @@ -350,23 +350,23 @@ void func_809A5960(ObjArmos* this, GlobalContext* globalCtx) { (Math_CosS(this->dyna.actor.shape.rot.y) * -9.0f) + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(0.014f, 0.014f, 0.014f, MTXMODE_APPLY); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809A5A3C(ObjArmos* this, GlobalContext* globalCtx) { +void func_809A5A3C(ObjArmos* this, PlayState* play) { s32 pad[2]; MtxF sp48; if (this->dyna.actor.floorPoly != NULL) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); @@ -377,16 +377,16 @@ void func_809A5A3C(ObjArmos* this, GlobalContext* globalCtx) { Matrix_Put(&sp48); Matrix_Scale(0.6f, 1.0f, 0.6f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void ObjArmos_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjArmos_Draw(Actor* thisx, PlayState* play) { ObjArmos* this = THIS; - func_809A5960(this, globalCtx); - func_809A5A3C(this, globalCtx); + func_809A5960(this, play); + func_809A5A3C(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h index 0a03d49159..ab92c6b854 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h @@ -6,7 +6,7 @@ struct ObjArmos; -typedef void (*ObjArmosActionFunc)(struct ObjArmos*, GlobalContext*); +typedef void (*ObjArmosActionFunc)(struct ObjArmos*, PlayState*); #define OBJARMOS_GET_7F(thisx) ((thisx)->params & 0x7F) #define OBJARMOS_GET_ROTZ_7(thisx) ((thisx)->home.rot.z & 7) 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 3ee4be0214..55ff4fe143 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -12,9 +12,9 @@ #define THIS ((ObjBean*)thisx) -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBean_Update(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 func_80937C10(ObjBean* this); void func_80937C24(ObjBean* this); @@ -22,43 +22,43 @@ void func_80937CA0(ObjBean* this); void func_80937CE4(ObjBean* this); void func_80937D54(ObjBean* this); void func_80937DD8(ObjBean* this); -void func_80937DEC(ObjBean* this, GlobalContext* globalCtx); +void func_80937DEC(ObjBean* this, PlayState* play); void func_80937FB0(ObjBean* this); -void func_80937FC8(ObjBean* this, GlobalContext* globalCtx); +void func_80937FC8(ObjBean* this, PlayState* play); void func_809381B0(ObjBean* this); -void func_809381C4(ObjBean* this, GlobalContext* globalCtx); +void func_809381C4(ObjBean* this, PlayState* play); void func_80938284(ObjBean* this); -void func_80938298(ObjBean* this, GlobalContext* globalCtx); +void func_80938298(ObjBean* this, PlayState* play); void func_8093833C(ObjBean* this); -void func_80938358(ObjBean* this, GlobalContext* globalCtx); +void func_80938358(ObjBean* this, PlayState* play); void func_809383B4(ObjBean* this); -void func_809383D0(ObjBean* this, GlobalContext* globalCtx); +void func_809383D0(ObjBean* this, PlayState* play); void func_80938408(ObjBean* this); -void func_80938444(ObjBean* this, GlobalContext* globalCtx); +void func_80938444(ObjBean* this, PlayState* play); void func_809384E8(ObjBean* this); -void func_80938504(ObjBean* this, GlobalContext* globalCtx); +void func_80938504(ObjBean* this, PlayState* play); void func_80938588(ObjBean* this); -void func_809385A8(ObjBean* this, GlobalContext* globalCtx); +void func_809385A8(ObjBean* this, PlayState* play); void func_80938670(ObjBean* this); -void func_8093868C(ObjBean* this, GlobalContext* globalCtx); +void func_8093868C(ObjBean* this, PlayState* play); void func_80938704(ObjBean* this); -void func_80938728(ObjBean* this, GlobalContext* globalCtx); +void func_80938728(ObjBean* this, PlayState* play); void func_8093876C(ObjBean* this); -void func_80938780(ObjBean* this, GlobalContext* globalCtx); +void func_80938780(ObjBean* this, PlayState* play); void func_80938804(ObjBean* this); -void func_80938834(ObjBean* this, GlobalContext* globalCtx); +void func_80938834(ObjBean* this, PlayState* play); void func_80938874(ObjBean* this); -void func_809388A8(ObjBean* this, GlobalContext* globalCtx); +void func_809388A8(ObjBean* this, PlayState* play); void func_8093892C(ObjBean* this); -void func_80938958(ObjBean* this, GlobalContext* globalCtx); -void func_809389BC(ObjBean* this, GlobalContext* globalCtx); +void func_80938958(ObjBean* this, PlayState* play); +void func_809389BC(ObjBean* this, PlayState* play); void func_80938A14(ObjBean* this); -void func_80938A5C(ObjBean* this, GlobalContext* globalCtx); +void func_80938A5C(ObjBean* this, PlayState* play); void func_80938AA4(ObjBean* this); -void func_80938AD8(ObjBean* this, GlobalContext* globalCtx); -void func_80938C1C(Actor* thisx, GlobalContext* globalCtx); -void func_80938E00(Actor* thisx, GlobalContext* globalCtx); -void func_80938F50(Actor* thisx, GlobalContext* globalCtx); +void func_80938AD8(ObjBean* this, PlayState* play); +void func_80938C1C(Actor* thisx, PlayState* play); +void func_80938E00(Actor* thisx, PlayState* play); +void func_80938F50(Actor* thisx, PlayState* play); const ActorInit Obj_Bean_InitVars = { ACTOR_OBJ_BEAN, @@ -119,7 +119,7 @@ static Vec2f D_80938FF8[4] = { { 3.0f, 0.3f }, }; -void func_80936CF0(ObjBean* this, GlobalContext* globalCtx) { +void func_80936CF0(ObjBean* this, PlayState* play) { Vec3f sp24; s32 sp20; @@ -127,10 +127,10 @@ void func_80936CF0(ObjBean* this, GlobalContext* globalCtx) { sp24.y = this->dyna.actor.world.pos.y + 29.999998f; sp24.z = this->dyna.actor.world.pos.z; this->dyna.actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &sp24); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &sp20, &this->dyna.actor, &sp24); } -s32 func_80936D58(ObjBean* this, GlobalContext* globalCtx) { +s32 func_80936D58(ObjBean* this, PlayState* play) { static Vec3f D_80939018 = { 0.0f, 30.0f, 0.0f }; s32 pad; s32 spB8; @@ -147,8 +147,8 @@ s32 func_80936D58(ObjBean* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->dyna.actor.world.pos, &spAC, &spA0); Math_Vec3f_Diff(&this->dyna.actor.world.pos, &spAC, &sp94); - if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &spA0, &sp94, &sp88, &this->dyna.actor.floorPoly, true, true, true, - true, &spB8, &this->dyna.actor)) { + if (BgCheck_EntityLineTest2(&play->colCtx, &spA0, &sp94, &sp88, &this->dyna.actor.floorPoly, true, true, true, true, + &spB8, &this->dyna.actor)) { this->dyna.actor.world.pos.x = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.x) * 1.9f) + sp88.x; this->dyna.actor.world.pos.y = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.y) * 1.9f) + sp88.y; this->dyna.actor.world.pos.z = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.z) * 1.9f) + sp88.z; @@ -212,8 +212,8 @@ void func_80937238(ObjBean* this) { this->dyna.actor.world.pos.z = this->unk_1BC.z + this->unk_1D0; } -void func_80937268(ObjBean* this, GlobalContext* globalCtx) { - this->unk_1D8 = globalCtx->setupPathList[OBJBEAN_GET_3F00(&this->dyna.actor)].count - 1; +void func_80937268(ObjBean* this, PlayState* play) { + this->unk_1D8 = play->setupPathList[OBJBEAN_GET_3F00(&this->dyna.actor)].count - 1; this->unk_1DA = 0; this->unk_1DC = 1; } @@ -259,8 +259,8 @@ void func_809372D0(ObjBean* this) { } } -s32 func_80937468(ObjBean* this, GlobalContext* globalCtx) { - Actor* bgActor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +s32 func_80937468(ObjBean* this, PlayState* play) { + Actor* bgActor = play->actorCtx.actorLists[ACTORCAT_BG].first; while (bgActor != NULL) { if ((bgActor->id == ACTOR_EN_HORSE) && @@ -273,8 +273,8 @@ s32 func_80937468(ObjBean* this, GlobalContext* globalCtx) { return false; } -ObjBean* func_809374F8(ObjBean* this, GlobalContext* globalCtx) { - Actor* bgActor = globalCtx->actorCtx.actorLists[ACTORCAT_BG].first; +ObjBean* func_809374F8(ObjBean* this, PlayState* play) { + Actor* bgActor = play->actorCtx.actorLists[ACTORCAT_BG].first; s32 params = OBJBEAN_GET_3F80(&this->dyna.actor, 0); while (bgActor != NULL) { @@ -293,15 +293,15 @@ ObjBean* func_809374F8(ObjBean* this, GlobalContext* globalCtx) { return (ObjBean*)bgActor; } -void func_809375C8(ObjBean* this, GlobalContext* globalCtx) { - ObjBean* bean = func_809374F8(this, globalCtx); +void func_809375C8(ObjBean* this, PlayState* play) { + ObjBean* bean = func_809374F8(this, play); if (bean != NULL) { bean->unk_200 = 1; } } -void func_809375F4(ObjBean* this, GlobalContext* globalCtx) { +void func_809375F4(ObjBean* this, PlayState* play) { static Gfx* D_80939024[] = { gKakeraLeafMiddle, gKakeraLeafTip, @@ -345,8 +345,8 @@ void func_809375F4(ObjBean* this, GlobalContext* globalCtx) { phi_s3 = -100; phi_v0 = 0x40; } - EffectSsKakera_Spawn(globalCtx, &spC4, &spB8, &spC4, phi_s3, phi_v0, 40, 3, 0, temp_s2, 0, 0, - (temp_s2 >> 3) + 40, -1, GAMEPLAY_KEEP, D_80939024[i & 1]); + EffectSsKakera_Spawn(play, &spC4, &spB8, &spC4, phi_s3, phi_v0, 40, 3, 0, temp_s2, 0, 0, (temp_s2 >> 3) + 40, + -1, GAMEPLAY_KEEP, D_80939024[i & 1]); } } @@ -357,7 +357,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Init(Actor* thisx, PlayState* play) { s32 pad; ObjBean* this = THIS; s32 sp2C = OBJBEAN_GET_C000(&this->dyna.actor); @@ -366,26 +366,26 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1FE = 0; this->unk_1B8 = 0.1f; DynaPolyActor_Init(&this->dyna, 3); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); if ((sp2C == ENOBJBEAN_GET_C000_1) || (sp2C == ENOBJBEAN_GET_C000_2)) { this->dyna.actor.update = func_80938C1C; this->dyna.actor.textId = 0xFD; if (sp2C == ENOBJBEAN_GET_C000_1) { - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit2); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit2); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); } this->dyna.actor.flags |= ACTOR_FLAG_10; func_80937C10(this); - if (!func_80936D58(this, globalCtx)) { + if (!func_80936D58(this, play)) { Actor_MarkForDeath(&this->dyna.actor); } else { - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, 7); + func_800BC154(play, &play->actorCtx, &this->dyna.actor, 7); func_80937DD8(this); } } else { s32 params2 = OBJBEAN_GET_3F00(&this->dyna.actor); - Path* path = &globalCtx->setupPathList[params2]; + Path* path = &play->setupPathList[params2]; this->unk_1DE = OBJBEAN_GET_3(&this->dyna.actor); this->dyna.actor.world.rot.z = 0; @@ -393,37 +393,37 @@ void ObjBean_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0; this->unk_1FE |= 2; - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_mamenoki_Colheader_0004BC); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit1); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_mamenoki_Colheader_0004BC); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit1); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->unk_1D4 = Lib_SegmentedToVirtual(path->points); - func_80937268(this, globalCtx); + func_80937268(this, play); func_809372A8(this); func_80937238(this); ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 8.8f); - func_80936CF0(this, globalCtx); + func_80936CF0(this, play); - if (!OBJBEAN_GET_80(&this->dyna.actor) && Flags_GetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 0)) && - !Flags_GetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 1)) && func_800FE9B4(globalCtx)) { - Flags_SetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 1)); + if (!OBJBEAN_GET_80(&this->dyna.actor) && Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0)) && + !Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1)) && func_800FE9B4(play)) { + Flags_SetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1)); } - if (OBJBEAN_GET_80(&this->dyna.actor) || Flags_GetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 1))) { + if (OBJBEAN_GET_80(&this->dyna.actor) || Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1))) { func_80938804(this); } else { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); func_80938704(this); } } } -void ObjBean_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Destroy(Actor* thisx, PlayState* play) { ObjBean* this = THIS; - 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_80937B54(ObjBean* this) { @@ -487,14 +487,14 @@ void func_80937DD8(ObjBean* this) { this->actionFunc = func_80937DEC; } -void func_80937DEC(ObjBean* this, GlobalContext* globalCtx) { +void func_80937DEC(ObjBean* this, PlayState* play) { s32 pad; s32 sp20 = OBJBEAN_GET_C000(&this->dyna.actor); if (sp20 == ENOBJBEAN_GET_C000_1) { s32 pad2; - if (func_809374F8(this, globalCtx) == NULL) { + if (func_809374F8(this, play) == NULL) { this->unk_1FF = false; } else { this->unk_1FF = true; @@ -503,12 +503,12 @@ void func_80937DEC(ObjBean* this, GlobalContext* globalCtx) { this->unk_1FF = false; } - if (this->unk_1FF && !Flags_GetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 1)) && - Flags_GetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 0)) && func_800FE9B4(globalCtx)) { - Flags_SetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); + if (this->unk_1FF && !Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)) && + Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0)) && func_800FE9B4(play)) { + Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); } - if (this->unk_1FF && Flags_GetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 1))) { + if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1))) { Actor_MarkForDeath(&this->dyna.actor); return; } @@ -519,7 +519,7 @@ void func_80937DEC(ObjBean* this, GlobalContext* globalCtx) { this->dyna.actor.draw = func_80938E00; } - if (this->unk_1FF && Flags_GetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 0))) { + if (this->unk_1FF && Flags_GetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0))) { this->unk_1FE |= 5; func_80937C30(this); } else { @@ -527,7 +527,7 @@ void func_80937DEC(ObjBean* this, GlobalContext* globalCtx) { func_80937C10(this); } - if (Flags_GetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { + if (Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { this->unk_1E4 = 5; } else { this->unk_1E4 = 0; @@ -541,16 +541,16 @@ void func_80937FB0(ObjBean* this) { this->actionFunc = func_80937FC8; } -void func_80937FC8(ObjBean* this, GlobalContext* globalCtx) { +void func_80937FC8(ObjBean* this, PlayState* play) { this->unk_1E8(this); - if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { - if (Player_GetExchangeItemId(globalCtx) == EXCH_ITEM_2E) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_2E) { func_809383B4(this); - Flags_SetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 0)); + Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0)); } - if (Flags_GetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { + if (Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0))) { this->unk_1E4 = 5; } else { s32 pad; @@ -563,19 +563,19 @@ void func_80937FC8(ObjBean* this, GlobalContext* globalCtx) { } else if (((this->collider.base.acFlags & AC_HIT) && (this->collider.base.ac != NULL) && (this->collider.base.ac->id == ACTOR_OBJ_AQUA)) || ((this->unk_1FF != 0) && (this->unk_1FE & 4) && (this->dyna.actor.xzDistToPlayer < 300.0f) && - func_800FE9B4(globalCtx))) { - func_809375C8(this, globalCtx); - Flags_SetSwitch(globalCtx, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); + func_800FE9B4(play))) { + func_809375C8(this, play); + Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 1)); this->unk_1E4 = 6; func_80938670(this); } else if (this->unk_1FF != 0) { if (this->unk_1FE & 4) { this->collider.base.acFlags &= ~AC_HIT; if (this->dyna.actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } else { - func_800B85E0(&this->dyna.actor, globalCtx, 28.0f, 0x2E); + func_800B85E0(&this->dyna.actor, play, 28.0f, 0x2E); } } } @@ -584,13 +584,13 @@ void func_809381B0(ObjBean* this) { this->actionFunc = func_809381C4; } -void func_809381C4(ObjBean* this, GlobalContext* globalCtx) { +void func_809381C4(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); if (this->dyna.actor.cutscene >= 0) { - func_800B7298(globalCtx, &this->dyna.actor, 1); + func_800B7298(play, &this->dyna.actor, 1); } this->unk_1E4 = 2; func_80938284(this); @@ -608,12 +608,12 @@ void func_80938284(ObjBean* this) { this->actionFunc = func_80938298; } -void func_80938298(ObjBean* this, GlobalContext* globalCtx) { +void func_80938298(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (this->unk_1E0 >= 3) { this->unk_1E4 = 3; - Flags_SetSwitch(globalCtx, OBJBEAN_GET_7F(&this->dyna.actor, 0)); + Flags_SetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 0)); this->unk_1E4 = 5; func_8093833C(this); } else if (this->unk_1E4 == 4) { @@ -629,7 +629,7 @@ void func_8093833C(ObjBean* this) { this->unk_1B2 = 4; } -void func_80938358(ObjBean* this, GlobalContext* globalCtx) { +void func_80938358(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (this->unk_1B2 <= 0) { @@ -643,7 +643,7 @@ void func_809383B4(ObjBean* this) { this->actionFunc = func_809383D0; } -void func_809383D0(ObjBean* this, GlobalContext* globalCtx) { +void func_809383D0(ObjBean* this, PlayState* play) { if (this->unk_1B2 <= 0) { this->unk_1FE |= 4; func_80938408(this); @@ -655,7 +655,7 @@ void func_80938408(ObjBean* this) { this->actionFunc = func_80938444; } -void func_80938444(ObjBean* this, GlobalContext* globalCtx) { +void func_80938444(ObjBean* this, PlayState* play) { s32 pad; s32 sp20 = Math_StepToF(&this->dyna.actor.scale.y, 0.16672663f, 0.01f) & 1; @@ -677,7 +677,7 @@ void func_809384E8(ObjBean* this) { this->actionFunc = func_80938504; } -void func_80938504(ObjBean* this, GlobalContext* globalCtx) { +void func_80938504(ObjBean* this, PlayState* play) { this->unk_1AC -= 2400; this->dyna.actor.scale.y = Math_SinS(this->unk_1AC) * 0.17434467f; this->dyna.actor.scale.x = this->dyna.actor.scale.z = Math_CosS(this->unk_1AC) * 0.12207746f; @@ -692,7 +692,7 @@ void func_80938588(ObjBean* this) { this->actionFunc = func_809385A8; } -void func_809385A8(ObjBean* this, GlobalContext* globalCtx) { +void func_809385A8(ObjBean* this, PlayState* play) { s32 pad; s16 sp22; @@ -712,7 +712,7 @@ void func_80938670(ObjBean* this) { this->unk_1B2 = 73; } -void func_8093868C(ObjBean* this, GlobalContext* globalCtx) { +void func_8093868C(ObjBean* this, PlayState* play) { if (this->unk_1B2 <= 0) { Actor_MarkForDeath(&this->dyna.actor); } else if (this->unk_1B2 <= 20) { @@ -729,7 +729,7 @@ void func_80938704(ObjBean* this) { this->actionFunc = func_80938728; } -void func_80938728(ObjBean* this, GlobalContext* globalCtx) { +void func_80938728(ObjBean* this, PlayState* play) { if (this->unk_200 != 0) { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); func_8093876C(this); @@ -740,11 +740,11 @@ void func_8093876C(ObjBean* this) { this->actionFunc = func_80938780; } -void func_80938780(ObjBean* this, GlobalContext* globalCtx) { +void func_80938780(ObjBean* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); if (this->dyna.actor.cutscene >= 0) { - func_800B7298(globalCtx, &this->dyna.actor, 1); + func_800B7298(play, &this->dyna.actor, 1); } this->unk_1B4 = 36; func_80937130(this); @@ -760,7 +760,7 @@ void func_80938804(ObjBean* this) { this->actionFunc = func_80938834; } -void func_80938834(ObjBean* this, GlobalContext* globalCtx) { +void func_80938834(ObjBean* this, PlayState* play) { if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { func_80938874(this); } @@ -774,10 +774,10 @@ void func_80938874(ObjBean* this) { this->dyna.actor.speedXZ = 0.0f; } -void func_809388A8(ObjBean* this, GlobalContext* globalCtx) { +void func_809388A8(ObjBean* this, PlayState* play) { func_809372D0(this); if (this->unk_1DA == this->unk_1D8) { - func_80937268(this, globalCtx); + func_80937268(this, play); func_809372A8(this); func_8093892C(this); } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { @@ -792,7 +792,7 @@ void func_8093892C(ObjBean* this) { this->actionFunc = func_80938958; } -void func_80938958(ObjBean* this, GlobalContext* globalCtx) { +void func_80938958(ObjBean* this, PlayState* play) { if (!DynaPolyActor_IsInRidingRotatingState(&this->dyna)) { func_80938804(this); } @@ -805,9 +805,9 @@ void func_80938998(ObjBean* this) { this->actionFunc = func_809389BC; } -void func_809389BC(ObjBean* this, GlobalContext* globalCtx) { +void func_809389BC(ObjBean* this, PlayState* play) { if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { - func_80937268(this, globalCtx); + func_80937268(this, play); func_809372A8(this); func_80937238(this); func_80938A14(this); @@ -822,8 +822,8 @@ void func_80938A14(ObjBean* this) { this->actionFunc = func_80938A5C; } -void func_80938A5C(ObjBean* this, GlobalContext* globalCtx) { - if (func_80937468(this, globalCtx)) { +void func_80938A5C(ObjBean* this, PlayState* play) { + if (func_80937468(this, play)) { this->unk_1B2 = 100; } else if (this->unk_1B2 <= 0) { func_80938AA4(this); @@ -837,9 +837,9 @@ void func_80938AA4(ObjBean* this) { this->actionFunc = func_80938AD8; } -void func_80938AD8(ObjBean* this, GlobalContext* globalCtx) { +void func_80938AD8(ObjBean* this, PlayState* play) { s32 pad; - s32 sp30 = func_80937468(this, globalCtx); + s32 sp30 = func_80937468(this, play); func_80937160(this); if (this->unk_1B2 == 25) { @@ -847,13 +847,13 @@ void func_80938AD8(ObjBean* this, GlobalContext* globalCtx) { } if (sp30 != 0) { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->dyna.actor.xzDistToPlayer < 74.0f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 sp28 = 74.0f - this->dyna.actor.xzDistToPlayer; f32 sin; f32 cos; @@ -875,7 +875,7 @@ void func_80938AD8(ObjBean* this, GlobalContext* globalCtx) { } } -void func_80938C1C(Actor* thisx, GlobalContext* globalCtx) { +void func_80938C1C(Actor* thisx, PlayState* play) { ObjBean* this = THIS; if (this->unk_1B2 > 0) { @@ -889,10 +889,10 @@ void func_80938C1C(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBean_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBean* this = THIS; @@ -900,7 +900,7 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_1B2--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->unk_1B4 > 0) { this->unk_1B4--; @@ -914,14 +914,14 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { 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); } - func_80936CF0(this, globalCtx); + func_80936CF0(this, play); this->dyna.actor.shape.shadowDraw = ActorShadow_DrawCircle; this->dyna.actor.shape.shadowScale = this->dyna.actor.scale.x * 88.0f; - if (func_80937468(this, globalCtx)) { - func_809375F4(this, globalCtx); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (func_80937468(this, play)) { + func_809375F4(this, play); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); func_80938998(this); } } else { @@ -930,14 +930,14 @@ void ObjBean_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->dyna.actor, 6.0f); } -void func_80938E00(Actor* thisx, GlobalContext* globalCtx) { +void func_80938E00(Actor* thisx, PlayState* play) { ObjBean* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_1FE & 4) { gSPDisplayList(POLY_OPA_DISP++, object_mamenoki_DL_000090); @@ -952,15 +952,15 @@ void func_80938E00(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->unk_1B8, this->unk_1B8, this->unk_1B8, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_mamenoki_DL_000530); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80938F50(Actor* thisx, GlobalContext* globalCtx) { +void func_80938F50(Actor* thisx, PlayState* play) { ObjBean* this = THIS; - Gfx_DrawDListXlu(globalCtx, object_mamenoki_DL_002208); + Gfx_DrawDListXlu(play, object_mamenoki_DL_002208); } 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 da6e4a22c4..7ff2610aa4 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -5,7 +5,7 @@ struct ObjBean; -typedef void (*ObjBeanActionFunc)(struct ObjBean*, GlobalContext*); +typedef void (*ObjBeanActionFunc)(struct ObjBean*, PlayState*); typedef void (*ObjBeanUnkFunc)(struct ObjBean*); #define OBJBEAN_GET_7F(thisx, x) (((thisx)->params + (x)) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c index 6023111164..d57c9937d2 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c @@ -11,13 +11,13 @@ #define THIS ((ObjBell*)thisx) -void ObjBell_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBell_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBell_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBell_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBell_Init(Actor* thisx, PlayState* play); +void ObjBell_Destroy(Actor* thisx, PlayState* play); +void ObjBell_Update(Actor* thisx, PlayState* play); +void ObjBell_Draw(Actor* thisx, PlayState* play); s32 func_80A356D8(ObjBell* this); -s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx); +s32 func_80A357A8(ObjBell* this, PlayState* play); const ActorInit Obj_Bell_InitVars = { ACTOR_OBJ_BELL, @@ -165,7 +165,7 @@ s32 func_80A356D8(ObjBell* this) { return false; } -s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) { +s32 func_80A357A8(ObjBell* this, PlayState* play) { f32 temp_f0; s16 temp_v1; @@ -176,7 +176,7 @@ s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) { if (ABS_ALT(temp_v1) < 0x3FFC) { if (this->unk_214 == 0) { if (temp_f0 > 0.18f) { - func_800B8D98(globalCtx, &this->dyna.actor, 8.0f * temp_f0, this->dyna.actor.yawTowardsPlayer, + func_800B8D98(play, &this->dyna.actor, 8.0f * temp_f0, this->dyna.actor.yawTowardsPlayer, 11.0f * temp_f0); this->unk_214 = 30; } @@ -203,16 +203,16 @@ s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) { return false; } -void func_80A358FC(ObjBell* this, GlobalContext* globalCtx) { +void func_80A358FC(ObjBell* this, PlayState* play) { this->collider1.dim.worldSphere.radius = (this->collider1.dim.modelSphere.radius * this->collider1.dim.scale); this->collider2.dim.worldSphere.radius = (this->collider2.dim.modelSphere.radius * this->collider2.dim.scale); if (DECR(this->unk_20E) == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.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); } -void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A359B4(Actor* thisx, PlayState* play) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); Matrix_Translate(0.0f, 2600.0f, 0.0f, MTXMODE_APPLY); @@ -220,75 +220,75 @@ void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateXS(thisx->world.rot.x, MTXMODE_APPLY); Matrix_RotateYS(-thisx->world.rot.y, MTXMODE_APPLY); Matrix_Translate(0.0f, -2600.0f, 0.0f, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_f52_obj_DL_000698); gSPDisplayList(POLY_OPA_DISP++, object_f52_obj_DL_0008D0); gSPDisplayList(POLY_OPA_DISP++, object_f52_obj_DL_000960); gSPDisplayList(POLY_OPA_DISP++, object_f52_obj_DL_0007A8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A35B18(Actor* thisx, GlobalContext* globalCtx) { +void func_80A35B18(Actor* thisx, PlayState* play) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); Matrix_RotateYS(thisx->shape.rot.y, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_f52_obj_DL_000570); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A35BD4(Actor* thisx, GlobalContext* globalCtx) { +void func_80A35BD4(Actor* thisx, PlayState* play) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y - 4.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_f52_obj_DL_000840); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjBell_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBell_Init(Actor* thisx, PlayState* play) { ObjBell* this = THIS; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_f52_obj_Colheader_001BA8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_f52_obj_Colheader_001BA8); Actor_SetScale(&this->dyna.actor, 0.08f); - Collider_InitAndSetSphere(globalCtx, &this->collider1, &this->dyna.actor, &sCylinderInit1); - Collider_InitAndSetSphere(globalCtx, &this->collider2, &this->dyna.actor, &sCylinderInit2); + Collider_InitAndSetSphere(play, &this->collider1, &this->dyna.actor, &sCylinderInit1); + Collider_InitAndSetSphere(play, &this->collider2, &this->dyna.actor, &sCylinderInit2); CollisionCheck_SetInfo2(&this->dyna.actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); } -void ObjBell_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBell_Destroy(Actor* thisx, PlayState* play) { ObjBell* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_DestroySphere(globalCtx, &this->collider1); - Collider_DestroySphere(globalCtx, &this->collider2); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroySphere(play, &this->collider1); + Collider_DestroySphere(play, &this->collider2); } -void ObjBell_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBell_Update(Actor* thisx, PlayState* play) { ObjBell* this = THIS; if (this->unk_214 != 0) { this->unk_214--; } - func_80A357A8(this, globalCtx); + func_80A357A8(this, play); func_80A356D8(this); - func_80A358FC(this, globalCtx); + func_80A358FC(this, play); } -void ObjBell_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBell_Draw(Actor* thisx, PlayState* play) { ObjBell* this = THIS; Vec3f sp30; Vec3f sp24; - func_80A35B18(thisx, globalCtx); - func_80A35BD4(thisx, globalCtx); - func_80A359B4(thisx, globalCtx); + func_80A35B18(thisx, play); + func_80A35BD4(thisx, play); + func_80A359B4(thisx, play); Math_Vec3s_ToVec3f(&sp30, &this->collider1.dim.modelSphere.center); Matrix_MultVec3f(&sp30, &sp24); Math_Vec3f_ToVec3s(&this->collider1.dim.worldSphere.center, &sp24); diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index 8a1ae2df7b..e1edaf0f76 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -12,16 +12,16 @@ #define THIS ((ObjBigicicle*)thisx) -void ObjBigicicle_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBigicicle_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBigicicle_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBigicicle_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBigicicle_Init(Actor* thisx, PlayState* play); +void ObjBigicicle_Destroy(Actor* thisx, PlayState* play); +void ObjBigicicle_Update(Actor* thisx, PlayState* play); +void ObjBigicicle_Draw(Actor* thisx, PlayState* play); -void func_80AE8FD4(ObjBigicicle* this, GlobalContext* globalCtx); -void func_80AE9090(ObjBigicicle* this, GlobalContext* globalCtx); -void func_80AE9180(ObjBigicicle* this, GlobalContext* globalCtx); -void func_80AE9258(ObjBigicicle* this, GlobalContext* globalCtx); -void func_80AE939C(ObjBigicicle* this, GlobalContext* globalCtx); +void func_80AE8FD4(ObjBigicicle* this, PlayState* play); +void func_80AE9090(ObjBigicicle* this, PlayState* play); +void func_80AE9180(ObjBigicicle* this, PlayState* play); +void func_80AE9258(ObjBigicicle* this, PlayState* play); +void func_80AE939C(ObjBigicicle* this, PlayState* play); const ActorInit Obj_Bigicicle_InitVars = { ACTOR_OBJ_BIGICICLE, @@ -97,7 +97,7 @@ Gfx* D_80AE98A8[] = { object_bigicicle_DL_000F40, }; -void ObjBigicicle_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBigicicle_Init(Actor* thisx, PlayState* play) { ObjBigicicle* this = THIS; f32 sp30; s32 sp28; @@ -114,17 +114,17 @@ void ObjBigicicle_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; sp30 = sp28 * (1.0f / 60.0f); - Collider_InitAndSetCylinder(globalCtx, &this->collider1, &this->actor, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); this->collider1.dim.radius = this->collider1.dim.radius * sp30; this->collider1.dim.height = this->collider1.dim.height * sp30; this->collider1.dim.yShift = this->collider1.dim.yShift * sp30; - Collider_InitAndSetCylinder(globalCtx, &this->collider2, &this->actor, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); this->collider2.dim.radius = this->collider2.dim.radius * sp30; this->collider2.dim.height = this->collider2.dim.height * sp30; this->collider2.dim.yShift = this->collider2.dim.yShift * sp30; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Actor_MarkForDeath(&this->actor); return; } @@ -144,14 +144,14 @@ void ObjBigicicle_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80AE8FD4; } -void ObjBigicicle_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBigicicle_Destroy(Actor* thisx, PlayState* play) { ObjBigicicle* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider1); - Collider_DestroyCylinder(globalCtx, &this->collider2); + Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->collider2); } -void func_80AE8DE4(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE8DE4(ObjBigicicle* this, PlayState* play) { s32 i; Vec3f sp98; Vec3f sp8C; @@ -166,7 +166,7 @@ void func_80AE8DE4(ObjBigicicle* this, GlobalContext* globalCtx) { sp8C.y = Rand_ZeroFloat(2.0f); sp8C.z = randPlusMinusPoint5Scaled(13.0f); - EffectSsHahen_Spawn(globalCtx, &sp98, &sp8C, &D_80AE987C, 2, (Rand_ZeroFloat(20.0f) + 30.0f) * temp_f20, + EffectSsHahen_Spawn(play, &sp98, &sp8C, &D_80AE987C, 2, (Rand_ZeroFloat(20.0f) + 30.0f) * temp_f20, OBJECT_BIGICICLE, 0x28, object_bigicicle_DL_0009B0); } @@ -174,10 +174,10 @@ void func_80AE8DE4(ObjBigicicle* this, GlobalContext* globalCtx) { sp98.y = this->actor.world.pos.y - (25.0f * temp_f20); sp98.z = this->actor.world.pos.z; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &sp98, 40, NA_SE_EV_ICE_PIECE); + SoundSource_PlaySfxAtFixedWorldPos(play, &sp98, 40, NA_SE_EV_ICE_PIECE); } -void func_80AE8FD4(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE8FD4(ObjBigicicle* this, PlayState* play) { if ((this->collider1.base.acFlags & AC_HIT) || ((this->collider2.base.acFlags & AC_HIT) && (this->collider2.info.acHitInfo->toucher.dmgFlags & 0x3820))) { if ((this->unk_148 == 0) || (this->unk_149 == 1)) { @@ -186,18 +186,18 @@ void func_80AE8FD4(ObjBigicicle* this, GlobalContext* globalCtx) { return; } - func_80AE8DE4(this, globalCtx); + func_80AE8DE4(this, play); this->unk_149++; this->unk_14A = 50; this->actionFunc = func_80AE9180; } } -void func_80AE9090(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE9090(ObjBigicicle* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->unk_149++; - func_80AE8DE4(this, globalCtx); + func_80AE8DE4(this, play); if (this->unk_149 == 2) { f32 temp_f0 = this->actor.scale.y * 2100.0f; @@ -216,7 +216,7 @@ void func_80AE9090(ObjBigicicle* this, GlobalContext* globalCtx) { } } -void func_80AE9180(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE9180(ObjBigicicle* this, PlayState* play) { this->unk_14A--; if (this->unk_14A > 0) { @@ -231,15 +231,15 @@ void func_80AE9180(ObjBigicicle* this, GlobalContext* globalCtx) { } } -void func_80AE9258(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE9258(ObjBigicicle* this, PlayState* play) { Actor* itemAction; f32 temp_f0; ObjIcePoly* icePoly; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - itemAction = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (itemAction != NULL) { if (itemAction->id == ACTOR_OBJ_ICE_POLY) { @@ -247,7 +247,7 @@ void func_80AE9258(ObjBigicicle* this, GlobalContext* globalCtx) { temp_f0 = this->actor.world.pos.y - icePoly->actor.world.pos.y; if ((temp_f0 < icePoly->colliders1[0].dim.height) && (temp_f0 > 0.0f) && (Actor_XZDistanceBetweenActors(&this->actor, &icePoly->actor) < icePoly->colliders1[0].dim.radius)) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); this->actionFunc = func_80AE939C; return; } @@ -263,7 +263,7 @@ void func_80AE9258(ObjBigicicle* this, GlobalContext* globalCtx) { } } -void func_80AE939C(ObjBigicicle* this, GlobalContext* globalCtx) { +void func_80AE939C(ObjBigicicle* this, PlayState* play) { s32 i; Vec3f sp98; Vec3f sp8C; @@ -278,21 +278,21 @@ void func_80AE939C(ObjBigicicle* this, GlobalContext* globalCtx) { sp98.y = this->actor.world.pos.y + (sp8C.y * 7.0f * temp_f20); sp98.z = this->actor.world.pos.z + (sp8C.z * 5.0f * temp_f20); - EffectSsHahen_Spawn(globalCtx, &sp98, &sp8C, &D_80AE987C, 2, (Rand_ZeroFloat(30.0f) + 40.0f) * temp_f20, + EffectSsHahen_Spawn(play, &sp98, &sp8C, &D_80AE987C, 2, (Rand_ZeroFloat(30.0f) + 40.0f) * temp_f20, OBJECT_BIGICICLE, 30, object_bigicicle_DL_0009B0); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_GLASSBROKEN_IMPACT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_GLASSBROKEN_IMPACT); ActorCutscene_Stop(this->actor.cutscene); Actor_MarkForDeath(&this->actor); } -void ObjBigicicle_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBigicicle_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBigicicle* this = THIS; Vec3f sp44; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (Rand_ZeroOne() < 0.05f) { sp44.x = (((215.0f + Rand_ZeroFloat(65.0f)) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)) * this->actor.scale.x) + @@ -302,20 +302,20 @@ void ObjBigicicle_Update(Actor* thisx, GlobalContext* globalCtx) { sp44.z = (((215.0f + Rand_ZeroFloat(65.0f)) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)) * this->actor.scale.z) + this->actor.world.pos.z; - EffectSsKirakira_SpawnDispersed(globalCtx, &sp44, &gZeroVec3f, &gZeroVec3f, &D_80AE9894, &D_80AE9898, 2000, 5); + EffectSsKirakira_SpawnDispersed(play, &sp44, &gZeroVec3f, &gZeroVec3f, &D_80AE9894, &D_80AE9898, 2000, 5); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); } -void ObjBigicicle_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBigicicle_Draw(Actor* thisx, PlayState* play) { ObjBigicicle* this = THIS; - Gfx_DrawDListXlu(globalCtx, D_80AE989C[this->unk_149]); - Gfx_DrawDListXlu(globalCtx, D_80AE98A8[this->unk_149]); - AnimatedMat_Draw(globalCtx, D_80AE9878); - Gfx_DrawDListXlu(globalCtx, object_bigicicle_DL_0014F0); + Gfx_DrawDListXlu(play, D_80AE989C[this->unk_149]); + Gfx_DrawDListXlu(play, D_80AE98A8[this->unk_149]); + AnimatedMat_Draw(play, D_80AE9878); + Gfx_DrawDListXlu(play, object_bigicicle_DL_0014F0); } diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h index 1744a81b46..3023ab0854 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.h @@ -5,7 +5,7 @@ struct ObjBigicicle; -typedef void (*ObjBigicicleActionFunc)(struct ObjBigicicle*, GlobalContext*); +typedef void (*ObjBigicicleActionFunc)(struct ObjBigicicle*, PlayState*); #define OBJBIGICLE_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) 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 2d3a6f2d54..9c35b0298a 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -11,11 +11,11 @@ #define THIS ((ObjBlockstop*)thisx) -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjBlockstop_Init(Actor* thisx, PlayState* play); +void ObjBlockstop_Update(Actor* thisx, PlayState* play); -void ObjBlockstop_CheckForBlock(ObjBlockstop* this, GlobalContext* globalCtx); -void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, GlobalContext* globalCtx); +void ObjBlockstop_CheckForBlock(ObjBlockstop* this, PlayState* play); +void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, PlayState* play); const ActorInit Obj_Blockstop_InitVars = { ACTOR_OBJ_BLOCKSTOP, @@ -29,17 +29,17 @@ const ActorInit Obj_Blockstop_InitVars = { (ActorFunc)NULL, }; -void ObjBlockstop_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Init(Actor* thisx, PlayState* play) { ObjBlockstop* this = THIS; - if (Flags_GetSwitch(globalCtx, this->actor.params)) { + if (Flags_GetSwitch(play, this->actor.params)) { Actor_MarkForDeath(&this->actor); } this->actionFunc = ObjBlockstop_CheckForBlock; } -void ObjBlockstop_CheckForBlock(ObjBlockstop* this, GlobalContext* globalCtx) { - Actor* prop = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void ObjBlockstop_CheckForBlock(ObjBlockstop* this, PlayState* play) { + Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (prop != NULL) { if ((prop->id == ACTOR_OBJ_OSHIHIKI) && (fabsf(prop->world.pos.x - this->actor.world.pos.x) < 20.0f) && @@ -56,9 +56,9 @@ void ObjBlockstop_CheckForBlock(ObjBlockstop* this, GlobalContext* globalCtx) { } } -void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, GlobalContext* globalCtx) { +void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - Flags_SetSwitch(globalCtx, this->actor.params); + Flags_SetSwitch(play, this->actor.params); if (ActorCutscene_GetLength(this->actor.cutscene) != -1) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } @@ -68,8 +68,8 @@ void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, GlobalContext* globalCtx) ActorCutscene_SetIntentToPlay(this->actor.cutscene); } -void ObjBlockstop_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBlockstop_Update(Actor* thisx, PlayState* play) { ObjBlockstop* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h index 6f9f6439ec..6f191f79af 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h @@ -5,7 +5,7 @@ struct ObjBlockstop; -typedef void (*ObjBlockstopActionFunc)(struct ObjBlockstop*, GlobalContext*); +typedef void (*ObjBlockstopActionFunc)(struct ObjBlockstop*, PlayState*); typedef struct ObjBlockstop { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index bda85a4506..0380b338d3 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -11,12 +11,12 @@ #define THIS ((ObjBoat*)thisx) -void ObjBoat_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBoat_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBoat_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjBoat_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBoat_Init(Actor* thisx, PlayState* play); +void ObjBoat_Destroy(Actor* thisx, PlayState* play); +void ObjBoat_Update(Actor* thisx, PlayState* play); +void ObjBoat_Draw(Actor* thisx, PlayState* play); -void func_80B9B428(Actor* thisx, GlobalContext* globalCtx); +void func_80B9B428(Actor* thisx, PlayState* play); const ActorInit Obj_Boat_InitVars = { ACTOR_OBJ_BOAT, @@ -47,7 +47,7 @@ s16 func_80B9AF50(ObjBoat* this, Vec3f* arg0) { return ((this->unk_15D > 0) ? yaw : (yaw + 0x8000)); } -void ObjBoat_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoat_Init(Actor* thisx, PlayState* play) { s32 pad[2]; Path* path; ObjBoat* this = THIS; @@ -55,11 +55,11 @@ void ObjBoat_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 3); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_kaizoku_obj_Colheader_009A88); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_kaizoku_obj_Colheader_009A88); if (thisx->params < 0) { this->dyna.actor.update = func_80B9B428; } else { - path = &globalCtx->setupPathList[OBJBOAT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJBOAT_GET_PATH(thisx)]; this->unk_163 = path->count - 1; this->unk_164 = Lib_SegmentedToVirtual(path->points); this->unk_15D = 1; @@ -71,10 +71,10 @@ void ObjBoat_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjBoat_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoat_Destroy(Actor* thisx, PlayState* play) { ObjBoat* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B9B124(ObjBoat* this) { @@ -84,10 +84,10 @@ void func_80B9B124(ObjBoat* this) { this->dyna.actor.shape.rot.z = Math_SinS(this->unk_160 * 2) * 50.0f; } -void ObjBoat_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoat_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBoat* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 temp = DynaPolyActor_IsInRidingMovingState(&this->dyna); f32 sp3C = 0.0f; s16 sp3A = this->dyna.actor.shape.rot.y; @@ -136,19 +136,19 @@ void ObjBoat_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B9B124(this); } -void func_80B9B428(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80B9B428(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjBoat* this = THIS; - if (Cutscene_CheckActorAction(globalCtx, 511)) { - CsCmdActorAction* actionIndex = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 511)]; + if (Cutscene_CheckActorAction(play, 511)) { + CsCmdActorAction* actionIndex = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 511)]; if (this->unk_15F != actionIndex->action) { this->dyna.actor.shape.rot.x = actionIndex->urot.x; if (actionIndex->action != 1) { - Path* path = &globalCtx->setupPathList[OBJBOAT_GET_PATH(&this->dyna.actor)]; + Path* path = &play->setupPathList[OBJBOAT_GET_PATH(&this->dyna.actor)]; if (actionIndex->action == 3) { - path = &globalCtx->setupPathList[path->unk1]; + path = &play->setupPathList[path->unk1]; } this->unk_163 = path->count; this->unk_164 = Lib_SegmentedToVirtual(path->points); @@ -184,8 +184,8 @@ void func_80B9B428(Actor* thisx, GlobalContext* globalCtx2) { } } -void ObjBoat_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoat_Draw(Actor* thisx, PlayState* play) { ObjBoat* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_kaizoku_obj_DL_007630); + Gfx_DrawDListOpa(play, object_kaizoku_obj_DL_007630); } 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 8cf2039b4f..8706fd696a 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -11,18 +11,18 @@ #define THIS ((ObjBombiwa*)thisx) -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjBombiwa_Init(Actor* thisx, PlayState* play); +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play); +void ObjBombiwa_Update(Actor* thisx, PlayState* play); s32 func_809393B0(Actor* thisx); s32 func_80939470(Actor* thisx); void func_80939EE0(ObjBombiwa* this); -void func_80939EF4(ObjBombiwa* this, GlobalContext* globalCtx); +void func_80939EF4(ObjBombiwa* this, PlayState* play); void func_8093A080(ObjBombiwa* this); -void func_8093A1F0(ObjBombiwa* this, GlobalContext* globalCtx); -void func_8093A418(Actor* thisx, GlobalContext* globalCtx); -void func_8093A608(Actor* thisx, GlobalContext* globalCtx); +void func_8093A1F0(ObjBombiwa* this, PlayState* play); +void func_8093A418(Actor* thisx, PlayState* play); +void func_8093A608(Actor* thisx, PlayState* play); const ActorInit Obj_Bombiwa_InitVars = { ACTOR_OBJ_BOMBIWA, @@ -146,21 +146,21 @@ s32 func_80939470(Actor* thisx) { return false; } -s32 func_8093951C(ObjBombiwa* this, GlobalContext* globalCtx) { +s32 func_8093951C(ObjBombiwa* this, PlayState* play) { s32 pad; WaterBox* sp30; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, - &sp30, &sp28) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + &sp28) && (this->actor.world.pos.y < sp2C)) { return true; } return false; } -void func_80939594(ObjBombiwa* this, GlobalContext* globalCtx) { +void func_80939594(ObjBombiwa* this, PlayState* play) { s32 pad; Vec3f sp28; s32 sp24; @@ -170,24 +170,24 @@ void func_80939594(ObjBombiwa* this, GlobalContext* globalCtx) { sp28.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp24, &this->actor, &sp28); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp24, &this->actor, &sp28); } -void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Init(Actor* thisx, PlayState* play) { s32 pad; ObjBombiwa* this = THIS; s32 sp34 = OBJBOMBIWA_GET_100(&this->actor); s32 pad2; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(globalCtx, OBJBOMBIWA_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, OBJBOMBIWA_GET_7F(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, D_8093A998[sp34].collider); + Collider_SetCylinder(play, &this->collider, &this->actor, D_8093A998[sp34].collider); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -195,22 +195,22 @@ void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.world.rot.y = Rand_Next() >> 0x10; } - func_80939594(this, globalCtx); + func_80939594(this, play); } ActorShape_Init(&this->actor.shape, -200.0f, D_8093A998[sp34].unk_04, 9.8f); this->actor.world.pos.y = this->actor.home.pos.y + 20.0f; this->actor.draw = D_8093A998[sp34].unk_08; - if (func_8093951C(this, globalCtx)) { + if (func_8093951C(this, play)) { this->unk_203 |= 1; } func_80939EE0(this); } -void ObjBombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &THIS->collider); +void ObjBombiwa_Destroy(Actor* thisx, PlayState* play) { + Collider_DestroyCylinder(play, &THIS->collider); } -void func_80939794(ObjBombiwa* this, GlobalContext* globalCtx) { +void func_80939794(ObjBombiwa* this, PlayState* play) { Vec3f spB4; Vec3f spA8; s32 phi_v1; @@ -230,14 +230,14 @@ void func_80939794(ObjBombiwa* this, GlobalContext* globalCtx) { } else { phi_v1 = 0x21; } - EffectSsKakera_Spawn(globalCtx, &spB4, &spA8, &spB4, -400, phi_v1, 10, 2, 0, D_8093A9D0[i], 1, 0, 60, -1, + EffectSsKakera_Spawn(play, &spB4, &spA8, &spB4, -400, phi_v1, 10, 2, 0, D_8093A9D0[i], 1, 0, 60, -1, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); } - func_800BBFB0(globalCtx, &this->actor.world.pos, 60.0f, 8, 80, 140, 1); + func_800BBFB0(play, &this->actor.world.pos, 60.0f, 8, 80, 140, 1); } -void func_80939994(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80939994(PlayState* play, Vec3f* arg1) { Vec3f spAC; Vec3f spA0; s16 phi_v0; @@ -271,20 +271,20 @@ void func_80939994(GlobalContext* globalCtx, Vec3f* arg1) { phi_v0 = 32; } } - EffectSsKakera_Spawn(globalCtx, &spAC, &spA0, &spAC, -450, phi_v0, 15, 0, 0, i, 1, 0, life, -1, OBJECT_BOMBIWA, + EffectSsKakera_Spawn(play, &spAC, &spA0, &spAC, -450, phi_v0, 15, 0, 0, i, 1, 0, life, -1, OBJECT_BOMBIWA, object_bombiwa_DL_005990); } - func_800BBFB0(globalCtx, arg1, 120.0f, 3, 80, 140, 1); + func_800BBFB0(play, arg1, 120.0f, 3, 80, 140, 1); spAC.x = arg1->x; spAC.y = arg1->y + 70.0f; spAC.z = arg1->z; - func_800BBFB0(globalCtx, &spAC, 120.0f, 3, 80, 140, 1); + func_800BBFB0(play, &spAC, 120.0f, 3, 80, 140, 1); } -void func_80939C50(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80939C50(PlayState* play, Vec3f* arg1) { Vec3f spBC; Vec3f spB0; s32 phi_v0; @@ -318,18 +318,18 @@ void func_80939C50(GlobalContext* globalCtx, Vec3f* arg1) { phi_v0 = 32; } } - EffectSsKakera_Spawn(globalCtx, &spBC, &spB0, &spBC, -450, phi_v0, 15, 0, 0, D_8093A9E0[i], 1, 0, phi_s0, -1, + EffectSsKakera_Spawn(play, &spBC, &spB0, &spBC, -450, phi_v0, 15, 0, 0, D_8093A9E0[i], 1, 0, phi_s0, -1, OBJECT_BOMBIWA, object_bombiwa_DL_005990); } - func_800BBFB0(globalCtx, arg1, 60.0f, 4, 80, 140, 1); + func_800BBFB0(play, arg1, 60.0f, 4, 80, 140, 1); } void func_80939EE0(ObjBombiwa* this) { this->actionFunc = func_80939EF4; } -void func_80939EF4(ObjBombiwa* this, GlobalContext* globalCtx) { +void func_80939EF4(ObjBombiwa* this, PlayState* play) { s32 pad; s32 params = OBJBOMBIWA_GET_100(&this->actor); ObjBombiwaStruct2* sp28 = &D_8093A998[params]; @@ -339,17 +339,17 @@ void func_80939EF4(ObjBombiwa* this, GlobalContext* globalCtx) { } if (sp28->unk_0C(&this->actor)) { - Flags_SetSwitch(globalCtx, OBJBOMBIWA_GET_7F(&this->actor)); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); + Flags_SetSwitch(play, OBJBOMBIWA_GET_7F(&this->actor)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); if (OBJBOMBIWA_GET_8000(&this->actor)) { play_sound(NA_SE_SY_CORRECT_CHIME); } if (params == OBJBOMBIWA_100_0) { - func_80939794(this, globalCtx); + func_80939794(this, play); Actor_MarkForDeath(&this->actor); } else { - func_80939994(globalCtx, &this->actor.world.pos); + func_80939994(play, &this->actor.world.pos); this->actor.flags |= ACTOR_FLAG_10; func_8093A080(this); } @@ -365,8 +365,8 @@ void func_80939EF4(ObjBombiwa* this, GlobalContext* globalCtx) { this->collider.base.colType = COLTYPE_NONE; } } - 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); } } } @@ -397,7 +397,7 @@ void func_8093A080(ObjBombiwa* this) { this->actionFunc = func_8093A1F0; } -void func_8093A1F0(ObjBombiwa* this, GlobalContext* globalCtx) { +void func_8093A1F0(ObjBombiwa* this, PlayState* play) { s32 pad; s32 i; Vec3f sp9C; @@ -426,11 +426,11 @@ void func_8093A1F0(ObjBombiwa* this, GlobalContext* globalCtx) { sp9C.y = ptr->unk_04.y + 30.0f; sp9C.z = ptr->unk_04.z; - temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp94, &sp90, &this->actor, &sp9C); + temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp94, &sp90, &this->actor, &sp9C); if ((temp_f0 <= (BGCHECK_Y_MIN + 10.0f)) || ((ptr->unk_04.y - (200.0f * ptr->unk_00)) < temp_f0)) { this->unk_200++; ptr->unk_1A = 1; - func_80939C50(globalCtx, &ptr->unk_04); + func_80939C50(play, &ptr->unk_04); } } @@ -440,77 +440,74 @@ void func_8093A1F0(ObjBombiwa* this, GlobalContext* globalCtx) { } } -void ObjBombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjBombiwa_Update(Actor* thisx, PlayState* play) { ObjBombiwa* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_8093A418(Actor* thisx, GlobalContext* globalCtx) { +void func_8093A418(Actor* thisx, PlayState* play) { ObjBombiwa* this = THIS; f32 sp28; if ((this->actor.projectedPos.z <= 2200.0f) || ((this->unk_203 & 1) && (this->actor.projectedPos.z < 2300.0f))) { this->actor.shape.shadowAlpha = 160; - Gfx_DrawDListOpa(globalCtx, object_bombiwa_DL_0009E0); + Gfx_DrawDListOpa(play, object_bombiwa_DL_0009E0); return; } if (this->actor.projectedPos.z < 2300.0f) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); sp28 = (2300.0f - this->actor.projectedPos.z) * 2.55f; this->actor.shape.shadowAlpha = sp28 * (32.0f / 51); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s32)sp28); gSPDisplayList(POLY_XLU_DISP++, object_bombiwa_DL_000AF0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { this->actor.shape.shadowAlpha = 0; } } -void func_8093A608(Actor* thisx, GlobalContext* globalCtx) { +void func_8093A608(Actor* thisx, PlayState* play) { s32 pad[8]; ObjBombiwa* this = THIS; f32 sp38; s32 i; ObjBombiwaStruct* ptr; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->actionFunc == func_80939EF4) { if ((this->actor.projectedPos.z <= 2200.0f) || ((this->unk_203 & 1) && (this->actor.projectedPos.z < 2300.0f))) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x9B, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, object_bombiwa_DL_004560); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_bombiwa_DL_004688); } else if (this->actor.projectedPos.z < 2300.0f) { sp38 = (2300.0f - this->actor.projectedPos.z) * 2.55f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x9B, 255, 255, 255, (s32)sp38); gSPDisplayList(POLY_XLU_DISP++, object_bombiwa_DL_004560); } } else { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->unk_190); i++) { ptr = &this->unk_190[i]; @@ -519,12 +516,12 @@ void func_8093A608(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, &ptr->unk_14); Matrix_Scale(ptr->unk_00, ptr->unk_00, ptr->unk_00, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bombiwa_DL_005990); } } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h index 54d4024e99..602b3a788a 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h @@ -5,7 +5,7 @@ struct ObjBombiwa; -typedef void (*ObjBombiwaActionFunc)(struct ObjBombiwa*, GlobalContext*); +typedef void (*ObjBombiwaActionFunc)(struct ObjBombiwa*, PlayState*); #define OBJBOMBIWA_GET_7F(thisx) ((thisx)->params & 0x7F) #define OBJBOMBIWA_GET_100(thisx) (((thisx)->params >> 8) & 1) diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index b8da1a9f65..79da4f3328 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -13,10 +13,10 @@ #define THIS ((ObjBoyo*)thisx) -void ObjBoyo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjBoyo_Destroy(Actor* thisx, GlobalContext* globalCtx2); -void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2); -void ObjBoyo_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjBoyo_Init(Actor* thisx, PlayState* play); +void ObjBoyo_Destroy(Actor* thisx, PlayState* play2); +void ObjBoyo_Update(Actor* thisx, PlayState* play2); +void ObjBoyo_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Boyo_InitVars = { ACTOR_OBJ_BOYO, @@ -57,22 +57,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void ObjBoyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoyo_Init(Actor* thisx, PlayState* play) { ObjBoyo* this = THIS; 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); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_190 = Lib_SegmentedToVirtual(object_boyo_Matanimheader_000E88); } -void ObjBoyo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjBoyo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjBoyo* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, Player* target) { @@ -95,14 +95,14 @@ BumperCollideInfo sBumperCollideInfo[] = { { ACTOR_EN_BOM, (BumperCollideActorFunc)ObjBoyo_UpdateBombBumpValues }, }; -Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* num) { +Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, PlayState* play, s32* num) { Actor* collideActor; BumperCollideInfo* collideInfo; s32 i; if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { *num = 0; - return &GET_PLAYER(globalCtx)->actor; + return &GET_PLAYER(play)->actor; } if (this->collider.base.ocFlags1 & OC2_UNK1) { @@ -118,13 +118,13 @@ Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* nu return NULL; } -void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjBoyo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjBoyo* this = THIS; Actor* target; s32 num; - target = ObjBoyo_GetCollidedActor(this, globalCtx, &num); + target = ObjBoyo_GetCollidedActor(this, play, &num); if (target != NULL) { sBumperCollideInfo[num].actorCollideFunc(this, (void*)target); @@ -169,16 +169,16 @@ void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.base.ocFlags1 &= ~OC1_HIT; this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (thisx->xzDistToPlayer < 2000.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } -void ObjBoyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjBoyo_Draw(Actor* thisx, PlayState* play) { ObjBoyo* this = THIS; - AnimatedMat_Draw(globalCtx, this->unk_190); - Gfx_DrawDListOpa(globalCtx, object_boyo_DL_000300); + AnimatedMat_Draw(play, this->unk_190); + Gfx_DrawDListOpa(play, object_boyo_DL_000300); } diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 832000b0c9..0e6b48356c 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -20,13 +20,13 @@ #define OBJCHAN_ROTATION_SPEED 364 // == (65536 * 2/360) i.e. 2 degrees per second -void ObjChan_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjChan_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjChan_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjChan_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjChan_Init(Actor* thisx, PlayState* play); +void ObjChan_Destroy(Actor* thisx, PlayState* play); +void ObjChan_Update(Actor* thisx, PlayState* play); +void ObjChan_Draw(Actor* thisx, PlayState* play); -void ObjChan_ChandelierAction(ObjChan* this, GlobalContext* globalCtx); -void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx); +void ObjChan_ChandelierAction(ObjChan* this, PlayState* play); +void ObjChan_PotAction(ObjChan* this, PlayState* play); const ActorInit Obj_Chan_InitVars = { ACTOR_OBJ_CHAN, @@ -64,11 +64,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx); -void ObjChan_InitPot(ObjChan* this, GlobalContext* globalCtx); -void ObjChan_CreateSmashEffects(ObjChan* this, GlobalContext* globalCtx); -void ObjChan_DrawPot(Actor* thisx, GlobalContext* globalCtx); -void ObjChan_DrawFire(ObjChan* this, GlobalContext* globalCtx); +void ObjChan_InitChandelier(ObjChan* this2, PlayState* play); +void ObjChan_InitPot(ObjChan* this, PlayState* play); +void ObjChan_CreateSmashEffects(ObjChan* this, PlayState* play); +void ObjChan_DrawPot(Actor* thisx, PlayState* play); +void ObjChan_DrawFire(ObjChan* this, PlayState* play); static Vec3f sObjChanFlameSize[2] = { { 0.16f, 0.11f, 1.0f }, @@ -77,7 +77,7 @@ static Vec3f sObjChanFlameSize[2] = { static f32 sObjChanFlameYOffset[2] = { 1800, 1800 }; static s32 sObjChanLoaded; -void ObjChan_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjChan_Init(Actor* thisx, PlayState* play) { s32 pad; ObjChan* this = THIS; @@ -90,26 +90,26 @@ void ObjChan_Init(Actor* thisx, GlobalContext* globalCtx) { sObjChanLoaded = true; } Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sObjChanCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sObjChanCylinderInit); SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); switch (OBJCHAN_SUBTYPE(&this->actor)) { case OBJCHAN_SUBTYPE_CHANDELIER: this->rotation = this->actor.shape.rot.y; this->actor.shape.rot.y = 0; - ObjChan_InitChandelier(this, globalCtx); + ObjChan_InitChandelier(this, play); break; case OBJCHAN_SUBTYPE_POT: this->actor.draw = ObjChan_DrawPot; - ObjChan_InitPot(this, globalCtx); + ObjChan_InitPot(this, play); break; } } -void ObjChan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjChan_Destroy(Actor* thisx, PlayState* play) { ObjChan* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } u32 func_80BB9A1C(ObjChan* this, f32 arg1) { @@ -151,7 +151,7 @@ void ObjChan_CalculatePotPosition(Vec3f* childPosOut, Vec3s* childRotOut, Vec3f* } //! @TODO: Possibly takes actor and recasts -void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx) { +void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { ObjChan* this = this2; s32 i; ObjChan* temp_v0; @@ -165,8 +165,8 @@ void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp84, &this->actor.world.pos); sp84.y += 1600.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp84, &this->unk1C0, &sp94, false, false, - true, true, &sp90)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp84, &this->unk1C0, &sp94, false, false, true, + true, &sp90)) { this->unk1CC = this->actor.world.pos.y - this->unk1C0.y; } else { Actor_MarkForDeath(&this->actor); @@ -177,7 +177,7 @@ void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx) { ObjChan_CalculatePotPosition(&childPos, &childRot, &this->actor.world.pos, &this->actor.shape.rot, (s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation); temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, ACTOR_OBJ_CHAN, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, + &play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, (this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene, this->actor.unk20, &this->actor); if (temp_v0 != NULL) { this->pots[i] = temp_v0; @@ -188,7 +188,7 @@ void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx) { } } - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x7F)) { this->stateFlags |= OBJCHAN_STATE_FIRE_DELAY; this->stateFlags |= OBJCHAN_STATE_ON_FIRE; @@ -210,7 +210,7 @@ void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx) { } //! @TODO: More descriptive name than Action? -void ObjChan_ChandelierAction(ObjChan* this2, GlobalContext* globalCtx) { +void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { ObjChan* this = this2; ObjChan* temp; s32 i; @@ -258,9 +258,9 @@ void ObjChan_ChandelierAction(ObjChan* this2, GlobalContext* globalCtx) { } } if ((this->collider.base.acFlags & AC_HIT) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x800)) { - Flags_SetSwitch(globalCtx, this->actor.params & 0x7F); + Flags_SetSwitch(play, this->actor.params & 0x7F); } - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { + if (Flags_GetSwitch(play, this->actor.params & 0x7F)) { if (!(this->stateFlags & OBJCHAN_STATE_FIRE_DELAY)) { this->rotationSpeed = 0; this->flameSize = 0.0f; @@ -284,11 +284,11 @@ void ObjChan_ChandelierAction(ObjChan* this2, GlobalContext* globalCtx) { } } -void ObjChan_InitPot(ObjChan* this, GlobalContext* globalCtx) { +void ObjChan_InitPot(ObjChan* this, PlayState* play) { this->actionFunc = ObjChan_PotAction; } -void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { +void ObjChan_PotAction(ObjChan* this, PlayState* play) { s32 potBreaks; s32 phi_v1; @@ -305,14 +305,14 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { } } if (potBreaks) { - ObjChan_CreateSmashEffects(this, globalCtx); + ObjChan_CreateSmashEffects(this, play); ((ObjChan*)this->actor.parent)->pots[this->myPotIndex] = NULL; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN); func_80BB9A1C((ObjChan*)this->actor.parent, 40.0f); if (this->myPotIndex == 4) { if (!(((void)0, gSaveContext.save.weekEventReg[0x25]) & 0x10)) { gSaveContext.save.weekEventReg[0x25] = ((void)0, gSaveContext.save.weekEventReg[0x25]) | 0x10; - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MM, this->actor.world.pos.x, + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000, this->actor.cutscene, this->actor.unk20, NULL); } @@ -321,7 +321,7 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { } } -void ObjChan_CreateSmashEffects(ObjChan* this, GlobalContext* globalCtx) { +void ObjChan_CreateSmashEffects(ObjChan* this, PlayState* play) { s16 new_var = 0; s32 phi_s0; Vec3f spDC; @@ -352,85 +352,85 @@ void ObjChan_CreateSmashEffects(ObjChan* this, GlobalContext* globalCtx) { phi_s0 = 0x20; } new_var2 = spA4 * Rand_ZeroOne(); - EffectSsKakera_Spawn(globalCtx, &spDC, &spD0, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, spA8 + new_var2, - 0, 0, 50, -1, OBJECT_TSUBO, object_tsubo_DL_001960); + EffectSsKakera_Spawn(play, &spDC, &spD0, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, spA8 + new_var2, 0, 0, + 50, -1, OBJECT_TSUBO, object_tsubo_DL_001960); } - func_800BBFB0(globalCtx, &this->actor.world.pos, 30.0f, 2, 20, 50, true); - func_800BBFB0(globalCtx, &this->actor.world.pos, 30.0f, 2, 10, 80, true); + func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 20, 50, true); + func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 10, 80, true); } -void ObjChan_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjChan_Update(Actor* thisx, PlayState* play) { ObjChan* this = THIS; - this->actionFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->actionFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void ObjChan_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjChan_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjChan* this = THIS; Gfx* opa; Gfx* xlu; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_RotateYS(this->rotation, MTXMODE_APPLY); opa = Gfx_CallSetupDL(POLY_OPA_DISP, 0x19); - gSPMatrix(&opa[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&opa[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&opa[1], object_obj_chan_DL_000AF0); POLY_OPA_DISP = &opa[2]; xlu = func_8012C2B4(POLY_XLU_DISP); - gSPMatrix(&xlu[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&xlu[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&xlu[1], object_obj_chan_DL_000A10); POLY_XLU_DISP = &xlu[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); Matrix_Push(); if (this->stateFlags & OBJCHAN_STATE_ON_FIRE) { - ObjChan_DrawFire(this, globalCtx); + ObjChan_DrawFire(this, play); } Matrix_Pop(); } -void ObjChan_DrawPot(Actor* thisx, GlobalContext* globalCtx) { +void ObjChan_DrawPot(Actor* thisx, PlayState* play) { ObjChan* this = THIS; s32 pad; Gfx* dl; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); dl = Gfx_CallSetupDL(POLY_OPA_DISP, 0x19); - gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); + gSPMatrix(&dl[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); gSPDisplayList(&dl[1], object_obj_chan_DL_002358); POLY_OPA_DISP = &dl[2]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); if (this->stateFlags & OBJCHAN_STATE_ON_FIRE) { - ObjChan_DrawFire(this, globalCtx); + ObjChan_DrawFire(this, play); } } -void ObjChan_DrawFire(ObjChan* this, GlobalContext* globalCtx) { +void ObjChan_DrawFire(ObjChan* this, PlayState* play) { u32 sp4C; Gfx* dl; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - sp4C = globalCtx->gameplayFrames; + sp4C = play->gameplayFrames; - Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y - this->rotation + 0x8000, + Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y - this->rotation + 0x8000, MTXMODE_APPLY); Matrix_Scale(sObjChanFlameSize[OBJCHAN_SUBTYPE(&this->actor)].x * this->flameSize, sObjChanFlameSize[OBJCHAN_SUBTYPE(&this->actor)].y * this->flameSize, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, sObjChanFlameYOffset[OBJCHAN_SUBTYPE(&this->actor)], 0.0f, MTXMODE_APPLY); dl = func_8012C2B4(POLY_XLU_DISP); - gSPMatrix(&dl[0], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD); - gMoveWd(&dl[1], 6, 32, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0U, -sp4C * 20, 32, 128)); + gSPMatrix(&dl[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_LOAD); + gMoveWd(&dl[1], 6, 32, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0U, -sp4C * 20, 32, 128)); gDPSetPrimColor(&dl[2], 128, 128, 255, 255, 0, 255); gDPSetEnvColor(&dl[3], 255, 0, 0, 0); gSPDisplayList(&dl[4], &gGameplayKeepDrawFlameDL); POLY_XLU_DISP = &dl[5]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h index 2b11335b3f..4a689fa096 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h @@ -36,7 +36,7 @@ struct ObjChan; -typedef void (*ObjChanActionFunc)(struct ObjChan*, GlobalContext*); +typedef void (*ObjChanActionFunc)(struct ObjChan*, PlayState*); typedef struct ObjChan { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c index 7de79a2be2..ee48a2c40f 100644 --- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c +++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c @@ -10,10 +10,10 @@ #define THIS ((ObjChikuwa*)thisx) -void ObjChikuwa_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjChikuwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjChikuwa_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjChikuwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjChikuwa_Init(Actor* thisx, PlayState* play); +void ObjChikuwa_Destroy(Actor* thisx, PlayState* play); +void ObjChikuwa_Update(Actor* thisx, PlayState* play); +void ObjChikuwa_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Chikuwa_InitVars = { 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 7c674b0c64..9b5c302d3c 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -11,16 +11,16 @@ #define THIS ((ObjComb*)thisx) -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 func_8098DC44(ObjComb* this); -void func_8098DC60(ObjComb* this, GlobalContext* globalCtx); -void func_8098DEA0(ObjComb* this, GlobalContext* globalCtx); +void func_8098DC60(ObjComb* this, PlayState* play); +void func_8098DEA0(ObjComb* this, PlayState* play); void func_8098E098(ObjComb* this); -void func_8098E0B8(ObjComb* this, GlobalContext* globalCtx); +void func_8098E0B8(ObjComb* this, PlayState* play); const ActorInit Obj_Comb_InitVars = { ACTOR_OBJ_COMB, @@ -68,7 +68,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -s32 func_8098CE40(ObjComb* this, GlobalContext* globalCtx) { +s32 func_8098CE40(ObjComb* this, PlayState* play) { s32 phi_a2 = -1; s32 temp_v0 = (OBJCOMB_GET_1F(&this->actor) << 2) | 0xFF01; @@ -76,10 +76,10 @@ s32 func_8098CE40(ObjComb* this, GlobalContext* globalCtx) { phi_a2 = ((temp_v0 & 0x3FC) >> 2) & 0xFF; } - return ((phi_a2 < 0) == 1) || !Flags_GetTreasure(globalCtx, phi_a2); + return ((phi_a2 < 0) == 1) || !Flags_GetTreasure(play, phi_a2); } -void func_8098CEAC(ObjComb* this, GlobalContext* globalCtx) { +void func_8098CEAC(ObjComb* this, PlayState* play) { Vec3f spDC; Vec3f spD0; Vec3f spC4; @@ -126,7 +126,7 @@ void func_8098CEAC(ObjComb* this, GlobalContext* globalCtx) { } else { phi_v0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f10, 0, 0, 60, -1, + EffectSsKakera_Spawn(play, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f10, 0, 0, 60, -1, OBJECT_COMB, object_comb_DL_001040); } @@ -134,10 +134,10 @@ void func_8098CEAC(ObjComb* this, GlobalContext* globalCtx) { spD0.y = this->actor.world.pos.y - 10.0f; spD0.z = this->actor.world.pos.z; - func_800BBFB0(globalCtx, &spD0, 40.0f, 6, 70, 60, 1); + func_800BBFB0(play, &spD0, 40.0f, 6, 70, 60, 1); } -void func_8098D19C(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D19C(ObjComb* this, PlayState* play) { Vec3f spDC; Vec3f spD0; Vec3f spC4; @@ -184,7 +184,7 @@ void func_8098D19C(ObjComb* this, GlobalContext* globalCtx) { phi_v0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f8, 0, 0, 60, -1, + EffectSsKakera_Spawn(play, &spD0, &spC4, &spD0, phi_s0, phi_v0, phi_s1, 4, 0, temp_f8, 0, 0, 60, -1, OBJECT_COMB, object_comb_DL_001040); } @@ -192,10 +192,10 @@ void func_8098D19C(ObjComb* this, GlobalContext* globalCtx) { spD0.y = this->actor.world.pos.y + 20.0f; spD0.z = this->actor.world.pos.z; - func_800BBFB0(globalCtx, &spD0, 40.0f, 6, 70, 60, 1); + func_800BBFB0(play, &spD0, 40.0f, 6, 70, 60, 1); } -void func_8098D47C(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D47C(ObjComb* this, PlayState* play) { Vec3f spD4; Vec3f spC8; Vec3f spBC; @@ -235,12 +235,12 @@ void func_8098D47C(ObjComb* this, GlobalContext* globalCtx) { phi_v0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &spC8, &spBC, &spC8, phi_s0, phi_v0, 40, 0, 0, temp_f10, 0, 0, 80, -1, - OBJECT_COMB, object_comb_DL_001040); + EffectSsKakera_Spawn(play, &spC8, &spBC, &spC8, phi_s0, phi_v0, 40, 0, 0, temp_f10, 0, 0, 80, -1, OBJECT_COMB, + object_comb_DL_001040); } } -void func_8098D6E0(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D6E0(ObjComb* this, PlayState* play) { s32 i; Vec3f sp70; f32 temp_f0; @@ -254,23 +254,23 @@ void func_8098D6E0(ObjComb* this, GlobalContext* globalCtx) { temp_f20 = ((1.0f - SQ(temp_f0)) * 14.0f) + 4.0f; sp70.x = (Math_SinS((s32)(Rand_ZeroOne() * 8000.0f) + temp) * temp_f20) + this->actor.world.pos.x; sp70.z = (Math_CosS((s32)(Rand_ZeroOne() * 8000.0f) + temp) * temp_f20) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp70, NULL, NULL, 0, 200); + EffectSsGSplash_Spawn(play, &sp70, NULL, NULL, 0, 200); } sp70.x = this->actor.world.pos.x; sp70.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp70, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &sp70, NULL, NULL, 0, 300); } -void func_8098D870(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D870(ObjComb* this, PlayState* play) { s32 temp_v0 = func_800A8150(OBJCOMB_GET_3F(&this->actor)); if (temp_v0 >= 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ((OBJCOMB_GET_7F00(&this->actor)) << 8) | temp_v0); + Item_DropCollectible(play, &this->actor.world.pos, ((OBJCOMB_GET_7F00(&this->actor)) << 8) | temp_v0); } } -void func_8098D8C8(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D8C8(ObjComb* this, PlayState* play) { s32 params = OBJCOMB_GET_F(&this->actor); s32 i; s32 phi_s5; @@ -283,21 +283,21 @@ void func_8098D8C8(ObjComb* this, GlobalContext* globalCtx) { this->unk_1B6 = 0; for (i = 0; i < params; i++) { - if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BEE, this->actor.world.pos.x, this->actor.world.pos.y, + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BEE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, phi_s5)) { this->unk_1B6 = 1; } } } -void func_8098D99C(ObjComb* this, GlobalContext* globalCtx) { +void func_8098D99C(ObjComb* this, PlayState* play) { s32 params; Actor* temp_v0; - if (func_8098CE40(this, globalCtx)) { + if (func_8098CE40(this, play)) { params = (OBJCOMB_GET_1F(&this->actor) << 2) | 0xFF01; - temp_v0 = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.home.rot.y, 0, params); + temp_v0 = 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.home.rot.y, 0, params); if (temp_v0 != NULL) { temp_v0->parent = &this->actor; @@ -314,46 +314,46 @@ void func_8098D99C(ObjComb* this, GlobalContext* globalCtx) { } } -void func_8098DA74(ObjComb* this, GlobalContext* globalCtx) { +void func_8098DA74(ObjComb* this, PlayState* play) { s32 temp_v0 = OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor); if (temp_v0 == 0) { - func_8098D870(this, globalCtx); + func_8098D870(this, play); } else if (temp_v0 == 1) { - func_8098D8C8(this, globalCtx); + func_8098D8C8(this, play); } else { - func_8098D99C(this, globalCtx); + func_8098D99C(this, play); } } -void ObjComb_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Init(Actor* thisx, PlayState* play) { s32 pad; ObjComb* this = THIS; s32 sp2C = OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor); Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); + Collider_InitJntSph(play, &this->collider); if ((sp2C == 1) && OBJCOMB_GET_10(&this->actor) && (gSaveContext.save.weekEventReg[83] & 2)) { Actor_MarkForDeath(&this->actor); return; } - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); - if ((sp2C == 0) && Item_CanDropBigFairy(globalCtx, OBJCOMB_GET_3F(&this->actor), OBJCOMB_GET_7F00(&this->actor))) { + if ((sp2C == 0) && Item_CanDropBigFairy(play, OBJCOMB_GET_3F(&this->actor), OBJCOMB_GET_7F00(&this->actor))) { this->unk_1B7 = 1; this->actor.flags |= ACTOR_FLAG_10; } - if ((sp2C != 2) || !func_8098CE40(this, globalCtx)) { + if ((sp2C != 2) || !func_8098CE40(this, play)) { this->unk_1B8 = -1; } func_8098DC44(this); } -void ObjComb_Destroy(Actor* thisx, GlobalContext* globalCtx) { - Collider_DestroyJntSph(globalCtx, &THIS->collider); +void ObjComb_Destroy(Actor* thisx, PlayState* play) { + Collider_DestroyJntSph(play, &THIS->collider); } void func_8098DC44(ObjComb* this) { @@ -361,7 +361,7 @@ void func_8098DC44(ObjComb* this) { this->actionFunc = func_8098DC60; } -void func_8098DC60(ObjComb* this, GlobalContext* globalCtx) { +void func_8098DC60(ObjComb* this, PlayState* play) { s32 temp_a0; s8 temp_v0; u32 temp_v1; @@ -378,8 +378,8 @@ void func_8098DC60(ObjComb* this, GlobalContext* globalCtx) { if (this->unk_1B3) { if (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x0182C29C) { - func_8098CEAC(this, globalCtx); - func_8098DA74(this, globalCtx); + func_8098CEAC(this, play); + func_8098DA74(this, play); Actor_MarkForDeath(&this->actor); } else { s32 dmgFlags = this->collider.elements->info.acHitInfo->toucher.dmgFlags; @@ -413,11 +413,11 @@ void func_8098DC60(ObjComb* this, GlobalContext* globalCtx) { this->unk_1B8--; } } - 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); } this->actor.shape.rot.x = (s32)(Math_SinS(this->unk_1AA) * this->unk_1A8) + this->actor.home.rot.x; @@ -432,20 +432,20 @@ void func_8098DE58(ObjComb* this) { this->actionFunc = func_8098DEA0; } -void func_8098DEA0(ObjComb* this, GlobalContext* globalCtx) { +void func_8098DEA0(ObjComb* this, PlayState* play) { this->unk_1B4--; if ((this->actor.bgCheckFlags & 1) || (this->unk_1B4 <= 0)) { - func_8098DA74(this, globalCtx); + func_8098DA74(this, play); if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 30.0f)) { - func_8098D47C(this, globalCtx); + func_8098D47C(this, play); } else { - func_8098D19C(this, globalCtx); + func_8098D19C(this, play); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_HONEYCOMB_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_HONEYCOMB_BROKEN); func_8098E098(this); } else { if (this->actor.bgCheckFlags & 0x40) { - func_8098D6E0(this, globalCtx); + func_8098D6E0(this, play); } if (this->actor.bgCheckFlags & 0x20) { @@ -472,8 +472,8 @@ void func_8098DEA0(ObjComb* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&this->actor); this->actor.shape.rot.x += this->unk_1AE; this->actor.shape.rot.y += this->unk_1B0; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 12.0f, 0.0f, 5); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 12.0f, 0.0f, 5); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -483,7 +483,7 @@ void func_8098E098(ObjComb* this) { this->actionFunc = func_8098E0B8; } -void func_8098E0B8(ObjComb* this, GlobalContext* globalCtx) { +void func_8098E0B8(ObjComb* this, PlayState* play) { this->unk_1B4--; if (this->unk_1B4 <= 0) { Actor_MarkForDeath(&this->actor); @@ -492,12 +492,12 @@ void func_8098E0B8(ObjComb* this, GlobalContext* globalCtx) { if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.cutscene >= 0)) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - func_800B7298(globalCtx, &this->actor, 4); + func_800B7298(play, &this->actor, 4); } } } -void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Update(Actor* thisx, PlayState* play) { ObjComb* this = THIS; this->unk_1B3 = (this->collider.base.acFlags & AC_HIT) != 0; @@ -512,7 +512,7 @@ void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update == NULL) { if ((this->unk_1B5 == 2) && (func_800F2138(this->actor.cutscene) == -1)) { @@ -526,7 +526,7 @@ void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); if (this->actor.cutscene >= 0) { - func_800B7298(globalCtx, &this->actor, 1); + func_800B7298(play, &this->actor, 1); } if (((OBJCOMB_GET_8000(&this->actor) | OBJCOMB_GET_80(&this->actor)) == 1) && @@ -542,18 +542,18 @@ void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->unk_1B7 != 0) { - globalCtx->actorCtx.unk5 |= 8; + play->actorCtx.unk5 |= 8; this->actor.flags |= ACTOR_FLAG_10; } } } -void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjComb_Draw(Actor* thisx, PlayState* play) { ObjComb* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(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); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); @@ -562,10 +562,10 @@ void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -(this->actor.scale.y * 118.0f), 0.0f, 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_comb_DL_000CB0); Collider_UpdateSpheres(0, &this->collider); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 fc47df429b..709740b598 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -5,7 +5,7 @@ struct ObjComb; -typedef void (*ObjCombActionFunc)(struct ObjComb*, GlobalContext*); +typedef void (*ObjCombActionFunc)(struct ObjComb*, PlayState*); #define OBJCOMB_GET_F(thisx) ((thisx)->params & 0xF) #define OBJCOMB_GET_10(thisx) (((thisx)->params >> 4) & 0x1) diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index aa72f30522..fb395f8d05 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -10,10 +10,10 @@ #define THIS ((ObjDanpeilift*)thisx) -void ObjDanpeilift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDanpeilift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDanpeilift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDanpeilift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDanpeilift_Init(Actor* thisx, PlayState* play); +void ObjDanpeilift_Destroy(Actor* thisx, PlayState* play); +void ObjDanpeilift_Update(Actor* thisx, PlayState* play); +void ObjDanpeilift_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Danpeilift_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 3cf7af3207..ee687ae6e1 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -5,7 +5,7 @@ struct ObjDanpeilift; -typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, GlobalContext*); +typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, PlayState*); typedef struct ObjDanpeilift { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 2fba4b96aa..387ee5dbe3 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -10,11 +10,11 @@ #define THIS ((ObjDemo*)thisx) -void ObjDemo_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDemo_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjDemo_Init(Actor* thisx, PlayState* play); +void ObjDemo_Update(Actor* thisx, PlayState* play); -void func_80983678(ObjDemo* this, GlobalContext* globalCtx); -void func_80983704(ObjDemo* this, GlobalContext* globalCtx); +void func_80983678(ObjDemo* this, PlayState* play); +void func_80983704(ObjDemo* this, PlayState* play); #if 0 const ActorInit Obj_Demo_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h index 2631e91bef..62f105c913 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.h @@ -5,7 +5,7 @@ struct ObjDemo; -typedef void (*ObjDemoActionFunc)(struct ObjDemo*, GlobalContext*); +typedef void (*ObjDemoActionFunc)(struct ObjDemo*, PlayState*); typedef struct ObjDemo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index 22df1af736..0502074929 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -11,21 +11,21 @@ #define THIS ((ObjDhouse*)thisx) -void ObjDhouse_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDhouse_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDhouse_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDhouse_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDhouse_Init(Actor* thisx, PlayState* play); +void ObjDhouse_Destroy(Actor* thisx, PlayState* play); +void ObjDhouse_Update(Actor* thisx, PlayState* play); +void ObjDhouse_Draw(Actor* thisx, PlayState* play); -void func_80B12E7C(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); -void func_80B13170(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); +void func_80B12E7C(ObjDhouse* this, PlayState* play, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); +void func_80B13170(ObjDhouse* this, PlayState* play, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); void func_80B13908(ObjDhouse* this); -void func_80B1391C(ObjDhouse* this, GlobalContext* globalCtx); +void func_80B1391C(ObjDhouse* this, PlayState* play); void func_80B1392C(ObjDhouse* this); -void func_80B13940(ObjDhouse* this, GlobalContext* globalCtx); +void func_80B13940(ObjDhouse* this, PlayState* play); void func_80B139D8(ObjDhouse* this); -void func_80B139F4(ObjDhouse* this, GlobalContext* globalCtx); -void func_80B13C08(Actor* thisx, GlobalContext* globalCtx); -void func_80B13E40(Actor* thisx, GlobalContext* globalCtx); +void func_80B139F4(ObjDhouse* this, PlayState* play); +void func_80B13C08(Actor* thisx, PlayState* play); +void func_80B13E40(Actor* thisx, PlayState* play); const ActorInit Obj_Dhouse_InitVars = { ACTOR_OBJ_DHOUSE, @@ -123,27 +123,27 @@ static InitChainEntry sInitChain[] = { Vec3f D_80B13FC4 = { 160.0f, 0.0f, 240.0f }; -void ObjDhouse_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDhouse_Init(Actor* thisx, PlayState* play) { ObjDhouse* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - if (Flags_GetSwitch(globalCtx, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJDHOUSE_GET_7F(&this->dyna.actor))) { this->dyna.actor.draw = func_80B13E40; func_80B13908(this); } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_dhouse_Colheader_008040); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_dhouse_Colheader_008040); this->dyna.actor.flags |= ACTOR_FLAG_10; func_80B1392C(this); } } -void ObjDhouse_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDhouse_Destroy(Actor* thisx, PlayState* play) { ObjDhouse* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80B12A50(ObjDhouseStruct1* this, ObjDhouseStruct3* ptr3, Vec3f* arg2) { @@ -166,7 +166,7 @@ void func_80B12A88(Actor* thisx) { } } -void func_80B12B38(ObjDhouse* this2, GlobalContext* globalCtx) { +void func_80B12B38(ObjDhouse* this2, PlayState* play) { ObjDhouse* this = this2; s32 i; f32 temp_f0; @@ -193,14 +193,14 @@ void func_80B12B38(ObjDhouse* this2, GlobalContext* globalCtx) { ptr->unk_18.z += ptr3->unk_20.z; if (ptr->unk_1E == ptr3->unk_26) { - func_80B12E7C(this, globalCtx, ptr, ptr3); + func_80B12E7C(this, play, ptr, ptr3); } } phi_s3 = false; if (ptr->unk_0C.y < 0.0f) { func_80B12A50(ptr, ptr3, &sp80); - temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp90, &sp7C, &this->dyna.actor, &sp80); + temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp90, &sp7C, &this->dyna.actor, &sp80); if (((sp80.y - 35.0f) < temp_f0) && (temp_f0 > (BGCHECK_Y_MIN + 1.0f))) { phi_s3 = true; } @@ -208,7 +208,7 @@ void func_80B12B38(ObjDhouse* this2, GlobalContext* globalCtx) { if (phi_s3) { ptr->unk_1E = -1; - func_80B13170(this, globalCtx, ptr, ptr3); + func_80B13170(this, play, ptr, ptr3); } else if (ptr->unk_1E > 60) { ptr->unk_1E = -1; } else { @@ -234,7 +234,7 @@ s32 func_80B12D78(ObjDhouse* this) { return count; } -void func_80B12E7C(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { +void func_80B12E7C(ObjDhouse* this, PlayState* play, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { s32 i; Vec3f spA0; Vec3f sp94; @@ -278,13 +278,13 @@ void func_80B12E7C(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* sp88.y = ((Rand_ZeroOne() - 0.3f) * sp94.y) + ptr2->unk_00.y; sp88.z = ((Rand_ZeroOne() - 0.5f) * sp94.z) + ptr2->unk_00.z; - func_800B1210(globalCtx, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 130.0f) + 20, + func_800B1210(play, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 130.0f) + 20, (s32)(Rand_ZeroOne() * 140.0f) + 60); } } } -void func_80B13170(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { +void func_80B13170(ObjDhouse* this, PlayState* play, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { s32 i; Vec3f sp98; Vec3f sp8C; @@ -330,13 +330,13 @@ void func_80B13170(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* sp8C.y = (Rand_ZeroOne() * 120.0f) + ptr2->unk_00.y; sp8C.z = ((Rand_ZeroOne() - 0.5f) * 160.0f) + ptr2->unk_00.z; - func_800B1210(globalCtx, &sp8C, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 140.0f) + 20, + func_800B1210(play, &sp8C, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 140.0f) + 20, (s32)(Rand_ZeroOne() * 140.0f) + 40); } } } -void func_80B13474(ObjDhouse* this, GlobalContext* globalCtx, Vec3f* arg2) { +void func_80B13474(ObjDhouse* this, PlayState* play, Vec3f* arg2) { s32 i; Vec3f sp88; ObjDhouseStruct2* ptr2; @@ -372,12 +372,12 @@ void func_80B13474(ObjDhouse* this, GlobalContext* globalCtx, Vec3f* arg2) { sp88.y = (Rand_ZeroOne() * 60.0f) + ptr2->unk_00.y; sp88.z = ((Rand_ZeroOne() * 70.0f) - 35.0f) + ptr2->unk_00.z; - func_800B1210(globalCtx, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 80.0f) + 20, + func_800B1210(play, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 80.0f) + 20, (s32)(Rand_ZeroOne() * 90.0f) + 40); } } -void func_80B13724(ObjDhouse* this, GlobalContext* globalCtx) { +void func_80B13724(ObjDhouse* this, PlayState* play) { f32 temp_f0; f32 temp_f20 = this->dyna.actor.home.pos.y - 300.0f; s32 i; @@ -406,11 +406,11 @@ void func_80B13724(ObjDhouse* this, GlobalContext* globalCtx) { if (ptr2->unk_29 & 1) { temp_f0 = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp80, &sp6C, &this->dyna.actor, &ptr2->unk_00); + BgCheck_EntityRaycastFloor5(&play->colCtx, &sp80, &sp6C, &this->dyna.actor, &ptr2->unk_00); if (((ptr2->unk_00.y - 20.0f) < temp_f0) && (temp_f0 > BGCHECK_Y_MIN + 1.0f)) { Math_Vec3f_Copy(&sp70, &ptr2->unk_00); ptr2->unk_28 = 0; - func_80B13474(this, globalCtx, &sp70); + func_80B13474(this, play, &sp70); } } } @@ -422,25 +422,25 @@ void func_80B13908(ObjDhouse* this) { this->actionFunc = func_80B1391C; } -void func_80B1391C(ObjDhouse* this, GlobalContext* globalCtx) { +void func_80B1391C(ObjDhouse* this, PlayState* play) { } void func_80B1392C(ObjDhouse* this) { this->actionFunc = func_80B13940; } -void func_80B13940(ObjDhouse* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_80B13940(ObjDhouse* this, PlayState* play2) { + PlayState* play = play2; s32 sp20 = false; - if (Flags_GetSwitch(globalCtx, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJDHOUSE_GET_7F(&this->dyna.actor))) { sp20 = true; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_EXPLSION_LONG); } if (sp20) { func_80B12A88(&this->dyna.actor); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = func_80B13C08; this->dyna.actor.flags |= ACTOR_FLAG_20; func_80B139D8(this); @@ -452,8 +452,8 @@ void func_80B139D8(ObjDhouse* this) { this->actionFunc = func_80B139F4; } -void func_80B139F4(ObjDhouse* this, GlobalContext* globalCtx) { - Camera* camera = GET_ACTIVE_CAM(globalCtx); +void func_80B139F4(ObjDhouse* this, PlayState* play) { + Camera* camera = GET_ACTIVE_CAM(play); s16 quake; if (this->unk_1370 == 117) { @@ -480,33 +480,33 @@ void func_80B139F4(ObjDhouse* this, GlobalContext* globalCtx) { this->dyna.actor.flags &= ~ACTOR_FLAG_10; func_80B13908(this); } else { - func_80B12B38(this, globalCtx); - func_80B13724(this, globalCtx); + func_80B12B38(this, play); + func_80B13724(this, play); } } -void ObjDhouse_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDhouse_Update(Actor* thisx, PlayState* play) { ObjDhouse* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjDhouse_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_dhouse_DL_005A78); +void ObjDhouse_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_dhouse_DL_005A78); } -void func_80B13C08(Actor* thisx, GlobalContext* globalCtx) { +void func_80B13C08(Actor* thisx, PlayState* play) { ObjDhouse* this = THIS; ObjDhouseStruct1* ptr; ObjDhouseStruct2* ptr2; ObjDhouseStruct3* ptr3; s32 i; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dhouse_DL_004928); for (i = 0, ptr = &this->unk_160[0], ptr3 = &D_80B13E90[0]; i < ARRAY_COUNT(this->unk_160); i++, ptr3++, ptr++) { @@ -516,8 +516,7 @@ void func_80B13C08(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(-ptr3->unk_08.x, -ptr3->unk_08.y, -ptr3->unk_08.z, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, ptr3->unk_00); gSPDisplayList(POLY_OPA_DISP++, ptr3->unk_04); } @@ -528,15 +527,14 @@ void func_80B13C08(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, &ptr2->unk_1C); Matrix_Scale(ptr2->unk_18, ptr2->unk_18, ptr2->unk_18, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_dhouse_DL_0081D8); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B13E40(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_dhouse_DL_004928); +void func_80B13E40(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_dhouse_DL_004928); } diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h index 053928c1c3..807af52f94 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h @@ -5,7 +5,7 @@ struct ObjDhouse; -typedef void (*ObjDhouseActionFunc)(struct ObjDhouse*, GlobalContext*); +typedef void (*ObjDhouseActionFunc)(struct ObjDhouse*, PlayState*); #define OBJDHOUSE_GET_7F(thisx) ((thisx)->params & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c index 57f9d75505..4c8f383502 100644 --- a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c +++ b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c @@ -11,10 +11,10 @@ #define THIS ((ObjDinner*)thisx) -void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDinner_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDinner_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDinner_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDinner_Init(Actor* thisx, PlayState* play); +void ObjDinner_Destroy(Actor* thisx, PlayState* play); +void ObjDinner_Update(Actor* thisx, PlayState* play); +void ObjDinner_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Dinner_InitVars = { ACTOR_OBJ_DINNER, @@ -28,7 +28,7 @@ const ActorInit Obj_Dinner_InitVars = { (ActorFunc)ObjDinner_Draw, }; -void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDinner_Init(Actor* thisx, PlayState* play) { ObjDinner* this = THIS; if (gSaveContext.save.isNight != true || (CURRENT_DAY == 3 && gSaveContext.save.weekEventReg[22] & 1)) { @@ -37,18 +37,18 @@ void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); } -void ObjDinner_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDinner_Destroy(Actor* thisx, PlayState* play) { } -void ObjDinner_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDinner_Update(Actor* thisx, PlayState* play) { } -void ObjDinner_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void ObjDinner_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_obj_dinner_DL_0011E0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c index 163dd851de..af2908ecfc 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -11,17 +11,17 @@ #define THIS ((ObjDora*)thisx) -void ObjDora_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDora_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDora_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDora_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDora_Init(Actor* thisx, PlayState* play); +void ObjDora_Destroy(Actor* thisx, PlayState* play); +void ObjDora_Update(Actor* thisx, PlayState* play); +void ObjDora_Draw(Actor* thisx, PlayState* play); void ObjDora_SetupWait(ObjDora* this); -void ObjDora_Wait(ObjDora* this, GlobalContext* globalCtx); +void ObjDora_Wait(ObjDora* this, PlayState* play); void ObjDora_SetupMoveGong(ObjDora* this); -void ObjDora_MoveGong(ObjDora* this, GlobalContext* globalCtx); +void ObjDora_MoveGong(ObjDora* this, PlayState* play); s32 ObjDora_IsHalfHour(u16 time); -void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx); +void ObjDora_UpdateCollision(ObjDora* this, PlayState* play); typedef enum { /* 0x0 */ DORA_HIT_NONE, @@ -166,7 +166,7 @@ static DamageTable sDamageTable = { static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_HEAVY }; -void ObjDora_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDora_Init(Actor* thisx, PlayState* play) { ObjDora* this = THIS; s32 i; s32 j; @@ -189,8 +189,8 @@ void ObjDora_Init(Actor* thisx, GlobalContext* globalCtx) { this->gongForce.y = 0.0f; this->gongForce.z = 0.0f; - Collider_InitTris(globalCtx, &this->colliderTris); - Collider_SetTris(globalCtx, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); + Collider_InitTris(play, &this->colliderTris); + Collider_SetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, @@ -206,17 +206,17 @@ void ObjDora_Init(Actor* thisx, GlobalContext* globalCtx) { ObjDora_SetupWait(this); } -void ObjDora_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDora_Destroy(Actor* thisx, PlayState* play) { ObjDora* this = THIS; - Collider_DestroyTris(globalCtx, &this->colliderTris); + Collider_DestroyTris(play, &this->colliderTris); } void ObjDora_SetupWait(ObjDora* this) { this->actionFunc = ObjDora_Wait; } -void ObjDora_Wait(ObjDora* this, GlobalContext* globalCtx) { +void ObjDora_Wait(ObjDora* this, PlayState* play) { } void ObjDora_SetupMoveGong(ObjDora* this) { @@ -234,7 +234,7 @@ void ObjDora_SetupMoveGong(ObjDora* this) { this->actionFunc = ObjDora_MoveGong; } -void ObjDora_MoveGong(ObjDora* this, GlobalContext* globalCtx) { +void ObjDora_MoveGong(ObjDora* this, PlayState* play) { if ((this->gongForce.y < 182.0f) && (this->gongForce.z < 182.0f)) { this->lastGongHitType = DORA_HIT_LIGHT; @@ -261,7 +261,7 @@ s32 ObjDora_IsHalfHour(u16 time) { return false; } -void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx) { +void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { Actor* itemDrop; u16 time; @@ -281,12 +281,12 @@ void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx) { this->lastGongHitType = DORA_HIT_STRONG; } - func_800BC848(&this->actor, globalCtx, 5, 10); + func_800BC848(&this->actor, play, 5, 10); ObjDora_SetupMoveGong(this); if ((ObjDora_IsHalfHour(time) == true) && (this->rupeeDropTimer == 0)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - itemDrop = Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE); + itemDrop = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); itemDrop->world.rot.y = this->actor.world.rot.y; itemDrop->world.rot.y += (s32)(Rand_Centered() * 90.0f * (0x10000 / 360.0f)); itemDrop->velocity.y = 5.0f; @@ -304,49 +304,49 @@ void ObjDora_UpdateCollision(ObjDora* this, GlobalContext* globalCtx) { if (this->collisionCooldownTimer > 0) { this->collisionCooldownTimer--; } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); } } -void ObjDora_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDora_Update(Actor* thisx, PlayState* play) { ObjDora* this = THIS; - this->actionFunc(this, globalCtx); - ObjDora_UpdateCollision(this, globalCtx); + this->actionFunc(this, play); + ObjDora_UpdateCollision(this, play); } -void ObjDora_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjDora_Draw(Actor* thisx, PlayState* play) { static Vec3f position = { 0.0f, -61.5f, 0.0f }; ObjDora* this = THIS; f32 gongForceX; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->actionFunc == ObjDora_MoveGong) { gongForceX = this->gongForce.x; - if ((globalCtx->state.frames % 2) != 0) { + if ((play->state.frames % 2) != 0) { gongForceX *= -1.0f; } Matrix_Push(); Matrix_RotateXS(this->gongRotation.x, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL); Matrix_Translate(position.x, position.y + gongForceX, position.z + gongForceX, MTXMODE_APPLY); Matrix_RotateXS(this->gongRotation.z - this->gongRotation.x, MTXMODE_APPLY); Matrix_Translate(-position.x, -position.y, -position.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); Matrix_Pop(); } else { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.h b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.h index a2dbbea162..2d1e43dcca 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.h +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.h @@ -5,7 +5,7 @@ struct ObjDora; -typedef void (*ObjDoraActionFunc)(struct ObjDora*, GlobalContext*); +typedef void (*ObjDoraActionFunc)(struct ObjDora*, PlayState*); typedef struct ObjDora { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c index dbc9451096..cbbdf82ed0 100644 --- a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c +++ b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c @@ -10,12 +10,12 @@ #define THIS ((ObjDowsing*)thisx) -void ObjDowsing_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDowsing_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDowsing_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjDowsing_Init(Actor* thisx, PlayState* play); +void ObjDowsing_Destroy(Actor* thisx, PlayState* play); +void ObjDowsing_Update(Actor* thisx, PlayState* play); -s32 ObjDowsing_GetFlag(ObjDowsing* this, GlobalContext* globalCtx); -s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, GlobalContext* globalCtx); +s32 ObjDowsing_GetFlag(ObjDowsing* this, PlayState* play); +s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, PlayState* play); const ActorInit Obj_Dowsing_InitVars = { ACTOR_OBJ_DOWSING, @@ -29,42 +29,42 @@ const ActorInit Obj_Dowsing_InitVars = { (ActorFunc)NULL, }; -s32 ObjDowsing_GetFlag(ObjDowsing* this, GlobalContext* globalCtx) { +s32 ObjDowsing_GetFlag(ObjDowsing* this, PlayState* play) { s32 type = DOWSING_GET_TYPE(&this->actor); s32 flag = DOWSING_GET_FLAG(&this->actor); if (type == DOWSING_COLLECTIBLE) { - return Flags_GetCollectible(globalCtx, flag); + return Flags_GetCollectible(play, flag); } else if (type == DOWSING_CHEST) { - return Flags_GetTreasure(globalCtx, flag); + return Flags_GetTreasure(play, flag); } else if (type == DOWSING_SWITCH) { - return Flags_GetSwitch(globalCtx, flag); + return Flags_GetSwitch(play, flag); } else { return 0; } } -s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, GlobalContext* globalCtx) { - if (ObjDowsing_GetFlag(this, globalCtx)) { +s32 ObjDowsing_CheckValidSpawn(ObjDowsing* this, PlayState* play) { + if (ObjDowsing_GetFlag(this, play)) { Actor_MarkForDeath(&this->actor); return true; } return false; } -void ObjDowsing_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDowsing_Init(Actor* thisx, PlayState* play) { ObjDowsing* this = THIS; - ObjDowsing_CheckValidSpawn(this, globalCtx); + ObjDowsing_CheckValidSpawn(this, play); } -void ObjDowsing_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDowsing_Destroy(Actor* thisx, PlayState* play) { } -void ObjDowsing_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDowsing_Update(Actor* thisx, PlayState* play) { ObjDowsing* this = THIS; - if (!ObjDowsing_CheckValidSpawn(this, globalCtx)) { - func_800B8C50(thisx, globalCtx); + if (!ObjDowsing_CheckValidSpawn(this, play)) { + func_800B8C50(thisx, play); } } diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c index abc8d6c858..5db0592524 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c @@ -11,19 +11,19 @@ #define THIS ((ObjDriftice*)thisx) -void ObjDriftice_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjDriftice_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjDriftice_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjDriftice_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjDriftice_Init(Actor* thisx, PlayState* play); +void ObjDriftice_Destroy(Actor* thisx, PlayState* play); +void ObjDriftice_Update(Actor* thisx, PlayState* play); +void ObjDriftice_Draw(Actor* thisx, PlayState* play); void func_80A671A8(ObjDriftice* this); -void func_80A671BC(ObjDriftice* this, GlobalContext* globalCtx); +void func_80A671BC(ObjDriftice* this, PlayState* play); void func_80A671CC(ObjDriftice* this); -void func_80A671E0(ObjDriftice* this, GlobalContext* globalCtx); +void func_80A671E0(ObjDriftice* this, PlayState* play); void func_80A6743C(ObjDriftice* this); -void func_80A67450(ObjDriftice* this, GlobalContext* globalCtx); +void func_80A67450(ObjDriftice* this, PlayState* play); void func_80A674A8(ObjDriftice* this); -void func_80A674C4(ObjDriftice* this, GlobalContext* globalCtx); +void func_80A674C4(ObjDriftice* this, PlayState* play); const ActorInit Obj_Driftice_InitVars = { ACTOR_OBJ_DRIFTICE, @@ -264,7 +264,7 @@ void func_80A66E30(ObjDrifticeStruct* arg0, ObjDriftice* this) { func_80A665AC(&this->dyna.actor.shape.rot.z, 0xA28); } -void ObjDriftice_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjDriftice_Init(Actor* thisx, PlayState* play) { s32 pad; ObjDriftice* this = THIS; f32* sp2C = D_80A67620[OBJDRIFTICE_GET_3(&this->dyna.actor)]; @@ -302,14 +302,14 @@ void ObjDriftice_Init(Actor* thisx, GlobalContext* globalCtx) { } DynaPolyActor_Init(&this->dyna, phi_a1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_driftice_Colheader_001AA8); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_driftice_Colheader_001AA8); if (sp20 != 0) { func_80A671A8(this); } else { this->dyna.actor.flags |= ACTOR_FLAG_10; - path = &globalCtx->setupPathList[OBJDRIFTICE_GET_1FC(&this->dyna.actor)]; + path = &play->setupPathList[OBJDRIFTICE_GET_1FC(&this->dyna.actor)]; this->unk_164 = 0; this->unk_160 = path->count - 1; this->unk_168 = 1; @@ -320,24 +320,24 @@ void ObjDriftice_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjDriftice_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjDriftice_Destroy(Actor* thisx, PlayState* play) { ObjDriftice* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80A671A8(ObjDriftice* this) { this->actionFunc = func_80A671BC; } -void func_80A671BC(ObjDriftice* this, GlobalContext* globalCtx) { +void func_80A671BC(ObjDriftice* this, PlayState* play) { } void func_80A671CC(ObjDriftice* this) { this->actionFunc = func_80A671E0; } -void func_80A671E0(ObjDriftice* this, GlobalContext* globalCtx) { +void func_80A671E0(ObjDriftice* this, PlayState* play) { f32 phi_f0; Vec3f sp40; f32 sp3C; @@ -389,7 +389,7 @@ void func_80A671E0(ObjDriftice* this, GlobalContext* globalCtx) { if ((this->unk_16C[0].x != points->x) || (this->unk_16C[0].y != points->y) || (this->unk_16C[0].z != points->z)) { func_80A6743C(this); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); sp30 = false; } } @@ -405,10 +405,10 @@ void func_80A6743C(ObjDriftice* this) { this->actionFunc = func_80A67450; } -void func_80A67450(ObjDriftice* this, GlobalContext* globalCtx) { +void func_80A67450(ObjDriftice* this, PlayState* play) { if (this->unk_248 < 0) { func_80A66570(this, this->unk_164); - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); func_80A671CC(this); } } @@ -418,7 +418,7 @@ void func_80A674A8(ObjDriftice* this) { this->actionFunc = func_80A674C4; } -void func_80A674C4(ObjDriftice* this, GlobalContext* globalCtx) { +void func_80A674C4(ObjDriftice* this, PlayState* play) { this->unk_24C--; if (this->unk_24C <= 0) { this->dyna.actor.speedXZ = 0.0f; @@ -426,7 +426,7 @@ void func_80A674C4(ObjDriftice* this, GlobalContext* globalCtx) { } } -void ObjDriftice_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjDriftice_Update(Actor* thisx, PlayState* play) { ObjDriftice* this = THIS; if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { @@ -445,15 +445,15 @@ void ObjDriftice_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y += this->unk_244; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (OBJDRIFTICE_GET_ROT(&this->dyna.actor) && (this->dyna.actor.flags & ACTOR_FLAG_40)) { func_80A66E30(&this->unk_170, this); } } -void ObjDriftice_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjDriftice_Draw(Actor* thisx, PlayState* play) { ObjDriftice* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_driftice_DL_0016A0); + Gfx_DrawDListOpa(play, object_driftice_DL_0016A0); } diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h index 190fbdcb64..42dc3e181e 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h @@ -5,7 +5,7 @@ struct ObjDriftice; -typedef void (*ObjDrifticeActionFunc)(struct ObjDriftice*, GlobalContext*); +typedef void (*ObjDrifticeActionFunc)(struct ObjDriftice*, PlayState*); #define OBJDRIFTICE_GET_3(thisx) ((thisx)->params & 3) #define OBJDRIFTICE_GET_1FC(thisx) (((thisx)->params >> 2) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c b/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c index 5109cf2849..d2da273b59 100644 --- a/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c +++ b/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c @@ -11,9 +11,9 @@ #define THIS ((ObjEnding*)thisx) -void ObjEnding_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjEnding_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjEnding_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjEnding_Init(Actor* thisx, PlayState* play); +void ObjEnding_Update(Actor* thisx, PlayState* play); +void ObjEnding_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Ending_InitVars = { ACTOR_OBJ_ENDING, @@ -36,7 +36,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void ObjEnding_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjEnding_Init(Actor* thisx, PlayState* play) { ObjEnding* this = THIS; AnimatedMaterial* animMat; @@ -48,23 +48,23 @@ void ObjEnding_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjEnding_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjEnding_Update(Actor* thisx, PlayState* play) { } -void ObjEnding_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjEnding_Draw(Actor* thisx, PlayState* play) { ObjEnding* this = THIS; Gfx* dl1; Gfx* dl2; if (this->animMat != NULL) { - AnimatedMat_Draw(globalCtx, this->animMat); + AnimatedMat_Draw(play, this->animMat); } dl1 = this->modelInfo->dLists[0]; if (dl1 != NULL) { - Gfx_DrawDListOpa(globalCtx, dl1); + Gfx_DrawDListOpa(play, dl1); } dl2 = this->modelInfo->dLists[1]; if (dl2 != NULL) { - Gfx_DrawDListXlu(globalCtx, dl2); + Gfx_DrawDListXlu(play, dl2); } } diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c index 7d662432a1..cd7106240a 100644 --- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c +++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c @@ -11,10 +11,10 @@ #define THIS ((ObjEntotu*)thisx) -void ObjEntotu_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjEntotu_Init(Actor* thisx, PlayState* play); +void ObjEntotu_Destroy(Actor* thisx, PlayState* play); +void ObjEntotu_Update(Actor* thisx, PlayState* play); +void ObjEntotu_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Entotu_InitVars = { ACTOR_OBJ_ENTOTU, @@ -96,23 +96,23 @@ void func_80A349C0(ObjEntotu* this) { Math_ApproachF(&this->unk_1B8.x, (temp2 == 0) ? 0.0f : 1.0f, 0.02f, 1000.0f); } -void func_80A34A44(ObjEntotu* this, GlobalContext* globalCtx) { +void func_80A34A44(ObjEntotu* this, PlayState* play) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_f53_obj_DL_000158); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A34B28(ObjEntotu* this, GlobalContext* globalCtx) { +void func_80A34B28(ObjEntotu* this, PlayState* play) { u8 sp57; u8 sp56; s32 i; @@ -130,25 +130,25 @@ void func_80A34B28(ObjEntotu* this, GlobalContext* globalCtx) { if (this->unk_1B8.x > 0.0f) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20)); gSPSegment(POLY_XLU_DISP++, 0x09, Lib_SegmentedToVirtual(this->unk_148)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_f53_obj_DL_001C00); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void ObjEntotu_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjEntotu_Init(Actor* thisx, PlayState* play) { ObjEntotu* this = THIS; Lib_MemCpy(this->unk_148, ovl_Obj_Entotu_Vtx_000D10, sizeof(ovl_Obj_Entotu_Vtx_000D10)); @@ -156,18 +156,18 @@ void ObjEntotu_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1C4 = 0; } -void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjEntotu_Destroy(Actor* thisx, PlayState* play) { } -void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjEntotu_Update(Actor* thisx, PlayState* play) { ObjEntotu* this = THIS; func_80A349C0(this); } -void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjEntotu_Draw(Actor* thisx, PlayState* play) { ObjEntotu* this = THIS; - func_80A34B28(this, globalCtx); - func_80A34A44(this, globalCtx); + func_80A34B28(this, play); + func_80A34A44(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index eb91a93d4c..fb7681f310 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -11,15 +11,15 @@ #define THIS ((ObjEtcetera*)thisx) -void ObjEtcetera_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjEtcetera_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjEtcetera_Init(Actor* thisx, PlayState* play); +void ObjEtcetera_Destroy(Actor* thisx, PlayState* play); +void ObjEtcetera_Update(Actor* thisx, PlayState* play); -void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, GlobalContext* globalCtx); -void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, GlobalContext* globalCtx); -void ObjEtcetera_Setup(ObjEtcetera* this, GlobalContext* globalCtx); -void ObjEtcetera_DrawIdle(Actor* thisx, GlobalContext* globalCtx); -void ObjEtcetera_DrawAnimated(Actor* thisx, GlobalContext* globalCtx); +void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, PlayState* play); +void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, PlayState* play); +void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play); +void ObjEtcetera_DrawIdle(Actor* thisx, PlayState* play); +void ObjEtcetera_DrawAnimated(Actor* thisx, PlayState* play); const ActorInit Obj_Etcetera_InitVars = { ACTOR_OBJ_ETCETERA, @@ -69,7 +69,7 @@ static f32 oscillationTable[] = { -1.0, -1.0, -1.0, -0.7, 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7, 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, }; -void ObjEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjEtcetera_Init(Actor* thisx, PlayState* play) { s32 pad; ObjEtcetera* this = THIS; s32 objectIndex; @@ -80,16 +80,16 @@ void ObjEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { if ((type < DEKU_FLOWER_TYPE_PINK) || (type >= DEKU_FLOWER_TYPE_MAX)) { type = DEKU_FLOWER_TYPE_PINK; } - objectIndex = Object_GetIndex(&globalCtx->objectCtx, objectIds[type]); + objectIndex = Object_GetIndex(&play->objectCtx, objectIds[type]); if (objectIndex >= 0) { this->objIndex = objectIndex; } pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 10.0f; pos.z = this->dyna.actor.world.pos.z; - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &floorBgId, &this->dyna.actor, &pos); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &floorBgId, &this->dyna.actor, &pos); this->dyna.actor.floorBgId = floorBgId; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->actionFunc = ObjEtcetera_Setup; Actor_SetScale(&this->dyna.actor, 0.01f); @@ -97,11 +97,11 @@ void ObjEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { this->burrowFlag = 0; } -void ObjEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjEtcetera_Destroy(Actor* thisx, PlayState* play) { ObjEtcetera* this = THIS; - 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); } /** @@ -109,12 +109,12 @@ void ObjEtcetera_Destroy(Actor* thisx, GlobalContext* globalCtx) { * where something interacts with it. When the player launches out of the flower, the * oscillation is handled by ObjEtcetera_DoBounceOscillation instead. */ -void ObjEtcetera_DoNormalOscillation(ObjEtcetera* this, GlobalContext* globalCtx) { +void ObjEtcetera_DoNormalOscillation(ObjEtcetera* this, PlayState* play) { if (this->oscillationTimer > 0) { s32 requiredScopeTemp; Actor_SetScale(&this->dyna.actor, - (oscillationTable[globalCtx->gameplayFrames % 18] * (0.0001f * this->oscillationTimer)) + 0.01f); + (oscillationTable[play->gameplayFrames % 18] * (0.0001f * this->oscillationTimer)) + 0.01f); this->dyna.actor.scale.y = 0.02f; this->oscillationTimer--; } else { @@ -130,9 +130,9 @@ void ObjEtcetera_StartRustleAnimation(ObjEtcetera* this) { this->actionFunc = ObjEtcetera_PlayRustleAnimation; } -void ObjEtcetera_Idle(ObjEtcetera* this, GlobalContext* globalCtx) { +void ObjEtcetera_Idle(ObjEtcetera* this, PlayState* play) { s16 minOscillationTimer; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if ((player->stateFlags3 & 0x200) && (this->dyna.actor.xzDistToPlayer < 20.0f)) { // Player is launching out of the Deku Flower @@ -177,10 +177,10 @@ void ObjEtcetera_Idle(ObjEtcetera* this, GlobalContext* globalCtx) { this->oscillationTimer = 10; ObjEtcetera_StartRustleAnimation(this); } - ObjEtcetera_DoNormalOscillation(this, globalCtx); + ObjEtcetera_DoNormalOscillation(this, play); } -void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, GlobalContext* globalCtx) { +void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, PlayState* play) { if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { this->burrowFlag |= 1; } else { @@ -190,7 +190,7 @@ void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, GlobalContext* globalCtx this->dyna.actor.draw = ObjEtcetera_DrawIdle; this->actionFunc = ObjEtcetera_Idle; } - ObjEtcetera_DoNormalOscillation(this, globalCtx); + ObjEtcetera_DoNormalOscillation(this, play); } /** @@ -198,7 +198,7 @@ void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, GlobalContext* globalCtx * or because the flower spawned after killing a Mad Scrub), this function makes the * flower oscillate stronger than it normally does, including an oscillation on the Y-axis. */ -void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, GlobalContext* globalCtx) { +void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, PlayState* play) { // In order to match, we are seemingly required to access scale.x at one point // without using this. We can create a thisx or dyna pointer to achieve that, but // it's more likely they used dyna given that DynaPolyActor_IsInRidingMovingState takes a DynaPolyActor. @@ -229,7 +229,7 @@ void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, GlobalContext* globalCtx this->dyna.actor.scale.y = 2.0f * scaleTemp; } -void ObjEtcetera_Setup(ObjEtcetera* this, GlobalContext* globalCtx) { +void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { CollisionHeader* colHeader = NULL; s32 type; CollisionHeader* collisionHeaders[] = { @@ -246,28 +246,28 @@ void ObjEtcetera_Setup(ObjEtcetera* this, GlobalContext* globalCtx) { type = DEKU_FLOWER_TYPE_PINK; } - if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) { + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->dyna.actor.objBankIndex = this->objIndex; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); + Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_Init(&this->dyna, 1); thisCollisionHeader = collisionHeaders[type]; if (thisCollisionHeader != 0) { CollisionHeader_GetVirtual(thisCollisionHeader, &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); type = DEKU_FLOWER_TYPE(&this->dyna.actor); switch (type) { case DEKU_FLOWER_TYPE_PINK: case DEKU_FLOWER_TYPE_PINK_SPAWNED_FROM_MAD_SCRUB: - SkelAnime_Init(globalCtx, &this->skelAnime, &gPinkDekuFlowerSkel, &gDekuFlowerBounceAnim, - this->jointTable, this->morphTable, DEKU_FLOWER_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gPinkDekuFlowerSkel, &gDekuFlowerBounceAnim, this->jointTable, + this->morphTable, DEKU_FLOWER_LIMB_MAX); this->dList = gPinkDekuFlowerIdleDL; break; case DEKU_FLOWER_TYPE_GOLD: case DEKU_FLOWER_TYPE_GOLD_SPAWNED_FROM_MAD_SCRUB: this->dList = gGoldDekuFlowerIdleDL; - SkelAnime_Init(globalCtx, &this->skelAnime, &gGoldDekuFlowerSkel.sh, &gDekuFlowerBounceAnim, + SkelAnime_Init(play, &this->skelAnime, &gGoldDekuFlowerSkel.sh, &gDekuFlowerBounceAnim, this->jointTable, this->morphTable, DEKU_FLOWER_LIMB_MAX); this->collider.dim.height = 20; break; @@ -300,7 +300,7 @@ void ObjEtcetera_Setup(ObjEtcetera* this, GlobalContext* globalCtx) { } } -void ObjEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjEtcetera_Update(Actor* thisx, PlayState* play) { ObjEtcetera* this = THIS; CollisionPoly* floorPoly; u8 floorBgId = this->dyna.actor.floorBgId; @@ -308,11 +308,11 @@ void ObjEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { if (floorBgId == BGCHECK_SCENE) { floorPoly = this->dyna.actor.floorPoly; if (floorPoly != NULL && this->burrowFlag & 1) { - func_800FAAB4(globalCtx, SurfaceType_GetLightSettingIndex(&globalCtx->colCtx, floorPoly, floorBgId)); + func_800FAAB4(play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, floorBgId)); } } - this->actionFunc(this, globalCtx); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + this->actionFunc(this, play); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } /** @@ -320,16 +320,16 @@ void ObjEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { * It draws the flower as a single, non-moving display list that encompasses the whole flower. * When an animation is finished, functions are expected to set the actor's draw function to this. */ -void ObjEtcetera_DrawIdle(Actor* thisx, GlobalContext* globalCtx) { +void ObjEtcetera_DrawIdle(Actor* thisx, PlayState* play) { ObjEtcetera* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->dList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /** @@ -337,9 +337,9 @@ void ObjEtcetera_DrawIdle(Actor* thisx, GlobalContext* globalCtx) { * It draws the flower as an animated bunch of limbs using the SkelAnime system. * When a function wants to play an animation, it is expected to set the actor's draw function to this. */ -void ObjEtcetera_DrawAnimated(Actor* thisx, GlobalContext* globalCtx) { +void ObjEtcetera_DrawAnimated(Actor* thisx, PlayState* play) { ObjEtcetera* this = THIS; - func_8012C5B0(globalCtx->state.gfxCtx); - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor); + func_8012C5B0(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h index a52f5ae2ef..83bcba080d 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h @@ -35,7 +35,7 @@ typedef enum { struct ObjEtcetera; -typedef void (*ObjEtceteraActionFunc)(struct ObjEtcetera*, GlobalContext*); +typedef void (*ObjEtceteraActionFunc)(struct ObjEtcetera*, PlayState*); typedef struct ObjEtcetera { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c index 705dc93bf0..54bd7966cd 100644 --- a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c +++ b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c @@ -11,10 +11,10 @@ #define THIS ((ObjFireshield*)thisx) -void ObjFireshield_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjFireshield_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjFireshield_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjFireshield_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjFireshield_Init(Actor* thisx, PlayState* play); +void ObjFireshield_Destroy(Actor* thisx, PlayState* play); +void ObjFireshield_Update(Actor* thisx, PlayState* play); +void ObjFireshield_Draw(Actor* thisx, PlayState* play); void func_80A4CABC(ObjFireshield* this); void func_80A4CB7C(ObjFireshield* this); @@ -138,10 +138,10 @@ void func_80A4CCBC(ObjFireshield* this) { void func_80A4CD28(ObjFireshield* this) { } -void func_80A4CD34(Actor* thisx, GlobalContext* globalCtx) { +void func_80A4CD34(Actor* thisx, PlayState* play) { s32 pad; ObjFireshield* this = THIS; - s32 sp24 = Flags_GetSwitch(globalCtx, OBJFIRESHIELD_GET_7F(&this->actor)); + s32 sp24 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_7F(&this->actor)); s32 phi_v1; s32 phi_a0; @@ -150,11 +150,11 @@ void func_80A4CD34(Actor* thisx, GlobalContext* globalCtx) { phi_v1 = false; phi_a0 = false; } else { - phi_v1 = Flags_GetTreasure(globalCtx, OBJFIRESHIELD_GET_1F00(&this->actor)); + phi_v1 = Flags_GetTreasure(play, OBJFIRESHIELD_GET_1F00(&this->actor)); phi_a0 = false; } } else { - phi_a0 = Flags_GetSwitch(globalCtx, OBJFIRESHIELD_GET_3F80(&this->actor)); + phi_a0 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_3F80(&this->actor)); phi_v1 = false; } @@ -173,7 +173,7 @@ void func_80A4CD34(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80A4CE28(ObjFireshield* this, GlobalContext* globalCtx) { +void func_80A4CE28(ObjFireshield* this, PlayState* play) { s32 pad; s32 sp30 = OBJFIRESHIELD_GET_7F(&this->actor); s32 pad2[2]; @@ -185,23 +185,23 @@ void func_80A4CE28(ObjFireshield* this, GlobalContext* globalCtx) { sp24 = false; sp20 = false; } else { - sp24 = Flags_GetTreasure(globalCtx, OBJFIRESHIELD_GET_1F00(&this->actor)); + sp24 = Flags_GetTreasure(play, OBJFIRESHIELD_GET_1F00(&this->actor)); sp20 = false; } } else { - sp20 = Flags_GetSwitch(globalCtx, OBJFIRESHIELD_GET_3F80(&this->actor)); + sp20 = Flags_GetSwitch(play, OBJFIRESHIELD_GET_3F80(&this->actor)); sp24 = false; } if (!sp24 || !sp20 || (this->unk_19C != 0)) { - s32 sp1C = Flags_GetSwitch(globalCtx, sp30); + s32 sp1C = Flags_GetSwitch(play, sp30); s32 temp_v0 = (sp30 & ~0x1F) >> 5; if (this->unk_19C == 2) { if (Math_StepToF(&this->unk_198, 1.0f, 0.03f)) { this->unk_19C = 1; if (((this->actor.home.rot.z * 10) > 0) && (this->unk_1A7 != 0)) { - Flags_UnsetSwitch(globalCtx, sp30); + Flags_UnsetSwitch(play, sp30); sp1C = false; } } @@ -267,7 +267,7 @@ void func_80A4D1CC(void) { D_80A4D864[3] = 0; } -void ObjFireshield_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjFireshield_Init(Actor* thisx, PlayState* play) { ObjFireshield* this = THIS; s32 temp = 0x8000; ObjFireshieldStruct* sp2C = &D_80A4D84C[OBJFIRESHIELD_GET_C000(&this->actor)]; @@ -297,24 +297,24 @@ void ObjFireshield_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.z = -thisx->home.rot.z; } - 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 *= sp2C->unk_00; this->actor.colChkInfo.mass = MASS_IMMOVABLE; func_80A4D174(this); - func_80A4CD34(&this->actor, globalCtx); + func_80A4CD34(&this->actor, play); this->actionFunc = func_80A4CD28; } -void ObjFireshield_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjFireshield_Destroy(Actor* thisx, PlayState* play) { ObjFireshield* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjFireshield_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjFireshield_Update(Actor* thisx, PlayState* play) { ObjFireshield* this = THIS; ObjFireshield* this2 = THIS; s32 sp44 = OBJFIRESHIELD_GET_ROTX(&this->actor); @@ -342,17 +342,17 @@ void ObjFireshield_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.atFlags &= ~AT_HIT; } else if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_800B8D98(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); + func_800B8D98(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); } - func_80A4CE28(this, globalCtx); + func_80A4CE28(this, play); this->actor.world.pos.y = ((sp44 ? 144.0f : -144.0f) * (1.0f - this2->unk_198)) + this->actor.home.pos.y; this->unk_1A6 = this->unk_198 * 255.0f; if (this->unk_198 >= 0.7f) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.dim.height = this->unk_198 * 80.0f; @@ -374,25 +374,25 @@ void ObjFireshield_Update(Actor* thisx, GlobalContext* globalCtx) { } 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); } } -void ObjFireshield_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjFireshield_Draw(Actor* thisx, PlayState* play) { ObjFireshield* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 220, 0, this->unk_1A6); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A4 & 0x7F, 0, 0x20, 0x40, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->unk_1A4 & 0x7F, 0, 0x20, 0x40, 1, 0, (this->unk_1A4 * -15) & 0xFF, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_02E510); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index d03912b14b..14cab51c35 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -11,17 +11,17 @@ #define THIS ((ObjFlowerpot*)thisx) -void ObjFlowerpot_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjFlowerpot_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjFlowerpot_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjFlowerpot_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjFlowerpot_Init(Actor* thisx, PlayState* play); +void ObjFlowerpot_Destroy(Actor* thisx, PlayState* play); +void ObjFlowerpot_Update(Actor* thisx, PlayState* play); +void ObjFlowerpot_Draw(Actor* thisx, PlayState* play); void func_80A1C818(ObjFlowerpot* this); -void func_80A1C838(ObjFlowerpot* this, GlobalContext* globalCtx); +void func_80A1C838(ObjFlowerpot* this, PlayState* play); void func_80A1CBF8(ObjFlowerpot* this); -void func_80A1CC0C(ObjFlowerpot* this, GlobalContext* globalCtx); +void func_80A1CC0C(ObjFlowerpot* this, PlayState* play); void func_80A1CD10(ObjFlowerpot* this); -void func_80A1CEF4(ObjFlowerpot* this2, GlobalContext* globalCtx); +void func_80A1CEF4(ObjFlowerpot* this2, PlayState* play); static u32 D_80A1D830; static MtxF D_80A1D838[8]; @@ -186,25 +186,25 @@ void func_80A1B840(MtxF* matrix) { } } -void func_80A1B914(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1B914(ObjFlowerpot* this, PlayState* play) { if (!(this->unk_1EA & 4)) { s32 temp_v0 = func_800A8150(ENOBJFLOWERPOT_GET_3F(&this->actor)); if (temp_v0 >= 0) { s32 params = ENOBJFLOWERPOT_GET_7F00(&this->actor); - Item_DropCollectible(globalCtx, &this->actor.world.pos, temp_v0 | (params << 8)); + Item_DropCollectible(play, &this->actor.world.pos, temp_v0 | (params << 8)); this->unk_1EA |= 4; } } } -void func_80A1B994(ObjFlowerpot* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); +void func_80A1B994(ObjFlowerpot* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); } -void func_80A1B9CC(ObjFlowerpot* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); +void func_80A1B9CC(ObjFlowerpot* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } void func_80A1BA04(ObjFlowerpot* this, Vec3f* arg1) { @@ -213,7 +213,7 @@ void func_80A1BA04(ObjFlowerpot* this, Vec3f* arg1) { Matrix_MultVec3f(&D_80A1D408, arg1); } -void func_80A1BA44(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1BA44(ObjFlowerpot* this, PlayState* play) { s32 i; Vec3f spD0; Vec3f spC4; @@ -253,18 +253,18 @@ void func_80A1BA44(ObjFlowerpot* this, GlobalContext* globalCtx) { phi_s1 = 0; } - EffectSsKakera_Spawn(globalCtx, &spC4, &spB8, &spC4, -600, phi_s0, 30, 0, 0, (Rand_ZeroOne() * 12.0f) + 16.6f, + EffectSsKakera_Spawn(play, &spC4, &spB8, &spC4, -600, phi_s0, 30, 0, 0, (Rand_ZeroOne() * 12.0f) + 16.6f, phi_s1, 0, 35, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0015B0); } spD0.y += 20.0f; - func_800BBFB0(globalCtx, &spD0, 30.0f, 2, 20, 50, 1); - func_800BBFB0(globalCtx, &spD0, 30.0f, 2, 10, 80, 1); - func_800BBFB0(globalCtx, &spD0, 30.0f, 1, 10, 40, 1); + func_800BBFB0(play, &spD0, 30.0f, 2, 20, 50, 1); + func_800BBFB0(play, &spD0, 30.0f, 2, 10, 80, 1); + func_800BBFB0(play, &spD0, 30.0f, 1, 10, 40, 1); } -void func_80A1BD80(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1BD80(ObjFlowerpot* this, PlayState* play) { s32 i; Vec3f spC8; Vec3f spBC; @@ -296,8 +296,8 @@ void func_80A1BD80(ObjFlowerpot* this, GlobalContext* globalCtx) { phi_s0 = 32; } - EffectSsKakera_Spawn(globalCtx, &spBC, &spB0, &spBC, -240, phi_s0, 40, 0, 0, (Rand_ZeroOne() * 20.0f) + 10.6f, - 0, 0, 42, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0015B0); + EffectSsKakera_Spawn(play, &spBC, &spB0, &spBC, -240, phi_s0, 40, 0, 0, (Rand_ZeroOne() * 20.0f) + 10.6f, 0, 0, + 42, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0015B0); } spBC.y = this->actor.world.pos.y + this->actor.depthInWater; @@ -305,16 +305,16 @@ void func_80A1BD80(ObjFlowerpot* this, GlobalContext* globalCtx) { for (phi_s1 = 0, i = 0; i < 4; i++, phi_s1 += 0x4000) { spBC.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s1) * 15.0f) + this->actor.world.pos.x; spBC.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s1) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &spBC, NULL, NULL, 0, 200); + EffectSsGSplash_Spawn(play, &spBC, NULL, NULL, 0, 200); } spBC.x = this->actor.world.pos.x; spBC.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &spBC, NULL, NULL, 0, 350); - EffectSsGRipple_Spawn(globalCtx, &spBC, 150, 650, 0); + EffectSsGSplash_Spawn(play, &spBC, NULL, NULL, 0, 350); + EffectSsGRipple_Spawn(play, &spBC, 150, 650, 0); } -void func_80A1C0FC(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1C0FC(ObjFlowerpot* this, PlayState* play) { Vec3f spC4; Vec3f spB8; Vec3f spAC; @@ -336,12 +336,12 @@ void func_80A1C0FC(ObjFlowerpot* this, GlobalContext* globalCtx) { spAC.z = spB8.z * 0.23f; Math_Vec3f_Sum(&spB8, &spC4, &spB8); - EffectSsKakera_Spawn(globalCtx, &spB8, &spAC, &spB8, -100, 64, 40, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, - 80, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); + EffectSsKakera_Spawn(play, &spB8, &spAC, &spB8, -100, 64, 40, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, 80, + -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); } } -void func_80A1C328(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1C328(ObjFlowerpot* this, PlayState* play) { Vec3f spC4; Vec3f spB8; Vec3f spAC; @@ -363,8 +363,8 @@ void func_80A1C328(ObjFlowerpot* this, GlobalContext* globalCtx) { spAC.z = spB8.z * 0.18f; Math_Vec3f_Sum(&spB8, &spC4, &spB8); - EffectSsKakera_Spawn(globalCtx, &spB8, &spAC, &spB8, -80, 64, 44, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, - 80, -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); + EffectSsKakera_Spawn(play, &spB8, &spAC, &spB8, -80, 64, 44, 0, 0, (Rand_ZeroOne() * 16.0f) + 14.0f, 0, 0, 80, + -1, ACTOR_DEMO_GETITEM, object_flowerpot_DL_0014F0); } } @@ -382,17 +382,17 @@ void func_80A1C554(ObjFlowerpot* this) { } } -void func_80A1C5E8(ObjFlowerpot* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); +void func_80A1C5E8(ObjFlowerpot* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); } -void func_80A1C62C(ObjFlowerpot* this, GlobalContext* globalCtx) { - if (!(this->unk_1EA & 4) && (globalCtx->roomCtx.currRoom.num != this->unk_1EC)) { +void func_80A1C62C(ObjFlowerpot* this, PlayState* play) { + if (!(this->unk_1EA & 4) && (play->roomCtx.currRoom.num != this->unk_1EC)) { this->unk_1EA |= 4; } } -void ObjFlowerpot_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjFlowerpot_Init(Actor* thisx, PlayState* play) { s32 pad; ObjFlowerpot* this = THIS; @@ -402,8 +402,8 @@ void ObjFlowerpot_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y = Rand_Next() >> 0x10; } - 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); Matrix_SetTranslateRotateYXZ(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &this->actor.shape.rot); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); @@ -422,17 +422,17 @@ void ObjFlowerpot_Init(Actor* thisx, GlobalContext* globalCtx) { D_80A1DA40 = Rand_Next() >> 0x10; D_80A1D404 = false; func_80A1B3D0(); - D_80A1D830 = globalCtx->gameplayFrames; + D_80A1D830 = play->gameplayFrames; } this->unk_1EB = D_80A1D400 & 7; D_80A1D400++; } -void ObjFlowerpot_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjFlowerpot_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjFlowerpot* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80A1C818(ObjFlowerpot* this) { @@ -440,16 +440,16 @@ void func_80A1C818(ObjFlowerpot* this) { this->unk_1EA |= 1; } -void func_80A1C838(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1C838(ObjFlowerpot* this, PlayState* play) { s32 pad; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { func_80A1CBF8(this); this->actor.room = -1; this->actor.colChkInfo.mass = 180; this->actor.flags |= ACTOR_FLAG_10; if (func_800A817C(ENOBJFLOWERPOT_GET_3F(&this->actor))) { - func_80A1B914(this, globalCtx); + func_80A1B914(this, play); } //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be @@ -457,42 +457,42 @@ void func_80A1C838(ObjFlowerpot* this, GlobalContext* globalCtx) { func_800B8E58((Player*)this, NA_SE_PL_PULL_UP_POT); } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { if (!(this->unk_1EA & 2)) { - func_80A1B914(this, globalCtx); - func_80A1C328(this, globalCtx); - func_80A1B9CC(this, globalCtx); + func_80A1B914(this, play); + func_80A1C328(this, play); + func_80A1B9CC(this, play); this->unk_1EA |= 2; } - func_80A1BD80(this, globalCtx); - func_80A1B994(this, globalCtx); + func_80A1BD80(this, play); + func_80A1B994(this, play); Actor_MarkForDeath(&this->actor); } else if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) && (this->collider.elements[0].info.acHitInfo->toucher.dmgFlags & 0x058BFFBC)) { if (!(this->unk_1EA & 2)) { - func_80A1B914(this, globalCtx); - func_80A1C0FC(this, globalCtx); - func_80A1B9CC(this, globalCtx); + func_80A1B914(this, play); + func_80A1C0FC(this, play); + func_80A1B9CC(this, play); this->unk_1EA |= 2; } - func_80A1BA44(this, globalCtx); - func_80A1B994(this, globalCtx); + func_80A1BA44(this, play); + func_80A1B994(this, play); Actor_MarkForDeath(&this->actor); } else { if (this->collider.elements[1].info.bumperFlags & BUMP_HIT) { if (!(this->unk_1EA & 2)) { this->unk_1EA |= 2; this->collider.elements[1].info.bumperFlags &= ~BUMP_ON; - func_80A1C0FC(this, globalCtx); - func_80A1B914(this, globalCtx); - func_80A1B9CC(this, globalCtx); + func_80A1C0FC(this, play); + func_80A1B914(this, play); + func_80A1B9CC(this, play); } } if (this->unk_1EA & 1) { Actor_MoveWithGravity(&this->actor); - func_80A1C5E8(this, globalCtx); + func_80A1C5E8(this, play); if (this->actor.bgCheckFlags & 1) { if (this->actor.colChkInfo.mass == MASS_IMMOVABLE) { - if (DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId) == NULL) { + if (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL) { this->actor.flags &= ~ACTOR_FLAG_10; this->unk_1EA &= ~0x1; } @@ -509,16 +509,16 @@ void func_80A1C838(ObjFlowerpot* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; if (this->actor.xzDistToPlayer < 600.0f) { - 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) { - s16 temp_v0_3 = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; + s16 temp_v0_3 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; if (ABS_ALT(temp_v0_3) >= 0x5556) { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 36.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -530,22 +530,22 @@ void func_80A1CBF8(ObjFlowerpot* this) { this->actionFunc = func_80A1CC0C; } -void func_80A1CC0C(ObjFlowerpot* this, GlobalContext* globalCtx) { +void func_80A1CC0C(ObjFlowerpot* this, PlayState* play) { s32 pad; - func_80A1C62C(this, globalCtx); + func_80A1C62C(this, play); - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { func_80A1C818(this); - func_800B8E58(GET_PLAYER(globalCtx), NA_SE_PL_PUT_DOWN_POT); + func_800B8E58(GET_PLAYER(play), NA_SE_PL_PUT_DOWN_POT); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } else { Actor_MoveWithGravity(&this->actor); func_80A1CD10(this); } - func_80A1C5E8(this, globalCtx); + func_80A1C5E8(this, play); } else { Vec3f sp30; s32 sp2C; @@ -554,7 +554,7 @@ void func_80A1CC0C(ObjFlowerpot* this, GlobalContext* globalCtx) { sp30.y = this->actor.world.pos.y + 20.0f; sp30.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); } } @@ -587,7 +587,7 @@ void func_80A1CD10(ObjFlowerpot* this) { } } -void func_80A1CEF4(ObjFlowerpot* this2, GlobalContext* globalCtx) { +void func_80A1CEF4(ObjFlowerpot* this2, PlayState* play) { ObjFlowerpot* this = this2; s32 sp28 = this->collider.elements[0].info.toucherFlags & TOUCH_HIT; @@ -599,31 +599,31 @@ void func_80A1CEF4(ObjFlowerpot* this2, GlobalContext* globalCtx) { this->unk_1E8--; } - func_80A1C62C(this, globalCtx); + func_80A1C62C(this, play); if ((this->actor.bgCheckFlags & (0x8 | 0x2 | 0x1)) || sp28 || (this->unk_1E8 <= 0)) { if (!(this->unk_1EA & 2)) { - func_80A1B914(this, globalCtx); - func_80A1C0FC(this, globalCtx); - func_80A1B9CC(this, globalCtx); + func_80A1B914(this, play); + func_80A1C0FC(this, play); + func_80A1B9CC(this, play); this->unk_1EA |= 2; } - func_80A1BA44(this, globalCtx); - func_80A1B994(this, globalCtx); + func_80A1BA44(this, play); + func_80A1B994(this, play); Actor_MarkForDeath(&this->actor); return; } if (this->actor.bgCheckFlags & 0x40) { if (!(this->unk_1EA & 2)) { - func_80A1B914(this, globalCtx); - func_80A1C328(this, globalCtx); - func_80A1B9CC(this, globalCtx); + func_80A1B914(this, play); + func_80A1C328(this, play); + func_80A1B9CC(this, play); this->unk_1EA |= 2; } - func_80A1BD80(this, globalCtx); - func_80A1B994(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + func_80A1BD80(this, play); + func_80A1B994(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); return; } @@ -640,34 +640,34 @@ void func_80A1CEF4(ObjFlowerpot* this2, GlobalContext* globalCtx) { this->actor.shape.rot.x += D_80A1D3F8; this->actor.shape.rot.y += D_80A1D3FC; - func_80A1C5E8(this, globalCtx); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + func_80A1C5E8(this, play); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } -void ObjFlowerpot_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjFlowerpot_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjFlowerpot* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80A1C554(this); - if ((D_80A1D830 != globalCtx->gameplayFrames) && (globalCtx->roomCtx.currRoom.unk3 == 0)) { + if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { func_80A1B3D0(); - D_80A1D830 = globalCtx->gameplayFrames; + D_80A1D830 = play->gameplayFrames; } } -void ObjFlowerpot_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjFlowerpot_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjFlowerpot* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_flowerpot_DL_0012E0); if ((this->actionFunc != func_80A1C838) || (this->unk_1EA & 1)) { @@ -678,11 +678,11 @@ void ObjFlowerpot_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (!(this->unk_1EA & 2)) { - if ((globalCtx->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { + if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A1B840(&D_80A1D838[this->unk_1EB]); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } } @@ -690,5 +690,5 @@ void ObjFlowerpot_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_flowerpot_DL_001408); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.h b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.h index 01557bc2bb..93a095d031 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.h +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.h @@ -5,7 +5,7 @@ struct ObjFlowerpot; -typedef void (*ObjFlowerpotActionFunc)(struct ObjFlowerpot*, GlobalContext*); +typedef void (*ObjFlowerpotActionFunc)(struct ObjFlowerpot*, PlayState*); #define ENOBJFLOWERPOT_GET_3F(thisx) ((thisx)->params & 0x3F) #define ENOBJFLOWERPOT_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c index 7bdaa8654e..99a481577e 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -11,8 +11,8 @@ #define THIS ((ObjFunen*)thisx) -void ObjFunen_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjFunen_Init(Actor* thisx, PlayState* play); +void ObjFunen_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Funen_InitVars = { ACTOR_OBJ_FUNEN, ACTORCAT_PROP, FLAGS, @@ -22,27 +22,27 @@ const ActorInit Obj_Funen_InitVars = { f32 D_80A198D0[] = { 0.1f, 0.024390244f }; -void ObjFunen_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjFunen_Init(Actor* thisx, PlayState* play) { ObjFunen* this = THIS; Actor_SetScale(&this->actor, D_80A198D0[this->actor.params & 1]); } -void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjFunen_Draw(Actor* thisx, PlayState* play) { s32 temp; s32 pad[2]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateYS((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000), MTXMODE_APPLY); + func_8012C2DC(play->state.gfxCtx); + Matrix_RotateYS((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - 0x8000), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); - temp = -(globalCtx->gameplayFrames & 0x7FFFFFFF) & 0x7F; + temp = -(play->gameplayFrames & 0x7FFFFFFF) & 0x7F; gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, temp, 0x20, 0x20, 1, 0, temp, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, temp, 0x20, 0x20, 1, 0, temp, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, object_funen_DL_0000D0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index bedb0a38f5..fba15eac77 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -11,18 +11,18 @@ #define THIS ((ObjGhaka*)thisx) -void ObjGhaka_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjGhaka_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjGhaka_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjGhaka_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjGhaka_Init(Actor* thisx, PlayState* play); +void ObjGhaka_Destroy(Actor* thisx, PlayState* play); +void ObjGhaka_Update(Actor* thisx, PlayState* play); +void ObjGhaka_Draw(Actor* thisx, PlayState* play); void func_80B3C260(ObjGhaka* this); void func_80B3C29C(ObjGhaka* this); void func_80B3C2B0(ObjGhaka* this); -void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx); -void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx); -void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx); -void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx); +void func_80B3C2C4(ObjGhaka* this, PlayState* play); +void func_80B3C39C(ObjGhaka* this, PlayState* play); +void func_80B3C4E0(ObjGhaka* this, PlayState* play); +void func_80B3C624(ObjGhaka* this, PlayState* play); const ActorInit Obj_Ghaka_InitVars = { ACTOR_OBJ_GHAKA, @@ -58,25 +58,25 @@ void func_80B3C2B0(ObjGhaka* this) { this->actionFunc = func_80B3C624; } -void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx) { +void func_80B3C2C4(ObjGhaka* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[20] & 0x20)) { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, - 0, this->dyna.actor.cutscene, this->dyna.actor.unk20, 0); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 0, + this->dyna.actor.cutscene, this->dyna.actor.unk20, 0); } else { - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, - 1, -1, this->dyna.actor.unk20, 0); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 1, -1, + this->dyna.actor.unk20, 0); } } -void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3C39C(ObjGhaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { func_80B3C29C(this); } else if (this->dyna.actor.xzDistToPlayer < 100.0f || this->dyna.actor.isTargeted) { if (distDiff <= -0x5556 || distDiff >= 0x5556) { - func_800B863C(&this->dyna.actor, globalCtx); + func_800B863C(&this->dyna.actor, play); if (player->transformation == PLAYER_FORM_GORON) { this->dyna.actor.textId = 0xCF3; } else { @@ -94,40 +94,40 @@ void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) { } } -void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx) { - u8 talkState = Message_GetState(&globalCtx->msgCtx); +void func_80B3C4E0(ObjGhaka* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); if (talkState == 5) { - if (Message_ShouldAdvance(globalCtx)) { - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + if (Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; func_80B3C260(this); } } else if (talkState == 4) { - if (Message_ShouldAdvance(globalCtx)) { - switch (globalCtx->msgCtx.choiceIndex) { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); this->dyna.actor.textId = 0xCF5; - Message_StartTextbox(globalCtx, this->dyna.actor.textId, &this->dyna.actor); + Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; case 1: func_8019F208(); this->dyna.actor.textId = 0xCF7; - Message_StartTextbox(globalCtx, this->dyna.actor.textId, &this->dyna.actor); + Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; case 2: func_8019F230(); - globalCtx->msgCtx.msgMode = 0x43; - globalCtx->msgCtx.unk12023 = 4; + play->msgCtx.msgMode = 0x43; + play->msgCtx.unk12023 = 4; func_80B3C260(this); } } } } -void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B3C624(ObjGhaka* this, PlayState* play) { + Player* player = GET_PLAYER(play); u8 stepTemp = Math_StepToS(&this->unk_168, 0x64, 1); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + this->unk_168; @@ -135,7 +135,7 @@ void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { if (stepTemp) { player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; - func_80B3C2C4(this, globalCtx); + func_80B3C2C4(this, play); gSaveContext.save.weekEventReg[20] |= 0x20; func_80B3C260(this); Audio_PlaySfxAtPos(&D_80B3C960, NA_SE_EV_BLOCK_BOUND); @@ -144,7 +144,7 @@ void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { } } -void ObjGhaka_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjGhaka_Init(Actor* thisx, PlayState* play) { ObjGhaka* this = THIS; s32 pad; CollisionHeader* colHeader = NULL; @@ -153,39 +153,39 @@ void ObjGhaka_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_ghaka_Colheader_003CD0, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x4); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x4); if (this->dyna.actor.floorPoly == 0) { Actor_MarkForDeath(&this->dyna.actor); } if (gSaveContext.save.weekEventReg[20] & 0x20) { - func_80B3C2C4(this, globalCtx); + func_80B3C2C4(this, play); } func_80B3C260(this); } -void ObjGhaka_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjGhaka_Destroy(Actor* thisx, PlayState* play) { ObjGhaka* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjGhaka_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjGhaka_Update(Actor* thisx, PlayState* play) { ObjGhaka* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); thisx->focus.pos.x = thisx->world.pos.x; thisx->focus.pos.y = thisx->world.pos.y + 60.0f; thisx->focus.pos.z = thisx->world.pos.z; } -void ObjGhaka_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +void ObjGhaka_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_ghaka_DL_001A20); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ghaka_DL_001980); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h index d375d6374b..275928f47a 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h @@ -5,7 +5,7 @@ struct ObjGhaka; -typedef void (*ObjGhakaActionFunc)(struct ObjGhaka*, GlobalContext*); +typedef void (*ObjGhakaActionFunc)(struct ObjGhaka*, PlayState*); typedef struct ObjGhaka { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c index 705325429e..53dad10d92 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -12,10 +12,10 @@ #define THIS ((ObjGrass*)thisx) -void ObjGrass_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjGrass_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjGrass_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjGrass_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjGrass_Init(Actor* thisx, PlayState* play); +void ObjGrass_Destroy(Actor* thisx, PlayState* play); +void ObjGrass_Update(Actor* thisx, PlayState* play); +void ObjGrass_Draw(Actor* thisx, PlayState* play); ObjGrassStruct1* D_809AADA0[4]; f32 D_809AADB0[4]; @@ -65,19 +65,19 @@ Vec3f D_809AAB4C[] = { s16 D_809AAB7C[] = { 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26 }; -s32 func_809A9110(GlobalContext* globalCtx, Vec3f* arg1) { +s32 func_809A9110(PlayState* play, Vec3f* arg1) { f32 sp2C; Vec3f sp20; - SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, arg1, &sp20, &sp2C); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, &sp20, &sp2C); - if ((globalCtx->unk_187F0.z * -130.13191f) < sp20.z) { + if ((play->unk_187F0.z * -130.13191f) < sp20.z) { if (sp2C < 1.0f) { sp2C = 1.0f; } - if (((fabsf(sp20.x) - (130.13191f * globalCtx->unk_187F0.x)) < sp2C) && - ((fabsf(sp20.y) - (130.13191f * globalCtx->unk_187F0.y)) < sp2C)) { + if (((fabsf(sp20.x) - (130.13191f * play->unk_187F0.x)) < sp2C) && + ((fabsf(sp20.y) - (130.13191f * play->unk_187F0.y)) < sp2C)) { return true; } } @@ -95,13 +95,13 @@ void func_809A91FC(MtxF* matrix) { } } -void func_809A92D0(ObjGrassStruct1_1* ptr, GlobalContext* globalCtx) { +void func_809A92D0(ObjGrassStruct1_1* ptr, PlayState* play) { if (!(ptr->unk_0E & 0x10)) { - Item_DropCollectibleRandom(globalCtx, NULL, &ptr->unk_00, ptr->unk_0E * 0x10); + Item_DropCollectibleRandom(play, NULL, &ptr->unk_00, ptr->unk_0E * 0x10); } } -void func_809A9314(ObjGrassStruct1_1* ptr, GlobalContext* globalCtx) { +void func_809A9314(ObjGrassStruct1_1* ptr, PlayState* play) { Vec3f spBC; Vec3f spB0; s32 i; @@ -118,7 +118,7 @@ void func_809A9314(ObjGrassStruct1_1* ptr, GlobalContext* globalCtx) { spBC.y = Rand_ZeroOne() * 10.0f; spBC.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - EffectSsKakera_Spawn(globalCtx, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, + EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, D_809AAB7C[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, 1, gKakeraLeafMiddle); spB0.x = ptr->unk_00.x + (ptr2->x * 16.0f); @@ -129,20 +129,20 @@ void func_809A9314(ObjGrassStruct1_1* ptr, GlobalContext* globalCtx) { spBC.y = Rand_ZeroOne() * 10.0f; spBC.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - EffectSsKakera_Spawn(globalCtx, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, + EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, D_809AAB7C[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, 1, gKakeraLeafTip); } } -void ObjGrass_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrass_Init(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; s32 i; Actor_SetScale(&this->actor, 0.4f); for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - Collider_InitCylinder(globalCtx, &this->unk_2948[i].collider); - Collider_SetCylinder(globalCtx, &this->unk_2948[i].collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->unk_2948[i].collider); + Collider_SetCylinder(play, &this->unk_2948[i].collider, &this->actor, &sCylinderInit); } this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -153,12 +153,12 @@ void ObjGrass_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_3290 = Rand_Next() >> 0x10; } -void ObjGrass_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrass_Destroy(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; s32 i; for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { - Collider_DestroyCylinder(globalCtx, &this->unk_2948[i].collider); + Collider_DestroyCylinder(play, &this->unk_2948[i].collider); } for (i = 0; i < ARRAY_COUNT(this->unk_3298); i++) { @@ -171,23 +171,23 @@ void ObjGrass_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_809A9790(ObjGrass* this, GlobalContext* globalCtx) { +void func_809A9790(ObjGrass* this, PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(this->unk_2948); i++) { ObjGrassStruct1_1* ptr = this->unk_2948[i].unk_4C; if ((ptr != NULL) && (this->unk_2948[i].collider.base.acFlags & AC_HIT)) { - func_809A9314(ptr, globalCtx); - func_809A92D0(ptr, globalCtx); + func_809A9314(ptr, play); + func_809A92D0(ptr, play); ptr->unk_0F |= 4; - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &ptr->unk_00, 20, NA_SE_EV_PLANT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &ptr->unk_00, 20, NA_SE_EV_PLANT_BROKEN); } } } -void func_809A983C(ObjGrass* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_809A983C(ObjGrass* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 i; s32 j; s32 x; @@ -287,8 +287,8 @@ void func_809A983C(ObjGrass* this, GlobalContext* globalCtx) { ptr3->collider.dim.pos.x = ptr2->unk_00.x; ptr3->collider.dim.pos.y = ptr2->unk_00.y; ptr3->collider.dim.pos.z = ptr2->unk_00.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &ptr3->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &ptr3->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &ptr3->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &ptr3->collider.base); ptr2->unk_0F |= 2; ptr3->unk_4C = ptr2; } else { @@ -375,15 +375,15 @@ void func_809A9DB8(ObjGrass* this) { } } -void ObjGrass_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrass_Update(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; - func_809A9790(this, globalCtx); - func_809A983C(this, globalCtx); + func_809A9790(this, play); + func_809A983C(this, play); func_809A9DB8(this); } -void func_809AA278(ObjGrass* this, GlobalContext* globalCtx) { +void func_809AA278(ObjGrass* this, PlayState* play) { ObjGrassStruct1* ptr; ObjGrassStruct1_1* ptr2; s32 i; @@ -394,9 +394,9 @@ void func_809AA278(ObjGrass* this, GlobalContext* globalCtx) { for (i = 0; i < this->unk_2944; i++) { ptr = &this->unk_144[i]; - temp_f22 = Math3D_Vec3fDistSq(&ptr->unk_00, &GET_ACTIVE_CAM(globalCtx)->eye); + temp_f22 = Math3D_Vec3fDistSq(&ptr->unk_00, &GET_ACTIVE_CAM(play)->eye); - if ((temp_f22 < SQ(1280.0f)) && func_809A9110(globalCtx, &ptr->unk_00)) { + if ((temp_f22 < SQ(1280.0f)) && func_809A9110(play, &ptr->unk_00)) { ptr->unk_FE |= 1; for (j = 0; j < ptr->unk_FC; j++) { @@ -410,7 +410,7 @@ void func_809AA278(ObjGrass* this, GlobalContext* globalCtx) { if (temp_f22 < SQ(980.0f)) { ptr2->unk_10 = 255; } else { - distSq = Math3D_Vec3fDistSq(&ptr2->unk_00, &GET_ACTIVE_CAM(globalCtx)->eye); + distSq = Math3D_Vec3fDistSq(&ptr2->unk_00, &GET_ACTIVE_CAM(play)->eye); if ((distSq <= SQ(1080.0f)) || ((ptr2->unk_0F & 8) && (distSq < SQ(1180.0f)))) { ptr2->unk_10 = 255; } else if (distSq >= SQ(1180.0f)) { @@ -427,9 +427,9 @@ void func_809AA278(ObjGrass* this, GlobalContext* globalCtx) { } } -void func_809AA54C(Actor* thisx, GlobalContext* globalCtx2) { +void func_809AA54C(Actor* thisx, PlayState* play2) { ObjGrass* this = THIS; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; Lights* temp_s0; ObjGrassStruct1* ptr; s32 i; @@ -437,9 +437,9 @@ void func_809AA54C(Actor* thisx, GlobalContext* globalCtx2) { Vec3s sp70 = { 0, 0, 0 }; ObjGrassStruct1_1* ptr2; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, gObjGrass_D_809AA9F0); @@ -448,9 +448,9 @@ void func_809AA54C(Actor* thisx, GlobalContext* globalCtx2) { ptr = &this->unk_144[i]; if (ptr->unk_FE & 1) { - temp_s0 = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx); - Lights_BindAll(temp_s0, globalCtx->lightCtx.listHead, &ptr->unk_00, globalCtx); - Lights_Draw(temp_s0, globalCtx->state.gfxCtx); + temp_s0 = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); + Lights_BindAll(temp_s0, play->lightCtx.listHead, &ptr->unk_00, play); + Lights_Draw(temp_s0, play->state.gfxCtx); for (j = 0; j < ptr->unk_FC; j++) { ptr2 = &ptr->unk_0C[j]; @@ -463,7 +463,7 @@ void func_809AA54C(Actor* thisx, GlobalContext* globalCtx2) { func_809A91FC(&this->unk_2F88[j]); } - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gObjGrass_D_809AAAE0); } @@ -471,10 +471,10 @@ void func_809AA54C(Actor* thisx, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_809AA798(Actor* thisx, GlobalContext* globalCtx) { +void func_809AA798(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; ObjGrassStruct1* ptr; ObjGrassStruct1_1* ptr2; @@ -482,9 +482,9 @@ void func_809AA798(Actor* thisx, GlobalContext* globalCtx) { s32 j; Vec3s sp6C = { 0, 0, 0 }; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gObjGrass_D_809AAA68); @@ -500,7 +500,7 @@ void func_809AA798(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, &sp6C); 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), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, ptr2->unk_10); gSPDisplayList(POLY_XLU_DISP++, gObjGrass_D_809AAAE0); @@ -509,13 +509,13 @@ void func_809AA798(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjGrass_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrass_Draw(Actor* thisx, PlayState* play) { ObjGrass* this = THIS; - func_809AA278(this, globalCtx); - func_809AA54C(thisx, globalCtx); - func_809AA798(thisx, globalCtx); + func_809AA278(this, play); + func_809AA54C(thisx, play); + func_809AA798(thisx, play); } diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c index 2e9df3323b..11c8619ce1 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c @@ -13,21 +13,21 @@ #define THIS ((ObjGrassCarry*)thisx) -void ObjGrassCarry_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjGrassCarry_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjGrassCarry_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjGrassCarry_Init(Actor* thisx, PlayState* play); +void ObjGrassCarry_Destroy(Actor* thisx, PlayState* play); +void ObjGrassCarry_Update(Actor* thisx, PlayState* play); void func_809AB3C4(ObjGrassCarry* this); -void func_809AB3D8(ObjGrassCarry* this, GlobalContext* globalCtx); +void func_809AB3D8(ObjGrassCarry* this, PlayState* play); void func_809AB428(ObjGrassCarry* this); -void func_809AB43C(ObjGrassCarry* this, GlobalContext* globalCtx); +void func_809AB43C(ObjGrassCarry* this, PlayState* play); void func_809AB474(ObjGrassCarry* this); -void func_809AB4A8(ObjGrassCarry* this, GlobalContext* globalCtx); +void func_809AB4A8(ObjGrassCarry* this, PlayState* play); void func_809AB5FC(ObjGrassCarry* this); -void func_809AB610(ObjGrassCarry* this, GlobalContext* globalCtx); +void func_809AB610(ObjGrassCarry* this, PlayState* play); void func_809AB6FC(ObjGrassCarry* this); -void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx); -void func_809ABB7C(Actor* this, GlobalContext* globalCtx); +void func_809AB77C(ObjGrassCarry* this, PlayState* play); +void func_809ABB7C(Actor* this, PlayState* play); const ActorInit Obj_Grass_Carry_InitVars = { ACTOR_OBJ_GRASS_CARRY, @@ -102,17 +102,17 @@ void func_809AAF18(ObjGrassCarry* this) { Actor_UpdatePos(&this->actor); } -void func_809AAF58(ObjGrassCarry* this, GlobalContext* globalCtx) { - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); +void func_809AAF58(ObjGrassCarry* this, PlayState* play) { + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); } -void func_809AAF9C(Vec3f* arg0, s16 arg1, GlobalContext* globalCtx) { +void func_809AAF9C(Vec3f* arg0, s16 arg1, PlayState* play) { if (!(arg1 & 0x10)) { - Item_DropCollectibleRandom(globalCtx, NULL, arg0, arg1 * 0x10); + Item_DropCollectibleRandom(play, NULL, arg0, arg1 * 0x10); } } -void func_809AAFE8(Vec3f* arg0, GlobalContext* globalCtx) { +void func_809AAFE8(Vec3f* arg0, PlayState* play) { Vec3f spBC; Vec3f spB0; s32 i; @@ -129,7 +129,7 @@ void func_809AAFE8(Vec3f* arg0, GlobalContext* globalCtx) { spBC.y = Rand_ZeroOne() * 10.0f; spBC.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - EffectSsKakera_Spawn(globalCtx, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, + EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, D_809ABC3C[(s32)(Rand_ZeroOne() * 111.1f) & 7], 0, 0, 80, -1, 1, gKakeraLeafMiddle); spB0.x = arg0->x + (ptr->x * 16.0f); @@ -140,25 +140,25 @@ void func_809AAFE8(Vec3f* arg0, GlobalContext* globalCtx) { spBC.y = Rand_ZeroOne() * 10.0f; spBC.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - EffectSsKakera_Spawn(globalCtx, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, + EffectSsKakera_Spawn(play, &spB0, &spBC, &spB0, -100, 64, 40, 3, 0, D_809ABC3C[(s32)(Rand_ZeroOne() * 111.1f) % 7], 0, 0, 80, -1, 1, gKakeraLeafTip); } } -void ObjGrassCarry_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrassCarry_Init(Actor* thisx, PlayState* play) { ObjGrassCarry* this = THIS; 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 = 80; func_809AB3C4(this); } -void ObjGrassCarry_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrassCarry_Destroy(Actor* thisx, PlayState* play) { ObjGrassCarry* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); if (this->unk_190 != NULL) { ObjGrassCarry** carry = &this->unk_190->unk_3298[this->actor.params]; @@ -174,7 +174,7 @@ void func_809AB3C4(ObjGrassCarry* this) { this->actionFunc = func_809AB3D8; } -void func_809AB3D8(ObjGrassCarry* this, GlobalContext* globalCtx) { +void func_809AB3D8(ObjGrassCarry* this, PlayState* play) { if (this->unk_190 != NULL) { if (this->actor.params != this->unk_190->unk_3292) { func_809AB474(this); @@ -188,7 +188,7 @@ void func_809AB428(ObjGrassCarry* this) { this->actionFunc = func_809AB43C; } -void func_809AB43C(ObjGrassCarry* this, GlobalContext* globalCtx) { +void func_809AB43C(ObjGrassCarry* this, PlayState* play) { if (this->actor.params != this->unk_190->unk_3292) { func_809AB474(this); } @@ -205,10 +205,10 @@ void func_809AB474(ObjGrassCarry* this) { this->actor.world.rot.x = this->actor.shape.rot.z; } -void func_809AB4A8(ObjGrassCarry* this, GlobalContext* globalCtx) { +void func_809AB4A8(ObjGrassCarry* this, PlayState* play) { ObjGrassCarry* this2 = this; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { func_809AB5FC(this); if (this->unk_194 != NULL) { this->unk_194->unk_0F |= 4; @@ -219,9 +219,9 @@ void func_809AB4A8(ObjGrassCarry* this, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 1.0f; this->unk_190->unk_3292 ^= 1; this->actor.room = -1; - 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->unk_190->unk_3294 != NULL) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->unk_194 = this->unk_190->unk_3294; Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_194->unk_00); @@ -231,7 +231,7 @@ void func_809AB4A8(ObjGrassCarry* this, GlobalContext* globalCtx) { this->actor.playerHeightRel = Actor_HeightDiff(&this->actor, &player->actor); this->actor.xyzDistToPlayerSq = SQ(this->actor.xzDistToPlayer) + SQ(this->actor.playerHeightRel); this->actor.yawTowardsPlayer = Actor_YawBetweenActors(&this->actor, &player->actor); - Actor_LiftActor(&this->actor, globalCtx); + Actor_LiftActor(&this->actor, play); } } @@ -239,26 +239,26 @@ void func_809AB5FC(ObjGrassCarry* this) { this->actionFunc = func_809AB610; } -void func_809AB610(ObjGrassCarry* this, GlobalContext* globalCtx) { +void func_809AB610(ObjGrassCarry* this, PlayState* play) { s32 pad; Vec3f sp30; s32 sp2C; - if (Actor_HasNoParent(&this->actor, globalCtx)) { + if (Actor_HasNoParent(&this->actor, play)) { func_809AB6FC(this); this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; this->actor.gravity = -0.1f; this->actor.terminalVelocity = -17.0f; func_809AAF18(this); - func_809AAF58(this, globalCtx); + func_809AAF58(this, play); this->actor.gravity = -3.2f; } else { sp30.x = this->actor.world.pos.x; sp30.y = this->actor.world.pos.y + 20.0f; sp30.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); } } @@ -271,7 +271,7 @@ void func_809AB6FC(ObjGrassCarry* this) { this->unk_19A = 60; } -void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { +void func_809AB77C(ObjGrassCarry* this, PlayState* play) { s16 phi_s0; s32 temp_v0 = (this->collider.base.atFlags & AT_HIT) != 0; Vec3f sp5C; @@ -284,8 +284,8 @@ void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { this->unk_19A--; if ((this->actor.bgCheckFlags & (1 | 2 | 8)) || temp_v0 || (this->unk_19A <= 0)) { - func_809AAFE8(&this->actor.world.pos, globalCtx); - func_809AAF9C(&this->actor.world.pos, this->unk_198, globalCtx); + func_809AAFE8(&this->actor.world.pos, play); + func_809AAF9C(&this->actor.world.pos, this->unk_198, play); this->actor.draw = NULL; this->actor.shape.shadowDraw = NULL; @@ -295,7 +295,7 @@ void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { } if (!(this->actor.bgCheckFlags & 0x20)) { - 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); } func_809AB428(this); return; @@ -307,14 +307,14 @@ void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { for (phi_s0 = 0, i = 0; i < 4; i++, phi_s0 += 0x4000) { sp5C.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.x; sp5C.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp5C, NULL, NULL, 0, 190); + EffectSsGSplash_Spawn(play, &sp5C, NULL, NULL, 0, 190); } sp5C.x = this->actor.world.pos.x; sp5C.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp5C, NULL, NULL, 0, 280); - EffectSsGRipple_Spawn(globalCtx, &sp5C, 300, 700, 0); + EffectSsGSplash_Spawn(play, &sp5C, NULL, NULL, 0, 280); + EffectSsGRipple_Spawn(play, &sp5C, 300, 700, 0); this->actor.terminalVelocity = -3.0f; this->actor.velocity.x *= 0.1f; @@ -327,7 +327,7 @@ void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { D_809ABC08 = D_809ABC08 >> 1; D_809ABC04 = D_809ABC04 >> 1; this->actor.bgCheckFlags &= ~0x40; - 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); } Math_StepToS(&D_809ABC00, D_809ABBFC, 0x1F4); @@ -335,14 +335,14 @@ void func_809AB77C(ObjGrassCarry* this, GlobalContext* globalCtx) { this->actor.shape.rot.x += D_809ABC00; this->actor.shape.rot.y += D_809ABC08; func_809AAF18(this); - func_809AAF58(this, globalCtx); + func_809AAF58(this, play); 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); } -void ObjGrassCarry_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjGrassCarry_Update(Actor* thisx, PlayState* play) { ObjGrassCarry* this = THIS; if (this->unk_190 == NULL) { @@ -352,9 +352,9 @@ void ObjGrassCarry_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void func_809ABB7C(Actor* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gKusaBushType1); +void func_809ABB7C(Actor* this, PlayState* play) { + Gfx_DrawDListOpa(play, gKusaBushType1); } diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h index 50d2f61f71..f46940f1b1 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h @@ -7,7 +7,7 @@ struct ObjGrassCarry; struct ObjGrass; struct ObjGrassStruct1_1; -typedef void (*ObjGrassCarryActionFunc)(struct ObjGrassCarry*, GlobalContext*); +typedef void (*ObjGrassCarryActionFunc)(struct ObjGrassCarry*, PlayState*); typedef struct ObjGrassCarry { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c index 88beb7a6b8..125c788508 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c +++ b/src/overlays/actors/ovl_Obj_Grass_Unit/z_obj_grass_unit.c @@ -10,7 +10,7 @@ #define THIS ((ObjGrassUnit*)thisx) -void ObjGrassUnit_Init(Actor* thisx, GlobalContext* globalCtx); +void ObjGrassUnit_Init(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Grass_Unit_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index c6dac659e3..8e5a6d4a01 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -11,31 +11,31 @@ #define THIS ((ObjHakaisi*)thisx) -void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHakaisi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHakaisi_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHakaisi_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHakaisi_Init(Actor* thisx, PlayState* play); +void ObjHakaisi_Destroy(Actor* thisx, PlayState* play); +void ObjHakaisi_Update(Actor* thisx, PlayState* play); +void ObjHakaisi_Draw(Actor* thisx, PlayState* play); void func_80B1444C(ObjHakaisi* this); -void func_80B14460(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14460(ObjHakaisi* this, PlayState* play); void func_80B14510(ObjHakaisi* this); -void func_80B14524(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14524(ObjHakaisi* this, PlayState* play); void func_80B14558(ObjHakaisi* this); -void func_80B1456C(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B1456C(ObjHakaisi* this, PlayState* play); void func_80B145F4(ObjHakaisi* this); -void func_80B14648(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14648(ObjHakaisi* this, PlayState* play); void func_80B149A8(ObjHakaisi* this); -void func_80B149C0(ObjHakaisi* this, GlobalContext* globalCtx); -void func_80B14A24(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec); -void func_80B14B6C(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec, s16 arg3); -void func_80B14CF8(GlobalContext* globalCtx, Vec3f vec, s16 arg2, s16 arg3, s32 arg4); -void func_80B14F4C(ObjHakaisi* this, GlobalContext* globalCtx, s32 arg2); -void func_80B151E0(ObjHakaisi* this, GlobalContext* globalCtx); -void func_80B15254(Actor* thisx, GlobalContext* globalCtx); +void func_80B149C0(ObjHakaisi* this, PlayState* play); +void func_80B14A24(ObjHakaisi* this, PlayState* play, Vec3f vec); +void func_80B14B6C(ObjHakaisi* this, PlayState* play, Vec3f vec, s16 arg3); +void func_80B14CF8(PlayState* play, Vec3f vec, s16 arg2, s16 arg3, s32 arg4); +void func_80B14F4C(ObjHakaisi* this, PlayState* play, s32 arg2); +void func_80B151E0(ObjHakaisi* this, PlayState* play); +void func_80B15254(Actor* thisx, PlayState* play); void func_80B15264(ObjHakaisi* this); -void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx); -void func_80B1544C(Actor* thisx, GlobalContext* globalCtx); -void func_80B154A0(Actor* thisx, GlobalContext* globalCtx); +void func_80B15330(ObjHakaisi* this, PlayState* play); +void func_80B1544C(Actor* thisx, PlayState* play); +void func_80B154A0(Actor* thisx, PlayState* play); const ActorInit Obj_Hakaisi_InitVars = { ACTOR_OBJ_HAKAISI, @@ -63,7 +63,7 @@ Color_RGBA8 D_80B155FC = { 100, 60, 20, 0 }; Vec3f D_80B15600 = { 1.0f, 0.0f, 0.0f }; -void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHakaisi_Init(Actor* thisx, PlayState* play) { s32 pad; ObjHakaisi* this = THIS; CollisionHeader* sp7C = NULL; @@ -89,7 +89,7 @@ void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { case 4: case 5: - func_80B151E0(this, globalCtx); + func_80B151E0(this, play); return; default: @@ -109,7 +109,7 @@ void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_hakaisi_Colheader_002FC4, &sp7C); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp7C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp7C); this->unk_19A = 0; this->unk_198 = 0; this->switchFlag = OBJHAKAISI_GET_SWITCHFLAG(thisx); @@ -119,11 +119,11 @@ void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { this->switchFlag = -1; } - if ((this->switchFlag != -1) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + if ((this->switchFlag != -1) && Flags_GetSwitch(play, this->switchFlag)) { Actor_MarkForDeath(&this->dyna.actor); } - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); if (this->dyna.actor.floorPoly == NULL) { Actor_MarkForDeath(&this->dyna.actor); @@ -149,11 +149,11 @@ void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B1444C(this); } -void ObjHakaisi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHakaisi_Destroy(Actor* thisx, PlayState* play) { ObjHakaisi* this = THIS; if (OBJHAKAISI_GET_FF(&this->dyna.actor) != 3) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -161,14 +161,14 @@ void func_80B1444C(ObjHakaisi* this) { this->actionFunc = func_80B14460; } -void func_80B14460(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B14460(ObjHakaisi* this, PlayState* play) { s16 sp26 = BINANG_SUB(this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer); - if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { func_80B14510(this); } else if (this->dyna.actor.textId != 0) { if (ABS_ALT(sp26) < 0x2000) { - func_800B8614(&this->dyna.actor, globalCtx, 100.0f); + func_800B8614(&this->dyna.actor, play, 100.0f); } } @@ -181,8 +181,8 @@ void func_80B14510(ObjHakaisi* this) { this->actionFunc = func_80B14524; } -void func_80B14524(ObjHakaisi* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { +void func_80B14524(ObjHakaisi* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { func_80B1444C(this); } } @@ -191,7 +191,7 @@ void func_80B14558(ObjHakaisi* this) { this->actionFunc = func_80B1456C; } -void func_80B1456C(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B1456C(ObjHakaisi* this, PlayState* play) { if (this->unk_196 != -1) { if (ActorCutscene_GetCanPlayNext(this->unk_196)) { ActorCutscene_StartAndSetUnkLinkFields(this->unk_196, &this->dyna.actor); @@ -201,7 +201,7 @@ void func_80B1456C(ObjHakaisi* this, GlobalContext* globalCtx) { } if (this->dyna.actor.colChkInfo.health < 30) { func_80B145F4(this); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -213,33 +213,33 @@ void func_80B145F4(ObjHakaisi* this) { this->actionFunc = func_80B14648; } -void func_80B14648(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B14648(ObjHakaisi* this, PlayState* play) { if (this->unk_19A < 2) { - func_80B14CF8(globalCtx, this->unk_160[this->unk_194], 100, 30, 5); + func_80B14CF8(play, this->unk_160[this->unk_194], 100, 30, 5); } this->unk_19A++; if (this->dyna.actor.colChkInfo.health == 0) { - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 70); - Flags_SetSwitch(globalCtx, this->switchFlag); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14B6C(this, play, this->unk_160[this->unk_194], 70); + Flags_SetSwitch(play, this->switchFlag); this->dyna.actor.draw = NULL; func_80B149A8(this); } if (this->unk_19E != this->dyna.actor.colChkInfo.health) { if ((this->unk_19E > 20) && (this->dyna.actor.colChkInfo.health <= 20)) { - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14F4C(this, globalCtx, 0); - func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 40); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14F4C(this, play, 0); + func_80B14B6C(this, play, this->unk_160[this->unk_194], 40); this->unk_194 = 1; } else if ((this->unk_19E > 10) && (this->dyna.actor.colChkInfo.health <= 10)) { - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); - func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 60); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14A24(this, play, this->unk_160[this->unk_194]); + func_80B14B6C(this, play, this->unk_160[this->unk_194], 60); this->unk_194 = 2; } this->unk_19A = 0; @@ -255,7 +255,7 @@ void func_80B149A8(ObjHakaisi* this) { this->actionFunc = func_80B149C0; } -void func_80B149C0(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B149C0(ObjHakaisi* this, PlayState* play) { if (this->unk_19A < 60) { this->unk_19A++; } else if ((this->unk_196 != -1) && !ActorCutscene_GetCanPlayNext(this->unk_196)) { @@ -263,20 +263,20 @@ void func_80B149C0(ObjHakaisi* this, GlobalContext* globalCtx) { } } -void func_80B14A24(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec) { +void func_80B14A24(ObjHakaisi* this, PlayState* play, Vec3f vec) { s32 i; - func_80B14CF8(globalCtx, vec, 100, 30, 5); + func_80B14CF8(play, vec, 100, 30, 5); for (i = 0; i < 5; i++) { vec.x += Rand_Centered() * 20.0f; vec.y += Rand_ZeroOne() * 5.0f; vec.z += Rand_Centered() * 20.0f; - EffectSsHahen_SpawnBurst(globalCtx, &vec, 5.0f, 0, 20, 15, 3, OBJECT_HAKAISI, 10, object_hakaisi_DL_0021B0); + EffectSsHahen_SpawnBurst(play, &vec, 5.0f, 0, 20, 15, 3, OBJECT_HAKAISI, 10, object_hakaisi_DL_0021B0); } } -void func_80B14B6C(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec, s16 arg3) { +void func_80B14B6C(ObjHakaisi* this, PlayState* play, Vec3f vec, s16 arg3) { s32 i; s16 temp_s1; Vec3f sp6C; @@ -290,13 +290,13 @@ void func_80B14B6C(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec, s16 ar sp6C.y = (Rand_ZeroOne() * 3.0f) + vec.y; sp6C.z = (Math_CosS(temp_s1) * 15.0f) + vec.z; - EffectSsHahen_SpawnBurst(globalCtx, &sp6C, 10.0f, 0, arg3, 30, 2, OBJECT_HAKAISI, 15, object_hakaisi_DL_0021B0); + EffectSsHahen_SpawnBurst(play, &sp6C, 10.0f, 0, arg3, 30, 2, OBJECT_HAKAISI, 15, object_hakaisi_DL_0021B0); } - func_80B14CF8(globalCtx, vec, 100, 50, 20); + func_80B14CF8(play, vec, 100, 50, 20); } -void func_80B14CF8(GlobalContext* globalCtx, Vec3f vec, s16 arg2, s16 arg3, s32 arg4) { +void func_80B14CF8(PlayState* play, Vec3f vec, s16 arg2, s16 arg3, s32 arg4) { s32 i; s16 temp_s0; Vec3f spAC; @@ -322,54 +322,54 @@ void func_80B14CF8(GlobalContext* globalCtx, Vec3f vec, s16 arg2, s16 arg3, s32 sp94.y = -0.1f * spA0.y; sp94.z = -0.1f * spA0.z; - func_800B0EB0(globalCtx, &spAC, &spA0, &sp94, &D_80B155F8, &D_80B155FC, arg2, arg3, 10); + func_800B0EB0(play, &spAC, &spA0, &sp94, &D_80B155F8, &D_80B155FC, arg2, arg3, 10); } } -void func_80B14F4C(ObjHakaisi* this, GlobalContext* globalCtx, s32 arg2) { +void func_80B14F4C(ObjHakaisi* this, PlayState* play, s32 arg2) { if (arg2 == 0) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x, + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 55.0f, this->dyna.actor.world.pos.z - 10.0f, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 4); } else { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x + 20.0f, + Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x + 20.0f, this->dyna.actor.world.pos.y + 30.0f, this->dyna.actor.world.pos.z - 10.0f, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 5); } } -void ObjHakaisi_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHakaisi_Update(Actor* thisx, PlayState* play) { ObjHakaisi* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjHakaisi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHakaisi_Draw(Actor* thisx, PlayState* play) { ObjHakaisi* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_194 == 0) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_002650); } else if (this->unk_194 == 1) { Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_0029C0); } else { Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_002CC0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80B151E0(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B151E0(ObjHakaisi* this, PlayState* play) { this->dyna.actor.update = func_80B1544C; this->dyna.actor.draw = func_80B154A0; this->dyna.actor.destroy = func_80B15254; @@ -379,7 +379,7 @@ void func_80B151E0(ObjHakaisi* this, GlobalContext* globalCtx) { func_80B15264(this); } -void func_80B15254(Actor* thisx, GlobalContext* globalCtx) { +void func_80B15254(Actor* thisx, PlayState* play) { } void func_80B15264(ObjHakaisi* this) { @@ -396,7 +396,7 @@ void func_80B15264(ObjHakaisi* this) { this->actionFunc = func_80B15330; } -void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx) { +void func_80B15330(ObjHakaisi* this, PlayState* play) { s32 pad; MtxF sp34; @@ -404,8 +404,8 @@ void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx) { Actor_UpdatePos(&this->dyna.actor); if (this->dyna.actor.bgCheckFlags & 2) { - func_80B14B6C(this, globalCtx, this->dyna.actor.world.pos, 40); - func_80B14CF8(globalCtx, this->dyna.actor.world.pos, 100, 30, 10); + func_80B14B6C(this, play, this->dyna.actor.world.pos, 40); + func_80B14CF8(play, this->dyna.actor.world.pos, 100, 30, 10); Actor_MarkForDeath(&this->dyna.actor); } @@ -418,26 +418,26 @@ void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx) { Matrix_MtxFToYXZRot(&sp34, &this->dyna.actor.shape.rot, false); } -void func_80B1544C(Actor* thisx, GlobalContext* globalCtx) { +void func_80B1544C(Actor* thisx, PlayState* play) { ObjHakaisi* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); } -void func_80B154A0(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void func_80B154A0(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (OBJHAKAISI_GET_FF(thisx) == 4) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_001F10); } else { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_0021B0); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h index 4f1d1ada9a..4de9a0d80a 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h @@ -5,7 +5,7 @@ struct ObjHakaisi; -typedef void (*ObjHakaisiActionFunc)(struct ObjHakaisi*, GlobalContext*); +typedef void (*ObjHakaisiActionFunc)(struct ObjHakaisi*, PlayState*); #define OBJHAKAISI_GET_FF(thisx) ((thisx)->params & 0xFF) #define OBJHAKAISI_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFF00) >> 8) 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 7b8377cee8..aefec238e2 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -11,10 +11,10 @@ #define THIS ((ObjHamishi*)thisx) -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, @@ -61,11 +61,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_STOP), }; -void func_809A0F20(Actor* thisx, GlobalContext* globalCtx) { +void func_809A0F20(Actor* thisx, PlayState* play) { ObjHamishi* this = THIS; - 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); } @@ -91,7 +91,7 @@ void func_809A0F78(ObjHamishi* this) { } } -void func_809A10F4(ObjHamishi* this, GlobalContext* globalCtx) { +void func_809A10F4(ObjHamishi* this, PlayState* play) { s32 i; Vec3f spC8; Vec3f spBC; @@ -125,15 +125,15 @@ void func_809A10F4(ObjHamishi* this, GlobalContext* globalCtx) { gravity = -320; } - EffectSsKakera_Spawn(globalCtx, &spBC, &spC8, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, D_809A1AD4[i], - 3, 0, 70, 1, GAMEPLAY_FIELD_KEEP, gameplay_field_keep_DL_006420); + EffectSsKakera_Spawn(play, &spBC, &spC8, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0, D_809A1AD4[i], 3, 0, + 70, 1, GAMEPLAY_FIELD_KEEP, gameplay_field_keep_DL_006420); } - func_800BBFB0(globalCtx, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); - func_800BBFB0(globalCtx, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); + func_800BBFB0(play, &this->actor.world.pos, 140.0f, 6, 180, 90, 1); + func_800BBFB0(play, &this->actor.world.pos, 140.0f, 12, 80, 90, 1); } -void func_809A13A0(ObjHamishi* this, GlobalContext* globalCtx) { +void func_809A13A0(ObjHamishi* this, PlayState* play) { s32 pad; Vec3f sp28; s32 sp24; @@ -143,29 +143,29 @@ void func_809A13A0(ObjHamishi* this, GlobalContext* globalCtx) { sp28.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp24, &this->actor, &sp28); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp24, &this->actor, &sp28); } -s32 func_809A1408(ObjHamishi* this, GlobalContext* globalCtx) { +s32 func_809A1408(ObjHamishi* this, PlayState* play) { s32 pad; WaterBox* sp30; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, - &sp30, &sp28) && + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + &sp28) && (this->actor.world.pos.y < sp2C)) { return true; } return false; } -void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Init(Actor* thisx, PlayState* play) { ObjHamishi* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { this->actor.uncullZoneForward += 1000.0f; } @@ -175,28 +175,28 @@ void ObjHamishi_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.home.rot.y = this->actor.shape.rot.y; } - func_809A0F20(&this->actor, globalCtx); + func_809A0F20(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - func_809A13A0(this, globalCtx); + func_809A13A0(this, play); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 2.3f); - if (Flags_GetSwitch(globalCtx, OBJHAMISHI_GET_SWITCHFLAG(&this->actor))) { + if (Flags_GetSwitch(play, OBJHAMISHI_GET_SWITCHFLAG(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } this->actor.shape.yOffset = 80.0f; - if (func_809A1408(this, globalCtx)) { + if (func_809A1408(this, play)) { this->unk_1A2 |= 1; } } -void ObjHamishi_Destroy(Actor* thisx, GlobalContext* globalCtx) { - Collider_DestroyCylinder(globalCtx, &THIS->collider); +void ObjHamishi_Destroy(Actor* thisx, PlayState* play) { + Collider_DestroyCylinder(play, &THIS->collider); } -void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Update(Actor* thisx, PlayState* play) { s32 pad; ObjHamishi* this = THIS; s32 sp24 = (this->collider.base.acFlags & AC_HIT) != 0; @@ -227,9 +227,9 @@ void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_190 = 2.0f; this->unk_194 = 400.0f; } else { - func_809A10F4(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); - Flags_SetSwitch(globalCtx, OBJHAMISHI_GET_SWITCHFLAG(&this->actor)); + func_809A10F4(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); + Flags_SetSwitch(play, OBJHAMISHI_GET_SWITCHFLAG(&this->actor)); Actor_MarkForDeath(&this->actor); } } @@ -248,41 +248,41 @@ void ObjHamishi_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1A0 > 0) { this->unk_1A0--; } else if ((this->actor.flags & ACTOR_FLAG_40) && (this->actor.xzDistToPlayer < 1000.0f)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } } -void ObjHamishi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHamishi_Draw(Actor* thisx, PlayState* play) { ObjHamishi* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((thisx->projectedPos.z <= 2150.0f) || ((this->unk_1A2 & 1) && (thisx->projectedPos.z < 2250.0f))) { thisx->shape.shadowAlpha = 160; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 170, 130, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_field_keep_DL_0061E8); } else if (thisx->projectedPos.z < 2250.0f) { f32 sp20 = (2250.0f - thisx->projectedPos.z) * 2.55f; thisx->shape.shadowAlpha = sp20 * 0.627451f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 170, 130, (s32)sp20); gSPDisplayList(POLY_XLU_DISP++, gameplay_field_keep_DL_0061E8); } else { thisx->shape.shadowAlpha = 0; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 93578ac40b..6eb0b0adc8 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -11,10 +11,10 @@ #define THIS ((ObjHana*)thisx) -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, @@ -35,18 +35,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 40, ICHAIN_STOP), }; -void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Init(Actor* thisx, PlayState* play) { ObjHana* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); } -void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Destroy(Actor* thisx, PlayState* play) { } -void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHana_Update(Actor* thisx, PlayState* play) { } -void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_hana_DL_000500); +void ObjHana_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_hana_DL_000500); } diff --git a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c index 840488810d..c0537940c3 100644 --- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c +++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c @@ -11,15 +11,15 @@ #define THIS ((ObjHariko*)thisx) -void ObjHariko_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHariko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHariko_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHariko_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHariko_Init(Actor* thisx, PlayState* play); +void ObjHariko_Destroy(Actor* thisx, PlayState* play); +void ObjHariko_Update(Actor* thisx, PlayState* play); +void ObjHariko_Draw(Actor* thisx, PlayState* play); void ObjHariko_SetupWait(ObjHariko* this); -void ObjHariko_Wait(ObjHariko* this, GlobalContext* globalCtx); +void ObjHariko_Wait(ObjHariko* this, PlayState* play); void ObjHariko_SetupBobHead(ObjHariko* this); -void ObjHariko_BobHead(ObjHariko* this, GlobalContext* globalCtx); +void ObjHariko_BobHead(ObjHariko* this, PlayState* play); void ObjHariko_CheckForQuakes(ObjHariko* this); const ActorInit Obj_Hariko_InitVars = { @@ -34,7 +34,7 @@ const ActorInit Obj_Hariko_InitVars = { (ActorFunc)ObjHariko_Draw, }; -void ObjHariko_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHariko_Init(Actor* thisx, PlayState* play) { ObjHariko* this = THIS; Actor_SetScale(&this->actor, 0.1f); @@ -46,14 +46,14 @@ void ObjHariko_Init(Actor* thisx, GlobalContext* globalCtx) { ObjHariko_SetupWait(this); } -void ObjHariko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHariko_Destroy(Actor* thisx, PlayState* play) { } void ObjHariko_SetupWait(ObjHariko* this) { this->actionFunc = ObjHariko_Wait; } -void ObjHariko_Wait(ObjHariko* this, GlobalContext* globalCtx) { +void ObjHariko_Wait(ObjHariko* this, PlayState* play) { } void ObjHariko_SetupBobHead(ObjHariko* this) { @@ -62,7 +62,7 @@ void ObjHariko_SetupBobHead(ObjHariko* this) { this->actionFunc = ObjHariko_BobHead; } -void ObjHariko_BobHead(ObjHariko* this, GlobalContext* globalCtx) { +void ObjHariko_BobHead(ObjHariko* this, PlayState* play) { this->headOffset += 0x1555; this->headRotation.x = Math_SinS(this->headOffset) * this->bobbleStep; this->headRotation.y = Math_CosS(this->headOffset) * this->bobbleStep; @@ -78,27 +78,27 @@ void ObjHariko_CheckForQuakes(ObjHariko* this) { } } -void ObjHariko_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHariko_Update(Actor* thisx, PlayState* play) { ObjHariko* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); ObjHariko_CheckForQuakes(this); } -void ObjHariko_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHariko_Draw(Actor* thisx, PlayState* play) { ObjHariko* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Push(); Matrix_RotateXS(this->headRotation.x, MTXMODE_APPLY); Matrix_RotateYS(this->headRotation.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gHarikoBodyDL); gSPDisplayList(POLY_OPA_DISP++, gHarikoFaceDL); Matrix_Pop(); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h index 12d4fe5052..ae3fcf160a 100644 --- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h +++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.h @@ -5,7 +5,7 @@ struct ObjHariko; -typedef void (*ObjHarikoActionFunc)(struct ObjHariko*, GlobalContext*); +typedef void (*ObjHarikoActionFunc)(struct ObjHariko*, PlayState*); typedef struct ObjHariko { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index 4e6b3791de..72aaa3e127 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -11,20 +11,20 @@ #define THIS ((ObjHgdoor*)thisx) -void ObjHgdoor_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHgdoor_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHgdoor_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHgdoor_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHgdoor_Init(Actor* thisx, PlayState* play); +void ObjHgdoor_Destroy(Actor* thisx, PlayState* play); +void ObjHgdoor_Update(Actor* thisx, PlayState* play); +void ObjHgdoor_Draw(Actor* thisx, PlayState* play); void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this); -void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx); +void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, PlayState* play); void func_80BD42AC(ObjHgdoor* this); -void func_80BD42C0(ObjHgdoor* this, GlobalContext* globalCtx); +void func_80BD42C0(ObjHgdoor* this, PlayState* play); void func_80BD433C(ObjHgdoor* this); -void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx); +void func_80BD4358(ObjHgdoor* this, PlayState* play); void func_80BD4460(ObjHgdoor* this); -void func_80BD4478(ObjHgdoor* this, GlobalContext* globalCtx); -s32 func_80BD44D0(ObjHgdoor* this, GlobalContext* globalCtx); +void func_80BD4478(ObjHgdoor* this, PlayState* play); +s32 func_80BD44D0(ObjHgdoor* this, PlayState* play); const ActorInit Obj_Hgdoor_InitVars = { ACTOR_OBJ_HGDOOR, @@ -42,8 +42,8 @@ static s16 D_80BD4690 = 0; static s32 unused = 0; static s32 unused2 = 0; -void ObjHgdoor_SetChild(ObjHgdoor* this, GlobalContext* globalCtx) { - Actor* actorIterator = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void ObjHgdoor_SetChild(ObjHgdoor* this, PlayState* play) { + Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (actorIterator) { if ((actorIterator->id == ACTOR_OBJ_HGDOOR) && (&this->dyna.actor != actorIterator)) { @@ -54,8 +54,8 @@ void ObjHgdoor_SetChild(ObjHgdoor* this, GlobalContext* globalCtx) { } } -void ObjHgdoor_SetParent(ObjHgdoor* this, GlobalContext* globalCtx) { - Actor* actorIterator = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].first; +void ObjHgdoor_SetParent(ObjHgdoor* this, PlayState* play) { + Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_PROP].first; while (actorIterator) { if (actorIterator->id == ACTOR_EN_HG) { @@ -66,7 +66,7 @@ void ObjHgdoor_SetParent(ObjHgdoor* this, GlobalContext* globalCtx) { } } -void ObjHgdoor_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHgdoor_Init(Actor* thisx, PlayState* play) { ObjHgdoor* this = THIS; s32 pad; CollisionHeader* header = NULL; @@ -78,29 +78,29 @@ void ObjHgdoor_Init(Actor* thisx, GlobalContext* globalCtx) { } else { CollisionHeader_GetVirtual(&object_hgdoor_Colheader_0018C0, &header); } - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, header); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, header); this->rotation = 0; this->timer = 0; this->cutscene = this->dyna.actor.cutscene; ObjHgdoor_SetupCheckShouldOpen(this); } -void ObjHgdoor_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHgdoor_Destroy(Actor* thisx, PlayState* play) { ObjHgdoor* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this) { this->actionFunc = ObjHgdoor_CheckShouldOpen; } -void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx) { +void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20) && (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) && OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { - ObjHgdoor_SetChild(this, globalCtx); - ObjHgdoor_SetParent(this, globalCtx); + ObjHgdoor_SetChild(this, play); + ObjHgdoor_SetParent(this, play); func_80BD42AC(this); } } @@ -109,7 +109,7 @@ void func_80BD42AC(ObjHgdoor* this) { this->actionFunc = func_80BD42C0; } -void func_80BD42C0(ObjHgdoor* this, GlobalContext* globalCtx) { +void func_80BD42C0(ObjHgdoor* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->dyna.actor); func_80BD433C(this); @@ -127,14 +127,14 @@ void func_80BD433C(ObjHgdoor* this) { this->actionFunc = func_80BD4358; } -void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx) { +void func_80BD4358(ObjHgdoor* this, PlayState* play) { s32 actionIndex; - if (Cutscene_CheckActorAction(globalCtx, 483)) { - actionIndex = Cutscene_GetActorActionIndex(globalCtx, 483); - if (this->unk166 != globalCtx->csCtx.actorActions[actionIndex]->action) { - this->unk166 = globalCtx->csCtx.actorActions[actionIndex]->action; - switch (globalCtx->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_CheckActorAction(play, 483)) { + actionIndex = Cutscene_GetActorActionIndex(play, 483); + if (this->unk166 != play->csCtx.actorActions[actionIndex]->action) { + this->unk166 = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { case 1: Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY); if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.parent->id == ACTOR_EN_HG)) { @@ -146,7 +146,7 @@ void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx) { break; } } - if ((D_80BD4690 == 1) && (func_80BD44D0(this, globalCtx))) { + if ((D_80BD4690 == 1) && (func_80BD44D0(this, play))) { func_80BD4460(this); } } else { @@ -159,13 +159,13 @@ void func_80BD4460(ObjHgdoor* this) { this->actionFunc = func_80BD4478; } -void func_80BD4478(ObjHgdoor* this, GlobalContext* globalCtx) { +void func_80BD4478(ObjHgdoor* this, PlayState* play) { if (this->timer++ > 80 && !ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Stop(this->cutscene); } } -s32 func_80BD44D0(ObjHgdoor* this, GlobalContext* globalCtx) { +s32 func_80BD44D0(ObjHgdoor* this, PlayState* play) { if (this->rotation < 0x5555) { this->rotation += 0x1388; } else { @@ -184,18 +184,18 @@ void func_80BD4500(ObjHgdoor* this) { } } -void ObjHgdoor_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHgdoor_Update(Actor* thisx, PlayState* play) { ObjHgdoor* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); func_80BD4500(this); } -void ObjHgdoor_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); +void ObjHgdoor_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (OBJHGDOOR_IS_RIGHT_DOOR(thisx)) { gSPDisplayList(POLY_OPA_DISP++, object_hgdoor_DL_001AB0); gSPDisplayList(POLY_OPA_DISP++, object_hgdoor_DL_001BA8); @@ -204,5 +204,5 @@ void ObjHgdoor_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, object_hgdoor_DL_001768); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h index a3590f4249..803236ac1a 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h @@ -5,7 +5,7 @@ struct ObjHgdoor; -typedef void (*ObjHgdoorActionFunc)(struct ObjHgdoor*, GlobalContext*); +typedef void (*ObjHgdoorActionFunc)(struct ObjHgdoor*, PlayState*); #define OBJHGDOOR_IS_RIGHT_DOOR(thisx) \ ((thisx)->params & 0x8000) // door on the right when looking at the cabinet diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c index 1ce6faa7d5..9f19241acb 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c @@ -11,15 +11,15 @@ #define THIS ((ObjHsStump*)thisx) -void ObjHsStump_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHsStump_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHsStump_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHsStump_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHsStump_Init(Actor* thisx, PlayState* play); +void ObjHsStump_Destroy(Actor* thisx, PlayState* play); +void ObjHsStump_Update(Actor* thisx, PlayState* play); +void ObjHsStump_Draw(Actor* thisx, PlayState* play); -void ObjHsStump_SetupIdle(ObjHsStump* this, GlobalContext* globalCtx); -void ObjHsStump_Idle(ObjHsStump* this, GlobalContext* globalCtx); -void ObjHsStump_SetupAppear(ObjHsStump* this, GlobalContext* globalCtx); -void ObjHsStump_Appear(ObjHsStump* this, GlobalContext* globalCtx); +void ObjHsStump_SetupIdle(ObjHsStump* this, PlayState* play); +void ObjHsStump_Idle(ObjHsStump* this, PlayState* play); +void ObjHsStump_SetupAppear(ObjHsStump* this, PlayState* play); +void ObjHsStump_Appear(ObjHsStump* this, PlayState* play); const ActorInit Obj_HsStump_InitVars = { ACTOR_OBJ_HSSTUMP, @@ -39,39 +39,39 @@ static InitChainEntry sInitChain[] = { static Vec3f sIceSmokeAccel = { 0.0f, 0.0f, 0.0f }; -void ObjHsStump_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsStump_Init(Actor* thisx, PlayState* play) { ObjHsStump* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->isHidden = OBJHSSTUMP_GET_ISHIDDEN(thisx); this->switchFlag = OBJHSSTUMP_GET_SWITCHFLAG(thisx); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hsstump_Colheader_0011B0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_hsstump_Colheader_0011B0); switch (this->isHidden) { case true: - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->isHidden = false; } else { this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.0f); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } case false: - ObjHsStump_SetupIdle(this, globalCtx); + ObjHsStump_SetupIdle(this, play); } } -void ObjHsStump_SetupIdle(ObjHsStump* this, GlobalContext* globalCtx) { +void ObjHsStump_SetupIdle(ObjHsStump* this, PlayState* play) { this->actionFunc = ObjHsStump_Idle; } -void ObjHsStump_Idle(ObjHsStump* this, GlobalContext* globalCtx) { - if (this->isHidden == true && Flags_GetSwitch(globalCtx, this->switchFlag)) { - ObjHsStump_SetupAppear(this, globalCtx); +void ObjHsStump_Idle(ObjHsStump* this, PlayState* play) { + if (this->isHidden == true && Flags_GetSwitch(play, this->switchFlag)) { + ObjHsStump_SetupAppear(this, play); } } -void ObjHsStump_SetupAppear(ObjHsStump* this, GlobalContext* globalCtx) { +void ObjHsStump_SetupAppear(ObjHsStump* this, PlayState* play) { this->dyna.actor.draw = ObjHsStump_Draw; this->framesAppeared = 0; this->rotAngle = 0; @@ -80,7 +80,7 @@ void ObjHsStump_SetupAppear(ObjHsStump* this, GlobalContext* globalCtx) { this->actionFunc = ObjHsStump_Appear; } -void ObjHsStump_Appear(ObjHsStump* this, GlobalContext* globalCtx) { +void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) { if (this->framesAppeared >= 0) { Math_SmoothStepToF(&this->rotFactor, 0.0f, 1.0f, this->framesAppeared + 18.0f, 0.01f); this->dyna.actor.shape.rot.x = (Math_SinS(this->rotAngle) * this->rotFactor) + this->dyna.actor.home.rot.x; @@ -115,7 +115,7 @@ void ObjHsStump_Appear(ObjHsStump* this, GlobalContext* globalCtx) { Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, offsetAngle, &iceSmokePosOffset, &iceSmokePos); Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, offsetAngle, &iceSmokeVelOffset, &iceSmokeVel); - EffectSsIceSmoke_Spawn(globalCtx, &iceSmokePos, &iceSmokeVel, &sIceSmokeAccel, 100); + EffectSsIceSmoke_Spawn(play, &iceSmokePos, &iceSmokeVel, &sIceSmokeAccel, 100); } } } @@ -125,24 +125,24 @@ void ObjHsStump_Appear(ObjHsStump* this, GlobalContext* globalCtx) { } if (this->dyna.actor.scale.x == 18.0f * 0.01f) { this->isHidden = false; - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - ObjHsStump_SetupIdle(this, globalCtx); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + ObjHsStump_SetupIdle(this, play); } this->framesAppeared++; } -void ObjHsStump_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsStump_Destroy(Actor* thisx, PlayState* play) { ObjHsStump* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjHsStump_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHsStump_Update(Actor* thisx, PlayState* play) { ObjHsStump* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjHsStump_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_hsstump_DL_0003B8); +void ObjHsStump_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_hsstump_DL_0003B8); } diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h index 899688b27d..1f82a15b1e 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.h @@ -8,7 +8,7 @@ struct ObjHsStump; -typedef void (*ObjHsStumpActionFunc)(struct ObjHsStump*, GlobalContext*); +typedef void (*ObjHsStumpActionFunc)(struct ObjHsStump*, PlayState*); typedef struct ObjHsStump { /* 0x000 */ DynaPolyActor dyna; 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 3738153657..d67da85606 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -10,12 +10,12 @@ #define THIS ((ObjHsblock*)thisx) -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_8093E0A0(ObjHsblock* this, GlobalContext* globalCtx); +void func_8093E0A0(ObjHsblock* this, PlayState* play); void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc); 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 230313cb6d..e5fcb433b8 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -5,7 +5,7 @@ struct ObjHsblock; -typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, GlobalContext*); +typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, PlayState*); typedef struct ObjHsblock { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index c31eeb151e..44510220e0 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -11,20 +11,20 @@ #define THIS ((ObjHugebombiwa*)thisx) -void ObjHugebombiwa_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHugebombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHugebombiwa_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHugebombiwa_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHugebombiwa_Init(Actor* thisx, PlayState* play); +void ObjHugebombiwa_Destroy(Actor* thisx, PlayState* play); +void ObjHugebombiwa_Update(Actor* thisx, PlayState* play); +void ObjHugebombiwa_Draw(Actor* thisx, PlayState* play); void func_80A54BF0(ObjHugebombiwa* this); -void func_80A54C04(ObjHugebombiwa* this, GlobalContext* globalCtx); +void func_80A54C04(ObjHugebombiwa* this, PlayState* play); void func_80A54CD8(ObjHugebombiwa* this); -void func_80A54CEC(ObjHugebombiwa* this, GlobalContext* globalCtx); +void func_80A54CEC(ObjHugebombiwa* this, PlayState* play); void func_80A54E10(ObjHugebombiwa* this); -void func_80A55064(ObjHugebombiwa* this, GlobalContext* globalCtx); +void func_80A55064(ObjHugebombiwa* this, PlayState* play); void func_80A55310(ObjHugebombiwa* this); -void func_80A55564(ObjHugebombiwa* this, GlobalContext* globalCtx); -void func_80A55B34(Actor* thisx, GlobalContext* globalCtx); +void func_80A55564(ObjHugebombiwa* this, PlayState* play); +void func_80A55B34(Actor* thisx, PlayState* play); const ActorInit Obj_Hugebombiwa_InitVars = { ACTOR_OBJ_HUGEBOMBIWA, @@ -60,7 +60,7 @@ static ColliderCylinderInit sCylinderInit = { static Vec3f D_80A55D2C = { 0.0f, 0.3f, 0.0f }; -void func_80A53BE0(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80A53BE0(PlayState* play, Vec3f* arg1) { Vec3f spBC; Vec3f spB0; s32 i; @@ -105,12 +105,12 @@ void func_80A53BE0(GlobalContext* globalCtx, Vec3f* arg1) { if (1) {} } - EffectSsKakera_Spawn(globalCtx, &spBC, &spB0, &spBC, gravity, phi_v0, 15, 0, 0, phi_v1, 1, 0, life, -1, + EffectSsKakera_Spawn(play, &spBC, &spB0, &spBC, gravity, phi_v0, 15, 0, 0, phi_v1, 1, 0, life, -1, OBJECT_BOMBIWA, object_bombiwa_DL_001990); } } -void func_80A53E60(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { +void func_80A53E60(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3) { static Color_RGBA8 D_80A55D38 = { 210, 210, 210, 255 }; static Color_RGBA8 D_80A55D3C = { 140, 140, 140, 255 }; static f32 D_80A55D40[] = { 3.0f, 5.0f, 9.0f, 18.0f }; @@ -163,7 +163,7 @@ void func_80A53E60(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { phi_v1 = temp_f0; } - EffectSsKakera_Spawn(globalCtx, &spDC, &spD0, &spDC, phi_s2, phi_v0, 15, 0, 0, phi_v1, 1, 0, phi_s0, -1, + EffectSsKakera_Spawn(play, &spDC, &spD0, &spDC, phi_s2, phi_v0, 15, 0, 0, phi_v1, 1, 0, phi_s0, -1, OBJECT_BOMBIWA, object_bombiwa_DL_001990); spDC.x += (Rand_ZeroOne() - 0.5f) * 270.0f; @@ -172,11 +172,11 @@ void func_80A53E60(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { phi_s0 = (Rand_ZeroOne() * 160.0f) + 140.0f; phi_s1 = (Rand_ZeroOne() * 180.0f) + 120.0f; - func_800B0E48(globalCtx, &spDC, &gZeroVec3f, &D_80A55D2C, &D_80A55D38, &D_80A55D3C, phi_s0, phi_s1); + func_800B0E48(play, &spDC, &gZeroVec3f, &D_80A55D2C, &D_80A55D38, &D_80A55D3C, phi_s0, phi_s1); } } -void func_80A541F4(ObjHugebombiwa* this, GlobalContext* globalCtx) { +void func_80A541F4(ObjHugebombiwa* this, PlayState* play) { static s16 D_80A55D50[] = { 24, 17, 13, 7, 6, 5, 3, 2 }; s32 i; s32 pad[2]; @@ -207,7 +207,7 @@ void func_80A541F4(ObjHugebombiwa* this, GlobalContext* globalCtx) { spE8.y = (Rand_ZeroOne() * 18.0f) + 10.0f; spE8.z = temp_f24 * 10.0f; - EffectSsKakera_Spawn(globalCtx, &spF4, &spE8, &spF4, -650, 37, 15, 0, 0, D_80A55D50[i & 7], 1, 0, 60, -1, + EffectSsKakera_Spawn(play, &spF4, &spE8, &spF4, -650, 37, 15, 0, 0, D_80A55D50[i & 7], 1, 0, 60, -1, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); spDC.x = ((Rand_ZeroOne() - 0.5f) * 230.0f) + spF4.x; @@ -222,7 +222,7 @@ void func_80A541F4(ObjHugebombiwa* this, GlobalContext* globalCtx) { spC4.y = 0.24f; spC4.z = temp_f24 * -0.07f; - func_800B12F0(globalCtx, &spDC, &spD0, &spC4, (s32)(Rand_ZeroOne() * 800.0f) + 1000, -49, 20); + func_800B12F0(play, &spDC, &spD0, &spC4, (s32)(Rand_ZeroOne() * 800.0f) + 1000, -49, 20); spDC.x = ((Rand_ZeroOne() - 0.5f) * 160.0f) + spF4.x; spDC.y = ((Rand_ZeroOne() - 0.2f) * 140.0f) + spF4.y; @@ -236,12 +236,12 @@ void func_80A541F4(ObjHugebombiwa* this, GlobalContext* globalCtx) { spC4.y = 0.3f; spC4.z = temp_f24 * -0.09f; - func_800B12F0(globalCtx, &spDC, &spD0, &spC4, (s32)(Rand_ZeroOne() * 100.0f) + 40, + func_800B12F0(play, &spDC, &spD0, &spC4, (s32)(Rand_ZeroOne() * 100.0f) + 40, (s32)(Rand_ZeroOne() * 200.0f) + 20, 10); } } -void func_80A54600(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { +void func_80A54600(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3) { static f32 D_80A55D60[] = { 3.0f, 5.0f, 9.0f, 18.0f }; static s8 D_80A55D70 = 0; Vec3f spCC; @@ -278,7 +278,7 @@ void func_80A54600(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { phi_v0 = temp; } - EffectSsKakera_Spawn(globalCtx, &spCC, &spC0, &spCC, phi_v1, 33, 15, 0, 0, phi_v0, 1, 0, 70, -1, OBJECT_BOMBIWA, + EffectSsKakera_Spawn(play, &spCC, &spC0, &spCC, phi_v1, 33, 15, 0, 0, phi_v0, 1, 0, 70, -1, OBJECT_BOMBIWA, object_bombiwa_DL_0009E0); spCC.x += (Rand_ZeroOne() - 0.5f) * 270.0f; @@ -287,13 +287,13 @@ void func_80A54600(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3) { temp_s0 = (Rand_ZeroOne() * 160.0f) + 140.0f; temp_s1 = (Rand_ZeroOne() * 180.0f) + 120.0f; - func_800B1210(globalCtx, &spCC, &gZeroVec3f, &D_80A55D2C, temp_s0, temp_s1); + func_800B1210(play, &spCC, &gZeroVec3f, &D_80A55D2C, temp_s0, temp_s1); } } -void func_80A54980(ObjHugebombiwa* this, GlobalContext* globalCtx, s32 arg2) { +void func_80A54980(ObjHugebombiwa* this, PlayState* play, s32 arg2) { s32 pad[2]; - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 0x4E20); Quake_SetQuakeValues(quake, arg2, 0, 0, 0); @@ -330,19 +330,19 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 900, ICHAIN_STOP), }; -void ObjHugebombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHugebombiwa_Init(Actor* thisx, PlayState* play) { s32 pad; ObjHugebombiwa* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); - if (Flags_GetSwitch(globalCtx, ENHUGEBOMBIWA_GET_7F(&this->actor))) { + if (Flags_GetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor))) { Actor_MarkForDeath(&this->actor); return; } - Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; if ((ENHUGEBOMBIWA_GET_100(&this->actor)) == 1) { @@ -358,18 +358,18 @@ void ObjHugebombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A54BF0(this); } -void ObjHugebombiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjHugebombiwa_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjHugebombiwa* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_80A54BF0(ObjHugebombiwa* this) { this->actionFunc = func_80A54C04; } -void func_80A54C04(ObjHugebombiwa* this, GlobalContext* globalCtx) { +void func_80A54C04(ObjHugebombiwa* this, PlayState* play) { s32 pad; if (this->collider.base.acFlags & AC_HIT) { @@ -393,36 +393,36 @@ void func_80A54C04(ObjHugebombiwa* this, GlobalContext* globalCtx) { } } - 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_80A54CD8(ObjHugebombiwa* this) { this->actionFunc = func_80A54CEC; } -void func_80A54CEC(ObjHugebombiwa* this, GlobalContext* globalCtx) { +void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { s32 pad; if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - Flags_SetSwitch(globalCtx, ENHUGEBOMBIWA_GET_7F(&this->actor)); + Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && - ((globalCtx->sceneNum == SCENE_17SETUGEN) || (globalCtx->sceneNum == SCENE_17SETUGEN2))) { + ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_17SETUGEN2))) { gSaveContext.save.weekEventReg[19] |= 2; } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 80, NA_SE_EV_SNOWBALL_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_SNOWBALL_BROKEN); } if (!(ENHUGEBOMBIWA_GET_100(&this->actor))) { - func_80A53BE0(globalCtx, &this->actor.world.pos); + func_80A53BE0(play, &this->actor.world.pos); func_80A54E10(this); } else { - func_80A541F4(this, globalCtx); + func_80A541F4(this, play); func_80A55310(this); } } else { @@ -475,7 +475,7 @@ void func_80A54E10(ObjHugebombiwa* this) { this->actionFunc = func_80A55064; } -void func_80A55064(ObjHugebombiwa* this, GlobalContext* globalCtx) { +void func_80A55064(ObjHugebombiwa* this, PlayState* play) { s32 i; s32 pad; Vec3f spA4; @@ -507,13 +507,13 @@ void func_80A55064(ObjHugebombiwa* this, GlobalContext* globalCtx) { spA4.y = ptr->unk_0C.y + 60.0f; spA4.z = ptr->unk_0C.z; - temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp9C, &sp98, &this->actor, &spA4); + temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp9C, &sp98, &this->actor, &spA4); if ((temp_f0 <= BGCHECK_Y_MIN + 10.0f) || ((ptr->unk_0C.y - (350.0f * ptr->unk_00.y)) < temp_f0)) { this->unk_4B0++; ptr->unk_24 = 1; - func_80A53E60(globalCtx, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 9.8f); - if ((globalCtx->gameplayFrames % 4) == 0) { - func_80A54980(this, globalCtx, (s32)(Rand_ZeroOne() * 5.5f) + 1); + func_80A53E60(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 9.8f); + if ((play->gameplayFrames % 4) == 0) { + func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } @@ -571,7 +571,7 @@ void func_80A55310(ObjHugebombiwa* this) { this->actionFunc = func_80A55564; } -void func_80A55564(ObjHugebombiwa* this, GlobalContext* globalCtx) { +void func_80A55564(ObjHugebombiwa* this, PlayState* play) { s32 i; EnHugebombiwaStruct* ptr; Vec3f spA4; @@ -603,13 +603,13 @@ void func_80A55564(ObjHugebombiwa* this, GlobalContext* globalCtx) { spA4.y = ptr->unk_0C.y + 60.0f; spA4.z = ptr->unk_0C.z; - temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp9C, &sp98, &this->actor, &spA4); + temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp9C, &sp98, &this->actor, &spA4); if ((temp_f0 <= BGCHECK_Y_MIN + 10.0f) || (ptr->unk_0C.y < temp_f0)) { this->unk_4B0++; ptr->unk_24 = 1; - func_80A54600(globalCtx, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 10.1f); - if ((globalCtx->gameplayFrames % 4) == 0) { - func_80A54980(this, globalCtx, (s32)(Rand_ZeroOne() * 5.5f) + 1); + func_80A54600(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 10.1f); + if ((play->gameplayFrames % 4) == 0) { + func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } @@ -621,42 +621,39 @@ void func_80A55564(ObjHugebombiwa* this, GlobalContext* globalCtx) { } } -void ObjHugebombiwa_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHugebombiwa_Update(Actor* thisx, PlayState* play) { ObjHugebombiwa* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjHugebombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHugebombiwa_Draw(Actor* thisx, PlayState* play) { ObjHugebombiwa* this = THIS; s32 pad[8]; f32 sp38; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if ((this->actionFunc == func_80A54C04) || (this->actionFunc == func_80A54CEC)) { if (this->actor.projectedPos.z <= 4300.0f) { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0xFF, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, object_bombiwa_DL_002F60); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_bombiwa_DL_003110); } else if (this->actor.projectedPos.z < 4500.0f) { sp38 = (4500.0f - this->actor.projectedPos.z) * 1.275f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, 255, (s32)sp38); gSPDisplayList(POLY_XLU_DISP++, object_bombiwa_DL_002F60); } @@ -674,7 +671,7 @@ void ObjHugebombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr->unk_0C.x, ptr->unk_0C.y, ptr->unk_0C.z, &ptr->unk_1C); Matrix_Scale(ptr->unk_00.x, ptr->unk_00.x, ptr->unk_00.x, MTXMODE_APPLY); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, object_bombiwa_DL_001990); } } @@ -682,21 +679,21 @@ void ObjHugebombiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_OPA_DISP = gfx; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_80A55B34(Actor* thisx, GlobalContext* globalCtx) { +void func_80A55B34(Actor* thisx, PlayState* play) { ObjHugebombiwa* this = THIS; s32 i; Gfx* gfx; EnHugebombiwaStruct* ptr; if ((this->actionFunc == func_80A54C04) || (this->actionFunc == func_80A54CEC)) { - Gfx_DrawDListOpa(globalCtx, object_bombiwa_DL_001820); + Gfx_DrawDListOpa(play, object_bombiwa_DL_001820); return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(gfx++, &sSetupDL[6 * 25]); @@ -713,11 +710,11 @@ void func_80A55B34(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_APPLY); Matrix_Translate(0.0f, -325.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, object_bombiwa_DL_0009E0); } POLY_OPA_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h index f1d26aaf4b..5ef9b27177 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.h @@ -5,7 +5,7 @@ struct ObjHugebombiwa; -typedef void (*ObjHugebombiwaActionFunc)(struct ObjHugebombiwa*, GlobalContext*); +typedef void (*ObjHugebombiwaActionFunc)(struct ObjHugebombiwa*, PlayState*); #define ENHUGEBOMBIWA_GET_7F(thisx) ((thisx)->params & 0x7F) #define ENHUGEBOMBIWA_GET_100(thisx) (((thisx)->params >> 8) & 1) diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 4e09bb6554..ef3a5b79e0 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -12,19 +12,19 @@ #define THIS ((ObjHunsui*)thisx) -void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjHunsui_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjHunsui_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjHunsui_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjHunsui_Init(Actor* thisx, PlayState* play); +void ObjHunsui_Destroy(Actor* thisx, PlayState* play); +void ObjHunsui_Update(Actor* thisx, PlayState* play); +void ObjHunsui_Draw(Actor* thisx, PlayState* play); -void func_80B9CE64(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D0FC(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D2BC(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D4D0(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx); -void func_80B9DA60(Actor* thisx, GlobalContext* globalCtx); +void func_80B9CE64(ObjHunsui* this, PlayState* play); +void func_80B9D0FC(ObjHunsui* this, PlayState* play); +void func_80B9D120(ObjHunsui* this, PlayState* play); +void func_80B9D2BC(ObjHunsui* this, PlayState* play); +void func_80B9D4D0(ObjHunsui* this, PlayState* play); +void func_80B9D508(ObjHunsui* this, PlayState* play); +void func_80B9D714(ObjHunsui* this, PlayState* play); +void func_80B9DA60(Actor* thisx, PlayState* play); AnimatedMaterial* D_80B9DED0; AnimatedMaterial* D_80B9DED4; @@ -66,7 +66,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), }; -s32 func_80B9C450(GlobalContext* globalCtx, s32 arg1, s32 arg2) { +s32 func_80B9C450(PlayState* play, s32 arg1, s32 arg2) { s32 sp2C = 1; if (arg2 < ARRAY_COUNT(D_80B9DC70)) { @@ -75,11 +75,11 @@ s32 func_80B9C450(GlobalContext* globalCtx, s32 arg1, s32 arg2) { while (val--) { if ((1 << val) & val3) { - if (!Flags_GetSwitch(globalCtx, arg1 + val)) { + if (!Flags_GetSwitch(play, arg1 + val)) { sp2C = 0; break; } - } else if (Flags_GetSwitch(globalCtx, arg1 + val)) { + } else if (Flags_GetSwitch(play, arg1 + val)) { sp2C = 0; break; } @@ -88,20 +88,20 @@ s32 func_80B9C450(GlobalContext* globalCtx, s32 arg1, s32 arg2) { sp2C = 0; switch (arg2) { case 14: - if (!Flags_GetSwitch(globalCtx, arg1)) { + if (!Flags_GetSwitch(play, arg1)) { sp2C = 1; } - if (Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) && - Flags_GetSwitch(globalCtx, arg1 + 3)) { + if (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && + Flags_GetSwitch(play, arg1 + 3)) { sp2C += 2; } break; case 15: - if (!Flags_GetSwitch(globalCtx, arg1) || - (Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) && - Flags_GetSwitch(globalCtx, arg1 + 3))) { + if (!Flags_GetSwitch(play, arg1) || + (Flags_GetSwitch(play, arg1 + 1) && Flags_GetSwitch(play, arg1 + 2) && + Flags_GetSwitch(play, arg1 + 3))) { sp2C = 1; } break; @@ -110,8 +110,8 @@ s32 func_80B9C450(GlobalContext* globalCtx, s32 arg1, s32 arg2) { return sp2C; } -void func_80B9C5E8(ObjHunsui* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B9C5E8(ObjHunsui* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_f10; f32 temp_f16; Vec3f sp40; @@ -135,7 +135,7 @@ void func_80B9C5E8(ObjHunsui* this, GlobalContext* globalCtx) { sp40.z += randPlusMinusPoint5Scaled(10.0f); sp40.y += Rand_ZeroFloat(2.0f); - EffectSsGSplash_Spawn(globalCtx, &sp40, NULL, NULL, 2.0f * Rand_ZeroOne(), 1); + EffectSsGSplash_Spawn(play, &sp40, NULL, NULL, 2.0f * Rand_ZeroOne(), 1); } } else { this->unk_172 |= 8; @@ -149,7 +149,7 @@ void func_80B9C5E8(ObjHunsui* this, GlobalContext* globalCtx) { sp40.z += randPlusMinusPoint5Scaled(10.0f); sp40.y += Rand_ZeroFloat(45.0f); - EffectSsGSplash_Spawn(globalCtx, &sp40, NULL, NULL, 1, 1); + EffectSsGSplash_Spawn(play, &sp40, NULL, NULL, 1, 1); } sp3E = BINANG_ROT180(player->actor.world.rot.y - this->dyna.actor.yawTowardsPlayer); @@ -199,7 +199,7 @@ void func_80B9C5E8(ObjHunsui* this, GlobalContext* globalCtx) { } } -void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjHunsui_Init(Actor* thisx, PlayState* play) { ObjHunsui* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -209,7 +209,7 @@ void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); if ((this->unk_160 != OBJHUNSUI_F000_5) && (this->unk_160 != OBJHUNSUI_F000_6)) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hunsui_Colheader_000C74); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_hunsui_Colheader_000C74); } D_80B9DED0 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_000BF0); @@ -280,7 +280,7 @@ void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { case OBJHUNSUI_F000_1: this->dyna.actor.draw = func_80B9DA60; - if ((this->unk_172 & 1) && func_80B9C450(globalCtx, this->unk_168, this->unk_164)) { + if ((this->unk_172 & 1) && func_80B9C450(play, this->unk_168, this->unk_164)) { this->unk_174 = 240.0f; this->unk_172 |= 4; this->unk_184 = 0xFF0; @@ -290,7 +290,7 @@ void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_184 = 0; } this->unk_178 = this->unk_174; - this->unk_180 = func_80B9C450(globalCtx, this->unk_168, this->unk_164); + this->unk_180 = func_80B9C450(play, this->unk_168, this->unk_164); this->actionFunc = func_80B9CE64; break; @@ -302,13 +302,13 @@ void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { case OBJHUNSUI_F000_6: this->dyna.actor.draw = func_80B9DA60; if ((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) { - func_80B9D2BC(this, globalCtx); + func_80B9D2BC(this, play); this->unk_178 = this->unk_174; } else { - if ((this->unk_172 & 1) || func_80B9C450(globalCtx, this->unk_168, this->unk_164)) { - func_80B9D4D0(this, globalCtx); + if ((this->unk_172 & 1) || func_80B9C450(play, this->unk_168, this->unk_164)) { + func_80B9D4D0(this, play); } else { - func_80B9D0FC(this, globalCtx); + func_80B9D0FC(this, play); } this->unk_178 = this->unk_174; } @@ -316,16 +316,16 @@ void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjHunsui_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjHunsui_Destroy(Actor* thisx, PlayState* play) { ObjHunsui* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjHunsui_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjHunsui_Update(Actor* thisx, PlayState* play) { ObjHunsui* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if ((this->unk_172 & 0x40) && SubS_StartActorCutscene(&this->dyna.actor, this->unk_17C, -1, 0)) { this->unk_172 &= ~0x40; @@ -340,18 +340,18 @@ void ObjHunsui_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80B9CE64(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9CE64(ObjHunsui* this, PlayState* play) { s32 sp2C; f32 sins; if (!(this->unk_172 & 2)) { - func_80B9C5E8(this, globalCtx); + func_80B9C5E8(this, play); } this->unk_18A += 0x71C; Math_SmoothStepToF(&this->unk_190, this->unk_194, 1.0f, 0.2f, 0.01f); - sp2C = func_80B9C450(globalCtx, this->unk_168, this->unk_164); + sp2C = func_80B9C450(play, this->unk_168, this->unk_164); if (!(this->unk_172 & 1)) { if (sp2C != this->unk_180) { @@ -404,7 +404,7 @@ void func_80B9CE64(ObjHunsui* this, GlobalContext* globalCtx) { this->unk_180 = sp2C; } -void func_80B9D094(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D094(ObjHunsui* this, PlayState* play) { f32 sins; this->unk_18A += 0x71C; @@ -413,15 +413,15 @@ void func_80B9D094(ObjHunsui* this, GlobalContext* globalCtx) { this->unk_198 = sins * this->unk_190; } -void func_80B9D0FC(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D0FC(ObjHunsui* this, PlayState* play) { this->unk_174 = -30.0f; this->actionFunc = func_80B9D120; } -void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D120(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) && - ((this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num))) { + (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + ((this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num))) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -435,7 +435,7 @@ void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx) { return; } - func_80B9D094(this, globalCtx); + func_80B9D094(this, play); if (!(this->unk_172 & 0x40)) { Math_SmoothStepToF(&this->unk_178, this->unk_174, 0.6f, 10.5f, 0.05f); } @@ -446,14 +446,14 @@ void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx) { this->unk_172 |= 2; } - if (func_80B9C450(globalCtx, this->unk_168, this->unk_164)) { + if (func_80B9C450(play, this->unk_168, this->unk_164)) { this->unk_17C = this->unk_170; this->unk_172 |= 0x40; - func_80B9D4D0(this, globalCtx); + func_80B9D4D0(this, play); } } -s32 func_80B9D288(GlobalContext* globalCtx, Actor* thisx, Actor* iter, void* verifyData) { +s32 func_80B9D288(PlayState* play, Actor* thisx, Actor* iter, void* verifyData) { s32 ret = false; if (BGDBLUEMOVEBG_GET_F(iter) == BGDBLUEMOVEBG_F_8) { @@ -462,16 +462,16 @@ s32 func_80B9D288(GlobalContext* globalCtx, Actor* thisx, Actor* iter, void* ver return ret; } -void func_80B9D2BC(ObjHunsui* this, GlobalContext* globalCtx) { - if ((this->unk_172 & 1) || func_80B9C450(globalCtx, this->unk_168, this->unk_164)) { - func_80B9D4D0(this, globalCtx); +void func_80B9D2BC(ObjHunsui* this, PlayState* play) { + if ((this->unk_172 & 1) || func_80B9C450(play, this->unk_168, this->unk_164)) { + func_80B9D4D0(this, play); } else { this->unk_172 |= 2; - func_80B9D0FC(this, globalCtx); + func_80B9D0FC(this, play); } } -void func_80B9D334(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D334(ObjHunsui* this, PlayState* play) { Vec3f sp74; s32 i; s32 phi_s2 = 0; @@ -506,27 +506,27 @@ void func_80B9D334(ObjHunsui* this, GlobalContext* globalCtx) { this->unk_174 = 240; } } else { - Actor* dblueMovebg = SubS_FindActorCustom(globalCtx, &this->dyna.actor, NULL, ACTORCAT_BG, - ACTOR_BG_DBLUE_MOVEBG, NULL, func_80B9D288); + Actor* dblueMovebg = SubS_FindActorCustom(play, &this->dyna.actor, NULL, ACTORCAT_BG, ACTOR_BG_DBLUE_MOVEBG, + NULL, func_80B9D288); if (dblueMovebg != NULL) { this->unk_1B4 = (BgDblueMovebg*)dblueMovebg; - func_80B9D2BC(this, globalCtx); + func_80B9D2BC(this, play); } } } -void func_80B9D4D0(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D4D0(ObjHunsui* this, PlayState* play) { this->unk_172 &= ~2; this->unk_172 |= 0x10; this->unk_174 = 240.0f; this->actionFunc = func_80B9D508; } -void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D508(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) && - (this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num)) { + (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -540,12 +540,12 @@ void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx) { return; } - func_80B9C5E8(this, globalCtx); - func_80B9D094(this, globalCtx); + func_80B9C5E8(this, play); + func_80B9D094(this, play); if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (globalCtx->roomCtx.currRoom.num == 8)) { - func_80B9D334(this, globalCtx); + (play->roomCtx.currRoom.num == 8)) { + func_80B9D334(this, play); } if (!(this->unk_172 & 0x40)) { @@ -559,24 +559,24 @@ void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx) { this->unk_1B0 += -8.0f + (0.9f * (this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y)); } - if (!(this->unk_172 & 1) && !func_80B9C450(globalCtx, this->unk_168, this->unk_164)) { + if (!(this->unk_172 & 1) && !func_80B9C450(play, this->unk_168, this->unk_164)) { this->unk_17C = this->unk_170; this->unk_172 |= 0x40; - func_80B9D0FC(this, globalCtx); + func_80B9D0FC(this, play); } } -void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx) { +void func_80B9D714(ObjHunsui* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s16 cs; f32 sp28; - if ((this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) && - (this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num)) { + if ((this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { Actor_MarkForDeath(&this->dyna.actor); } else { - if (Flags_GetSwitch(globalCtx, this->unk_168)) { + if (Flags_GetSwitch(play, this->unk_168)) { this->unk_172 &= ~2; this->unk_172 |= 0x10; cs = this->dyna.actor.cutscene; @@ -600,7 +600,7 @@ void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 800.0f, 0.1f, 8.0f, 1.0f) < 0.5f) { if (DECR(this->unk_16E) == 0) { - Flags_UnsetSwitch(globalCtx, this->unk_168); + Flags_UnsetSwitch(play, this->unk_168); } } this->dyna.actor.velocity.y = this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y; @@ -628,7 +628,7 @@ void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx) { } } -void ObjHunsui_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjHunsui_Draw(Actor* thisx, PlayState* play) { ObjHunsui* this = THIS; if (this->unk_172 & 0x10) { @@ -638,12 +638,12 @@ void ObjHunsui_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (!(this->unk_172 & 2)) { - AnimatedMat_Draw(globalCtx, D_80B9DED0); - Gfx_DrawDListXlu(globalCtx, object_hunsui_DL_000220); + AnimatedMat_Draw(play, D_80B9DED0); + Gfx_DrawDListXlu(play, object_hunsui_DL_000220); } } -void func_80B9DA60(Actor* thisx, GlobalContext* globalCtx) { +void func_80B9DA60(Actor* thisx, PlayState* play) { s32 pad; ObjHunsui* this = THIS; f32 temp; @@ -655,26 +655,26 @@ void func_80B9DA60(Actor* thisx, GlobalContext* globalCtx) { if ((this->dyna.actor.flags & ACTOR_FLAG_40) && !(this->unk_172 & 2)) { if ((this->unk_160 == OBJHUNSUI_F000_6) || (this->unk_160 == OBJHUNSUI_F000_5)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames % 128) * -9, 0x20, - 0x20, 1, 0, (globalCtx->gameplayFrames % 128) * -8, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (play->gameplayFrames % 128) * -9, 0x20, 0x20, 1, 0, + (play->gameplayFrames % 128) * -8, 0x20, 0x20)); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s32)this->unk_1AC, 0x20, 0x20, 1, 0, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (s32)this->unk_1AC, 0x20, 0x20, 1, 0, (s32)this->unk_1B0, 0x20, 0x20)); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - AnimatedMat_DrawXlu(globalCtx, D_80B9DED4); + AnimatedMat_DrawXlu(play, D_80B9DED4); } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x7F, 255, 255, 255, 127); - Gfx_DrawDListXlu(globalCtx, object_hunsui_DL_000EC0); + Gfx_DrawDListXlu(play, object_hunsui_DL_000EC0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h index cbf1e4f133..a2d5ebd11a 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h @@ -6,7 +6,7 @@ struct ObjHunsui; -typedef void (*ObjHunsuiActionFunc)(struct ObjHunsui*, GlobalContext*); +typedef void (*ObjHunsuiActionFunc)(struct ObjHunsui*, PlayState*); #define OBJHUNSUI_GET_7F(thisx) ((thisx)->params & 0x7F) #define OBJHUNSUI_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F) 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 bdffb1b520..45503c0def 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 @@ -12,15 +12,15 @@ #define THIS ((ObjIcePoly*)thisx) -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 func_80931828(ObjIcePoly* this, GlobalContext* globalCtx); -void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx); -void func_80931E58(ObjIcePoly* this, GlobalContext* globalCtx); -void func_80931EEC(ObjIcePoly* this, GlobalContext* globalCtx); +void func_80931828(ObjIcePoly* this, PlayState* play); +void func_80931A38(ObjIcePoly* this, PlayState* play); +void func_80931E58(ObjIcePoly* this, PlayState* play); +void func_80931EEC(ObjIcePoly* this, PlayState* play); const ActorInit Obj_Ice_Poly_InitVars = { ACTOR_OBJ_ICE_POLY, @@ -77,7 +77,7 @@ static ColliderCylinderInit sCylinderInit2 = { static Color_RGBA8 D_80932378 = { 250, 250, 250, 255 }; static Color_RGBA8 D_8093237C = { 180, 180, 180, 255 }; -void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Init(Actor* thisx, PlayState* play) { ObjIcePoly* this = THIS; s32 i; @@ -88,8 +88,8 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(thisx, thisx->params * 0.01f); for (i = 0; i < ARRAY_COUNT(this->colliders1); i++) { - Collider_InitAndSetCylinder(globalCtx, &this->colliders1[i], thisx, &sCylinderInit1); - Collider_InitAndSetCylinder(globalCtx, &this->colliders2[i], thisx, &sCylinderInit2); + Collider_InitAndSetCylinder(play, &this->colliders1[i], thisx, &sCylinderInit1); + Collider_InitAndSetCylinder(play, &this->colliders2[i], thisx, &sCylinderInit2); Collider_UpdateCylinder(thisx, &this->colliders1[i]); Collider_UpdateCylinder(thisx, &this->colliders2[i]); } @@ -115,8 +115,8 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->shape.rot.x = 0x500; thisx->shape.rot.z = -0x500; - if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(globalCtx, this->unk_149)) || - ((globalCtx->sceneNum == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { + if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || + ((play->sceneNum == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { Actor_MarkForDeath(thisx); return; } @@ -124,17 +124,17 @@ void ObjIcePoly_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80931A38; } -void ObjIcePoly_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Destroy(Actor* thisx, PlayState* play) { ObjIcePoly* this = THIS; s32 i; for (i = 0; i < ARRAY_COUNT(this->colliders1); i++) { - Collider_DestroyCylinder(globalCtx, &this->colliders1[i]); - Collider_DestroyCylinder(globalCtx, &this->colliders2[i]); + Collider_DestroyCylinder(play, &this->colliders1[i]); + Collider_DestroyCylinder(play, &this->colliders2[i]); } } -void func_80931828(ObjIcePoly* this, GlobalContext* globalCtx) { +void func_80931828(ObjIcePoly* this, PlayState* play) { static Color_RGBA8 D_80932380 = { 170, 255, 255, 255 }; static Color_RGBA8 D_80932384 = { 0, 50, 100, 255 }; static Vec3f D_80932388 = { 0.0f, -1.0f, 0.0f }; @@ -149,7 +149,7 @@ void func_80931828(ObjIcePoly* this, GlobalContext* globalCtx) { spA0.y = (this->colliders1[0].dim.height * 2) + this->actor.world.pos.y; spA0.z = this->actor.world.pos.z; - sp90 = BgCheck_EntityRaycastFloor1(&globalCtx->colCtx, &sp88, &spA0); + sp90 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp88, &spA0); if (sp90 < this->actor.world.pos.y) { sp90 = this->actor.world.pos.y; } @@ -163,14 +163,14 @@ void func_80931828(ObjIcePoly* this, GlobalContext* globalCtx) { spA0.x = (this->colliders1[0].dim.radius * (sp94.x * (1.0f / 12))) + this->actor.world.pos.x; spA0.z = (this->colliders1[0].dim.radius * (sp94.z * (1.0f / 12))) + this->actor.world.pos.z; spA0.y = Rand_ZeroFloat(temp) + sp90; - EffectSsEnIce_Spawn(globalCtx, &spA0, (Rand_ZeroFloat(0.4f) + 0.3f) * this->actor.scale.x, &sp94, &D_80932388, + EffectSsEnIce_Spawn(play, &spA0, (Rand_ZeroFloat(0.4f) + 0.3f) * this->actor.scale.x, &sp94, &D_80932388, &D_80932380, &D_80932384, 40); } } -void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { +void func_80931A38(ObjIcePoly* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); Vec3f sp6C; s32 i; s32 pad2; @@ -205,11 +205,11 @@ void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { this->actionFunc = func_80931E58; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - if (globalCtx->sceneNum == SCENE_00KEIKOKU) { + if (play->sceneNum == SCENE_00KEIKOKU) { Actor* actor = NULL; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_ITEMACTION, ACTOR_OBJ_ICE_POLY); + actor = SubS_FindActor(play, actor, ACTORCAT_ITEMACTION, ACTOR_OBJ_ICE_POLY); if (actor != NULL) { if ((&this->actor != actor) && (&this->actor != actor)) { ((ObjIcePoly*)actor)->unk_14A = 0; @@ -219,7 +219,7 @@ void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { } } while (actor != NULL); } - } else if ((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(globalCtx, this->unk_149)) { + } else if ((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) { ActorCutscene_SetIntentToPlay(this->actor.cutscene); this->unk_14A = 1; this->actionFunc = func_80931E58; @@ -231,14 +231,14 @@ void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { } if (this->unk_14A == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders1[0].base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliders1[1].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders1[0].base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders1[1].base); } for (i = 0; i < ARRAY_COUNT(this->colliders1); i++) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders1[i].base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders1[i].base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliders2[i].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders1[i].base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliders1[i].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders2[i].base); } } @@ -260,15 +260,15 @@ void func_80931A38(ObjIcePoly* this, GlobalContext* globalCtx) { } sp6C.z = (phi_v0 * (15.0f + (sp58 * 15.0f)) * this->actor.scale.z) + this->actor.world.pos.z; - EffectSsKirakira_SpawnDispersed(globalCtx, &sp6C, &gZeroVec3f, &gZeroVec3f, &D_80932378, &D_8093237C, 2000, 5); + EffectSsKirakira_SpawnDispersed(play, &sp6C, &gZeroVec3f, &gZeroVec3f, &D_80932378, &D_8093237C, 2000, 5); } } -void func_80931E58(ObjIcePoly* this, GlobalContext* globalCtx) { +void func_80931E58(ObjIcePoly* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); if (this->unk_14A == 1) { - func_80931828(this, globalCtx); + func_80931828(this, play); Actor_MarkForDeath(&this->actor); } else { this->unk_14A = 40; @@ -280,7 +280,7 @@ void func_80931E58(ObjIcePoly* this, GlobalContext* globalCtx) { } } -void func_80931EEC(ObjIcePoly* this, GlobalContext* globalCtx) { +void func_80931EEC(ObjIcePoly* this, PlayState* play) { Vec3f spAC; Vec3f spA0; Vec3f sp94; @@ -314,7 +314,7 @@ void func_80931EEC(ObjIcePoly* this, GlobalContext* globalCtx) { } sp94.z = (phi_v0 * (20.0f + (20.0f * temp_f20)) * this->actor.scale.x) + this->actor.world.pos.z; - func_800B0DE0(globalCtx, &sp94, &spA0, &spAC, &D_80932378, &D_8093237C, + func_800B0DE0(play, &sp94, &spA0, &spAC, &D_80932378, &D_8093237C, ((Rand_ZeroOne() * 100.0f) + 350.0f) * this->actor.scale.x, this->actor.scale.x * 20.0f); } @@ -328,33 +328,33 @@ void func_80931EEC(ObjIcePoly* this, GlobalContext* globalCtx) { if (this->unk_14A == 0) { ActorCutscene_Stop(this->actor.cutscene); if (this->unk_149 != OBJICEPOLY_FF_FF) { - Flags_SetSwitch(globalCtx, this->unk_149); + Flags_SetSwitch(play, this->unk_149); } Actor_MarkForDeath(&this->actor); } } -void ObjIcePoly_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjIcePoly_Update(Actor* thisx, PlayState* play) { ObjIcePoly* this = THIS; - 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 = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - func_800B8118(&this->actor, globalCtx, 0); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 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->unk_148); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_050D10); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 b34866e3cd..c1efd768d3 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 @@ -5,7 +5,7 @@ struct ObjIcePoly; -typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, GlobalContext*); +typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*); #define OBJICEPOLY_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 1a6d96c730..c5a11c8e3e 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -11,39 +11,39 @@ #define THIS ((ObjIceblock*)thisx) -void ObjIceblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjIceblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjIceblock_Init(Actor* thisx, PlayState* play); +void ObjIceblock_Destroy(Actor* thisx, PlayState* play); +void ObjIceblock_Update(Actor* thisx, PlayState* play); +void ObjIceblock_Draw(Actor* thisx, PlayState* play); void ObjIceBlock_SetupAttemptSpawnCutscene(ObjIceblock* this); -void ObjIceBlock_AttemptSpawnCutscene(ObjIceblock* this, GlobalContext* globalCtx); +void ObjIceBlock_AttemptSpawnCutscene(ObjIceblock* this, PlayState* play); void func_80A25824(ObjIceblock* this); -void func_80A2586C(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A2586C(ObjIceblock* this, PlayState* play); void func_80A25978(ObjIceblock* this); -void func_80A25994(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25994(ObjIceblock* this, PlayState* play); void func_80A25A8C(ObjIceblock* this); -void func_80A25AA8(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25AA8(ObjIceblock* this, PlayState* play); void func_80A25BA0(ObjIceblock* this); -void func_80A25BBC(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25BBC(ObjIceblock* this, PlayState* play); void func_80A25C5C(ObjIceblock* this); -void func_80A25C70(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25C70(ObjIceblock* this, PlayState* play); void func_80A25CF4(ObjIceblock* this); -void func_80A25D28(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25D28(ObjIceblock* this, PlayState* play); void func_80A25E3C(ObjIceblock* this); -void func_80A25E50(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25E50(ObjIceblock* this, PlayState* play); void func_80A25FA0(ObjIceblock* this); -void func_80A25FD4(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A25FD4(ObjIceblock* this, PlayState* play); void func_80A260E8(ObjIceblock* this); -void func_80A26144(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A26144(ObjIceblock* this, PlayState* play); void func_80A262BC(ObjIceblock* this); -void func_80A262EC(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A262EC(ObjIceblock* this, PlayState* play); void func_80A26574(ObjIceblock* this); -void func_80A265C0(ObjIceblock* this, GlobalContext* globalCtx); -void func_80A266E0(ObjIceblock* this, GlobalContext* globalCtx); -void func_80A26B64(ObjIceblock* this, GlobalContext* globalCtx); -void func_80A26B74(ObjIceblock* this, GlobalContext* globalCtx); -void func_80A26BF8(ObjIceblock* this, GlobalContext* globalCtx); +void func_80A265C0(ObjIceblock* this, PlayState* play); +void func_80A266E0(ObjIceblock* this, PlayState* play); +void func_80A26B64(ObjIceblock* this, PlayState* play); +void func_80A26B74(ObjIceblock* this, PlayState* play); +void func_80A26BF8(ObjIceblock* this, PlayState* play); const ActorInit Obj_Iceblock_InitVars = { ACTOR_OBJ_ICEBLOCK, @@ -148,7 +148,7 @@ void func_80A23370(ObjIceblock* this, s32 arg1) { this->unk_26C = arg1; } -void func_80A2339C(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3, s32 arg4) { +void func_80A2339C(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3, s32 arg4) { Vec3f spBC; Vec3f spB0; Vec3f spA4; @@ -187,7 +187,7 @@ void func_80A2339C(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, f32 arg3, s3 spA4.y = -0.8f - (temp_f20 * 18.0f); - EffectSsIceBlock_Spawn(globalCtx, &spBC, &spB0, &spA4, temp_s4); + EffectSsIceBlock_Spawn(play, &spBC, &spB0, &spA4, temp_s4); } } @@ -301,7 +301,7 @@ void func_80A23B88(ObjIceblock* this) { } } -s32 func_80A23D08(ObjIceblock* this, GlobalContext* globalCtx) { +s32 func_80A23D08(ObjIceblock* this, PlayState* play) { static ObjIceBlockUnkStruct3 D_80A26E90[] = { { -300.0f, 300.0f }, { 300.0f, 300.0f }, { -300.0f, -300.0f }, { 300.0f, -300.0f }, { 0.0f, 0.0f }, }; @@ -341,7 +341,7 @@ s32 func_80A23D08(ObjIceblock* this, GlobalContext* globalCtx) { spA4.z += this->dyna.actor.world.pos.z; ptr->unk_04 = - BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &ptr->unk_00, &ptr->unk_08, &this->dyna.actor, &spA4, 0.0f); + BgCheck_EntityRaycastFloor6(&play->colCtx, &ptr->unk_00, &ptr->unk_08, &this->dyna.actor, &spA4, 0.0f); if (ptr->unk_04 > BGCHECK_Y_MIN + 1) { sp94 = 1; if (phi_f22 < ptr->unk_04) { @@ -350,7 +350,7 @@ s32 func_80A23D08(ObjIceblock* this, GlobalContext* globalCtx) { } } - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, spA4.x, spA4.z, &ptr->unk_0C, &spC4)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, spA4.x, spA4.z, &ptr->unk_0C, &spC4)) { if (phi_f20 < ptr->unk_0C) { spB8 = i; phi_f20 = ptr->unk_0C; @@ -379,10 +379,10 @@ s32 func_80A23D08(ObjIceblock* this, GlobalContext* globalCtx) { return sp94; } -s32 func_80A23F90(ObjIceblock* this, GlobalContext* globalCtx) { +s32 func_80A23F90(ObjIceblock* this, PlayState* play) { this->unk_1B0 &= ~4; - if (func_80A23D08(this, globalCtx)) { + if (func_80A23D08(this, play)) { f32 phi_f2 = BGCHECK_Y_MIN; s32 ret = false; s32 i; @@ -406,7 +406,7 @@ s32 func_80A23F90(ObjIceblock* this, GlobalContext* globalCtx) { return false; } -s32 func_80A24118(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f* arg3) { +s32 func_80A24118(ObjIceblock* this, PlayState* play, f32 arg2, Vec3f* arg3) { static ObjIceBlockUnkStruct3 D_80A26EE0[] = { { -300.0f, -300.0f }, { 300.0f, -300.0f }, { -300.0f, 600.0f }, { 300.0f, 600.0f }, { 0.0f, 0.0f }, }; @@ -460,7 +460,7 @@ s32 func_80A24118(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f* spD0.y = spDC.y; spD0.z = temp_f26 + spDC.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spDC, &spD0, &spB8, &spA8, true, false, false, true, &spAC, + if (BgCheck_EntityLineTest3(&play->colCtx, &spDC, &spD0, &spB8, &spA8, true, false, false, true, &spAC, &this->dyna.actor, 0.0f)) { temp_f20 = Math3D_Vec3fDistSq(&spDC, &spB8); if (temp_f20 < phi_f20) { @@ -473,10 +473,10 @@ s32 func_80A24118(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f* return ret; } -s32 func_80A24384(ObjIceblock* this, GlobalContext* globalCtx) { +s32 func_80A24384(ObjIceblock* this, PlayState* play) { Vec3f sp1C; - if (func_80A24118(this, globalCtx, 0.0f, &sp1C)) { + if (func_80A24118(this, play, 0.0f, &sp1C)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -484,7 +484,7 @@ s32 func_80A24384(ObjIceblock* this, GlobalContext* globalCtx) { return false; } -s32 func_80A243E0(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg0) { +s32 func_80A243E0(ObjIceblock* this, PlayState* play, Vec3f* arg0) { static f32 D_80A26F30[] = { -300.0f, 300.0f }; static f32 D_80A26F38[] = { 1.0f, -1.0f }; s32 i; @@ -536,7 +536,7 @@ s32 func_80A243E0(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg0) { spE0.y = spEC.y; spE0.z = temp_f30 + spEC.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spEC, &spE0, &spC8, &spB8, true, false, false, true, &spBC, + if (BgCheck_EntityLineTest3(&play->colCtx, &spEC, &spE0, &spC8, &spB8, true, false, false, true, &spBC, &this->dyna.actor, 0.0f)) { temp_f12 = Math3D_Vec3fDistSq(&spEC, &spC8); if (temp_f12 < phi_f22) { @@ -551,10 +551,10 @@ s32 func_80A243E0(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg0) { return ret; } -s32 func_80A24680(ObjIceblock* this, GlobalContext* globalCtx) { +s32 func_80A24680(ObjIceblock* this, PlayState* play) { Vec3f sp1C; - if (func_80A243E0(this, globalCtx, &sp1C)) { + if (func_80A243E0(this, play, &sp1C)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -562,7 +562,7 @@ s32 func_80A24680(ObjIceblock* this, GlobalContext* globalCtx) { return false; } -s32 func_80A246D8(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg2) { +s32 func_80A246D8(ObjIceblock* this, PlayState* play, Vec3f* arg2) { static ObjIceBlockUnkStruct3 D_80A26F40[] = { { -300.0f, -300.0f }, { 300.0f, -300.0f }, { -300.0f, 600.0f }, { 300.0f, 600.0f }, { 0.0f, 0.0f }, }; @@ -600,10 +600,10 @@ s32 func_80A246D8(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg2) { spB4.y = spC0.y; spB4.z = (Math_CosS(phi_s3) * temp_f20) + spC0.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spC0, &spB4, &sp9C, &sp94, true, false, false, true, &sp98, + if (BgCheck_EntityLineTest3(&play->colCtx, &spC0, &spB4, &sp9C, &sp94, true, false, false, true, &sp98, &this->dyna.actor, 0.0f)) { ret = true; - temp_v0 = (ObjIceblock*)DynaPoly_GetActor(&globalCtx->colCtx, sp98); + temp_v0 = (ObjIceblock*)DynaPoly_GetActor(&play->colCtx, sp98); if ((temp_v0 != NULL) && (temp_v0->dyna.actor.id == ACTOR_OBJ_ICEBLOCK) && (temp_v0->unk_2B0 == 3)) { temp_v0->unk_1B0 |= 0x80; } @@ -620,7 +620,7 @@ void func_80A2491C(ObjIceblock* this) { this->unk_276 = this->unk_278; } -s32 func_80A24954(ObjIceblock* this, GlobalContext* globalCtx) { +s32 func_80A24954(ObjIceblock* this, PlayState* play) { s32 pad[2]; s8 sp27 = this->unk_2B0; f32 temp = (this->dyna.actor.scale.y * 600.0f) - 90.0f; @@ -629,7 +629,7 @@ s32 func_80A24954(ObjIceblock* this, GlobalContext* globalCtx) { func_80A262BC(this); this->unk_2B0 = 3; } else if (this->unk_1B0 & 4) { - if (func_800C99D4(&globalCtx->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 5) { + if (func_800C99D4(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 5) { func_80A25FA0(this); this->unk_2B0 = 2; } else { @@ -640,21 +640,21 @@ s32 func_80A24954(ObjIceblock* this, GlobalContext* globalCtx) { return sp27 != this->unk_2B0; } -void func_80A24A48(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A24A48(ObjIceblock* this, PlayState* play) { if (!(this->unk_1B0 & 0x10) && !(this->collider.base.ocFlags1 & OC1_HIT)) { - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_1B0 |= 0x10; } } -void func_80A24AA8(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A24AA8(ObjIceblock* this, PlayState* play) { s32 i; f32 x; ObjIceblock* temp_v0; if (this->unk_1B0 & 4) { for (i = 0; i < ARRAY_COUNT(this->unk_1F4); i++) { - temp_v0 = (ObjIceblock*)DynaPoly_GetActor(&globalCtx->colCtx, ((void)0, this->unk_1F4[i]).unk_08); + temp_v0 = (ObjIceblock*)DynaPoly_GetActor(&play->colCtx, ((void)0, this->unk_1F4[i]).unk_08); if ((temp_v0 != NULL) && (temp_v0->dyna.actor.id == ACTOR_OBJ_ICEBLOCK)) { x = this->dyna.actor.world.pos.y - this->unk_1F4[i].unk_04; @@ -666,7 +666,7 @@ void func_80A24AA8(ObjIceblock* this, GlobalContext* globalCtx) { } } -void func_80A24B74(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A24B74(ObjIceblock* this, PlayState* play) { s32 pad; Vec3f sp20; @@ -675,11 +675,11 @@ void func_80A24B74(ObjIceblock* this, GlobalContext* globalCtx) { sp20.x = this->dyna.actor.world.pos.x; sp20.y = this->unk_244; sp20.z = this->dyna.actor.world.pos.z; - EffectSsGRipple_Spawn(globalCtx, &sp20, 480, 880, 0); + EffectSsGRipple_Spawn(play, &sp20, 480, 880, 0); } } -void func_80A24BDC(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4) { +void func_80A24BDC(ObjIceblock* this, PlayState* play, f32 arg2, f32 arg3, s32 arg4) { s32 i; Vec3f sp88; f32 temp_f20; @@ -695,7 +695,7 @@ void func_80A24BDC(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, f32 ar temp_f20 = ((Rand_ZeroOne() * 5.0f) + 40.0f) * arg2; sp88.x = (Math_SinS((s32)(Rand_ZeroOne() * temp_f22) + phi_s0) * temp_f20) + this->dyna.actor.world.pos.x; sp88.z = (Math_CosS((s32)(Rand_ZeroOne() * temp_f22) + phi_s0) * temp_f20) + this->dyna.actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp88, NULL, NULL, 0, ((Rand_ZeroOne() * 60.0f) + 320.0f) * arg3); + EffectSsGSplash_Spawn(play, &sp88, NULL, NULL, 0, ((Rand_ZeroOne() * 60.0f) + 320.0f) * arg3); } } } @@ -704,7 +704,7 @@ void func_80A24DC4(ObjIceblock* this) { this->unk_2A2 = 0; } -void func_80A24DD0(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A24DD0(ObjIceblock* this, PlayState* play) { static Vec3f D_80A26F90 = { 0.0f, 0.3f, 0.0f }; static Color_RGBA8 D_80A26F9C = { 250, 250, 250, 255 }; static Color_RGBA8 D_80A26FA0 = { 180, 180, 180, 255 }; @@ -751,13 +751,13 @@ void func_80A24DD0(ObjIceblock* this, GlobalContext* globalCtx) { spA8.z += this->dyna.actor.world.pos.z; temp_f20 = ((Rand_ZeroOne() * 800.0f) + (1600.0f * this->dyna.actor.scale.x)) * phi_f22; - func_800B0E48(globalCtx, &spA8, &gZeroVec3f, &D_80A26F90, &D_80A26F9C, &D_80A26FA0, temp_f20, + func_800B0E48(play, &spA8, &gZeroVec3f, &D_80A26F90, &D_80A26F9C, &D_80A26FA0, temp_f20, (Rand_ZeroOne() * 20.0f) + 30.0f); } } } -void func_80A2508C(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A2508C(ObjIceblock* this, PlayState* play) { s32 pad; Vec3f sp40; Vec3f sp34; @@ -786,8 +786,7 @@ void func_80A2508C(ObjIceblock* this, GlobalContext* globalCtx) { sp34.z = (this->dyna.actor.scale.z * sp34.z) + this->dyna.actor.world.pos.z; if ((this->unk_244 - 3.0f) < sp34.y) { - EffectSsIceSmoke_Spawn(globalCtx, &sp34, &sp40, &gZeroVec3f, - (s32)(this->dyna.actor.scale.y * 1300.0f) + 60); + EffectSsIceSmoke_Spawn(play, &sp34, &sp40, &gZeroVec3f, (s32)(this->dyna.actor.scale.y * 1300.0f) + 60); } } } @@ -847,8 +846,8 @@ void func_80A25404(ObjIceblock* this) { this->unk_26E[0] = 0; } -void func_80A2541C(ObjIceblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A2541C(ObjIceblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; @@ -902,7 +901,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -void ObjIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjIceblock_Init(Actor* thisx, PlayState* play) { s32 pad; ObjIceblock* this = THIS; Actor* parent; @@ -922,10 +921,10 @@ void ObjIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gIceBlockDynaColHeader); - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); - Collider_InitCylinder(globalCtx, &this->collider); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &gIceBlockDynaColHeader); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { this->collider.dim.yShift = -100; @@ -959,18 +958,18 @@ void ObjIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { this->meltTimer = 450; // (450/20) = 22 seconds } -void ObjIceblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjIceblock_Destroy(Actor* thisx, PlayState* play) { ObjIceblock* this = THIS; - 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 ObjIceBlock_SetupAttemptSpawnCutscene(ObjIceblock* this) { this->actionFunc = ObjIceBlock_AttemptSpawnCutscene; } -void ObjIceBlock_AttemptSpawnCutscene(ObjIceblock* this, GlobalContext* globalCtx) { +void ObjIceBlock_AttemptSpawnCutscene(ObjIceblock* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); this->extendedDrawFunc = func_80A26BF8; @@ -988,7 +987,7 @@ void func_80A25824(ObjIceblock* this) { func_80A2319C(this, this->dyna.actor.scale.x); } -void func_80A2586C(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A2586C(ObjIceblock* this, PlayState* play) { func_80A236D4(this, &this->dyna.actor.home.pos); if (this->stateTimer > 0) { @@ -1010,7 +1009,7 @@ void func_80A2586C(ObjIceblock* this, GlobalContext* globalCtx) { func_80A2319C(this, this->dyna.actor.scale.x); if (this->dyna.actor.flags & ACTOR_FLAG_40) { - func_80A2339C(globalCtx, &this->dyna.actor.world.pos, (this->dyna.actor.scale.x + 0.05f) * 0.6666666f, 1.0f, 3); + func_80A2339C(play, &this->dyna.actor.world.pos, (this->dyna.actor.scale.x + 0.05f) * 0.6666666f, 1.0f, 3); } } @@ -1019,7 +1018,7 @@ void func_80A25978(ObjIceblock* this) { this->stateTimer = 4; } -void func_80A25994(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25994(ObjIceblock* this, PlayState* play) { s32 pad; Vec3f sp30; @@ -1030,12 +1029,12 @@ void func_80A25994(ObjIceblock* this, GlobalContext* globalCtx) { } if (this->dyna.actor.flags & ACTOR_FLAG_40) { - func_80A2339C(globalCtx, &this->dyna.actor.world.pos, this->dyna.actor.scale.x, 1.2f, 15); + func_80A2339C(play, &this->dyna.actor.world.pos, this->dyna.actor.scale.x, 1.2f, 15); if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { sp30.x = this->dyna.actor.world.pos.x; sp30.y = this->dyna.actor.world.pos.y - 30.0f; sp30.z = this->dyna.actor.world.pos.z; - func_80A2339C(globalCtx, &sp30, this->dyna.actor.scale.x, 1.2f, 10); + func_80A2339C(play, &sp30, this->dyna.actor.scale.x, 1.2f, 10); } } @@ -1052,7 +1051,7 @@ void func_80A25A8C(ObjIceblock* this) { this->stateTimer = 2; } -void func_80A25AA8(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25AA8(ObjIceblock* this, PlayState* play) { s32 pad[2]; f32 sp24; s32 temp = func_80A236D4(this, &this->dyna.actor.home.pos); @@ -1064,7 +1063,7 @@ void func_80A25AA8(ObjIceblock* this, GlobalContext* globalCtx) { if (temp) { sp24 = this->dyna.actor.scale.y * 300.0f; - func_80A23D08(this, globalCtx); + func_80A23D08(this, play); if (sp24 < (this->dyna.actor.world.pos.y - this->dyna.actor.floorHeight)) { func_80A25BA0(this); } else { @@ -1089,18 +1088,18 @@ void func_80A25BA0(ObjIceblock* this) { this->dyna.actor.velocity.y = 0.0f; } -void func_80A25BBC(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25BBC(ObjIceblock* this, PlayState* play) { if (func_80A25238(this) != -1) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } func_80A23690(this); - if (func_80A23F90(this, globalCtx)) { + if (func_80A23F90(this, play)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } - if (func_80A24954(this, globalCtx)) { + if (func_80A24954(this, play)) { func_80A2491C(this); if (this->unk_2B0 == 3) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DIVE_INTO_WATER_L); @@ -1112,14 +1111,14 @@ void func_80A25C5C(ObjIceblock* this) { this->actionFunc = func_80A25C70; } -void func_80A25C70(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25C70(ObjIceblock* this, PlayState* play) { if (func_80A25238(this) != -1) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.floorHeight - 0.1f, 14.0f)) { - func_80A23F90(this, globalCtx); - func_80A24954(this, globalCtx); + func_80A23F90(this, play); + func_80A24954(this, play); } } @@ -1128,13 +1127,13 @@ void func_80A25CF4(ObjIceblock* this) { this->actionFunc = func_80A25D28; } -void func_80A25D28(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25D28(ObjIceblock* this, PlayState* play) { s32 sp34; s32 sp30; Vec3f sp24; func_80A23690(this); - func_80A23F90(this, globalCtx); + func_80A23F90(this, play); sp30 = func_80A25238(this); func_80A252DC(this, sp30); sp34 = true; @@ -1142,7 +1141,7 @@ void func_80A25D28(ObjIceblock* this, GlobalContext* globalCtx) { sp34 = false; } else if (!(this->unk_1B0 & 2) && (this->unk_26E[sp30] >= 11)) { sp34 = true; - if (!func_80A24118(this, globalCtx, (this->dyna.pushForce > 0.0f) ? 59.9f : 89.9f, &sp24)) { + if (!func_80A24118(this, play, (this->dyna.pushForce > 0.0f) ? 59.9f : 89.9f, &sp24)) { func_80A232C4(this, sp30); func_80A25E3C(this); sp34 = false; @@ -1150,17 +1149,17 @@ void func_80A25D28(ObjIceblock* this, GlobalContext* globalCtx) { } if (sp34) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } - func_80A24A48(this, globalCtx); + func_80A24A48(this, play); } void func_80A25E3C(ObjIceblock* this) { this->actionFunc = func_80A25E50; } -void func_80A25E50(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25E50(ObjIceblock* this, PlayState* play) { s32 pad; f32 temp_f0 = this->unk_268 - *this->unk_264; f32 temp_f2 = (Math_SinS(fabsf(temp_f0) * 546.13336f) * 2.8f) + 1.2f; @@ -1169,16 +1168,16 @@ void func_80A25E50(ObjIceblock* this, GlobalContext* globalCtx) { Vec3f sp28; func_80A23690(this); - if (!func_80A23F90(this, globalCtx)) { - func_80A24680(this, globalCtx); + if (!func_80A23F90(this, play)) { + func_80A24680(this, play); func_80A23B88(this); - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); func_80A25BA0(this); } else if (sp38) { - if (func_80A24118(this, globalCtx, 59.9f, &sp28)) { + if (func_80A24118(this, play, 59.9f, &sp28)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); func_80A25CF4(this); } else { func_800B9010(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); @@ -1190,35 +1189,35 @@ void func_80A25FA0(ObjIceblock* this) { this->actionFunc = func_80A25FD4; } -void func_80A25FD4(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A25FD4(ObjIceblock* this, PlayState* play) { s32 pad; s32 sp30; s32 sp2C; Vec3f sp20; func_80A23690(this); - func_80A23F90(this, globalCtx); + func_80A23F90(this, play); sp2C = func_80A25238(this); func_80A252DC(this, sp2C); sp30 = true; if (sp2C == -1) { sp30 = false; - } else if (!(this->unk_1B0 & 2) && (this->unk_26E[sp2C] >= 11) && !func_80A24118(this, globalCtx, 2.0f, &sp20) && - !Player_InCsMode(&globalCtx->state)) { + } else if (!(this->unk_1B0 & 2) && (this->unk_26E[sp2C] >= 11) && !func_80A24118(this, play, 2.0f, &sp20) && + !Player_InCsMode(&play->state)) { func_80A23370(this, sp2C); func_80A260E8(this); sp30 = false; - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_800B7298(play, &this->dyna.actor, 7); this->unk_1B0 |= 1; } if (this) {} if (sp30) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } - func_80A24A48(this, globalCtx); + func_80A24A48(this, play); } void func_80A260E8(ObjIceblock* this) { @@ -1232,7 +1231,7 @@ void func_80A260E8(ObjIceblock* this) { this->actionFunc = func_80A26144; } -void func_80A26144(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A26144(ObjIceblock* this, PlayState* play) { s32 pad2; s32 sp28; s32 isBool; @@ -1244,22 +1243,22 @@ void func_80A26144(ObjIceblock* this, GlobalContext* globalCtx) { Math_StepToF(&this->unk_25C, this->unk_260, 0.75f); *this->unk_264 += this->unk_25C; - sp28 = func_80A24384(this, globalCtx); + sp28 = func_80A24384(this, play); func_80A23690(this); - sp24 = func_80A23F90(this, globalCtx); + sp24 = func_80A23F90(this, play); isBool = sp24 == 0; if (isBool || sp28 || (this->stateTimer == 1)) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } if ((this->unk_1B0 & 1) && (isBool || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1B0 &= ~1; - func_800B7298(globalCtx, &this->dyna.actor, 6); + func_800B7298(play, &this->dyna.actor, 6); } if (isBool) { - func_80A24680(this, globalCtx); + func_80A24680(this, play); func_80A23B88(this); func_80A25BA0(this); } else if (sp28) { @@ -1270,7 +1269,7 @@ void func_80A26144(ObjIceblock* this, GlobalContext* globalCtx) { func_800B9010(&this->dyna.actor, NA_SE_PL_SLIP_ICE_LEVEL - SFX_FLAG); } - func_80A24DD0(this, globalCtx); + func_80A24DD0(this, play); } void func_80A262BC(ObjIceblock* this) { @@ -1279,7 +1278,7 @@ void func_80A262BC(ObjIceblock* this) { this->stateTimer = -1; } -void func_80A262EC(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A262EC(ObjIceblock* this, PlayState* play) { s32 pad; f32 temp_f14; f32 temp_f18; @@ -1287,7 +1286,7 @@ void func_80A262EC(ObjIceblock* this, GlobalContext* globalCtx) { f32 temp; if (func_80A25238(this) != -1) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } if (this->stateTimer > 0) { @@ -1297,15 +1296,15 @@ void func_80A262EC(ObjIceblock* this, GlobalContext* globalCtx) { if (this->stateTimer == -1) { if ((this->dyna.actor.velocity.y < 0.0f) && (this->dyna.actor.world.pos.y < this->unk_244) && ((this->unk_244 - (600.0f * this->dyna.actor.scale.y)) <= this->dyna.actor.world.pos.y)) { - func_80A24BDC(this, globalCtx, 1.0f, 0.9f, 11); - func_80A24B74(this, globalCtx); + func_80A24BDC(this, play, 1.0f, 0.9f, 11); + func_80A24B74(this, play); this->stateTimer = 3; } else { this->stateTimer = 0; } } else if (this->stateTimer == 1) { - func_80A24BDC(this, globalCtx, 0.7f, 1.3f, 6); - func_80A24B74(this, globalCtx); + func_80A24BDC(this, play, 0.7f, 1.3f, 6); + func_80A24B74(this, play); } this->dyna.actor.velocity.y += 5.0f; @@ -1317,20 +1316,20 @@ void func_80A262EC(ObjIceblock* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y += temp; temp_f14 = this->dyna.actor.world.pos.y + (600.0f * this->dyna.actor.scale.y); if (this->unk_244 < (temp_f14 - 90.0f)) { - func_80A24B74(this, globalCtx); + func_80A24B74(this, play); func_80A26574(this); } else { if ((this->dyna.actor.velocity.y > 0.0f) && (temp_f14 < (this->unk_244 + 3.0f)) && (this->unk_244 <= temp_f14)) { - func_80A24BDC(this, globalCtx, 0.8f, 1.0f, 11); - func_80A24B74(this, globalCtx); + func_80A24BDC(this, play, 0.8f, 1.0f, 11); + func_80A24B74(this, play); } sp38.x = this->dyna.actor.world.pos.x; sp38.y = (this->unk_244 - (600.0f * this->dyna.actor.scale.y)) + 90.0f; sp38.z = this->dyna.actor.world.pos.z; - if (func_80A246D8(this, globalCtx, &sp38)) { + if (func_80A246D8(this, play, &sp38)) { this->unk_1B0 |= 0x80; } } @@ -1348,12 +1347,12 @@ void func_80A26574(ObjIceblock* this) { this->stateTimer = 40; } -void func_80A265C0(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A265C0(ObjIceblock* this, PlayState* play) { s32 pad; ObjIceBlockUnkStruct4* ptr; if (func_80A25238(this) != -1) { - func_80A2541C(this, globalCtx); + func_80A2541C(this, play); } if (this->stateTimer > 0) { @@ -1365,17 +1364,17 @@ void func_80A265C0(ObjIceblock* this, GlobalContext* globalCtx) { ptr->unk_0E = Rand_S16Offset(900, 600); ptr->unk_04 = (2.0f * Rand_ZeroOne()) + 1.0f; ptr->unk_14 = Rand_Next() >> 0x10; - func_80A24B74(this, globalCtx); + func_80A24B74(this, play); } func_80A237A4(this); func_80A23938(this); if (this->unk_1B0 & 0x40) { - func_80A24B74(this, globalCtx); + func_80A24B74(this, play); } - func_80A24A48(this, globalCtx); + func_80A24A48(this, play); } void func_80A266C4(ObjIceblock* this) { @@ -1383,7 +1382,7 @@ void func_80A266C4(ObjIceblock* this) { this->unk_2A8 = 0.0f; } -void func_80A266E0(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A266E0(ObjIceblock* this, PlayState* play) { f32 temp; s32 sp20; Actor* actor = &this->dyna.actor; @@ -1408,14 +1407,14 @@ void func_80A266E0(ObjIceblock* this, GlobalContext* globalCtx) { this->collider.dim.radius = actor->scale.x * 290.0f; } - func_80A2508C(this, globalCtx); + func_80A2508C(this, play); if (sp20) { Actor_MarkForDeath(&this->dyna.actor); } } -void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjIceblock_Update(Actor* thisx, PlayState* play) { s32 pad; ObjIceblock* this = THIS; Actor* parent = this->dyna.actor.parent; @@ -1454,7 +1453,7 @@ void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_1B0 &= ~0x100; if (this->unk_1B0 & 1) { this->unk_1B0 &= ~1; - func_800B7298(globalCtx, &this->dyna.actor, 6); + func_800B7298(play, &this->dyna.actor, 6); } func_80A266C4(this); } @@ -1467,7 +1466,7 @@ void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->dyna.actor.update == NULL) { if (parent != NULL) { parent->child = NULL; @@ -1489,14 +1488,14 @@ void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.base.ocFlags1 |= (OC1_TYPE_2 | OC1_TYPE_1 | OC1_TYPE_PLAYER); this->collider.info.bumper.dmgFlags |= (0x800000 | 0x400000 | 0x10000 | 0x2000 | 0x1000 | 0x800 | 0x200 | 0x100 | 0x80 | 0x20 | 0x10 | 0x2); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } if (this->unk_1B0 & 0x100) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } func_80A25440(this); @@ -1506,28 +1505,28 @@ void ObjIceblock_Update(Actor* thisx, GlobalContext* globalCtx) { if (parent) {} } -void func_80A26B64(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A26B64(ObjIceblock* this, PlayState* play) { } // draw func -void func_80A26B74(ObjIceblock* this, GlobalContext* globalCtx) { - Gfx_DrawDListXlu(globalCtx, gIceBlockCubeDL); +void func_80A26B74(ObjIceblock* this, PlayState* play) { + Gfx_DrawDListXlu(play, gIceBlockCubeDL); if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); - Gfx_DrawDListXlu(globalCtx, gIceBlockIceBergDL); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); + Gfx_DrawDListXlu(play, gIceBlockIceBergDL); } } // draw func -void func_80A26BF8(ObjIceblock* this, GlobalContext* globalCtx) { +void func_80A26BF8(ObjIceblock* this, PlayState* play) { s32 pad[2]; ObjIceBlockUnkStruct* ptr; s32 i; Vec3s sp70; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); sp70.z = 0; for (i = 0; i < ARRAY_COUNT(this->unk_1B4); i++) { @@ -1538,27 +1537,27 @@ void func_80A26BF8(ObjIceblock* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.z, &sp70); Matrix_Scale(ptr->unk_04, ptr->unk_08, ptr->unk_0C, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gIceBlockCubeDL); } if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y - 20.0f, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->unk_2B4, this->unk_2B4, this->unk_2B4, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gIceBlockIceBergDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjIceblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjIceblock_Draw(Actor* thisx, PlayState* play) { ObjIceblock* this = THIS; - AnimatedMat_Draw(globalCtx, sCubeSublimatingAirTexMat); - this->extendedDrawFunc(this, globalCtx); - func_80A24AA8(this, globalCtx); + AnimatedMat_Draw(play, sCubeSublimatingAirTexMat); + this->extendedDrawFunc(this, play); + func_80A24AA8(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h index 52460b87d8..31ef0d80f6 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h @@ -5,8 +5,8 @@ struct ObjIceblock; -typedef void (*ObjIceblockActionFunc)(struct ObjIceblock*, GlobalContext*); -typedef void (*ObjIceblockExtendedDrawFunc)(struct ObjIceblock*, GlobalContext*); +typedef void (*ObjIceblockActionFunc)(struct ObjIceblock*, PlayState*); +typedef void (*ObjIceblockExtendedDrawFunc)(struct ObjIceblock*, PlayState*); #define GET_ICEBLOCK_SNAP_ROT(thisx) (((thisx)->params >> 1) & 1) #define GET_ICEBLOCK_ICEBERG(thisx) ((thisx)->params & 1) diff --git a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c index 53d1d76698..64a6b8b111 100644 --- a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c +++ b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c @@ -11,10 +11,10 @@ #define THIS ((ObjJgGakki*)thisx) -void ObjJgGakki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjJgGakki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjJgGakki_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjJgGakki_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjJgGakki_Init(Actor* thisx, PlayState* play); +void ObjJgGakki_Destroy(Actor* thisx, PlayState* play); +void ObjJgGakki_Update(Actor* thisx, PlayState* play); +void ObjJgGakki_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Jg_Gakki_InitVars = { ACTOR_OBJ_JG_GAKKI, @@ -28,18 +28,18 @@ const ActorInit Obj_Jg_Gakki_InitVars = { (ActorFunc)ObjJgGakki_Draw, }; -void ObjJgGakki_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjJgGakki_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjJgGakki* this = THIS; f32 frameCount = Animation_GetLastFrame(&gGoronElderDrumTakeOutAnim); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_Init(globalCtx, &this->skelAnime, &gGoronElderDrumSkel, NULL, NULL, NULL, 0); + SkelAnime_Init(play, &this->skelAnime, &gGoronElderDrumSkel, NULL, NULL, NULL, 0); - if (((globalCtx->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7)) && - (globalCtx->csCtx.currentCsIndex == 0)) { + if (((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7)) && + (play->csCtx.currentCsIndex == 0)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, frameCount, frameCount, 2, 0.0f); - } else if ((globalCtx->sceneNum == SCENE_17SETUGEN) || (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA)) { + } else if ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_10YUKIYAMANOMURA)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, 0.0f, frameCount, 2, 0.0f); } else { Actor_MarkForDeath(&this->actor); @@ -47,20 +47,20 @@ void ObjJgGakki_Init(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetScale(&this->actor, 0.01f); } -void ObjJgGakki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjJgGakki_Destroy(Actor* thisx, PlayState* play) { ObjJgGakki* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjJgGakki_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjJgGakki_Update(Actor* thisx, PlayState* play) { ObjJgGakki* this = THIS; SkelAnime_Update(&this->skelAnime); } -void ObjJgGakki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjJgGakki_Draw(Actor* thisx, PlayState* play) { ObjJgGakki* this = THIS; - SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c index 68e7717c1a..1d34515c91 100644 --- a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c +++ b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c @@ -10,10 +10,10 @@ #define THIS ((ObjJgameLight*)thisx) -void ObjJgameLight_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjJgameLight_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjJgameLight_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjJgameLight_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjJgameLight_Init(Actor* thisx, PlayState* play); +void ObjJgameLight_Destroy(Actor* thisx, PlayState* play); +void ObjJgameLight_Update(Actor* thisx, PlayState* play); +void ObjJgameLight_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Jgame_Light_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c index 1ca1c4b586..24584c1d48 100644 --- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c +++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c @@ -11,18 +11,18 @@ #define THIS ((ObjKendoKanban*)thisx) -void ObjKendoKanban_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKendoKanban_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKendoKanban_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKendoKanban_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKendoKanban_Init(Actor* thisx, PlayState* play); +void ObjKendoKanban_Destroy(Actor* thisx, PlayState* play); +void ObjKendoKanban_Update(Actor* thisx, PlayState* play); +void ObjKendoKanban_Draw(Actor* thisx, PlayState* play); void func_80B65880(ObjKendoKanban* this); -void func_80B65894(ObjKendoKanban* this, GlobalContext* globalCtx); -void func_80B658A4(ObjKendoKanban* this, GlobalContext* globalCtx); -void func_80B65CE0(ObjKendoKanban* this, GlobalContext* globalCtx); -void func_80B65D68(ObjKendoKanban* this, GlobalContext* globalCtx); -void func_80B65DA8(ObjKendoKanban* this, GlobalContext* globalCtx); -s32 func_80B6618C(ObjKendoKanban* this, GlobalContext* globalCtx); +void func_80B65894(ObjKendoKanban* this, PlayState* play); +void func_80B658A4(ObjKendoKanban* this, PlayState* play); +void func_80B65CE0(ObjKendoKanban* this, PlayState* play); +void func_80B65D68(ObjKendoKanban* this, PlayState* play); +void func_80B65DA8(ObjKendoKanban* this, PlayState* play); +s32 func_80B6618C(ObjKendoKanban* this, PlayState* play); const ActorInit Obj_Kendo_Kanban_InitVars = { ACTOR_OBJ_KENDO_KANBAN, @@ -158,7 +158,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_HEAVY }; Vec3f D_80B6681C = { 0.0f, 0.0f, 0.0f }; Vec3f D_80B66828 = { 1.0f, 0.0f, 0.0f }; -void ObjKendoKanban_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKendoKanban_Init(Actor* thisx, PlayState* play) { s32 pad[2]; ObjKendoKanban* this = THIS; Vec3f sp70[3]; @@ -167,11 +167,11 @@ void ObjKendoKanban_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); - 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); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Collider_InitTris(globalCtx, &this->colliderTris); - Collider_SetTris(globalCtx, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); + Collider_InitTris(play, &this->colliderTris); + Collider_SetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->colliderTrisElements); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, &this->actor.shape.rot); @@ -184,7 +184,7 @@ void ObjKendoKanban_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetTrisVertices(&this->colliderTris, i, &sp70[0], &sp70[1], &sp70[2]); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->unk_30C = OBJKENDOKANBAN_GET_F(&this->actor); this->actor.gravity = -2.0f; @@ -206,26 +206,26 @@ void ObjKendoKanban_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_30C == OBJKENDOKANBAN_F_0) { func_80B65880(this); } else { - func_80B658A4(this, globalCtx); + func_80B658A4(this, play); } } -void ObjKendoKanban_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKendoKanban_Destroy(Actor* thisx, PlayState* play) { ObjKendoKanban* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); - Collider_DestroyTris(globalCtx, &this->colliderTris); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyTris(play, &this->colliderTris); } void func_80B65880(ObjKendoKanban* this) { this->actionFunc = func_80B65894; } -void func_80B65894(ObjKendoKanban* this, GlobalContext* globalCtx) { +void func_80B65894(ObjKendoKanban* this, PlayState* play) { } -void func_80B658A4(ObjKendoKanban* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B658A4(ObjKendoKanban* this, PlayState* play) { + Player* player = GET_PLAYER(play); if (this->unk_30C == OBJKENDOKANBAN_F_0) { if ((player->swordAnimation == 0) || (player->swordAnimation == 1) || (player->swordAnimation == 0x14)) { @@ -234,7 +234,7 @@ void func_80B658A4(ObjKendoKanban* this, GlobalContext* globalCtx) { this->actor.velocity = D_80B6666C; this->unk_2CC = D_80B6669C; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_KENDO_KANBAN, + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_KENDO_KANBAN, this->actor.home.pos.x - 5.0f, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0xA); @@ -248,9 +248,8 @@ void func_80B658A4(ObjKendoKanban* this, GlobalContext* globalCtx) { this->actor.velocity = D_80B66678; this->unk_2CC = D_80B666A8; - Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_KENDO_KANBAN, - this->actor.home.pos.x, this->actor.home.pos.y + 5.0f, this->actor.home.pos.z, 0, 0, 0, - 3); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_KENDO_KANBAN, this->actor.home.pos.x, + this->actor.home.pos.y + 5.0f, this->actor.home.pos.z, 0, 0, 0, 3); this->unk_29C[0] = D_80B666F4; this->unk_29C[1] = D_80B6670C; @@ -281,11 +280,11 @@ void func_80B658A4(ObjKendoKanban* this, GlobalContext* globalCtx) { this->actionFunc = func_80B65CE0; } -void func_80B65CE0(ObjKendoKanban* this, GlobalContext* globalCtx) { +void func_80B65CE0(ObjKendoKanban* this, PlayState* play) { this->actor.velocity.y += this->actor.gravity; Actor_UpdatePos(&this->actor); this->unk_302 += this->unk_304; - func_80B65DA8(this, globalCtx); + func_80B65DA8(this, play); if (this->actor.world.pos.y < -200.0f) { this->actor.world.pos.y = -200.0f; } @@ -295,15 +294,15 @@ void func_80B65D54(ObjKendoKanban* this) { this->actionFunc = func_80B65D68; } -void func_80B65D68(ObjKendoKanban* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80B65D68(ObjKendoKanban* this, PlayState* play) { + Player* player = GET_PLAYER(play); - if (func_80B6618C(this, globalCtx) == 1) { + if (func_80B6618C(this, play) == 1) { player->unk_AC0 = 700.0f; } } -void func_80B65DA8(ObjKendoKanban* this, GlobalContext* globalCtx) { +void func_80B65DA8(ObjKendoKanban* this, PlayState* play) { Vec3f sp5C; s32 pad[2]; Vec3f sp48; @@ -349,7 +348,7 @@ void func_80B65DA8(ObjKendoKanban* this, GlobalContext* globalCtx) { Matrix_Pop(); } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (this->actor.bgCheckFlags & 1) { this->actor.velocity.x *= 0.8f; @@ -395,8 +394,8 @@ void func_80B65DA8(ObjKendoKanban* this, GlobalContext* globalCtx) { } } -s32 func_80B6618C(ObjKendoKanban* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B6618C(ObjKendoKanban* this, PlayState* play) { + Player* player = GET_PLAYER(play); s32 phi_v0; s32 phi_v1 = 0; s32 i; @@ -433,11 +432,11 @@ s32 func_80B6618C(ObjKendoKanban* this, GlobalContext* globalCtx) { return true; } -void func_80B66304(ObjKendoKanban* this, GlobalContext* globalCtx) { +void func_80B66304(ObjKendoKanban* this, PlayState* play) { if ((this->actionFunc != func_80B65CE0) && (this->actionFunc != func_80B65D68)) { if (this->colliderTris.base.acFlags & AC_HIT) { this->colliderTris.base.acFlags &= ~AC_HIT; - func_80B658A4(this, globalCtx); + func_80B658A4(this, play); } Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); @@ -445,39 +444,39 @@ void func_80B66304(ObjKendoKanban* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.pos.x -= (s16)(20.0f * Math_SinS(this->actor.shape.rot.y)); if (this->actionFunc == func_80B65894) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } } -void ObjKendoKanban_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKendoKanban_Update(Actor* thisx, PlayState* play) { ObjKendoKanban* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); - func_80B66304(this, globalCtx); + func_80B66304(this, play); } #ifdef NON_MATCHING -void ObjKendoKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjKendoKanban_Draw(Actor* thisx, PlayState* play) { ObjKendoKanban* this = THIS; s32 i; Gfx* poly; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (this->unk_30C == OBJKENDOKANBAN_F_0) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gKendoKanbanDL); } else { Matrix_RotateAxisS(this->unk_302, &this->unk_2F0, MTXMODE_APPLY); Matrix_Translate(-this->unk_2E4.x, -this->unk_2E4.y, -this->unk_2E4.z, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_30C & OBJKENDOKANBAN_F_1) { gSPDisplayList(POLY_OPA_DISP++, D_80B666C0); @@ -496,7 +495,7 @@ void ObjKendoKanban_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) { Matrix_MultVec3f(&this->unk_29C[i], &this->unk_26C[i]); diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h index a8c4f8d7c4..3a250b2ff5 100644 --- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h +++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h @@ -5,7 +5,7 @@ struct ObjKendoKanban; -typedef void (*ObjKendoKanbanActionFunc)(struct ObjKendoKanban*, GlobalContext*); +typedef void (*ObjKendoKanbanActionFunc)(struct ObjKendoKanban*, PlayState*); #define OBJKENDOKANBAN_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c b/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c index 4f8bc1d3a7..28c10781db 100644 --- a/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c +++ b/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c @@ -11,10 +11,10 @@ #define THIS ((ObjKepnKoya*)thisx) -void ObjKepnKoya_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKepnKoya_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKepnKoya_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKepnKoya_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKepnKoya_Init(Actor* thisx, PlayState* play); +void ObjKepnKoya_Destroy(Actor* thisx, PlayState* play); +void ObjKepnKoya_Update(Actor* thisx, PlayState* play); +void ObjKepnKoya_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Kepn_Koya_InitVars = { ACTOR_OBJ_KEPN_KOYA, @@ -33,27 +33,27 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 900, ICHAIN_STOP), }; -void ObjKepnKoya_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKepnKoya_Init(Actor* thisx, PlayState* play) { ObjKepnKoya* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_kepn_koya_Colheader_00805C); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_kepn_koya_Colheader_00805C); if (this->dyna.bgId == BG_ACTOR_MAX) { Actor_MarkForDeath(&this->dyna.actor); } } -void ObjKepnKoya_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKepnKoya_Destroy(Actor* thisx, PlayState* play) { ObjKepnKoya* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjKepnKoya_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKepnKoya_Update(Actor* thisx, PlayState* play) { } -void ObjKepnKoya_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_kepn_koya_DL_003478); +void ObjKepnKoya_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_kepn_koya_DL_003478); } 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 979848c3b3..6f98958b1e 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -12,24 +12,24 @@ #define THIS ((ObjKibako*)thisx) -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKibako_Update(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, GlobalContext* globalCtx); -void ObjKibako_SpawnCollectible(ObjKibako* this, GlobalContext* globalCtx); +void ObjKibako_Draw(Actor* thisx, PlayState* play); +void ObjKibako_SpawnCollectible(ObjKibako* this, PlayState* play); void func_809262BC(ObjKibako* this); -void func_80926318(ObjKibako* this, GlobalContext* globalCtx); -void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx); -void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx); +void func_80926318(ObjKibako* this, PlayState* play); +void ObjKibako_AirBreak(ObjKibako* this, PlayState* play); +void ObjKibako_WaterBreak(ObjKibako* this, PlayState* play); void func_80926B40(ObjKibako* this); -void func_80926B54(ObjKibako* this, GlobalContext* globalCtx); +void func_80926B54(ObjKibako* this, 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); static s16 D_80927380 = 0; static s16 D_80927384 = 0; @@ -81,13 +81,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 60, ICHAIN_STOP), }; -void ObjKibako_SpawnCollectible(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_SpawnCollectible(ObjKibako* this, PlayState* play) { s32 dropItem00Id; if (this->isDropCollected == 0) { dropItem00Id = func_800A8150(KIBAKO_COLLECTIBLE_ID(&this->actor)); if (dropItem00Id > ITEM00_NO_DROP) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, + Item_DropCollectible(play, &this->actor.world.pos, dropItem00Id | KIBAKO_COLLECTIBLE_FLAG(&this->actor) << 8); this->isDropCollected = 1; } @@ -114,26 +114,26 @@ void func_809262BC(ObjKibako* this) { } } -void func_80926318(ObjKibako* this, GlobalContext* globalCtx) { +void func_80926318(ObjKibako* this, PlayState* play) { s16 angle; s32 pad; if (this->actor.xzDistToPlayer < 100.0f) { - angle = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; + angle = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; if (ABS_ALT(angle) > 0x5555) { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 36.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } -void func_80926394(ObjKibako* this, GlobalContext* globalCtx) { - if ((this->isDropCollected == 0) && (globalCtx->roomCtx.currRoom.num != this->unk199)) { +void func_80926394(ObjKibako* this, PlayState* play) { + if ((this->isDropCollected == 0) && (play->roomCtx.currRoom.num != this->unk199)) { this->isDropCollected = 1; } } -void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjKibako_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjKibako* this = THIS; s32 whichBankIndex; @@ -145,11 +145,11 @@ void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx2) { } else { this->actor.uncullZoneForward = 800.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.colChkInfo.mass = MASS_IMMOVABLE; - this->bankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIdList[whichBankIndex]); + this->bankIndex = Object_GetIndex(&play->objectCtx, sObjectIdList[whichBankIndex]); if (this->bankIndex < 0) { Actor_MarkForDeath(&this->actor); return; @@ -158,14 +158,14 @@ void ObjKibako_Init(Actor* thisx, GlobalContext* globalCtx2) { func_80926B40(this); } -void ObjKibako_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjKibako_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjKibako* this = THIS; - 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* worldPos = &this->actor.world.pos; @@ -196,16 +196,16 @@ void ObjKibako_AirBreak(ObjKibako* this, GlobalContext* globalCtx) { phi_s0 = 0x20; } - EffectSsKakera_Spawn( - globalCtx, &pos, &velocity, worldPos, -200, phi_s0, 20, 0, 0, (Rand_ZeroOne() * 38.0f) + 10.0f, 0, 0, 60, - -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); + EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -200, phi_s0, 20, 0, 0, (Rand_ZeroOne() * 38.0f) + 10.0f, + 0, 0, 60, -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], + sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); } - func_800BBFB0(globalCtx, worldPos, 40.0f, 3, 0x32, 0x8C, 1); - func_800BBFB0(globalCtx, worldPos, 40.0f, 2, 0x14, 0x50, 1); + func_800BBFB0(play, worldPos, 40.0f, 3, 0x32, 0x8C, 1); + func_800BBFB0(play, worldPos, 40.0f, 2, 0x14, 0x50, 1); } -void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_WaterBreak(ObjKibako* this, PlayState* play) { s16 angle; s32 i; Vec3f* worldPos = &this->actor.world.pos; @@ -216,11 +216,11 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { for (angle = 0, i = 0; i < 5; i++, angle += 0x3333) { pos.x = (Math_SinS(((s32)(Rand_ZeroOne() * 6000.0f)) + angle) * 15.0f) + worldPos->x; pos.z = (Math_CosS(((s32)(Rand_ZeroOne() * 6000.0f)) + angle) * 15.0f) + worldPos->z; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 350); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 350); } pos.x = worldPos->x; pos.z = worldPos->z; - EffectSsGRipple_Spawn(globalCtx, &pos, 200, 600, 0); + EffectSsGRipple_Spawn(play, &pos, 200, 600, 0); for (i = 0, angle = 0; i < 12; i++, angle += 0x4E20) { f32 sn = Math_SinS(angle); @@ -240,9 +240,9 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { temp_rand = Rand_ZeroOne(); phi_s0 = (temp_rand < 0.2f) ? 0x40 : 0x20; - EffectSsKakera_Spawn( - globalCtx, &pos, &velocity, worldPos, -180, phi_s0, 50, 5, 0, (Rand_ZeroOne() * 35.0f) + 10.0f, 0, 0, 70, - -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); + EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -180, phi_s0, 50, 5, 0, (Rand_ZeroOne() * 35.0f) + 10.0f, + 0, 0, 70, -1, sObjectIdList[KIBAKO_BANK_INDEX(&this->actor)], + sKakeraDisplayLists[KIBAKO_BANK_INDEX(&this->actor)]); } } @@ -250,10 +250,10 @@ void func_80926B40(ObjKibako* this) { this->actionFunc = func_80926B54; } -void func_80926B54(ObjKibako* this, GlobalContext* globalCtx) { +void func_80926B54(ObjKibako* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); - if (Object_IsLoaded(&globalCtx->objectCtx, this->bankIndex)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.draw = ObjKibako_Draw; this->actor.objBankIndex = this->bankIndex; ObjKibako_SetupIdle(this); @@ -264,36 +264,36 @@ void ObjKibako_SetupIdle(ObjKibako* this) { this->actionFunc = ObjKibako_Idle; } -void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Idle(ObjKibako* this, PlayState* play) { s32 pad; s32 pad1; - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { ObjKibako_SetupHeld(this); this->actor.room = -1; this->actor.colChkInfo.mass = 120; if (func_800A817C(KIBAKO_COLLECTIBLE_ID(&this->actor))) { - ObjKibako_SpawnCollectible(this, globalCtx); + ObjKibako_SpawnCollectible(this, play); } //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the collider func_800B8E58((Player*)this, NA_SE_PL_PULL_UP_WOODBOX); } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { - ObjKibako_WaterBreak(this, globalCtx); - ObjKibako_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + ObjKibako_WaterBreak(this, play); + ObjKibako_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); } else if (this->collider.base.acFlags & AC_HIT) { - ObjKibako_AirBreak(this, globalCtx); - ObjKibako_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_AirBreak(this, play); + ObjKibako_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); Actor_MarkForDeath(&this->actor); } else { Actor_MoveWithGravity(&this->actor); func_809262BC(this); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; @@ -308,20 +308,20 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { if (KIBAKO_BOMBER_CAN_HIDE_IN_BOX(&this->actor)) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - func_80926318(this, globalCtx); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + func_80926318(this, play); } } else { if (this->actor.xzDistToPlayer < 800.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); - func_80926318(this, globalCtx); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_80926318(this, play); } } } @@ -332,14 +332,14 @@ void ObjKibako_SetupHeld(ObjKibako* this) { this->actionFunc = ObjKibako_Held; } -void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Held(ObjKibako* this, PlayState* play) { s32 pad; Vec3f pos; s32 bgId; - func_80926394(this, globalCtx); - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + func_80926394(this, play); + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { ObjKibako_SetupIdle(this); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; @@ -349,13 +349,13 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { ObjKibako_SetupThrown(this); this->actor.flags &= ~ACTOR_FLAG_4000000; } - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); } else { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); } } @@ -371,7 +371,7 @@ void ObjKibako_SetupThrown(ObjKibako* this) { this->actionFunc = ObjKibako_Thrown; } -void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { +void ObjKibako_Thrown(ObjKibako* this, PlayState* play) { void* pad; void* pad2; s32 atHit; @@ -380,21 +380,21 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { if (atHit) { this->collider.base.atFlags &= ~AT_HIT; } - func_80926394(this, globalCtx); + func_80926394(this, play); if (this->timer > 0) { this->timer--; } if ((this->actor.bgCheckFlags & 0xB) || (atHit) || (this->timer <= 0)) { - ObjKibako_AirBreak(this, globalCtx); - ObjKibako_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako_AirBreak(this, play); + ObjKibako_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); Actor_MarkForDeath(&this->actor); } else { if (this->actor.bgCheckFlags & 0x40) { - ObjKibako_WaterBreak(this, globalCtx); - ObjKibako_SpawnCollectible(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + ObjKibako_WaterBreak(this, play); + ObjKibako_SpawnCollectible(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); } else { if (this->actor.velocity.y < -0.05f) { @@ -405,21 +405,21 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { Math_StepToS(&D_8092738C, D_80927388, 0xA0); this->actor.shape.rot.x = (s16)(this->actor.shape.rot.x + D_80927384); this->actor.shape.rot.y = (s16)(this->actor.shape.rot.y + D_8092738C); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); 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) { ObjKibako* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); ObjKibako_SetShadow(this); } -void ObjKibako_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, sDisplayLists[KIBAKO_BANK_INDEX(thisx)]); +void ObjKibako_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, sDisplayLists[KIBAKO_BANK_INDEX(thisx)]); } 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 6df8b48ee1..b3ef71cca7 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h @@ -10,7 +10,7 @@ struct ObjKibako; -typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, GlobalContext*); +typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, PlayState*); typedef struct ObjKibako { /* 0x000 */ 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 4559051932..40fd2682bf 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -12,12 +12,12 @@ #define THIS ((ObjKibako2*)thisx) -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, @@ -58,17 +58,17 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -s32 ObjKibako2_ContainsSkulltula(ObjKibako2* this, GlobalContext* globalCtx) { +s32 ObjKibako2_ContainsSkulltula(ObjKibako2* this, PlayState* play) { s32 actorSpawnParam = KIBAKO2_SKULLTULA_SPAWN_PARAM(&this->dyna.actor); s32 flag = -1; if ((u16)actorSpawnParam & 3) { flag = ((actorSpawnParam & 0x3FC) >> 2) & 0xFF; } - return !(flag >= 0 && Flags_GetTreasure(globalCtx, flag)); + return !(flag >= 0 && Flags_GetTreasure(play, flag)); } -void ObjKibako2_Break(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Break(ObjKibako2* this, PlayState* play) { s32 pad[2]; Vec3f* thisPos = &this->dyna.actor.world.pos; Vec3f pos; @@ -99,32 +99,32 @@ 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, gLargeCrateFragment1DL); + 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, gLargeCrateFragment1DL); } - func_800BBFB0(globalCtx, thisPos, 90.0f, 6, 100, 160, 1); + func_800BBFB0(play, thisPos, 90.0f, 6, 100, 160, 1); } -void ObjKibako2_SpawnCollectible(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_SpawnCollectible(ObjKibako2* this, PlayState* play) { s32 dropItem00Id = func_800A8150(KIBAKO2_COLLECTIBLE_ID(&this->dyna.actor)); if (dropItem00Id > ITEM00_NO_DROP) { - Item_DropCollectible(globalCtx, &this->dyna.actor.world.pos, + Item_DropCollectible(play, &this->dyna.actor.world.pos, dropItem00Id | KIBAKO2_COLLECTIBLE_FLAG(&this->dyna.actor) << 8); } } -void ObjKibako2_SpawnSkulltula(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_SpawnSkulltula(ObjKibako2* this, PlayState* play) { s16 yRotation; s32 actorSpawnParam; Actor* skulltula; - if (ObjKibako2_ContainsSkulltula(this, globalCtx)) { + if (ObjKibako2_ContainsSkulltula(this, play)) { actorSpawnParam = KIBAKO2_SKULLTULA_SPAWN_PARAM(&this->dyna.actor); yRotation = (Rand_Next() >> 0x11) + this->dyna.actor.yawTowardsPlayer + 0xC000; skulltula = - 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, yRotation, 0, actorSpawnParam); + 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, yRotation, 0, actorSpawnParam); if (skulltula != NULL) { skulltula->parent = &this->dyna.actor; skulltula->velocity.y = 13.0f; @@ -133,24 +133,24 @@ void ObjKibako2_SpawnSkulltula(ObjKibako2* this, GlobalContext* globalCtx) { } } -void ObjKibako2_SpawnContents(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_SpawnContents(ObjKibako2* this, PlayState* play) { if (KIBAKO2_CONTENTS(&this->dyna.actor) == CONTENTS_COLLECTIBLE) { - ObjKibako2_SpawnCollectible(this, globalCtx); + ObjKibako2_SpawnCollectible(this, play); } else { - ObjKibako2_SpawnSkulltula(this, globalCtx); + ObjKibako2_SpawnSkulltula(this, play); } } -void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Init(Actor* thisx, PlayState* play) { ObjKibako2* this = THIS; s32 pad; s32 contents = KIBAKO2_CONTENTS(&this->dyna.actor); DynaPolyActor_Init(&this->dyna, 0); - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gLargeCrateCol); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &gLargeCrateCol); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->dyna.actor.home.rot.z = 0; this->dyna.actor.world.rot.z = 0; @@ -158,23 +158,23 @@ void ObjKibako2_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.x = 0; this->dyna.actor.shape.rot.x = 0; if (contents == CONTENTS_COLLECTIBLE) { - if (Item_CanDropBigFairy(globalCtx, KIBAKO2_COLLECTIBLE_ID(&this->dyna.actor), + if (Item_CanDropBigFairy(play, KIBAKO2_COLLECTIBLE_ID(&this->dyna.actor), KIBAKO2_COLLECTIBLE_FLAG(&this->dyna.actor))) { this->unk_1AC = 1; this->dyna.actor.flags |= ACTOR_FLAG_10; } } - if ((contents != CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, globalCtx)) { + if ((contents != CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, play)) { this->skulltulaNoiseTimer = -1; } this->actionFunc = ObjKibako2_Idle; } -void ObjKibako2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Destroy(Actor* thisx, PlayState* play) { ObjKibako2* this = THIS; - 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); } s32 ObjKibako2_ShouldBreak(ObjKibako2* this) { @@ -206,29 +206,29 @@ s32 ObjKibako2_ShouldBreak(ObjKibako2* this) { return shouldBreak; } -void ObjKibako2_Idle(ObjKibako2* this, GlobalContext* globalCtx) { +void ObjKibako2_Idle(ObjKibako2* this, PlayState* play) { if (ObjKibako2_ShouldBreak(this)) { - ObjKibako2_Break(this, globalCtx); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); + ObjKibako2_Break(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); this->dyna.actor.flags |= ACTOR_FLAG_10; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(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) { - ObjKibako2_SpawnContents(this, globalCtx); +void ObjKibako2_Kill(ObjKibako2* this, PlayState* play) { + ObjKibako2_SpawnContents(this, play); Actor_MarkForDeath(&this->dyna.actor); } -void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKibako2_Update(Actor* thisx, PlayState* play) { ObjKibako2* this = THIS; if (this->unk_1AC != 0) { - globalCtx->actorCtx.unk5 |= 8; + play->actorCtx.unk5 |= 8; } if (this->skulltulaNoiseTimer >= 0) { @@ -243,9 +243,9 @@ void ObjKibako2_Update(Actor* thisx, GlobalContext* globalCtx) { this->skulltulaNoiseTimer--; } } - 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 dd4687ab21..9cbd57ef78 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -15,7 +15,7 @@ typedef enum { struct ObjKibako2; -typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, GlobalContext*); +typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, PlayState*); typedef struct ObjKibako2 { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c index 33cadc8f60..5c10fbd169 100644 --- a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c +++ b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c @@ -11,10 +11,10 @@ #define THIS ((ObjKinoko*)thisx) -void ObjKinoko_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKinoko_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKinoko_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKinoko_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKinoko_Init(Actor* thisx, PlayState* play); +void ObjKinoko_Destroy(Actor* thisx, PlayState* play); +void ObjKinoko_Update(Actor* thisx, PlayState* play); +void ObjKinoko_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Kinoko_InitVars = { ACTOR_OBJ_KINOKO, @@ -28,15 +28,15 @@ const ActorInit Obj_Kinoko_InitVars = { (ActorFunc)ObjKinoko_Draw, }; -void ObjKinoko_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKinoko_Init(Actor* thisx, PlayState* play) { thisx->world.pos.y += 4.0f; } -void ObjKinoko_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKinoko_Destroy(Actor* thisx, PlayState* play) { } -void ObjKinoko_Update(Actor* thisx, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void ObjKinoko_Update(Actor* thisx, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; if (player->currentMask != PLAYER_MASK_SCENTS) { @@ -47,12 +47,12 @@ void ObjKinoko_Update(Actor* thisx, GlobalContext* globalCtx) { thisx->draw = ObjKinoko_Draw; thisx->hintId = 0x64; thisx->flags |= ACTOR_FLAG_1; - if (Actor_HasParent(thisx, globalCtx)) { - Flags_SetCollectible(globalCtx, OBJ_KINOKO_GET_FLAG(thisx)); + if (Actor_HasParent(thisx, play)) { + Flags_SetCollectible(play, OBJ_KINOKO_GET_FLAG(thisx)); Actor_MarkForDeath(thisx); return; } - Actor_PickUp(thisx, globalCtx, GI_MAX, 20.0f, 10.0f); + Actor_PickUp(thisx, play, GI_MAX, 20.0f, 10.0f); if (Math_SmoothStepToF(&thisx->speedXZ, 0.0f, 0.04f, 2.0f, 0.5f) < 0.5f) { thisx->scale.x = 0.0f; thisx->speedXZ = 110.0f; @@ -64,27 +64,27 @@ void ObjKinoko_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->scale.y = thisx->scale.x; thisx->scale.z = thisx->scale.x; - thisx->shape.rot.y = Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; + thisx->shape.rot.y = Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamera]) + 0x8000; } } -void ObjKinoko_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjKinoko_Draw(Actor* thisx, PlayState* play) { Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gfx = POLY_XLU_DISP; gDPSetPrimColor(&gfx[0], 0, 0, 169, 63, 186, (u8)thisx->speedXZ); gDPSetEnvColor(&gfx[1], 110, 44, 200, 100); gDPSetRenderMode(&gfx[2], G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPMatrix(&gfx[3], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[4], &gameplay_keep_DL_029D10[2]); Matrix_RotateXS(-0x4000, MTXMODE_APPLY); - gSPMatrix(&gfx[5], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(&gfx[5], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[6], &gameplay_keep_DL_029D10[2]); POLY_XLU_DISP = &gfx[7]; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c index 5080c19e63..810525a582 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c @@ -11,17 +11,17 @@ #define THIS ((ObjKzsaku*)thisx) -void ObjKzsaku_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjKzsaku_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjKzsaku_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjKzsaku_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjKzsaku_Init(Actor* thisx, PlayState* play); +void ObjKzsaku_Destroy(Actor* thisx, PlayState* play); +void ObjKzsaku_Update(Actor* thisx, PlayState* play); +void ObjKzsaku_Draw(Actor* thisx, PlayState* play); void ObjKzsaku_SetupIdle(ObjKzsaku* this); void func_80C08BBC(ObjKzsaku* this); void func_80C08C84(ObjKzsaku* this); -void ObjKzsaku_Idle(ObjKzsaku* this, GlobalContext* globalCtx); -void ObjKzsaku_Rise(ObjKzsaku* this, GlobalContext* globalCtx); -void func_80C08CB0(ObjKzsaku* this, GlobalContext* globalCtx); +void ObjKzsaku_Idle(ObjKzsaku* this, PlayState* play); +void ObjKzsaku_Rise(ObjKzsaku* this, PlayState* play); +void func_80C08CB0(ObjKzsaku* this, PlayState* play); const ActorInit Obj_Kzsaku_InitVars = { ACTOR_OBJ_KZSAKU, @@ -35,7 +35,7 @@ const ActorInit Obj_Kzsaku_InitVars = { (ActorFunc)ObjKzsaku_Draw, }; -void ObjKzsaku_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjKzsaku_Init(Actor* thisx, PlayState* play) { s32 pad; ObjKzsaku* this = THIS; CollisionHeader* col = NULL; @@ -44,22 +44,22 @@ void ObjKzsaku_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_kzsaku_Colheader_001118, &col); - this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, col); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, col); this->switchFlag = KZSAKU_GET_SWITCHFLAG(thisx); this->raisedAmount = 0.0f; - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { func_80C08C84(this); } else { ObjKzsaku_SetupIdle(this); } } -void ObjKzsaku_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjKzsaku_Destroy(Actor* thisx, PlayState* play) { ObjKzsaku* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void ObjKzsaku_SetupIdle(ObjKzsaku* this) { @@ -67,8 +67,8 @@ void ObjKzsaku_SetupIdle(ObjKzsaku* this) { this->actionFunc = ObjKzsaku_Idle; } -void ObjKzsaku_Idle(ObjKzsaku* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->switchFlag)) { +void ObjKzsaku_Idle(ObjKzsaku* this, PlayState* play) { + if (Flags_GetSwitch(play, this->switchFlag)) { func_80C08BBC(this); } } @@ -77,7 +77,7 @@ void func_80C08BBC(ObjKzsaku* this) { this->actionFunc = ObjKzsaku_Rise; } -void ObjKzsaku_Rise(ObjKzsaku* this, GlobalContext* globalCtx) { +void ObjKzsaku_Rise(ObjKzsaku* this, PlayState* play) { if (this->dyna.actor.cutscene != -1) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -100,7 +100,7 @@ void func_80C08C84(ObjKzsaku* this) { this->actionFunc = func_80C08CB0; } -void func_80C08CB0(ObjKzsaku* this, GlobalContext* globalCtx) { +void func_80C08CB0(ObjKzsaku* this, PlayState* play) { if (this->timer <= 20) { if (this->timer == 20) { if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { @@ -113,18 +113,18 @@ void func_80C08CB0(ObjKzsaku* this, GlobalContext* globalCtx) { } } -void ObjKzsaku_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjKzsaku_Update(Actor* thisx, PlayState* play) { ObjKzsaku* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjKzsaku_Draw(Actor* thisx, GlobalContext* globalCtx) { - OPEN_DISPS(globalCtx->state.gfxCtx); +void ObjKzsaku_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_kzsaku_DL_000040); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h index 8c126412de..dad54478cb 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.h @@ -7,7 +7,7 @@ struct ObjKzsaku; -typedef void (*ObjKzsakuActionFunc)(struct ObjKzsaku*, GlobalContext*); +typedef void (*ObjKzsakuActionFunc)(struct ObjKzsaku*, PlayState*); typedef struct ObjKzsaku { /* 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 300e299aac..28a45984ed 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -10,10 +10,10 @@ #define THIS ((ObjLift*)thisx) -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); #if 0 const ActorInit Obj_Lift_InitVars = { 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 3a3bbb497f..4abba15fd0 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -5,7 +5,7 @@ struct ObjLift; -typedef void (*ObjLiftActionFunc)(struct ObjLift*, GlobalContext*); +typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*); typedef struct ObjLift { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c index bd86f2dea9..6884526ee6 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c @@ -11,16 +11,16 @@ #define THIS ((ObjLightblock*)thisx) -void ObjLightblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLightblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLightblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLightblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLightblock_Init(Actor* thisx, PlayState* play); +void ObjLightblock_Destroy(Actor* thisx, PlayState* play); +void ObjLightblock_Update(Actor* thisx, PlayState* play); +void ObjLightblock_Draw(Actor* thisx, PlayState* play); void func_80AF3AC8(ObjLightblock* this); -void func_80AF3ADC(ObjLightblock* this, GlobalContext* globalCtx); +void func_80AF3ADC(ObjLightblock* this, PlayState* play); void func_80AF3B8C(ObjLightblock* this); -void func_80AF3BA0(ObjLightblock* this, GlobalContext* globalCtx); +void func_80AF3BA0(ObjLightblock* this, PlayState* play); void func_80AF3C18(ObjLightblock* this); -void func_80AF3C34(ObjLightblock* this, GlobalContext* globalCtx); +void func_80AF3C34(ObjLightblock* this, PlayState* play); const ActorInit Obj_Lightblock_InitVars = { ACTOR_OBJ_LIGHTBLOCK, @@ -76,14 +76,14 @@ static InitChainEntry sInitChain[] = { extern Gfx D_801AEF88[]; extern Gfx D_801AEFA0[]; -void func_80AF3910(ObjLightblock* this, GlobalContext* globalCtx) { +void func_80AF3910(ObjLightblock* this, PlayState* play) { LightblockTypeVars* typeVars = &sLightblockTypeVars[LIGHTBLOCK_TYPE(&this->dyna.actor)]; - 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, typeVars->params); + 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, typeVars->params); } -void ObjLightblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightblock_Init(Actor* thisx, PlayState* play) { s32 pad; ObjLightblock* this = THIS; LightblockTypeVars* typeVars = &sLightblockTypeVars[LIGHTBLOCK_TYPE(&this->dyna.actor)]; @@ -91,12 +91,12 @@ void ObjLightblock_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, typeVars->scale); DynaPolyActor_Init(&this->dyna, 0); - Collider_InitCylinder(globalCtx, &this->collider); - if (Flags_GetSwitch(globalCtx, LIGHTBLOCK_DESTROYED(&this->dyna.actor))) { + Collider_InitCylinder(play, &this->collider); + if (Flags_GetSwitch(play, LIGHTBLOCK_DESTROYED(&this->dyna.actor))) { Actor_MarkForDeath(&this->dyna.actor); } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_lightblock_Colheader_000B80); - Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_lightblock_Colheader_000B80); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->collider.dim.radius = typeVars->radius; this->collider.dim.height = typeVars->height; @@ -106,18 +106,18 @@ void ObjLightblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjLightblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightblock_Destroy(Actor* thisx, PlayState* play) { ObjLightblock* this = THIS; - 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_80AF3AC8(ObjLightblock* this) { this->actionFunc = func_80AF3ADC; } -void func_80AF3ADC(ObjLightblock* this, GlobalContext* globalCtx) { +void func_80AF3ADC(ObjLightblock* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; // light arrows @@ -136,7 +136,7 @@ void func_80AF3ADC(ObjLightblock* this, GlobalContext* globalCtx) { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); func_80AF3B8C(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -144,11 +144,11 @@ void func_80AF3B8C(ObjLightblock* this) { this->actionFunc = func_80AF3BA0; } -void func_80AF3BA0(ObjLightblock* this, GlobalContext* globalCtx) { +void func_80AF3BA0(ObjLightblock* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - Flags_SetSwitch(globalCtx, LIGHTBLOCK_DESTROYED(&this->dyna.actor)); - func_80AF3910(this, globalCtx); + Flags_SetSwitch(play, LIGHTBLOCK_DESTROYED(&this->dyna.actor)); + func_80AF3910(this, play); func_80AF3C18(this); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); @@ -160,7 +160,7 @@ void func_80AF3C18(ObjLightblock* this) { this->actionFunc = func_80AF3C34; } -void func_80AF3C34(ObjLightblock* this, GlobalContext* globalCtx) { +void func_80AF3C34(ObjLightblock* this, PlayState* play) { s8 temp_a0; this->timer--; @@ -174,33 +174,33 @@ void func_80AF3C34(ObjLightblock* this, GlobalContext* globalCtx) { } else { this->alpha = 0; this->dyna.actor.draw = NULL; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } } } -void ObjLightblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightblock_Update(Actor* thisx, PlayState* play) { ObjLightblock* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjLightblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightblock_Draw(Actor* thisx, PlayState* play) { ObjLightblock* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->alpha < 255) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, D_801AEF88); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, this->alpha); gSPDisplayList(POLY_XLU_DISP++, object_lightblock_DL_000178); } else { - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, D_801AEFA0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, object_lightblock_DL_000178); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h index 028d637547..c8a0b23df1 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.h @@ -8,7 +8,7 @@ struct ObjLightblock; -typedef void (*ObjLightblockActionFunc)(struct ObjLightblock*, GlobalContext*); +typedef void (*ObjLightblockActionFunc)(struct ObjLightblock*, PlayState*); typedef struct ObjLightblock { /* 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 b1d54899bb..470e226627 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -11,21 +11,21 @@ #define THIS ((ObjLightswitch*)thisx) -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_PlayCinema(ObjLightswitch* this, 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_PlayCinema(ObjLightswitch* this, PlayState* play); void ObjLightSwitch_SetupEnabled(ObjLightswitch* this); -void ObjLightSwitch_Enabled(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightSwitch_Enabled(ObjLightswitch* this, PlayState* play); void ObjLightswitch_SetupIdle(ObjLightswitch* this); void ObjLightSwitch_SetupFade(ObjLightswitch* this); -void ObjLightSwitch_Fade(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightSwitch_Fade(ObjLightswitch* this, PlayState* play); void ObjLightSwitch_SetupAsleep(ObjLightswitch* this); -void ObjLightSwitch_Asleep(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightSwitch_Asleep(ObjLightswitch* this, PlayState* play); void ObjLightSwitch_SetupDisabled(ObjLightswitch* this); -void ObjLightSwitch_Disabled(ObjLightswitch* this, GlobalContext* globalCtx); -void ObjLightswitch_Idle(ObjLightswitch* this, GlobalContext* globalCtx); +void ObjLightSwitch_Disabled(ObjLightswitch* this, PlayState* play); +void ObjLightswitch_Idle(ObjLightswitch* this, PlayState* play); const ActorInit Obj_Lightswitch_InitVars = { ACTOR_OBJ_LIGHTSWITCH, @@ -83,11 +83,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 200, 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, &sJntSphInit, &this->elements); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->elements); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), @@ -96,17 +96,17 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) Collider_UpdateSpheres(0, &this->collider); } -void ObjLightswitch_UpdateSwitchFlags(ObjLightswitch* this, GlobalContext* globalCtx, s32 set) { +void ObjLightswitch_UpdateSwitchFlags(ObjLightswitch* this, PlayState* play, s32 set) { if (this) {} if (set) { - Flags_SetSwitch(globalCtx, GET_LIGHTSWITCH_SWITCHFLAG(this)); + Flags_SetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(this)); } else { - Flags_UnsetSwitch(globalCtx, GET_LIGHTSWITCH_SWITCHFLAG(this)); + Flags_UnsetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(this)); } } -void ObjLightswitch_SpawnEffects(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_SpawnEffects(ObjLightswitch* this, PlayState* play) { Vec3f effectPos; f32 sinResult; f32 cosResult; @@ -139,18 +139,18 @@ void ObjLightswitch_SpawnEffects(ObjLightswitch* this, GlobalContext* globalCtx) effectPos.y = this->actor.world.pos.y + tempResultDiff + 10.0f; effectPos.z = this->actor.world.pos.z + ((rand * cosResult) - (tempResult * sinResult)); - EffectSsDeadDb_Spawn(globalCtx, &effectPos, &gZeroVec3f, &gZeroVec3f, &sLightswitchEffectPrimColor, + EffectSsDeadDb_Spawn(play, &effectPos, &gZeroVec3f, &gZeroVec3f, &sLightswitchEffectPrimColor, &sLightswitchEffectEnvColor, 100, 0, 9); } } -void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Init(Actor* thisx, PlayState* play) { ObjLightswitch* this = THIS; s32 pad; u32 isSwitchActivated; s32 isTriggered; - isSwitchActivated = Flags_GetSwitch(globalCtx, GET_LIGHTSWITCH_SWITCHFLAG(this)); + isSwitchActivated = Flags_GetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(this)); isTriggered = false; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetFocus(&this->actor, 0.0f); @@ -165,7 +165,7 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { ObjLightswitch_SetupIdle(this); } - ObjLightswitch_InitCollider(this, globalCtx); + ObjLightswitch_InitCollider(this, play); if (GET_LIGHTSWITCH_INVISIBLE(this)) { // the stone tower exterior switch is part of the scene mesh, the actor is invisble on top @@ -177,9 +177,9 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjLightswitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Destroy(Actor* thisx, PlayState* play) { ObjLightswitch* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void ObjLightswitch_SetAction(ObjLightswitch* this, ObjLightswitchSetupFunc setupFunc, u32 setState) { @@ -188,10 +188,10 @@ void ObjLightswitch_SetAction(ObjLightswitch* this, ObjLightswitchSetupFunc setu this->actionFunc = ObjLightswitch_PlayCinema; } -void ObjLightswitch_PlayCinema(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_PlayCinema(ObjLightswitch* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - ObjLightswitch_UpdateSwitchFlags(this, globalCtx, this->switchFlagSetType); + ObjLightswitch_UpdateSwitchFlags(this, play, this->switchFlagSetType); this->cutsceneTimer = 50; this->setupFunc(this); } else { @@ -208,7 +208,7 @@ void ObjLightswitch_SetupIdle(ObjLightswitch* this) { this->actionFunc = ObjLightswitch_Idle; } -void ObjLightswitch_Idle(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightswitch_Idle(ObjLightswitch* this, PlayState* play) { s32 actorType = GET_LIGHTSWITCH_TYPE(this); if (this->hitState >= 10) { @@ -229,7 +229,7 @@ void ObjLightSwitch_SetupAsleep(ObjLightswitch* this) { this->actionFunc = ObjLightSwitch_Asleep; } -void ObjLightSwitch_Asleep(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightSwitch_Asleep(ObjLightswitch* this, PlayState* play) { if (this->colorShiftTimer == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SUN_MARK_FLASH); } @@ -259,12 +259,12 @@ void ObjLightSwitch_SetupEnabled(ObjLightswitch* this) { this->actionFunc = ObjLightSwitch_Enabled; } -void ObjLightSwitch_Enabled(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightSwitch_Enabled(ObjLightswitch* this, PlayState* play) { s32 actorType = GET_LIGHTSWITCH_TYPE(this); if (actorType == LIGHTSWITCH_TYPE_REGULAR) { // switch can be disabled outside of this actor by flag - if (!Flags_GetSwitch(globalCtx, GET_LIGHTSWITCH_SWITCHFLAG(this))) { + if (!Flags_GetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(this))) { ObjLightSwitch_SetupDisabled(this); } } else if (actorType == LIGHTSWITCH_TYPE_FLIP) { @@ -274,7 +274,7 @@ void ObjLightSwitch_Enabled(ObjLightswitch* this, GlobalContext* globalCtx) { } } else if (this->hitState == 0) { if (this->colorShiftTimer >= 13) { - ObjLightswitch_UpdateSwitchFlags(this, globalCtx, 0); + ObjLightswitch_UpdateSwitchFlags(this, play, 0); ObjLightSwitch_SetupDisabled(this); } else { this->colorShiftTimer++; @@ -291,7 +291,7 @@ void ObjLightSwitch_SetupDisabled(ObjLightswitch* this) { this->actionFunc = ObjLightSwitch_Disabled; } -void ObjLightSwitch_Disabled(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightSwitch_Disabled(ObjLightswitch* this, PlayState* play) { this->colorShiftTimer--; Math_StepToS(&this->edgeRotSpeed, 0, 0xA); this->edgeRot += this->edgeRotSpeed; @@ -311,9 +311,9 @@ void ObjLightSwitch_SetupFade(ObjLightswitch* this) { this->actionFunc = ObjLightSwitch_Fade; } -void ObjLightSwitch_Fade(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightSwitch_Fade(ObjLightswitch* this, PlayState* play) { this->colorAlpha -= 200; - ObjLightswitch_SpawnEffects(this, globalCtx); // spawn burning fire effect + ObjLightswitch_SpawnEffects(this, play); // spawn burning fire effect if (this->colorAlpha < 0) { Actor_MarkForDeath(&this->actor); } else { @@ -321,7 +321,7 @@ void ObjLightSwitch_Fade(ObjLightswitch* this, GlobalContext* globalCtx) { } } -void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Update(Actor* thisx, PlayState* play) { ObjLightswitch* this = THIS; s32 pad; @@ -354,22 +354,22 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.update != NULL) { this->previousACFlags = this->collider.base.acFlags; - 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) { s32 pad; Vec3f tempPos; Vec3s tempRot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), ((void)0, (u8)(this->colorB >> 6)), (u8)(this->colorAlpha >> 6)); gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); @@ -377,7 +377,7 @@ void ObjLightSwitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { tempPos.x = this->actor.world.pos.x; tempPos.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); tempPos.z = this->actor.world.pos.z; - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sLightswitchFaceGfx[this->faceState])); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000260); @@ -386,26 +386,26 @@ void ObjLightSwitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { tempRot.z = this->actor.shape.rot.z + this->edgeRot; Matrix_SetTranslateRotateYXZ(tempPos.x, tempPos.y, tempPos.z, &tempRot); 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000398); tempRot.z = this->actor.shape.rot.z - this->edgeRot; Matrix_SetTranslateRotateYXZ(tempPos.x, tempPos.y, tempPos.z, &tempRot); 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000408); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjLightSwitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { +void ObjLightSwitch_DrawXlu(ObjLightswitch* this, PlayState* play) { s32 pad; Vec3f tempPos; Vec3s tempRot; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->colorR >> 6), (u8)(this->colorG >> 6), ((void)0, (u8)(this->colorB >> 6)), (u8)(this->colorAlpha >> 6)); gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); @@ -413,7 +413,7 @@ void ObjLightSwitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { tempPos.x = this->actor.world.pos.x; tempPos.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); tempPos.z = this->actor.world.pos.z; - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sLightswitchFaceGfx[this->faceState])); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000260); @@ -422,25 +422,25 @@ void ObjLightSwitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { tempRot.z = this->actor.shape.rot.z + this->edgeRot; Matrix_SetTranslateRotateYXZ(tempPos.x, tempPos.y, tempPos.z, &tempRot); 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000398); tempRot.z = this->actor.shape.rot.z - this->edgeRot; Matrix_SetTranslateRotateYXZ(tempPos.x, tempPos.y, tempPos.z, &tempRot); 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), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000408); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjLightswitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjLightswitch_Draw(Actor* thisx, PlayState* play) { ObjLightswitch* this = THIS; s32 alpha = (u8)(this->colorAlpha >> 6); if ((GET_LIGHTSWITCH_TYPE(this) == LIGHTSWITCH_TYPE_FAKE) && (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 6bd9dde17a..319b1d6431 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -5,7 +5,7 @@ struct ObjLightswitch; -typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, GlobalContext*); +typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, PlayState*); typedef void (*ObjLightswitchSetupFunc)(struct ObjLightswitch*); typedef struct ObjLightswitch { diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index d804f6b637..e6976c1779 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -10,10 +10,10 @@ #define THIS ((ObjLupygamelift*)thisx) -void ObjLupygamelift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjLupygamelift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjLupygamelift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjLupygamelift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjLupygamelift_Init(Actor* thisx, PlayState* play); +void ObjLupygamelift_Destroy(Actor* thisx, PlayState* play); +void ObjLupygamelift_Update(Actor* thisx, PlayState* play); +void ObjLupygamelift_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Lupygamelift_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h index a1bd6d62ea..95232485ac 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h @@ -5,7 +5,7 @@ struct ObjLupygamelift; -typedef void (*ObjLupygameliftActionFunc)(struct ObjLupygamelift*, GlobalContext*); +typedef void (*ObjLupygameliftActionFunc)(struct ObjLupygamelift*, PlayState*); typedef struct ObjLupygamelift { /* 0x0000 */ Actor actor; 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 a5aaefd4fd..6c2d8a3567 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -10,9 +10,9 @@ #define THIS ((ObjMakekinsuta*)thisx) -void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakekinsuta_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMakekinsuta_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); +void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play); +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Makekinsuta_InitVars = { 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 1645f84693..8e2756f0b7 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 THIS ((ObjMakeoshihiki*)thisx) -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMakeoshihiki_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play); +void ObjMakeoshihiki_Update(Actor* thisx, PlayState* play); const ActorInit Obj_Makeoshihiki_InitVars = { ACTOR_OBJ_MAKEOSHIHIKI, @@ -25,15 +25,15 @@ const ActorInit Obj_Makeoshihiki_InitVars = { (ActorFunc)NULL, }; -s32 ObjMakeoshihiki_GetChildSpawnPointIndex(ObjMakeoshihiki* this, GlobalContext* globalCtx) { +s32 ObjMakeoshihiki_GetChildSpawnPointIndex(ObjMakeoshihiki* this, PlayState* play) { s32 pad; - s32 pathIndexOffset1 = Flags_GetSwitch(globalCtx, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this)) ? 1 : 0; - s32 pathIndexOffset2 = Flags_GetSwitch(globalCtx, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(this)) ? 2 : 0; + s32 pathIndexOffset1 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this)) ? 1 : 0; + s32 pathIndexOffset2 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(this)) ? 2 : 0; return pathIndexOffset1 + pathIndexOffset2; } -void ObjMakeoshihiki_SetSwitchFlags(ObjMakeoshihiki* this, GlobalContext* globalCtx, s32 pathIndex) { +void ObjMakeoshihiki_SetSwitchFlags(ObjMakeoshihiki* this, PlayState* play, s32 pathIndex) { s32 pad; s32 pad2; s32 switchFlag1; @@ -43,36 +43,36 @@ void ObjMakeoshihiki_SetSwitchFlags(ObjMakeoshihiki* this, GlobalContext* global switchFlag1 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this); if (pathIndex & 2) { - Flags_SetSwitch(globalCtx, switchFlag2); + Flags_SetSwitch(play, switchFlag2); } else { - Flags_UnsetSwitch(globalCtx, switchFlag2); + Flags_UnsetSwitch(play, switchFlag2); } if (pathIndex & 1) { - Flags_SetSwitch(globalCtx, switchFlag1); + Flags_SetSwitch(play, switchFlag1); } else { - Flags_UnsetSwitch(globalCtx, switchFlag1); + Flags_UnsetSwitch(play, switchFlag1); } } -void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { ObjMakeoshihiki* this = THIS; Vec3s* childPoint; Path* path; s32 childPointIndex; - path = &globalCtx->setupPathList[OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(this)]; + path = &play->setupPathList[OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(this)]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; - childPointIndex = ObjMakeoshihiki_GetChildSpawnPointIndex(this, globalCtx); + childPointIndex = ObjMakeoshihiki_GetChildSpawnPointIndex(this, play); childPoint = &this->pathPoints[childPointIndex]; - if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_OBJ_OSHIHIKI, childPoint->x, - childPoint->y, childPoint->z, 0, 0, 0, 0xFFF1) == NULL) { + if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_OSHIHIKI, childPoint->x, childPoint->y, + childPoint->z, 0, 0, 0, 0xFFF1) == NULL) { Actor_MarkForDeath(&this->actor); } } -void ObjMakeoshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMakeoshihiki_Update(Actor* thisx, PlayState* play) { ObjMakeoshihiki* this = THIS; Actor* child; s32 loopPathIndex; @@ -86,7 +86,7 @@ void ObjMakeoshihiki_Update(Actor* thisx, GlobalContext* globalCtx) { for (loopPathIndex = 0; loopPathIndex < this->pathCount; loopPathIndex++) { Math_Vec3s_ToVec3f(&pathPointF, &this->pathPoints[loopPathIndex]); if (Math3D_Vec3fDistSq(&this->actor.child->world.pos, &pathPointF) < SQ(0.5f)) { - ObjMakeoshihiki_SetSwitchFlags(this, globalCtx, loopPathIndex); + ObjMakeoshihiki_SetSwitchFlags(this, play, loopPathIndex); return; } } diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index a32f791bc8..99745be7cb 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -11,10 +11,10 @@ #define THIS ((ObjMilkBin*)thisx) -void ObjMilkBin_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMilkBin_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjMilkBin_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMilkBin_Init(Actor* thisx, PlayState* play); +void ObjMilkBin_Destroy(Actor* thisx, PlayState* play); +void ObjMilkBin_Update(Actor* thisx, PlayState* play); +void ObjMilkBin_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Milk_Bin_InitVars = { ACTOR_OBJ_MILK_BIN, @@ -48,10 +48,10 @@ static ColliderCylinderInit sCylinderInit = { { 12, 30, 0, { 0, 0, 0 } }, }; -void ObjMilkBin_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMilkBin_Init(Actor* thisx, PlayState* play) { ObjMilkBin* this = THIS; - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.shape.yOffset = 1100.0f; @@ -63,14 +63,14 @@ void ObjMilkBin_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjMilkBin_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMilkBin_Destroy(Actor* thisx, PlayState* play) { ObjMilkBin* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjMilkBin_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjMilkBin* this = THIS; if (this->type == OBJ_MILK_BIN_TYPE_1) { @@ -89,15 +89,15 @@ void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (!(this->disableDraw & 1)) { - 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 ObjMilkBin_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjMilkBin_Draw(Actor* thisx, PlayState* play) { ObjMilkBin* this = THIS; if (!(this->disableDraw & 1)) { - Gfx_DrawDListOpa(globalCtx, gMilkBinMilkJarDL); + Gfx_DrawDListOpa(play, gMilkBinMilkJarDL); } } diff --git a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c index 5b5e80d392..deaf30f957 100644 --- a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c +++ b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c @@ -10,10 +10,10 @@ #define THIS ((ObjMine*)thisx) -void ObjMine_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMine_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMine_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjMine_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMine_Init(Actor* thisx, PlayState* play); +void ObjMine_Destroy(Actor* thisx, PlayState* play); +void ObjMine_Update(Actor* thisx, PlayState* play); +void ObjMine_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Mine_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.h b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.h index 4b7f8ee3d2..c2ce765f9b 100644 --- a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.h +++ b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.h @@ -5,7 +5,7 @@ struct ObjMine; -typedef void (*ObjMineActionFunc)(struct ObjMine*, GlobalContext*); +typedef void (*ObjMineActionFunc)(struct ObjMine*, PlayState*); typedef struct ObjMine { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index d6d780a041..d0d7492078 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -11,19 +11,19 @@ #define THIS ((ObjMoonStone*)thisx) -void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMoonStone_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMoonStone_Init(Actor* thisx, PlayState* play); +void ObjMoonStone_Destroy(Actor* thisx, PlayState* play); +void ObjMoonStone_Update(Actor* thisx, PlayState* play); +void ObjMoonStone_Draw(Actor* thisx, PlayState* play); void func_80C0662C(ObjMoonStone* this); -void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx); +void func_80C06640(ObjMoonStone* this, PlayState* play); void func_80C066F8(ObjMoonStone* this); -void func_80C0670C(ObjMoonStone* this, GlobalContext* globalCtx); +void func_80C0670C(ObjMoonStone* this, PlayState* play); void func_80C0673C(ObjMoonStone* this); -void func_80C06768(ObjMoonStone* this, GlobalContext* globalCtx); +void func_80C06768(ObjMoonStone* this, PlayState* play); void func_80C0685C(ObjMoonStone* this); -void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx); +void func_80C06870(ObjMoonStone* this, PlayState* play); const ActorInit Obj_Moon_Stone_InitVars = { ACTOR_OBJ_MOON_STONE, @@ -37,7 +37,7 @@ const ActorInit Obj_Moon_Stone_InitVars = { (ActorFunc)ObjMoonStone_Draw, }; -void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMoonStone_Init(Actor* thisx, PlayState* play) { ObjMoonStone* this = THIS; Actor_SetScale(&this->actor, 0.3f); @@ -51,7 +51,7 @@ void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx) { func_80C0662C(this); } else if (!(gSaveContext.save.weekEventReg[74] & 0x40)) { if ((gSaveContext.save.weekEventReg[74] & 0x80)) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, 1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -1); } this->actor.flags &= ~ACTOR_FLAG_1; @@ -61,26 +61,26 @@ void ObjMoonStone_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjMoonStone_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMoonStone_Destroy(Actor* thisx, PlayState* play) { } void func_80C0662C(ObjMoonStone* this) { this->actionFunc = func_80C06640; } -void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80C06640(ObjMoonStone* this, PlayState* play) { + Player* player = GET_PLAYER(play); s16 sp1A = this->actor.yawTowardsPlayer - 0x8000; sp1A -= player->actor.shape.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.colChkInfo.health = 1; - Message_StartTextbox(globalCtx, 0x5E3U, &this->actor); + Message_StartTextbox(play, 0x5E3U, &this->actor); func_80C066F8(this); } else { s32 phi_v0 = ABS_ALT(sp1A); if (phi_v0 < 0x1555) { - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } } } @@ -89,8 +89,8 @@ void func_80C066F8(ObjMoonStone* this) { this->actionFunc = func_80C0670C; } -void func_80C0670C(ObjMoonStone* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { +void func_80C0670C(ObjMoonStone* this, PlayState* play) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.colChkInfo.health = 0; func_80C0662C(this); } @@ -103,21 +103,21 @@ void func_80C0673C(ObjMoonStone* this) { this->actionFunc = func_80C06768; } -void func_80C06768(ObjMoonStone* this, GlobalContext* globalCtx) { +void func_80C06768(ObjMoonStone* this, PlayState* play) { if ((gSaveContext.save.weekEventReg[74] & 0x80)) { if (this->actor.draw == NULL) { this->actor.draw = ObjMoonStone_Draw; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, 1, this->actor.world.pos.x, this->actor.world.pos.y, + Actor_Spawn(&play->actorCtx, play, 1, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, -1); } } if (this->actor.draw) { - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actor.draw = NULL; func_80C0685C(this); } else if (this->actor.xzDistToPlayer < 25.0f) { - Actor_PickUp(&this->actor, globalCtx, GI_MOON_TEAR, 100.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_MOON_TEAR, 100.0f, 30.0f); } } } @@ -126,33 +126,33 @@ void func_80C0685C(ObjMoonStone* this) { this->actionFunc = func_80C06870; } -void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) { - if (Message_GetState(&globalCtx->msgCtx) == 6 && Message_ShouldAdvance(globalCtx)) { +void func_80C06870(ObjMoonStone* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[74] |= 0x40; Actor_MarkForDeath(&this->actor); } } -void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMoonStone_Update(Actor* thisx, PlayState* play) { ObjMoonStone* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & 0x10000282)) { - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } } -void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void ObjMoonStone_Draw(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_gi_reserve00_Matanimheader_001C60)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_gi_reserve00_Matanimheader_001C60)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_gi_reserve00_DL_000D78); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_gi_reserve00_DL_000C80); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h index 0790384972..fbdf402808 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h @@ -5,7 +5,7 @@ struct ObjMoonStone; -typedef void (*ObjMoonStoneActionFunc)(struct ObjMoonStone*, GlobalContext*); +typedef void (*ObjMoonStoneActionFunc)(struct ObjMoonStone*, PlayState*); typedef struct ObjMoonStone { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index f81b4fe47e..fd9157d8aa 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -10,20 +10,20 @@ #define THIS ((ObjMuPict*)thisx) -void ObjMuPict_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjMuPict_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjMuPict_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjMuPict_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjMuPict_Init(Actor* thisx, PlayState* play); +void ObjMuPict_Destroy(Actor* thisx, PlayState* play); +void ObjMuPict_Update(Actor* thisx, PlayState* play); +void ObjMuPict_Draw(Actor* thisx, PlayState* play); void func_80C06B5C(ObjMuPict* this); -void func_80C06B70(ObjMuPict* this, GlobalContext* globalCtx); +void func_80C06B70(ObjMuPict* this, PlayState* play); void func_80C06C54(ObjMuPict* this); -void func_80C06C68(ObjMuPict* this, GlobalContext* globalCtx); +void func_80C06C68(ObjMuPict* this, PlayState* play); void func_80C06CC4(ObjMuPict* this); -void func_80C06CD8(ObjMuPict* this, GlobalContext* globalCtx); -void func_80C06D90(ObjMuPict* this, GlobalContext* globalCtx); -void func_80C06DC8(ObjMuPict* this, GlobalContext* globalCtx); -void func_80C06E88(ObjMuPict* this, GlobalContext* globalCtx); +void func_80C06CD8(ObjMuPict* this, PlayState* play); +void func_80C06D90(ObjMuPict* this, PlayState* play); +void func_80C06DC8(ObjMuPict* this, PlayState* play); +void func_80C06E88(ObjMuPict* this, PlayState* play); const ActorInit Obj_Mu_Pict_InitVars = { ACTOR_OBJ_MU_PICT, @@ -37,14 +37,14 @@ const ActorInit Obj_Mu_Pict_InitVars = { (ActorFunc)ObjMuPict_Draw, }; -void ObjMuPict_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMuPict_Init(Actor* thisx, PlayState* play) { ObjMuPict* this = THIS; if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20)) { Actor_MarkForDeath(&this->actor); } - func_80C06D90(this, globalCtx); + func_80C06D90(this, play); this->unk14A = UNK_ACTOR_PARAM; this->actor.targetMode = 6; this->actor.focus.pos = this->actor.world.pos; @@ -53,30 +53,30 @@ void ObjMuPict_Init(Actor* thisx, GlobalContext* globalCtx) { func_80C06B5C(this); } -void ObjMuPict_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMuPict_Destroy(Actor* thisx, PlayState* play) { } void func_80C06B5C(ObjMuPict* this) { this->actionFunc = func_80C06B70; } -void func_80C06B70(ObjMuPict* this, GlobalContext* globalCtx) { +void func_80C06B70(ObjMuPict* this, PlayState* play) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; - if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.cutscene < 0) { - func_80C06DC8(this, globalCtx); + func_80C06DC8(this, play); func_80C06CC4(this); } else { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); } ActorCutscene_SetIntentToPlay(this->actor.cutscene); - func_80C06DC8(this, globalCtx); + func_80C06DC8(this, play); func_80C06C54(this); } } else if (ABS_ALT(yawDiff) < 0x2AAA) { - func_800B8614(&this->actor, globalCtx, 80.0f); + func_800B8614(&this->actor, play, 80.0f); } } @@ -84,7 +84,7 @@ void func_80C06C54(ObjMuPict* this) { this->actionFunc = func_80C06C68; } -void func_80C06C68(ObjMuPict* this, GlobalContext* globalCtx) { +void func_80C06C68(ObjMuPict* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); func_80C06CC4(this); @@ -97,8 +97,8 @@ void func_80C06CC4(ObjMuPict* this) { this->actionFunc = func_80C06CD8; } -void func_80C06CD8(ObjMuPict* this, GlobalContext* globalCtx) { - switch (Message_GetState(&globalCtx->msgCtx)) { +void func_80C06CD8(ObjMuPict* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { case 0: case 1: case 2: @@ -106,10 +106,10 @@ void func_80C06CD8(ObjMuPict* this, GlobalContext* globalCtx) { case 4: break; case 5: - func_80C06E88(this, globalCtx); + func_80C06E88(this, play); break; case 6: - if (Message_ShouldAdvance(globalCtx)) { + if (Message_ShouldAdvance(play)) { func_80C06B5C(this); if (this->actor.cutscene >= 0) { ActorCutscene_Stop(this->actor.cutscene); @@ -121,8 +121,8 @@ void func_80C06CD8(ObjMuPict* this, GlobalContext* globalCtx) { this->actor.parent->shape.rot.y = this->actor.parent->world.rot.y; } -void func_80C06D90(ObjMuPict* this, GlobalContext* globalCtx) { - Actor* actorPtr = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; +void func_80C06D90(ObjMuPict* this, PlayState* play) { + Actor* actorPtr = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (actorPtr != NULL) { if (actorPtr->id == ACTOR_EN_HGO) { @@ -133,65 +133,65 @@ void func_80C06D90(ObjMuPict* this, GlobalContext* globalCtx) { } } -void func_80C06DC8(ObjMuPict* this, GlobalContext* globalCtx) { +void func_80C06DC8(ObjMuPict* this, PlayState* play) { if (this->unk14A == 0) { if (this->unk148 == 0) { this->unk148 = 1; - Message_StartTextbox(globalCtx, 0x159A, &this->actor); + Message_StartTextbox(play, 0x159A, &this->actor); this->textId = 0x159A; } else { - Message_StartTextbox(globalCtx, 0x159D, &this->actor); + Message_StartTextbox(play, 0x159D, &this->actor); this->textId = 0x159D; } } else if (this->unk148 == 0) { this->unk148 = 1; - Message_StartTextbox(globalCtx, 0x15A0, &this->actor); + Message_StartTextbox(play, 0x15A0, &this->actor); this->textId = 0x15A0; } else { - Message_StartTextbox(globalCtx, 0x15A3, &this->actor); + Message_StartTextbox(play, 0x15A3, &this->actor); this->textId = 0x15A3; } } -void func_80C06E88(ObjMuPict* this, GlobalContext* globalCtx) { - if (Message_ShouldAdvance(globalCtx)) { +void func_80C06E88(ObjMuPict* this, PlayState* play) { + if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x159A: - Message_StartTextbox(globalCtx, 0x159B, &this->actor); + Message_StartTextbox(play, 0x159B, &this->actor); this->textId = 0x159B; break; case 0x159B: - Message_StartTextbox(globalCtx, 0x159C, &this->actor); + Message_StartTextbox(play, 0x159C, &this->actor); this->textId = 0x159C; break; case 0x159D: - Message_StartTextbox(globalCtx, 0x159E, &this->actor); + Message_StartTextbox(play, 0x159E, &this->actor); this->textId = 0x159E; break; case 0x159E: - Message_StartTextbox(globalCtx, 0x159F, &this->actor); + Message_StartTextbox(play, 0x159F, &this->actor); this->textId = 0x159F; break; case 0x15A0: - Message_StartTextbox(globalCtx, 0x15A1, &this->actor); + Message_StartTextbox(play, 0x15A1, &this->actor); this->textId = 0x15A1; break; case 0x15A1: - Message_StartTextbox(globalCtx, 0x15A2, &this->actor); + Message_StartTextbox(play, 0x15A2, &this->actor); this->textId = 0x15A2; break; case 0x15A3: - Message_StartTextbox(globalCtx, 0x15A4, &this->actor); + Message_StartTextbox(play, 0x15A4, &this->actor); this->textId = 0x15A4; break; } } } -void ObjMuPict_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjMuPict_Update(Actor* thisx, PlayState* play) { ObjMuPict* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjMuPict_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjMuPict_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.h b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.h index eceebab1c8..cac7725895 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.h +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.h @@ -7,7 +7,7 @@ struct ObjMuPict; #define UNK_ACTOR_PARAM ((this->actor.params & 0xF000) >> 0xC) -typedef void (*ObjMuPictActionFunc)(struct ObjMuPict*, GlobalContext*); +typedef void (*ObjMuPictActionFunc)(struct ObjMuPict*, PlayState*); typedef struct ObjMuPict { /* 0x000 */ Actor actor; 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 b243544827..65a1734986 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -10,15 +10,15 @@ #define THIS ((ObjMure*)thisx) -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_KillActors(ObjMure* this, GlobalContext* globalCtx); -void ObjMure_CheckChildren(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); +void ObjMure_KillActors(ObjMure* this, PlayState* play); +void ObjMure_CheckChildren(ObjMure* this, PlayState* play); const ActorInit Obj_Mure_InitVars = { ACTOR_OBJ_MURE, @@ -72,7 +72,7 @@ typedef enum { /* 2 */ OBJMURE_CHILD_STATE_2 } ObjMureChildState; -s32 func_808D78D0(ObjMure* this, GlobalContext* globalCtx) { +s32 func_808D78D0(ObjMure* this, PlayState* play) { if (this->type == OBJMURE_TYPE_FISH || this->type == OBJMURE_TYPE_BUGS || this->type == OBJMURE_TYPE_BUTTERFLY) { Actor_ProcessInitChain(&this->actor, sInitChain); } else { @@ -81,14 +81,14 @@ s32 func_808D78D0(ObjMure* this, GlobalContext* globalCtx) { return true; } -s32 func_808D7928(ObjMure* this, GlobalContext* globalCtx) { - if (!func_808D78D0(this, globalCtx)) { +s32 func_808D7928(ObjMure* this, PlayState* play) { + if (!func_808D78D0(this, play)) { return false; } return true; } -void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Init(Actor* thisx, PlayState* play) { ObjMure* this = THIS; this->chNum = OBJ_MURE_GET_CHNUM(this->actor.params); @@ -103,14 +103,14 @@ void ObjMure_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - if (!func_808D7928(this, globalCtx)) { + if (!func_808D7928(this, play)) { Actor_MarkForDeath(&this->actor); return; } this->actionFunc = ObjMure_InitialAction; } -void ObjMure_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_Destroy(Actor* thisx, PlayState* play) { } s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { @@ -124,7 +124,7 @@ void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { *outPos = *inPos; } -void ObjMure_SpawnActors0(Actor* thisx, GlobalContext* globalCtx) { +void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { ObjMure* this = THIS; s32 i; Vec3f pos; @@ -138,9 +138,9 @@ void ObjMure_SpawnActors0(Actor* thisx, GlobalContext* globalCtx) { case OBJMURE_CHILD_STATE_2: ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, 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], - this->actor.cutscene, this->actor.unk20, NULL); + &play->actorCtx, 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], this->actor.cutscene, + this->actor.unk20, NULL); if (this->children[i] != NULL) { if (this->type == 0x90) { ((ObjMureChild*)this->children[i])->unk_197 = 1; @@ -151,9 +151,9 @@ void ObjMure_SpawnActors0(Actor* thisx, GlobalContext* globalCtx) { default: ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( - &globalCtx->actorCtx, globalCtx, 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], - this->actor.cutscene, this->actor.unk20, NULL); + &play->actorCtx, 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], this->actor.cutscene, + this->actor.unk20, NULL); if (this->children[i] != NULL) { this->children[i]->room = this->actor.room; } @@ -162,8 +162,8 @@ void ObjMure_SpawnActors0(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { + PlayState* play = play2; Actor* actor = &this->actor; Vec3f spawnPos; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); @@ -172,8 +172,8 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx2) { for (i = 0; i < maxChildren; i++) { ObjMure_GetSpawnPos(&spawnPos, &actor->world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( - &globalCtx2->actorCtx, globalCtx, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, - actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, + &play2->actorCtx, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, actor->world.rot.x, + actor->world.rot.y, actor->world.rot.z, (this->type == OBJMURE_TYPE_BUTTERFLY && i == 0) ? 1 : sSpawnParams[this->type], this->actor.cutscene, this->actor.unk20, NULL); if (this->children[i] != NULL) { @@ -185,18 +185,18 @@ void ObjMure_SpawnActors1(ObjMure* this, GlobalContext* globalCtx2) { } } -void ObjMure_SpawnActors(ObjMure* this, GlobalContext* globalCtx) { +void ObjMure_SpawnActors(ObjMure* this, PlayState* play) { switch (this->svNum) { case 0: - ObjMure_SpawnActors0(&this->actor, globalCtx); + ObjMure_SpawnActors0(&this->actor, 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; @@ -213,7 +213,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_MarkForDeath(this->children[i]); @@ -225,11 +225,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; @@ -252,15 +252,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_10; - ObjMure_SpawnActors(this, globalCtx); + ObjMure_SpawnActors(this, play); } } @@ -310,7 +310,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_19C <= 0) { if (this->unk_19E) { this->unk_19E = false; @@ -344,7 +344,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; @@ -378,22 +378,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_10; - 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 = THIS; if (this->unk_19C > 0) { this->unk_19C--; } - 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 1cb9a653a1..4934e635ec 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -5,7 +5,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 49101b7460..31c5b50aab 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -10,12 +10,12 @@ #define THIS ((ObjMure2*)thisx) -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 func_809613C4(ObjMure2* this, GlobalContext* globalCtx); -void func_809613FC(ObjMure2* this, GlobalContext* globalCtx); -void func_80961490(ObjMure2* this, GlobalContext* globalCtx); +void func_809613C4(ObjMure2* this, PlayState* play); +void func_809613FC(ObjMure2* this, PlayState* play); +void func_80961490(ObjMure2* this, PlayState* play); #if 0 const ActorInit Obj_Mure2_InitVars = { 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 b306e2552c..fdb6af93cb 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h @@ -5,7 +5,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 bdeb9c7025..c8a5188b0d 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -10,13 +10,13 @@ #define THIS ((ObjMure3*)thisx) -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_8098F5AC(ObjMure3* this, GlobalContext* globalCtx); -void func_8098F5E4(ObjMure3* this, GlobalContext* globalCtx); -void func_8098F680(ObjMure3* this, GlobalContext* globalCtx); +void func_8098F5AC(ObjMure3* this, PlayState* play); +void func_8098F5E4(ObjMure3* this, PlayState* play); +void func_8098F680(ObjMure3* this, PlayState* play); #if 0 const ActorInit Obj_Mure3_InitVars = { 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 67252a147d..edab30561b 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -5,7 +5,7 @@ struct ObjMure3; -typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, GlobalContext*); +typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); typedef struct ObjMure3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 2ff0e093ec..b85ec38cc7 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -12,22 +12,22 @@ #define THIS ((ObjNozoki*)thisx) -void ObjNozoki_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjNozoki_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjNozoki_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjNozoki_Init(Actor* thisx, PlayState* play); +void ObjNozoki_Destroy(Actor* thisx, PlayState* play); +void ObjNozoki_Update(Actor* thisx, PlayState* play); void ObjNozoki_SetupAction(ObjNozoki* this, ObjNozokiActionFunc actionFunc); -void func_80BA2514(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA27C4(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA28DC(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA2AB4(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA2BA4(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA2C94(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA3044(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA311C(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA3230(ObjNozoki* this, GlobalContext* globalCtx); -void func_80BA3344(ObjNozoki* this, GlobalContext* globalCtx); -void ObjNozoki_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80BA2514(ObjNozoki* this, PlayState* play); +void func_80BA27C4(ObjNozoki* this, PlayState* play); +void func_80BA28DC(ObjNozoki* this, PlayState* play); +void func_80BA2AB4(ObjNozoki* this, PlayState* play); +void func_80BA2BA4(ObjNozoki* this, PlayState* play); +void func_80BA2C94(ObjNozoki* this, PlayState* play); +void func_80BA3044(ObjNozoki* this, PlayState* play); +void func_80BA311C(ObjNozoki* this, PlayState* play); +void func_80BA3230(ObjNozoki* this, PlayState* play); +void func_80BA3344(ObjNozoki* this, PlayState* play); +void ObjNozoki_Draw(Actor* thisx, PlayState* play); s32 D_80BA36B0; s32 D_80BA36B4; @@ -64,7 +64,7 @@ void ObjNozoki_SetupAction(ObjNozoki* this, ObjNozokiActionFunc actionFunc) { this->actionFunc = actionFunc; } -void ObjNozoki_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjNozoki_Init(Actor* thisx, PlayState* play) { ObjNozoki* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -72,7 +72,7 @@ void ObjNozoki_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0; this->unk_15F = this->dyna.actor.cutscene; - if (globalCtx->sceneNum == SCENE_AYASHIISHOP) { + if (play->sceneNum == SCENE_AYASHIISHOP) { this->unk_15C = 4; ObjNozoki_SetupAction(this, func_80BA3230); this->dyna.actor.colChkInfo.cylRadius = -40; @@ -85,29 +85,29 @@ void ObjNozoki_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjNozoki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjNozoki_Destroy(Actor* thisx, PlayState* play) { ObjNozoki* this = THIS; if (this->unk_15C == 0) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } -void func_80BA2514(ObjNozoki* this, GlobalContext* globalCtx) { - s32 sp24 = Object_GetIndex(&globalCtx->objectCtx, D_80BA34B8[this->unk_15C]); +void func_80BA2514(ObjNozoki* this, PlayState* play) { + s32 sp24 = Object_GetIndex(&play->objectCtx, D_80BA34B8[this->unk_15C]); if (sp24 < 0) { Actor_MarkForDeath(&this->dyna.actor); return; } - if (Object_IsLoaded(&globalCtx->objectCtx, sp24)) { + if (Object_IsLoaded(&play->objectCtx, sp24)) { this->dyna.actor.objBankIndex = sp24; this->dyna.actor.draw = ObjNozoki_Draw; if (this->unk_15C == 0) { - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_secom_obj_Colheader_0001C0); + Actor_SetObjectDependency(play, &this->dyna.actor); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_secom_obj_Colheader_0001C0); if (ActorCutscene_GetAdditionalCutscene(this->unk_15F) >= 0) { this->dyna.actor.params |= OBJNOZOKI_400; } @@ -143,8 +143,8 @@ s32 func_80BA26A8(ObjNozoki* this) { return false; } -s32 func_80BA2708(ObjNozoki* this, GlobalContext* globalCtx) { - Actor* enemy = globalCtx->actorCtx.actorLists[ACTORCAT_ENEMY].first; +s32 func_80BA2708(ObjNozoki* this, PlayState* play) { + Actor* enemy = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; Vec3f sp30; while (enemy != NULL) { @@ -164,18 +164,18 @@ void func_80BA2790(ObjNozoki* this) { this->unk_15E = 0; } -void func_80BA27C4(ObjNozoki* this, GlobalContext* globalCtx) { - if (!(globalCtx->actorCtx.unk5 & 0x20)) { +void func_80BA27C4(ObjNozoki* this, PlayState* play) { + if (!(play->actorCtx.unk5 & 0x20)) { if (OBJNOZOKI_GET_200(&this->dyna.actor)) { - if (!func_80BA2708(this, globalCtx)) { + if (!func_80BA2708(this, play)) { return; } } else { if (D_80BA36B0 != 0) { - globalCtx->actorCtx.unk5 |= 0x80; + play->actorCtx.unk5 |= 0x80; } - if (!Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { return; } } @@ -190,14 +190,14 @@ void func_80BA27C4(ObjNozoki* this, GlobalContext* globalCtx) { if (this->unk_15E < 0) { this->unk_15E = 50; } - globalCtx->actorCtx.unk5 |= 0x10; + play->actorCtx.unk5 |= 0x10; } } - GET_PLAYER(globalCtx)->linearVelocity = 0.0f; + GET_PLAYER(play)->linearVelocity = 0.0f; } } -void func_80BA28DC(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA28DC(ObjNozoki* this, PlayState* play) { if (this->unk_15E != 0) { if (DECR(this->unk_15E) == 0) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); @@ -205,22 +205,22 @@ void func_80BA28DC(ObjNozoki* this, GlobalContext* globalCtx) { return; } - if (!(globalCtx->actorCtx.unk5 & 0x20)) { + if (!(play->actorCtx.unk5 & 0x20)) { 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); if (OBJNOZOKI_GET_200(&this->dyna.actor)) { - if (!Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { return; } - } else if (Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { s32 cs = this->dyna.actor.cutscene; if (cs == this->unk_15F) { if (OBJNOZOKI_GET_400(&this->dyna.actor)) { Vec3f sp28; - Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &sp28, &GET_PLAYER(globalCtx)->actor.world.pos); + Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &sp28, &GET_PLAYER(play)->actor.world.pos); if (sp28.z < -20.0f) { this->unk_15F = ActorCutscene_GetAdditionalCutscene(this->unk_15F); } @@ -243,7 +243,7 @@ void func_80BA28DC(ObjNozoki* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); } -void func_80BA2AB4(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA2AB4(ObjNozoki* this, PlayState* play) { this->dyna.actor.velocity.y = 30.0f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 30.0f) && (D_80BA36B0 == 0)) { @@ -251,22 +251,22 @@ void func_80BA2AB4(ObjNozoki* this, GlobalContext* globalCtx) { D_80BA36B0 = 1; } - if (!(globalCtx->actorCtx.unk5 & 0x20)) { + if (!(play->actorCtx.unk5 & 0x20)) { if (!(OBJNOZOKI_GET_200(&this->dyna.actor)) && - Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { func_80BA2790(this); } } } -void func_80BA2B64(ObjNozoki* this, GlobalContext* globalCtx, s32 arg2, s32 arg3) { +void func_80BA2B64(ObjNozoki* this, PlayState* play, s32 arg2, s32 arg3) { this->unk_15D = arg2; this->unk_15E = 80; - Flags_UnsetSwitch(globalCtx, arg3); + Flags_UnsetSwitch(play, arg3); } -void func_80BA2BA4(ObjNozoki* this, GlobalContext* globalCtx) { - if (!Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { +void func_80BA2BA4(ObjNozoki* this, PlayState* play) { + if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { this->dyna.actor.shape.rot.x = -0x1F40; this->unk_15E = 80; } else if (DECR(this->unk_15E) == 0) { @@ -288,7 +288,7 @@ s32 func_80BA2C28(ObjNozoki* this) { return -1; } -void func_80BA2C94(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA2C94(ObjNozoki* this, PlayState* play) { s32 temp_v0 = func_80BA2C28(this); f32 sp38; f32 sp34; @@ -298,26 +298,26 @@ void func_80BA2C94(ObjNozoki* this, GlobalContext* globalCtx) { D_80BA36B4 = temp_v0; } - if ((temp_v0 < 0) && Play_InCsMode(globalCtx)) { + if ((temp_v0 < 0) && Play_InCsMode(play)) { return; } if (D_80BA36B8 < D_80BA34D8[D_80BA36B4]) { sp38 = this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y; - if ((this->unk_15D != 1) && Flags_GetSwitch(globalCtx, this->dyna.actor.world.rot.z)) { - func_80BA2B64(this, globalCtx, 1, this->dyna.actor.world.rot.x); - } else if ((this->unk_15D != 2) && Flags_GetSwitch(globalCtx, this->dyna.actor.world.rot.x)) { - func_80BA2B64(this, globalCtx, 2, this->dyna.actor.world.rot.z); + if ((this->unk_15D != 1) && Flags_GetSwitch(play, this->dyna.actor.world.rot.z)) { + func_80BA2B64(this, play, 1, this->dyna.actor.world.rot.x); + } else if ((this->unk_15D != 2) && Flags_GetSwitch(play, this->dyna.actor.world.rot.x)) { + func_80BA2B64(this, play, 2, this->dyna.actor.world.rot.z); } else if (DECR(this->unk_15E) == 0) { this->unk_15D = 0; - Flags_UnsetSwitch(globalCtx, this->dyna.actor.world.rot.z); - Flags_UnsetSwitch(globalCtx, this->dyna.actor.world.rot.x); + Flags_UnsetSwitch(play, this->dyna.actor.world.rot.z); + Flags_UnsetSwitch(play, this->dyna.actor.world.rot.x); } Math_StepToF(&this->dyna.actor.speedXZ, D_80BA34E4[this->unk_15D], 0.1f); - if ((globalCtx->actorCtx.unk5 & 0x40) || (globalCtx->actorCtx.unk5 & 0x20)) { + if ((play->actorCtx.unk5 & 0x40) || (play->actorCtx.unk5 & 0x20)) { temp_f0 = 0.5f; } else { temp_f0 = this->dyna.actor.speedXZ; @@ -327,20 +327,20 @@ void func_80BA2C94(ObjNozoki* this, GlobalContext* globalCtx) { D_80BA36B8 += this->dyna.actor.speedXZ; - if (globalCtx->actorCtx.unk5 & 0x40) { + if (play->actorCtx.unk5 & 0x40) { if (sp34 <= 5.0f) { Actor_MarkForDeath(&this->dyna.actor); } - } else if (!(globalCtx->actorCtx.unk5 & 0x20) && (GET_PLAYER(globalCtx)->actor.id == ACTOR_PLAYER) && - Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) { + } else if (!(play->actorCtx.unk5 & 0x20) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) && + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) { static Vec3f D_80BA34F0 = { 0.0f, 0.0f, 50.0f }; - globalCtx->actorCtx.unk5 |= 0x40; + play->actorCtx.unk5 |= 0x40; Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.home.pos, this->dyna.actor.shape.rot.y, &D_80BA34F0, &this->dyna.actor.world.pos); this->dyna.actor.shape.rot.x = -0x1F40; } else if (sp34 < 50.0f) { - globalCtx->actorCtx.unk5 |= 0x20; + play->actorCtx.unk5 |= 0x20; if (sp34 < 20.0f) { this->dyna.actor.velocity.y -= 0.4f; @@ -361,21 +361,21 @@ void func_80BA2C94(ObjNozoki* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.x -= 0x10000; } - globalCtx->roomCtx.unk7A[0] = this->dyna.actor.velocity.x; + play->roomCtx.unk7A[0] = this->dyna.actor.velocity.x; func_8019FAD8(&D_801DB4A4, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speedXZ); } -void func_80BA3044(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA3044(ObjNozoki* this, PlayState* play) { Vec3f* sp1C = &this->dyna.actor.focus.pos; if (this->unk_15D == 0) { - if (globalCtx->actorCtx.unk5 & 0x40) { + if (play->actorCtx.unk5 & 0x40) { this->unk_15D = 1; this->unk_15E = 20; Math_Vec3f_Copy(&this->dyna.actor.world.pos, sp1C); - } else if (!(globalCtx->actorCtx.unk5 & 0x20) && - Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + } else if (!(play->actorCtx.unk5 & 0x20) && + Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { sp1C = &this->dyna.actor.home.pos; } } else if (DECR(this->unk_15E) == 0) { @@ -385,9 +385,9 @@ void func_80BA3044(ObjNozoki* this, GlobalContext* globalCtx) { Math_Vec3f_StepToXZ(&this->dyna.actor.world.pos, sp1C, 8.0f); } -void func_80BA311C(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA311C(ObjNozoki* this, PlayState* play) { if (this->unk_15D == 0) { - if (Flags_GetSwitch(globalCtx, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { this->unk_15D = 1; this->unk_15E = 70; } @@ -407,13 +407,13 @@ void func_80BA311C(ObjNozoki* this, GlobalContext* globalCtx) { } } -void func_80BA3230(ObjNozoki* this, GlobalContext* globalCtx) { +void func_80BA3230(ObjNozoki* this, PlayState* play) { if (gSaveContext.save.weekEventReg[64] & 0x20) { - Actor* npc = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; - Actor* test3 = SubS_FindActor(globalCtx, npc, ACTORCAT_NPC, ACTOR_EN_TEST3); + Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; + Actor* test3 = SubS_FindActor(play, npc, ACTORCAT_NPC, ACTOR_EN_TEST3); if ((test3 != NULL) && (test3->draw != NULL)) { - if ((globalCtx->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { + if ((play->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10000); this->dyna.actor.textId = 0x297A; } else { @@ -425,32 +425,32 @@ void func_80BA3230(ObjNozoki* this, GlobalContext* globalCtx) { } } - if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { ObjNozoki_SetupAction(this, func_80BA3344); } else { - func_800B8614(&this->dyna.actor, globalCtx, 50.0f); + func_800B8614(&this->dyna.actor, play, 50.0f); } } } } -void func_80BA3344(ObjNozoki* this, GlobalContext* globalCtx) { - if ((globalCtx->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { - if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { +void func_80BA3344(ObjNozoki* this, PlayState* play) { + if ((play->curSpawn == 3) && !(gSaveContext.save.weekEventReg[64] & 0x40)) { + if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { gSaveContext.save.weekEventReg[64] |= 0x40; this->dyna.actor.flags &= ~ACTOR_FLAG_10000; ObjNozoki_SetupAction(this, func_80BA3230); } - } else if ((this->dyna.actor.textId == 0) || Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { - globalCtx->nextEntranceIndex = 0xE20; - globalCtx->sceneLoadFlag = 0x14; + } else if ((this->dyna.actor.textId == 0) || Actor_TextboxIsClosing(&this->dyna.actor, play)) { + play->nextEntranceIndex = 0xE20; + play->sceneLoadFlag = 0x14; } } -void ObjNozoki_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjNozoki_Update(Actor* thisx, PlayState* play) { ObjNozoki* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } Gfx* D_80BA34FC[] = { @@ -461,12 +461,12 @@ Gfx* D_80BA34FC[] = { object_secom_obj_DL_001300, }; -void ObjNozoki_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjNozoki_Draw(Actor* thisx, PlayState* play) { ObjNozoki* this = THIS; if (this->unk_15C == 1) { - GetItem_Draw(globalCtx, GID_39); + GetItem_Draw(play, GID_39); } else { - Gfx_DrawDListOpa(globalCtx, D_80BA34FC[this->unk_15C]); + Gfx_DrawDListOpa(play, D_80BA34FC[this->unk_15C]); } } diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h index 08af2bc02a..007569ecd4 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h @@ -5,7 +5,7 @@ struct ObjNozoki; -typedef void (*ObjNozokiActionFunc)(struct ObjNozoki*, GlobalContext*); +typedef void (*ObjNozokiActionFunc)(struct ObjNozoki*, PlayState*); #define OBJNOZOKI_GET_SWITCHFLAG1(thisx) ((thisx)->params & 0x7F) #define OBJNOZOKI_GET_180(thisx) (((thisx)->params >> 7) & 3) diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 731bc43287..4a2498043e 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -10,10 +10,10 @@ #define THIS ((ObjOcarinalift*)thisx) -void ObjOcarinalift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjOcarinalift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjOcarinalift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjOcarinalift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjOcarinalift_Init(Actor* thisx, PlayState* play); +void ObjOcarinalift_Destroy(Actor* thisx, PlayState* play); +void ObjOcarinalift_Update(Actor* thisx, PlayState* play); +void ObjOcarinalift_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Ocarinalift_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h index 33e56c4ab0..d8c0502869 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h @@ -5,7 +5,7 @@ struct ObjOcarinalift; -typedef void (*ObjOcarinaliftActionFunc)(struct ObjOcarinalift*, GlobalContext*); +typedef void (*ObjOcarinaliftActionFunc)(struct ObjOcarinalift*, PlayState*); typedef struct ObjOcarinalift { /* 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 fac52301a5..b6c2a1d8b2 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -12,18 +12,18 @@ #define THIS ((ObjOshihiki*)thisx) -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_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_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, @@ -73,7 +73,7 @@ void ObjOshihiki_RotateXZ(Vec3f* out, Vec3f* in, f32 sn, f32 cs) { out->z = (in->z * cs) - (in->x * sn); } -s32 ObjOshihiki_StrongEnough(ObjOshihiki* this, GlobalContext* globalCtx) { +s32 ObjOshihiki_StrongEnough(ObjOshihiki* this, PlayState* play) { s32 strength = OBJOSHIHIKI_GET_F(&this->dyna.actor); if (this->cantMove) { @@ -98,12 +98,12 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) { } } -ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, GlobalContext* globalCtx) { +ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, PlayState* play) { DynaPolyActor* dyna; if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) && (fabsf(this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) < 0.001f)) { - dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if ((dyna != NULL) && (dyna->actor.id == ACTOR_OBJ_OSHIHIKI)) { return (ObjOshihiki*)dyna; } @@ -133,7 +133,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) { @@ -146,14 +146,14 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont switch (OBJSWITCH_GET_33(&dyna->actor)) { case OBJSWITCH_NORMAL_BLUE: if ((dynaSwitchFlag == OBJOSHIHIKI_GET_7F00(&this->dyna.actor)) && - Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + Flags_GetSwitch(play, dynaSwitchFlag)) { return false; } break; case OBJSWITCH_INVERSE_BLUE: if ((dynaSwitchFlag == OBJOSHIHIKI_GET_7F00(&this->dyna.actor)) && - !Flags_GetSwitch(globalCtx, dynaSwitchFlag)) { + !Flags_GetSwitch(play, dynaSwitchFlag)) { return false; } break; @@ -162,11 +162,11 @@ s32 ObjOshihiki_NoSwitchPress(ObjOshihiki* this, DynaPolyActor* dyna, GlobalCont return true; } -void ObjOshihiki_SetScale(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetScale(ObjOshihiki* this, PlayState* play) { Actor_SetScale(&this->dyna.actor, sScales[OBJOSHIHIKI_GET_F(&this->dyna.actor)]); } -void ObjOshihiki_SetTextureStep(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetTextureStep(ObjOshihiki* this, PlayState* play) { switch (OBJOSHIHIKI_GET_F(&this->dyna.actor)) { case OBJOSHIHIKI_F_0: case OBJOSHIHIKI_F_3: @@ -185,7 +185,7 @@ void ObjOshihiki_SetTextureStep(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { Color_RGB8* src = &sColors[OBJOSHIHIKI_GET_F0(&this->dyna.actor)]; this->color.r = src->r; @@ -193,14 +193,14 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, GlobalContext* globalCtx) { this->color.b = src->b; } -void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Init(Actor* thisx, PlayState* play) { ObjOshihiki* this = THIS; DynaPolyActor_Init(&this->dyna, 1); if ((OBJOSHIHIKI_GET_FF00(&this->dyna.actor) >= OBJOSHIHIKI_FF00_0) && (OBJOSHIHIKI_GET_FF00(&this->dyna.actor) < OBJOSHIHIKI_FF00_80)) { - if (Flags_GetSwitch(globalCtx, OBJOSHIHIKI_GET_7F00(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJOSHIHIKI_GET_7F00(&this->dyna.actor))) { switch (OBJOSHIHIKI_GET_F(&this->dyna.actor)) { case OBJOSHIHIKI_F_0: case OBJOSHIHIKI_F_1: @@ -219,24 +219,24 @@ void ObjOshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { } } - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); + DynaPolyActor_LoadMesh(play, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); this->texture = Lib_SegmentedToVirtual(gameplay_dangeon_keep_Matanimheader_01B370); - ObjOshihiki_SetScale(this, globalCtx); - ObjOshihiki_SetTextureStep(this, globalCtx); + ObjOshihiki_SetScale(this, play); + ObjOshihiki_SetTextureStep(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); } -void ObjOshihiki_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) { ObjOshihiki* this = THIS; - 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 pad; Vec3f colCheckPoint; Vec3f colCheckOffset; @@ -253,8 +253,8 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, GlobalContext* globalCtx) { colCheckPoint.y += this->dyna.actor.prevPos.y; colCheckPoint.z += this->dyna.actor.world.pos.z; - this->floorHeights[i] = BgCheck_EntityRaycastFloor6( - &globalCtx->colCtx, &this->floorPolys[i], &this->floorBgIds[i], &this->dyna.actor, &colCheckPoint, 0.0f); + this->floorHeights[i] = BgCheck_EntityRaycastFloor6(&play->colCtx, &this->floorPolys[i], &this->floorBgIds[i], + &this->dyna.actor, &colCheckPoint, 0.0f); } } @@ -274,15 +274,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; @@ -291,7 +291,7 @@ s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, GlobalContext* globalCtx) { return false; } -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) { Actor_MarkForDeath(&this->dyna.actor); return false; @@ -304,7 +304,7 @@ s32 ObjOshihiki_CheckGround(ObjOshihiki* this, GlobalContext* globalCtx) { return false; } -s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, ObjOshihiki* this) { +s32 ObjOshihiki_CheckWall(PlayState* play, s16 angle, f32 direction, ObjOshihiki* this) { f32 maxDists[2]; f32 maxDist; f32 sn; @@ -345,20 +345,20 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob faceVtxNext.y = faceVtx.y; faceVtxNext.z = (maxDist * cs) + faceVtx.z; - 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)) { - if (!ObjOshihiki_CheckWall(globalCtx, blockUnder->dyna.yRotation, blockUnder->direction, this)) { + if (!ObjOshihiki_CheckWall(play, blockUnder->dyna.yRotation, blockUnder->direction, this)) { this->blockUnder = blockUnder; } } @@ -382,7 +382,7 @@ 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->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.z = 0.0f; @@ -391,18 +391,18 @@ void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx) { this->actionFunc = ObjOshihiki_OnScene; } -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) { if (fabsf(this->dyna.pushForce) > 0.001f) { - if (ObjOshihiki_StrongEnough(this, globalCtx)) { - if (!ObjOshihiki_CheckWall(globalCtx, this->dyna.yRotation, this->dyna.pushForce, this)) { + if (ObjOshihiki_StrongEnough(this, play)) { + if (!ObjOshihiki_CheckWall(play, this->dyna.yRotation, this->dyna.pushForce, this)) { this->direction = this->dyna.pushForce; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); return; } } @@ -415,7 +415,7 @@ 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->dyna.actor.velocity.z = 0.0f; this->dyna.actor.velocity.y = 0.0f; @@ -424,44 +424,44 @@ void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx) { this->actionFunc = ObjOshihiki_OnActor; } -void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); DynaPolyActor* dyna; s32 sp20 = false; this->stateFlags |= PUSHBLOCK_ON_ACTOR; Actor_MoveWithGravity(&this->dyna.actor); - if (ObjOshihiki_CheckFloor(this, globalCtx)) { + if (ObjOshihiki_CheckFloor(this, play)) { if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } else { - dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if (dyna != NULL) { DynaPolyActor_SetRidingFallingState(dyna); DynaPolyActor_SetSwitchPressedState(dyna); if ((this->timer <= 0) && (fabsf(this->dyna.pushForce) > 0.001f) && - ObjOshihiki_StrongEnough(this, globalCtx) && ObjOshihiki_NoSwitchPress(this, dyna, globalCtx) && - !ObjOshihiki_CheckWall(globalCtx, this->dyna.yRotation, this->dyna.pushForce, this)) { + ObjOshihiki_StrongEnough(this, play) && ObjOshihiki_NoSwitchPress(this, dyna, play) && + !ObjOshihiki_CheckWall(play, this->dyna.yRotation, this->dyna.pushForce, this)) { this->direction = this->dyna.pushForce; - ObjOshihiki_SetupPush(this, globalCtx); + ObjOshihiki_SetupPush(this, play); sp20 = true; } } else { - ObjOshihiki_SetupOnScene(this, globalCtx); + ObjOshihiki_SetupOnScene(this, play); } } } else if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } else { - dyna = DynaPoly_GetActor(&globalCtx->colCtx, this->floorBgIds[this->highestFloor]); + dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if ((dyna != NULL) && (dyna->flags & 1)) { DynaPolyActor_SetRidingFallingState(dyna); DynaPolyActor_SetSwitchPressedState(dyna); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { - ObjOshihiki_SetupFall(this, globalCtx); + ObjOshihiki_SetupFall(this, play); } } @@ -471,16 +471,16 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { } } -void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_SetupPush(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_PUSH; this->dyna.actor.gravity = 0.0f; this->pushSpeed = 2.0f; this->actionFunc = ObjOshihiki_Push; } -void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { +void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); f32 pushDistSigned; s32 stopFlag; @@ -491,18 +491,18 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (pushDistSigned * this->yawSin); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + (pushDistSigned * this->yawCos); - if (!ObjOshihiki_CheckFloor(this, globalCtx)) { + if (!ObjOshihiki_CheckFloor(this, play)) { this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; player->stateFlags2 &= ~0x10; this->dyna.pushForce = 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); + player = GET_PLAYER(play); - if (ObjOshihiki_CheckWall(globalCtx, this->dyna.yRotation, this->dyna.pushForce, this)) { + if (ObjOshihiki_CheckWall(play, this->dyna.yRotation, this->dyna.pushForce, this)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } @@ -515,27 +515,27 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { 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); } } Actor_PlaySfxAtPos(&this->dyna.actor, 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.z = 0.0f; this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.x = 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); s16 temp_t4; this->stateFlags |= PUSHBLOCK_FALL; @@ -547,21 +547,20 @@ void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { Actor_MoveWithGravity(&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); } Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Actor_PlaySfxAtPos(&this->dyna.actor, - SurfaceType_GetSfx(&globalCtx->colCtx, this->floorPolys[this->highestFloor], - this->floorBgIds[this->highestFloor]) + - SFX_FLAG); + Actor_PlaySfxAtPos(&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) { ObjOshihiki* this = THIS; this->stateFlags &= @@ -577,27 +576,27 @@ 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 = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - if (ObjOshihiki_MoveWithBlockUnder(this, globalCtx)) { + 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_8012C28C(globalCtx->state.gfxCtx); - AnimatedMat_DrawStep(globalCtx, this->texture, this->textureStep); + func_8012C28C(play->state.gfxCtx); + AnimatedMat_DrawStep(play, this->texture, this->textureStep); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0xFF, 0xFF, this->color.r, this->color.g, this->color.b, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_dangeon_keep_DL_0182A8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } 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 e08630132a..d26920203f 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -5,7 +5,7 @@ struct ObjOshihiki; -typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, GlobalContext*); +typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, PlayState*); #define OBJOSHIHIKI_GET_F(thisx) ((thisx)->params & 0xF) #define OBJOSHIHIKI_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c index 0f594f1e15..b988df8898 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c @@ -10,9 +10,9 @@ #define THIS ((ObjPurify*)thisx) -void ObjPurify_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjPurify_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjPurify_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjPurify_Init(Actor* thisx, PlayState* play); +void ObjPurify_Destroy(Actor* thisx, PlayState* play); +void ObjPurify_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Purify_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h index 46ee7a8790..a092a69bda 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h @@ -5,7 +5,7 @@ struct ObjPurify; -typedef void (*ObjPurifyActionFunc)(struct ObjPurify*, GlobalContext*); +typedef void (*ObjPurifyActionFunc)(struct ObjPurify*, PlayState*); typedef struct ObjPurify { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index 95b9a3a13d..9f024b0c0b 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -12,18 +12,18 @@ #define THIS ((ObjPzlblock*)thisx) -void ObjPzlblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjPzlblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjPzlblock_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjPzlblock_Init(Actor* thisx, PlayState* play); +void ObjPzlblock_Destroy(Actor* thisx, PlayState* play); +void ObjPzlblock_Update(Actor* thisx, PlayState* play); void func_809A3A48(ObjPzlblock* this); -void func_809A3A74(ObjPzlblock* this, GlobalContext* globalCtx); +void func_809A3A74(ObjPzlblock* this, PlayState* play); void func_809A3BA4(ObjPzlblock* this); -void func_809A3BC0(ObjPzlblock* this, GlobalContext* globalCtx); +void func_809A3BC0(ObjPzlblock* this, PlayState* play); void func_809A3D1C(ObjPzlblock* this); -void func_809A3D38(ObjPzlblock* this, GlobalContext* globalCtx); -void func_809A3E58(Actor* thisx, GlobalContext* globalCtx); -void func_809A3F0C(Actor* thisx, GlobalContext* globalCtx); +void func_809A3D38(ObjPzlblock* this, PlayState* play); +void func_809A3E58(Actor* thisx, PlayState* play); +void func_809A3F0C(Actor* thisx, PlayState* play); const ActorInit Obj_Pzlblock_InitVars = { ACTOR_OBJ_PZLBLOCK, @@ -63,9 +63,9 @@ Color_RGB8 D_809A4088[] = { { 0, 255, 255 }, { 255, 0, 255 }, { 0, 0, 0 }, { 255, 255, 255 }, }; -s32 func_809A33E0(ObjPzlblock* this, GlobalContext* globalCtx, s16 arg2) { - return !DynaPolyActor_ValidateMove(globalCtx, &this->dyna, 30, arg2, 1) || - !DynaPolyActor_ValidateMove(globalCtx, &this->dyna, 30, arg2, 28); +s32 func_809A33E0(ObjPzlblock* this, PlayState* play, s16 arg2) { + return !DynaPolyActor_ValidateMove(play, &this->dyna, 30, arg2, 1) || + !DynaPolyActor_ValidateMove(play, &this->dyna, 30, arg2, 28); } s32 func_809A3448(ObjPzlblock* this) { @@ -191,7 +191,7 @@ void func_809A376C(ObjPzlblock* this, s32 arg1) { this->unk_16C = arg1; } -void ObjPzlblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjPzlblock_Init(Actor* thisx, PlayState* play) { s32 pad; ObjPzlblock* this = THIS; s32 sp2C = OBJPZLBLOCK_GET_ROTZ(&this->dyna.actor); @@ -207,11 +207,11 @@ void ObjPzlblock_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 0); - this->unk_17A = Object_GetIndex(&globalCtx->objectCtx, sp24->unk_00); + this->unk_17A = Object_GetIndex(&play->objectCtx, sp24->unk_00); if (sp28 == 0) { func_809A3D1C(this); - } else if (Flags_GetSwitch(globalCtx, OBJPZLBLOCK_GET_7F(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJPZLBLOCK_GET_7F(&this->dyna.actor))) { if (sp2C == 0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (sp28 * 60); func_809A3D1C(this); @@ -232,10 +232,10 @@ void ObjPzlblock_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjPzlblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjPzlblock_Destroy(Actor* thisx, PlayState* play) { ObjPzlblock* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_809A3A48(ObjPzlblock* this) { @@ -247,7 +247,7 @@ void func_809A3A48(ObjPzlblock* this) { this->unk_160 = 4; } -void func_809A3A74(ObjPzlblock* this, GlobalContext* globalCtx) { +void func_809A3A74(ObjPzlblock* this, PlayState* play) { s32 i; s32 sp20 = func_809A3448(this); @@ -261,14 +261,14 @@ void func_809A3A74(ObjPzlblock* this, GlobalContext* globalCtx) { if (sp20 != -1) { if ((this->unk_16E[sp20] >= 11) && func_809A34E0(this, sp20) && func_809A35EC(this, sp20)) { - if (!func_809A33E0(this, globalCtx, (this->dyna.pushForce > 0.0f) ? 90 : 120)) { + if (!func_809A33E0(this, play, (this->dyna.pushForce > 0.0f) ? 90 : 120)) { func_809A376C(this, sp20); func_809A3BA4(this); return; } } - GET_PLAYER(globalCtx)->stateFlags2 &= ~0x10; + GET_PLAYER(play)->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; } } @@ -278,24 +278,24 @@ void func_809A3BA4(ObjPzlblock* this) { this->unk_160 = 5; } -void func_809A3BC0(ObjPzlblock* this, GlobalContext* globalCtx) { +void func_809A3BC0(ObjPzlblock* this, PlayState* play) { if (Math_StepToF(this->unk_164, this->unk_168, 2.3f)) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 params = OBJPZLBLOCK_GET_ROTZ(&this->dyna.actor); s32 pad; s32 sp20 = 0; if ((params == 4) || (params == 5) || (params == 6)) { - if (!func_809A35EC(this, this->unk_16C) || func_809A33E0(this, globalCtx, 0x5A)) { + if (!func_809A35EC(this, this->unk_16C) || func_809A33E0(this, play, 0x5A)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else if (func_809A35EC(this, this->unk_16C)) { - if (func_809A33E0(this, globalCtx, 0x5A)) { + if (func_809A33E0(this, play, 0x5A)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Flags_SetSwitch(globalCtx, OBJPZLBLOCK_GET_7F(&this->dyna.actor)); + Flags_SetSwitch(play, OBJPZLBLOCK_GET_7F(&this->dyna.actor)); sp20 = 1; } @@ -316,58 +316,58 @@ void func_809A3D1C(ObjPzlblock* this) { this->unk_160 = 4; } -void func_809A3D38(ObjPzlblock* this, GlobalContext* globalCtx) { +void func_809A3D38(ObjPzlblock* this, PlayState* play) { if (fabsf(this->dyna.pushForce) > 0.1f) { - GET_PLAYER(globalCtx)->stateFlags2 &= ~0x10; + GET_PLAYER(play)->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; } } -void ObjPzlblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjPzlblock_Update(Actor* thisx, PlayState* play) { s32 pad; ObjPzlblock* this = THIS; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 15.0f, 30.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, 4); - if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_17A)) { + if (Object_IsLoaded(&play->objectCtx, this->unk_17A)) { ObjPzlblockStruct* sp2C = &D_809A4060[OBJPZLBLOCK_GET_1000(&this->dyna.actor)]; this->dyna.actor.objBankIndex = this->unk_17A; - Actor_SetObjectDependency(globalCtx, &this->dyna.actor); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, sp2C->unk_04); + Actor_SetObjectDependency(play, &this->dyna.actor); + DynaPolyActor_LoadMesh(play, &this->dyna, sp2C->unk_04); this->dyna.actor.update = func_809A3E58; this->dyna.actor.draw = func_809A3F0C; } } -void func_809A3E58(Actor* thisx, GlobalContext* globalCtx) { +void func_809A3E58(Actor* thisx, PlayState* play) { ObjPzlblock* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; if (this->unk_160 != 0) { - Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 15.0f, 30.0f, 0.0f, this->unk_160); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, this->unk_160); if (((this->actionFunc == func_809A3A74) || (this->actionFunc == func_809A3D38)) && - (this->dyna.actor.bgCheckFlags & 1) && !DynaPoly_GetActor(&globalCtx->colCtx, this->dyna.actor.floorBgId)) { + (this->dyna.actor.bgCheckFlags & 1) && !DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId)) { this->unk_160 = 0; } } } -void func_809A3F0C(Actor* thisx, GlobalContext* globalCtx) { +void func_809A3F0C(Actor* thisx, PlayState* play) { ObjPzlblockStruct* sp2C = &D_809A4060[OBJPZLBLOCK_GET_1000(thisx)]; Color_RGB8* sp28 = &D_809A4088[OBJPZLBLOCK_GET_700(thisx)]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sp28->r, sp28->g, sp28->b, 255); gSPDisplayList(POLY_OPA_DISP++, sp2C->unk_08); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h index fa1ca1f59f..c408004838 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h @@ -5,7 +5,7 @@ struct ObjPzlblock; -typedef void (*ObjPzlblockActionFunc)(struct ObjPzlblock*, GlobalContext*); +typedef void (*ObjPzlblockActionFunc)(struct ObjPzlblock*, PlayState*); #define OBJPZLBLOCK_GET_7F(thisx) ((thisx)->params & 0x7F) #define OBJPZLBLOCK_GET_700(thisx) (((thisx)->params >> 8) & 7) diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 24f3fe0d6e..05349cfacc 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -11,21 +11,21 @@ #define THIS ((ObjRaillift*)thisx) -void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjRaillift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjRaillift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjRaillift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjRaillift_Init(Actor* thisx, PlayState* play); +void ObjRaillift_Destroy(Actor* thisx, PlayState* play); +void ObjRaillift_Update(Actor* thisx, PlayState* play); +void ObjRaillift_Draw(Actor* thisx, PlayState* play); -void ObjRaillift_DrawDekuFlowerPlatformColorful(Actor* thisx, GlobalContext* globalCtx); -void ObjRaillift_DrawDekuFlowerPlatform(Actor* thisx, GlobalContext* globalCtx); +void ObjRaillift_DrawDekuFlowerPlatformColorful(Actor* thisx, PlayState* play); +void ObjRaillift_DrawDekuFlowerPlatform(Actor* thisx, PlayState* play); -void ObjRaillift_DoNothing(ObjRaillift* this, GlobalContext* globalCtx); -void ObjRaillift_Idle(ObjRaillift* this, GlobalContext* globalCtx); +void ObjRaillift_DoNothing(ObjRaillift* this, PlayState* play); +void ObjRaillift_Idle(ObjRaillift* this, PlayState* play); void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 arg1); -void ObjRaillift_StartCutscene(ObjRaillift* this, GlobalContext* globalCtx); -void ObjRaillift_Teleport(ObjRaillift* this, GlobalContext* globalCtx); -void ObjRaillift_Wait(ObjRaillift* this, GlobalContext* globalCtx); -void ObjRaillift_Move(ObjRaillift* this, GlobalContext* globalCtx); +void ObjRaillift_StartCutscene(ObjRaillift* this, PlayState* play); +void ObjRaillift_Teleport(ObjRaillift* this, PlayState* play); +void ObjRaillift_Wait(ObjRaillift* this, PlayState* play); +void ObjRaillift_Move(ObjRaillift* this, PlayState* play); const ActorInit Obj_Raillift_InitVars = { ACTOR_OBJ_RAILLIFT, @@ -52,7 +52,7 @@ void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 idx) { Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[idx]); } -void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjRaillift_Init(Actor* thisx, PlayState* play) { ObjRaillift* this = THIS; s32 pad; Path* path; @@ -66,16 +66,15 @@ void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx) { thisx->shape.rot.z = 0; thisx->world.rot.z = 0; DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, sColHeaders[type]); + DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[type]); this->speed = OBJRAILLIFT_GET_SPEED(thisx); if (this->speed < 0.0f) { this->speed = -this->speed; isColorful = true; } if (type == DEKU_FLOWER_PLATFORM) { - Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_ETCETERA, thisx->world.pos.x, - thisx->world.pos.y, thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, - thisx->shape.rot.z, 0); + Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_ETCETERA, thisx->world.pos.x, thisx->world.pos.y, + thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, 0); if (isColorful) { thisx->draw = ObjRaillift_DrawDekuFlowerPlatformColorful; } else { @@ -85,13 +84,13 @@ void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx) { if (this->speed < 0.01f) { this->actionFunc = ObjRaillift_DoNothing; } else { - path = &globalCtx->setupPathList[OBJRAILLIFT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJRAILLIFT_GET_PATH(thisx)]; this->curPoint = OBJRAILLIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; this->points = Lib_SegmentedToVirtual(path->points); ObjRaillift_UpdatePosition(this, this->curPoint); - if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(globalCtx, OBJRAILLIFT_GET_FLAG(thisx))) { + if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; } else { this->actionFunc = ObjRaillift_Move; @@ -99,16 +98,16 @@ void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjRaillift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjRaillift_Destroy(Actor* thisx, PlayState* play) { ObjRaillift* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjRaillift_DoNothing(ObjRaillift* this, GlobalContext* globalCtx) { +void ObjRaillift_DoNothing(ObjRaillift* this, PlayState* play) { } -void ObjRaillift_Move(ObjRaillift* this, GlobalContext* globalCtx) { +void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { s32 isTeleporting; Vec3f nextPoint; f32 speed; @@ -120,7 +119,7 @@ void ObjRaillift_Move(ObjRaillift* this, GlobalContext* globalCtx) { s32 pad; if (OBJRAILLIFT_HAS_FLAG(&this->dyna.actor)) { - if (!Flags_GetSwitch(globalCtx, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { this->actionFunc = ObjRaillift_Idle; return; } @@ -166,7 +165,7 @@ void ObjRaillift_Move(ObjRaillift* this, GlobalContext* globalCtx) { if ((initialPoint->x != endPoint->x) || (initialPoint->y != endPoint->y) || (initialPoint->z != endPoint->z)) { this->actionFunc = ObjRaillift_Teleport; - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; } } @@ -181,15 +180,15 @@ void ObjRaillift_Move(ObjRaillift* this, GlobalContext* globalCtx) { /* Will teleport to what ever curpoint is set to */ -void ObjRaillift_Teleport(ObjRaillift* this, GlobalContext* globalCtx) { +void ObjRaillift_Teleport(ObjRaillift* this, PlayState* play) { if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { ObjRaillift_UpdatePosition(this, this->curPoint); - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = ObjRaillift_Move; } } -void ObjRaillift_Wait(ObjRaillift* this, GlobalContext* globalCtx) { +void ObjRaillift_Wait(ObjRaillift* this, PlayState* play) { this->waitTimer--; if (this->waitTimer <= 0) { this->actionFunc = ObjRaillift_Move; @@ -197,15 +196,15 @@ void ObjRaillift_Wait(ObjRaillift* this, GlobalContext* globalCtx) { } } -void ObjRaillift_Idle(ObjRaillift* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { +void ObjRaillift_Idle(ObjRaillift* this, PlayState* play) { + if (Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { this->dyna.actor.speedXZ = 0.0f; ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); this->actionFunc = ObjRaillift_StartCutscene; } } -void ObjRaillift_StartCutscene(ObjRaillift* this, GlobalContext* globalCtx) { +void ObjRaillift_StartCutscene(ObjRaillift* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); this->cutsceneTimer = 50; @@ -215,12 +214,12 @@ void ObjRaillift_StartCutscene(ObjRaillift* this, GlobalContext* globalCtx) { } } -void ObjRaillift_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjRaillift_Update(Actor* thisx, PlayState* play) { ObjRaillift* this = THIS; f32 target; f32 step; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Actor_SetFocus(&this->dyna.actor, 10.0f); if (this->cutsceneTimer > 0) { this->cutsceneTimer--; @@ -261,29 +260,29 @@ void ObjRaillift_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjRaillift_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjRaillift_Draw(Actor* thisx, PlayState* play) { s32 pad; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, globalCtx->gameplayFrames, 0, 32, 32, 1, 0, 0, 32, - 32, 0, 0, 0, 160)); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Gfx_TwoTexScrollEnvColor(play->state.gfxCtx, 0, play->gameplayFrames, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, + 0, 160)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_raillift_DL_004BF0); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } /* The non-colorful platforms are the ones found in Woodfall Temple */ -void ObjRaillift_DrawDekuFlowerPlatform(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_raillift_DL_000208); +void ObjRaillift_DrawDekuFlowerPlatform(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_raillift_DL_000208); } /* The colorful platforms are the ones found in Deku Palace */ -void ObjRaillift_DrawDekuFlowerPlatformColorful(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, object_raillift_DL_0071B8); +void ObjRaillift_DrawDekuFlowerPlatformColorful(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_raillift_DL_0071B8); } diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h index 06ff23d92c..cd55d1fa6c 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h @@ -5,7 +5,7 @@ struct ObjRaillift; -typedef void (*ObjRailliftActionFunc)(struct ObjRaillift*, GlobalContext*); +typedef void (*ObjRailliftActionFunc)(struct ObjRaillift*, PlayState*); #define OBJRAILLIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) #define OBJRAILLIFT_HAS_FLAG(thisx) (((thisx)->params >> 0xD) & 1) 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 ff0c8d2700..b39187c756 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -10,13 +10,13 @@ #define THIS ((ObjRoomtimer*)thisx) -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_80973CD8(ObjRoomtimer* this, GlobalContext* globalCtx); -void func_80973D3C(ObjRoomtimer* this, GlobalContext* globalCtx); -void func_80973DE0(ObjRoomtimer* this, GlobalContext* globalCtx); +void func_80973CD8(ObjRoomtimer* this, PlayState* play); +void func_80973D3C(ObjRoomtimer* this, PlayState* play); +void func_80973DE0(ObjRoomtimer* this, PlayState* play); const ActorInit Obj_Roomtimer_InitVars = { ACTOR_OBJ_ROOMTIMER, @@ -30,7 +30,7 @@ const ActorInit Obj_Roomtimer_InitVars = { (ActorFunc)NULL, }; -void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { ObjRoomtimer* this = THIS; this->switchFlag = ROOMTIMER_GET_SWITCHFLAG(thisx); @@ -42,7 +42,7 @@ void ObjRoomtimer_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = func_80973CD8; } -void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) { ObjRoomtimer* this = THIS; if (this->actor.params != 0x1FF && gSaveContext.unk_3DD0[4] > 0) { @@ -50,17 +50,17 @@ void ObjRoomtimer_Destroy(Actor* thisx, GlobalContext* globalCtx) { } } -void func_80973CD8(ObjRoomtimer* this, GlobalContext* globalCtx) { +void func_80973CD8(ObjRoomtimer* this, PlayState* play) { if (this->actor.params != 0x1FF) { func_8010E9F0(4, this->actor.params); } - func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actionFunc = func_80973D3C; } -void func_80973D3C(ObjRoomtimer* this, GlobalContext* globalCtx) { - if (Flags_GetClearTemp(globalCtx, this->actor.room)) { +void func_80973D3C(ObjRoomtimer* this, PlayState* play) { + if (Flags_GetClearTemp(play, this->actor.room)) { if (this->actor.params != 0x1FF) { gSaveContext.unk_3DD0[4] = 5; } @@ -68,15 +68,15 @@ void func_80973D3C(ObjRoomtimer* this, GlobalContext* globalCtx) { this->actionFunc = func_80973DE0; } else if (this->actor.params != 0x1FF && gSaveContext.unk_3DD0[4] == 0) { play_sound(NA_SE_OC_ABYSS); - func_80169EFC(&globalCtx->state); + func_80169EFC(&play->state); Actor_MarkForDeath(&this->actor); } } -void func_80973DE0(ObjRoomtimer* this, GlobalContext* globalCtx) { +void func_80973DE0(ObjRoomtimer* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - Flags_SetClear(globalCtx, this->actor.room); - Flags_SetSwitch(globalCtx, this->switchFlag); + Flags_SetClear(play, this->actor.room); + Flags_SetSwitch(play, this->switchFlag); if (ActorCutscene_GetLength(this->actor.cutscene) != -1) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } @@ -86,8 +86,8 @@ void func_80973DE0(ObjRoomtimer* this, GlobalContext* globalCtx) { } } -void ObjRoomtimer_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjRoomtimer_Update(Actor* thisx, PlayState* play) { ObjRoomtimer* this = THIS; - 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 b58d5da495..a20c8af438 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_Rotlift/z_obj_rotlift.c b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c index b17827e0a1..2d984f7269 100644 --- a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c +++ b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c @@ -11,10 +11,10 @@ #define THIS ((ObjRotlift*)thisx) -void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2); -void ObjRotlift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjRotlift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjRotlift_Init(Actor* thisx, PlayState* play2); +void ObjRotlift_Destroy(Actor* thisx, PlayState* play); +void ObjRotlift_Update(Actor* thisx, PlayState* play); +void ObjRotlift_Draw(Actor* thisx, PlayState* play); void ObjRotlift_MoveDekuFlowers(ObjRotlift* this); @@ -78,8 +78,8 @@ void ObjRotlift_MoveDekuFlowers(ObjRotlift* this) { } } -void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjRotlift_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjRotlift* this = THIS; s32 type = OBJROTLIFT_GET_TYPE(&this->dyna.actor); s32 dekuFlowerType; @@ -96,7 +96,7 @@ void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2) { dekuFlowerType = 0x100; } *dekuFlowers = (ObjEtcetera*)Actor_SpawnAsChild( - &globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ETCETERA, this->dyna.actor.world.pos.x, + &play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ETCETERA, 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, dekuFlowerType); } @@ -105,17 +105,17 @@ void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2) { DynaPolyActor_Init(&this->dyna, 3); modelInfo = &sModelInfo[type]; - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, modelInfo->colHeader); + DynaPolyActor_LoadMesh(play, &this->dyna, modelInfo->colHeader); modelInfo->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); } -void ObjRotlift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjRotlift_Destroy(Actor* thisx, PlayState* play) { ObjRotlift* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjRotlift_Update(Actor* thisx, PlayState* play) { ObjRotlift* this = THIS; s16 angShift; s32 angVelocity; @@ -132,11 +132,11 @@ void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.y += angShift; } -void ObjRotlift_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjRotlift_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjRotlift* this = THIS; ModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)]; - AnimatedMat_Draw(globalCtx, modelInfo->animMat); - Gfx_DrawDListOpa(globalCtx, modelInfo->dList); + AnimatedMat_Draw(play, modelInfo->animMat); + Gfx_DrawDListOpa(play, modelInfo->dList); } diff --git a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c index f6f744d155..7ddc911425 100644 --- a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c +++ b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c @@ -10,10 +10,10 @@ #define THIS ((ObjShutter*)thisx) -void ObjShutter_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjShutter_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjShutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjShutter_Init(Actor* thisx, PlayState* play); +void ObjShutter_Destroy(Actor* thisx, PlayState* play); +void ObjShutter_Update(Actor* thisx, PlayState* play); +void ObjShutter_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Shutter_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 1253747e4e..15bd818fc8 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -11,21 +11,21 @@ #define THIS ((ObjSkateblock*)thisx) -void ObjSkateblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSkateblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSkateblock_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSkateblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSkateblock_Init(Actor* thisx, PlayState* play); +void ObjSkateblock_Destroy(Actor* thisx, PlayState* play); +void ObjSkateblock_Update(Actor* thisx, PlayState* play); +void ObjSkateblock_Draw(Actor* thisx, PlayState* play); void func_80A22308(ObjSkateblock* this); -void func_80A22334(ObjSkateblock* this, GlobalContext* globalCtx); +void func_80A22334(ObjSkateblock* this, PlayState* play); void func_80A2244C(ObjSkateblock* this); -void func_80A224A4(ObjSkateblock* this, GlobalContext* globalCtx); +void func_80A224A4(ObjSkateblock* this, PlayState* play); void func_80A22628(ObjSkateblock* this); -void func_80A2264C(ObjSkateblock* this, GlobalContext* globalCtx); +void func_80A2264C(ObjSkateblock* this, PlayState* play); void func_80A22728(ObjSkateblock* this); -void func_80A2273C(ObjSkateblock* this, GlobalContext* globalCtx); +void func_80A2273C(ObjSkateblock* this, PlayState* play); void func_80A227A4(ObjSkateblock* this); -void func_80A227C0(ObjSkateblock* this, GlobalContext* globalCtx); +void func_80A227C0(ObjSkateblock* this, PlayState* play); const ActorInit Obj_Skateblock_InitVars = { ACTOR_OBJ_SKATEBLOCK, @@ -138,7 +138,7 @@ void func_80A212F0(Vec3f* arg0, Vec3f* arg1, s16 arg2) { arg0->z = (arg1->z * temp_f0) - (arg1->x * sp1C); } -s32 func_80A21370(ObjSkateblock* this, GlobalContext* globalCtx) { +s32 func_80A21370(ObjSkateblock* this, PlayState* play) { ObjSkateblockFloor* floor; s32 i; s32 pad; @@ -162,7 +162,7 @@ s32 func_80A21370(ObjSkateblock* this, GlobalContext* globalCtx) { sp8C.z = this->dyna.actor.world.pos.z + ((D_80A22A1C[i].z * this->dyna.actor.scale.z) + D_80A22A44[i].z); floor->height = - BgCheck_EntityRaycastFloor6(&globalCtx->colCtx, &floor->poly, &floor->bgId, &this->dyna.actor, &sp8C, 0.0f); + BgCheck_EntityRaycastFloor6(&play->colCtx, &floor->poly, &floor->bgId, &this->dyna.actor, &sp8C, 0.0f); if (floor->height > BGCHECK_Y_MIN + 1.0f) { sp88 = true; @@ -181,13 +181,13 @@ s32 func_80A21370(ObjSkateblock* this, GlobalContext* globalCtx) { return sp88; } -s32 func_80A21548(ObjSkateblock* this, GlobalContext* globalCtx) { +s32 func_80A21548(ObjSkateblock* this, PlayState* play) { s32 i; ObjSkateblockFloor* floor; this->unk_1C1 &= ~4; - if (func_80A21370(this, globalCtx)) { + if (func_80A21370(this, play)) { f32 maxHeight = BGCHECK_Y_MIN; s32 phi_v1 = false; f32 temp_f12 = this->dyna.actor.world.pos.y - 10.0f; @@ -210,7 +210,7 @@ s32 func_80A21548(ObjSkateblock* this, GlobalContext* globalCtx) { return false; } -s32 func_80A216D4(ObjSkateblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f* arg3) { +s32 func_80A216D4(ObjSkateblock* this, PlayState* play, f32 arg2, Vec3f* arg3) { s32 pad; f32 spE8; f32 spE4; @@ -257,7 +257,7 @@ s32 func_80A216D4(ObjSkateblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f spC8.y = spD4.y; spC8.z = temp_f26 + spD4.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spD4, &spC8, &spB0, &spA0, true, false, false, true, &spA4, + if (BgCheck_EntityLineTest3(&play->colCtx, &spD4, &spC8, &spB0, &spA0, true, false, false, true, &spA4, &this->dyna.actor, 0.0f)) { temp_f2 = Math3D_Vec3fDistSq(&spD4, &spB0); if (temp_f2 < temp_f20) { @@ -270,10 +270,10 @@ s32 func_80A216D4(ObjSkateblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f return ret; } -s32 func_80A21934(ObjSkateblock* this, GlobalContext* globalCtx) { +s32 func_80A21934(ObjSkateblock* this, PlayState* play) { Vec3f sp1C; - if (func_80A216D4(this, globalCtx, 0.0f, &sp1C)) { + if (func_80A216D4(this, play, 0.0f, &sp1C)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -281,7 +281,7 @@ s32 func_80A21934(ObjSkateblock* this, GlobalContext* globalCtx) { return false; } -s32 func_80A21990(ObjSkateblock* this, GlobalContext* globalCtx, Vec3f* arg2) { +s32 func_80A21990(ObjSkateblock* this, PlayState* play, Vec3f* arg2) { s32 i; f32 sp100; s16 phi_s6 = this->dyna.yRotation; @@ -330,7 +330,7 @@ s32 func_80A21990(ObjSkateblock* this, GlobalContext* globalCtx, Vec3f* arg2) { spE0.y = spEC.y; spE0.z = temp_f30 + spEC.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spEC, &spE0, &spC8, &spB8, true, false, false, true, &spBC, + if (BgCheck_EntityLineTest3(&play->colCtx, &spEC, &spE0, &spC8, &spB8, true, false, false, true, &spBC, &this->dyna.actor, 0.0f)) { temp_f0 = Math3D_Vec3fDistSq(&spEC, &spC8); if (temp_f0 < phi_f22) { @@ -345,10 +345,10 @@ s32 func_80A21990(ObjSkateblock* this, GlobalContext* globalCtx, Vec3f* arg2) { return ret; } -s32 func_80A21C30(ObjSkateblock* this, GlobalContext* globalCtx) { +s32 func_80A21C30(ObjSkateblock* this, PlayState* play) { Vec3f sp1C; - if (func_80A21990(this, globalCtx, &sp1C)) { + if (func_80A21990(this, play, &sp1C)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -366,8 +366,8 @@ void func_80A21C88(ObjSkateblock* this, s32 arg1) { this->unk_170 = arg1; } -void func_80A21CB4(ObjSkateblock* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_80A21CB4(ObjSkateblock* this, PlayState* play) { + Player* player = GET_PLAYER(play); player->stateFlags2 &= ~0x10; this->dyna.pushForce = 0.0f; @@ -407,7 +407,7 @@ void func_80A21D1C(ObjSkateblock* this) { } } -void func_80A21E9C(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A21E9C(ObjSkateblock* this, PlayState* play) { DynaPolyActor* temp_v0; s32 i; ObjSkateblockFloor* ptr; @@ -419,7 +419,7 @@ void func_80A21E9C(ObjSkateblock* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->unk_184); i++) { ptr = &this->unk_184[i]; - temp_v0 = DynaPoly_GetActor(&globalCtx->colCtx, ptr->bgId); + temp_v0 = DynaPoly_GetActor(&play->colCtx, ptr->bgId); if ((temp_v0 != NULL) && (temp_v0->actor.id == ACTOR_OBJ_SKATEBLOCK)) { ObjSkateblock* skateBlock = (ObjSkateblock*)temp_v0; f32 height = this->dyna.actor.world.pos.y - ptr->height; @@ -435,7 +435,7 @@ void func_80A21F68(ObjSkateblock* this) { this->unk_17C = 0; } -void func_80A21F74(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A21F74(ObjSkateblock* this, PlayState* play) { s32 pad; Vec3f spA8; Vec3f sp9C; @@ -479,18 +479,18 @@ void func_80A21F74(ObjSkateblock* this, GlobalContext* globalCtx) { spA8.z += this->dyna.actor.world.pos.z; temp = ((Rand_ZeroOne() * 800.0f) + (1600.0f * this->dyna.actor.scale.x)) * phi_f22; - func_800B0E48(globalCtx, &spA8, &gZeroVec3f, &D_80A22ACC, &D_80A22AD8, &D_80A22ADC, temp, + func_800B0E48(play, &spA8, &gZeroVec3f, &D_80A22ACC, &D_80A22AD8, &D_80A22ADC, temp, (Rand_ZeroOne() * 20.0f) + 30.0f); } } } -void ObjSkateblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSkateblock_Init(Actor* thisx, PlayState* play) { ObjSkateblock* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); + DynaPolyActor_LoadMesh(play, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); if (D_80A22A18 == NULL) { D_80A22A18 = Lib_SegmentedToVirtual(gameplay_dangeon_keep_Matanimheader_01B370); } @@ -500,10 +500,10 @@ void ObjSkateblock_Init(Actor* thisx, GlobalContext* globalCtx) { D_80A22A14 &= 0x1F; } -void ObjSkateblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSkateblock_Destroy(Actor* thisx, PlayState* play) { ObjSkateblock* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80A22308(ObjSkateblock* this) { @@ -515,14 +515,14 @@ void func_80A22308(ObjSkateblock* this) { this->dyna.actor.velocity.y = 0.0f; } -void func_80A22334(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A22334(ObjSkateblock* this, PlayState* play) { s32 pad; s32 sp30; s32 sp2C; Vec3f sp20; func_80A21CD8(this); - func_80A21548(this, globalCtx); + func_80A21548(this, play); sp2C = func_80A21150(this); func_80A211F4(this, sp2C); @@ -531,16 +531,16 @@ void func_80A22334(ObjSkateblock* this, GlobalContext* globalCtx) { if (sp2C == -1) { sp30 = false; } else if (!(this->unk_1C1 & 2) && (this->unk_172[sp2C] > 10) && (D_80A22A10 == 0) && - !func_80A216D4(this, globalCtx, 2.0f, &sp20) && !Player_InCsMode(&globalCtx->state)) { + !func_80A216D4(this, play, 2.0f, &sp20) && !Player_InCsMode(&play->state)) { func_80A21C88(this, sp2C); func_80A2244C(this); sp30 = false; - func_800B7298(globalCtx, &this->dyna.actor, 7); + func_800B7298(play, &this->dyna.actor, 7); this->unk_1C1 |= 1; } if (sp30) { - func_80A21CB4(this, globalCtx); + func_80A21CB4(this, play); } } @@ -553,7 +553,7 @@ void func_80A2244C(ObjSkateblock* this) { func_80A21F68(this); } -void func_80A224A4(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A224A4(ObjSkateblock* this, PlayState* play) { s32 pad; s32 sp28 = false; s32 sp24 = false; @@ -562,7 +562,7 @@ void func_80A224A4(ObjSkateblock* this, GlobalContext* globalCtx) { *this->unk_16C += this->unk_164; - if (func_80A21934(this, globalCtx)) { + if (func_80A21934(this, play)) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80A21D1C(this); sp28 = true; @@ -572,8 +572,8 @@ void func_80A224A4(ObjSkateblock* this, GlobalContext* globalCtx) { func_80A21CD8(this); - if (!func_80A21548(this, globalCtx)) { - func_80A21C30(this, globalCtx); + if (!func_80A21548(this, play)) { + func_80A21C30(this, play); func_80A21D1C(this); func_80A22628(this); sp24 = true; @@ -586,15 +586,15 @@ void func_80A224A4(ObjSkateblock* this, GlobalContext* globalCtx) { } if (sp24 || sp28 || (this->unk_17A == 1)) { - func_80A21CB4(this, globalCtx); + func_80A21CB4(this, play); } if ((this->unk_1C1 & 1) && (sp24 || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1C1 &= ~1; - func_800B7298(globalCtx, &this->dyna.actor, 6); + func_800B7298(play, &this->dyna.actor, 6); } - func_80A21F74(this, globalCtx); + func_80A21F74(this, play); } void func_80A22628(ObjSkateblock* this) { @@ -603,19 +603,19 @@ void func_80A22628(ObjSkateblock* this) { this->dyna.actor.velocity.y = this->dyna.actor.gravity; } -void func_80A2264C(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A2264C(ObjSkateblock* this, PlayState* play) { s32 pad; s32 sp20; if (func_80A21150(this) != -1) { - func_80A21CB4(this, globalCtx); + func_80A21CB4(this, play); } func_80A21CD8(this); - sp20 = func_80A21548(this, globalCtx); + sp20 = func_80A21548(this, play); if (sp20 || ((this->unk_160 - this->dyna.actor.world.pos.y) > 300.0f)) { - if (func_800C9B40(&globalCtx->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 12) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + if (func_800C9B40(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 12) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80A22728(this); return; @@ -631,7 +631,7 @@ void func_80A22728(ObjSkateblock* this) { this->actionFunc = func_80A2273C; } -void func_80A2273C(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A2273C(ObjSkateblock* this, PlayState* play) { if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y - (600.0f * this->dyna.actor.scale.y)) - 10.0f; @@ -646,9 +646,9 @@ void func_80A227A4(ObjSkateblock* this) { this->unk_17A = 40; } -void func_80A227C0(ObjSkateblock* this, GlobalContext* globalCtx) { +void func_80A227C0(ObjSkateblock* this, PlayState* play) { if (func_80A21150(this) != -1) { - func_80A21CB4(this, globalCtx); + func_80A21CB4(this, play); } if (this->unk_17A > 0) { @@ -656,7 +656,7 @@ void func_80A227C0(ObjSkateblock* this, GlobalContext* globalCtx) { return; } - func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = ObjSkateblock_Draw; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { @@ -668,29 +668,29 @@ void func_80A227C0(ObjSkateblock* this, GlobalContext* globalCtx) { } } -void ObjSkateblock_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSkateblock_Update(Actor* thisx, PlayState* play) { ObjSkateblock* this = THIS; D_80A22A10 &= ~(1 << this->unk_1C0); - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_1C1 &= ~2; } -void ObjSkateblock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSkateblock_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjSkateblock* this = THIS; Color_RGB8* sp2C = &D_80A22B08[OBJSKAEBLOCK_GET_F(&this->dyna.actor)]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - AnimatedMat_DrawStep(globalCtx, D_80A22A18, 0); + func_8012C28C(play->state.gfxCtx); + AnimatedMat_DrawStep(play, D_80A22A18, 0); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0xFF, 0xFF, sp2C->r, sp2C->g, sp2C->b, 255); gSPDisplayList(POLY_OPA_DISP++, gameplay_dangeon_keep_DL_0182A8); - func_80A21E9C(this, globalCtx); + func_80A21E9C(this, play); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.h b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.h index c26a93844b..83131e4d9b 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.h +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.h @@ -5,7 +5,7 @@ struct ObjSkateblock; -typedef void (*ObjSkateblockActionFunc)(struct ObjSkateblock*, GlobalContext*); +typedef void (*ObjSkateblockActionFunc)(struct ObjSkateblock*, PlayState*); #define OBJSKAEBLOCK_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c b/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c index 83e286e976..9d3b1265de 100644 --- a/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c +++ b/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c @@ -11,10 +11,10 @@ #define THIS ((ObjSmork*)thisx) -void ObjSmork_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSmork_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSmork_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSmork_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSmork_Init(Actor* thisx, PlayState* play); +void ObjSmork_Destroy(Actor* thisx, PlayState* play); +void ObjSmork_Update(Actor* thisx, PlayState* play); +void ObjSmork_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Smork_InitVars = { ACTOR_OBJ_SMORK, @@ -90,7 +90,7 @@ void func_80A3D940(ObjSmork* this) { Math_ApproachF(&this->unk_1B8, (this->unk_1C4 == 0) ? 0.0f : 1.0f, 0.02f, 1000.0f); } -void func_80A3D9C4(ObjSmork* this, GlobalContext* globalCtx) { +void func_80A3D9C4(ObjSmork* this, PlayState* play) { u8 sp57; u8 sp56; s32 i; @@ -109,25 +109,25 @@ void func_80A3D9C4(ObjSmork* this, GlobalContext* globalCtx) { if (this->unk_1B8 > 0.0f) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20)); gSPSegment(POLY_XLU_DISP++, 0x09, Lib_SegmentedToVirtual(this->unk_148)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_f53_obj_DL_001C00); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } -void ObjSmork_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSmork_Init(Actor* thisx, PlayState* play) { ObjSmork* this = THIS; Lib_MemCpy(this->unk_148, ovl_Obj_Smork_Vtx_000C10, sizeof(Vtx) * ARRAY_COUNT(ovl_Obj_Smork_Vtx_000C10)); @@ -135,17 +135,17 @@ void ObjSmork_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1C4 = 0; } -void ObjSmork_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSmork_Destroy(Actor* thisx, PlayState* play) { } -void ObjSmork_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSmork_Update(Actor* thisx, PlayState* play) { ObjSmork* this = THIS; func_80A3D940(this); } -void ObjSmork_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSmork_Draw(Actor* thisx, PlayState* play) { ObjSmork* this = THIS; - func_80A3D9C4(this, globalCtx); + func_80A3D9C4(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c index b3464d7443..c69dd7ff86 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c @@ -12,26 +12,26 @@ #define THIS ((ObjSnowball*)thisx) -void ObjSnowball_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSnowball_Init(Actor* thisx, PlayState* play); +void ObjSnowball_Destroy(Actor* thisx, PlayState* play); +void ObjSnowball_Update(Actor* thisx, PlayState* play); +void ObjSnowball_Draw(Actor* thisx, PlayState* play); -void func_80B02CD0(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B02D58(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B02DB0(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B02E54(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04338(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04350(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04540(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B0457C(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04608(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04648(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B046E4(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04B48(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04B60(ObjSnowball* this, GlobalContext* globalCtx); -void func_80B04D34(Actor* thisx, GlobalContext* globalCtx); +void func_80B02CD0(ObjSnowball* this, PlayState* play); +void func_80B02D58(ObjSnowball* this, PlayState* play); +void func_80B02DB0(ObjSnowball* this, PlayState* play); +void func_80B02E54(ObjSnowball* this, PlayState* play); +void func_80B04338(ObjSnowball* this, PlayState* play); +void func_80B04350(ObjSnowball* this, PlayState* play); +void func_80B04540(ObjSnowball* this, PlayState* play); +void func_80B0457C(ObjSnowball* this, PlayState* play); +void func_80B04608(ObjSnowball* this, PlayState* play); +void func_80B04648(ObjSnowball* this, PlayState* play); +void func_80B046E4(ObjSnowball* this, PlayState* play); +void func_80B047C0(ObjSnowball* this, PlayState* play); +void func_80B04B48(ObjSnowball* this, PlayState* play); +void func_80B04B60(ObjSnowball* this, PlayState* play); +void func_80B04D34(Actor* thisx, PlayState* play); const ActorInit Obj_Snowball_InitVars = { ACTOR_OBJ_SNOWBALL, @@ -101,42 +101,41 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP), }; -void func_80B02CD0(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B02CD0(ObjSnowball* this, PlayState* play) { ObjSnowballStruct2* ptr = &D_80B04F84[this->actor.home.rot.y]; - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ptr->unk_00, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, - this->actor.home.rot.z, ptr->unk_02, -1, this->actor.unk20, NULL); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, + ptr->unk_02, -1, this->actor.unk20, NULL); } -void func_80B02D58(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B02D58(ObjSnowball* this, PlayState* play) { s32 temp_v0 = func_800A8150(OBJSNOWBALL_GET_3F(&this->actor)); if (temp_v0 >= 0) { - Item_DropCollectible(globalCtx, &this->actor.home.pos, (OBJSNOWBALL_GET_7F00(&this->actor) << 8) | temp_v0); + Item_DropCollectible(play, &this->actor.home.pos, (OBJSNOWBALL_GET_7F00(&this->actor) << 8) | temp_v0); } } -void func_80B02DB0(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B02DB0(ObjSnowball* this, PlayState* play) { s32 pad; ObjSnowballStruct2* ptr = &D_80B04F84[this->actor.home.rot.y]; - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ptr->unk_00, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, - this->actor.home.rot.z, this->actor.params | ptr->unk_02, + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, + this->actor.params | ptr->unk_02, ActorCutscene_GetAdditionalCutscene(this->actor.cutscene), this->actor.unk20, NULL); } -void func_80B02E54(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B02E54(ObjSnowball* this, PlayState* play) { ObjSnowballStruct2* ptr = &D_80B04F84[this->actor.home.rot.y]; - Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ptr->unk_00, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, - this->actor.home.rot.z, this->actor.params | ptr->unk_02, -1, this->actor.unk20, - NULL); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, + this->actor.params | ptr->unk_02, -1, this->actor.unk20, NULL); } -void func_80B02EE4(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B02EE4(ObjSnowball* this, PlayState* play) { Vec3f spAC; Vec3f spA0; Vec3f sp94; @@ -156,12 +155,12 @@ void func_80B02EE4(ObjSnowball* this, GlobalContext* globalCtx) { spAC.y = spA0.y * -0.06f; spAC.z = spA0.z * -0.06f; - func_800B0E48(globalCtx, &sp94, &spA0, &spAC, &D_80B04FB4, &D_80B04FB8, (s32)(Rand_ZeroOne() * 30.0f) + 15, + func_800B0E48(play, &sp94, &spA0, &spAC, &D_80B04FB4, &D_80B04FB8, (s32)(Rand_ZeroOne() * 30.0f) + 15, (s32)(Rand_ZeroOne() * 40.0f) + 30); } } -void func_80B030F8(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B030F8(ObjSnowball* this, PlayState* play) { s32 pad; f32 temp_f28 = sqrtf(this->unk_20C); Vec3f spFC; @@ -228,7 +227,7 @@ void func_80B030F8(ObjSnowball* this, GlobalContext* globalCtx) { scale = ((Rand_ZeroOne() * 15.0f) + 30.0f) * this->unk_20C; - EffectSsKakera_Spawn(globalCtx, &spFC, &spF0, &spFC, gravity, phi_s0, 30, 0, 0, scale, phi_s4, 0, 50, -1, + EffectSsKakera_Spawn(play, &spFC, &spF0, &spFC, gravity, phi_s0, 30, 0, 0, scale, phi_s4, 0, 50, -1, OBJECT_GOROIWA, temp_s2); if ((this->unk_210 == 0) && (temp_s7 >= 3)) { spFC.x += (Rand_ZeroOne() * 120.0f) - 60.0f; @@ -237,7 +236,7 @@ void func_80B030F8(ObjSnowball* this, GlobalContext* globalCtx) { temp_s0 = (s32)(Rand_ZeroOne() * 50.0f * temp_f28) + 40; temp_s1 = (s32)(Rand_ZeroOne() * 60.0f * temp_f28) + 50; - func_800B0E48(globalCtx, &spFC, &gZeroVec3f, &D_80B04FBC, &D_80B04FB4, &D_80B04FB8, temp_s0, temp_s1); + func_800B0E48(play, &spFC, &gZeroVec3f, &D_80B04FBC, &D_80B04FB4, &D_80B04FB8, temp_s0, temp_s1); } } @@ -268,12 +267,12 @@ void func_80B030F8(ObjSnowball* this, GlobalContext* globalCtx) { spE4.y = spF0.y * -0.05f; spE4.z = spF0.z * -0.02f; - EffectSsIceSmoke_Spawn(globalCtx, &spFC, &spF0, &spE4, ((s32)(Rand_ZeroOne() * 170.0f) + 150) * temp_f28); + EffectSsIceSmoke_Spawn(play, &spFC, &spF0, &spE4, ((s32)(Rand_ZeroOne() * 170.0f) + 150) * temp_f28); } } } -void func_80B03688(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B03688(ObjSnowball* this, PlayState* play) { s32 i; Vec3f spB8; Vec3f spAC; @@ -306,7 +305,7 @@ void func_80B03688(ObjSnowball* this, GlobalContext* globalCtx) { temp_s3 = (s32)(Rand_ZeroOne() * 60.0f * temp_f22) + 70; - func_800B0E48(globalCtx, &spB8, &spAC, &spA0, &D_80B04FB4, &D_80B04FB8, temp_s3, + func_800B0E48(play, &spB8, &spAC, &spA0, &D_80B04FB4, &D_80B04FB8, temp_s3, (s32)(Rand_ZeroOne() * 70.0f * temp_f22) + 70); } } else { @@ -328,12 +327,12 @@ void func_80B03688(ObjSnowball* this, GlobalContext* globalCtx) { spB8.y = (Rand_ZeroOne() * 20.0f) + this->actor.home.pos.y; spB8.z = (spB8.z * temp_f20) + this->actor.home.pos.z; - EffectSsIceSmoke_Spawn(globalCtx, &spB8, &spAC, &spA0, (s32)(Rand_ZeroOne() * 140.0f * temp_f22) + 100); + EffectSsIceSmoke_Spawn(play, &spB8, &spAC, &spA0, (s32)(Rand_ZeroOne() * 140.0f * temp_f22) + 100); } } } -void func_80B03A80(GlobalContext* globalCtx, f32 arg1, Vec3f* arg2) { +void func_80B03A80(PlayState* play, f32 arg1, Vec3f* arg2) { f32 temp_f30 = sqrtf(arg1); Vec3f spD8; Vec3f spCC; @@ -389,7 +388,7 @@ void func_80B03A80(GlobalContext* globalCtx, f32 arg1, Vec3f* arg2) { phi_s0 = 0x40; } - EffectSsKakera_Spawn(globalCtx, &spD8, &spCC, &spD8, phi_s2, phi_s0, 30, 0, 0, + EffectSsKakera_Spawn(play, &spD8, &spCC, &spD8, phi_s2, phi_s0, 30, 0, 0, ((Rand_ZeroOne() * 15.0f) + 25.0f) * arg1, phi_s3, 0, 0x36, -1, OBJECT_GOROIWA, temp_s1); spD8.x += (Rand_ZeroOne() * 80.0f) - 40.0f; @@ -398,12 +397,12 @@ void func_80B03A80(GlobalContext* globalCtx, f32 arg1, Vec3f* arg2) { phi_s0 = (s32)(Rand_ZeroOne() * 60.0f * temp_f30) + 60; - func_800B0E48(globalCtx, &spD8, &gZeroVec3f, &D_80B04FBC, &D_80B04FB4, &D_80B04FB8, phi_s0, + func_800B0E48(play, &spD8, &gZeroVec3f, &D_80B04FBC, &D_80B04FB4, &D_80B04FB8, phi_s0, (s32)(Rand_ZeroOne() * 30.0f * temp_f30) + 60); } } -void func_80B03E2C(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B03E2C(ObjSnowball* this, PlayState* play) { ObjSnowballStruct* ptr; s32 i; @@ -432,23 +431,23 @@ void func_80B03E2C(ObjSnowball* this, GlobalContext* globalCtx) { } } -void func_80B03FF8(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B03FF8(ObjSnowball* this, PlayState* play) { s32 pad; s16 rotY = this->actor.home.rot.y; ObjSnowballStruct2* sp18 = &D_80B04F84[rotY]; if (sp18->unk_04 != NULL) { - sp18->unk_04(this, globalCtx); + sp18->unk_04(this, play); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); if (rotY == 5) { - Flags_SetSwitch(globalCtx, OBJSNOWBALL_GET_3F(&this->actor)); + Flags_SetSwitch(play, OBJSNOWBALL_GET_3F(&this->actor)); } } -void ObjSnowball_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball_Init(Actor* thisx, PlayState* play) { ObjSnowball* this = THIS; Sphere16* sphere; ColliderJntSphElementDim* elementDim; @@ -485,8 +484,8 @@ void ObjSnowball_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 3; } - 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->actor.colChkInfo.mass = MASS_HEAVY; sphere = &this->collider.elements[0].dim.worldSphere; @@ -501,31 +500,31 @@ void ObjSnowball_Init(Actor* thisx, GlobalContext* globalCtx) { sp48.z = this->actor.home.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp44, &this->actor, &sp48); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp44, &this->actor, &sp48); if (this->actor.floorHeight < (this->actor.home.pos.y - 10.0f)) { this->actor.floorPoly = NULL; } else { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 13.0f); } - func_80B04338(this, globalCtx); + func_80B04338(this, play); - if ((sp40 == 5) && Flags_GetSwitch(globalCtx, OBJSNOWBALL_GET_3F(&this->actor))) { + if ((sp40 == 5) && Flags_GetSwitch(play, OBJSNOWBALL_GET_3F(&this->actor))) { Actor_MarkForDeath(&this->actor); } } -void ObjSnowball_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball_Destroy(Actor* thisx, PlayState* play) { ObjSnowball* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } -void func_80B04338(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04338(ObjSnowball* this, PlayState* play) { this->actionFunc = func_80B04350; } -void func_80B04350(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04350(ObjSnowball* this, PlayState* play) { s32 pad; s32 flag = (this->collider.base.acFlags & AC_HIT) != 0; @@ -551,14 +550,14 @@ void func_80B04350(ObjSnowball* this, GlobalContext* globalCtx) { } if (this->actor.cutscene < 0) { - func_80B03FF8(this, globalCtx); + func_80B03FF8(this, play); if (this->unk_20A == 0) { - func_80B04608(this, globalCtx); + func_80B04608(this, play); } else { - func_80B046E4(this, globalCtx); + func_80B046E4(this, play); } } else { - func_80B04540(this, globalCtx); + func_80B04540(this, play); } return; } @@ -566,7 +565,7 @@ void func_80B04350(ObjSnowball* this, GlobalContext* globalCtx) { if (flag && !(this->collider.elements->info.acHitInfo->toucher.dmgFlags & (0x10000 | 0x2000 | 0x1000 | 0x800 | 0x20))) { if (this->unk_209 <= 0) { - func_80B02EE4(this, globalCtx); + func_80B02EE4(this, play); if (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x1000000) { this->unk_209 = 25; } else { @@ -580,39 +579,39 @@ void func_80B04350(ObjSnowball* this, GlobalContext* globalCtx) { this->unk_209--; } - 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_80B04540(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04540(ObjSnowball* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actor.cutscene); this->actionFunc = func_80B0457C; } -void func_80B0457C(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B0457C(ObjSnowball* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - func_80B03FF8(this, globalCtx); + func_80B03FF8(this, play); this->unk_20B = 1; if (this->unk_20A == 0) { - func_80B04608(this, globalCtx); + func_80B04608(this, play); } else { - func_80B046E4(this, globalCtx); + func_80B046E4(this, play); } } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void func_80B04608(ObjSnowball* this, GlobalContext* globalCtx) { - func_80B030F8(this, globalCtx); +void func_80B04608(ObjSnowball* this, PlayState* play) { + func_80B030F8(this, play); this->actor.draw = NULL; this->unk_208 = 50; this->actor.floorPoly = NULL; this->actionFunc = func_80B04648; } -void func_80B04648(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04648(ObjSnowball* this, PlayState* play) { this->unk_208--; if (this->unk_208 <= 0) { if (this->unk_20B != 0) { @@ -620,26 +619,26 @@ void func_80B04648(ObjSnowball* this, GlobalContext* globalCtx) { } if (this->actor.home.rot.y == 1) { - func_80B04B48(this, globalCtx); + func_80B04B48(this, play); } else { Actor_MarkForDeath(&this->actor); } } else if (this->unk_208 == 0x2D) { - func_80B03688(this, globalCtx); + func_80B03688(this, play); } } -void func_80B046E4(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B046E4(ObjSnowball* this, PlayState* play) { Vec3f sp44; s32 i; - func_80B03E2C(this, globalCtx); + func_80B03E2C(this, play); for (i = 0; i < ARRAY_COUNT(this->unk_1A8); i++) { sp44.x = this->unk_1A8[i].unk_00.x; sp44.y = this->unk_1A8[i].unk_00.y - (60.0f * this->unk_20C); sp44.z = this->unk_1A8[i].unk_00.z; - func_80B03A80(globalCtx, this->unk_20C, &sp44); + func_80B03A80(play, this->unk_20C, &sp44); } this->actor.draw = func_80B04D34; @@ -648,7 +647,7 @@ void func_80B046E4(ObjSnowball* this, GlobalContext* globalCtx) { this->actionFunc = func_80B047C0; } -void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B047C0(ObjSnowball* this, PlayState* play) { static Vec3f D_80B04FD8 = { 0.0f, 1.0f, 0.0f }; static Vec3f D_80B04FE4 = { 0.0f, 0.0f, 1.0f }; s32 pad; @@ -684,7 +683,7 @@ void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx) { sp9C.y = ptr->unk_00.y + 25.0f; sp9C.z = ptr->unk_00.z; - ptr->unk_18 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &ptr->unk_28, &sp98, &this->actor, &sp9C); + ptr->unk_18 = BgCheck_EntityRaycastFloor5(&play->colCtx, &ptr->unk_28, &sp98, &this->actor, &sp9C); if (ptr->unk_10 <= 0.0f) { Matrix_RotateZYX(ptr->unk_1C.x, ptr->unk_1C.y, ptr->unk_1C.z, MTXMODE_NEW); @@ -710,7 +709,7 @@ void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx) { sp70.x = ptr->unk_00.x; sp70.y = ptr->unk_00.y - sp84; sp70.z = ptr->unk_00.z; - func_80B03A80(globalCtx, this->unk_20C, &sp70); + func_80B03A80(play, this->unk_20C, &sp70); } } } @@ -724,7 +723,7 @@ void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx) { } if (this->actor.home.rot.y == 1) { - func_80B04B48(this, globalCtx); + func_80B04B48(this, play); } else { Actor_MarkForDeath(&this->actor); } @@ -743,25 +742,25 @@ void func_80B047C0(ObjSnowball* this, GlobalContext* globalCtx) { } } -void func_80B04B48(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04B48(ObjSnowball* this, PlayState* play) { this->actionFunc = func_80B04B60; } -void func_80B04B60(ObjSnowball* this, GlobalContext* globalCtx) { +void func_80B04B60(ObjSnowball* this, PlayState* play) { } -void ObjSnowball_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball_Update(Actor* thisx, PlayState* play) { s32 pad; ObjSnowball* this = THIS; s32 sp24 = false; if (this->actor.home.rot.y == 1) { if (this->unk_211 != 0) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_10; this->unk_211 = 0; } - } else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags |= ACTOR_FLAG_10; this->unk_211 = 1; } else if (this->actor.isTargeted) { @@ -769,10 +768,10 @@ void ObjSnowball_Update(Actor* thisx, GlobalContext* globalCtx) { } } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (sp24 && (this->actionFunc == func_80B04350)) { - func_800B8614(&this->actor, globalCtx, 100.0f); + func_800B8614(&this->actor, play, 100.0f); } if ((this->actor.floorPoly != NULL) && (this->actor.projectedPos.z < 920.0f)) { @@ -790,13 +789,13 @@ void ObjSnowball_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjSnowball_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball_Draw(Actor* thisx, PlayState* play) { ObjSnowball* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_goroiwa_DL_008B90); + Gfx_DrawDListOpa(play, object_goroiwa_DL_008B90); } -void func_80B04D34(Actor* thisx, GlobalContext* globalCtx) { +void func_80B04D34(Actor* thisx, PlayState* play) { s32 pad; ObjSnowball* this = THIS; ObjSnowballStruct* ptr; @@ -814,12 +813,12 @@ void func_80B04D34(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &sp80); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, object_goroiwa_DL_0082D0); + Gfx_DrawDListOpa(play, object_goroiwa_DL_0082D0); if ((ptr->unk_28 != NULL) && (ptr->unk_2C > 0)) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C448(globalCtx->state.gfxCtx); + func_8012C448(play->state.gfxCtx); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); @@ -829,11 +828,11 @@ void func_80B04D34(Actor* thisx, GlobalContext* globalCtx) { Matrix_Put(&sp88); Matrix_Scale(this->actor.scale.x * 7.5f, 1.0f, this->actor.scale.z * 7.5f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } } diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h index c6bc03100e..0b2974d44b 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.h @@ -5,7 +5,7 @@ struct ObjSnowball; -typedef void (*ObjSnowballActionFunc)(struct ObjSnowball*, GlobalContext*); +typedef void (*ObjSnowballActionFunc)(struct ObjSnowball*, PlayState*); #define OBJSNOWBALL_GET_3F(thisx) ((thisx)->params & 0x3F) #define OBJSNOWBALL_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index 3737a5426b..72c96d25e6 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -11,20 +11,20 @@ #define THIS ((ObjSnowball2*)thisx) -void ObjSnowball2_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball2_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball2_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSnowball2_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSnowball2_Init(Actor* thisx, PlayState* play); +void ObjSnowball2_Destroy(Actor* thisx, PlayState* play); +void ObjSnowball2_Update(Actor* thisx, PlayState* play); +void ObjSnowball2_Draw(Actor* thisx, PlayState* play); void func_80B38E20(ObjSnowball2* this); void func_80B39C78(ObjSnowball2* this); -void func_80B39C9C(ObjSnowball2* this, GlobalContext* globalCtx); +void func_80B39C9C(ObjSnowball2* this, PlayState* play); void func_80B39F60(ObjSnowball2* this); -void func_80B39FA8(ObjSnowball2* this, GlobalContext* globalCtx); +void func_80B39FA8(ObjSnowball2* this, PlayState* play); void func_80B3A0D8(ObjSnowball2* this); -void func_80B3A13C(ObjSnowball2* this, GlobalContext* globalCtx); +void func_80B3A13C(ObjSnowball2* this, PlayState* play); void func_80B3A498(ObjSnowball2* this); -void func_80B3A500(ObjSnowball2* this, GlobalContext* globalCtx); +void func_80B3A500(ObjSnowball2* this, PlayState* play); const ActorInit Obj_Snowball2_InitVars = { ACTOR_OBJ_SNOWBALL2, @@ -86,20 +86,19 @@ void func_80B38E20(ObjSnowball2* this) { Collider_UpdateSpheres(0, &this->collider); } -void func_80B38E88(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B38E88(ObjSnowball2* this, PlayState* play) { s32 temp_v0; if (this->unk_1AE == 0) { temp_v0 = func_800A8150(ENOBJSNOWBALL2_GET_3F(&this->actor)); if (temp_v0 >= 0) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, - (ENOBJSNOWBALL2_GET_7F00(&this->actor) << 8) | temp_v0); + Item_DropCollectible(play, &this->actor.world.pos, (ENOBJSNOWBALL2_GET_7F00(&this->actor) << 8) | temp_v0); this->unk_1AE = 1; } } } -void func_80B38EFC(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B38EFC(ObjSnowball2* this, PlayState* play) { s32 pad; s32 i; Vec3f spA4; @@ -120,12 +119,12 @@ void func_80B38EFC(ObjSnowball2* this, GlobalContext* globalCtx) { spA4.y = sp98.y * -0.06f; spA4.z = sp98.z * -0.06f; - func_800B0E48(globalCtx, &sp8C, &sp98, &spA4, &D_80B3A914, &D_80B3A918, (s32)(Rand_ZeroOne() * 40.0f) + 10, + func_800B0E48(play, &sp8C, &sp98, &spA4, &D_80B3A914, &D_80B3A918, (s32)(Rand_ZeroOne() * 40.0f) + 10, (s32)(Rand_ZeroOne() * 30.0f) + 10); } } -void func_80B39108(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B39108(ObjSnowball2* this, PlayState* play) { s32 phi_s5; s16 phi_s1; s32 phi_v0; @@ -177,20 +176,20 @@ void func_80B39108(ObjSnowball2* this, GlobalContext* globalCtx) { phi_v0 = 0; } - EffectSsKakera_Spawn(globalCtx, &spD0, &spDC, &spD0, -300, phi_s1, 30, 0, 0, (temp >> 0x1D) + 8, phi_v0, 0, 50, - -1, OBJECT_GOROIWA, D_80B3A91C[i & 3]); + EffectSsKakera_Spawn(play, &spD0, &spDC, &spD0, -300, phi_s1, 30, 0, 0, (temp >> 0x1D) + 8, phi_v0, 0, 50, -1, + OBJECT_GOROIWA, D_80B3A91C[i & 3]); spD0.x += (Rand_ZeroOne() - 0.5f) * 40.0f; spD0.y += (Rand_ZeroOne() - 0.3f) * 45.0f; spD0.z += (Rand_ZeroOne() - 0.5f) * 40.0f; - func_800B0E48(globalCtx, &spD0, &gZeroVec3f, &D_80B3A92C, &D_80B3A914, &D_80B3A918, + func_800B0E48(play, &spD0, &gZeroVec3f, &D_80B3A92C, &D_80B3A914, &D_80B3A918, (s32)(Rand_ZeroOne() * 70.0f) + 10, (s32)(Rand_ZeroOne() * 100.0f) + 10); } spD0.y = (temp_f2 * temp_f20) + spC8; } -void func_80B39470(Actor* thisx, GlobalContext* globalCtx) { +void func_80B39470(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; Vec3f sp58; s32 phi_s0; @@ -201,29 +200,29 @@ void func_80B39470(Actor* thisx, GlobalContext* globalCtx) { for (phi_s0 = 0, i = 0; i < 5; i++, phi_s0 += (0x10000 / 5)) { sp58.x = (Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.x; sp58.z = (Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + phi_s0) * 15.0f) + this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 200); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 200); } sp58.x = this->actor.world.pos.x; sp58.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(globalCtx, &sp58, NULL, NULL, 0, 300); + EffectSsGSplash_Spawn(play, &sp58, NULL, NULL, 0, 300); } -void func_80B395C4(GlobalContext* this, Vec3f* arg1) { - EffectSsGRipple_Spawn(this, arg1, 200, 700, 0); +void func_80B395C4(PlayState* play, Vec3f* arg1) { + EffectSsGRipple_Spawn(play, arg1, 200, 700, 0); } -void func_80B395EC(Actor* thisx, GlobalContext* globalCtx) { +void func_80B395EC(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; Vec3f sp18; sp18.x = this->actor.world.pos.x; sp18.y = this->actor.world.pos.y + this->actor.depthInWater; sp18.z = this->actor.world.pos.z; - func_80B395C4(globalCtx, &sp18); + func_80B395C4(play, &sp18); } -void func_80B39638(GlobalContext* globalCtx, Vec3f* arg1) { +void func_80B39638(PlayState* play, Vec3f* arg1) { static s16 D_80B3A938 = 0; f32 temp_f20; f32 temp_f22; @@ -255,20 +254,20 @@ void func_80B39638(GlobalContext* globalCtx, Vec3f* arg1) { sp80.y = sp8C.y * -0.025f; sp80.z = sp8C.z * -0.02f; - EffectSsIceSmoke_Spawn(globalCtx, &sp98, &sp8C, &sp80, (s32)(Rand_ZeroOne() * 30.0f) + 68); + EffectSsIceSmoke_Spawn(play, &sp98, &sp8C, &sp80, (s32)(Rand_ZeroOne() * 30.0f) + 68); } } -void func_80B39834(Actor* thisx, GlobalContext* globalCtx) { +void func_80B39834(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; s32 i; for (i = 0; i < 3; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 20.0f, 30.0f, (Rand_ZeroOne() * 0.11f) + 0.03f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 20.0f, 30.0f, (Rand_ZeroOne() * 0.11f) + 0.03f); } } -void func_80B39908(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B39908(ObjSnowball2* this, PlayState* play) { Vec3f spAC; Vec3f spA0; Vec3f sp94; @@ -290,20 +289,20 @@ void func_80B39908(ObjSnowball2* this, GlobalContext* globalCtx) { spAC.y = spA0.y * -0.06f; spAC.z = spA0.z * -0.06f; - func_800B0E48(globalCtx, &sp94, &spA0, &spAC, &D_80B3A914, &D_80B3A918, (s32)(Rand_ZeroOne() * 40.0f) + 10, + func_800B0E48(play, &sp94, &spA0, &spAC, &D_80B3A914, &D_80B3A918, (s32)(Rand_ZeroOne() * 40.0f) + 10, (s32)(Rand_ZeroOne() * 30.0f) + 10); } } } -void func_80B39B28(ObjSnowball2* this, GlobalContext* globalCtx) { - if ((this->unk_1AE == 0) && (globalCtx->roomCtx.currRoom.num != this->unk_1AF)) { +void func_80B39B28(ObjSnowball2* this, PlayState* play) { + if ((this->unk_1AE == 0) && (play->roomCtx.currRoom.num != this->unk_1AF)) { this->unk_1AE = 1; } } -void func_80B39B5C(ObjSnowball2* this, GlobalContext* globalCtx) { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_SMALL_SNOWBALL_BROKEN); +void func_80B39B5C(ObjSnowball2* this, PlayState* play) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_SMALL_SNOWBALL_BROKEN); } static InitChainEntry sInitChain[] = { @@ -312,27 +311,27 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 25, ICHAIN_STOP), }; -void ObjSnowball2_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball2_Init(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitJntSph(globalCtx, &this->collider); + Collider_InitJntSph(play, &this->collider); this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = Rand_Next() >> 0x10; ActorShape_Init(&this->actor.shape, 200.0f, NULL, 12.5f); this->actor.shape.shadowAlpha = 130; - Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); func_80B38E20(this); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_1AF = this->actor.room; func_80B39C78(this); } -void ObjSnowball2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball2_Destroy(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; - Collider_DestroyJntSph(globalCtx, &this->collider); + Collider_DestroyJntSph(play, &this->collider); } void func_80B39C78(ObjSnowball2* this) { @@ -341,7 +340,7 @@ void func_80B39C78(ObjSnowball2* this) { this->actionFunc = func_80B39C9C; } -void func_80B39C9C(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B39C9C(ObjSnowball2* this, PlayState* play) { s32 pad; s32 sp38 = (this->collider.base.acFlags & AC_HIT) != 0; s32 pad2; @@ -350,47 +349,46 @@ void func_80B39C9C(ObjSnowball2* this, GlobalContext* globalCtx) { this->collider.base.acFlags &= ~AC_HIT; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.room = -1; this->actor.flags |= ACTOR_FLAG_10; if (func_800A817C(ENOBJSNOWBALL2_GET_3F(&this->actor))) { - func_80B38E88(this, globalCtx); + func_80B38E88(this, play); } - func_80B38EFC(this, globalCtx); - func_800B8E58(GET_PLAYER(globalCtx), NA_SE_PL_PULL_UP_SNOWBALL); + func_80B38EFC(this, play); + func_800B8E58(GET_PLAYER(play), NA_SE_PL_PULL_UP_SNOWBALL); func_80B39F60(this); } else if ((this->actor.bgCheckFlags & 0x20) && ((this->actor.shape.yOffset * this->actor.scale.y) < this->actor.depthInWater)) { func_80B3A498(this); } else if (sp38 && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x0583FFBC)) { - func_80B38E88(this, globalCtx); - func_80B39108(this, globalCtx); - func_80B39B5C(this, globalCtx); + func_80B38E88(this, play); + func_80B39108(this, play); + func_80B39B5C(this, play); Actor_MarkForDeath(&this->actor); return; } else { if (sp38 && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 2)) { - func_80B39908(this, globalCtx); + func_80B39908(this, play); } if (this->unk_1AD == 0) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); - if ((this->actor.bgCheckFlags & 1) && - (DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId) == NULL)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + if ((this->actor.bgCheckFlags & 1) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_1AD = 1; this->actor.flags &= ~ACTOR_FLAG_10; } } if (this->actor.xzDistToPlayer < 800.0f) { - 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) { - if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, GET_PLAYER(globalCtx)->actor.world.rot.y)) >= + if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, GET_PLAYER(play)->actor.world.rot.y)) >= 0x5556) { - Actor_PickUp(&this->actor, globalCtx, GI_NONE, 36.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -405,32 +403,32 @@ void func_80B39F60(ObjSnowball2* this) { this->actionFunc = func_80B39FA8; } -void func_80B39FA8(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B39FA8(ObjSnowball2* this, PlayState* play) { s32 pad; Vec3f sp30; s32 sp2C; - func_80B39B28(this, globalCtx); + func_80B39B28(this, play); if (this->unk_1AC > 0) { this->unk_1AC--; - func_80B38EFC(this, globalCtx); + func_80B38EFC(this, play); } - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; this->actor.speedXZ *= 3.8f; this->actor.velocity.y *= 0.4f; this->actor.gravity = -2.8f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); func_80B3A0D8(this); } else { sp30.x = this->actor.world.pos.x; sp30.y = this->actor.world.pos.y + 20.0f; sp30.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &sp30); } } @@ -442,7 +440,7 @@ void func_80B3A0D8(ObjSnowball2* this) { this->actionFunc = func_80B3A13C; } -void func_80B3A13C(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B3A13C(ObjSnowball2* this, PlayState* play) { s32 pad; s32 sp38 = (this->collider.base.atFlags & AT_HIT) != 0; s32 sp34 = (this->collider.base.ocFlags1 & OC1_HIT) != 0; @@ -460,12 +458,12 @@ void func_80B3A13C(ObjSnowball2* this, GlobalContext* globalCtx) { this->unk_1AC--; } - func_80B39B28(this, globalCtx); + func_80B39B28(this, play); if ((((this->actor.bgCheckFlags & 9) || sp38) && !(this->actor.bgCheckFlags & 0x20)) || (this->unk_1AC <= 0)) { - func_80B38E88(this, globalCtx); - func_80B39108(this, globalCtx); - func_80B39B5C(this, globalCtx); + func_80B38E88(this, play); + func_80B39108(this, play); + func_80B39B5C(this, play); Actor_MarkForDeath(&this->actor); return; } @@ -474,18 +472,18 @@ void func_80B3A13C(ObjSnowball2* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x60) { if ((this->actor.bgCheckFlags & 0x40) || (this->actor.speedXZ > 3.0f)) { if (this->actor.depthInWater < (1200.0f * this->actor.scale.y)) { - func_80B39470(&this->actor, globalCtx); - func_80B395EC(&this->actor, globalCtx); + func_80B39470(&this->actor, play); + func_80B395EC(&this->actor, play); } if (this->actor.bgCheckFlags & 0x40) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); } - } else if ((((globalCtx->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) && + } else if ((((play->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) && (this->actor.depthInWater < (1200.0f * this->actor.scale.y))) { - func_80B395EC(&this->actor, globalCtx); + func_80B395EC(&this->actor, play); } - func_80B39834(&this->actor, globalCtx); + func_80B39834(&this->actor, play); this->unk_1A8 >>= 1; this->unk_1AA >>= 1; @@ -509,15 +507,15 @@ void func_80B3A13C(ObjSnowball2* this, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); this->actor.shape.rot.x += this->unk_1A8; this->actor.shape.rot.y += this->unk_1AA; func_80B38E20(this); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (sp30) { func_80B3A498(this); } else { - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -533,7 +531,7 @@ void func_80B3A498(ObjSnowball2* this) { this->actionFunc = func_80B3A500; } -void func_80B3A500(ObjSnowball2* this, GlobalContext* globalCtx) { +void func_80B3A500(ObjSnowball2* this, PlayState* play) { f32 phi_f0; s32 pad; f32 temp_f14 = this->actor.home.pos.y - this->actor.world.pos.y; @@ -567,8 +565,8 @@ void func_80B3A500(ObjSnowball2* this, GlobalContext* globalCtx) { this->actor.velocity.y += this->actor.gravity; this->actor.world.pos.y += this->actor.velocity.y; - if (((globalCtx->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) { - func_80B395C4(globalCtx, &this->actor.home.pos); + if (((play->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) { + func_80B395C4(play, &this->actor.home.pos); } if (this->unk_1AC <= 0) { @@ -583,24 +581,24 @@ void func_80B3A500(ObjSnowball2* this, GlobalContext* globalCtx) { this->actor.scale.z = this->actor.scale.x; if ((this->unk_1AC >= 6) && (temp_f14 < temp_f12)) { - func_80B39638(globalCtx, &this->actor.home.pos); + func_80B39638(play, &this->actor.home.pos); } if (this->unk_1AC == 10) { - func_80B38E88(this, globalCtx); + func_80B38E88(this, play); } func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); } else { func_80B38E20(this); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void ObjSnowball2_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball2_Update(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->actor.projectedPos.z < 460.0f) { if (this->actor.projectedPos.z > 200.0f) { @@ -617,8 +615,8 @@ void ObjSnowball2_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjSnowball2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSnowball2_Draw(Actor* thisx, PlayState* play) { ObjSnowball2* this = THIS; - Gfx_DrawDListOpa(globalCtx, object_goroiwa_DL_008B90); + Gfx_DrawDListOpa(play, object_goroiwa_DL_008B90); } diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.h b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.h index 120358a805..2b88a6b2c8 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.h +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.h @@ -5,7 +5,7 @@ struct ObjSnowball2; -typedef void (*ObjSnowball2ActionFunc)(struct ObjSnowball2*, GlobalContext*); +typedef void (*ObjSnowball2ActionFunc)(struct ObjSnowball2*, PlayState*); #define ENOBJSNOWBALL2_GET_3F(thisx) ((thisx)->params & 0x3F) #define ENOBJSNOWBALL2_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c index 231dd99f34..221ae3acc5 100644 --- a/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c +++ b/src/overlays/actors/ovl_Obj_Sound/z_obj_sound.c @@ -10,9 +10,9 @@ #define THIS ((ObjSound*)thisx) -void ObjSound_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSound_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSound_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjSound_Init(Actor* thisx, PlayState* play); +void ObjSound_Destroy(Actor* thisx, PlayState* play); +void ObjSound_Update(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Sound_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 37ceb72687..7001451580 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -11,17 +11,17 @@ #define THIS ((ObjSpidertent*)thisx) -void ObjSpidertent_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSpidertent_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSpidertent_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSpidertent_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSpidertent_Init(Actor* thisx, PlayState* play); +void ObjSpidertent_Destroy(Actor* thisx, PlayState* play); +void ObjSpidertent_Update(Actor* thisx, PlayState* play); +void ObjSpidertent_Draw(Actor* thisx, PlayState* play); void func_80B307E0(ObjSpidertent* this); -void func_80B30808(ObjSpidertent* this, GlobalContext* globalCtx); +void func_80B30808(ObjSpidertent* this, PlayState* play); void func_80B30A2C(ObjSpidertent* this); -void func_80B30A4C(ObjSpidertent* this, GlobalContext* globalCtx); +void func_80B30A4C(ObjSpidertent* this, PlayState* play); void func_80B30AD4(ObjSpidertent* this); -void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx); +void func_80B30AF8(ObjSpidertent* this, PlayState* play); const ActorInit Obj_Spidertent_InitVars = { ACTOR_OBJ_SPIDERTENT, @@ -446,7 +446,7 @@ s32 func_80B2FC98(TriNorm* triNorm, Vec3f* arg1) { } } -void func_80B300F4(ObjSpidertent* thisx, GlobalContext* globalCtx, TriNorm* triNorm, Vec3f* arg3, f32 arg4, s32 arg5) { +void func_80B300F4(ObjSpidertent* thisx, PlayState* play, TriNorm* triNorm, Vec3f* arg3, f32 arg4, s32 arg5) { ObjSpidertent* this = THIS; ObjSpidertentStruct* spE0 = &D_80B31350[OBJSPIDERTENT_GET_1(&this->dyna.actor)]; f32 temp_f24; @@ -499,8 +499,8 @@ void func_80B300F4(ObjSpidertent* thisx, GlobalContext* globalCtx, TriNorm* triN spB8.y = sp80->unk_08 * sp94.y; spB8.z = sp80->unk_08 * sp94.z; - EffectSsDeadDb_Spawn(globalCtx, &spC4, &spB8, &gZeroVec3f, &sp80->unk_10, &sp80->unk_14, sp80->unk_0C, - 0, sp80->unk_0E); + EffectSsDeadDb_Spawn(play, &spC4, &spB8, &gZeroVec3f, &sp80->unk_10, &sp80->unk_14, sp80->unk_0C, 0, + sp80->unk_0E); } phi_f22 += temp_f24; @@ -522,8 +522,8 @@ void func_80B30410(ObjSpidertent* this, Vec3f* arg1) { this->unk_3C0 = 0; } -s32 func_80B30480(ObjSpidertent* this, GlobalContext* globalCtx, Vec3f* arg2) { - Player* player = GET_PLAYER(globalCtx); +s32 func_80B30480(ObjSpidertent* this, PlayState* play, Vec3f* arg2) { + Player* player = GET_PLAYER(play); TriNorm* triNorm; s32 i; Vec3f sp58; @@ -549,7 +549,7 @@ s32 func_80B30480(ObjSpidertent* this, GlobalContext* globalCtx, Vec3f* arg2) { return false; } -void ObjSpidertent_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpidertent_Init(Actor* thisx, PlayState* play) { s32 pad; ObjSpidertent* this = THIS; s32 temp_s1 = OBJSPIDERTENT_GET_1(&this->dyna.actor); @@ -562,15 +562,15 @@ void ObjSpidertent_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - Collider_InitTris(globalCtx, &this->collider); + Collider_InitTris(play, &this->collider); - if (Flags_GetSwitch(globalCtx, OBJSPIDERTENT_GET_7F00(&this->dyna.actor))) { + if (Flags_GetSwitch(play, OBJSPIDERTENT_GET_7F00(&this->dyna.actor))) { Actor_MarkForDeath(&this->dyna.actor); return; } - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, ptr->unk_04); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, D_80B31350[temp_s1].unk_08, this->colliderElements); + DynaPolyActor_LoadMesh(play, &this->dyna, ptr->unk_04); + Collider_SetTris(play, &this->collider, &this->dyna.actor, D_80B31350[temp_s1].unk_08, this->colliderElements); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); @@ -596,11 +596,11 @@ void ObjSpidertent_Init(Actor* thisx, GlobalContext* globalCtx) { func_80B307E0(this); } -void ObjSpidertent_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpidertent_Destroy(Actor* thisx, PlayState* play) { ObjSpidertent* this = THIS; - 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_80B307E0(ObjSpidertent* this) { @@ -611,7 +611,7 @@ void func_80B307E0(ObjSpidertent* this) { this->actionFunc = func_80B30808; } -void func_80B30808(ObjSpidertent* this, GlobalContext* globalCtx) { +void func_80B30808(ObjSpidertent* this, PlayState* play) { s32 phi_s4; s32 i; ObjSpidertentStruct* ptr2 = &D_80B31350[OBJSPIDERTENT_GET_1(&this->dyna.actor)]; @@ -625,7 +625,7 @@ void func_80B30808(ObjSpidertent* this, GlobalContext* globalCtx) { s32 phi_s0 = false; if (this->collider.base.acFlags & AC_HIT) { - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); this->collider.base.acFlags &= ~AC_HIT; phi_s1 = 0; @@ -658,7 +658,7 @@ void func_80B30808(ObjSpidertent* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp70, &this->dyna.actor.world.pos); } phi_s0 = true; - } else if ((this->dyna.actor.xzDistToPlayer < ptr2->unk_24) && func_80B30480(this, globalCtx, &sp70)) { + } else if ((this->dyna.actor.xzDistToPlayer < ptr2->unk_24) && func_80B30480(this, play, &sp70)) { phi_s0 = true; } @@ -666,7 +666,7 @@ void func_80B30808(ObjSpidertent* this, GlobalContext* globalCtx) { func_80B30410(this, &sp70); func_80B30A2C(this); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -675,13 +675,13 @@ void func_80B30A2C(ObjSpidertent* this) { this->actionFunc = func_80B30A4C; } -void func_80B30A4C(ObjSpidertent* this, GlobalContext* globalCtx) { +void func_80B30A4C(ObjSpidertent* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); if (this->dyna.actor.cutscene >= 0) { - func_800B7298(globalCtx, &this->dyna.actor, 1); + func_800B7298(play, &this->dyna.actor, 1); } - Flags_SetSwitch(globalCtx, OBJSPIDERTENT_GET_7F00(&this->dyna.actor)); + Flags_SetSwitch(play, OBJSPIDERTENT_GET_7F00(&this->dyna.actor)); func_80B30AD4(this); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); @@ -696,7 +696,7 @@ void func_80B30AD4(ObjSpidertent* this) { } #ifdef NON_MATCHING -void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx) { +void func_80B30AF8(ObjSpidertent* this, PlayState* play) { ObjSpidertentStruct* temp_s0 = &D_80B31350[OBJSPIDERTENT_GET_1(&this->dyna.actor)]; TriNorm* triNorm; s32 i; @@ -759,7 +759,7 @@ void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx) { this->unk_3C1--; if (this->unk_3C1 == 40) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->unk_3C1 >= 0x20) { @@ -769,7 +769,7 @@ void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_EXTINCT); this->unk_3C7 = Rand_S16Offset(2, 2); } else { - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 11, NA_SE_EN_EXTINCT); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 11, NA_SE_EN_EXTINCT); this->unk_3C7 = Rand_S16Offset(2, 4); } @@ -786,7 +786,7 @@ void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx) { for (j = 0; j < ARRAY_COUNT(this->unk_3B0); j++) { if (!(this->unk_3B0[j] < 5.0f) && !(this->unk_3C0 & (1 << j)) && func_80B2FB94(&this->unk_3A4, this->unk_3B0[j], triNorm, &sp60, &sp5C)) { - func_80B300F4(this, globalCtx, triNorm, &sp60, sp5C, j); + func_80B300F4(this, play, triNorm, &sp60, sp5C, j); } } } @@ -799,27 +799,27 @@ void func_80B30AF8(ObjSpidertent* this, GlobalContext* globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spidertent/func_80B30AF8.s") #endif -void ObjSpidertent_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpidertent_Update(Actor* thisx, PlayState* play) { ObjSpidertent* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjSpidertent_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpidertent_Draw(Actor* thisx, PlayState* play) { ObjSpidertent* this = THIS; s32 params = OBJSPIDERTENT_GET_1(&this->dyna.actor); s32 temp_f18 = this->unk_3C5 * (29.0f / 51); Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_XLU_DISP; gSPDisplayList(gfx++, &sSetupDL[6 * 25]); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(gfx++, 0, 0xFF, this->unk_3C2, this->unk_3C3, this->unk_3C4, temp_f18); gSPDisplayList(gfx++, D_80B31350[params].unk_00); POLY_XLU_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h index 9289bd3656..86eeb54b52 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.h @@ -5,7 +5,7 @@ struct ObjSpidertent; -typedef void (*ObjSpidertentActionFunc)(struct ObjSpidertent*, GlobalContext*); +typedef void (*ObjSpidertentActionFunc)(struct ObjSpidertent*, PlayState*); #define OBJSPIDERTENT_GET_1(thisx) ((thisx)->params & 1) #define OBJSPIDERTENT_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 2b15ef0b6e..ea47348338 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -11,22 +11,22 @@ #define THIS ((ObjSpinyroll*)thisx) -void ObjSpinyroll_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSpinyroll_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSpinyroll_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjSpinyroll_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjSpinyroll_Init(Actor* thisx, PlayState* play); +void ObjSpinyroll_Destroy(Actor* thisx, PlayState* play); +void ObjSpinyroll_Update(Actor* thisx, PlayState* play); +void ObjSpinyroll_Draw(Actor* thisx, PlayState* play); void func_80A1E9C4(ObjSpinyroll* this); -void func_80A1E9E0(ObjSpinyroll* this, GlobalContext* globalCtx); -void func_80A1EA4C(ObjSpinyroll* this, GlobalContext* globalCtx); +void func_80A1E9E0(ObjSpinyroll* this, PlayState* play); +void func_80A1EA4C(ObjSpinyroll* this, PlayState* play); void func_80A1EAAC(ObjSpinyroll* this); -void func_80A1EAE0(ObjSpinyroll* this, GlobalContext* globalCtx); +void func_80A1EAE0(ObjSpinyroll* this, PlayState* play); void func_80A1EB40(ObjSpinyroll* this); -void func_80A1EB54(ObjSpinyroll* this, GlobalContext* globalCtx); +void func_80A1EB54(ObjSpinyroll* this, PlayState* play); void func_80A1EC24(ObjSpinyroll* this); -void func_80A1EC38(ObjSpinyroll* this, GlobalContext* globalCtx); +void func_80A1EC38(ObjSpinyroll* this, PlayState* play); void func_80A1ECC0(ObjSpinyroll* this); -void func_80A1ECD4(ObjSpinyroll* this, GlobalContext* globalCtx); +void func_80A1ECD4(ObjSpinyroll* this, PlayState* play); const ActorInit Obj_Spinyroll_InitVars = { ACTOR_OBJ_SPINYROLL, @@ -143,12 +143,12 @@ static InitChainEntry sInitChain[] = { s16 D_80A1F20C[] = { 0xFA0, -0xFA0 }; -void func_80A1DA50(GlobalContext* globalCtx, ObjSpinyroll* this, Vec3f* arg2, Vec3f* arg3) { +void func_80A1DA50(PlayState* play, ObjSpinyroll* this, Vec3f* arg2, Vec3f* arg3) { Vec3f sp1C; Math_Vec3f_Sum(arg2, arg3, &sp1C); Math_Vec3f_Scale(&sp1C, 0.5f); - EffectSsHitMark_SpawnFixedScale(globalCtx, 3, &sp1C); + EffectSsHitMark_SpawnFixedScale(play, 3, &sp1C); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); } @@ -278,8 +278,8 @@ void func_80A1DFA0(ObjSpinyroll* this) { } #ifdef NON_MATCHING -// globalCtx not in s reg, something with ptr->unk_F0 = temp_s1; line -s32 func_80A1E074(ObjSpinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s32 arg3) { +// play not in s reg, something with ptr->unk_F0 = temp_s1; line +s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { s32 i; s32 j; ObjSpinyrollStruct2* ptr = &this->unk_3A4; @@ -315,10 +315,10 @@ s32 func_80A1E074(ObjSpinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s32 spBC.x = temp_f22 + spC8.x; spBC.z = temp_f24 + spC8.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_00[j].unk_04, 1, 0, 0, 1, + if (BgCheck_EntityLineTest3(&play->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_00[j].unk_04, 1, 0, 0, 1, &temp_s1->unk_00[j].bgId, &this->dyna.actor, 0.0f)) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { - func_80A1DA50(globalCtx, this, &spC8, &spB0); + func_80A1DA50(play, this, &spC8, &spB0); } temp_f0 = Math3D_Vec3fDistSq(&spC8, &spB0); @@ -335,14 +335,14 @@ s32 func_80A1E074(ObjSpinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s32 return sp98; } #else -s32 func_80A1E074(ObjSpinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s32 arg3); +s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E074.s") #endif -s32 func_80A1E2D8(ObjSpinyroll* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80A1E2D8(ObjSpinyroll* this, PlayState* play, s32 arg2) { Vec3f sp1C; - if (func_80A1E074(this, globalCtx, &sp1C, arg2)) { + if (func_80A1E074(this, play, &sp1C, arg2)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -364,7 +364,7 @@ s32 func_80A1E394(CollisionContext* colCtx, f32* arg1, CollisionPoly** polyOut, } #ifdef NON_MATCHING -s32 func_80A1E3D8(ObjSpinyroll* this, GlobalContext* globalCtx, f32* arg2, s32 arg3) { +s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { f32 temp_f20; ObjSpinyrollStruct2* spC8; f32 phi_f22; @@ -404,13 +404,13 @@ s32 func_80A1E3D8(ObjSpinyroll* this, GlobalContext* globalCtx, f32* arg2, s32 a spAC.x += this->dyna.actor.world.pos.x; spAC.z += this->dyna.actor.world.pos.z; - if (spC0(&globalCtx->colCtx, &spA0.y, &temp_s0->unk_00[j].unk_04, &temp_s0->unk_00[j].bgId, &spAC, this)) { + if (spC0(&play->colCtx, &spA0.y, &temp_s0->unk_00[j].unk_04, &temp_s0->unk_00[j].bgId, &spAC, this)) { temp_f20 = fabsf(spA0.y - spAC.y); if (temp_f20 <= 24.0f) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { spA0.x = spAC.x; spA0.z = spAC.z; - func_80A1DA50(globalCtx, this, &spAC, &spA0); + func_80A1DA50(play, this, &spAC, &spA0); } if (temp_f20 < phi_f22) { @@ -426,29 +426,29 @@ s32 func_80A1E3D8(ObjSpinyroll* this, GlobalContext* globalCtx, f32* arg2, s32 a return sp84; } #else -s32 func_80A1E3D8(ObjSpinyroll* this, GlobalContext* globalCtx, f32* arg2, s32 arg3); +s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E3D8.s") #endif -s32 func_80A1E648(ObjSpinyroll* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80A1E648(ObjSpinyroll* this, PlayState* play, s32 arg2) { f32 sp1C; - if (func_80A1E3D8(this, globalCtx, &sp1C, arg2)) { + if (func_80A1E3D8(this, play, &sp1C, arg2)) { this->dyna.actor.world.pos.y += sp1C; return true; } return false; } -DynaPolyActor* func_80A1E694(ObjSpinyroll* this, GlobalContext* globalCtx) { +DynaPolyActor* func_80A1E694(ObjSpinyroll* this, PlayState* play) { if (this->unk_3A4.unk_F0 != NULL) { - return DynaPoly_GetActor(&globalCtx->colCtx, this->unk_3A4.unk_F0->unk_00[0].bgId); + return DynaPoly_GetActor(&play->colCtx, this->unk_3A4.unk_F0->unk_00[0].bgId); } return NULL; } -s32 func_80A1E6D4(ObjSpinyroll* this, GlobalContext* globalCtx) { - DynaPolyActor* temp_v0 = func_80A1E694(this, globalCtx); +s32 func_80A1E6D4(ObjSpinyroll* this, PlayState* play) { + DynaPolyActor* temp_v0 = func_80A1E694(this, play); if ((temp_v0 != NULL) && (Math3D_Vec3fDistSq(&temp_v0->actor.world.pos, &temp_v0->actor.prevPos) > SQ(0.01f))) { return true; @@ -456,7 +456,7 @@ s32 func_80A1E6D4(ObjSpinyroll* this, GlobalContext* globalCtx) { return false; } -void ObjSpinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpinyroll_Init(Actor* thisx, PlayState* play) { s32 pad; ObjSpinyroll* this = THIS; f32 sp44; @@ -480,10 +480,10 @@ void ObjSpinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.uncullZoneScale = 250.0f * sp44; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spinyroll_Colheader_000E68); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_spinyroll_Colheader_000E68); - Collider_InitTris(globalCtx, &this->collider); - Collider_SetTris(globalCtx, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); + Collider_InitTris(play, &this->collider); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); if (OBJSPINYROLL_GET_7F(&this->dyna.actor) == OBJSPINYROLL_GET_7F_7F) { func_80A1E9C4(this); @@ -494,7 +494,7 @@ void ObjSpinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A1DFA0(this); this->unk_4A4 = D_80A1F1C4[OBJSPINYROLL_GET_380(thisx)]; - path = &globalCtx->setupPathList[OBJSPINYROLL_GET_7F(&this->dyna.actor)]; + path = &play->setupPathList[OBJSPINYROLL_GET_7F(&this->dyna.actor)]; points = Lib_SegmentedToVirtual(path->points); sp34 = &points[0]; @@ -519,11 +519,11 @@ void ObjSpinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A1EAAC(this); } -void ObjSpinyroll_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpinyroll_Destroy(Actor* thisx, PlayState* play) { ObjSpinyroll* this = THIS; - 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_80A1E9C4(ObjSpinyroll* this) { @@ -531,7 +531,7 @@ void func_80A1E9C4(ObjSpinyroll* this) { this->actionFunc = func_80A1E9E0; } -void func_80A1E9E0(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1E9E0(ObjSpinyroll* this, PlayState* play) { this->unk_4DA += 0x6E; if (this->unk_4DA > 0xFA0) { this->unk_4DA = 0xFA0; @@ -544,7 +544,7 @@ void func_80A1EA10(ObjSpinyroll* this) { this->dyna.actor.speedXZ = 0.0f; } -void func_80A1EA4C(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1EA4C(ObjSpinyroll* this, PlayState* play) { if (Math_ScaledStepToS(&this->unk_4DA, 0, this->unk_4DE)) { if (this->unk_4E2 > 0) { this->unk_4E2--; @@ -561,7 +561,7 @@ void func_80A1EAAC(ObjSpinyroll* this) { this->dyna.actor.speedXZ = 0.0f; } -void func_80A1EAE0(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1EAE0(ObjSpinyroll* this, PlayState* play) { if (Math_ScaledStepToS(&this->unk_4DA, this->unk_4DC, 0x6E)) { if (!this->unk_49C) { func_80A1EB40(this); @@ -575,11 +575,11 @@ void func_80A1EB40(ObjSpinyroll* this) { this->actionFunc = func_80A1EB54; } -void func_80A1EB54(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1EB54(ObjSpinyroll* this, PlayState* play) { s32 sp24 = func_80A1DEB8(this); - if (func_80A1E2D8(this, globalCtx, 1)) { - if (func_80A1E694(this, globalCtx) != NULL) { + if (func_80A1E2D8(this, play, 1)) { + if (func_80A1E694(this, play) != NULL) { func_80A1DCCC(this); this->unk_4DE = 0x7D0; func_80A1EC24(this); @@ -601,12 +601,12 @@ void func_80A1EC24(ObjSpinyroll* this) { this->actionFunc = func_80A1EC38; } -void func_80A1EC38(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1EC38(ObjSpinyroll* this, PlayState* play) { s32 sp24 = true; Math_ScaledStepToS(&this->unk_4DA, 0, this->unk_4DE); - if (func_80A1E2D8(this, globalCtx, 0) && func_80A1E6D4(this, globalCtx)) { + if (func_80A1E2D8(this, play, 0) && func_80A1E6D4(this, play)) { sp24 = false; } @@ -620,10 +620,10 @@ void func_80A1ECC0(ObjSpinyroll* this) { this->actionFunc = func_80A1ECD4; } -void func_80A1ECD4(ObjSpinyroll* this, GlobalContext* globalCtx) { +void func_80A1ECD4(ObjSpinyroll* this, PlayState* play) { s32 sp24 = func_80A1DEB8(this); - if (func_80A1E648(this, globalCtx, 1)) { + if (func_80A1E648(this, play, 1)) { func_80A1DE84(this); func_80A1DCCC(this); this->unk_4DE = 0x7D0; @@ -636,8 +636,8 @@ void func_80A1ECD4(ObjSpinyroll* this, GlobalContext* globalCtx) { } } -void ObjSpinyroll_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjSpinyroll_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjSpinyroll* this = THIS; if (this->collider.base.atFlags & AT_HIT) { @@ -645,17 +645,17 @@ void ObjSpinyroll_Update(Actor* thisx, GlobalContext* globalCtx2) { func_80A1DCCC(this); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_4E0 += this->unk_4DA; func_80A1DC5C(this); func_80A1DB2C(thisx); - 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 ObjSpinyroll_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSpinyroll_Draw(Actor* thisx, PlayState* play) { ObjSpinyroll* this = THIS; f32 temp_f26; f32 temp_f28; @@ -667,9 +667,9 @@ void ObjSpinyroll_Draw(Actor* thisx, GlobalContext* globalCtx) { f32 temp_f30; Vec3s sp84; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); temp_f26 = Math_CosS(this->dyna.actor.shape.rot.y) * 120.0f; temp_f28 = Math_SinS(this->dyna.actor.shape.rot.y) * -120.0f; @@ -697,12 +697,12 @@ void ObjSpinyroll_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_SetTranslateRotateYXZ(phi_f22, temp_f30, phi_f24, &sp84); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_spinyroll_DL_000460); phi_f22 += temp_f26; phi_f24 += temp_f28; } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h index b35627b135..c265e7d659 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h @@ -5,7 +5,7 @@ struct ObjSpinyroll; -typedef void (*ObjSpinyrollActionFunc)(struct ObjSpinyroll*, GlobalContext*); +typedef void (*ObjSpinyrollActionFunc)(struct ObjSpinyroll*, PlayState*); typedef s32 (*ObjSpinyrollColFunc)(CollisionContext*, f32*, CollisionPoly**, s32*, Vec3f*, struct ObjSpinyroll*); #define OBJSPINYROLL_GET_7F(thisx) ((thisx)->params & 0x7F) 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 8b61f265b9..c527ff4fa8 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -13,10 +13,10 @@ #define COS_OF_5_PI_DIV_8 -0.38268343f -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_FloorSwitchUpInit(ObjSwitch* this); void ObjSwitch_FloorSwitchPushDownInit(ObjSwitch* this); @@ -36,32 +36,32 @@ void ObjSwitch_LargeFloorSwitchPushDownInit(ObjSwitch* this); void ObjSwitch_LargeFloorSwitchDownInit(ObjSwitch* this); void ObjSwitch_LargeFloorSwitchRiseUpInit(ObjSwitch* this); -void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_TryPlayCutscene(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_FloorSwitchUp(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_FloorSwitchPushDown(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_FloorSwitchDown(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_FloorSwitchRiseUp(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_EyeSwitchUnfrozen(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_EyeSwitchOpen(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_EyeSwitchClosing(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_EyeSwitchClosed(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_EyeSwitchOpening(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_CrystalSwitchOff(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_CrystalSwitchTurnOn(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_CrystalSwitchOn(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_CrystalSwitchTurnOff(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_LargeFloorSwitchUp(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_LargeFloorSwitchPushDown(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_LargeFloorSwitchDown(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_LargeFloorSwitchRiseUp(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, PlayState* play); +void ObjSwitch_TryPlayCutscene(ObjSwitch* this, PlayState* play); +void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play); +void ObjSwitch_FloorSwitchPushDown(ObjSwitch* this, PlayState* play); +void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play); +void ObjSwitch_FloorSwitchRiseUp(ObjSwitch* this, PlayState* play); +void ObjSwitch_EyeSwitchUnfrozen(ObjSwitch* this, PlayState* play); +void ObjSwitch_EyeSwitchOpen(ObjSwitch* this, PlayState* play); +void ObjSwitch_EyeSwitchClosing(ObjSwitch* this, PlayState* play); +void ObjSwitch_EyeSwitchClosed(ObjSwitch* this, PlayState* play); +void ObjSwitch_EyeSwitchOpening(ObjSwitch* this, PlayState* play); +void ObjSwitch_CrystalSwitchOff(ObjSwitch* this, PlayState* play); +void ObjSwitch_CrystalSwitchTurnOn(ObjSwitch* this, PlayState* play); +void ObjSwitch_CrystalSwitchOn(ObjSwitch* this, PlayState* play); +void ObjSwitch_CrystalSwitchTurnOff(ObjSwitch* this, PlayState* play); +void ObjSwitch_LargeFloorSwitchUp(ObjSwitch* this, PlayState* play); +void ObjSwitch_LargeFloorSwitchPushDown(ObjSwitch* this, PlayState* play); +void ObjSwitch_LargeFloorSwitchDown(ObjSwitch* this, PlayState* play); +void ObjSwitch_LargeFloorSwitchRiseUp(ObjSwitch* this, PlayState* play); -void ObjSwitch_DrawFloorSwitch(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_DrawRustyFloorSwitch(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_DrawVisibleEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_DrawInvisibleEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_DrawEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx); -void ObjSwitch_DrawCrystalSwitch(ObjSwitch* this, GlobalContext* globalCtx); +void ObjSwitch_DrawFloorSwitch(ObjSwitch* this, PlayState* play); +void ObjSwitch_DrawRustyFloorSwitch(ObjSwitch* this, PlayState* play); +void ObjSwitch_DrawVisibleEyeSwitch(ObjSwitch* this, PlayState* play); +void ObjSwitch_DrawInvisibleEyeSwitch(ObjSwitch* this, PlayState* play); +void ObjSwitch_DrawEyeSwitch(ObjSwitch* this, PlayState* play); +void ObjSwitch_DrawCrystalSwitch(ObjSwitch* this, PlayState* play); static TexturePtr sEyeSwitchTextures[][4] = { { gEyeSwitchGoldOpenTex, gEyeSwitchGoldOpeningTex, gEyeSwitchGoldClosingTex, gEyeSwitchGoldClosedTex }, @@ -203,11 +203,11 @@ static Gfx* sEyeSwitchDL[] = { gEyeSwitchGoldDL, gEyeSwitchSilverDL }; static AnimatedMaterial* sCrystalSwitchAnimatedMat; -void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderJntSphInit* init) { +void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* init) { s32 pad; - Collider_InitJntSph(globalCtx, &this->colliderJntSph); - Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->dyna.actor, init, this->colliderJntSphElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, init, this->colliderJntSphElements); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y), @@ -216,14 +216,14 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, Col Collider_UpdateSpheres(0, &this->colliderJntSph); } -void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, ColliderTrisInit* init) { +void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisInit* init) { s32 pad; s32 i; s32 j; Vec3f vtx[3]; - Collider_InitTris(globalCtx, &this->colliderTris); - Collider_SetTris(globalCtx, &this->colliderTris, &this->dyna.actor, init, this->colliderTrisElements); + Collider_InitTris(play, &this->colliderTris); + Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, init, this->colliderTrisElements); Matrix_Push(); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + @@ -240,22 +240,22 @@ void ObjSwitch_InitTrisCollider(ObjSwitch* this, GlobalContext* globalCtx, Colli Matrix_Pop(); } -Actor* ObjSwitch_SpawnIce(ObjSwitch* this, GlobalContext* globalCtx) { - return Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ICE_POLY, +Actor* ObjSwitch_SpawnIce(ObjSwitch* this, PlayState* play) { + return Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y - 25.0f, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 0xFF32); } -void ObjSwitch_SetSwitchFlagState(ObjSwitch* this, GlobalContext* globalCtx, s32 setFlag) { +void ObjSwitch_SetSwitchFlagState(ObjSwitch* this, PlayState* play, s32 setFlag) { if (setFlag) { s32 flag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); - Flags_SetSwitch(globalCtx, flag); + Flags_SetSwitch(play, flag); } else { s32 flag = OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor); - Flags_UnsetSwitch(globalCtx, flag); + Flags_UnsetSwitch(play, flag); } } @@ -288,15 +288,15 @@ void ObjSwitch_SetFloorSwitchSnapPlayerState(ObjSwitch* this, s32 state) { } } -void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, PlayState* play) { s32 pad; Player* player; f32 centerDisplacement; s16 yaw; f32 cos; - if (globalCtx->actorCtx.unk5 & 0x80) { - player = GET_PLAYER(globalCtx); + if (play->actorCtx.unk5 & 0x80) { + player = GET_PLAYER(play); // compute yawTowardsPlayer relative to model space yaw = BINANG_SUB(this->dyna.actor.yawTowardsPlayer, this->dyna.actor.shape.rot.y); @@ -325,14 +325,14 @@ void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, GlobalContext* } } -void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Init(Actor* thisx, PlayState* play) { s32 pad; s32 type; u32 isSwitchFlagSet; ObjSwitch* this = THIS; s32 pad2; - isSwitchFlagSet = Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor)); + isSwitchFlagSet = Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor)); type = OBJ_SWITCH_GET_TYPE(&this->dyna.actor); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, sScale[type]); @@ -344,10 +344,10 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 1.0f; } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gFloorSwitchCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gFloorSwitchCol); } if (type == OBJSWITCH_TYPE_FLOOR) { - if (globalCtx->sceneNum == SCENE_SECOM) { + if (play->sceneNum == SCENE_SECOM) { this->floorSwitchUpScale = 33.0f / 200.0f / 3.0f; this->floorSwitchDownScale = 33.0f / 2000.0f / 3.0f; } else { @@ -356,7 +356,7 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } } if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_LARGE) { - if (globalCtx->sceneNum == SCENE_SECOM) { + if (play->sceneNum == SCENE_SECOM) { Color_RGB8* color = &sSakonHideoutColor[OBJ_SWITCH_GET_COLOR_ID(&this->dyna.actor)]; this->color.r = color->r; @@ -373,11 +373,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, &sEyeSwitchTrisInit); + ObjSwitch_InitTrisCollider(this, play, &sEyeSwitchTrisInit); } else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { - ObjSwitch_InitJntSphCollider(this, globalCtx, &sJntSphInit); + ObjSwitch_InitJntSphCollider(this, play, &sJntSphInit); } if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { this->dyna.actor.targetMode = 4; @@ -385,7 +385,7 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; if (OBJ_SWITCH_IS_FROZEN(&this->dyna.actor)) { - if (ObjSwitch_SpawnIce(this, globalCtx) == NULL) { + if (ObjSwitch_SpawnIce(this, play) == NULL) { OBJ_SWITCH_UNSET_FROZEN(&this->dyna.actor); } this->sfxTimer = 0; @@ -457,37 +457,37 @@ void ObjSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjSwitch* this = THIS; s32 type = OBJ_SWITCH_GET_TYPE(&this->dyna.actor); if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY || type == OBJSWITCH_TYPE_FLOOR_LARGE) { - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } switch (type) { case OBJSWITCH_TYPE_FLOOR_RUSTY: case OBJSWITCH_TYPE_EYE: - Collider_DestroyTris(globalCtx, &this->colliderTris); + Collider_DestroyTris(play, &this->colliderTris); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyJntSph(play, &this->colliderJntSph); break; } } -void ObjSwitch_TryPlayCutsceneInit(ObjSwitch* this, GlobalContext* globalCtx, ObjSwitchSetupActionFunc actionFunc, +void ObjSwitch_TryPlayCutsceneInit(ObjSwitch* this, PlayState* play, ObjSwitchSetupActionFunc actionFunc, s32 nextSwitchFlagState) { this->setupFunc = actionFunc; this->nextSwitchFlagState = nextSwitchFlagState; this->actionFunc = ObjSwitch_TryPlayCutscene; } -void ObjSwitch_TryPlayCutscene(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_TryPlayCutscene(ObjSwitch* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - ObjSwitch_SetSwitchFlagState(this, globalCtx, this->nextSwitchFlagState); + ObjSwitch_SetSwitchFlagState(this, play, this->nextSwitchFlagState); if (this->floorSwitchPlayerSnapState == 1) { this->floorSwitchPlayerSnapState = 2; } @@ -503,52 +503,51 @@ void ObjSwitch_FloorSwitchUpInit(ObjSwitch* this) { this->dyna.actor.scale.y = this->floorSwitchUpScale; } -void ObjSwitch_FloorSwitchUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play) { s32 pad; if (OBJ_SWITCH_GET_TYPE(&this->dyna.actor) == OBJSWITCH_TYPE_FLOOR_RUSTY) { if (this->colliderTris.base.acFlags & AC_HIT) { this->colliderTris.base.acFlags &= ~AT_HIT; - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchPushDownInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } else { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); } } else { switch (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchPushDownInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } break; case OBJSWITCH_SUBTYPE_SYNC: if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchPushDownInit, true); - } else if (Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); + } else if (Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { ObjSwitch_FloorSwitchPushDownInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { s32 isSwitchFlagNotSet = - Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor)) ? false : true; + Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor)) ? false : true; ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchPushDownInit, - isSwitchFlagNotSet); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, isSwitchFlagNotSet); } break; case OBJSWITCH_SUBTYPE_RESET: if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchPushDownInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } break; case OBJSWITCH_SUBTYPE_RESET_INVERTED: if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 2); - ObjSwitch_SetSwitchFlagState(this, globalCtx, false); + ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_FloorSwitchPushDownInit(this); } break; @@ -560,7 +559,7 @@ void ObjSwitch_FloorSwitchPushDownInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorSwitchPushDown; } -void ObjSwitch_FloorSwitchPushDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorSwitchPushDown(ObjSwitch* this, PlayState* play) { this->dyna.actor.scale.y -= 0.0495f; if (this->dyna.actor.scale.y <= this->floorSwitchDownScale) { ObjSwitch_PlayFootSwitchSfx(this); @@ -576,16 +575,16 @@ void ObjSwitch_FloorSwitchDownInit(ObjSwitch* this) { this->dyna.actor.scale.y = this->floorSwitchDownScale; } -void ObjSwitch_FloorSwitchDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { s32 pad; u32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); switch (subType) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: - if (!Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { - if (globalCtx->sceneNum == SCENE_SECOM && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { - ObjSwitch_SetSwitchFlagState(this, globalCtx, true); + if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + if (play->sceneNum == SCENE_SECOM && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + ObjSwitch_SetSwitchFlagState(this, play, true); } else { ObjSwitch_FloorSwitchRiseUpInit(this); } @@ -595,19 +594,19 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, GlobalContext* globalCtx) { case OBJSWITCH_SUBTYPE_RESET: case OBJSWITCH_SUBTYPE_RESET_INVERTED: if (!DynaPolyActor_IsInSwitchPressedState(&this->dyna) && - (Player_InCsMode(&globalCtx->state) == 0 || globalCtx->sceneNum == SCENE_SECOM)) { + (Player_InCsMode(&play->state) == 0 || play->sceneNum == SCENE_SECOM)) { if (this->floorSwitchReleaseTimer <= 0) { if (subType == OBJSWITCH_SUBTYPE_RESET) { - ObjSwitch_SetSwitchFlagState(this, globalCtx, false); + ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_FloorSwitchRiseUpInit(this); } else if (subType == OBJSWITCH_SUBTYPE_RESET_INVERTED) { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_FloorSwitchRiseUpInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchRiseUpInit, true); } else { ObjSwitch_FloorSwitchRiseUpInit(this); } } } else { - if (globalCtx->sceneNum == SCENE_SECOM) { + if (play->sceneNum == SCENE_SECOM) { this->floorSwitchReleaseTimer = 2; } else { this->floorSwitchReleaseTimer = 6; @@ -621,7 +620,7 @@ void ObjSwitch_FloorSwitchRiseUpInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_FloorSwitchRiseUp; } -void ObjSwitch_FloorSwitchRiseUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_FloorSwitchRiseUp(ObjSwitch* this, PlayState* play) { this->dyna.actor.scale.y += 0.0495f; if (this->floorSwitchUpScale <= this->dyna.actor.scale.y) { ObjSwitch_PlayFootSwitchSfx(this); @@ -661,8 +660,8 @@ void ObjSwitch_EyeSwitchFrozenInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_EyeSwitchUnfrozen; } -void ObjSwitch_EyeSwitchUnfrozen(ObjSwitch* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { +void ObjSwitch_EyeSwitchUnfrozen(ObjSwitch* this, PlayState* play) { + if (Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { ObjSwitch_EyeSwitchClosedInit(this); } else { ObjSwitch_EyeSwitchOpenInit(this); @@ -674,10 +673,10 @@ void ObjSwitch_EyeSwitchOpenInit(ObjSwitch* this) { this->eyeTexIndex = 0; } -void ObjSwitch_EyeSwitchOpen(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeSwitchOpen(ObjSwitch* this, PlayState* play) { if (ObjSwitch_IsEyeSwitchHit(this) || OBJ_SWITCH_IS_FROZEN(&this->dyna.actor)) { OBJ_SWITCH_UNSET_FROZEN(&this->dyna.actor); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_EyeSwitchClosingInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_EyeSwitchClosingInit, true); } } @@ -685,7 +684,7 @@ void ObjSwitch_EyeSwitchClosingInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_EyeSwitchClosing; } -void ObjSwitch_EyeSwitchClosing(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeSwitchClosing(ObjSwitch* this, PlayState* play) { this->eyeTexIndex++; if (this->eyeTexIndex >= 3) { ObjSwitch_StopCutscene(this); @@ -699,10 +698,10 @@ void ObjSwitch_EyeSwitchClosedInit(ObjSwitch* this) { this->eyeTexIndex = 3; } -void ObjSwitch_EyeSwitchClosed(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeSwitchClosed(ObjSwitch* this, PlayState* play) { switch (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: - if (!Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { OBJ_SWITCH_UNSET_FROZEN(&this->dyna.actor); ObjSwitch_EyeSwitchOpeningInit(this); } @@ -710,7 +709,7 @@ void ObjSwitch_EyeSwitchClosed(ObjSwitch* this, GlobalContext* globalCtx) { case OBJSWITCH_SUBTYPE_TOGGLE: if (ObjSwitch_IsEyeSwitchHit(this) || OBJ_SWITCH_IS_FROZEN(&this->dyna.actor)) { OBJ_SWITCH_UNSET_FROZEN(&this->dyna.actor); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_EyeSwitchOpeningInit, false); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_EyeSwitchOpeningInit, false); } break; } @@ -720,7 +719,7 @@ void ObjSwitch_EyeSwitchOpeningInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_EyeSwitchOpening; } -void ObjSwitch_EyeSwitchOpening(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_EyeSwitchOpening(ObjSwitch* this, PlayState* play) { this->eyeTexIndex--; if (this->eyeTexIndex <= 0) { ObjSwitch_StopCutscene(this); @@ -736,7 +735,7 @@ void ObjSwitch_CrystalSwitchOffInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalSwitchOff; } -void ObjSwitch_CrystalSwitchOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalSwitchOff(ObjSwitch* this, PlayState* play) { s32 switchHit = (this->colliderJntSph.base.acFlags & AC_HIT) != 0; s32 canActivate = switchHit && !(this->collisionFlags & AC_HIT) && (this->disableCrystalSwitchTimer <= 0); @@ -746,21 +745,21 @@ void ObjSwitch_CrystalSwitchOff(ObjSwitch* this, GlobalContext* globalCtx) { switch (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: if (canActivate) { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_CrystalSwitchTurnOnInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_CrystalSwitchTurnOnInit, true); } break; case OBJSWITCH_SUBTYPE_SYNC: if (canActivate) { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_CrystalSwitchTurnOnInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_CrystalSwitchTurnOnInit, true); - } else if (Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + } else if (Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { this->disableCrystalSwitchTimer = 10; ObjSwitch_CrystalSwitchTurnOnInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if (canActivate) { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_CrystalSwitchTurnOnInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_CrystalSwitchTurnOnInit, true); } ObjSwitch_CrystalUpdateTimer(this); break; @@ -771,7 +770,7 @@ void ObjSwitch_CrystalSwitchTurnOnInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalSwitchTurnOn; } -void ObjSwitch_CrystalSwitchTurnOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalSwitchTurnOn(ObjSwitch* this, PlayState* play) { s32 switchHit = (this->colliderJntSph.base.acFlags & AC_HIT) != 0; s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); @@ -793,7 +792,7 @@ void ObjSwitch_CrystalSwitchOnInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalSwitchOn; } -void ObjSwitch_CrystalSwitchOn(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalSwitchOn(ObjSwitch* this, PlayState* play) { s32 switchHit = (this->colliderJntSph.base.acFlags & AC_HIT) != 0; s32 canActivate = switchHit && !(this->collisionFlags & AC_HIT) && (this->disableCrystalSwitchTimer <= 0); @@ -803,14 +802,14 @@ void ObjSwitch_CrystalSwitchOn(ObjSwitch* this, GlobalContext* globalCtx) { switch (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: - if (!Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { this->disableCrystalSwitchTimer = 10; ObjSwitch_CrystalSwitchTurnOffInit(this); } break; case OBJSWITCH_SUBTYPE_TOGGLE: if (canActivate) { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_CrystalSwitchTurnOffInit, false); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_CrystalSwitchTurnOffInit, false); } } ObjSwitch_CrystalUpdateTimer(this); @@ -820,7 +819,7 @@ void ObjSwitch_CrystalSwitchTurnOffInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_CrystalSwitchTurnOff; } -void ObjSwitch_CrystalSwitchTurnOff(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_CrystalSwitchTurnOff(ObjSwitch* this, PlayState* play) { s32 switchHit = (this->colliderJntSph.base.acFlags & AC_HIT) != 0; if (switchHit) { @@ -837,22 +836,22 @@ void ObjSwitch_LargeFloorSwitchUpInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_LargeFloorSwitchUp; } -void ObjSwitch_LargeFloorSwitchUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_LargeFloorSwitchUp(ObjSwitch* this, PlayState* play) { s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); if (subType == OBJSWITCH_SUBTYPE_ONCE) { if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_LargeFloorSwitchPushDownInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_LargeFloorSwitchPushDownInit, true); } } else if (subType == OBJSWITCH_SUBTYPE_RESET) { if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_LargeFloorSwitchPushDownInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_LargeFloorSwitchPushDownInit, true); } } else if (subType == OBJSWITCH_SUBTYPE_RESET_INVERTED && DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 2); - ObjSwitch_SetSwitchFlagState(this, globalCtx, false); + ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_LargeFloorSwitchPushDownInit(this); } } @@ -861,7 +860,7 @@ void ObjSwitch_LargeFloorSwitchPushDownInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_LargeFloorSwitchPushDown; } -void ObjSwitch_LargeFloorSwitchPushDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_LargeFloorSwitchPushDown(ObjSwitch* this, PlayState* play) { this->dyna.actor.scale.y -= 0.074250005f; if (this->dyna.actor.scale.y <= 33.0f / 2000.0f) { ObjSwitch_PlayFootSwitchSfx(this); @@ -877,21 +876,21 @@ void ObjSwitch_LargeFloorSwitchDownInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_LargeFloorSwitchDown; } -void ObjSwitch_LargeFloorSwitchDown(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_LargeFloorSwitchDown(ObjSwitch* this, PlayState* play) { s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); if (subType == OBJSWITCH_SUBTYPE_ONCE) { - if (!Flags_GetSwitch(globalCtx, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { + if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { ObjSwitch_LargeFloorSwitchRiseUpInit(this); } } else if (subType == OBJSWITCH_SUBTYPE_RESET || subType == OBJSWITCH_SUBTYPE_RESET_INVERTED) { - if (!DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna) && !Player_InCsMode(&globalCtx->state)) { + if (!DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna) && !Player_InCsMode(&play->state)) { if (this->floorSwitchReleaseTimer <= 0) { if (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_RESET) { - ObjSwitch_SetSwitchFlagState(this, globalCtx, false); + ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_LargeFloorSwitchRiseUpInit(this); } else { - ObjSwitch_TryPlayCutsceneInit(this, globalCtx, ObjSwitch_LargeFloorSwitchRiseUpInit, true); + ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_LargeFloorSwitchRiseUpInit, true); } } } else { @@ -904,7 +903,7 @@ void ObjSwitch_LargeFloorSwitchRiseUpInit(ObjSwitch* this) { this->actionFunc = ObjSwitch_LargeFloorSwitchRiseUp; } -void ObjSwitch_LargeFloorSwitchRiseUp(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_LargeFloorSwitchRiseUp(ObjSwitch* this, PlayState* play) { this->dyna.actor.scale.y += 0.074250005f; if (this->dyna.actor.scale.y >= 0.2475f) { ObjSwitch_PlayFootSwitchSfx(this); @@ -913,7 +912,7 @@ void ObjSwitch_LargeFloorSwitchRiseUp(ObjSwitch* this, GlobalContext* globalCtx) } } -void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Update(Actor* thisx, PlayState* play) { ObjSwitch* this = THIS; if (this->floorSwitchReleaseTimer > 0) { @@ -922,12 +921,12 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->sfxTimer > 0) { this->sfxTimer--; } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); if (this->floorSwitchPlayerSnapState != 0) { s32 pad; dummy: - ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(this, globalCtx); + ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(this, play); if (this->floorSwitchPlayerSnapState == 2) { this->floorSwitchPlayerSnapState = 0; } @@ -941,11 +940,11 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { case OBJSWITCH_TYPE_EYE: this->collisionFlags = this->colliderTris.base.acFlags; this->colliderTris.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - if (!Player_InCsMode(&globalCtx->state)) { + if (!Player_InCsMode(&play->state)) { if (this->disableCrystalSwitchTimer > 0) { this->disableCrystalSwitchTimer--; } @@ -956,96 +955,96 @@ void ObjSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { this->colliderJntSph.base.colType = COLTYPE_NONE; } this->collisionFlags = this->colliderJntSph.base.acFlags; - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } } -void ObjSwitch_DrawFloorSwitch(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawFloorSwitch(ObjSwitch* this, PlayState* play) { s32 pad[2]; if (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_ONCE) { Gfx* opa; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); opa = POLY_OPA_DISP; gSPDisplayList(opa++, &sSetupDL[6 * 25]); - gSPMatrix(opa++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(opa++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(opa++, 0, 0x80, this->color.r, this->color.g, this->color.b, 255); gSPDisplayList(opa++, gFloorSwitch1DL); POLY_OPA_DISP = opa; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else { - Gfx_DrawDListOpa(globalCtx, sFloorSwitchDL[OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)]); + Gfx_DrawDListOpa(play, sFloorSwitchDL[OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)]); } } -void ObjSwitch_DrawRustyFloorSwitch(ObjSwitch* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gRustyFloorSwitchDL); +void ObjSwitch_DrawRustyFloorSwitch(ObjSwitch* this, PlayState* play) { + Gfx_DrawDListOpa(play, gRustyFloorSwitchDL); } -void ObjSwitch_DrawVisibleEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawVisibleEyeSwitch(ObjSwitch* this, PlayState* play) { s32 pad; s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, sEyeSwitchTextures[subType][this->eyeTexIndex]); gSPDisplayList(POLY_OPA_DISP++, sEyeSwitchDL[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjSwitch_DrawInvisibleEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawInvisibleEyeSwitch(ObjSwitch* this, PlayState* play) { s32 pad; s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, sEyeSwitchTextures[subType][this->eyeTexIndex]); gSPDisplayList(POLY_XLU_DISP++, sEyeSwitchDL[subType]); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjSwitch_DrawEyeSwitch(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawEyeSwitch(ObjSwitch* this, PlayState* play) { if (OBJ_SWITCH_IS_INVISIBLE(&this->dyna.actor)) { - ObjSwitch_DrawInvisibleEyeSwitch(this, globalCtx); + ObjSwitch_DrawInvisibleEyeSwitch(this, play); } else { - ObjSwitch_DrawVisibleEyeSwitch(this, globalCtx); + ObjSwitch_DrawVisibleEyeSwitch(this, play); } } -void ObjSwitch_DrawCrystalSwitch(ObjSwitch* this, GlobalContext* globalCtx) { +void ObjSwitch_DrawCrystalSwitch(ObjSwitch* this, PlayState* play) { s32 pad[2]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_800B8118(&this->dyna.actor, globalCtx, 0); - AnimatedMat_DrawStep(globalCtx, sCrystalSwitchAnimatedMat, this->crystalAnimTimer); - func_8012C28C(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_800B8118(&this->dyna.actor, play, 0); + AnimatedMat_DrawStep(play, sCrystalSwitchAnimatedMat, this->crystalAnimTimer); + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCrystalSwitchBaseDL); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, this->color.r, this->color.g, this->color.b, 255); gSPDisplayList(POLY_OPA_DISP++, gCrystalSwitchCoreDL); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCrystalSwitchDiamondDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSwitch_Draw(Actor* thisx, PlayState* play) { static ObjSwitchDrawFunc drawFunc[] = { ObjSwitch_DrawFloorSwitch, ObjSwitch_DrawRustyFloorSwitch, ObjSwitch_DrawEyeSwitch, ObjSwitch_DrawCrystalSwitch, ObjSwitch_DrawCrystalSwitch, ObjSwitch_DrawFloorSwitch, }; ObjSwitch* this = THIS; - drawFunc[OBJ_SWITCH_GET_TYPE(&this->dyna.actor)](this, globalCtx); + drawFunc[OBJ_SWITCH_GET_TYPE(&this->dyna.actor)](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 42ee4207fd..34d7019e83 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -5,8 +5,8 @@ struct ObjSwitch; -typedef void (*ObjSwitchActionFunc)(struct ObjSwitch* this, GlobalContext* globalCtx); -typedef void (*ObjSwitchDrawFunc)(struct ObjSwitch* this, GlobalContext* globalCtx); +typedef void (*ObjSwitchActionFunc)(struct ObjSwitch* this, PlayState* play); +typedef void (*ObjSwitchDrawFunc)(struct ObjSwitch* this, PlayState* play); typedef void (*ObjSwitchSetupActionFunc)(struct ObjSwitch* this); typedef enum { diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c index cea97efe91..4472c4fc33 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c @@ -10,14 +10,14 @@ #define THIS ((ObjSwprize*)thisx) -void ObjSwprize_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjSwprize_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjSwprize_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjSwprize_Init(Actor* thisx, PlayState* play); +void ObjSwprize_Destroy(Actor* thisx, PlayState* play); +void ObjSwprize_Update(Actor* thisx, PlayState* play); -void func_80C25654(ObjSwprize* this, GlobalContext* globalCtx); -void func_80C256AC(ObjSwprize* this, GlobalContext* globalCtx); -void func_80C2572C(ObjSwprize* this, GlobalContext* globalCtx); -void func_80C25794(ObjSwprize* this, GlobalContext* globalCtx); +void func_80C25654(ObjSwprize* this, PlayState* play); +void func_80C256AC(ObjSwprize* this, PlayState* play); +void func_80C2572C(ObjSwprize* this, PlayState* play); +void func_80C25794(ObjSwprize* this, PlayState* play); #if 0 const ActorInit Obj_Swprize_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h index 680417d506..4002f25c4b 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h @@ -5,7 +5,7 @@ struct ObjSwprize; -typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, GlobalContext*); +typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, PlayState*); typedef struct ObjSwprize { /* 0x0000 */ Actor actor; 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 9001ea27ac..2d7f2a836e 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -13,10 +13,10 @@ #define THIS ((ObjSyokudai*)thisx) -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, @@ -87,25 +87,25 @@ static Gfx* sDLists[] = { static s32 sNumLitTorchesInGroup; -void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Init(Actor* thisx, PlayState* play) { ObjSyokudai* this = THIS; s32 pad; s32 type = OBJ_SYOKUDAI_GET_TYPE(thisx); s32 switchFlag = OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx); Actor_ProcessInitChain(thisx, sInitChain); - func_800B4AEC(globalCtx, thisx, 50.0f); + func_800B4AEC(play, thisx, 50.0f); ActorShape_Init(&thisx->shape, 0.0f, func_800B4B50, 1.0f); - Collider_InitAndSetCylinder(globalCtx, &this->standCollider, thisx, &sStandColliderInit); + Collider_InitAndSetCylinder(play, &this->standCollider, thisx, &sStandColliderInit); this->standCollider.base.colType = sColTypes[OBJ_SYOKUDAI_GET_TYPE(thisx)]; - Collider_InitAndSetCylinder(globalCtx, &this->flameCollider, thisx, &sFlameColliderInit); + Collider_InitAndSetCylinder(play, &this->flameCollider, thisx, &sFlameColliderInit); thisx->colChkInfo.mass = MASS_IMMOVABLE; Lights_PointGlowSetInfo(&this->lightInfo, thisx->world.pos.x, thisx->world.pos.y + OBJ_SYOKUDAI_GLOW_HEIGHT, thisx->world.pos.z, 0xFF, 0xFF, 0xB4, -1); - this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); if (OBJ_SYOKUDAI_GET_START_LIT(thisx) || - ((type != OBJ_SYOKUDAI_TYPE_NO_SWITCH || switchFlag != 0x7F) && Flags_GetSwitch(globalCtx, switchFlag))) { + ((type != OBJ_SYOKUDAI_TYPE_NO_SWITCH || switchFlag != 0x7F) && Flags_GetSwitch(play, switchFlag))) { s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx); @@ -120,16 +120,16 @@ void ObjSyokudai_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(thisx, 60.0f); } -void ObjSyokudai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Destroy(Actor* thisx, PlayState* play) { ObjSyokudai* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->standCollider); - Collider_DestroyCylinder(globalCtx, &this->flameCollider); - LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode); + Collider_DestroyCylinder(play, &this->standCollider); + Collider_DestroyCylinder(play, &this->flameCollider); + 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 = THIS; s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx); s32 switchFlag = OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx); @@ -147,7 +147,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { if (ActorCutscene_GetCanPlayNext(thisx->cutscene) != 0) { ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx); if (this->pendingAction >= OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH) { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); } } else { ActorCutscene_SetIntentToPlay(thisx->cutscene); @@ -157,13 +157,13 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_NONE; } } else { - if (WaterBox_GetSurface1_2(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &waterSurface, + if (WaterBox_GetSurface1_2(play, &play->colCtx, thisx->world.pos.x, thisx->world.pos.z, &waterSurface, &waterBox) && ((waterSurface - thisx->world.pos.y) > OBJ_SYOKUDAI_FLAME_HEIGHT)) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_OUT; if (type == OBJ_SYOKUDAI_TYPE_FLAME_CAUSES_SWITCH) { - Flags_UnsetSwitch(globalCtx, switchFlag); + Flags_UnsetSwitch(play, switchFlag); if (groupSize != 0) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_GROUP_BY_WATER; } @@ -171,13 +171,13 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { s32 interaction = OBJ_SYOKUDAI_INTERACTION_NONE; u32 flameColliderHurtboxDmgFlags = 0; - player = GET_PLAYER(globalCtx); + player = GET_PLAYER(play); if (OBJ_SYOKUDAI_GET_START_LIT(thisx)) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; } if (groupSize != 0) { - if (Flags_GetSwitch(globalCtx, switchFlag)) { + if (Flags_GetSwitch(play, switchFlag)) { if (this->snuffTimer == OBJ_SYOKUDAI_SNUFF_OUT) { if (type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; @@ -243,7 +243,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } else if (thisx->cutscene >= 0) { this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH; } else { - Flags_SetSwitch(globalCtx, switchFlag); + Flags_SetSwitch(play, switchFlag); this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; } } else { @@ -261,10 +261,10 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } } Collider_UpdateCylinder(thisx, &this->standCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->standCollider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->standCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->standCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->standCollider.base); Collider_UpdateCylinder(thisx, &this->flameCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->flameCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->flameCollider.base); if ((this->snuffTimer > OBJ_SYOKUDAI_SNUFF_OUT) && (--this->snuffTimer == OBJ_SYOKUDAI_SNUFF_OUT) && (type != OBJ_SYOKUDAI_TYPE_SWITCH_CAUSES_FLAME)) { sNumLitTorchesInGroup--; @@ -285,15 +285,15 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { this->flameTexScroll++; } -void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { ObjSyokudai* this = THIS; s32 pad; s32 groupSize = OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx); f32 flameScale; - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[OBJ_SYOKUDAI_GET_TYPE(thisx)]); if (this->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT) { s32 snuffTimerInitial = OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize); @@ -306,18 +306,17 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { flameScale = (f32)this->snuffTimer / OBJ_SYOKUDAI_SNUFF_DEFAULT; } flameScale *= 0.0027f; - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(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->flameTexScroll * -OBJ_SYOKUDAI_SNUFF_DEFAULT) & 0x1FF, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY); - Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y), - MTXMODE_APPLY); + Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - thisx->shape.rot.y), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.c b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.c index 65c9849819..e4936f1fb4 100644 --- a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.c +++ b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.c @@ -10,12 +10,12 @@ #define THIS ((ObjTakarayaWall*)thisx) -void ObjTakarayaWall_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTakarayaWall_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTakarayaWall_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTakarayaWall_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTakarayaWall_Init(Actor* thisx, PlayState* play); +void ObjTakarayaWall_Destroy(Actor* thisx, PlayState* play); +void ObjTakarayaWall_Update(Actor* thisx, PlayState* play); +void ObjTakarayaWall_Draw(Actor* thisx, PlayState* play); -void func_80AD9B04(ObjTakarayaWall* this, GlobalContext* globalCtx); +void func_80AD9B04(ObjTakarayaWall* this, PlayState* play); #if 0 const ActorInit Obj_Takaraya_Wall_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h index 83f267d37f..0b2251d098 100644 --- a/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h +++ b/src/overlays/actors/ovl_Obj_Takaraya_Wall/z_obj_takaraya_wall.h @@ -5,7 +5,7 @@ struct ObjTakarayaWall; -typedef void (*ObjTakarayaWallActionFunc)(struct ObjTakarayaWall*, GlobalContext*); +typedef void (*ObjTakarayaWallActionFunc)(struct ObjTakarayaWall*, PlayState*); typedef struct ObjTakarayaWall { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 6d7fd75521..32a44878b8 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -10,10 +10,10 @@ #define THIS ((ObjTaru*)thisx) -void ObjTaru_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTaru_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTaru_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTaru_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTaru_Init(Actor* thisx, PlayState* play); +void ObjTaru_Destroy(Actor* thisx, PlayState* play); +void ObjTaru_Update(Actor* thisx, PlayState* play); +void ObjTaru_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Taru_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h index 67cea2ef87..9e79cf7973 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h @@ -5,7 +5,7 @@ struct ObjTaru; -typedef void (*ObjTaruActionFunc)(struct ObjTaru*, GlobalContext*); +typedef void (*ObjTaruActionFunc)(struct ObjTaru*, PlayState*); typedef struct ObjTaru { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index f8425b40a7..bd5c164131 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -11,17 +11,17 @@ #define THIS ((ObjToge*)thisx) -void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjToge_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjToge_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjToge_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjToge_Init(Actor* thisx, PlayState* play); +void ObjToge_Destroy(Actor* thisx, PlayState* play); +void ObjToge_Update(Actor* thisx, PlayState* play); +void ObjToge_Draw(Actor* thisx, PlayState* play); void func_809A4744(ObjToge* this); -void func_809A477C(ObjToge* this, GlobalContext* globalCtx); +void func_809A477C(ObjToge* this, PlayState* play); void func_809A4804(ObjToge* this); -void func_809A481C(ObjToge* this, GlobalContext* globalCtx); +void func_809A481C(ObjToge* this, PlayState* play); void func_809A488C(ObjToge* this); -void func_809A48AC(ObjToge* this, GlobalContext* globalCtx); +void func_809A48AC(ObjToge* this, PlayState* play); const ActorInit Obj_Toge_InitVars = { ACTOR_OBJ_TOGE, @@ -68,22 +68,22 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_STOP), }; -void func_809A41C0(ObjToge* this, GlobalContext* globalCtx) { +void func_809A41C0(ObjToge* this, PlayState* play) { Vec3f sp1C = this->actor.world.pos; sp1C.y += 10.0f; sp1C.z += 10.0f; - func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f); + func_800B2B44(play, &this->actor, &sp1C, 1.8f); sp1C.x += 10.0f; sp1C.z -= 20.0f; - func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f); + func_800B2B44(play, &this->actor, &sp1C, 1.8f); sp1C.x -= 20.0f; - func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f); + func_800B2B44(play, &this->actor, &sp1C, 1.8f); } -void func_809A42A0(ObjToge* this, GlobalContext* globalCtx) { +void func_809A42A0(ObjToge* this, PlayState* play) { Vec3f sp54; s32 i; s16 phi_s0; @@ -93,20 +93,20 @@ void func_809A42A0(ObjToge* this, GlobalContext* globalCtx) { for (i = 0, phi_s0 = 0; i < 5; i++, phi_s0 += 0x3333) { sp54.x = (Math_SinS(phi_s0) * 15.0f) + this->actor.world.pos.x; sp54.z = (Math_CosS(phi_s0) * 15.0f) + this->actor.world.pos.z; - func_800B2B44(globalCtx, &this->actor, &sp54, (Rand_ZeroOne() * 0.6f) + 2.8f); + func_800B2B44(play, &this->actor, &sp54, (Rand_ZeroOne() * 0.6f) + 2.8f); } } -void func_809A43A8(ObjToge* this, GlobalContext* globalCtx) { +void func_809A43A8(ObjToge* this, PlayState* play) { if (!OBJTOGE_GET_4000(&this->actor)) { - func_809A41C0(this, globalCtx); + func_809A41C0(this, play); } else { - func_809A42A0(this, globalCtx); + func_809A42A0(this, play); } } -s32 func_809A43EC(ObjToge* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +s32 func_809A43EC(ObjToge* this, PlayState* play) { + Player* player = GET_PLAYER(play); f32 temp_fv1 = player->actor.world.pos.x - this->unk_1B8; f32 temp_fa0 = player->actor.world.pos.z - this->unk_1BC; f32 temp = -(this->unk_1CC * temp_fa0) + (temp_fv1 * this->unk_1C8); @@ -115,7 +115,7 @@ s32 func_809A43EC(ObjToge* this, GlobalContext* globalCtx) { return fabsf(temp) <= this->unk_1C0 && fabsf(temp2) <= this->unk_1C4; } -void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjToge_Init(Actor* thisx, PlayState* play) { s32 pad; ObjToge* this = THIS; Path* path; @@ -129,14 +129,14 @@ void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx) { sp3E = thisx->home.rot.z; thisx->home.rot.z = thisx->world.rot.z = thisx->shape.rot.z = 0; - Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitCylinder(play, &this->collider); if (OBJTOGE_GET_PATH(thisx) == 0xFF) { Actor_MarkForDeath(thisx); return; } - path = &globalCtx->setupPathList[OBJTOGE_GET_PATH(thisx)]; + path = &play->setupPathList[OBJTOGE_GET_PATH(thisx)]; if (path->count != 2) { Actor_MarkForDeath(thisx); return; @@ -166,7 +166,7 @@ void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1B4 = false; } - Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Collider_UpdateCylinder(thisx, &this->collider); thisx->colChkInfo.mass = MASS_IMMOVABLE; @@ -182,11 +182,11 @@ void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjToge_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjToge_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjToge* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void func_809A4744(ObjToge* this) { @@ -195,7 +195,7 @@ void func_809A4744(ObjToge* this) { this->unk_1B2 = D_809A4CFC[OBJTOGE_GET_3800(&this->actor)]; } -void func_809A477C(ObjToge* this, GlobalContext* globalCtx) { +void func_809A477C(ObjToge* this, PlayState* play) { if (this->unk_1B2 > 0) { this->unk_1B2--; } @@ -217,11 +217,11 @@ void func_809A4804(ObjToge* this) { this->unk_1B0 = 0; } -void func_809A481C(ObjToge* this, GlobalContext* globalCtx) { +void func_809A481C(ObjToge* this, PlayState* play) { if (this->unk_1B0 >= 0x1770) { this->unk_1B0 = 0x1770; func_809A488C(this); - } else if ((this->unk_1B0 > 0) || func_809A43EC(this, globalCtx)) { + } else if ((this->unk_1B0 > 0) || func_809A43EC(this, play)) { this->unk_1B0 += 200; } this->actor.shape.rot.y += this->unk_1B0; @@ -232,7 +232,7 @@ void func_809A488C(ObjToge* this) { this->actionFunc = func_809A48AC; } -void func_809A48AC(ObjToge* this, GlobalContext* globalCtx) { +void func_809A48AC(ObjToge* this, PlayState* play) { s32 pad; s32 sp30 = this->unk_194 ^ 1; @@ -244,8 +244,7 @@ void func_809A48AC(ObjToge* this, GlobalContext* globalCtx) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f, - 0x81); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f, 0x81); if (this->actor.bgCheckFlags & 8) { this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[this->unk_194]); @@ -273,13 +272,13 @@ void func_809A48AC(ObjToge* this, GlobalContext* globalCtx) { } } -void ObjToge_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjToge_Update(Actor* thisx, PlayState* play) { ObjToge* this = THIS; ColliderCylinder* collider = &this->collider; if (this->collider.base.acFlags & AC_HIT) { if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000) { - func_809A43A8(this, globalCtx); + func_809A43A8(this, play); Actor_SetColorFilter(&this->actor, 0, 250, 0, 250); } collider->base.acFlags &= ~AC_HIT; @@ -287,28 +286,28 @@ void ObjToge_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.colorFilterTimer == 0) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - func_800B8DD4(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 4); + func_800B8DD4(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 4); } - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->actor.xzDistToPlayer < 1000.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } if ((this->actor.flags & ACTOR_FLAG_40) || (this->actor.xzDistToPlayer < 300.0f)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); + CollisionCheck_SetOC(play, &play->colChkCtx, &collider->base); } else { this->collider.base.ocFlags1 &= ~OC1_HIT; this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; } } -void ObjToge_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjToge_Draw(Actor* thisx, PlayState* play) { ObjToge* this = THIS; - func_800B8050(&this->actor, globalCtx, 1); - Gfx_DrawDListOpa(globalCtx, object_trap_DL_001400); + func_800B8050(&this->actor, play, 1); + Gfx_DrawDListOpa(play, object_trap_DL_001400); } diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h index 3908b2c7e4..9a55a42194 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h @@ -5,7 +5,7 @@ struct ObjToge; -typedef void (*ObjTogeActionFunc)(struct ObjToge*, GlobalContext*); +typedef void (*ObjTogeActionFunc)(struct ObjToge*, PlayState*); #define OBJTOGE_GET_PATH(thisx) ((thisx)->params & 0xFF) #define OBJTOGE_GET_700(thisx) (((thisx)->params >> 8) & 7) diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 1567e90cc7..ba02b50389 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -11,20 +11,20 @@ #define THIS ((ObjTokeiStep*)thisx) -void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiStep_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiStep_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiStep_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeiStep_Init(Actor* thisx, PlayState* play); +void ObjTokeiStep_Destroy(Actor* thisx, PlayState* play); +void ObjTokeiStep_Update(Actor* thisx, PlayState* play); +void ObjTokeiStep_Draw(Actor* thisx, PlayState* play); void ObjTokeiStep_SetupBeginOpen(ObjTokeiStep* this); -void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, GlobalContext* globalCtx); +void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, PlayState* play); void ObjTokeiStep_SetupDoNothing(ObjTokeiStep* this); -void ObjTokeiStep_DoNothing(ObjTokeiStep* this, GlobalContext* globalCtx); +void ObjTokeiStep_DoNothing(ObjTokeiStep* this, PlayState* play); void ObjTokeiStep_SetupOpen(ObjTokeiStep* this); -void ObjTokeiStep_Open(ObjTokeiStep* this, GlobalContext* globalCtx); +void ObjTokeiStep_Open(ObjTokeiStep* this, PlayState* play); void ObjTokeiStep_SetupDoNothingOpen(ObjTokeiStep* this); -void ObjTokeiStep_DoNothingOpen(ObjTokeiStep* this, GlobalContext* globalCtx); -void ObjTokeiStep_DrawOpen(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeiStep_DoNothingOpen(ObjTokeiStep* this, PlayState* play); +void ObjTokeiStep_DrawOpen(Actor* thisx, PlayState* play); const ActorInit Obj_Tokei_Step_InitVars = { ACTOR_OBJ_TOKEI_STEP, @@ -59,9 +59,9 @@ void ObjTokeiStep_SetSysMatrix(ObjTokeiStepPanel* panel) { mtx->zw = panel->pos.z; } -void ObjTokeiStep_AddQuake(ObjTokeiStep* this, GlobalContext* globalCtx) { +void ObjTokeiStep_AddQuake(ObjTokeiStep* this, PlayState* play) { s32 pad[2]; - s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); Quake_SetSpeed(quake, 20000); Quake_SetQuakeValues(quake, 1, 0, 0, 0); @@ -69,7 +69,7 @@ void ObjTokeiStep_AddQuake(ObjTokeiStep* this, GlobalContext* globalCtx) { func_8013ECE0(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } -void ObjTokeiStep_SpawnDust(ObjTokeiStep* this, ObjTokeiStepPanel* panel, GlobalContext* globalCtx) { +void ObjTokeiStep_SpawnDust(ObjTokeiStep* this, ObjTokeiStepPanel* panel, PlayState* play) { s32 i; s32 pad; Vec3f dustSpawnOffset; @@ -85,7 +85,7 @@ void ObjTokeiStep_SpawnDust(ObjTokeiStep* this, ObjTokeiStepPanel* panel, Global dustSpawnPos.x += panel->pos.x; dustSpawnPos.y += panel->pos.y; dustSpawnPos.z += panel->pos.z; - func_800B1210(globalCtx, &dustSpawnPos, &gZeroVec3f, &sDustEffectAccel, (s32)((Rand_ZeroOne() * 40.0f) + 80.0f), + func_800B1210(play, &dustSpawnPos, &gZeroVec3f, &sDustEffectAccel, (s32)((Rand_ZeroOne() * 40.0f) + 80.0f), (s32)((Rand_ZeroOne() * 20.0f) + 50.0f)); } } @@ -136,7 +136,7 @@ void ObjTokeiStep_InitTimers(ObjTokeiStep* this) { } } -s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, GlobalContext* globalCtx) { +s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, PlayState* play) { ObjTokeiStep* this2 = this; s32 i; ObjTokeiStepPanel* panel; @@ -176,8 +176,8 @@ s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, GlobalContext* globalCtx) { panel->pos.y += finalPosY; } if (panel->numBounces == 1) { - ObjTokeiStep_SpawnDust(this2, panel, globalCtx); - ObjTokeiStep_AddQuake(this2, globalCtx); + ObjTokeiStep_SpawnDust(this2, panel, play); + ObjTokeiStep_AddQuake(this2, play); } } } @@ -187,14 +187,14 @@ s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, GlobalContext* globalCtx) { return isOpen; } -void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiStep_Init(Actor* thisx, PlayState* play) { ObjTokeiStep* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - if ((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0)) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClocktowerPanelCol); + if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0)) { + DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (gSaveContext.save.day >= 4)) { @@ -202,29 +202,29 @@ void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx) { ObjTokeiStep_InitStepsOpen(this); ObjTokeiStep_SetupDoNothingOpen(this); } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClocktowerPanelCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupDoNothing(this); } } -void ObjTokeiStep_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiStep_Destroy(Actor* thisx, PlayState* play) { ObjTokeiStep* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } void ObjTokeiStep_SetupBeginOpen(ObjTokeiStep* this) { this->actionFunc = ObjTokeiStep_BeginOpen; } -void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, GlobalContext* globalCtx) { +void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, PlayState* play) { CsCmdActorAction* action; - if (Cutscene_CheckActorAction(globalCtx, 134)) { - action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 134)]; + if (Cutscene_CheckActorAction(play, 134)) { + action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 134)]; - if ((action->startFrame == globalCtx->csCtx.frames) && (action->action != 0)) { + if ((action->startFrame == play->csCtx.frames) && (action->action != 0)) { this->dyna.actor.draw = ObjTokeiStep_DrawOpen; ObjTokeiStep_SetupOpen(this); } @@ -235,7 +235,7 @@ void ObjTokeiStep_SetupDoNothing(ObjTokeiStep* this) { this->actionFunc = ObjTokeiStep_DoNothing; } -void ObjTokeiStep_DoNothing(ObjTokeiStep* this, GlobalContext* globalCtx) { +void ObjTokeiStep_DoNothing(ObjTokeiStep* this, PlayState* play) { } void ObjTokeiStep_SetupOpen(ObjTokeiStep* this) { @@ -243,9 +243,9 @@ void ObjTokeiStep_SetupOpen(ObjTokeiStep* this) { this->actionFunc = ObjTokeiStep_Open; } -void ObjTokeiStep_Open(ObjTokeiStep* this, GlobalContext* globalCtx) { - if (ObjTokeiStep_OpenProcess(this, globalCtx)) { - func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +void ObjTokeiStep_Open(ObjTokeiStep* this, PlayState* play) { + if (ObjTokeiStep_OpenProcess(this, play)) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); ObjTokeiStep_SetupDoNothingOpen(this); } } @@ -255,37 +255,37 @@ void ObjTokeiStep_SetupDoNothingOpen(ObjTokeiStep* this) { this->actionFunc = ObjTokeiStep_DoNothingOpen; } -void ObjTokeiStep_DoNothingOpen(ObjTokeiStep* this, GlobalContext* globalCtx) { +void ObjTokeiStep_DoNothingOpen(ObjTokeiStep* this, PlayState* play) { } -void ObjTokeiStep_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiStep_Update(Actor* thisx, PlayState* play) { ObjTokeiStep* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjTokeiStep_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiStep_Draw(Actor* thisx, PlayState* play) { ObjTokeiStep* this = THIS; - Gfx_DrawDListOpa(globalCtx, gClocktowerPanelDL); + Gfx_DrawDListOpa(play, gClocktowerPanelDL); } -void ObjTokeiStep_DrawOpen(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiStep_DrawOpen(Actor* thisx, PlayState* play) { ObjTokeiStep* this = THIS; s32 i; ObjTokeiStepPanel* panel; Gfx* gfx; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(gfx++, &sSetupDL[6 * 0x19]); for (i = 0; i < ARRAY_COUNT(this->panels); i++) { panel = &this->panels[i]; ObjTokeiStep_SetSysMatrix(panel); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gClocktowerPanelDL); } POLY_OPA_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h index 06ec37e3a6..1b3f73fcb6 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.h @@ -5,7 +5,7 @@ struct ObjTokeiStep; -typedef void (*ObjTokeiStepFunc)(struct ObjTokeiStep*, struct GlobalContext*); +typedef void (*ObjTokeiStepFunc)(struct ObjTokeiStep*, struct PlayState*); typedef struct ObjTokeiStepPanel { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c index 9ffa6d4462..15e01b8325 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.c @@ -10,10 +10,10 @@ #define THIS ((ObjTokeiTobira*)thisx) -void ObjTokeiTobira_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTobira_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTobira_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTobira_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeiTobira_Init(Actor* thisx, PlayState* play); +void ObjTokeiTobira_Destroy(Actor* thisx, PlayState* play); +void ObjTokeiTobira_Update(Actor* thisx, PlayState* play); +void ObjTokeiTobira_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Tokei_Tobira_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h index 610f677802..8ddd39eb98 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h +++ b/src/overlays/actors/ovl_Obj_Tokei_Tobira/z_obj_tokei_tobira.h @@ -5,7 +5,7 @@ struct ObjTokeiTobira; -typedef void (*ObjTokeiTobiraActionFunc)(struct ObjTokeiTobira*, GlobalContext*); +typedef void (*ObjTokeiTobiraActionFunc)(struct ObjTokeiTobira*, PlayState*); typedef struct ObjTokeiTobira { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c b/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c index 29ea1f8a8f..a0183266fa 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c @@ -11,10 +11,10 @@ #define THIS ((ObjTokeiTurret*)thisx) -void ObjTokeiTurret_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTurret_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTurret_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeiTurret_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeiTurret_Init(Actor* thisx, PlayState* play); +void ObjTokeiTurret_Destroy(Actor* thisx, PlayState* play); +void ObjTokeiTurret_Update(Actor* thisx, PlayState* play); +void ObjTokeiTurret_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Tokei_Turret_InitVars = { ACTOR_OBJ_TOKEI_TURRET, @@ -33,7 +33,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void ObjTokeiTurret_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiTurret_Init(Actor* thisx, PlayState* play) { s32 pad; ObjTokeiTurret* this = THIS; s32 tier; @@ -46,41 +46,41 @@ void ObjTokeiTurret_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.uncullZoneDownward = this->dyna.actor.uncullZoneScale = 240.0f; if (tier == TURRET_TIER_BASE) { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTownTurretBaseCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTownTurretBaseCol); } else { - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gClockTownTurretPlatformCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTownTurretPlatformCol); } } else { this->dyna.actor.uncullZoneDownward = this->dyna.actor.uncullZoneScale = 1300.0; } } -void ObjTokeiTurret_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiTurret_Destroy(Actor* thisx, PlayState* play) { ObjTokeiTurret* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjTokeiTurret_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiTurret_Update(Actor* thisx, PlayState* play) { } -void ObjTokeiTurret_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeiTurret_Draw(Actor* thisx, PlayState* play) { ObjTokeiTurret* this = THIS; Gfx* gfx; if (OBJ_TOKEI_TURRET_TIER_TYPE(thisx) == TURRET_TIER_TOP) { - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; gSPDisplayList(gfx++, &sSetupDL[6 * 25]); - gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfx++, gClockTownTurretPlatformTopDL); POLY_OPA_DISP = gfx; - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } else if (OBJ_TOKEI_TURRET_TIER_TYPE(thisx) == TURRET_TIER_BASE) { - Gfx_DrawDListOpa(globalCtx, gClockTownTurretPlatformBaseDL); + Gfx_DrawDListOpa(play, gClockTownTurretPlatformBaseDL); } else { - Gfx_DrawDListOpa(globalCtx, gClockTownFlagsDL); + Gfx_DrawDListOpa(play, gClockTownFlagsDL); } } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 546e29a8e3..a1c7d3fb33 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -42,25 +42,25 @@ #define GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute) \ ((s16)(currentClockMinute * (0x10000 * 12.0f / 360))) -void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeidai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeidai_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeidai_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeidai_Init(Actor* thisx, PlayState* play); +void ObjTokeidai_Destroy(Actor* thisx, PlayState* play); +void ObjTokeidai_Update(Actor* thisx, PlayState* play); +void ObjTokeidai_Draw(Actor* thisx, PlayState* play); -void ObjTokeidai_DoNothing(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_TowerClock_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, GlobalContext* globalCtx); -void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, GlobalContext* globalCtx); +void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_TowerClock_OpenedIdle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, PlayState* play); +void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play); void ObjTokeidai_SetupTowerOpening(ObjTokeidai* this); -void ObjTokeidai_Clock_Draw(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeidai_Counterweight_Draw(Actor* thisx, GlobalContext* globalCtx); -void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTokeidai_Clock_Draw(Actor* thisx, PlayState* play); +void ObjTokeidai_Counterweight_Draw(Actor* thisx, PlayState* play); +void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Tokeidai_InitVars = { ACTOR_OBJ_TOKEIDAI, @@ -116,15 +116,15 @@ void ObjTokeidai_Clock_Init(ObjTokeidai* this) { this->sunMoonPanelRotation = ObjTokeidai_GetTargetSunMoonPanelRotation(); } -void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_ExteriorGear_Draw; this->opaDList = gClockTowerExteriorGearDL; ObjTokeidai_SetupClockOrExteriorGear(this); - if (((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0)) || - ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0))) { + if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0)) || + ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; @@ -136,14 +136,14 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_Clock_Init(this); - if (((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0)) || - ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0))) { + if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0)) || + ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; @@ -163,7 +163,7 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, GlobalContext* globalCtx) { } } -void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { s32 type; this->actor.draw = ObjTokeidai_Counterweight_Draw; @@ -175,10 +175,10 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) this->spotlightIntensity = 0; } - if (((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0)) || - ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0))) { + if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0)) || + ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0))) { this->spotlightIntensity = 0; ObjTokeidai_SetupTowerOpening(this); @@ -186,9 +186,8 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) type = OBJ_TOKEIDAI_TYPE(&this->actor); if (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN || type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD) { - this->actor.child = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HANABI, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + this->actor.child = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HANABI, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } } @@ -211,7 +210,7 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Init(Actor* thisx, PlayState* play) { ObjTokeidai* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -227,11 +226,11 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { switch (OBJ_TOKEIDAI_TYPE(&this->actor)) { case OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD: Actor_SetScale(&this->actor, 0.15f); - ObjTokeidai_ExteriorGear_Init(this, globalCtx); + ObjTokeidai_ExteriorGear_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_CLOCK_TOWN: - ObjTokeidai_ExteriorGear_Init(this, globalCtx); + ObjTokeidai_ExteriorGear_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_UNUSED_WALL: @@ -246,11 +245,11 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { case OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD: Actor_SetScale(&this->actor, 0.15f); - ObjTokeidai_TowerClock_Init(this, globalCtx); + ObjTokeidai_TowerClock_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN: - ObjTokeidai_TowerClock_Init(this, globalCtx); + ObjTokeidai_TowerClock_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_WALL_CLOCK: @@ -269,11 +268,11 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { case OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD: Actor_SetScale(&this->actor, 0.15f); - ObjTokeidai_Counterweight_Init(this, globalCtx); + ObjTokeidai_Counterweight_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN: - ObjTokeidai_Counterweight_Init(this, globalCtx); + ObjTokeidai_Counterweight_Init(this, play); break; case OBJ_TOKEIDAI_TYPE_STAIRCASE_TO_ROOFTOP: @@ -284,7 +283,7 @@ void ObjTokeidai_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjTokeidai_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Destroy(Actor* thisx, PlayState* play) { } void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { @@ -324,20 +323,20 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { } } -void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, PlayState* play) { if ((this->actor.bgCheckFlags & 1) || this->actor.world.pos.y < 0.0f) { this->actionFunc = ObjTokeidai_DoNothing; } else { this->actor.shape.rot.x += 0x50; this->actor.shape.rot.z += 0x50; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); } } -void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 132) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 2) { +void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 132) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 2) { this->actionFunc = ObjTokeidai_ExteriorGear_Collapse; this->actor.speedXZ = this->actor.scale.y * 5.0f; this->actor.velocity.y = 0.0f; @@ -350,7 +349,7 @@ void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, GlobalContext* globa * This, used in conjunction with the following function, makes the * tower's clock slide off the tower and spin through the air when the moon crashes. */ -void ObjTokeidai_TowerClock_Fall(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerClock_Fall(ObjTokeidai* this, PlayState* play) { this->actor.shape.rot.x += this->fallingClockFaceRotationalVelocity; if (this->fallingClockFaceRotationalVelocity > 0xA0) { this->fallingClockFaceRotationalVelocity -= 5; @@ -367,7 +366,7 @@ void ObjTokeidai_TowerClock_Fall(ObjTokeidai* this, GlobalContext* globalCtx) { * This makes the tower's clock slide off as the moon crashes into it. It's * the tower clock's equivalent to other components' Collapse functions. */ -void ObjTokeidai_TowerClock_SlideOff(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerClock_SlideOff(ObjTokeidai* this, PlayState* play) { f32 cos; f32 sin; Actor* thisx = &this->actor; @@ -403,16 +402,16 @@ void ObjTokeidai_TowerClock_SlideOff(ObjTokeidai* this, GlobalContext* globalCtx thisx->world.pos.z = (1178.0f * sin) + (this->aerialClockFaceSpeed * cos) + thisx->home.pos.z; } -void ObjTokeidai_TowerClock_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 132) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 1) { +void ObjTokeidai_TowerClock_OpenedIdle(ObjTokeidai* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 132) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 1) { this->actionFunc = ObjTokeidai_TowerClock_SlideOff; this->slidingClockFaceAngle = 0; this->aerialClockFaceSpeed = -0xD; } } -void ObjTokeidai_Counterweight_Collapse(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_Counterweight_Collapse(ObjTokeidai* this, PlayState* play) { if (this->actor.world.pos.y < 0.0f) { this->actionFunc = ObjTokeidai_DoNothing; } else { @@ -421,9 +420,9 @@ void ObjTokeidai_Counterweight_Collapse(ObjTokeidai* this, GlobalContext* global } } -void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 132) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 3) { +void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 132) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 3) { this->actionFunc = ObjTokeidai_Counterweight_Collapse; this->xRotation = 0; this->actor.velocity.y = 0.0f; @@ -432,34 +431,34 @@ void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, GlobalContext* glob } } -void ObjTokeidai_TerminaFieldWalls_Collapse(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TerminaFieldWalls_Collapse(ObjTokeidai* this, PlayState* play) { if (this->actor.shape.rot.x < 0x4000) { this->actor.shape.rot.x += 0x28; } } -void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 132) != 0 && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 1) { +void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 132) != 0 && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 1) { this->actionFunc = ObjTokeidai_TerminaFieldWalls_Collapse; } } -void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, GlobalContext* globalCtx) { - if (Cutscene_CheckActorAction(globalCtx, 132) != 0 && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 5) { +void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 132) != 0 && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 5) { gSaveContext.save.weekEventReg[8] |= 0x40; - if (((globalCtx->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0)) || - ((globalCtx->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (globalCtx->csCtx.currentCsIndex == 0))) { + if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0)) || + ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + (play->csCtx.currentCsIndex == 0))) { Audio_SetCutsceneFlag(false); gSaveContext.save.cutscene = 0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.respawnFlag = 2; - globalCtx->sceneLoadFlag = 0x14; - globalCtx->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; - globalCtx->unk_1887F = 2; + play->sceneLoadFlag = 0x14; + play->nextEntranceIndex = gSaveContext.respawn[RESTART_MODE_RETURN].entranceIndex; + play->unk_1887F = 2; if (gSaveContext.respawn[RESTART_MODE_RETURN].playerParams == 0xCFF) { gSaveContext.nextTransition = 0x15; } else { @@ -470,7 +469,7 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, GlobalContext* glob } } -void ObjTokeidai_TowerOpening_FinishOpening(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerOpening_FinishOpening(ObjTokeidai* this, PlayState* play) { s32 type; if (this->clockFaceZTranslation > -320) { @@ -481,7 +480,7 @@ void ObjTokeidai_TowerOpening_FinishOpening(ObjTokeidai* this, GlobalContext* gl type = OBJ_TOKEIDAI_TYPE(&this->actor); if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) { - ObjTokeidai_TowerOpening_EndCutscene(this, globalCtx); + ObjTokeidai_TowerOpening_EndCutscene(this, play); } else { this->actionFunc = ObjTokeidai_DoNothing; if (this->actor.child != NULL) { @@ -491,7 +490,7 @@ void ObjTokeidai_TowerOpening_FinishOpening(ObjTokeidai* this, GlobalContext* gl } } -void ObjTokeidai_TowerOpening_Wait(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerOpening_Wait(ObjTokeidai* this, PlayState* play) { if (this->openingWaitTimer > 0) { this->openingWaitTimer--; } else { @@ -500,7 +499,7 @@ void ObjTokeidai_TowerOpening_Wait(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, PlayState* play) { this->xRotation += this->counterweightRotationalVelocity; if (this->xRotation < 0x4000) { this->counterweightRotationalVelocity += this->counterweightRotationalAcceleration; @@ -540,7 +539,7 @@ void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, GlobalContext } } -void ObjTokeidai_TowerOpening_FinishRaise(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerOpening_FinishRaise(ObjTokeidai* this, PlayState* play) { s32 type; if (this->settleTimer > 0) { @@ -569,7 +568,7 @@ void ObjTokeidai_TowerOpening_FinishRaise(ObjTokeidai* this, GlobalContext* glob } } -void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { s32 type; if (this->yTranslation < 3400) { @@ -592,9 +591,9 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, GlobalContext* globa } } -void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, GlobalContext* globalCtx) { - if ((Cutscene_CheckActorAction(globalCtx, 132) && - globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 132)]->action == 4) || +void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, PlayState* play) { + if ((Cutscene_CheckActorAction(play, 132) && + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 4) || (gSaveContext.save.weekEventReg[8] & 0x40)) { this->actionFunc = ObjTokeidai_TowerOpening_RaiseTower; } @@ -613,10 +612,10 @@ void ObjTokeidai_SetupTowerOpening(ObjTokeidai* this) { this->clockFaceZTranslation = 0; } -void ObjTokeidai_DoNothing(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play) { } -void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { if (((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) || (gSaveContext.save.weekEventReg[8] & 0x40)) { this->actor.draw = ObjTokeidai_Draw; @@ -625,7 +624,7 @@ void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, GlobalContext* globa } } -s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, GlobalContext* globalCtx) { +s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, PlayState* play) { if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { return false; } @@ -636,7 +635,7 @@ s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, GlobalContext* glo return false; } -void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { s32 currentClockHour = GET_CURRENT_CLOCK_HOUR(this); if (currentClockHour != this->clockHour) { @@ -689,7 +688,7 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { if (CURRENT_DAY == 3 && this->clockHour < 6 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); @@ -697,12 +696,12 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { return; } - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { this->actor.home.rot.x = 1; this->clockTime += 3; this->actor.draw = ObjTokeidai_Clock_Draw; } else { - if (!(globalCtx->actorCtx.unk5 & 2) && + if (!(play->actorCtx.unk5 & 2) && OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD && ActorCutscene_GetCurrentIndex() == -1) { this->actor.draw = NULL; @@ -717,25 +716,25 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { if (CURRENT_DAY != 3 || gSaveContext.save.time >= CLOCK_TIME(6, 0)) { ObjTokeidai_RotateOnMinuteChange(this, true); } - ObjTokeidai_RotateOnHourChange(this, globalCtx); + ObjTokeidai_RotateOnHourChange(this, play); } -void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, PlayState* play) { this->clockTime = gSaveContext.save.time; ObjTokeidai_RotateOnMinuteChange(this, true); - ObjTokeidai_RotateOnHourChange(this, globalCtx); + ObjTokeidai_RotateOnHourChange(this, play); } -void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { - if (ObjTokeidai_IsPostFirstCycleFinalHours(this, globalCtx)) { +void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) { + if (ObjTokeidai_IsPostFirstCycleFinalHours(this, play)) { this->actor.draw = ObjTokeidai_ExteriorGear_Draw; } else { - if (globalCtx->csCtx.state != 0) { + if (play->csCtx.state != 0) { this->actor.home.rot.x = 1; this->clockTime += 3; this->actor.draw = ObjTokeidai_ExteriorGear_Draw; } else { - if ((globalCtx->actorCtx.unk5 & 2) == 0 && + if ((play->actorCtx.unk5 & 2) == 0 && OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD && ActorCutscene_GetCurrentIndex() == -1) { this->actor.draw = NULL; @@ -750,19 +749,18 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, GlobalContext* globalCtx) { +void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, PlayState* play) { s32 type; - if (ObjTokeidai_IsPostFirstCycleFinalHours(this, globalCtx)) { + if (ObjTokeidai_IsPostFirstCycleFinalHours(this, play)) { this->spotlightIntensity = 0; if (this->actor.child == NULL) { type = OBJ_TOKEIDAI_TYPE(&this->actor); if (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN || type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD) { - this->actor.child = - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HANABI, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); + this->actor.child = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HANABI, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } } @@ -785,40 +783,40 @@ void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, GlobalContext* globalCtx) } } -void ObjTokeidai_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Update(Actor* thisx, PlayState* play) { ObjTokeidai* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } /** * Used for TerminaFieldWalls StaircaseToRooftop, and UnusedWall */ -void ObjTokeidai_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Draw(Actor* thisx, PlayState* play) { ObjTokeidai* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->opaDList != NULL) { - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->opaDList); } if (this->xluDList != NULL) { - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, this->xluDList); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjTokeidai_Clock_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Clock_Draw(Actor* thisx, PlayState* play) { ObjTokeidai* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(0.0f, this->yTranslation, 0.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -1791.0f, MTXMODE_APPLY); Matrix_RotateXS(-this->xRotation, MTXMODE_APPLY); @@ -826,16 +824,16 @@ void ObjTokeidai_Clock_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_RotateZS(-this->minuteRingOrExteriorGearRotation, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gClockTowerMinuteRingDL); Matrix_Pop(); Matrix_Translate(0.0f, 0.0f, this->clockFaceZTranslation, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gClockTowerClockCenterAndHandDL); Matrix_RotateZS(-this->clockFaceRotation * 2, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_WALL_CLOCK || OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_SMALL_WALL_CLOCK) { gSPDisplayList(POLY_OPA_DISP++, gWallClockClockFace); @@ -845,15 +843,15 @@ void ObjTokeidai_Clock_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, -1112.0f, -19.6f, MTXMODE_APPLY); Matrix_RotateYS(this->sunMoonPanelRotation, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gClockTowerSunAndMoonPanelDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjTokeidai_Counterweight_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_Counterweight_Draw(Actor* thisx, PlayState* play) { s32 pad; - u32 gameplayFrames = globalCtx->gameplayFrames; + u32 gameplayFrames = play->gameplayFrames; ObjTokeidai* this = THIS; Matrix_RotateYS(-this->actor.shape.rot.y, MTXMODE_APPLY); @@ -863,30 +861,30 @@ void ObjTokeidai_Counterweight_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 5480.0f, -80.0f, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); // For scrolling the spotlight's mask texture down the length of the light beam. gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, -gameplayFrames, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, -gameplayFrames, 0, 0x20, 0x20)); // Draws the counterweight - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, this->opaDList); // Draws the spotlight - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 255, 255, 235, 180, (s32)(this->spotlightIntensity * 2.55f)); gSPDisplayList(POLY_XLU_DISP++, this->xluDList); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, PlayState* play) { ObjTokeidai* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(0.0f, this->yTranslation, 0.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -1791.0f, MTXMODE_APPLY); @@ -895,9 +893,9 @@ void ObjTokeidai_ExteriorGear_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateYS(thisx->shape.rot.y, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 1791.0f, MTXMODE_APPLY); Matrix_RotateZS(this->minuteRingOrExteriorGearRotation, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gClockTowerExteriorGearDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h index 48e44614dc..70ef31c797 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.h @@ -21,7 +21,7 @@ typedef enum { struct ObjTokeidai; -typedef void (*ObjTokeidaiActionFunc)(struct ObjTokeidai*, GlobalContext*); +typedef void (*ObjTokeidaiActionFunc)(struct ObjTokeidai*, PlayState*); typedef struct ObjTokeidai { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c index b91cbcf7ea..508da5040f 100644 --- a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c +++ b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c @@ -10,10 +10,10 @@ #define THIS ((ObjToudai*)thisx) -void ObjToudai_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjToudai_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjToudai_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjToudai_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjToudai_Init(Actor* thisx, PlayState* play); +void ObjToudai_Destroy(Actor* thisx, PlayState* play); +void ObjToudai_Update(Actor* thisx, PlayState* play); +void ObjToudai_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Toudai_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c index 223ebad740..1426849f7c 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c @@ -11,14 +11,14 @@ #define THIS ((ObjTree*)thisx) -void ObjTree_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjTree_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjTree_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjTree_Init(Actor* thisx, PlayState* play); +void ObjTree_Destroy(Actor* thisx, PlayState* play); +void ObjTree_Update(Actor* thisx, PlayState* play); +void ObjTree_Draw(Actor* thisx, PlayState* play); -void ObTree_DoNothing(ObjTree* this, GlobalContext* globalCtx); +void ObTree_DoNothing(ObjTree* this, PlayState* play); void ObTree_SetupDoNothing(ObjTree* this); -void ObTree_Sway(ObjTree* this, GlobalContext* globalCtx); +void ObTree_Sway(ObjTree* this, PlayState* play); const ActorInit Obj_Tree_InitVars = { ACTOR_OBJ_TREE, @@ -89,7 +89,7 @@ static DamageTable sDamageTable = { static CollisionCheckInfoInit2 sColchkInfoInit = { 8, 0, 0, 0, MASS_HEAVY }; -void ObjTree_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTree_Init(Actor* thisx, PlayState* play) { s32 pad; ObjTree* this = THIS; CollisionHeader* colHeader = NULL; @@ -101,11 +101,11 @@ void ObjTree_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, 0.1f); DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_tree_Colheader_001B2C, &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); } - 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); CollisionCheck_SetInfo2(&this->dyna.actor.colChkInfo, &sDamageTable, &sColchkInfoInit); if (OBJTREE_ISLARGE(&this->dyna.actor)) { @@ -118,23 +118,23 @@ void ObjTree_Init(Actor* thisx, GlobalContext* globalCtx) { ObTree_SetupDoNothing(this); } -void ObjTree_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjTree_Destroy(Actor* thisx, PlayState* play) { ObjTree* this = THIS; s32 bgId; if (!OBJTREE_ISLARGE(&this->dyna.actor)) { bgId = this->dyna.bgId; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, bgId); } - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } void ObTree_SetupDoNothing(ObjTree* this) { this->actionFunc = ObTree_DoNothing; } -void ObTree_DoNothing(ObjTree* this, GlobalContext* globalCtx) { +void ObTree_DoNothing(ObjTree* this, PlayState* play) { } void ObTree_SetupSway(ObjTree* this) { @@ -145,7 +145,7 @@ void ObTree_SetupSway(ObjTree* this) { this->actionFunc = ObTree_Sway; } -void ObTree_Sway(ObjTree* this, GlobalContext* globalCtx) { +void ObTree_Sway(ObjTree* this, PlayState* play) { if (this->timer > 80) { ObTree_SetupDoNothing(this); return; @@ -159,12 +159,12 @@ void ObTree_Sway(ObjTree* this, GlobalContext* globalCtx) { this->timer++; } -void ObTree_UpdateCollision(ObjTree* this, GlobalContext* globalCtx) { +void ObTree_UpdateCollision(ObjTree* this, PlayState* play) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->dyna.actor.xzDistToPlayer < 600.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->dyna.actor.home.rot.y == 1) { this->dyna.actor.home.rot.y = 0; ObTree_SetupSway(this); @@ -172,26 +172,26 @@ void ObTree_UpdateCollision(ObjTree* this, GlobalContext* globalCtx) { } } -void ObjTree_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjTree_Update(Actor* thisx, PlayState* play) { ObjTree* this = THIS; - this->actionFunc(this, globalCtx); - ObTree_UpdateCollision(this, globalCtx); + this->actionFunc(this, play); + ObTree_UpdateCollision(this, play); } -void ObjTree_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjTree_Draw(Actor* thisx, PlayState* play) { s16 xRot = (f32)thisx->shape.rot.x; s16 zRot = (f32)thisx->shape.rot.z; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(globalCtx->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tree_DL_000680); Matrix_RotateZYX(xRot, 0, zRot, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_tree_DL_0007C8); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h index b50e3eb408..828530ab37 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.h @@ -5,7 +5,7 @@ struct ObjTree; -typedef void (*ObjTreeActionFunc)(struct ObjTree*, GlobalContext*); +typedef void (*ObjTreeActionFunc)(struct ObjTree*, PlayState*); #define OBJTREE_ISLARGE(thisx) ((thisx)->params & 0x8000) 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 3f7dc42740..d4bc4d34f1 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -14,27 +14,27 @@ #define THIS ((ObjTsubo*)thisx) -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_PotBreak1(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_RacePotBreak1(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_PotBreak2(ObjTsubo* this, GlobalContext* globalCtx2); -void ObjTsubo_RacePotBreak2(ObjTsubo* this, GlobalContext* globalCtx2); -void ObjTsubo_PotBreak3(ObjTsubo* this, GlobalContext* globalCtx2); -void ObjTsubo_RacePotBreak3(ObjTsubo* this, GlobalContext* globalCtx2); +void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play); +void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play); +void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2); +void ObjTsubo_RacePotBreak2(ObjTsubo* this, PlayState* play2); +void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2); +void ObjTsubo_RacePotBreak3(ObjTsubo* this, PlayState* play2); void func_80928914(ObjTsubo* this); -void func_80928928(ObjTsubo* this, GlobalContext* globalCtx); +void func_80928928(ObjTsubo* this, PlayState* play); void func_809289B4(ObjTsubo* this); -void func_809289E4(ObjTsubo* this, GlobalContext* globalCtx); +void func_809289E4(ObjTsubo* this, PlayState* play); void func_80928D6C(ObjTsubo* this); -void func_80928D80(ObjTsubo* this, GlobalContext* globalCtx); +void func_80928D80(ObjTsubo* this, PlayState* play); void func_80928E74(ObjTsubo* this); -void func_80928F18(ObjTsubo* this, GlobalContext* globalCtx); +void func_80928F18(ObjTsubo* this, PlayState* play); void func_809291DC(ObjTsubo* this); -void func_8092926C(ObjTsubo* this, GlobalContext* globalCtx); +void func_8092926C(ObjTsubo* this, PlayState* play); s16 D_80929500 = 0; s16 D_80929504 = 0; @@ -103,7 +103,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -s32 func_809275C0(ObjTsubo* this, GlobalContext* globalCtx) { +s32 func_809275C0(ObjTsubo* this, PlayState* play) { s32 chestFlag = -1; s32 skulltulaParams = (OBJ_TSUBO_P001F(&this->actor) << 2) | 0xFF01; @@ -111,40 +111,40 @@ s32 func_809275C0(ObjTsubo* this, GlobalContext* globalCtx) { chestFlag = ENSW_GETS_3FC(skulltulaParams); } - return (chestFlag < 0) == true || !Flags_GetTreasure(globalCtx, chestFlag); + return (chestFlag < 0) == true || !Flags_GetTreasure(play, chestFlag); } -void func_8092762C(ObjTsubo* this, GlobalContext* globalCtx) { +void func_8092762C(ObjTsubo* this, PlayState* play) { if (!OBJ_TSUBO_P0010(&this->actor) && (OBJ_TSUBO_ZROT(&this->actor) != 2)) { - Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, OBJ_TSUBO_P000F(&this->actor) << 4); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, OBJ_TSUBO_P000F(&this->actor) << 4); } } -void func_80927690(ObjTsubo* this, GlobalContext* globalCtx) { +void func_80927690(ObjTsubo* this, PlayState* play) { s32 itemDrop; if (!this->unk_197 && (OBJ_TSUBO_ZROT(&this->actor) != 2)) { itemDrop = func_800A8150(OBJ_TSUBO_P003F(&this->actor)); if (itemDrop > ITEM00_NO_DROP) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, (OBJ_TSUBO_PFE00(&this->actor) << 8) | itemDrop); + Item_DropCollectible(play, &this->actor.world.pos, (OBJ_TSUBO_PFE00(&this->actor) << 8) | itemDrop); this->unk_197 = true; } } } -void ObjTsubo_SpawnBoes(ObjTsubo* this, GlobalContext* globalCtx, s32 arg2) { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MKK, this->actor.world.pos.x, this->actor.world.pos.y, +void ObjTsubo_SpawnBoes(ObjTsubo* this, PlayState* play, s32 arg2) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MKK, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 2); } -void ObjTsubo_SpawnGoldSkulltula(ObjTsubo* this, GlobalContext* globalCtx, s32 arg2) { +void ObjTsubo_SpawnGoldSkulltula(ObjTsubo* this, PlayState* play, s32 arg2) { Actor* child; s32 params; - if (func_809275C0(this, globalCtx)) { + if (func_809275C0(this, play)) { params = (OBJ_TSUBO_P001F(&this->actor) << 2) | 0xFF01; - child = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, (u32)Rand_Next() >> 0x10, 0, params); + child = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, (u32)Rand_Next() >> 0x10, 0, params); if (child != NULL) { child->parent = &this->actor; child->velocity.y = 0.0f; @@ -153,25 +153,25 @@ void ObjTsubo_SpawnGoldSkulltula(ObjTsubo* this, GlobalContext* globalCtx, s32 a } } -void func_80927818(ObjTsubo* this, GlobalContext* globalCtx, s32 arg2) { +void func_80927818(ObjTsubo* this, PlayState* play, s32 arg2) { if (OBJ_TSUBO_ZROT(&this->actor) == 1) { - ObjTsubo_SpawnBoes(this, globalCtx, arg2); + ObjTsubo_SpawnBoes(this, play, arg2); } else if (OBJ_TSUBO_ZROT(&this->actor) == 2) { - ObjTsubo_SpawnGoldSkulltula(this, globalCtx, arg2); + ObjTsubo_SpawnGoldSkulltula(this, play, arg2); } } -s32 ObjTsubo_IsSceneNotGohtOrTwinmold(ObjTsubo* this, GlobalContext* globalCtx) { - return (globalCtx->sceneNum != SCENE_HAKUGIN_BS) && (globalCtx->sceneNum != SCENE_INISIE_BS); +s32 ObjTsubo_IsSceneNotGohtOrTwinmold(ObjTsubo* this, PlayState* play) { + return (play->sceneNum != SCENE_HAKUGIN_BS) && (play->sceneNum != SCENE_INISIE_BS); } -void func_8092788C(ObjTsubo* this, GlobalContext* globalCtx) { - if (!this->unk_197 && (globalCtx->roomCtx.currRoom.num != this->homeRoom)) { +void func_8092788C(ObjTsubo* this, PlayState* play) { + if (!this->unk_197 && (play->roomCtx.currRoom.num != this->homeRoom)) { this->unk_197 = true; } } -void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; s32 pad; s32 type = OBJ_TSUBO_GET_TYPE(&this->actor); @@ -182,38 +182,38 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, sPotTypeData[type].scale); this->actor.shape.rot.z = 0; this->actor.world.rot.z = 0; - Collider_InitCylinder(globalCtx, &this->cylinderCollider); - Collider_SetCylinder(globalCtx, &this->cylinderCollider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->cylinderCollider); + Collider_SetCylinder(play, &this->cylinderCollider, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->cylinderCollider); this->cylinderCollider.dim.radius = sPotTypeData[type].radius; this->cylinderCollider.dim.height = sPotTypeData[type].height; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sPotTypeData[type].objId); + this->objBankIndex = Object_GetIndex(&play->objectCtx, sPotTypeData[type].objId); if (this->objBankIndex < 0) { Actor_MarkForDeath(&this->actor); } else { this->actor.shape.shadowScale = 1.8f; this->homeRoom = this->actor.room; if ((type != OBJ_TSUBO_TYPE_3) && (sp2C != 2)) { - if (Item_CanDropBigFairy(globalCtx, OBJ_TSUBO_P003F(&this->actor), OBJ_TSUBO_PFE00(&this->actor))) { + if (Item_CanDropBigFairy(play, OBJ_TSUBO_P003F(&this->actor), OBJ_TSUBO_PFE00(&this->actor))) { this->unk_198 = true; } } - if ((type == OBJ_TSUBO_TYPE_3) || (sp2C != 2) || !func_809275C0(this, globalCtx)) { + if ((type == OBJ_TSUBO_TYPE_3) || (sp2C != 2) || !func_809275C0(this, play)) { this->unk_19A = -1; } func_80928914(this); } } -void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = (GlobalContext*)globalCtx2; +void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; ObjTsubo* this = (ObjTsubo*)thisx; - Collider_DestroyCylinder(globalCtx, &this->cylinderCollider); + Collider_DestroyCylinder(play, &this->cylinderCollider); } -void ObjTsubo_PotBreak1(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play) { s16 rot; s32 i; s32 phi_s0; @@ -246,14 +246,14 @@ void ObjTsubo_PotBreak1(ObjTsubo* this, GlobalContext* globalCtx) { phi_s0 = 0x20; } scale = Rand_ZeroOne() * 110.0f + 15.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, typeData->objId, typeData->shardDL); } - func_800BBFB0(globalCtx, &this->actor.world.pos, 30.0f, 2, 20, 50, true); - func_800BBFB0(globalCtx, &this->actor.world.pos, 30.0f, 2, 10, 80, true); + func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 20, 50, true); + func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 10, 80, true); } -void ObjTsubo_RacePotBreak1(ObjTsubo* this, GlobalContext* globalCtx) { +void ObjTsubo_RacePotBreak1(ObjTsubo* this, PlayState* play) { s16 rot; s32 phi_s0; s32 i; @@ -285,15 +285,15 @@ void ObjTsubo_RacePotBreak1(ObjTsubo* this, GlobalContext* globalCtx) { phi_s0 = 0xA0; } scale = Rand_ZeroOne() * 160.0f + 15.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, &this->actor.world.pos, -340, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -340, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, typeData->objId, typeData->shardDL); } - func_800BBFB0(globalCtx, &this->actor.world.pos, 50.0f, 2, 40, 50, true); - func_800BBFB0(globalCtx, &this->actor.world.pos, 50.0f, 2, 20, 80, true); + func_800BBFB0(play, &this->actor.world.pos, 50.0f, 2, 40, 50, true); + func_800BBFB0(play, &this->actor.world.pos, 50.0f, 2, 20, 80, true); } -void ObjTsubo_PotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = (GlobalContext*)globalCtx2; +void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2) { + PlayState* play = (PlayState*)play2; s16 rot; s32 i; s32 phi_s0; @@ -310,11 +310,11 @@ void ObjTsubo_PotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { for (rot = 0, i = 0; i < 5; i++, rot += 0x10000 / 5) { pos.x = Math_SinS((s32)(Rand_ZeroOne() * 6000) + rot) * 15.0f + worldPos->x; pos.z = Math_CosS((s32)(Rand_ZeroOne() * 6000) + rot) * 15.0f + worldPos->z; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 350); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 350); } pos.x = worldPos->x; pos.z = worldPos->z; - EffectSsGRipple_Spawn(globalCtx, &pos, 200, 600, 0); + EffectSsGRipple_Spawn(play, &pos, 200, 600, 0); for (i = 0, rot = 0; i < 13; rot += 0x4E20, i++) { sin = Math_SinS(rot); cos = Math_CosS(rot); @@ -331,13 +331,13 @@ void ObjTsubo_PotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { phi_s0 = 0x20; } scale = Rand_ZeroOne() * 105.0f + 10.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, - typeData->objId, typeData->shardDL); + EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objId, + typeData->shardDL); } } -void ObjTsubo_RacePotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = (GlobalContext*)globalCtx2; +void ObjTsubo_RacePotBreak2(ObjTsubo* this, PlayState* play2) { + PlayState* play = (PlayState*)play2; s32 pad; s16 rot; s32 i; @@ -355,11 +355,11 @@ void ObjTsubo_RacePotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { for (rot = 0, i = 0; i < 5; i++, rot += 0x10000 / 5) { pos.x = Math_SinS((s32)(Rand_ZeroOne() * 6000) + rot) * 30.0f + worldPos->x; pos.z = Math_CosS((s32)(Rand_ZeroOne() * 6000) + rot) * 30.0f + worldPos->z; - EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 350); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 350); } pos.x = worldPos->x; pos.z = worldPos->z; - EffectSsGRipple_Spawn(globalCtx, &pos, 300, 700, 0); + EffectSsGRipple_Spawn(play, &pos, 300, 700, 0); for (i = 0, rot = 0; i < 15; rot += 0x4E20, i++) { sin = Math_SinS(rot); cos = Math_CosS(rot); @@ -376,13 +376,13 @@ void ObjTsubo_RacePotBreak2(ObjTsubo* this, GlobalContext* globalCtx2) { phi_s0 = 0xA0; } scale = (Rand_ZeroOne() * 150.0f) + 10.0f; - EffectSsKakera_Spawn(globalCtx, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, - typeData->objId, typeData->shardDL); + EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objId, + typeData->shardDL); } } -void ObjTsubo_PotBreak3(ObjTsubo* this, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = (GlobalContext*)globalCtx2; +void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2) { + PlayState* play = (PlayState*)play2; s32 i; s16 rot; s32 phi_s0; @@ -412,26 +412,26 @@ void ObjTsubo_PotBreak3(ObjTsubo* this, GlobalContext* globalCtx2) { } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(globalCtx, &pos, &vel, &this->actor.world.pos, -170, phi_s0, 50, 3, 0, + EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -170, phi_s0, 50, 3, 0, (Rand_ZeroOne() * 105.0f) + 10.0f, 0, 0, 70, -1, typeData->objId, typeData->shardDL); } for (i = 0; i < 7; i++) { - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 20.0f, 30.0f, 40.0f, (Rand_ZeroOne() * 0.06f) + 0.09f); - EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.08f) + 0.09f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 30.0f, 40.0f, (Rand_ZeroOne() * 0.06f) + 0.09f); + EffectSsBubble_Spawn(play, &this->actor.world.pos, 10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.08f) + 0.09f); } } -void ObjTsubo_RacePotBreak3(ObjTsubo* this, GlobalContext* globalCtx2) { +void ObjTsubo_RacePotBreak3(ObjTsubo* this, PlayState* play2) { } void func_80928914(ObjTsubo* this) { this->actionFunc = func_80928928; } -void func_80928928(ObjTsubo* this, GlobalContext* globalCtx) { +void func_80928928(ObjTsubo* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; func_809289B4(this); } @@ -444,7 +444,7 @@ void func_809289B4(ObjTsubo* this) { this->actionFunc = func_809289E4; } -void func_809289E4(ObjTsubo* this, GlobalContext* globalCtx) { +void func_809289E4(ObjTsubo* this, PlayState* play) { ObjTsuboData* typeData; s32 pad; s32 type = OBJ_TSUBO_GET_TYPE(&this->actor); @@ -457,13 +457,13 @@ void func_809289E4(ObjTsubo* this, GlobalContext* globalCtx) { if (this->cylinderCollider.base.ocFlags1 & OC1_HIT) { this->cylinderCollider.base.ocFlags1 &= ~OC1_HIT; } - if (Actor_HasParent(&this->actor, globalCtx)) { + if (Actor_HasParent(&this->actor, play)) { this->actor.room = -1; this->actor.flags |= ACTOR_FLAG_10; if ((type != OBJ_TSUBO_TYPE_3) && func_800A817C(OBJ_TSUBO_P003F(&this->actor))) { - func_80927690(this, globalCtx); + func_80927690(this, play); } - func_80927818(this, globalCtx, 0); + func_80927818(this, play, 0); //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the collider func_800B8E58((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); @@ -473,18 +473,18 @@ void func_809289E4(ObjTsubo* this, GlobalContext* globalCtx) { typeData = &sPotTypeData[type]; this->unk_19B = 0; if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f)) { - typeData->breakPot3(this, globalCtx); + typeData->breakPot3(this, play); } else { - typeData->breakPot1(this, globalCtx); + typeData->breakPot1(this, play); } if (type == OBJ_TSUBO_TYPE_3) { - func_8092762C(this, globalCtx); + func_8092762C(this, play); } else { - func_80927690(this, globalCtx); + func_80927690(this, play); } - func_80927818(this, globalCtx, 1); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, globalCtx)) { + func_80927818(this, play, 1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, play)) { Actor_MarkForDeath(&this->actor); } else { func_809291DC(this); @@ -492,24 +492,23 @@ void func_809289E4(ObjTsubo* this, GlobalContext* globalCtx) { } else { if (!this->unk_195) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); - if ((this->actor.bgCheckFlags & 1) && - (DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId) == NULL)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + if ((this->actor.bgCheckFlags & 1) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_195 = true; this->actor.flags &= ~ACTOR_FLAG_10; } } if ((this->actor.xzDistToPlayer < 800.0f) || (gSaveContext.save.entranceIndex == 0xD010)) { Collider_UpdateCylinder(&this->actor, &this->cylinderCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinderCollider.base); if (this->actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinderCollider.base); if (this->actor.xzDistToPlayer < 100.0f) { - s16 yawDiff = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; + s16 yawDiff = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; s32 absYawDiff = ABS_ALT(yawDiff); if (absYawDiff > DEGF_TO_BINANG(120.0f)) { - Actor_PickUp(&this->actor, globalCtx, 0, 36.0f, 30.0f); + Actor_PickUp(&this->actor, play, 0, 36.0f, 30.0f); } } } @@ -521,24 +520,24 @@ void func_80928D6C(ObjTsubo* this) { this->actionFunc = func_80928D80; } -void func_80928D80(ObjTsubo* this, GlobalContext* globalCtx) { +void func_80928D80(ObjTsubo* this, PlayState* play) { s32 pad; Vec3f pos; s32 bgId; - func_8092788C(this, globalCtx); - if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomCtx.currRoom.num; + func_8092788C(this, play); + if (Actor_HasNoParent(&this->actor, play)) { + this->actor.room = play->roomCtx.currRoom.num; Actor_MoveWithGravity(&this->actor); this->actor.flags &= ~ACTOR_FLAG_4000000; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); func_80928E74(this); } else { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; pos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos); } } @@ -552,7 +551,7 @@ void func_80928E74(ObjTsubo* this) { this->actionFunc = func_80928F18; } -void func_80928F18(ObjTsubo* this, GlobalContext* globalCtx) { +void func_80928F18(ObjTsubo* this, PlayState* play) { s32 pad; ObjTsuboData* typeData; s32 type = OBJ_TSUBO_GET_TYPE(&this->actor); @@ -562,35 +561,35 @@ void func_80928F18(ObjTsubo* this, GlobalContext* globalCtx) { if (atHit) { this->cylinderCollider.base.atFlags &= ~AT_HIT; } - func_8092788C(this, globalCtx); + func_8092788C(this, play); if (this->unk_194 > 0) { this->unk_194--; } typeData = &sPotTypeData[type]; if ((this->actor.bgCheckFlags & 0xB) || atHit || (this->unk_194 <= 0)) { - typeData->breakPot1(this, globalCtx); + typeData->breakPot1(this, play); if (type == OBJ_TSUBO_TYPE_3) { - func_8092762C(this, globalCtx); + func_8092762C(this, play); } else { - func_80927690(this, globalCtx); + func_80927690(this, play); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, globalCtx)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, play)) { Actor_MarkForDeath(&this->actor); } else { func_809291DC(this); } } else if (this->actor.bgCheckFlags & 0x40) { - typeData->breakPot2(this, globalCtx); + typeData->breakPot2(this, play); if (type == OBJ_TSUBO_TYPE_3) { - func_8092762C(this, globalCtx); + func_8092762C(this, play); } else { - func_80927690(this, globalCtx); + func_80927690(this, play); } - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); - if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, globalCtx)) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); + if (ObjTsubo_IsSceneNotGohtOrTwinmold(this, play)) { Actor_MarkForDeath(&this->actor); } else { func_809291DC(this); @@ -601,10 +600,10 @@ void func_80928F18(ObjTsubo* this, GlobalContext* globalCtx) { Math_StepToS(&D_8092950C, D_80929508, 150); this->actor.shape.rot.x += D_80929504; this->actor.shape.rot.y += D_8092950C; - Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); Collider_UpdateCylinder(&this->actor, &this->cylinderCollider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinderCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinderCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinderCollider.base); } } @@ -627,7 +626,7 @@ void func_809291DC(ObjTsubo* this) { this->actionFunc = func_8092926C; } -void func_8092926C(ObjTsubo* this, GlobalContext* globalCtx) { +void func_8092926C(ObjTsubo* this, PlayState* play) { f32 scale; if (this->unk_194 > 0) { @@ -645,10 +644,10 @@ void func_8092926C(ObjTsubo* this, GlobalContext* globalCtx) { } } -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); if (this->actor.draw == NULL) { this->actor.shape.shadowDraw = NULL; } else if (this->actor.projectedPos.z < 811.0f) { @@ -666,7 +665,7 @@ void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) { } if (!this->unk_197) { if (this->unk_198) { - globalCtx->actorCtx.unk5 |= 8; + play->actorCtx.unk5 |= 8; this->actor.flags |= ACTOR_FLAG_10; } if (this->unk_19A >= 0) { @@ -684,8 +683,8 @@ void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = (GlobalContext*)globalCtx2; +void ObjTsubo_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; - Gfx_DrawDListOpa(globalCtx, sPotTypeData[OBJ_TSUBO_GET_TYPE(thisx)].modelDL); + Gfx_DrawDListOpa(play, sPotTypeData[OBJ_TSUBO_GET_TYPE(thisx)].modelDL); } 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 01d4bb82f1..a12c0b5883 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -5,9 +5,9 @@ struct ObjTsubo; -typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, GlobalContext*); +typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, PlayState*); -typedef void (*ObjTsuboUnkFunc)(struct ObjTsubo*, GlobalContext*); +typedef void (*ObjTsuboUnkFunc)(struct ObjTsubo*, PlayState*); #define OBJ_TSUBO_P000F(thisx) ((thisx)->params & 0x0F) #define OBJ_TSUBO_P001F(thisx) ((thisx)->params & 0x1F) diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 324d13e4b0..5175a8ee10 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -10,26 +10,26 @@ #define THIS ((ObjUm*)thisx) -void ObjUm_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjUm_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjUm_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjUm_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjUm_Init(Actor* thisx, PlayState* play); +void ObjUm_Destroy(Actor* thisx, PlayState* play); +void ObjUm_Update(Actor* thisx, PlayState* play); +void ObjUm_Draw(Actor* thisx, PlayState* play); -void func_80B79A50(ObjUm* this, GlobalContext* globalCtx); -void func_80B79F10(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A070(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A0E0(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A144(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A2AC(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A394(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A400(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A494(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A614(ObjUm* this, GlobalContext* globalCtx); -void func_80B7A7AC(ObjUm* this, GlobalContext* globalCtx); -void func_80B7ABE4(ObjUm* this, GlobalContext* globalCtx); -void func_80B7AC94(ObjUm* this, GlobalContext* globalCtx); -void func_80B7AD34(ObjUm* this, GlobalContext* globalCtx); -void func_80B7AE58(ObjUm* this, GlobalContext* globalCtx); +void func_80B79A50(ObjUm* this, PlayState* play); +void func_80B79F10(ObjUm* this, PlayState* play); +void func_80B7A070(ObjUm* this, PlayState* play); +void func_80B7A0E0(ObjUm* this, PlayState* play); +void func_80B7A144(ObjUm* this, PlayState* play); +void func_80B7A2AC(ObjUm* this, PlayState* play); +void func_80B7A394(ObjUm* this, PlayState* play); +void func_80B7A400(ObjUm* this, PlayState* play); +void func_80B7A494(ObjUm* this, PlayState* play); +void func_80B7A614(ObjUm* this, PlayState* play); +void func_80B7A7AC(ObjUm* this, PlayState* play); +void func_80B7ABE4(ObjUm* this, PlayState* play); +void func_80B7AC94(ObjUm* this, PlayState* play); +void func_80B7AD34(ObjUm* this, PlayState* play); +void func_80B7AE58(ObjUm* this, PlayState* play); void ObjUm_SetupAction(ObjUm* this, ObjUmActionFunc actionFunc); diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.h b/src/overlays/actors/ovl_Obj_Um/z_obj_um.h index 1487c561f5..b421187e44 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.h +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.h @@ -5,7 +5,7 @@ struct ObjUm; -typedef void (*ObjUmActionFunc)(struct ObjUm*, GlobalContext*); +typedef void (*ObjUmActionFunc)(struct ObjUm*, PlayState*); typedef struct ObjUm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index 35371b6050..e895eeba9b 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -10,10 +10,10 @@ #define THIS ((ObjUsiyane*)thisx) -void ObjUsiyane_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjUsiyane_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjUsiyane_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjUsiyane_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjUsiyane_Init(Actor* thisx, PlayState* play); +void ObjUsiyane_Destroy(Actor* thisx, PlayState* play); +void ObjUsiyane_Update(Actor* thisx, PlayState* play); +void ObjUsiyane_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Usiyane_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h index 664da07e49..351bc93b1b 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h @@ -5,7 +5,7 @@ struct ObjUsiyane; -typedef void (*ObjUsiyaneActionFunc)(struct ObjUsiyane*, GlobalContext*); +typedef void (*ObjUsiyaneActionFunc)(struct ObjUsiyane*, PlayState*); typedef struct ObjUsiyane { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c index 8741fc01bc..e0d07c4fb6 100644 --- a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c +++ b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c @@ -11,9 +11,9 @@ #define THIS ((ObjVisiblock*)thisx) -void ObjVisiblock_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjVisiblock_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjVisiblock_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjVisiblock_Init(Actor* thisx, PlayState* play); +void ObjVisiblock_Destroy(Actor* thisx, PlayState* play); +void ObjVisiblock_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Visiblock_InitVars = { ACTOR_OBJ_VISIBLOCK, @@ -34,20 +34,20 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -void ObjVisiblock_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjVisiblock_Init(Actor* thisx, PlayState* play) { ObjVisiblock* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_visiblock_Colheader_000AD0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_visiblock_Colheader_000AD0); } -void ObjVisiblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjVisiblock_Destroy(Actor* thisx, PlayState* play) { ObjVisiblock* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjVisiblock_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListXlu(globalCtx, object_visiblock_DL_000140); +void ObjVisiblock_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListXlu(play, object_visiblock_DL_000140); } diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c index 067bd58ecc..93400d4a8f 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c @@ -11,21 +11,21 @@ #define THIS ((ObjVspinyroll*)thisx) -void ObjVspinyroll_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjVspinyroll_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjVspinyroll_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjVspinyroll_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjVspinyroll_Init(Actor* thisx, PlayState* play); +void ObjVspinyroll_Destroy(Actor* thisx, PlayState* play); +void ObjVspinyroll_Update(Actor* thisx, PlayState* play); +void ObjVspinyroll_Draw(Actor* thisx, PlayState* play); void func_80A3CEC4(ObjVspinyroll* this); -void func_80A3CEE0(ObjVspinyroll* this, GlobalContext* globalCtx); -void func_80A3CF4C(ObjVspinyroll* this, GlobalContext* globalCtx); +void func_80A3CEE0(ObjVspinyroll* this, PlayState* play); +void func_80A3CF4C(ObjVspinyroll* this, PlayState* play); void func_80A3CFAC(ObjVspinyroll* this); -void func_80A3CFE0(ObjVspinyroll* this, GlobalContext* globalCtx); +void func_80A3CFE0(ObjVspinyroll* this, PlayState* play); void func_80A3D024(ObjVspinyroll* this); -void func_80A3D038(ObjVspinyroll* this, GlobalContext* globalCtx); +void func_80A3D038(ObjVspinyroll* this, PlayState* play); void func_80A3D0E8(ObjVspinyroll* this); -void func_80A3D0FC(ObjVspinyroll* this, GlobalContext* globalCtx); -void func_80A3D2C0(Actor* thisx, GlobalContext* globalCtx); +void func_80A3D0FC(ObjVspinyroll* this, PlayState* play); +void func_80A3D2C0(Actor* thisx, PlayState* play); const ActorInit Obj_Vspinyroll_InitVars = { ACTOR_OBJ_VSPINYROLL, @@ -159,7 +159,7 @@ void func_80A3C7E8(ObjVspinyroll* this) { } } -s32 func_80A3C8D8(ObjVspinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s32 arg3) { +s32 func_80A3C8D8(ObjVspinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { s32 pad; ObjVspinyrollStruct3* unk_1A8 = &this->unk_1A8; ObjVspinyrollStruct2* ptr; @@ -194,8 +194,8 @@ s32 func_80A3C8D8(ObjVspinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s3 spCC.x += 30.0f * this->unk_3B4.x; spCC.z += 30.0f * this->unk_3B4.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spD8, &spCC, &spC0, &unk_1A8->unk_000[i].collisionPoly, true, - false, false, true, &unk_1A8->unk_000[i].bgId, &this->dyna.actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &spD8, &spCC, &spC0, &unk_1A8->unk_000[i].collisionPoly, true, false, + false, true, &unk_1A8->unk_000[i].bgId, &this->dyna.actor, 0.0f)) { if ((arg3 != 0) && (this->dyna.actor.flags & ACTOR_FLAG_40)) { spA8.x = ptr->unk_00.x * 0.2f; spA8.y = ptr->unk_00.y; @@ -207,7 +207,7 @@ s32 func_80A3C8D8(ObjVspinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s3 spB4.y += this->dyna.actor.world.pos.y; spB4.z += this->dyna.actor.world.pos.z; - EffectSsHitMark_SpawnFixedScale(globalCtx, 3, &spB4); + EffectSsHitMark_SpawnFixedScale(play, 3, &spB4); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); } @@ -224,10 +224,10 @@ s32 func_80A3C8D8(ObjVspinyroll* this, GlobalContext* globalCtx, Vec3f* arg2, s3 return sp9C; } -s32 func_80A3CB94(ObjVspinyroll* this, GlobalContext* globalCtx, s32 arg2) { +s32 func_80A3CB94(ObjVspinyroll* this, PlayState* play, s32 arg2) { Vec3f sp1C; - if (func_80A3C8D8(this, globalCtx, &sp1C, arg2)) { + if (func_80A3C8D8(this, play, &sp1C, arg2)) { this->dyna.actor.world.pos.x += sp1C.x; this->dyna.actor.world.pos.z += sp1C.z; return true; @@ -235,15 +235,15 @@ s32 func_80A3CB94(ObjVspinyroll* this, GlobalContext* globalCtx, s32 arg2) { return false; } -DynaPolyActor* func_80A3CBF0(ObjVspinyroll* this, GlobalContext* globalCtx) { +DynaPolyActor* func_80A3CBF0(ObjVspinyroll* this, PlayState* play) { if (this->unk_1A8.unk_1E0 != NULL) { - return DynaPoly_GetActor(&globalCtx->colCtx, this->unk_1A8.unk_1E0->bgId); + return DynaPoly_GetActor(&play->colCtx, this->unk_1A8.unk_1E0->bgId); } return NULL; } -s32 func_80A3CC30(ObjVspinyroll* this, GlobalContext* globalCtx) { - DynaPolyActor* actor = func_80A3CBF0(this, globalCtx); +s32 func_80A3CC30(ObjVspinyroll* this, PlayState* play) { + DynaPolyActor* actor = func_80A3CBF0(this, play); if ((actor != NULL) && (Math3D_Vec3fDistSq(&actor->actor.world.pos, &actor->actor.prevPos) > 0.0001f)) { return true; @@ -257,7 +257,7 @@ void func_80A3CC84(f32 arg0) { matrix->yw += arg0; } -void ObjVspinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjVspinyroll_Init(Actor* thisx, PlayState* play) { s32 pad; ObjVspinyroll* this = THIS; s32 params = OBJVSPINYROLL_GET_4000(&this->dyna.actor); @@ -280,10 +280,10 @@ void ObjVspinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.scale.x = 0.1f; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_spinyroll_Colheader_000F80); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_spinyroll_Colheader_000F80); - 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); if (params == OBJVSPINYROLL_4000_1) { this->dyna.actor.draw = func_80A3D2C0; @@ -299,7 +299,7 @@ void ObjVspinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A3C7E8(this); this->unk_394 = D_80A3D458[OBJVSPINYROLL_GET_380(thisx)]; - path = &globalCtx->setupPathList[OBJVSPINYROLL_GET_7F(&this->dyna.actor)]; + path = &play->setupPathList[OBJVSPINYROLL_GET_7F(&this->dyna.actor)]; points = Lib_SegmentedToVirtual(path->points); point1 = &points[0]; point2 = &points[1]; @@ -314,11 +314,11 @@ void ObjVspinyroll_Init(Actor* thisx, GlobalContext* globalCtx) { func_80A3CFAC(this); } -void ObjVspinyroll_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjVspinyroll_Destroy(Actor* thisx, PlayState* play) { ObjVspinyroll* this = THIS; - 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_80A3CEC4(ObjVspinyroll* this) { @@ -326,7 +326,7 @@ void func_80A3CEC4(ObjVspinyroll* this) { this->actionFunc = func_80A3CEE0; } -void func_80A3CEE0(ObjVspinyroll* this, GlobalContext* globalCtx) { +void func_80A3CEE0(ObjVspinyroll* this, PlayState* play) { this->unk_3C0 += 0x6E; if (this->unk_3C0 > 0xFA0) { this->unk_3C0 = 0xFA0; @@ -339,7 +339,7 @@ void func_80A3CF10(ObjVspinyroll* this) { this->dyna.actor.speedXZ = 0.0f; } -void func_80A3CF4C(ObjVspinyroll* this, GlobalContext* globalCtx) { +void func_80A3CF4C(ObjVspinyroll* this, PlayState* play) { if (Math_ScaledStepToS(&this->unk_3C0, 0, this->unk_3C4) && (this->unk_3C8 > 0)) { this->unk_3C8--; if (this->unk_3C8 <= 0) { @@ -354,7 +354,7 @@ void func_80A3CFAC(ObjVspinyroll* this) { this->dyna.actor.speedXZ = 0.0f; } -void func_80A3CFE0(ObjVspinyroll* this, GlobalContext* globalCtx) { +void func_80A3CFE0(ObjVspinyroll* this, PlayState* play) { if (Math_ScaledStepToS(&this->unk_3C0, this->unk_3C2, 0x6E)) { func_80A3D024(this); } @@ -364,12 +364,12 @@ void func_80A3D024(ObjVspinyroll* this) { this->actionFunc = func_80A3D038; } -void func_80A3D038(ObjVspinyroll* this, GlobalContext* globalCtx) { +void func_80A3D038(ObjVspinyroll* this, PlayState* play) { s32 sp24 = func_80A3C700(this); - if (func_80A3CB94(this, globalCtx, 1)) { + if (func_80A3CB94(this, play, 1)) { this->unk_3C4 = 0x7D0; - if (func_80A3CBF0(this, globalCtx) != NULL) { + if (func_80A3CBF0(this, play) != NULL) { func_80A3D0E8(this); } else { func_80A3C6CC(this); @@ -386,11 +386,11 @@ void func_80A3D0E8(ObjVspinyroll* this) { this->actionFunc = func_80A3D0FC; } -void func_80A3D0FC(ObjVspinyroll* this, GlobalContext* globalCtx) { +void func_80A3D0FC(ObjVspinyroll* this, PlayState* play) { s32 sp24 = true; Math_ScaledStepToS(&this->unk_3C0, 0, this->unk_3C4); - if (func_80A3CB94(this, globalCtx, 0) && func_80A3CC30(this, globalCtx)) { + if (func_80A3CB94(this, play, 0) && func_80A3CC30(this, play)) { sp24 = false; } @@ -400,20 +400,20 @@ void func_80A3D0FC(ObjVspinyroll* this, GlobalContext* globalCtx) { } } -void ObjVspinyroll_Update(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjVspinyroll_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjVspinyroll* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); this->unk_3C6 += this->unk_3C0; Collider_UpdateCylinder(&this->dyna.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 ObjVspinyroll_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjVspinyroll_Draw(Actor* thisx, PlayState* play) { ObjVspinyroll* this = THIS; Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 60.0f, this->dyna.actor.world.pos.z, @@ -422,20 +422,20 @@ void ObjVspinyroll_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZS(this->dyna.actor.shape.rot.z + 0x4000, MTXMODE_APPLY); Matrix_RotateXS(this->dyna.actor.shape.rot.x + this->unk_3C6, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, object_spinyroll_DL_000460); + Gfx_DrawDListOpa(play, object_spinyroll_DL_000460); } -void func_80A3D2C0(Actor* thisx, GlobalContext* globalCtx) { +void func_80A3D2C0(Actor* thisx, PlayState* play) { ObjVspinyroll* this = THIS; Vec3s sp3C; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); sp3C.x = this->dyna.actor.shape.rot.x + this->unk_3C6; sp3C.y = this->dyna.actor.shape.rot.y; sp3C.z = this->dyna.actor.shape.rot.z + 0x4000; - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 60.0f, this->dyna.actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(sp3C.y, MTXMODE_APPLY); @@ -443,13 +443,13 @@ void func_80A3D2C0(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateXS(sp3C.x, MTXMODE_APPLY); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_spinyroll_DL_000460); func_80A3CC84(120.0f); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_spinyroll_DL_000460); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h index 15879f86ec..11913355da 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h @@ -5,7 +5,7 @@ struct ObjVspinyroll; -typedef void (*ObjVspinyrollActionFunc)(struct ObjVspinyroll*, GlobalContext*); +typedef void (*ObjVspinyrollActionFunc)(struct ObjVspinyroll*, PlayState*); #define OBJVSPINYROLL_GET_7F(thisx) ((thisx)->params & 0x7F) #define OBJVSPINYROLL_GET_380(thisx) (((thisx)->params >> 7) & 7) diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index c676b49606..03e1486d8f 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -12,15 +12,15 @@ #define THIS ((ObjWarpstone*)thisx) -void ObjWarpstone_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjWarpstone_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjWarpstone_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjWarpstone_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjWarpstone_Init(Actor* thisx, PlayState* play); +void ObjWarpstone_Destroy(Actor* thisx, PlayState* play); +void ObjWarpstone_Update(Actor* thisx, PlayState* play); +void ObjWarpstone_Draw(Actor* thisx, PlayState* play); void ObjWarpstone_SetupAction(ObjWarpstone* this, ObjWarpstoneActionFunc actionFunc); -s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, GlobalContext* globalCtx); -s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCtx); -s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCtx); -s32 ObjWarpstone_OpenedIdle(ObjWarpstone* this, GlobalContext* globalCtx); +s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, PlayState* play); +s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, PlayState* play); +s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, PlayState* play); +s32 ObjWarpstone_OpenedIdle(ObjWarpstone* this, PlayState* play); const ActorInit Obj_Warpstone_InitVars = { ACTOR_OBJ_WARPSTONE, @@ -64,11 +64,11 @@ void ObjWarpstone_SetupAction(ObjWarpstone* this, ObjWarpstoneActionFunc actionF this->actionFunc = actionFunc; } -void ObjWarpstone_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarpstone_Init(Actor* thisx, PlayState* play) { ObjWarpstone* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Actor_SetFocus(&this->dyna.actor, 40.0f); if (!OBJ_WARPSTONE_IS_ACTIVATED(OBJ_WARPSTONE_GET_ID(this))) { @@ -79,13 +79,13 @@ void ObjWarpstone_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjWarpstone_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarpstone_Destroy(Actor* thisx, PlayState* play) { ObjWarpstone* this = THIS; - Collider_DestroyCylinder(globalCtx, &this->collider); + Collider_DestroyCylinder(play, &this->collider); } -s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, GlobalContext* globalCtx) { +s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { ObjWarpstone_SetupAction(this, ObjWarpstone_BeginOpeningCutscene); return true; @@ -96,7 +96,7 @@ s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, GlobalContext* globalCtx) { } } -s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCtx) { +s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, PlayState* play) { if (this->dyna.actor.cutscene < 0 || ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); ObjWarpstone_SetupAction(this, ObjWarpstone_PlayOpeningCutscene); @@ -107,7 +107,7 @@ s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, GlobalContext* globalC return true; } -s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCtx) { +s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, PlayState* play) { if (this->openingCSTimer++ >= OBJ_WARPSTONE_TIMER_ACTIVATE_THRESHOLD) { ActorCutscene_Stop(this->dyna.actor.cutscene); Sram_ActivateOwl(OBJ_WARPSTONE_GET_ID(this)); @@ -125,53 +125,53 @@ s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, GlobalContext* globalCt return true; } -s32 ObjWarpstone_OpenedIdle(ObjWarpstone* this, GlobalContext* globalCtx) { +s32 ObjWarpstone_OpenedIdle(ObjWarpstone* this, PlayState* play) { /*You can save your progress and quit here.*/ this->dyna.actor.textId = 0xC01; return false; } -void ObjWarpstone_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjWarpstone_Update(Actor* thisx, PlayState* play) { ObjWarpstone* this = THIS; s32 pad; if (this->isTalking) { - if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { this->isTalking = false; - } else if ((Message_GetState(&globalCtx->msgCtx) == 4) && Message_ShouldAdvance(globalCtx)) { - if (globalCtx->msgCtx.choiceIndex != 0) { + } else if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex != 0) { func_8019F208(); - globalCtx->msgCtx.msgMode = 0x4D; - globalCtx->msgCtx.unk120D6 = 0; - globalCtx->msgCtx.unk120D4 = 0; + play->msgCtx.msgMode = 0x4D; + play->msgCtx.unk120D6 = 0; + play->msgCtx.unk120D4 = 0; gSaveContext.save.owlSaveLocation = OBJ_WARPSTONE_GET_ID(this); } else { - func_801477B4(globalCtx); + func_801477B4(play); } } - } else if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { + } else if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { this->isTalking = true; - } else if (!this->actionFunc(this, globalCtx)) { - func_800B863C(&this->dyna.actor, globalCtx); + } else if (!this->actionFunc(this, play)) { + func_800B863C(&this->dyna.actor, play); } - Collider_ResetCylinderAC(globalCtx, &this->collider.base); + Collider_ResetCylinderAC(play, &this->collider.base); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - 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 ObjWarpstone_Draw(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void ObjWarpstone_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjWarpstone* this = THIS; - Gfx_DrawDListOpa(globalCtx, sOwlStatueDLs[this->modelIndex]); + Gfx_DrawDListOpa(play, sOwlStatueDLs[this->modelIndex]); if (this->dyna.actor.home.rot.x != 0) { - OPEN_DISPS(globalCtx->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 34.0f, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 30.0f, MTXMODE_APPLY); Matrix_Scale(this->dyna.actor.velocity.x, this->dyna.actor.velocity.x, this->dyna.actor.velocity.x, MTXMODE_APPLY); @@ -179,13 +179,13 @@ void ObjWarpstone_Draw(Actor* thisx, GlobalContext* globalCtx2) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, this->dyna.actor.home.rot.x); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255); - Matrix_RotateZF((((globalCtx->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_RotateZF((((play->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); Matrix_Pop(); - Matrix_RotateZF((~((globalCtx->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Matrix_RotateZF((~((play->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h index 37cfb99abd..ace6e88968 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h @@ -5,7 +5,7 @@ struct ObjWarpstone; -typedef s32 (*ObjWarpstoneActionFunc)(struct ObjWarpstone* this, GlobalContext* globalCtx); +typedef s32 (*ObjWarpstoneActionFunc)(struct ObjWarpstone* this, PlayState* play); typedef enum { /* 0 */ SEK_MODEL_CLOSED, diff --git a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c index f72645e49c..567d9a92e5 100644 --- a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c +++ b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c @@ -10,10 +10,10 @@ #define THIS ((ObjWind*)thisx) -void ObjWind_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjWind_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjWind_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjWind_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjWind_Init(Actor* thisx, PlayState* play); +void ObjWind_Destroy(Actor* thisx, PlayState* play); +void ObjWind_Update(Actor* thisx, PlayState* play); +void ObjWind_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Wind_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 34d82523ff..bd702c6932 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -10,17 +10,17 @@ #define THIS ((ObjWturn*)thisx) -void ObjWturn_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjWturn_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjWturn_Init(Actor* thisx, PlayState* play); +void ObjWturn_Update(Actor* thisx, PlayState* play); void func_808A7954(ObjWturn* this); -void func_808A7968(ObjWturn* this, GlobalContext* globalCtx); +void func_808A7968(ObjWturn* this, PlayState* play); void func_808A7A24(ObjWturn* this); -void func_808A7A5C(ObjWturn* this, GlobalContext* globalCtx); -void func_808A7AAC(ObjWturn* this, GlobalContext* globalCtx); -void func_808A7BA0(ObjWturn* this, GlobalContext* globalCtx); -void func_808A7C04(ObjWturn* this, GlobalContext* globalCtx); -void func_808A7C78(ObjWturn* this, GlobalContext* globalCtx); +void func_808A7A5C(ObjWturn* this, PlayState* play); +void func_808A7AAC(ObjWturn* this, PlayState* play); +void func_808A7BA0(ObjWturn* this, PlayState* play); +void func_808A7C04(ObjWturn* this, PlayState* play); +void func_808A7C78(ObjWturn* this, PlayState* play); const ActorInit Obj_Wturn_InitVars = { ACTOR_OBJ_WTURN, ACTORCAT_ITEMACTION, FLAGS, @@ -28,7 +28,7 @@ const ActorInit Obj_Wturn_InitVars = { (ActorFunc)Actor_Noop, (ActorFunc)ObjWturn_Update, (ActorFunc)NULL, }; -void ObjWturn_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjWturn_Init(Actor* thisx, PlayState* play) { ObjWturn* this = THIS; func_808A7954(this); @@ -38,12 +38,12 @@ void func_808A7954(ObjWturn* this) { this->actionFunc = func_808A7968; } -void func_808A7968(ObjWturn* this, GlobalContext* globalCtx) { - if (globalCtx->msgCtx.ocarinaMode >= 28 && globalCtx->msgCtx.ocarinaMode < 39) { - Flags_UnsetSwitch(globalCtx, this->actor.params); +void func_808A7968(ObjWturn* this, PlayState* play) { + if (play->msgCtx.ocarinaMode >= 28 && play->msgCtx.ocarinaMode < 39) { + Flags_UnsetSwitch(play, this->actor.params); Actor_MarkForDeath(&this->actor); - } else if ((Flags_GetSwitch(globalCtx, this->actor.params) && (globalCtx->sceneNum == SCENE_F40)) || - (!Flags_GetSwitch(globalCtx, this->actor.params) && (globalCtx->sceneNum == SCENE_F41))) { + } else if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F40)) || + (!Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F41))) { func_808A7A24(this); } } @@ -53,76 +53,76 @@ void func_808A7A24(ObjWturn* this) { this->actionFunc = func_808A7A5C; } -void func_808A7A5C(ObjWturn* this, GlobalContext* globalCtx) { +void func_808A7A5C(ObjWturn* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - func_808A7AAC(this, globalCtx); + func_808A7AAC(this, play); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void func_808A7AAC(ObjWturn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808A7AAC(ObjWturn* this, PlayState* play) { + Player* player = GET_PLAYER(play); Vec3f eye; Vec3f at; ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); func_8016566C(140); this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - func_800B7298(globalCtx, &this->actor, 21); + func_800B7298(play, &this->actor, 21); at.x = player->actor.focus.pos.x; at.z = player->actor.focus.pos.z; at.y = player->actor.focus.pos.y; eye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + at.x; eye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + at.z; eye.y = at.y + 4.0f; - Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye); + Play_CameraSetAtEye(play, this->camId, &at, &eye); this->actionFunc = func_808A7BA0; } -void func_808A7BA0(ObjWturn* this, GlobalContext* globalCtx) { +void func_808A7BA0(ObjWturn* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.shape.rot.z, -0x8000, 0x0200)) { - func_808A7C04(this, globalCtx); + func_808A7C04(this, play); } func_800B8FE8(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG); - Play_CameraSetRoll(globalCtx, this->camId, this->actor.shape.rot.z); + Play_CameraSetRoll(play, this->camId, this->actor.shape.rot.z); } -void func_808A7C04(ObjWturn* this, GlobalContext* globalCtx) { - Player* player = GET_PLAYER(globalCtx); +void func_808A7C04(ObjWturn* this, PlayState* play) { + Player* player = GET_PLAYER(play); this->actor.world.pos.y += this->actor.playerHeightRel; player->actor.shape.shadowAlpha = 0; - func_800B7298(globalCtx, &this->actor, 0x54); + func_800B7298(play, &this->actor, 0x54); func_800B8E58(player, NA_SE_VO_NAVY_ENEMY); this->unk_14A = 0; func_80165690(); this->actionFunc = func_808A7C78; } -void func_808A7C78(ObjWturn* this, GlobalContext* globalCtx) { +void func_808A7C78(ObjWturn* this, PlayState* play) { static Vec3f D_808A7DC0 = { 0.0f, -1.0f, 0.0f }; - Camera* camera = Play_GetCamera(globalCtx, this->camId); - Player* player = GET_PLAYER(globalCtx); + Camera* camera = Play_GetCamera(play, this->camId); + Player* player = GET_PLAYER(play); this->unk_14A++; player->actor.world.pos.y = this->actor.world.pos.y + this->unk_14A * 4.0f; - Play_CameraSetAtEyeUp(globalCtx, this->camId, &player->actor.focus.pos, &camera->eye, &D_808A7DC0); + Play_CameraSetAtEyeUp(play, this->camId, &player->actor.focus.pos, &camera->eye, &D_808A7DC0); if (this->unk_14A == 1) { - globalCtx->unk_1887F = 0x40; + play->unk_1887F = 0x40; gSaveContext.nextTransition = 3; gSaveContext.nextCutsceneIndex = 0; - if (globalCtx->sceneNum == 0x58) { - globalCtx->nextEntranceIndex = 0xAC00; + if (play->sceneNum == 0x58) { + play->nextEntranceIndex = 0xAC00; } else { - globalCtx->nextEntranceIndex = 0xAA10; + play->nextEntranceIndex = 0xAA10; } - globalCtx->sceneLoadFlag = 0x14; + play->sceneLoadFlag = 0x14; } } -void ObjWturn_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjWturn_Update(Actor* thisx, PlayState* play) { ObjWturn* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h index 0390ac7a89..9b498cf4ba 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h @@ -5,7 +5,7 @@ struct ObjWturn; -typedef void (*ObjWturnActionFunc)(struct ObjWturn*, GlobalContext*); +typedef void (*ObjWturnActionFunc)(struct ObjWturn*, PlayState*); typedef struct ObjWturn { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c index 14bad806cb..8870295aa2 100644 --- a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c +++ b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c @@ -11,10 +11,10 @@ #define THIS ((ObjY2lift*)thisx) -void ObjY2lift_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjY2lift_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjY2lift_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjY2lift_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjY2lift_Init(Actor* thisx, PlayState* play); +void ObjY2lift_Destroy(Actor* thisx, PlayState* play); +void ObjY2lift_Update(Actor* thisx, PlayState* play); +void ObjY2lift_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Y2lift_InitVars = { ACTOR_OBJ_Y2LIFT, @@ -35,21 +35,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjY2lift_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjY2lift_Init(Actor* thisx, PlayState* play) { ObjY2lift* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gPirateLiftPlatformCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gPirateLiftPlatformCol); } -void ObjY2lift_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjY2lift_Destroy(Actor* thisx, PlayState* play) { ObjY2lift* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjY2lift_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjY2lift_Update(Actor* thisx, PlayState* play) { ObjY2lift* this = THIS; f32 temp_fv0 = this->dyna.actor.world.pos.y; f32 targetVelocityY = 0.0f; @@ -90,6 +90,6 @@ void ObjY2lift_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjY2lift_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, gPirateLiftPlatformDL); +void ObjY2lift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, gPirateLiftPlatformDL); } diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c index 4bfced35c0..6b67bc0682 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c @@ -10,10 +10,10 @@ #define THIS ((ObjY2shutter*)thisx) -void ObjY2shutter_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjY2shutter_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjY2shutter_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjY2shutter_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjY2shutter_Init(Actor* thisx, PlayState* play); +void ObjY2shutter_Destroy(Actor* thisx, PlayState* play); +void ObjY2shutter_Update(Actor* thisx, PlayState* play); +void ObjY2shutter_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Obj_Y2shutter_InitVars = { diff --git a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c index 997941057a..845e97da4e 100644 --- a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c +++ b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c @@ -11,10 +11,10 @@ #define THIS ((ObjYado*)thisx) -void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjYado_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjYado_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjYado_Init(Actor* thisx, PlayState* play); +void ObjYado_Destroy(Actor* thisx, PlayState* play); +void ObjYado_Update(Actor* thisx, PlayState* play); +void ObjYado_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Yado_InitVars = { ACTOR_OBJ_YADO, @@ -34,7 +34,7 @@ static InitChainEntry sInitChain[] = { AnimatedMaterial* D_80C16470; -void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjYado_Init(Actor* thisx, PlayState* play) { ObjYado* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -42,32 +42,32 @@ void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx) { this->isNight = gSaveContext.save.isNight; } -void ObjYado_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjYado_Destroy(Actor* thisx, PlayState* play) { } -void ObjYado_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjYado_Update(Actor* thisx, PlayState* play) { ObjYado* this = THIS; this->isNight = gSaveContext.save.isNight; } -void ObjYado_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjYado_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjYado* this = THIS; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (this->isNight) { - gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 95, 95, 70, 155)); - gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 0, 40, 40, 255)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(play->state.gfxCtx, 128, 95, 95, 70, 155)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(play->state.gfxCtx, 128, 0, 40, 40, 255)); } else { - gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 255, 255, 215, 110)); - gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(globalCtx->state.gfxCtx, 128, 255, 255, 215, 255)); + gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_PrimColor(play->state.gfxCtx, 128, 255, 255, 215, 110)); + gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_PrimColor(play->state.gfxCtx, 128, 255, 255, 215, 255)); } - AnimatedMat_Draw(globalCtx, D_80C16470); - Gfx_DrawDListOpa(globalCtx, object_yado_obj_DL_000430); - Gfx_DrawDListXlu(globalCtx, object_yado_obj_DL_000320); + AnimatedMat_Draw(play, D_80C16470); + Gfx_DrawDListOpa(play, object_yado_obj_DL_000430); + Gfx_DrawDListXlu(play, object_yado_obj_DL_000320); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c index 4e9bb84b2d..185638056c 100644 --- a/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c +++ b/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.c @@ -13,10 +13,10 @@ #define CAN_DROP_NUT(thisx) (thisx->params < 0) -void ObjYasi_Init(Actor* thisx, GlobalContext* globalCtx); -void ObjYasi_Destroy(Actor* thisx, GlobalContext* globalCtx); -void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx); -void ObjYasi_Draw(Actor* thisx, GlobalContext* globalCtx); +void ObjYasi_Init(Actor* thisx, PlayState* play); +void ObjYasi_Destroy(Actor* thisx, PlayState* play); +void ObjYasi_Update(Actor* thisx, PlayState* play); +void ObjYasi_Draw(Actor* thisx, PlayState* play); const ActorInit Obj_Yasi_InitVars = { ACTOR_OBJ_YASI, @@ -37,12 +37,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -void ObjYasi_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjYasi_Init(Actor* thisx, PlayState* play) { ObjYasi* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gPalmTreeCol); + DynaPolyActor_LoadMesh(play, &this->dyna, &gPalmTreeCol); this->dyna.actor.home.rot.y = 0; @@ -52,13 +52,13 @@ void ObjYasi_Init(Actor* thisx, GlobalContext* globalCtx) { } } -void ObjYasi_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjYasi_Destroy(Actor* thisx, PlayState* play) { ObjYasi* this = THIS; - DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjYasi_Update(Actor* thisx, PlayState* play) { ObjYasi* this = THIS; s16 temp; Vec3f dropPos; @@ -69,10 +69,10 @@ void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx) { dropPos.x = this->dyna.actor.world.pos.x; dropPos.y = this->dyna.actor.world.pos.y + 280.0f; dropPos.z = this->dyna.actor.world.pos.z; - Item_DropCollectible(globalCtx, &dropPos, ITEM00_NUTS_1); + Item_DropCollectible(play, &dropPos, ITEM00_NUTS_1); } } - this->dyna.actor.home.rot.y = GET_PLAYER(globalCtx)->actor.shape.rot.y; + this->dyna.actor.home.rot.y = GET_PLAYER(play)->actor.shape.rot.y; this->dyna.actor.home.rot.x = 400; this->dyna.actor.home.rot.z = 0; } @@ -82,7 +82,7 @@ void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx) { BINANG_SUB(this->dyna.actor.home.rot.x, (s16)(this->dyna.actor.shape.rot.x * 0.08f)); } -void ObjYasi_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjYasi_Draw(Actor* thisx, PlayState* play) { ObjYasi* this = THIS; Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, @@ -97,5 +97,5 @@ void ObjYasi_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Gfx_DrawDListOpa(globalCtx, gPalmTreeDL); + Gfx_DrawDListOpa(play, gPalmTreeDL); } 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 e817998734..f0f1160da2 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -11,19 +11,19 @@ #define THIS ((ObjectKankyo*)thisx) -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 actionFunc); -void func_808DC18C(ObjectKankyo* this, GlobalContext* globalCtx); -void func_808DCB7C(ObjectKankyo* this, GlobalContext* globalCtx); -void func_808DCBF8(ObjectKankyo* this, GlobalContext* globalCtx); -void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx); -void func_808DD3C8(Actor* thisx, GlobalContext* globalCtx2); -void func_808DD970(Actor* thisx, GlobalContext* globalCtx2); -void func_808DDE9C(Actor* thisx, GlobalContext* globalCtx2); +void func_808DC18C(ObjectKankyo* this, PlayState* play); +void func_808DCB7C(ObjectKankyo* this, PlayState* play); +void func_808DCBF8(ObjectKankyo* this, PlayState* play); +void func_808DCDB4(ObjectKankyo* this, PlayState* play); +void func_808DD3C8(Actor* thisx, PlayState* play2); +void func_808DD970(Actor* thisx, PlayState* play2); +void func_808DDE9C(Actor* thisx, PlayState* play2); static f32 D_808DE5B0; @@ -49,17 +49,17 @@ void func_808DBE8C(ObjectKankyo* this) { ObjectKankyo_SetupAction(this, func_808DC18C); } -void func_808DBEB0(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DBEB0(ObjectKankyo* this, PlayState* play) { s32 i; D_808DE5B0 = 0.0f; this->unk_144 = Rand_ZeroOne() * 360.0f; this->unk_148 = Rand_ZeroOne() * 360.0f; - if (globalCtx->envCtx.unk_F2[2] == 128) { + if (play->envCtx.unk_F2[2] == 128) { D_808DE5B0 = 1.0f; this->unk_114E = 1; - for (i = 0; i < globalCtx->envCtx.unk_F2[2]; i++) { + for (i = 0; i < play->envCtx.unk_F2[2]; i++) { this->unk_14C[i].unk_10 = Rand_ZeroOne() * -200.0f; } } else { @@ -68,7 +68,7 @@ void func_808DBEB0(ObjectKankyo* this, GlobalContext* globalCtx) { ObjectKankyo_SetupAction(this, func_808DCB7C); } -void func_808DBFB0(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DBFB0(ObjectKankyo* this, PlayState* play) { D_808DE5B0 = 0.0f; this->unk_114E = 0; this->unk_144 = Rand_ZeroOne() * 360.0f; @@ -78,7 +78,7 @@ void func_808DBFB0(ObjectKankyo* this, GlobalContext* globalCtx) { ObjectKankyo_SetupAction(this, func_808DCBF8); } -void func_808DC038(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DC038(ObjectKankyo* this, PlayState* play) { s16 i; this->unk_144 = Rand_ZeroOne() * 360.0f; @@ -92,7 +92,7 @@ void func_808DC038(ObjectKankyo* this, GlobalContext* globalCtx) { ObjectKankyo_SetupAction(this, func_808DCDB4); } -void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Init(Actor* thisx, PlayState* play) { ObjectKankyo* this = THIS; s16 i; @@ -107,28 +107,28 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { break; case 2: - globalCtx->envCtx.unk_F2[2] = 0x80; - func_808DBFB0(this, globalCtx); + play->envCtx.unk_F2[2] = 0x80; + func_808DBFB0(this, play); break; case 1: case 3: - func_808DBEB0(this, globalCtx); + func_808DBEB0(this, play); break; case 4: - func_808DC038(this, globalCtx); + func_808DC038(this, play); break; } } -void ObjectKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Destroy(Actor* thisx, PlayState* play) { ObjectKankyo* this = THIS; Actor_MarkForDeath(&this->actor); } -void func_808DC18C(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DC18C(ObjectKankyo* this, PlayState* play) { s32 pad; s32 pad2; s32 pad3; @@ -140,20 +140,20 @@ void func_808DC18C(ObjectKankyo* this, GlobalContext* globalCtx) { f32 x; f32 sp1C; - x = globalCtx->view.at.x - globalCtx->view.eye.x; - y = globalCtx->view.at.y - globalCtx->view.eye.y; - z = globalCtx->view.at.z - globalCtx->view.eye.z; + x = play->view.at.x - play->view.eye.x; + y = play->view.at.y - play->view.eye.y; + z = play->view.at.z - play->view.eye.z; magnitude = sqrtf(SQ(x) + SQ(y) + SQ(z)); temp_f18 = x / magnitude; x = z / magnitude; sp1C = (y / magnitude) * 120.0f; - this->unk_14C[0].unk_00 = globalCtx->view.eye.x + (temp_f18 * 50.0f); - this->unk_14C[0].unk_04 = globalCtx->view.eye.y + sp1C; - this->unk_14C[0].unk_08 = globalCtx->view.eye.z + (x * 50.0f); - this->unk_14C[1].unk_00 = globalCtx->view.eye.x + (temp_f18 * 220.0f); - this->unk_14C[1].unk_08 = globalCtx->view.eye.z + (x * 220.0f); + this->unk_14C[0].unk_00 = play->view.eye.x + (temp_f18 * 50.0f); + this->unk_14C[0].unk_04 = play->view.eye.y + sp1C; + this->unk_14C[0].unk_08 = play->view.eye.z + (x * 50.0f); + this->unk_14C[1].unk_00 = play->view.eye.x + (temp_f18 * 220.0f); + this->unk_14C[1].unk_08 = play->view.eye.z + (x * 220.0f); this->unk_114C = 0; this->unk_144 = 100.0f; @@ -163,13 +163,13 @@ void func_808DC18C(ObjectKankyo* this, GlobalContext* globalCtx) { this->unk_144 = 400.0f; if (x < 0.0f) { this->unk_14C[0].unk_00 = -350.0f; - this->unk_14C[0].unk_04 = globalCtx->view.eye.y + sp1C; + this->unk_14C[0].unk_04 = play->view.eye.y + sp1C; this->unk_14C[0].unk_08 = 3680.0f; this->unk_14C[1].unk_00 = -350.0f; this->unk_14C[1].unk_08 = 3680.0f; } else { this->unk_14C[0].unk_00 = -350.0f; - this->unk_14C[0].unk_04 = globalCtx->view.eye.y + sp1C; + this->unk_14C[0].unk_04 = play->view.eye.y + sp1C; this->unk_14C[0].unk_08 = 4280.0f; this->unk_14C[1].unk_00 = -350.0f; this->unk_14C[1].unk_08 = 4280.0f; @@ -177,17 +177,17 @@ void func_808DC18C(ObjectKankyo* this, GlobalContext* globalCtx) { } } - magnitude = globalCtx->envCtx.windSpeed / 60.0f; + magnitude = play->envCtx.windSpeed / 60.0f; magnitude = CLAMP(magnitude, 0.0f, 1.0f); - sp30.x = globalCtx->envCtx.windDir.x * magnitude; - sp30.y = globalCtx->envCtx.windDir.y + 100.0f; - sp30.z = globalCtx->envCtx.windDir.z * magnitude; + sp30.x = play->envCtx.windDir.x * magnitude; + sp30.y = play->envCtx.windDir.y + 100.0f; + sp30.z = play->envCtx.windDir.z * magnitude; this->unk_14C[2].unk_00 = 0x4000 - Math_Vec3f_Pitch(&gZeroVec3f, &sp30); this->unk_14C[2].unk_04 = Math_Vec3f_Yaw(&gZeroVec3f, &sp30) + 0x8000; } -void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DC454(ObjectKankyo* this, PlayState* play) { s16 i; u32 tempI; f32 phi_f20; @@ -201,9 +201,9 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { f32 temp_f22; f32 temp_f24; f32 temp_f28; - f32 x = globalCtx->view.at.x - globalCtx->view.eye.x; - f32 y = globalCtx->view.at.y - globalCtx->view.eye.y; - f32 z = globalCtx->view.at.z - globalCtx->view.eye.z; + f32 x = play->view.at.x - play->view.eye.x; + f32 y = play->view.at.y - play->view.eye.y; + f32 z = play->view.at.z - play->view.eye.z; f32 magnitude = sqrtf(SQ(x) + SQ(y) + SQ(z)); f32 temp_120 = 120.0f; f32 temp_f30; @@ -214,15 +214,15 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { spCC = y / magnitude; spC8 = z / magnitude; - for (i = 0; i < globalCtx->envCtx.unk_F2[2]; i++) { + for (i = 0; i < play->envCtx.unk_F2[2]; i++) { switch (this->unk_14C[i].unk_1C) { case 0: - this->unk_14C[i].unk_00 = globalCtx->view.eye.x + (spD0 * 120.0f); - this->unk_14C[i].unk_04 = globalCtx->view.eye.y + (spCC * 120.0f); - this->unk_14C[i].unk_08 = globalCtx->view.eye.z + (spC8 * 120.0f); + this->unk_14C[i].unk_00 = play->view.eye.x + (spD0 * 120.0f); + this->unk_14C[i].unk_04 = play->view.eye.y + (spCC * 120.0f); + this->unk_14C[i].unk_08 = play->view.eye.z + (spC8 * 120.0f); this->unk_14C[i].unk_0C = (Rand_ZeroOne() - 0.5f) * (2.0f * temp_120); - temp_f22 = (Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)) * 0.004f) + 60.0f; + temp_f22 = (Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)) * 0.004f) + 60.0f; if (temp_f22 < 20.0f) { temp_f22 = 20.0f; } @@ -232,13 +232,13 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { } else { this->unk_14C[i].unk_10 += temp_f22; tempI = i; - if (globalCtx->envCtx.unk_F2[2] == (tempI + 1)) { + if (play->envCtx.unk_F2[2] == (tempI + 1)) { this->unk_114E = 0; } } this->unk_14C[i].unk_14 = (Rand_ZeroOne() - 0.5f) * (2.0f * temp_120); - if (globalCtx->envCtx.unk_F2[4] == 0) { + if (play->envCtx.unk_F2[4] == 0) { this->unk_14C[i].unk_18 = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { this->unk_14C[i].unk_18 = (Rand_ZeroOne() * 3.0f) + 8.0f; @@ -247,33 +247,32 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { break; case 1: - temp_f24 = globalCtx->view.eye.x + (spD0 * 120.0f); - temp_f28 = globalCtx->view.eye.y + (spCC * 120.0f); - temp_f30 = globalCtx->view.eye.z + (spC8 * 120.0f); + temp_f24 = play->view.eye.x + (spD0 * 120.0f); + temp_f28 = play->view.eye.y + (spCC * 120.0f); + temp_f30 = play->view.eye.z + (spC8 * 120.0f); - magnitude = sqrtf((f32)SQ(globalCtx->envCtx.windDir.x) + SQ(globalCtx->envCtx.windDir.y) + - SQ(globalCtx->envCtx.windDir.z)); + magnitude = + sqrtf((f32)SQ(play->envCtx.windDir.x) + SQ(play->envCtx.windDir.y) + SQ(play->envCtx.windDir.z)); if (magnitude == 0.0f) { magnitude = 0.001f; } - spC4 = -globalCtx->envCtx.windDir.x / magnitude; - spC0 = -globalCtx->envCtx.windDir.y / magnitude; - spBC = -globalCtx->envCtx.windDir.z / magnitude; + spC4 = -play->envCtx.windDir.x / magnitude; + spC0 = -play->envCtx.windDir.y / magnitude; + spBC = -play->envCtx.windDir.z / magnitude; if (i == 0) { this->unk_144 += 0.049999997f * Rand_ZeroOne(); this->unk_148 += 0.049999997f * Rand_ZeroOne(); } - phi_f20 = globalCtx->envCtx.windSpeed / 120.0f; + phi_f20 = play->envCtx.windSpeed / 120.0f; phi_f20 = CLAMP(phi_f20, 0.0f, 1.0f); this->unk_14C[i].unk_0C += sinf((this->unk_144 + (i * 100.0f)) * 0.01f) + (spC4 * 10.0f * phi_f20); this->unk_14C[i].unk_14 += cosf((this->unk_148 + (i * 100.0f)) * 0.01f) + (spBC * 10.0f * phi_f20); - this->unk_14C[i].unk_10 -= - this->unk_14C[i].unk_18 - (spC0 * 3.0f * (globalCtx->envCtx.windSpeed / 100.0f)); + this->unk_14C[i].unk_10 -= this->unk_14C[i].unk_18 - (spC0 * 3.0f * (play->envCtx.windSpeed / 100.0f)); - temp_f22 = (-Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)) * 0.012f) + 40.0f; + temp_f22 = (-Camera_GetCamDirPitch(GET_ACTIVE_CAM(play)) * 0.012f) + 40.0f; if (temp_f22 < -40.0f) { temp_f22 = -40.0f; } @@ -290,7 +289,7 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { sp88.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; sp88.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - phi_f20 = Math_Vec3f_DistXZ(&sp88, &globalCtx->view.eye) / 200.0f; + phi_f20 = Math_Vec3f_DistXZ(&sp88, &play->view.eye) / 200.0f; phi_f20 = CLAMP(phi_f20, 0.0f, 1.0f); temp_f0_4 = 100.0f + phi_f20 + 60.0f; @@ -310,8 +309,7 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { this->unk_14C[i].unk_08 = temp_f30 + temp_120; } - if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) < - ((globalCtx->view.eye.y - temp_f22) - 40.0f)) { + if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) < ((play->view.eye.y - temp_f22) - 40.0f)) { this->unk_14C[i].unk_1C = 0; } break; @@ -319,45 +317,45 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void func_808DCB7C(ObjectKankyo* this, GlobalContext* globalCtx) { - if (globalCtx->envCtx.unk_F2[2] < globalCtx->envCtx.unk_F2[3]) { - if ((globalCtx->state.frames % 16) == 0) { - globalCtx->envCtx.unk_F2[2] += 2; +void func_808DCB7C(ObjectKankyo* this, PlayState* play) { + if (play->envCtx.unk_F2[2] < play->envCtx.unk_F2[3]) { + if ((play->state.frames % 16) == 0) { + play->envCtx.unk_F2[2] += 2; } - } else if (globalCtx->envCtx.unk_F2[3] < globalCtx->envCtx.unk_F2[2]) { - if ((globalCtx->state.frames % 16) == 0) { - globalCtx->envCtx.unk_F2[2] -= 2; + } else if (play->envCtx.unk_F2[3] < play->envCtx.unk_F2[2]) { + if ((play->state.frames % 16) == 0) { + play->envCtx.unk_F2[2] -= 2; } } - func_808DC454(this, globalCtx); + func_808DC454(this, play); } -void func_808DCBF8(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DCBF8(ObjectKankyo* this, PlayState* play) { f32 temp_f0; - if ((globalCtx->envCtx.unk_F2[2] > 0) && (this->unk_114C == 0)) { - if ((globalCtx->state.frames % 16) == 0) { - globalCtx->envCtx.unk_F2[2] -= 9; - if ((s8)globalCtx->envCtx.unk_F2[2] < 0) { - globalCtx->envCtx.unk_F2[2] = 0; + if ((play->envCtx.unk_F2[2] > 0) && (this->unk_114C == 0)) { + if ((play->state.frames % 16) == 0) { + play->envCtx.unk_F2[2] -= 9; + if ((s8)play->envCtx.unk_F2[2] < 0) { + play->envCtx.unk_F2[2] = 0; } } } - temp_f0 = (f32)globalCtx->envCtx.unk_F2[2] / 128; + temp_f0 = (f32)play->envCtx.unk_F2[2] / 128; temp_f0 = CLAMP(temp_f0, 0.0f, 1.0f); if (temp_f0 > 0.01f) { D_801F4E30 = 155.0f * temp_f0; - globalCtx->envCtx.sandstormState = 10; + play->envCtx.sandstormState = 10; } else { D_801F4E30 = 0; - globalCtx->envCtx.sandstormState = 10; + play->envCtx.sandstormState = 10; } - func_808DC454(this, globalCtx); + func_808DC454(this, play); } -void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { +void func_808DCDB4(ObjectKankyo* this, PlayState* play) { s16 i; f32 magnitude; f32 temp_80; @@ -379,9 +377,9 @@ void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { this->unk_114C++; } - x = globalCtx->view.at.x - globalCtx->view.eye.x; - y = globalCtx->view.at.y - globalCtx->view.eye.y; - z = globalCtx->view.at.z - globalCtx->view.eye.z; + x = play->view.at.x - play->view.eye.x; + y = play->view.at.y - play->view.eye.y; + z = play->view.at.z - play->view.eye.z; magnitude = sqrtf(SQ(x) + SQ(y) + SQ(z)); @@ -395,9 +393,9 @@ void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { for (i = 0; i < this->unk_114C; i++) { switch (this->unk_14C[i].unk_1C) { case 0: - this->unk_14C[i].unk_00 = globalCtx->view.eye.x + (spAC * 120.0f); - this->unk_14C[i].unk_04 = globalCtx->view.eye.y + (spA8 * 120.0f); - this->unk_14C[i].unk_08 = globalCtx->view.eye.z + (spA4 * 120.0f); + this->unk_14C[i].unk_00 = play->view.eye.x + (spAC * 120.0f); + this->unk_14C[i].unk_04 = play->view.eye.y + (spA8 * 120.0f); + this->unk_14C[i].unk_08 = play->view.eye.z + (spA4 * 120.0f); this->unk_14C[i].unk_0C = (Rand_ZeroOne() - 0.5f) * (temp_120 * 2.0f); if ((i % 2) == 0) { this->unk_14C[i].unk_10 = -100.0f; @@ -411,24 +409,24 @@ void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { case 1: - temp_f26 = globalCtx->view.eye.x + (spAC * 120.0f); - temp_f28 = globalCtx->view.eye.y + (spA8 * 120.0f); - temp_f18 = globalCtx->view.eye.z + (spA4 * 120.0f); + temp_f26 = play->view.eye.x + (spAC * 120.0f); + temp_f28 = play->view.eye.y + (spA8 * 120.0f); + temp_f18 = play->view.eye.z + (spA4 * 120.0f); - magnitude = sqrtf((f32)SQ(globalCtx->envCtx.windDir.x) + SQ(globalCtx->envCtx.windDir.y) + - SQ(globalCtx->envCtx.windDir.z)); + magnitude = + sqrtf((f32)SQ(play->envCtx.windDir.x) + SQ(play->envCtx.windDir.y) + SQ(play->envCtx.windDir.z)); if (magnitude == 0.0f) { magnitude = 0.001f; } - spA0 = -globalCtx->envCtx.windDir.x / magnitude; - sp9C = -globalCtx->envCtx.windDir.z / magnitude; + spA0 = -play->envCtx.windDir.x / magnitude; + sp9C = -play->envCtx.windDir.z / magnitude; if (i == 0) { this->unk_144 += 0.049999997f * Rand_ZeroOne(); this->unk_148 += 0.049999997f * Rand_ZeroOne(); } - temp_f20 = globalCtx->envCtx.windSpeed / 120.0f; + temp_f20 = play->envCtx.windSpeed / 120.0f; temp_f20 = CLAMP(temp_f20, 0.0f, 1.0f); this->unk_14C[i].unk_0C += sinf((this->unk_144 + i) * 0.01f) + (spA0 * 10.0f * temp_f20); @@ -436,12 +434,12 @@ void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { if ((i % 2) == 0) { this->unk_14C[i].unk_10 += this->unk_14C[i].unk_18; - if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) > (globalCtx->view.eye.y + 100.0f)) { + if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) > (play->view.eye.y + 100.0f)) { this->unk_14C[i].unk_1C = 0; } } else { this->unk_14C[i].unk_10 -= this->unk_14C[i].unk_18; - if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) < (globalCtx->view.eye.y - 100.0f)) { + if ((this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10) < (play->view.eye.y - 100.0f)) { this->unk_14C[i].unk_1C = 0; } } @@ -474,34 +472,34 @@ void func_808DCDB4(ObjectKankyo* this, GlobalContext* globalCtx) { } } -void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Update(Actor* thisx, PlayState* play) { ObjectKankyo* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx) { +void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { ObjectKankyo* this = THIS; switch (this->actor.params) { case 0: - func_808DDE9C(thisx, globalCtx); + func_808DDE9C(thisx, play); break; case 1: case 2: case 3: - func_808DD3C8(thisx, globalCtx); + func_808DD3C8(thisx, play); break; case 4: - func_808DD970(thisx, globalCtx); + func_808DD970(thisx, play); break; } } -void func_808DD3C8(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +void func_808DD3C8(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjectKankyo* this = THIS; Vec3f spC4; Vec3f spB8; @@ -514,33 +512,33 @@ void func_808DD3C8(Actor* thisx, GlobalContext* globalCtx2) { f32 temp_f2; f32 tempf; - if ((globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || ((u8)globalCtx->envCtx.unk_E2 == 0)) { + if ((play->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || ((u8)play->envCtx.unk_E2 == 0)) { return; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); spB4 = false; if (this->actor.params == 3) { - temp_f0 = func_80173B48(&globalCtx->state) / 1.4e7f; + temp_f0 = func_80173B48(&play->state) / 1.4e7f; temp_f0 = CLAMP(temp_f0, 0.0f, 1.0f); Math_SmoothStepToF(&D_808DE5B0, temp_f0, 0.2f, 0.1f, 0.001f); - sp68 = globalCtx->envCtx.unk_F2[2]; + sp68 = play->envCtx.unk_F2[2]; sp68 *= D_808DE5B0; - if ((globalCtx->envCtx.unk_F2[2] >= 32) && (sp68 < 32)) { + if ((play->envCtx.unk_F2[2] >= 32) && (sp68 < 32)) { sp68 = 32; } } else { - sp68 = globalCtx->envCtx.unk_F2[2]; + sp68 = play->envCtx.unk_F2[2]; } for (i = 0; i < sp68; i++) { spC4.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; spC4.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; spC4.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(globalCtx, &spC4, &spB8); + func_80169474(play, &spC4, &spB8); if ((spB8.x >= 0.0f) && (spB8.x < 320.0f) && (spB8.y >= 0.0f) && (spB8.y < 240.0f)) { if (!spB4) { @@ -560,24 +558,23 @@ void func_808DD3C8(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(spC4.x, spC4.y, spC4.z, MTXMODE_NEW); tempf = (i & 7) * 0.008f; Matrix_Scale(0.05f + tempf, 0.05f + tempf, 0.05f + tempf, MTXMODE_APPLY); - temp_f2 = Math_Vec3f_DistXYZ(&spC4, &globalCtx->view.eye) / 300.0f; + temp_f2 = Math_Vec3f_DistXYZ(&spC4, &play->view.eye) / 300.0f; temp_f2 = ((1.0f < temp_f2) ? 0.0f : (((1.0f - temp_f2) > 1.0f) ? 1.0f : 1.0f - temp_f2)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(160.0f * temp_f2)); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023130); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { +void func_808DD970(Actor* thisx, PlayState* play2) { f32 temp_f0; f32 temp_f20; Vec3f spBC; @@ -585,16 +582,16 @@ void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { f32 tempf; s16 i; f32 phi_f26; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; ObjectKankyo* this = THIS; f32 tempA; - if (globalCtx->sceneNum == SCENE_KYOJINNOMA) { + if (play->sceneNum == SCENE_KYOJINNOMA) { phi_f26 = 1.0f; } else { - tempA = Camera_GetWaterYPos(GET_ACTIVE_CAM(globalCtx)); + tempA = Camera_GetWaterYPos(GET_ACTIVE_CAM(play)); if (tempA != BGCHECK_Y_MIN) { - tempA -= globalCtx->view.eye.y; + tempA -= play->view.eye.y; phi_f26 = tempA / 4000.0f; } else { phi_f26 = 0.0f; @@ -602,33 +599,32 @@ void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { phi_f26 = CLAMP_MAX(phi_f26, 1.0f); - if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || (phi_f26 == 0.0f)) { + if (!(play->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || (phi_f26 == 0.0f)) { return; } } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < this->unk_114C; i++) { spBC.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; spBC.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; spBC.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(globalCtx, &spBC, &spB0); + func_80169474(play, &spBC, &spB0); if ((spB0.x >= 0.0f) && (spB0.x < 320.0f) && (spB0.y >= 0.0f) && (spB0.y < 240.0f)) { Matrix_Translate(spBC.x, spBC.y, spBC.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); - temp_f0 = Math_Vec3f_DistXYZ(&spBC, &globalCtx->view.eye); + temp_f0 = Math_Vec3f_DistXYZ(&spBC, &play->view.eye); temp_f0 = (u8)(255.0f * phi_f26) * (1.0f - (temp_f0 / 300.0f)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 55, temp_f0); gDPSetEnvColor(POLY_XLU_DISP++, 55, 50, 255, temp_f0); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex)); gSPClearGeometryMode(POLY_XLU_DISP++, G_LIGHTING); @@ -640,7 +636,7 @@ void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } f32 func_808DDE74(void) { @@ -648,11 +644,11 @@ f32 func_808DDE74(void) { } #ifdef NON_MATCHING -// globalCtx->envCtx.unk_F2[1] needs to be laoded into s0 and then copied to s7 -void func_808DDE9C(Actor* thisx, GlobalContext* globalCtx2) { - GlobalContext* globalCtx = globalCtx2; +// play->envCtx.unk_F2[1] needs to be laoded into s0 and then copied to s7 +void func_808DDE9C(Actor* thisx, PlayState* play2) { + PlayState* play = play2; ObjectKankyo* this = THIS; - Player* player = GET_PLAYER(globalCtx); + Player* player = GET_PLAYER(play); s32 i; s16 temp; f32 temp_f12; @@ -660,9 +656,9 @@ void func_808DDE9C(Actor* thisx, GlobalContext* globalCtx2) { f32 temp_f22; f32 temp_f2; u8 phi_s5; - s32 end = globalCtx->envCtx.unk_F2[1]; + s32 end = play->envCtx.unk_F2[1]; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); if (end != 0) { gDPPipeSync(POLY_XLU_DISP++); @@ -692,15 +688,15 @@ void func_808DDE9C(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(2.0f, 4.0f, 2.0f, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_0706E0); } phi_s5 = false; - if (player->actor.floorHeight < globalCtx->view.eye.y) { + if (player->actor.floorHeight < play->view.eye.y) { for (i = 0; i < end; i++) { if (!phi_s5) { - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 255); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 100); @@ -719,13 +715,12 @@ void func_808DDE9C(Actor* thisx, GlobalContext* globalCtx2) { temp_f12 = (Rand_ZeroOne() * 0.05f) + 0.05f; Matrix_Scale(temp_f12, temp_f12, temp_f12, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffShockwaveDL); } } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } #else #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Object_Kankyo/func_808DDE9C.s") 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 646863be0a..c6e374da86 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h @@ -5,7 +5,7 @@ struct ObjectKankyo; -typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, GlobalContext*); +typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, PlayState*); typedef struct { /* 0x00 */ f32 unk_00; 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 18d28f8c7c..91a5d3e661 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -10,13 +10,13 @@ #define THIS ((OceffSpot*)thisx) -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 func_809728F8(OceffSpot* this, GlobalContext* globalCtx); -void func_80972934(OceffSpot* this, GlobalContext* globalCtx); +void func_809728F8(OceffSpot* this, PlayState* play); +void func_80972934(OceffSpot* this, PlayState* play); void OceffSpot_SetupAction(OceffSpot* this, OceffSpotActionFunc actionFunc); 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 fa92acb986..e7872dd8c8 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h @@ -5,7 +5,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 1939b1ef02..68ee9d27f2 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -10,13 +10,13 @@ #define THIS ((OceffStorm*)thisx) -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 func_80981928(OceffStorm* this, GlobalContext* globalCtx); -void func_80981B48(OceffStorm* this, GlobalContext* globalCtx); +void func_80981928(OceffStorm* this, PlayState* play); +void func_80981B48(OceffStorm* this, PlayState* play); void OceffStorm_SetupAction(OceffStorm* this, OceffStormActionFunc actionFunc); 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 892632a4a4..a170215baa 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h @@ -5,7 +5,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 1179f5ba24..661c13a1b0 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe*)thisx) -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); #if 0 const ActorInit Oceff_Wipe_InitVars = { 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 61a1ae5494..ca7ff8de2e 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe2*)thisx) -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); #if 0 const ActorInit Oceff_Wipe2_InitVars = { 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 f91385daa2..fb1f2a45d1 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -11,10 +11,10 @@ #define THIS ((OceffWipe3*)thisx) -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); #if 0 const ActorInit Oceff_Wipe3_InitVars = { 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 b985aadadd..56942962dc 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe4*)thisx) -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); #if 0 const ActorInit Oceff_Wipe4_InitVars = { diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index e39a4aa4c5..1bef04db8b 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe5*)thisx) -void OceffWipe5_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe5_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe5_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe5_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe5_Init(Actor* thisx, PlayState* play); +void OceffWipe5_Destroy(Actor* thisx, PlayState* play); +void OceffWipe5_Update(Actor* thisx, PlayState* play); +void OceffWipe5_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Oceff_Wipe5_InitVars = { diff --git a/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c b/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c index a54ca583c0..3dd701dbf5 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c +++ b/src/overlays/actors/ovl_Oceff_Wipe6/z_oceff_wipe6.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe6*)thisx) -void OceffWipe6_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe6_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe6_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe6_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe6_Init(Actor* thisx, PlayState* play); +void OceffWipe6_Destroy(Actor* thisx, PlayState* play); +void OceffWipe6_Update(Actor* thisx, PlayState* play); +void OceffWipe6_Draw(Actor* thisx, PlayState* play); const ActorInit Oceff_Wipe6_InitVars = { ACTOR_OCEFF_WIPE6, @@ -29,23 +29,23 @@ const ActorInit Oceff_Wipe6_InitVars = { #include "overlays/ovl_Oceff_Wipe6/ovl_Oceff_Wipe6.c" -void OceffWipe6_Init(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe6_Init(Actor* thisx, PlayState* play) { OceffWipe6* this = THIS; Actor_SetScale(&this->actor, 1.0f); this->counter = 0; - this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; } -void OceffWipe6_Destroy(Actor* thisx, GlobalContext* globalCtx) { - func_80115D5C(&globalCtx->state); - globalCtx->msgCtx.unk120B0 = 0; +void OceffWipe6_Destroy(Actor* thisx, PlayState* play) { + func_80115D5C(&play->state); + play->msgCtx.unk120B0 = 0; } -void OceffWipe6_Update(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe6_Update(Actor* thisx, PlayState* play) { OceffWipe6* this = THIS; - 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 { @@ -53,7 +53,7 @@ void OceffWipe6_Update(Actor* thisx, GlobalContext* globalCtx) { } } -void OceffWipe6_Draw(Actor* thisx, GlobalContext* globalCtx) { +void OceffWipe6_Draw(Actor* thisx, PlayState* play) { OceffWipe6* this = THIS; f32 z; u8 alpha; @@ -64,8 +64,8 @@ void OceffWipe6_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f quakeOffset; s32 pad2; - activeCamEye = GET_ACTIVE_CAM(globalCtx)->eye; - Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(globalCtx)); + activeCamEye = GET_ACTIVE_CAM(play)->eye; + Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play)); if (this->counter < 32) { counter = this->counter; @@ -84,18 +84,18 @@ void OceffWipe6_Draw(Actor* thisx, GlobalContext* globalCtx) { gOceff6Vtx[i].v.cn[3] = alpha; } - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(activeCamEye.x + quakeOffset.x, activeCamEye.y + quakeOffset.y, activeCamEye.z + quakeOffset.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateXS(0x708, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - AnimatedMat_Draw(globalCtx, ovl_Oceff_Wipe6_Matanimheader_000338); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + AnimatedMat_Draw(play, ovl_Oceff_Wipe6_Matanimheader_000338); gSPDisplayList(POLY_XLU_DISP++, gOceff6DL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c index da295b768d..3eee00a94c 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c +++ b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c @@ -10,10 +10,10 @@ #define THIS ((OceffWipe7*)thisx) -void OceffWipe7_Init(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe7_Destroy(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe7_Update(Actor* thisx, GlobalContext* globalCtx); -void OceffWipe7_Draw(Actor* thisx, GlobalContext* globalCtx); +void OceffWipe7_Init(Actor* thisx, PlayState* play); +void OceffWipe7_Destroy(Actor* thisx, PlayState* play); +void OceffWipe7_Update(Actor* thisx, PlayState* play); +void OceffWipe7_Draw(Actor* thisx, PlayState* play); #if 0 const ActorInit Oceff_Wipe7_InitVars = { 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 38acb813ee..7b01b2d381 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -10,14 +10,14 @@ #define THIS ((ShotSun*)thisx) -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 func_80973740(ShotSun* this, GlobalContext* globalCtx); -void func_80973804(ShotSun* this, GlobalContext* globalCtx); -void func_809738D0(ShotSun* this, GlobalContext* globalCtx); -void func_80973960(ShotSun* this, GlobalContext* globalCtx); +void func_80973740(ShotSun* this, PlayState* play); +void func_80973804(ShotSun* this, PlayState* play); +void func_809738D0(ShotSun* this, PlayState* play); +void func_80973960(ShotSun* this, PlayState* play); #if 0 const ActorInit Shot_Sun_InitVars = { 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 53434204f6..2005c92874 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h @@ -5,7 +5,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_TG_Sw/z_tg_sw.c b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c index 51a2fa6952..6b5e139530 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c @@ -11,12 +11,12 @@ #define THIS ((TGSw*)thisx) // Prototypes -void TGSw_Init(Actor* thisx, GlobalContext* globalCtx); -void TGSw_Destroy(Actor* thisx, GlobalContext* globalCtx); -void TGSw_Update(Actor* thisx, GlobalContext* globalCtx); -void TGSw_Draw(Actor* thisx, GlobalContext* globalCtx); +void TGSw_Init(Actor* thisx, PlayState* play); +void TGSw_Destroy(Actor* thisx, PlayState* play); +void TGSw_Update(Actor* thisx, PlayState* play); +void TGSw_Draw(Actor* thisx, PlayState* play); -void TGSw_ActionExecuteOneShot(struct TGSw* this, GlobalContext* globalCtx); +void TGSw_ActionExecuteOneShot(struct TGSw* this, PlayState* play); const ActorInit TG_Sw_InitVars = { ACTOR_TG_SW, @@ -30,33 +30,33 @@ const ActorInit TG_Sw_InitVars = { (ActorFunc)TGSw_Draw, }; -void TGSw_ActionDecider(TGSw* this, GlobalContext* globalCtx) { +void TGSw_ActionDecider(TGSw* this, PlayState* play) { f32 scaledAbsoluteRotZ; f32 scaledAbsoluteRotY; u8 unk1F4; // Maybe actorCtx Debug Flag? - if (globalCtx->actorCtx.unk1F5 != 0) { + if (play->actorCtx.unk1F5 != 0) { scaledAbsoluteRotY = ABS_ALT(this->actor.world.rot.y) * 4.0f; scaledAbsoluteRotZ = ABS_ALT(this->actor.world.rot.z) * 4.0f; if ((scaledAbsoluteRotZ < this->actor.xzDistToPlayer) || (scaledAbsoluteRotY < this->actor.playerHeightRel)) { return; } - unk1F4 = globalCtx->actorCtx.unk1F4; + unk1F4 = play->actorCtx.unk1F4; if (unk1F4 == 2 || unk1F4 == 0) { this->actionFunc = &TGSw_ActionExecuteOneShot; } } } -void TGSw_ActionExecuteOneShot(TGSw* this, GlobalContext* globalCtx) { +void TGSw_ActionExecuteOneShot(TGSw* this, PlayState* play) { Actor* actor = NULL; if (1) {} do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_ENEMY, ACTOR_EN_SW); + actor = SubS_FindActor(play, actor, ACTORCAT_ENEMY, ACTOR_EN_SW); if (actor == NULL) { break; } @@ -71,7 +71,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, GlobalContext* globalCtx) { actor = NULL; do { - actor = SubS_FindActor(globalCtx, actor, ACTORCAT_NPC, ACTOR_EN_SW); + actor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_SW); if (actor == NULL) { break; @@ -87,22 +87,22 @@ void TGSw_ActionExecuteOneShot(TGSw* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } -void TGSw_Init(Actor* thisx, GlobalContext* globalCtx) { +void TGSw_Init(Actor* thisx, PlayState* play) { TGSw* this = THIS; this->actor.cutscene = this->actor.world.rot.z; this->actionFunc = &TGSw_ActionDecider; } -void TGSw_Destroy(Actor* thisx, GlobalContext* globalCtx) { +void TGSw_Destroy(Actor* thisx, PlayState* play) { ; } -void TGSw_Update(Actor* thisx, GlobalContext* globalCtx) { +void TGSw_Update(Actor* thisx, PlayState* play) { TGSw* this = THIS; - this->actionFunc(this, globalCtx); + this->actionFunc(this, play); } -void TGSw_Draw(Actor* thisx, GlobalContext* globalCtx) { +void TGSw_Draw(Actor* thisx, PlayState* play) { s32 pad; f32 scale; s32 absRot; @@ -113,11 +113,11 @@ void TGSw_Draw(Actor* thisx, GlobalContext* globalCtx) { absRot = ABS_ALT(thisx->world.rot.y); DebugDisplay_AddObject(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, thisx->shape.rot.y, 0, - 0.1f, 0.1f, scale, 160, 160, 160, 255, 6, globalCtx->state.gfxCtx); + 0.1f, 0.1f, scale, 160, 160, 160, 255, 6, play->state.gfxCtx); scale = absRot * 0.2f; DebugDisplay_AddObject(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, 0.1f, scale, 0.1f, - 160, 160, 160, 255, 6, globalCtx->state.gfxCtx); + 160, 160, 160, 255, 6, play->state.gfxCtx); thisx->shape.rot.y += 0x1000; } } diff --git a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.h b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.h index bec4c1f05f..28bebb5d89 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.h +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.h @@ -4,7 +4,7 @@ #include "global.h" struct TGSw; -typedef void (*TGSwActionFunc)(struct TGSw*, GlobalContext*); +typedef void (*TGSwActionFunc)(struct TGSw*, PlayState*); typedef struct TGSw { /* 0x000 */ 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 bc3e3c1e8b..b9d8eed5b2 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -12,10 +12,10 @@ extern UNK_TYPE D_06008860; extern UNK_TYPE D_0600BDD8; extern UNK_TYPE D_060178D0; -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); #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_8082DA90.s") diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c index a2449af928..09c2afb11d 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c @@ -10,9 +10,9 @@ #define PARAMS ((EffectEnIceBlockInitParams*)initParamsx) -u32 EffectEnIceBlock_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectEnIceBlock_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectEnIceBlock_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectEnIceBlock_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectEnIceBlock_Update(PlayState* play, u32 index, EffectSs* this); +void EffectEnIceBlock_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_En_Ice_Block_InitVars = { EFFECT_EN_ICE_BLOCK, @@ -24,9 +24,9 @@ const EffectSsInit Effect_En_Ice_Block_InitVars = { #define rRot regs[2] #define rRotVel regs[3] -u32 EffectEnIceBlock_CheckIceBlockObject(EffectSs* this, GlobalContext* globalCtx) { - if (((this->rObjId = Object_GetIndex(&globalCtx->objectCtx, OBJECT_ICE_BLOCK)) < 0) || - (!Object_IsLoaded(&globalCtx->objectCtx, this->rObjId))) { +u32 EffectEnIceBlock_CheckIceBlockObject(EffectSs* this, PlayState* play) { + if (((this->rObjId = Object_GetIndex(&play->objectCtx, OBJECT_ICE_BLOCK)) < 0) || + (!Object_IsLoaded(&play->objectCtx, this->rObjId))) { this->life = -1; this->draw = NULL; return false; @@ -35,7 +35,7 @@ u32 EffectEnIceBlock_CheckIceBlockObject(EffectSs* this, GlobalContext* globalCt } } -u32 EffectEnIceBlock_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectEnIceBlock_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectEnIceBlockInitParams* params = PARAMS; Math_Vec3f_Copy(&this->pos, ¶ms->pos); @@ -48,27 +48,27 @@ u32 EffectEnIceBlock_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v this->draw = EffectEnIceBlock_Draw; this->update = EffectEnIceBlock_Update; - EffectEnIceBlock_CheckIceBlockObject(this, globalCtx); + EffectEnIceBlock_CheckIceBlockObject(this, play); return 1; } -void EffectEnIceBlock_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectEnIceBlock_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; - if (EffectEnIceBlock_CheckIceBlockObject(this, globalCtx)) { + if (EffectEnIceBlock_CheckIceBlockObject(this, play)) { f32 scale = this->rScale * 0.1f * 0.01f; OPEN_DISPS(gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x06, - globalCtx->objectCtx.status[this->rObjId].segment); // object: OBJECT_ICE_BLOCK + play->objectCtx.status[this->rObjId].segment); // object: OBJECT_ICE_BLOCK - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZS(this->rRot, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -79,7 +79,7 @@ void EffectEnIceBlock_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) } } -void EffectEnIceBlock_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectEnIceBlock_Update(PlayState* play, u32 index, EffectSs* this) { this->rRot += this->rRotVel; - EffectEnIceBlock_CheckIceBlockObject(this, globalCtx); + EffectEnIceBlock_CheckIceBlockObject(this, play); } 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 ec5433b3cd..bb4cada883 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsBlastInitParams*)initParamsx) -s32 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); +s32 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); #if 0 const EffectSsInit Effect_Ss_Blast_InitVars = { 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 3d571f3f7b..7903deffab 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 @@ -8,10 +8,10 @@ #define PARAMS ((EffectSsBomb2InitParams*)initParamsx) -s32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_80978138(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_80978304(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this); +void func_80978138(PlayState* play, u32 index, EffectSs* this); +void func_80978304(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Bomb2_InitVars = { 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 6627e1c879..011d8a101c 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 @@ -13,9 +13,9 @@ #define PARAMS ((EffectSsBubbleInitParams*)initParamsx) -u32 EffectSsBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_Ss_Bubble_InitVars = { EFFECT_SS_BUBBLE, @@ -24,7 +24,7 @@ const EffectSsInit Effect_Ss_Bubble_InitVars = { static f32 sVecAdjMaximums[] = { 291.0f, 582.0f, 1600.0f }; -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; { @@ -45,8 +45,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); @@ -64,13 +64,13 @@ void EffectSsBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsBubble_Update(GlobalContext* globalCtx2, u32 index, EffectSs* this) { +void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) { WaterBox* waterBox; f32 waterSurfaceY = this->pos.y; Vec3f ripplePos; - GlobalContext* globalCtx = globalCtx2; + PlayState* play = play2; - 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; } @@ -78,21 +78,21 @@ void EffectSsBubble_Update(GlobalContext* globalCtx2, 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; label: return; } - if (((globalCtx->gameplayFrames + index) % 8) == 0) { + if (((play->gameplayFrames + index) % 8) == 0) { CollisionPoly* colPoly; u32 speed; s16 direction; f32 rVecAdjMax; - BgCheck_EntityRaycastFloor2_1(globalCtx, &globalCtx->colCtx, &colPoly, &this->pos); - speed = SurfaceType_GetConveyorSpeed(&globalCtx->colCtx, colPoly, BGCHECK_SCENE); - if ((speed != 0) && !SurfaceType_GetConveyorType(&globalCtx->colCtx, colPoly, BGCHECK_SCENE)) { - direction = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, colPoly, BGCHECK_SCENE) << 0xA; + BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos); + speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE); + if ((speed != 0) && !SurfaceType_GetConveyorType(&play->colCtx, colPoly, BGCHECK_SCENE)) { + direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA; rVecAdjMax = sVecAdjMaximums[speed - 1]; this->rVecAdjX = Math_SinS(direction) * rVecAdjMax; this->rVecAdjZ = Math_CosS(direction) * rVecAdjMax; 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 cc3531434a..ff8c54053e 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsDFireInitParams*)initParamsx) -s32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_D_Fire_InitVars = { 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 0ed0cf5f8c..616d30d03c 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsDeadDbInitParams*)initParamsx) -s32 EffectSsDeadDb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Dead_Db_InitVars = { 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 0d26eec89c..b1d6bb8af9 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsDeadDdInitParams*)initParamsx) -s32 EffectSsDeadDd_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDd_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDd_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Dead_Dd_InitVars = { 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 34bb24d285..e5079f55d7 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsDeadDsInitParams*)initParamsx) -s32 EffectSsDeadDs_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDeadDs_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Dead_Ds_InitVars = { 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 0237cfb1eb..a4aed47329 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsDtBubbleInitParams*)initParamsx) -s32 EffectSsDtBubble_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsDtBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDtBubble_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { 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 4d53619ff2..c3a72bb7fb 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 @@ -8,10 +8,10 @@ #define PARAMS ((EffectSsDustInitParams*)initParamsx) -s32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void func_809776BC(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_809777B4(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void func_809776BC(PlayState* play, u32 index, EffectSs* this); +void func_809777B4(PlayState* play, u32 index, EffectSs* this); +void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Dust_InitVars = { 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 2953789c97..49448b32ec 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsEnFireInitParams*)initParamsx) -s32 EffectSsEnFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsEnFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_En_Fire_InitVars = { 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 963c38bb92..aa5ec51402 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 @@ -8,10 +8,10 @@ #define PARAMS ((EffectSsEnIceInitParams*)initParamsx) -s32 EffectSsEnIce_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void func_8097F62C(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_8097F7EC(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsEnIce_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void func_8097F62C(PlayState* play, u32 index, EffectSs* this); +void func_8097F7EC(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_En_Ice_InitVars = { 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 1de32d6cee..e33b486f4a 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 @@ -10,9 +10,9 @@ #define PARAMS ((EffectSsExtraInitParams*)initParamsx) -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); static s16 sScores[] = { 30, 60, 100 }; @@ -28,16 +28,16 @@ static TexturePtr sPointTextures[] = { gYabusamePoint30Tex, gYabusamePoint60Tex, #define rScoreIndex regs[2] #define rScale regs[3] -u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { s32 pad; EffectSsExtraInitParams* params = PARAMS; s32 objIndex; - objIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_YABUSAME_POINT); - if ((objIndex >= 0) && (Object_IsLoaded(&globalCtx->objectCtx, objIndex))) { + objIndex = Object_GetIndex(&play->objectCtx, OBJECT_YABUSAME_POINT); + if ((objIndex >= 0) && (Object_IsLoaded(&play->objectCtx, objIndex))) { void* segBackup = gSegments[6]; - gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objIndex].segment); this->pos = params->pos; this->velocity = params->velocity; @@ -56,15 +56,15 @@ u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 0; } -void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale; void* storedSegment; scale = this->rScale / 100.0f; - storedSegment = globalCtx->objectCtx.status[this->rObjId].segment; + storedSegment = play->objectCtx.status[this->rObjId].segment; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); gSegments[6] = PHYSICAL_TO_VIRTUAL(storedSegment); @@ -72,19 +72,19 @@ void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + func_8012C2DC(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sPointTextures[this->rScoreIndex])); gSPDisplayList(POLY_XLU_DISP++, &gYabusamePointDL); - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsExtra_Update(PlayState* play, u32 index, EffectSs* this) { if (this->rTimer != 0) { this->rTimer--; } else { @@ -92,6 +92,6 @@ void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { } if (this->rTimer == 1) { - globalCtx->interfaceCtx.unk_25C = sScores[this->rScoreIndex]; + play->interfaceCtx.unk_25C = sScores[this->rScoreIndex]; } } 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 36ba13f9d8..073b6bb1d6 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsFhgFlashInitParams*)initParamsx) -s32 EffectSsFhgFlash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFhgFlash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFhgFlash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { 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 8d900162fe..ea4c47da51 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsFireTailInitParams*)initParamsx) -s32 EffectSsFireTail_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsFireTail_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Fire_Tail_InitVars = { 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 62c9455669..65b8a76ac2 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsGFireInitParams*)initParamsx) -s32 EffectSsGFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_G_Fire_InitVars = { 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 dbe61ca2fe..79cb97234c 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsGRippleInitParams*)initParamsx) -s32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGRipple_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGRipple_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_G_Ripple_InitVars = { 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 6cb6f18d8b..d465e082e7 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 @@ -8,10 +8,10 @@ #define PARAMS ((EffectSsGSpkInitParams*)initParamsx) -s32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void func_80978F40(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_80979068(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void func_80978F40(PlayState* play, u32 index, EffectSs* this); +void func_80979068(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_G_Spk_InitVars = { 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 597fce6016..210ede8f63 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsGSplashInitParams*)initParamsx) -s32 EffectSsGSplash_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsGSplash_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsGSplash_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_G_Splash_InitVars = { 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 b187c8f9c7..3a2f75606d 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsHahenInitParams*)initParamsx) -s32 EffectSsHahen_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHahen_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Hahen_InitVars = { 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 4f221abe44..7094ca4ea6 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 @@ -8,9 +8,9 @@ #define PARAMS ((EffectSsHitmarkInitParams*)initParamsx) -s32 EffectSsHitmark_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsHitmark_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsHitmark_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsHitmark_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsHitmark_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsHitmark_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Hitmark_InitVars = { 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 0fa12d248b..8b59e40fa0 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 @@ -15,16 +15,16 @@ #define PARAMS ((EffectSsIcePieceInitParams*)initParamsx) -u32 EffectSsIcePiece_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIcePiece_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this); const 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 = PARAMS; this->pos = initParams->pos; @@ -44,11 +44,11 @@ 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 = this->rScale * 0.01f; - u32 frames = globalCtx->state.frames; + u32 frames = play->state.frames; f32 alpha; OPEN_DISPS(gfxCtx); @@ -65,18 +65,18 @@ void EffectSsIcePiece_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_RotateYS(this->rYaw, MTXMODE_APPLY); Matrix_RotateXS(this->rPitch, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (s32)alpha & 0xFF); - func_800BCC68(&this->pos, globalCtx); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, - 0x20)); + func_800BCC68(&this->pos, play); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gEffIceFragmentDL); CLOSE_DISPS(gfxCtx); } -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 *= 0.85f; 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 4571bb7904..41c9c818a1 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 @@ -14,16 +14,16 @@ #define PARAMS ((EffectSsIceSmokeInitParams*)initParamsx) -u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsIceSmoke_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this); const 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 = PARAMS; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -45,32 +45,32 @@ u32 EffectSsIceSmoke_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, v return 1; } -void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; Mtx* mtx; f32 scale; - OPEN_DISPS(globalCtx->state.gfxCtx); + OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 235, 235, this->rAlpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->rScrollX * this->life, this->rScrollY * this->life, - 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, this->rScrollX * this->life, this->rScrollY * this->life, 0x20, + 0x40, 1, 0, 0, 0x20, 0x20)); 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); + mtx = Matrix_NewMtx(play->state.gfxCtx); if (mtx != NULL) { gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffIceSmokeDL); } - CLOSE_DISPS(globalCtx->state.gfxCtx); + CLOSE_DISPS(play->state.gfxCtx); } -void EffectSsIceSmoke_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this) { if (this->life < 10) { Math_StepToS(&this->rAlpha, 0, 10); } else if (this->rAlpha < 100) { 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 e93210b89d..d027f09dd1 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 @@ -16,16 +16,16 @@ #define PARAMS ((EffectSsKFireInitParams*)initParamsx) -u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this); const 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 = PARAMS; this->pos = initParams->pos; @@ -42,9 +42,9 @@ u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; f32 xzScale; f32 yScale; @@ -55,10 +55,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_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(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,19 +69,19 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } gDPPipeSync(POLY_XLU_DISP++); - Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&play->billboardMtxF); if ((index % 2) != 0) { Matrix_RotateYF(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); CLOSE_DISPS(gfxCtx); } -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 a345f0b5c3..a84b450c1d 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 @@ -22,11 +22,11 @@ #define PARAMS ((EffectSsKakeraInitParams*)initParamsx) -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsKakera_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this); -void EffectSsKakera_CheckForObject(EffectSs* this, GlobalContext* globalCtx); +void EffectSsKakera_CheckForObject(EffectSs* this, PlayState* play); const EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, @@ -41,7 +41,7 @@ KakeraColorStruct D_8097EAD8[] = { f32 D_8097EAE4[] = { 1.0f, 100.0f, 40.0f, 5.0f, 100.0f, 40.0f, 5.0f, 100.0f, 40.0f, 5.0f }; -u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsKakeraInitParams* initParams = PARAMS; this->pos = initParams->pos; @@ -58,7 +58,7 @@ u32 EffectSsKakera_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, voi break; default: this->rObjId = initParams->objId; - EffectSsKakera_CheckForObject(this, globalCtx); + EffectSsKakera_CheckForObject(this, play); break; } } else { @@ -85,8 +85,8 @@ f32 func_8097DE30(f32 center, f32 range) { return (2.0f * (Rand_ZeroOne() * range) - range) + center; } -void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 pad; f32 scale = this->rScale / 256.0f; s32 colorIndex = this->rColorIndex; @@ -94,9 +94,9 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); if (this->rObjId != KAKERA_OBJECT_DEFAULT) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { - gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); } else { - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); } } @@ -107,7 +107,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if ((((this->rReg4 >> 7) & 1) << 7) == 0x80) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C2DC(globalCtx->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); if (colorIndex >= 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, D_8097EAD8[colorIndex].lod, D_8097EAD8[colorIndex].color.r, D_8097EAD8[colorIndex].color.g, D_8097EAD8[colorIndex].color.b, 255); @@ -115,7 +115,7 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { gSPDisplayList(POLY_XLU_DISP++, this->gfx); } else { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - func_8012C28C(globalCtx->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); if (colorIndex >= 0) { gDPSetPrimColor(POLY_OPA_DISP++, 0, D_8097EAD8[colorIndex].lod, D_8097EAD8[colorIndex].color.r, D_8097EAD8[colorIndex].color.g, D_8097EAD8[colorIndex].color.b, 255); @@ -125,9 +125,9 @@ void EffectSsKakera_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsKakera_CheckForObject(EffectSs* this, GlobalContext* globalCtx) { - this->rObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, this->rObjId); - if ((this->rObjBankIndex < 0) || (!Object_IsLoaded(&globalCtx->objectCtx, this->rObjBankIndex))) { +void EffectSsKakera_CheckForObject(EffectSs* this, PlayState* play) { + this->rObjBankIndex = Object_GetIndex(&play->objectCtx, this->rObjId); + if ((this->rObjBankIndex < 0) || (!Object_IsLoaded(&play->objectCtx, this->rObjBankIndex))) { this->life = 0; this->draw = NULL; } @@ -303,9 +303,9 @@ s32 func_8097E698(EffectSs* this) { } } -void func_8097E7E0(EffectSs* this, GlobalContext* globalCtx) { +void func_8097E7E0(EffectSs* this, PlayState* play) { static f32 D_8097EB64[] = { 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) << 4) == (1 << 4)) { @@ -330,7 +330,7 @@ void func_8097E7E0(EffectSs* this, GlobalContext* globalCtx) { break; case 1: if ((this->velocity.y < 0.0f) && - (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_8097EB64[(this->rReg4 >> 2) & 3]))) { + (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_8097EB64[(this->rReg4 >> 2) & 3]))) { this->velocity.x *= func_8097DE30(0.9f, 0.2f); this->velocity.y *= -0.8f; this->velocity.z *= func_8097DE30(0.9f, 0.2f); @@ -340,7 +340,7 @@ void func_8097E7E0(EffectSs* this, GlobalContext* globalCtx) { } break; case 2: - if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->pos, D_8097EB64[(this->rReg4 >> 2) & 3])) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->pos, D_8097EB64[(this->rReg4 >> 2) & 3])) { this->rReg8 = 0; } break; @@ -348,7 +348,7 @@ void func_8097E7E0(EffectSs* this, GlobalContext* globalCtx) { } } -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 += 0x47B; @@ -367,8 +367,8 @@ void EffectSsKakera_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) if (!func_8097E698(this)) { this->life = 0; } - func_8097E7E0(this, globalCtx); + func_8097E7E0(this, play); if (this->rObjId != KAKERA_OBJECT_DEFAULT) { - EffectSsKakera_CheckForObject(this, globalCtx); + EffectSsKakera_CheckForObject(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 4c7c01ca36..97899ae68b 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 @@ -23,18 +23,18 @@ #define PARAMS ((EffectSsKirakiraInitParams*)initParamsx) -u32 EffectSsKirakira_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void func_80977DB4(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_80977E6C(GlobalContext* globalCtx, u32 index, EffectSs* this); -void func_80977F28(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsKirakira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsKirakira_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void func_80977DB4(PlayState* play, u32 index, EffectSs* this); +void func_80977E6C(PlayState* play, u32 index, EffectSs* this); +void func_80977F28(PlayState* play, u32 index, EffectSs* this); +void EffectSsKirakira_Draw(PlayState* play, u32 index, EffectSs* this); const 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 = PARAMS; this->pos = initParams->pos; @@ -80,7 +80,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 = this->rScale / 10000.0f; s32 pad; @@ -92,14 +92,14 @@ void EffectSsKirakira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) MtxF mfResult; Mtx* mtx; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetRotateRPY(&mfRot, 0, 0, this->rYaw); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRot, &mfTransBillboardRot); SkinMatrix_MtxFMtxFMult(&mfTransBillboardRot, &mfScale, &mfResult); gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -120,7 +120,7 @@ void EffectSsKirakira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void func_80977DB4(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_80977DB4(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; @@ -136,7 +136,7 @@ void func_80977DB4(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_80977E6C(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_80977E6C(PlayState* play, u32 index, EffectSs* this) { this->velocity.x *= 0.95f; this->velocity.z *= 0.95f; this->accel.x = randPlusMinusPoint5Scaled(0.2f); @@ -154,6 +154,6 @@ void func_80977E6C(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rYaw += this->rRotSpeed; } -void func_80977F28(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void func_80977F28(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 15fdcfc50a..1f70b8064f 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 @@ -22,9 +22,9 @@ #define PARAMS ((EffectSsLightningInitParams*)initParamsx) -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this); TexturePtr sLightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, @@ -38,7 +38,7 @@ const EffectSsInit Effect_Ss_Lightning_InitVars = { static s32 sIsDesegmented = false; -u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsLightningInitParams* initParams = PARAMS; s32 i; @@ -70,7 +70,7 @@ u32 EffectSsLightning_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, return 1; } -void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s32 yaw, EffectSs* this) { +void EffectSsLightning_NewLightning(PlayState* play, Vec3f* pos, s32 yaw, EffectSs* this) { EffectSs newLightning; EffectSS_Delete(&newLightning); @@ -80,11 +80,11 @@ void EffectSsLightning_NewLightning(GlobalContext* globalCtx, Vec3f* pos, s32 ya newLightning.rYaw = yaw; newLightning.life = newLightning.rLifespan; - EffectSS_Copy(globalCtx, &newLightning); + EffectSS_Copy(play, &newLightning); } -void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfResult; MtxF mfTrans; MtxF mfScale; @@ -109,7 +109,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) xzScale = yScale * 0.6f; SkinMatrix_SetScale(&mfScale, xzScale, yScale, xzScale); SkinMatrix_SetRotateRPY(&mfRot, this->vec.x, this->vec.y, this->rYaw); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRot, &mfTransBillboardRot); SkinMatrix_MtxFMtxFMult(&mfTransBillboardRot, &mfScale, &mfResult); @@ -130,7 +130,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) CLOSE_DISPS(gfxCtx); } -void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsLightning_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; Vec3f pos; s32 yaw; @@ -145,13 +145,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_Sbn/z_eff_ss_sbn.c b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c index 2e8646a54f..d1a22473f1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c @@ -22,10 +22,10 @@ #define PARAMS ((EffectSsSbnInitParams*)initParamsx) -u32 EffectSsSbn_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSbn_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSbn_DrawSliding(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSbn_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSbn_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSbn_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsSbn_DrawSliding(PlayState* play, u32 index, EffectSs* this); +void EffectSsSbn_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_Ss_Sbn_InitVars = { EFFECT_SS_SBN, @@ -44,7 +44,7 @@ static TexturePtr sTextures[] = { gEffPoppedDekuBubble4Tex, gEffPoppedDekuBubble5Tex, }; -u32 EffectSsSbn_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsSbn_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsSbnInitParams* initParams = PARAMS; CollisionPoly* colPoly; MtxF mtx; @@ -120,8 +120,8 @@ u32 EffectSsSbn_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* return 1; } -void EffectSsSbn_DrawSliding(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsSbn_DrawSliding(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mtx; f32 scale = this->rScale * 0.001f; s32 pad; @@ -149,20 +149,20 @@ void EffectSsSbn_DrawSliding(GlobalContext* globalCtx, u32 index, EffectSs* this this->rScroll += this->rScrollStep; } else { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffPoppedDekuBubbleSliding12Tex)); - if ((this->rScrollStep >= 2) && ((globalCtx->state.frames % 2) == 0)) { + if ((this->rScrollStep >= 2) && ((play->state.frames % 2) == 0)) { this->rScrollStep--; } this->rScroll += this->rScrollStep; } gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->rScroll, 0x20, 0x20)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->rScroll, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gEffPoppedDekuBubbleSlidingDL); CLOSE_DISPS(gfxCtx); } -void EffectSsSbn_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; +void EffectSsSbn_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mtx; f32 scale = this->rScale * 0.001f; @@ -194,7 +194,7 @@ void EffectSsSbn_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsSbn_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsSbn_Update(PlayState* play, u32 index, EffectSs* this) { if (this->life < 10) { this->rAlpha -= 20; } else if (this->life >= 45) { 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 5d30ecf046..4dbdc65a2f 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 @@ -21,16 +21,16 @@ #define PARAMS ((EffectSsSibukiInitParams*)initParamsx) -u32 EffectSsSibuki_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this); const 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 = PARAMS; this->pos = initParams->pos; @@ -61,8 +61,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); @@ -79,8 +79,8 @@ void EffectSsSibuki_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { - Player* player = GET_PLAYER(globalCtx); +void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this) { + Player* player = GET_PLAYER(play); s32 pad[2]; f32 xzVelScale; @@ -92,7 +92,7 @@ void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->rMoveDelay--; if (this->rMoveDelay == 0) { - s16 yaw = Camera_GetInputDirYaw(Play_GetCamera(globalCtx, CAM_ID_MAIN)); + s16 yaw = Camera_GetInputDirYaw(Play_GetCamera(play, CAM_ID_MAIN)); xzVelScale = ((200.0f + KREG(20)) * 0.01f) + ((0.1f * Rand_ZeroOne()) * (KREG(23) + 20.0f)); 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 c96684f0df..04afcba3f5 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,9 +8,9 @@ #define PARAMS ((EffectSsSolderSrchBallInitParams*)initParamsx) -s32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsSolderSrchBall_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +s32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this); #if 0 const EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { 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 adca906681..5d546a78fd 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 @@ -12,20 +12,20 @@ #define PARAMS ((EffectSsStickInitParams*)initParamsx) -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStick_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_Ss_Stick_InitVars = { EFFECT_SS_STICK, EffectSsStick_Init, }; -u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { +u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsStickInitParams* initParams = PARAMS; Vec3f pos; - this->rObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_KEEP); + this->rObjBankIndex = Object_GetIndex(&play->objectCtx, GAMEPLAY_KEEP); pos = initParams->pos; this->pos = pos; this->vec = pos; @@ -40,9 +40,9 @@ u32 EffectSsStick_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void return 1; } -void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { +void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); @@ -51,12 +51,12 @@ void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_RotateZYX(0, this->rYaw, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_8012C28C(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->rObjBankIndex].segment); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->rObjBankIndex].segment); gSPSegment(POLY_OPA_DISP++, 0x0C, D_801C0850); gSPDisplayList(POLY_OPA_DISP++, gDekuStickDL); CLOSE_DISPS(gfxCtx); } -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 abcd52393c..ad61166d36 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 @@ -11,9 +11,9 @@ #define rReg0 regs[0] -u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); -void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); -void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); +u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this); const EffectSsInit Effect_Ss_Stone1_InitVars = { EFFECT_SS_STONE1, @@ -37,7 +37,7 @@ static EffStoneDrawInfo sDrawInfo[] = { { gEffStone1Tex, { 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 = PARAMS; Vec3f pos = initParams->pos; @@ -51,8 +51,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; @@ -60,7 +60,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx); - 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); @@ -75,7 +75,7 @@ void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { CLOSE_DISPS(gfxCtx); } -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_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index df16aae5bf..eac0b8f59b 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -82,7 +82,7 @@ void Daytelop_Update(DaytelopContext* this, GameState* gameState) { state->running = 0; } - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); gSaveContext.save.time = CLOCK_TIME(6, 0); D_801BDBC8 = 0xFE; } else if (this->transitionCountdown == 90) { diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c705cb7088..cf8c4f93c5 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -26,7 +26,7 @@ void Opening_SetupForTitleCutscene(OpeningContext* this) { GameState* thisx = &this->gameState; thisx->running = false; } - SET_NEXT_GAMESTATE(&this->gameState, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->gameState, Play_Init, PlayState); gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index ea650803e5..d4247ca610 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -59,7 +59,7 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { GameState* gameState = &this->state; gameState->running = false; } while (0); - SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext); + SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } // "Translation" ("Actual name") diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7b3b9a12d3..8be063ba13 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -552,7 +552,7 @@ 0x800AF050:("EffectTireMark_Update",), 0x800AF284:("EffectTireMark_SetVertices",), 0x800AF310:("EffectTireMark_Draw",), - 0x800AF710:("Effect_GetGlobalCtx",), + 0x800AF710:("Effect_GetPlayState",), 0x800AF720:("Effect_GetByIndex",), 0x800AF87C:("Effect_InitStatus",), 0x800AF890:("Effect_Init",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index d643adfcbb..78f9582310 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -930,7 +930,7 @@ 0x801BD8B6:("actorCutsceneCurrentCamera","s16","",0x2), 0x801BD8B8:("actorCutsceneCurrentCutsceneActor","Actor*","",0x4), 0x801BD8BC:("actorCutsceneStartMethod","UNK_TYPE4","",0x4), - 0x801BD8C0:("actorCutscenesGlobalCtxt","GlobalContext*","",0x4), + 0x801BD8C0:("actorCutscenesPlayState","PlayState*","",0x4), 0x801BD8C4:("actorCutsceneReturnCamera","s16","",0x2), 0x801BD8C6:("D_801BD8C6","s16","",0x2), 0x801BD8D0:("sFireObjCollisionInit","ColliderCylinderInit","",0x2c), diff --git a/tools/namefixer.py b/tools/namefixer.py index b273b05cae..78711fbdfd 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -19,6 +19,7 @@ simpleReplace = { # Custom behaviour can be enabled by using a tuple as the value (see # explanation in replace_single below) wordReplace = { + # Functions "Actor_GetSwitchFlag": "Flags_GetSwitch", "atan_flip": "Math_Acot2F", "atans": "Math_Atan2S", @@ -539,11 +540,20 @@ wordReplace = { "EffectSsKiraKira_SpawnSmall": "EffectSsKirakira_SpawnSmall", "EffectSsKiraKira_SpawnDispersed": "EffectSsKirakira_SpawnDispersed", "EffectSsKiraKira_SpawnFocused": "EffectSsKirakira_SpawnFocused", + "Effect_GetGlobalCtx": "Effect_GetPlayState", "func_800E8F08": "Actor_TrackNone", "func_800E8FA4": "Actor_TrackPoint", "func_800E9250": "Actor_TrackPlayer", + # Structs + "ActorAnimationEntry": "AnimationInfo", + "ActorAnimationEntryS": "AnimationInfoS", + "struct_80B8E1A8": "AnimationSpeedInfo", + "GlobalContext": "PlayState", + "globalCtx": "play", + "globalCtx2": "play2", + # Struct members "skelAnime.unk03": "skelAnime.taper", "skelAnime.animCurrentSeg": "skelAnime.animation", @@ -605,19 +615,19 @@ wordReplace = { "csCtx.npcActions": "csCtx.actorActions", "csCtx->npcActions": "csCtx->actorActions", "csCtx.unk_12": "csCtx.currentCsIndex", - "globalCtx->mf_187FC": "globalCtx->billboardMtxF", - "globalCtx->projectionMatrix": "globalCtx->viewProjectionMtxF", - "globalCtx->actorCtx.actorList[": "globalCtx->actorCtx.actorLists[", - "globalCtx->envCtx.unk_8C": "globalCtx->envCtx.lightSettings", - "globalCtx->envCtx.unk_E5": "globalCtx->envCtx.fillScreen", - "globalCtx->envCtx.unk_E6": "globalCtx->envCtx.screenFillColor", - "globalCtx->envCtx.unk_C3": "globalCtx->envCtx.lightSettingOverride", - "globalCtx->envCtx.unk_DC": "globalCtx->envCtx.lightBlend", + "play->mf_187FC": "play->billboardMtxF", + "play->projectionMatrix": "play->viewProjectionMtxF", + "play->actorCtx.actorList[": "play->actorCtx.actorLists[", + "play->envCtx.unk_8C": "play->envCtx.lightSettings", + "play->envCtx.unk_E5": "play->envCtx.fillScreen", + "play->envCtx.unk_E6": "play->envCtx.screenFillColor", + "play->envCtx.unk_C3": "play->envCtx.lightSettingOverride", + "play->envCtx.unk_DC": "play->envCtx.lightBlend", - "globalCtx->msgCtx.unk1202A": "globalCtx->msgCtx.ocarinaMode", - "globalCtx->msgCtx.unk1202C": "globalCtx->msgCtx.ocarinaAction", - "globalCtx->msgCtx.unk11F22": "globalCtx->msgCtx.msgMode", - "globalCtx->msgCtx.unk11F04": "globalCtx->msgCtx.currentTextId", + "play->msgCtx.unk1202A": "play->msgCtx.ocarinaMode", + "play->msgCtx.unk1202C": "play->msgCtx.ocarinaAction", + "play->msgCtx.unk11F22": "play->msgCtx.msgMode", + "play->msgCtx.unk11F04": "play->msgCtx.currentTextId", "D_801D15B0" : "gZeroVec3f", "D_801D15BC" : "gZeroVec3s", @@ -627,11 +637,6 @@ wordReplace = { "D_04022B28" : "gDoorSkel", "D_04023100" : "gDoorCol", - # Structs - "ActorAnimationEntry": "AnimationInfo", - "ActorAnimationEntryS": "AnimationInfoS", - "struct_80B8E1A8": "AnimationSpeedInfo", - # Macros "CUR_EQUIP_VALUE_VOID": "GET_CUR_EQUIP_VALUE", "CUR_UPG_VALUE_VOID": "GET_CUR_UPG_VALUE", @@ -639,7 +644,7 @@ wordReplace = { "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,", # Example of custom behaviour: - # "PLAYER": ("GET_PLAYER(globalCtx)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames + # "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames } # [a-zA-Z0-9_] diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 03717a0204..ea5d57b315 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -66,7 +66,7 @@ asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Destroy.s,EffectTireMark_D asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Update.s,EffectTireMark_Update,0x800AF050,0x8D asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_SetVertices.s,EffectTireMark_SetVertices,0x800AF284,0x23 asm/non_matchings/code/z_eff_tire_mark/EffectTireMark_Draw.s,EffectTireMark_Draw,0x800AF310,0x100 -asm/non_matchings/code/z_effect/Effect_GetGlobalCtx.s,Effect_GetGlobalCtx,0x800AF710,0x4 +asm/non_matchings/code/z_effect/Effect_GetPlayState.s,Effect_GetPlayState,0x800AF710,0x4 asm/non_matchings/code/z_effect/Effect_GetByIndex.s,Effect_GetByIndex,0x800AF720,0x57 asm/non_matchings/code/z_effect/Effect_InitStatus.s,Effect_InitStatus,0x800AF87C,0x5 asm/non_matchings/code/z_effect/Effect_Init.s,Effect_Init,0x800AF890,0x34